Newbie help. Setting up WMI monitoring on process.

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
pipv
Posts: 6
Joined: Tue Mar 26, 2013 12:00 pm

Newbie help. Setting up WMI monitoring on process.

Post 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 :)
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

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

Post by slansing »

Are you able to make this function with another service? What happens when you run the command from the command line?
pipv
Posts: 6
Joined: Tue Mar 26, 2013 12:00 pm

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

Post 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
pipv
Posts: 6
Joined: Tue Mar 26, 2013 12:00 pm

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

Post 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?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
pipv
Posts: 6
Joined: Tue Mar 26, 2013 12:00 pm

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

Post 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 :)
Locked