Remote host not result not reflecting on Nagios Portal

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.
Locked
ritika.laddha
Posts: 5
Joined: Thu Mar 15, 2012 5:51 am

Remote host not result not reflecting on Nagios Portal

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Remote host not result not reflecting on Nagios Portal

Post 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?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
ritika.laddha
Posts: 5
Joined: Thu Mar 15, 2012 5:51 am

Re: Remote host not result not reflecting on Nagios Portal

Post 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.
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: Remote host not result not reflecting on Nagios Portal

Post 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.
ritika.laddha
Posts: 5
Joined: Thu Mar 15, 2012 5:51 am

Re: Remote host not result not reflecting on Nagios Portal

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