(Return code of 255 is out of bounds)

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.
ebp12100
Posts: 45
Joined: Thu Oct 30, 2014 11:33 am

(Return code of 255 is out of bounds)

Post by ebp12100 »

I'm setting up a Linux server running CentOS 6.9 that is being recognized on the Nagios Core web interface, but the services for this new target client are throwing service alerts. The error shown for those services is in the subject line of this topic: (Return code of 255 is out of bounds)

I'm leaning toward it being some type nrpe issue but have researched that piece but nothing I've tried has worked thus far. If someone is familiar with this alert could you point me toward a solution?

Many Thanks!

Ed
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: (Return code of 255 is out of bounds)

Post by lmiltchev »

Can you show us how your command is configured on the remote box? Also, show us the actual check, run from the command line on the Nagios server, along with the output of it.
Be sure to check out our Knowledgebase for helpful articles and solutions!
ebp12100
Posts: 45
Joined: Thu Oct 30, 2014 11:33 am

Re: (Return code of 255 is out of bounds)

Post by ebp12100 »

Hi, and thanks for the reply.

Could you be a little more specific as the actual file names and contents you're asking for on both the host and client?

Thanks!
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: (Return code of 255 is out of bounds)

Post by lmiltchev »

OK, here's an example:

The "check_users" command that is defined on the remote box:

Code: Select all

command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
The "Users" service definition on the nagios server:

Code: Select all

define service {
    host_name                MyHost
    service_description      Users
    use                      MyTemplate
    check_command            check_nrpe!check_users!-a '-w 2 -c 3'
    ...
}
The actual check, run from the command line on the nagios server, along with the output of it:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_users -a '-w 2 -c 3'
USERS OK - 1 users currently logged in |users=1;2;3;0
Be sure to check out our Knowledgebase for helpful articles and solutions!
ebp12100
Posts: 45
Joined: Thu Oct 30, 2014 11:33 am

Re: (Return code of 255 is out of bounds)

Post by ebp12100 »

Per your request:

The "check_users" command that is defined on my remote box:

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -r -w .15,.10,.05 -c .30,.25,.20
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200

# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for
# command arguments *AND* the dont_blame_nrpe directive in this
# config file is set to '1'. This poses a potential security risk, so
# make sure you read the SECURITY file before doing this.

### MISC SYSTEM METRICS ###
#command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
#command[check_load]=/usr/local/nagios/libexec/check_load $ARG1$
#command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
#command[check_swap]=/usr/local/nagios/libexec/check_swap $ARG1$
#command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$
#command[check_mem]=/usr/local/nagios/libexec/custom_check_mem -n $ARG1$


The "Users" service definition on the nagios server:

define service{
use generic-service
host_name io
service_description Current Users
check_command check_nrpe!check_users
contact_groups linux-admins,linux-admins-text
}

The actual check, run from the command line on the nagios server, along with the output of it:

[root:/usr/local/nagios/etc/servers]$ /usr/local/nagios/libexec/check_nrpe -H 155.42.51.41 -c check_users -a '-w 2 -c 3'

connect to address 155.42.51.41 port 5666: Connection refused
connect to host 155.42.51.41 port 5666: Connection refused
(Nagios-server)[root:/usr/local/nagios/etc/servers]$


/etc/services file on remote server does contains the line below

nrpe 5666/tcp # NRPE/Nagios
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: (Return code of 255 is out of bounds)

Post by lmiltchev »

Your arguments are "hard-coded" in your command, so you would need to run:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 155.42.51.41 -c check_users
Can you run the commands below on the nagios server successfully?

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 155.42.51.41
nmap 155.42.51.41 -p 5666
Is NRPE running under xinetd or as a "stand-alone" daemon on the remote machine? What is the output of the following commands, run on the NRPE box?

Code: Select all

ps axuw | grep nrpe
netstat -at | grep nrpe
Note: You need to add your Nagios server's IP address to the "allowed_hosts" line in the nrpe.cfg file (if NRPE is running as a "stand-alone" daemon) or add it to the "only_from" directive in the "/etc/xinetd.d/nrpe" file (if NRPE is running under xinetd) if you haven't done this already. Then, you will need to restart the nrpe service or xinetd so that changes cat take effect.

Do you have a firewall, e.g.iptables or firewalld or selinux enabled on the server and the client machines?
Be sure to check out our Knowledgebase for helpful articles and solutions!
ebp12100
Posts: 45
Joined: Thu Oct 30, 2014 11:33 am

Re: (Return code of 255 is out of bounds)

Post by ebp12100 »

I've attached a screen capture of what I'm seeing on the web interface
Attachments
Nagios Core web interface
Nagios Core web interface
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: (Return code of 255 is out of bounds)

Post by tgriep »

From your earlier post when you ran the the example commands, this message was displayed.
connect to address 155.42.51.41 port 5666: Connection refused
That means that the remote system is blocking the connection with the firewall or that the NRPE Agent is not configured to listen to the Nagios server or that the NRPE agent is not running at all.

Can you verify that the firewall is setup to allow inbound connections to port 5666.

Depending on where the NRPE package came from, the configuration files could be in various folders so can you run the following commands as root on that remote server and post the output?

Code: Select all

