Page 2 of 2

Re: Issue Monitoring Oracle Processes with 'check_procs'

Posted: Tue Apr 05, 2022 10:20 am
by gsmith
HI

Could you please provide the check_ncpa.py command you are using with check_procs ?

Thank you

Re: Issue Monitoring Oracle Processes with 'check_procs'

Posted: Tue Apr 05, 2022 10:44 am
by lazzarinof
Good morning,

Of course! First, I tried to use the GUI (because no point reinventing the wheel if it's built in), but without success. Then I've been working with the below (with the correct IP and Token, but I scrubbed those).

Code: Select all

$ /usr/local/nagios/libexec/check_ncpa.py -H x.x.x.x -t 'Token' -P 5693 -M 'processes' -q 'name=ora_pmon_cetsdevcdb' -w '1:' -c '1:'

Thank you,
-Frank

Re: Issue Monitoring Oracle Processes with 'check_procs'

Posted: Tue Apr 05, 2022 3:44 pm
by gsmith
Hi

When you use check_ncpa.py the way you have shown it is counting the number of oracle processes you have running (in your case 473).

So on the remote machine it is running something like:
ps -ef | grep oracle | wc -l

What you would need to do is to have a script (or multiple scripts) on the remote machine that do something like:

Code: Select all

#!/bin/bash
output=`ps -ef | grep xfs | grep $1 |  wc -l`
re='^[0-9]+$'
if ! [[ $output =~ $re ]] ; then
   echo "error: Not a number"; exit 1
fi
echo "Number of Oracle $1 processes is $output"
exit 0

And then from the XI server run:
./check_ncpa.py -H 192.168.23.86 -t 'mytoken' -P 5693 -M 'plugins/myscript.sh' -a 'ora_pmon_cetsdevcdb' -w '10' -c '15'

The script gets all the oracle processes and then only counts the ones that have the argument following the -a option,
so in the above check_ncpa.py command it would count all the processes with "oracle" and "ora_pmon_cetsdevcdb" in
the output of the ps command.

Thanks