Page 1 of 1

Remote host not result not reflecting on Nagios Portal

Posted: Thu Mar 15, 2012 6:20 am
by ritika.laddha
Hi,

I have written a script to monitor few services on Remote host. The script is working fine. It is giving the right results.
But on the Nagios side, incorrect results are being displayed.
Need help identifying the issue.

Re: Remote host not result not reflecting on Nagios Portal

Posted: Thu Mar 15, 2012 4:27 pm
by scottwilkerson
You are going to have to be more specific if you would like help of this...

What displays in the console?
What displays in Nagios?
What kind of "script" is this?

Re: Remote host not result not reflecting on Nagios Portal

Posted: Fri Mar 16, 2012 3:44 am
by ritika.laddha
Hi,

I am using a shell script. The main function of my script is:

cnt = the output of the commandline that will be executed. It is the number of processes running.

if [ $cnt -eq $critical_limit ]
then
echo "OK - $proc_desc is up and running"
#return OK state
exit $STATE_OK
fi

if [ $cnt -gt $critical_limit ]
then
echo "OK - $cnt $proc_desc are running as compared to the critical limit of $critical_limit"
#return OK state
exit $STATE_OK
fi


if [ $cnt -lt $critical_limit ] && [ $cnt -gt 0 ]
then
echo "CRITICAL - Only $cnt $proc_desc is running as compared to the critical limit of $critical_limit"
#return CRITICAL state
exit $STATE_CRITICAL
fi


The script gets executed properly on the remote host (CAR). The output of the script is also correct.
The issue is, when the remote host shows as CRITICAL, on the Nagios server it still shows as OK. which is incorrect.
So I need to identify the issue.

Re: Remote host not result not reflecting on Nagios Portal

Posted: Sun Mar 18, 2012 4:38 pm
by jsmurphy
What are the values of $STATE_OK, $STATE_CRITICAL, etc? Do they have the correct return/exit codes?
OK = 0
WARNING = 1
CRITICAL = 2
UNKNOWN = 3

If the text is displaying fine then that's the only thing I can think of at the moment.

Re: Remote host not result not reflecting on Nagios Portal

Posted: Sun Mar 18, 2012 10:04 pm
by ritika.laddha
HI,

I was able to fix the issue. During debugging, I figured out that the NRPE for not running.
Second, the command passed as an argument to the script needed some correction. I had to add "grep -v grep" for precise result.

Thank you for your suggestions.