Return Code 255 Out of Bounds from Nagios but not CMD line

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.
brayshawuk
Posts: 7
Joined: Fri Sep 05, 2014 6:39 am

Return Code 255 Out of Bounds from Nagios but not CMD line

Post by brayshawuk »

Hi, hoping someone can help. after much searching I found similar but not the same problems

I am having a problem running checks against a remote Linux server using check_nrpe. This works fine from the command line, but not when initiated from Nagios web

Here is the settings/checks on my monitored server:

configured in nrpe.cfg:
command[check_xvda1]=/usr/local/nagios/libexec/check_disk -w 10% -c 5% -p /dev/xvda1

locahost host is fine:
./check_nrpe -H localhost
NRPE v2.15
./check_nrpe -H localhost -c check_xvda1
DISK OK - free space: / 27129 MB (36% inode=10%);| /=46359MB;68940;72770;0;76601

And here is my Nagios host server:

From the command line:
./check_nrpe -H <remote_ip> -p 5666 -c check_xvda1
DISK OK - free space: / 27129 MB (36% inode=10%);| /=46359MB;68940;72770;0;76601

Another remote server (working):
./check_nrpe -H <remote_ip> -p 5666 -c check_xvda1
DISK CRITICAL - free space: / 416 MB (0% inode=96%);| /=76120MB;72569;76601;0;80633

However Nagios result is: (Return code of 255 is out of bounds)

The command I have setup (nconf) is: $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c $ARG1$

This command is used in an advanced service assigned to two remote Linux boxes. As I can use the check from the command line, I am confident it is not a firewall/port/"anything else people randomly come up with" issue. The same process was using to install nrpe on both the remote Linux boxes

Thanks in advance
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Return Code 255 Out of Bounds from Nagios but not CMD li

Post by eloyd »

Despite what you say, I'll bet a beer that it's a user/firewall/sudo problem. What happens when you run this command as the nagios user on your Nagios server?

Code: Select all

 ./check_nrpe -H <remote_ip> -p 5666 -c check_xvda1
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
brayshawuk
Posts: 7
Joined: Fri Sep 05, 2014 6:39 am

Re: Return Code 255 Out of Bounds from Nagios but not CMD li

Post by brayshawuk »

Thanks for quick response, however:

nagios@server:/usr/local/nagios/libexec$ ./check_nrpe -H <remote_ip> -p 5666 -c check_xvda1
DISK OK - free space: / 27129 MB (36% inode=10%);| /=46359MB;68940;72770;0;76601

:?
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Return Code 255 Out of Bounds from Nagios but not CMD li

Post by eloyd »

Okay, I'll give this another shot. :-)

You say your nrpe.cfg command definition is:

Code: Select all

command[check_xvda1]=/usr/local/nagios/libexec/check_disk -w 10% -c 5% -p /dev/xvda1
If that's the case, there are no parameters or variables in there - it is all hard-coded with specific thresholds and disk names. Yet in your Nagios command definition, you have the following:

Code: Select all

$USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c $ARG1$
That only shows the command definition, but not the service definition. Would it be possible to be the check_command defined for the service to make sure it's matching up with what you've defined in commands.cfg and nrpe.cfg?

I'm guessing at this point that you have a disconnect between all of the configuration files.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
brayshawuk
Posts: 7
Joined: Fri Sep 05, 2014 6:39 am

Re: Return Code 255 Out of Bounds from Nagios but not CMD li

Post by brayshawuk »

the command is defined in the monitored servers nrpe.cfg, therefore it is a command alias (sorry if didn't make this clear) - the command alias is "check_xvda1" so on nagios you only need to supply the host address and command alias. there are examples in the nrpe.cfg and some predefined.

therefore on the nagios server you define the command as: $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c $ARG1$

where $hostaddress$ will be the remote servers address, and $arg1$ will be the command alias "check_xvda1", you can see this in my original post when run from the command line. note I also tried the other other predefined command aliases with the same issue

it is the same command/advanced service that is defined to both the working and this non working remote Linux server

the servers were setup in the same way (99% sure). I do have another remote server to setup, which is configured in the same way (this is a remote test server, the next one is a remote live server). i'm hoping I won't have the same issues

thanks
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Return Code 255 Out of Bounds from Nagios but not CMD li

Post by tmcdonald »

On the remote system (the one which is having issues) please run the following and post the output:

Code: Select all

/usr/local/nagios/libexec/check_disk -w 10% -c 5% -p /dev/xvda1
echo $?
/usr/local/nagios/libexec/check_nrpe -H localhost -c check_xvda1
echo $?
This will show us the exit codes of the plugins.
Former Nagios employee
brayshawuk
Posts: 7
Joined: Fri Sep 05, 2014 6:39 am

Re: Return Code 255 Out of Bounds from Nagios but not CMD li

Post by brayshawuk »

already checked this, but here you go anyway

/usr/local/nagios/libexec/check_disk -w 10% -c 5% -p /dev/xvda1
DISK OK - free space: / 27129 MB (36% inode=10%);| /=46359MB;68940;72770;0;76601

echo $?
0

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_xvda1
DISK OK - free space: / 27129 MB (36% inode=10%);| /=46359MB;68940;72770;0;76601

echo $?
0

as mentioned, this all works absolutely fine from the command line both on the monitored server and the nagios host server. The problem only occurs when run from nagios web, but only on this remote server. the same command/advservice is assigned to two remote hosts - one works, and one doesn't :?
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Return Code 255 Out of Bounds from Nagios but not CMD li

Post by sreinhardt »

When you say that the command is only not working from the webui, is this when forcing a intimidate check? Are the checks updating normally otherwise on the webui, such as at their normal intervals?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
brayshawuk
Posts: 7
Joined: Fri Sep 05, 2014 6:39 am

Re: Return Code 255 Out of Bounds from Nagios but not CMD li

Post by brayshawuk »

immediate and scheduled interval checks, note it is the same template, notifications, adv service, command, etc that is used on both the working and non owkring remote server
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Return Code 255 Out of Bounds from Nagios but not CMD li

Post by eloyd »

In my experience, this is almost ALWAYS because either the NRPE server cannot be contacted or because the check cannot be executed as Nagios.

If it's working on one and not on the other, using the same check definitions and just adding another "server" to the list of servers to check, then the problem is not Nagios, it is NRPE or firewalls. I know you say it works from the command line, but I'll still bet you beer it has to do with one of the above problems.

Turn up your debugging within Nagios (/usr/local/nagios/etc/nagios.cfg) and then start watching /usr/local/nagios/var/nagios.log to see what it tells you.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
Locked