netstat -anp |grep 5666
ps -ef |grep nrpe
You may also want to look at the NRPE troubleshooting articles at this link.
https://support.nagios.com/kb/category.php?id=93
Thanks
Be sure to check out our Knowledgebase for helpful articles and solutions!
ebp12100
Posts: 45
Joined: Thu Oct 30, 2014 11:33 am

Re: (Return code of 255 is out of bounds)

Post by ebp12100 »

The "check_users" command that is defined on my remote box:

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -r -w .15,.10,.05 -c .30,.25,.20
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
# command[check_mysql]=/usr/local/nagios/libex/check_mysql -w 20% -c 10%

# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for
# command arguments *AND* the dont_blame_nrpe directive in this
# config file is set to '1'. This poses a potential security risk, so
# make sure you read the SECURITY file before doing this.

### MISC SYSTEM METRICS ###
#command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
#command[check_load]=/usr/local/nagios/libexec/check_load $ARG1$
#command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
#command[check_swap]=/usr/local/nagios/libexec/check_swap $ARG1$
#command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$
#command[check_mem]=/usr/local/nagios/libexec/custom_check_mem -n $ARG1$


The "Users" service definition on the nagios server

define service{
use generic-service
host_name io
service_description Current Users
check_command check_nrpe!check_users
contact_groups linux-admins,linux-admins-text
}

The actual check, run from the command line on the nagios server, along with the output of it:

[root:/usr/local/nagios/etc/servers]$ /usr/local/nagios/libexec/check_nrpe -H 155.42.51.41 -c check_users -a '-w 2 -c 3'

connect to address 155.42.51.41 port 5666: Connection refused
connect to host 155.42.51.41 port 5666: Connection refused
(Nagios-server)[root:/usr/local/nagios/etc/servers]$



/etc/services file on remote server contains the line below
nrpe 5666/tcp # NRPE/Nagiios



Your arguments are "hard-coded" in your command, so you would need to run (from the Nagios server):

/usr/local/nagios/libexec/check_nrpe -H 155.42.51.41 -c check_users

connect to address 155.42.51.41 port 5666: Connection refused
connect to host 155.42.51.41 port 5666: Connection refused


Can you run the commands below on the nagios server successfully?

/usr/local/nagios/libexec/check_nrpe -H 155.42.51.41
[root:/usr/local/nagios/etc/servers]$ /usr/local/nagios/libexec/check_nrpe -H 155.42.51.41
connect to address 155.42.51.41 port 5666: Connection refused
connect to host 155.42.51.41 port 5666: Connection refused

nmap 155.42.51.41 -p 5666
Starting Nmap 6.40 ( http://nmap.org ) at 2018-04-12 14:22 EDT
Nmap scan report for io.ccv.vsc.edu (155.42.51.41)
Host is up (0.00028s latency).
PORT STATE SERVICE
5666/tcp closed nrpe
MAC Address: 00:0C:29:2E:18:85 (VMware)

Nmap done: 1 IP address (1 host up) scanned in 0.18 seconds

Is NRPE running under xinetd or as a "stand-alone" daemon on the remote machine?
What is the output of the following commands, run on the NRPE box?

ps axuw | grep nrpe
[root:/etc/sysconfig]# ps axuw | grep nrpe
root 28788 0.0 0.0 105372 844 pts/0 S+ 14:26 0:00 grep nrpe
(io)[root:/etc/sysconfig]#

netstat -at | grep nrpe
[root:/etc/sysconfig]# netstat -at | grep nrpe
[root:/etc/sysconfig]#


You need to add your Nagios server's IP address to the "allowed_hosts" line in the nrpe.cfg file (if NRPE is running as a "stand-alone" daemon) or add it to the "only_from" directive in the "/etc/xinetd.d/nrpe" file (if NRPE is running under xinetd) if you haven't done this already.

Then, you will need to restart the nrpe service or xinetd so that changes can take effect.
Ran service xinetd restart (this was successful on the target server)

Do you have a firewall, e.g.iptables or firewalld or selinux enabled on the server and the client machines? Yes, on both the target host and the Nagios server.

Entry on the Nagios server’s iptables file:
# target host
-A RH-Firewall-1-INPUT -s 155.42.51.41 -j ACCEPT

Entry on the Target server iptables file:
#Nagios server
-A INPUT -s 155.42.51.60 -j ACCEPT
Followed by running the command below on both target and nagio server:
Iptables-restore <iptables


Ran on target server
[root:/usr/local/nagios/etc]# netstat -anp | grep 5666
[root:/usr/local/nagios/etc]#
[root:/usr/local/nagios/etc]# ps -ef | grep nrpe
root 29528 25053 0 15:12 pts/0 00:00:00 grep nrpe
[root:/usr/local/nagios/etc]#

I did notice the nrpe service seems to be unknown to the target server. Should I just reinstall nrpe?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: (Return code of 255 is out of bounds)

Post by lmiltchev »

It doesn't seem that nrpe is running on the remote system...

What guide did you use to install nrpe on this box?

Please post the entire /usr/local/nagios/etc/nrpe.cfg file from the remote machine and /etc/xinetd.d/nrpe (if present) on the forum, wrapped in code wraps.

Also, run the following command on the remote box, and show the output:

Code: Select all

find / -name nrpe
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked