Page 1 of 1

Status information unknown, but status OK and green

Posted: Thu Jun 05, 2014 8:36 am
by gsmith411
I have Nagios checking a few services on a remote host. The Status information returns "Return code of 255 is out of bounds", and yet the Status is OK with a green bar. How do I change Nagios to show me when the status is unknown? I would like the status to be yellow, or orange or anything else, but obviously the service is not OK if the return code is 255.

Ill troubleshoot the return code of 255 separately, but now do I get nagios to let me know when something is not OK. A return code of 255 indicates something is wrong, and I just want an alert of some sort to let me know that.

Thank you for the help

Re: Status information unknown, but status OK and green

Posted: Thu Jun 05, 2014 8:47 am
by eloyd
Sounds like you need to fix your service check first.

Re: Status information unknown, but status OK and green

Posted: Thu Jun 05, 2014 9:10 am
by gsmith411
Like I said, I realize I need to check why I am getting the return code of 255 and thats a whole different subject. My concern is that the service check is in an unknown state, and yet Nagios is telling me the status is OK.

BTW, I am running Nagios Core 4.0.4 on a gentoo box. This particular check is running a check_proc on a remote box via check_by_ssh. The reason it isn't working is because I failed to install the nagios plugins on the remote box. The fix is relatively easy, but the problem is that Nagios is telling me the service check status is OK when obviously, it isn't

Re: Status information unknown, but status OK and green

Posted: Thu Jun 05, 2014 10:46 am
by eloyd
Is this a Nagios supplied plugin service check or one you made yourself? If it's one you made yourself, you should really make sure that it never returns anything other than proper Nagios exit values.

Be that as it may, the only way to know what's going on is to look at your nagios log file, /usr/local/nagios/var/nagios.log (assuming default path). Is Nagios actually performing the check and logging the results?

Re: Status information unknown, but status OK and green

Posted: Thu Jun 05, 2014 1:04 pm
by gsmith411
Thanx for the quick reply. Its 2 nagios supplied checks. On the nagios server, I am running check_by_ssh. This check should log into the remote machine and run the nagios supplied script check_procs. Both are nagios supplied. I would assume they should return correct values.
The reason the Check_by_ssh script is failing is known. Its supposed to call the check_procs script on the remote host, but that check_procs script doesn't exist. Is it a problem with the check_by_ssh script that is return "OK" instead of "fail"?

Again, I can fix the problem that is causing the Return code 255. What I am trying to figure out is why Nagios says the check results are OK, when the results are unknown.

Thanx for the help

Re: Status information unknown, but status OK and green

Posted: Thu Jun 05, 2014 3:12 pm
by abrist
Very interesting. I just tested check_by_ssh against a script on my gentoo box that does not exist:

Code: Select all

[root@localhost nagios-plugins]# ./plugins/check_by_ssh -H localhost -C '/usr/local/nagios/libexec/check_not_exist'
Remote command execution failed: bash: /usr/local/nagios/libexec/check_not: No such file or directory
[root@localhost nagios-plugins]# echo $?
3
And I get the expected return of '3' (Unknown).
Can you post the full definitions for the command and service check and host?

Re: Status information unknown, but status OK and green

Posted: Thu Jun 05, 2014 5:31 pm
by eloyd
I find that stock check_by_ssh was woefully inadequate for our needs and wrote our own SSH wrapper. Among other things, it deals nicely with missing endpoint scripts and only allows commands run from a select list. As a result, it's been a long time since I've played with stock check_by_ssh, but if yours is returning incorrect status, I'm thinking that you might have an old version.

Be that as it may, I still think you need to fix this before you can look at what's going on with Nagios itself.

Re: Status information unknown, but status OK and green

Posted: Fri Jun 06, 2014 10:44 am
by scottwilkerson
eloyd wrote:I find that stock check_by_ssh was woefully inadequate for our needs and wrote our own SSH wrapper.
Any possibility of sharing this? :D

Re: Status information unknown, but status OK and green

Posted: Fri Jun 06, 2014 10:48 am
by eloyd
I maybe shouldn't have said "woefully." :-) I've PMed Andy about it, but no, I cannot share it. It was developed under NDA for a previous client of ours. In a nutshell, the deficiencies were related to the security measures in place at the client's site. We needed to be able to secure the commands executed so no arbitrary code could be put in place, and we needed to be able to use a man-in-the-middle approach to have Nagios -> SSH -> host -> SSH -> client and have the check actually run on client, not host.

Please forgive my hyperbole, and catch me at NW2014 and I'll be happy to talk in person.