NRPE Return code of 255 is out of bounds

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
sib
Posts: 111
Joined: Thu Dec 11, 2014 8:06 am

NRPE Return code of 255 is out of bounds

Post 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..
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NRPE Return code of 255 is out of bounds

Post 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?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
sib
Posts: 111
Joined: Thu Dec 11, 2014 8:06 am

Re: NRPE Return code of 255 is out of bounds

Post 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.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: NRPE Return code of 255 is out of bounds

Post 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.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: NRPE Return code of 255 is out of bounds

Post 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.
sib
Posts: 111
Joined: Thu Dec 11, 2014 8:06 am

Re: NRPE Return code of 255 is out of bounds

Post by sib »

Thanks for the replies. I think I will go with the service dependencies.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: NRPE Return code of 255 is out of bounds

Post 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.
sib
Posts: 111
Joined: Thu Dec 11, 2014 8:06 am

Re: NRPE Return code of 255 is out of bounds

Post by sib »

Is fine thank you
Locked