Monitoring multiples applications

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
enterdavertex
Posts: 10
Joined: Fri Aug 23, 2013 10:12 am

Monitoring multiples applications

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Monitoring multiples applications

Post 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.
Former Nagios employee
enterdavertex
Posts: 10
Joined: Fri Aug 23, 2013 10:12 am

Re: Monitoring multiples applications

Post 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 ?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Monitoring multiples applications

Post 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.
Former Nagios employee
enterdavertex
Posts: 10
Joined: Fri Aug 23, 2013 10:12 am

Re: Monitoring multiples applications

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Monitoring multiples applications

Post by tmcdonald »

Looks right to me. Did it work for you?
Former Nagios employee
Locked