Attempting to Write simple check

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mbowden
Posts: 93
Joined: Thu May 03, 2012 3:52 pm

Attempting to Write simple check

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Attempting to Write simple check

Post by lmiltchev »

Can you post the actual script, so that we can review it?
Be sure to check out our Knowledgebase for helpful articles and solutions!
mbowden
Posts: 93
Joined: Thu May 03, 2012 3:52 pm

Re: Attempting to Write simple check

Post by mbowden »

I believe I have the answer, I will post back after confirming
mbowden
Posts: 93
Joined: Thu May 03, 2012 3:52 pm

Re: Attempting to Write simple check

Post 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.
Locked