Page 1 of 1

Add Windows Service manually to Nagios using WMI

Posted: Thu Jan 19, 2017 1:08 pm
by jimhoffmann
Running the Windows WMI Wizard and when I add a Windows 2012 R2 host and it scans the Windows services on the server, it does not find all of them. So I would like to know how to resolve this or how to manually add a Windows service to Nagios?

Re: Add Windows Service manually to Nagios using WMI

Posted: Thu Jan 19, 2017 1:24 pm
by mcapra
If you're using the latest version of Nagios XI and the Windows WMI wizard, there should be a field you can bump up to increase the number of services listed:
2017_01_19_12_23_55_Configuration_Nagios_XI.png
Try bumping that value up to 65536 and see if it now includes the service you're trying to monitor.

Re: Add Windows Service manually to Nagios using WMI

Posted: Thu Jan 19, 2017 1:33 pm
by jimhoffmann
That did not work. It looks as if the services it is picking up are the ones that are part of svchost.exe, but not the ones I want to monitor. I have an application that I have installed with services I want to monitor and was hoping to be able to do that through Nagios.

Re: Add Windows Service manually to Nagios using WMI

Posted: Thu Jan 19, 2017 1:40 pm
by mcapra
Some services cannot be monitored by WMI. If this is the case, you're probably going to need to leverage an agent of some sort (such as NSClient++).

From your Nagios XI machine, can you share the output of the command (it'll be pretty long, perhaps send it to a file), replacing the <> bits with ones specific to your environment (feel free to exclude them from your public post, I just need the command's output):

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl -H <host> -u <win_username> -p <win_password> -m checkservice -a '<service_name>' -c _Total=1: -c 0 -d
Keeping in mind that the service name is different from the display name:
2017_01_19_12_38_03_192.168.67.99_Remote_Desktop_Connection.png

Re: Add Windows Service manually to Nagios using WMI

Posted: Thu Jan 19, 2017 2:00 pm
by jimhoffmann
$ /usr/local/nagios/libexec/check_wmi_plus.pl -H <host> -u '<username>' -p '<password>' -m checkservice -a 'Adlib Process Manager' -c _Total=1: -c 0
CRITICAL - [Triggered by _Total<1] - Found 0 Services(s), 0 OK and 0 with problems (0 excluded). |&apos;Total Service Count&apos;=0;1; &apos;Service Count OK State&apos;=0; &apos;Service Count Problem State&apos;=0;0; &apos;Excluded Service Count&apos;=0;

Above is the output I get when I run the Check Command.

Re: Add Windows Service manually to Nagios using WMI

Posted: Thu Jan 19, 2017 5:57 pm
by tmcdonald
Can you run what @mcapra suggested from the command line as opposed to from within the web interface? The web interface sometimes has issues with escaping or permissions.

Re: Add Windows Service manually to Nagios using WMI

Posted: Fri Jan 20, 2017 1:18 pm
by jimhoffmann
You can close this ticket. I installed a NCPA agent on a test server and found it easier to monitor servers that way.

Re: Add Windows Service manually to Nagios using WMI

Posted: Fri Jan 20, 2017 1:58 pm
by mcapra
Sure thing, feel free to open a new thread if you have NCPA specific questions!