NetXMS Support Forum

English Support => General Support => Topic started by: theyareseven on November 27, 2017, 10:21:45 AM

Title: Easy way to monitor Services
Post by: theyareseven on November 27, 2017, 10:21:45 AM
Is there an easy way to setup discovery (like with HDD for free space ect) on a node so the system will auto scan / check services, in an ideal world I would like the system to scan for all automatic services and add them, then the standard alerts if not running ect

Thank you
Title: Re: Easy way to monitor Services
Post by: Victor Kirhenshtein on November 27, 2017, 12:47:18 PM
Hi,

most likely instance discovery for DCI creation should help (maybe with script a s a source).

Best regards,
Victor
Title: Re: Easy way to monitor Services
Post by: Tursiops on November 29, 2017, 02:18:17 PM
Hi,

Without providing a full guide (the Admin Guide, Wiki and Forum should be able to help with the details), you could use a PowerShell script to generate an ExternalList. Something like this:
$wmiServiceNames = (Get-WmiObject Win32_Service -Filter "StartMode='Auto'").Name
foreach ($wmiServiceName in $wmiServiceNames) {
    $serviceDisplayName = (Get-Service $wmiServiceName).DisplayName
    $wmiServiceName + "," + $serviceDisplayName
}

Note, the above will provide a list of Service Names and Service Display Names, separated by commas.
That way you can use instance discovery to split the two, then use DCI the parameter
System.ServiceState{instance}
while being able to use the more readable {instance-name} for the DCI description.

Going a step further, you can create an event, action and event processing rule to automatically attempt to restart a service should it not be running.

Cheers
Title: Re: Easy way to monitor Services
Post by: dmna007 on April 01, 2022, 06:45:18 PM
i'm trying to do the exact same thing to make the dci creation process for services marked as 'auto start up' a less manual undertaking.  did you get anywhere with this?  if so some screenshots would be lovely to make my life easier!  thanks