Page 1 of 1

Attempting to Write simple check

Posted: Mon Dec 03, 2012 2:35 pm
by mbowden
So I am attempting to write a check that will execute a scritp on a remote box and return the exit code. I seem to be having some trouble.
I recieve 2 seperate return codes. also from the Nagios server the process completes too fast, the command being run takes 5 -10 seconds to complete

It appears that when it is called through NRPE it does not wait for the
"/u01/app/prod-sghe/brm/PROD/1.5x/engine/bin/engineconsole getstate -all >nul 2>&1"
to complete

Any help woudl be greatly appreciated

The Script;

#!/bin/bash
echo $PATH; echo $ENV
/u01/app/prod-sghe/brm/PROD/1.5x/engine/bin/engineconsole getstate -all >nul 2>&1
rc=$?
#rc=5
echo 'The BRM Engine is Up Exit Code' $rc
#env
exit $rc


Responses

########
From the Remote Server, run as the nagios user;
-bash-3.2$ /usr/local/nagios/libexec/custom_check_engine.sh

/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin

The BRM Engine is Up Exit Code 0
#######
From the Nagios server run as the nagios user
[nagios@xxx ~]$ /usr/local/nagios/libexec/check_nrpe -H prod-erpapp -t 30 -c custom_check_engine
/sbin:/usr/sbin:/bin:/usr/bin

The BRM Engine is Up Exit Code 1

Re: Attempting to Write simple check

Posted: Mon Dec 03, 2012 3:02 pm
by lmiltchev
Can you post the actual script, so that we can review it?

Re: Attempting to Write simple check

Posted: Mon Dec 03, 2012 3:05 pm
by mbowden
I believe I have the answer, I will post back after confirming

Re: Attempting to Write simple check

Posted: Tue Dec 04, 2012 9:39 am
by mbowden
Ok after completely reworking the script I have the check functioning properly. The issue was a redirect in the script that was failing, consider this question answered, Thank You.