Monitor Windows service name based on OS version

Started by gdodd, September 28, 2016, 12:17:18 AM

Previous topic - Next topic

gdodd

I'm new to NetXMS and it is working well for our needs. I am tweaking our DCI's now and have a question.

I have Windows 2003, 2008, and 2012 servers. I have a template setup to add DCI's to the servers and that works fine. I am monitoring the windows firewall service and the name is different on 2003 ("SharedAccess") compared to 2008/2012 ("MpsSvc"). I would like to use the same template/DCI and detect if it is on 2003. I tried using an instance discovery script, but that did not work.

The script I used was:
if($node->sysDescription like "*2003*") {
$1 = "SharedAccess"
else $1 = "MpsSvc"
}
return true;

As an alternative, I tried to make separate templates with Auto apply rules. I tried this for the rule:
return $node->sysDescription like "*2003*";
and that is not working as I expect.

Any suggestions would be appreciated. Thank you.

Gary

tomaskir

#1
Try

if ($node->sysDescription ~= ".*2003.*")
  println("matches");


"~=" is a regex comparison.

gdodd

Thank you for the reply.

My original template script worked, it just took longer than expected to apply. How often is it checked to see if a template should be automatically applied? The active discovery interval?

Can you see a way to make it work so I only need one template?


tomaskir

All auto-apply functionality is executed on each node during configuration poll of that node.

You can force a conf poll on a node with right click > Poll > Configuration.

You can configure how often conf poll runs in Server Configuration - ConfigurationPollingInterval.

gdodd

I got it working.

One thing that kept tripping me up is that when I would make a change to the discovery script and then Force DCI poll, it would say that it was unsupported. So I would make more changes and that would be unsupported. I probably had it working earlier and just needed to be patient for NetXMS to do it's thing.

I had to still see if it was Windows 2003 because newer versions use both services but only the MpsSvc is the firewall.