Page 1 of 1

Monitoring multiples applications

Posted: Wed Jan 29, 2014 3:34 pm
by enterdavertex
Hello there, here is the situation about the info. We have a software that barely support another one when he is open. ex explorer.exe & iexplorer.exe.
I would like to see if there is any script made for this type of suppervision,

0 or 1 of these process running = Good
Both Process Running = CRITICAL

We actually use the Check_nt for the software running, and i didn't know if there was any way to make this.

Thank you everyone and have a great day.

Re: Monitoring multiples applications

Posted: Wed Jan 29, 2014 3:36 pm
by tmcdonald
The simplest way of doing this would be to write a wrapper script that runs check_nt twice (once for each service) and then reports back to Nagios based on the number running.

Re: Monitoring multiples applications

Posted: Wed Jan 29, 2014 3:53 pm
by enterdavertex
tmcdonald wrote:The simplest way of doing this would be to write a wrapper script that runs check_nt twice (once for each service) and then reports back to Nagios based on the number running.
How is it possible ? actually i mean do you know an easy way to do this type of thing ?

Re: Monitoring multiples applications

Posted: Wed Jan 29, 2014 4:08 pm
by tmcdonald
I've just told you.

You will need to write some sort of script (perl, python, bash, whatever) that will run check_nt twice, once for each of the services you are checking for. The script you write will have some variable that increments based on whether or not a program is running. It gets this info by looking at the check_nt output. If you see "Running" you know it is running, and you increment the variable. You do this for each service, and if the result is 0 or 1 processes running you exit with OK, and if 2 are running you exit with CRITICAL.

Re: Monitoring multiples applications

Posted: Thu Jan 30, 2014 9:24 am
by enterdavertex
tmcdonald wrote:I've just told you.

You will need to write some sort of script (perl, python, bash, whatever) that will run check_nt twice, once for each of the services you are checking for. The script you write will have some variable that increments based on whether or not a program is running. It gets this info by looking at the check_nt output. If you see "Running" you know it is running, and you increment the variable. You do this for each service, and if the result is 0 or 1 processes running you exit with OK, and if 2 are running you exit with CRITICAL.
the best thing I could manage to do is :

Code: Select all

value1=$(/usr/local/nagios/libexec/check_nt -H $1 -p 12482 -v PROCSTATE -l APP1.exe)
value2=$(/usr/local/nagios/libexec/check_nt -H $1 -p 12482 -v PROCSTATE -l APP2.exe)
value3="All processes are running"
 
if [ "$value1" == "$value3" ]
then
  if [ "$value2" == "$value3" ]
  then    echo "CRITICAL"
   exit 2
  else    echo "APP 2 Work"
   exit 0
fi
else  echo "APP 1 Work"
 exit 0
fi

Re: Monitoring multiples applications

Posted: Thu Jan 30, 2014 11:28 am
by tmcdonald
Looks right to me. Did it work for you?