Remove PID from Windows Performance Counter

Started by jds, July 09, 2022, 06:31:33 PM

Previous topic - Next topic

jds

We are monitor some W3SVC_W3WP counters in netxms. The counters have a name format such as PID_APPPOOL. I was able to remove the PID from {instance-name} but if I remove it from {instance} the DCI doesn't work anymore. When the service restarts there is a new PID generated which creates a new DCI with the same {instance-name} but a different {instance}. What I would like to see if it's possible, is somehow keep the same DCI but allow the PID to change. The problem is we lose historical data when the new DCI is created and the old one ages out. Does anyone know of a solution for this?

Alex Kirhenshtein

Script-based DCI will be the best soluion here, I think.

Script should be something like (pseudo code):


value = null;
if (CURRENT_NAME@$node != null) { // custom attribute CURRENT_NAME on current node
  value = $node->readAgentParameter("..." . CURRENT_NAME@$node);
}
if (value == null) {
  for (item : $node->readAgentList("...")) {
    if (item match "...") {
      // correct element found
      $node->setCustomAttribute(CURRENT_NAME, item);
    }
  }

  if (CURRENT_NAME@$node != null) { // custom attribute CURRENT_NAME on current node
    value = $node->readAgentParameter("..." . CURRENT_NAME@$node);
  }
}

return value;