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.
I have one shell script, using to check two process running or not.
When i run that script on client it gives correct output (process running or not) but while running plugins from nagios server its gives opposite out-put.
Below is script :
cat check_consum_process
#!/bin/sh
#set -x
COUNT2=`ps -aef | grep -v grep | egrep 'AB.py |XX.py' | wc -l`
if
[ $COUNT2 -eq 2 ]
then
echo "AB.py/XX.py OK"
exit 0
else
echo "AB.py/XX.py NOT OK"
exit 2
fi
OUTPUT on client end.
Command :: ./check_consum_process
OUTPUT :: AB.py/XX.py OK
OUTPUT from nagios server :
command :: /usr/lib/nagios/plugins/check_nrpe -H ABC_server -c check_custom_consum_process
Output :: AB.py/XX.py NOT OK
That's an excellent point, as it would give you the ps output post greps and the count that your script is seeing! At least while debugging, I couldn't agree more!
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.
Have change the script as per suggestion.
Please let me know how to fix it.
Below is the output..
Client End Out put :
web 21887 1 1 Nov21 1 01:10:35 python ./AB.py --logging-level=debug --logging-file=XXXXXXX web 29040 1 6 Nov17 1 10:24:36 python ./XX.py --logging-level=debug --logging-file=YYYYYY 2
AB.py/XX.py OK
Server Output ::
web 21887 1 1 Nov21 ? 01:10:35 python ./AB.py --logg 1
AB.py/XX.py NOT OK
Both process running under web user & command was triggered by root users on both end (client & server ).
Server is showing count as 1 instant of 2 so i think its able to read & grep.
Please correct me if wrong.
Are you sure? NRPE commands usually run as the nagios user . . .
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.