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
Check runnig process
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Check runnig process
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
http://exchange.nagios.org/directory/Do ... in/details
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Check runnig process
Hi nag123705,
I use negate for the exact same thing you need. Below are the commands I have if they help.
commands.cfg:
services.cfg:
Good luck!
Kind Regards,
Gary Shergill
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$
}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
}Kind Regards,
Gary Shergill
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Check runnig process
Thanks for the input Gary!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Check runnig process
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?
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?
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Check runnig process
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 $?Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Check runnig process
Excellent!!! That did it.
Thank you both very much.
Thank you both very much.