Page 1 of 1

NRPE Return code of 255 is out of bounds

Posted: Mon Jul 13, 2015 3:23 am
by sib
Hi

I am getting out of bounds messages on the services if the host is down. How can I prevent this?

I already use the check_nrpe with -u to make them UNKNOWN

Code: Select all

define command {
       command_name                         check_nrpe
       command_line                         $USER1$/check_nrpe -u -H $HOSTADDRESS$ -t 50 -c $ARG1$ -a $ARG2$
}
And I only alert for warning and critical.

Still they appear as CRITICAL alert..

Re: NRPE Return code of 255 is out of bounds

Posted: Mon Jul 13, 2015 10:00 am
by abrist
Odd, when I run NRPE (with the -u flag) against non-existent hosts it times out with unknown as expected:

Code: Select all

./check_nrpe -H 10.10.10.1 -u -t 50
CHECK_NRPE: Socket timeout after 50 seconds.
echo $?
3
What version of NRPE are you running?

Re: NRPE Return code of 255 is out of bounds

Posted: Tue Jul 14, 2015 4:10 am
by sib
Looks like it is the same for me.

Probably it is during the state where the server is still running but NRPE service is already shutdown

# ./check_nrpe -H lbnss03 -u -t 10
connect to address 10.32.30.103 port 5666: Connection refused
connect to host lbnss03 port 5666: Connection refusedroot@lbnss22 [ /usr/local/nagios/libexec ]
# echo $?
255

This probably causes the out of bounds error.

Re: NRPE Return code of 255 is out of bounds

Posted: Tue Jul 14, 2015 10:19 am
by ssax
Yep, looks like it, you could always write a wrapper script that would check for that code if you really wanted it as unknown.

Re: NRPE Return code of 255 is out of bounds

Posted: Tue Jul 14, 2015 10:23 am
by jdalrymple
I suppose the logic in the way it's working is that check_nrpe isn't really intended to verify that the nrpe service is running, it's intended to check something else. Admittedly I'm getting the same results and I kind of wish I wasn't. The fix is trivial:

Code: Select all

    155         /* try to connect to the host at the given port number */
    156         if((sd=my_connect(server_name, &hostaddr, server_port, address_family,
    157                         bind_address)) < 0 ) {
    158                 exit (255);
    159                 }
    160         else {
    161                 result=STATE_OK;
    162         }

Code: Select all

[jdalrymple@nagios nrpe-2.15]$ /usr/local/nagios/libexec/check_nrpe -H testhost
connect to address 172.x.x.x port 5666: Connection refused
connect to host testhost port 5666: Connection refused[jdalrymple@nagios nrpe-2.15]$ echo $?
3
If you're so inclined.

Perhaps the more ideal solution is to do a service dependency and a

Code: Select all

[jdalrymple@nagios nrpe-2.15]$ /usr/local/nagios/libexec/check_tcp -H testhost -p 5666
connect to address testhost and port 5666: Connection refused
[jdalrymple@nagios nrpe-2.15]$ echo $?
2
FWIW - I feel the way you do about the way the plugin should behave, and I keep my own source tree for a number of other reasons. This change will be implemented in my own source tree.

Re: NRPE Return code of 255 is out of bounds

Posted: Fri Jul 17, 2015 5:34 am
by sib
Thanks for the replies. I think I will go with the service dependencies.

Re: NRPE Return code of 255 is out of bounds

Posted: Fri Jul 17, 2015 9:27 am
by jdalrymple
You're very welcome - OK to lock this topic? If you have any further questions regarding setting up those service dependencies I'd recommend starting a new topic anyway.

Re: NRPE Return code of 255 is out of bounds

Posted: Fri Jul 17, 2015 9:44 am
by sib
Is fine thank you