Windows Service not running - Service State OK?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
adminfun
Posts: 28
Joined: Mon May 11, 2015 9:06 am
Location: Bruges

Windows Service not running - Service State OK?

Post 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!
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Windows Service not running - Service State OK?

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Windows Service not running - Service State OK?

Post 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;
adminfun
Posts: 28
Joined: Mon May 11, 2015 9:06 am
Location: Bruges

Re: Windows Service not running - Service State OK?

Post 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.
adminfun
Posts: 28
Joined: Mon May 11, 2015 9:06 am
Location: Bruges

Re: Windows Service not running - Service State OK?

Post 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.
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Windows Service not running - Service State OK?

Post by lmiltchev »

I am glad I could help! :)

Let me know if it is OK to lock this topic and mark it as resolved.
Be sure to check out our Knowledgebase for helpful articles and solutions!
adminfun
Posts: 28
Joined: Mon May 11, 2015 9:06 am
Location: Bruges

Re: Windows Service not running - Service State OK?

Post by adminfun »

The topic can be locked and marked as resolved.
Locked