Page 1 of 1

Check runnig process

Posted: Fri May 17, 2013 12:26 pm
by nag123705
Hi All,

I'm running Nagios Core 3.4.4 on Ubuntu and I want to monitor the "explorer.exe" process on a windows server. Easy enough but, I want the status to be OK when the process is NOT running. I want to monitor and get an alert every time a user logs on and off the server. I created a new service template and assign it to the service definition. I tried changing the "initial state" but I can't get it to work.

Any help would be greatly appreciated.

TIA

Re: Check runnig process

Posted: Fri May 17, 2013 1:31 pm
by sreinhardt
You should look into using the negate plugin with your existing check. I am hoping this is a "core" windows server otherwise the request to not have explorer seems a bit odd.

http://exchange.nagios.org/directory/Do ... in/details

Re: Check runnig process

Posted: Mon May 20, 2013 3:49 am
by gshergill
Hi nag123705,

I use negate for the exact same thing you need. Below are the commands I have if they help.

commands.cfg:

Code: Select all

define command {
       command_name     negate
       command_line     /usr/local/nagios/libexec/negate -o CRITICAL -w WARNING -c OK -u UNKNOWN $ARG1$
        }
services.cfg:

Code: Select all

define service{
        use                     generic-service
        host_name               hostname
        service_description     Explorer
        check_command           negate!/usr/local/nagios/libexec/check_nt -H $HOSTADDRESS$ -s password -p 12489 -v PROCSTATE -d SHOWALL -l explorer.exe
        notification_interval   0
        normal_check_interval   1
        event_handler           custom-explorer-notify
        }
Good luck!

Kind Regards,

Gary Shergill

Re: Check runnig process

Posted: Mon May 20, 2013 12:16 pm
by sreinhardt
Thanks for the input Gary!

Re: Check runnig process

Posted: Fri May 24, 2013 2:10 pm
by nag123705
Thank you both for the replies but I can't get it to work right. I'm running the following tests:

me@host:~$ /usr/local/nagios/libexec/check_nt -H 192.168.1.1 -p 12345 -v PROCSTATE -d SHOWALL -l explorer.exe
and I get:
explorer.exe: Running

i'm running:
me@host:~$ /usr/local/nagios/libexec/negate -o CRITICAL -w WARNING -c OK -u UNKNOWN /usr/local/nagios/libexec/check_nt -H 192.168.1.1 -p 12345 -v PROCSTATE -d SHOWALL -l explorer.exe
and I get:
explorer.exe: Running

What am I doing wrong?

Re: Check runnig process

Posted: Fri May 24, 2013 2:37 pm
by sreinhardt
The negate plugin only alters certain words such as critical warning, or OK. Running would not be included in that. I would suggest running your command again and following with an echo $? to show the exit code, which is the part that nagios cares about for setting check state.

Code: Select all

 /usr/local/nagios/libexec/negate -o CRITICAL -w WARNING -c OK -u UNKNOWN /usr/local/nagios/libexec/check_nt -H 192.168.1.1 -p 12345 -v PROCSTATE -d SHOWALL -l explorer.exe
echo $?

Re: Check runnig process

Posted: Fri May 24, 2013 3:12 pm
by nag123705
Excellent!!! That did it.
Thank you both very much.