Page 1 of 1

Windows Service not running - Service State OK?

Posted: Tue May 12, 2015 7:59 am
by adminfun
Dear fellow Nagios users
I recently installed a Nagios XI server and have a problem with monitoring Windows Services through WMI.
The server doesn't flag the service as critical, even though it clearly states that the service is not running.
I have this problem with all the services that I try to monitor through WMI.
This is what I get when I test the command:
COMMAND: /usr/local/nagios/libexec/check_wmi_plus.pl -H 192.9.200.200 -u 'administrator' -p 'password' -m checkservice -a 'defragsvc'
OUTPUT: OK - Found 1 Services(s), 0 OK and 1 with problems (0 excluded). 'Disk Defragmenter' (defragsvc) is Stopped.|'Total Service Count'=1; 'Service Count OK State'=0; 'Service Count Problem State'=1; 'Excluded Service Count'=0;

I'm clearly missing a setting or something but I can't seem to find what.
Mind that I'm a novice user when it comes to Nagios.
Thanks in advance!

Re: Windows Service not running - Service State OK?

Posted: Tue May 12, 2015 9:12 am
by lmiltchev
Try adding a critical threshold to your command ("-c" flag):

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl -H 192.9.200.200 -u 'administrator' -p 'password' -m checkservice -a 'defragsvc' -c 0
Let me know if this helped.

Re: Windows Service not running - Service State OK?

Posted: Tue May 12, 2015 9:15 am
by jdalrymple
Here are the parts you need from the check_wmi_plus.pl help:

Code: Select all

 Typical Usage:

 check_wmi_plus.pl -H HOSTNAME -u DOMAIN/USER -p PASSWORD -m MODE [-s SUBMODE] [-a ARG1 ] [-w WARN] [-c CRIT]

 Complete Usage:

 check_wmi_plus.pl -H HOSTNAME -u DOMAIN/USER -p PASSWORD -m MODE [-s SUBMODE] [-a ARG1 ] [-o ARG2] [-3 ARG3] [-4 ARG4] [-w WARN] [-c CRIT] [-b BYTEFACTOR] [-t TIMEOUT] [--includedata DATASPEC] [--excludedata DATASPEC] [--nodatamode] [--nodataexit NODATAEXIT] [--nodatastring NODATASTRING] [-y DELAY] [--namespace WMINAMESPACE] [--inihelp] [--inifile=INIFILE] [--inidir=INIDIR] [--nokeepstate] [--keepexpiry KEXPIRY] [--keepid KID] [-z] [-v OSVERSION] [-d] [--help] [--itexthelp]
 
 checkservice
   ARG1  A regular expression that matches against the short or long service name that can be seen in the properties of the
      service in Windows. The matching services are included in the resulting list. Use . alone to include all services.
      Use Auto to check that all automatically started services are OK.
   ARG2  A regular expression that matches against the short or long service name that can be seen in the properties of the
      service in Windows. The matching services are excluded in the resulting list.
      This exclusion list is applied after the inclusion list.
   WARN/CRIT  can be used as described below.
      Valid Warning/Critical Fields are: _NumBad (Default), _NumGood, _NumExcluded, _Total
And here is a functional example:

Code: Select all

[root@localhost libexec]# ./check_wmi_plus.pl -H <winhost> -u <user> -p <pw> -m checkservice -a spooler -w _NumBad=0
WARNING - [Triggered by _NumBad>0] - Found 1 Services(s), 0 OK and 1 with problems (0 excluded). 'Print Spooler' (Spooler) is Stopped.|'Total Service Count'=1; 'Service Count OK State'=0; 'Service Count Problem State'=1;0; 'Excluded Service Count'=0;

Re: Windows Service not running - Service State OK?

Posted: Tue May 12, 2015 9:17 am
by adminfun
Thanks everyone. I know I already posted this in a different section of this forum, so sorry for the hassle.
I'll give the suggestions a try.

Re: Windows Service not running - Service State OK?

Posted: Tue May 12, 2015 9:31 am
by adminfun
Thank you very much lmiltchev, your suggestion seems to work so far. Check the screenshot in attachment.
COMMAND: /usr/local/nagios/libexec/check_wmi_plus.pl -H 192.9.200.200 -u 'administrator' -p 'password' -m checkservice -a 'defragsvc' -c 0
OUTPUT: OK - Found 1 Services(s), 1 OK and 0 with problems (0 excluded). 'Disk Defragmenter' (defragsvc) is Running.|'Total Service Count'=1; 'Service Count OK State'=1; 'Service Count Problem State'=0;0; 'Excluded Service Count'=0;

lmiltchev wrote:Try adding a critical threshold to your command ("-c" flag):

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl -H 192.9.200.200 -u 'administrator' -p 'password' -m checkservice -a 'defragsvc' -c 0
Let me know if this helped.

Re: Windows Service not running - Service State OK?

Posted: Tue May 12, 2015 10:08 am
by lmiltchev
I am glad I could help! :)

Let me know if it is OK to lock this topic and mark it as resolved.

Re: Windows Service not running - Service State OK?

Posted: Thu Jun 18, 2015 5:02 am
by adminfun
The topic can be locked and marked as resolved.