Page 1 of 1

Newbie help. Setting up WMI monitoring on process.

Posted: Tue Mar 26, 2013 12:18 pm
by pipv
Hi people!

Recently downloaded Nagios to have it monitoring my server at home. Setup the VM and have had it monitoring just a few basic hardware items no problem.

I recently decided to setup monitoring a process (i.e. explorer.exe) which went fine, until I noticed it didn't change it status from OK when the process wasn't running. The status information notes that the amount of found instances changes from 1 to 0. I tried adding a critical flag to the argument in the CCM edit page but it didn't work.
example:
$USER1$/check_wmi_plus.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -m $ARG3$ $ARG4$

$ARG1$ username
$ARG2$ password
$ARG3$ checkprocess
$ARG4$ -s Commandline -a 'explorer.exe' -w '0' (note: I have tried many different way of doing the flag such as -w 0, -w=0, -w _ItemCount=0)

Could anyone give me advice on setting this up, if so I would be very grateful :)

Re: Newbie help. Setting up WMI monitoring on process.

Posted: Tue Mar 26, 2013 2:03 pm
by slansing
Are you able to make this function with another service? What happens when you run the command from the command line?

Re: Newbie help. Setting up WMI monitoring on process.

Posted: Tue Apr 02, 2013 3:22 am
by pipv
Hi Slansing,

Thanks for you reply. I have tried to make this function work having it monitor windows calculator but this also has the same issue, detects that it is running and when it isn't but can't not get it to throw a warning when it isn't running.

No I have not tried to run this from the command line, as I said I'm quite new to this. I'm running the Nagios virtual image which is using centos. Do you mean running the command from here?

Thanks

Re: Newbie help. Setting up WMI monitoring on process.

Posted: Tue Apr 02, 2013 8:42 am
by pipv
I have realised something with the flag.

I have managed to get it to throw a CRITICAL flag but not how I wanted it. I set the flag criteria to 0 which then threw a flag when it was running, I noticed that the _Itemcount trigger would test itself against the criteria as greater than:

CRITICAL - [Triggered by _ItemCount>0]

Is it possible to change this to less than the criteria so it will alert when its not running?

Re: Newbie help. Setting up WMI monitoring on process.

Posted: Tue Apr 02, 2013 10:09 am
by lmiltchev
Try using the "negate" plugin to reverse the results. You may try something like this:

Code: Select all

cd /usr/local/nagios/libexec
./negate -s /usr/local/nagios/libexec/check_wmi_plus.pl -H <ip -u 'username' -p 'password' -m checkprocess -s Commandline -a '<your_process>.exe' -c 0

Re: Newbie help. Setting up WMI monitoring on process.

Posted: Tue Apr 02, 2013 10:43 am
by pipv
Hi lmiltchev,

Thanks for you reply!

I just managed to fix it as I saw your post. I used a range 1:1 which then enabled a second test (which I found using a debug output in wmiplus) checking a minimum value in a less than statement.

Thank you anyway :)