Forum Discussion

mmatec01's avatar
mmatec01
Icon for Neophyte rankNeophyte
3 months ago
Solved

Windows Services Monitoring with quite a bit more Automation applied

So today we use LM's Microsoft Windows Services DataSource to monitor Windows Services.  This DS uses Groovy Script and WMI calls under the hood to fetch the service metrics like state, start mode, status, etc... Everything works fine but one of the prerequisites is to go and manually populate the list of Windows services which then the DS parses out as a WILDVALUE variable in the script. You know, go to the device, click on Down Arrow (Manage Resource Options) --> Add Additional Monitoring --> and CHOOSE from the list of Windows Services. Rinse and Repeat and Save.  Then the DS goes to work.

Well, what if you have a list of over 100 Windows Services you need to add to let's say 20 Windows devices?  That would take forever to populate that list manually... That's a problem number 1.  Scratch that. This is not really a problem since one can run a PowerShell script (or Groovy Script) to perform this task using undocumented - but working very well - LM API calls. That problem is solved.


Next - This list of over 100 Services needs to be *refreshed* every let's say 24 hours to remove nonexistent services and add new ones based on the Regex filter.  That's a problem number 2.  And again, one can do it programmatically running API calls but this is where I am trying to figure out how to do it.  Run my script as a custom PropertySource?  I am not really writing Resource Properties, I am updating instance list (Windows Services) within Additional Monitoring on bunch of Resources.  Plus PropertySources are applied when ActiveDiscovery is run which is what, every 24 hours?  Or should I write custom DataSource that would accomplish this refresh and specify 1 day collection period?

Thanks.

  • You can create a DataSource loosely based on the existing WinService Datasource and provide it with an Autodiscover section that will populate all the services and keep them up-to-date. For example auto-add any services set to autostart (with some exceptions).

    But I’m pretty sure examples of this has been shared in the forum in the past and a quick look at the Exchange shows several DataSources that might do what you want already:

    https://conres.logicmonitor.com/santaba/uiv4/modules/toolbox/exchange

2 Replies

  • You can create a DataSource loosely based on the existing WinService Datasource and provide it with an Autodiscover section that will populate all the services and keep them up-to-date. For example auto-add any services set to autostart (with some exceptions).

    But I’m pretty sure examples of this has been shared in the forum in the past and a quick look at the Exchange shows several DataSources that might do what you want already:

    https://conres.logicmonitor.com/santaba/uiv4/modules/toolbox/exchange

  • Problem #1 is exactly what this is for. If problem #2 is keeping the instances updated, it also accomplishes that by using active discovery. You can set the discovery to be at whatever rate you want, with 15 minutes being the most frequent.