Return code of 127

I had tried to test nagios for the first time. But I got an error as showed below.
[1113484913] Warning: Return code of 127 for check of service ‘PING’ on host ‘localhost’ was out of bounds. Make sure the plugin you’re trying to run actually exists.
I had checked the document it is about plugins. I tried to execute the command as nagios in terminal and checked resource.cfg (at first I think it is about the path problem).

[nagios@localhost var]$ /usr/local/nagios/libexec/check_ping -H localhost -w 200,20%
-c 300,30% -p 5 localhost
PING OK - Packet loss = 0%, RTA = 0.09 ms
I have no ideas what is the problem. Somebody please give me some direction to solve this problem. Thanks!

Csdeng 4/14/2005

from : article.gmane.org/gmane.network. … user/13639

maybe it helps.

Luca

Thanks to Luca. But I check the permission of /bin/ping. It seems OK (Login as nagios).
[nagios@localhost nagios]$ ping localhost
PING localhost.localdomain (127.0.0.1) from 127.0.0.1 : 56(84) bytes of data.
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.049 ms
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=2 ttl=64 time=0.043 ms

please post the check_ping part checkcommands.cfg and the service definition for ping on localhost.

BTW why do you check_ping localhost? it’s quite useless, if you see the webpage it is working and if it goes down it will nott report it anyway as it can’t send you an email :smiley:

Luca

Thanks again!
I just want to make sure it works(simply check localhost),then I will modify config to monitor the real servers.
Here is the check_ping in the checkcommands.cfg(I copy from the sample config file)

‘check_ping’ command definition

define command{
command_name check_ping
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
}
##############
And the services.cfg about ping

Define a service to “ping” the local machine

define service{
use generic-service ; Name of service template to use
host_name localhost
service_description PING
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups apache
notification_interval 960
notification_period 24x7
check_command check_ping!100.0,20%!500.0,60%
}
#########################

What is $USER1$ defined as in the /usr/local/nagios/etc/resource.cfg?Plus, check the permissions on the files in libexec.

In the resource.cfg, the setting of $USSER1$ is
$USER1$=/usr/local/nagios/libexec
(from the first thread,userid of nagios can use the check_ping without problem)
And I changed the owner of the files in libexec dir from nagios to root. Then added userid of nagios with root group.
So I think how to verify the setting of $USER1$ in the nagios running process may help. But I don’t know how to do that.

So, if you have added nagios to the root group, and changed the owner of the files in the libexec directory to root, then how can we help you? I’m not sure, but it looks like you have decided that the documentation of nagios is useless. I see nowhere in the docs where you are instructed to do as you have done.

I’ve said this a dozen times so far. EVERY time I install nagios, I follow it step by step in the docs, never deviating. They are complete, precise, and to the letter. There are NO errors in the nagios docs that I have found.

If you intend to deviate from the docs, then you have apparrently decided to go about this on your own. Please don’t, it works great the way the docs instruct. If you ever decide to follow the docs, then please post your troubles, if you have any.

Maybe I am too eager to solve this problem(I did try my best to read the docs). I changed the owner of the files in libexec dir from root back to nagios and removed the root group from userid of nagios.
After restarting apache and nagios. I got the same error message. What should I do next to check this error?

try adding a space in between the commas check_ping is really picky about that on my machine.

You have the service check defined with host_name localhost. So what is the hosts.cfg file defined as for this host?
IP is what?

The setting in hosts.cfg is as followed
define host{
use generic-host ; Name of host template to use
host_name localhost
alias localhost
address 127.0.0.1
check_command check-host-alive
max_check_attempts 10
notification_interval 120
contact_groups apache
notification_period 24x7
notification_options d,r
}

To Manta01:

May I ask where to add a space in between the commas check_ping ?

Csdeng

Post your /etc/group that has any nagios user in it.
nagios:x:502:nagios
nagiocmd:x:503:nagios,apache

Post a ls -la of the following:
[root@tia2665 nagios]# pwd
/usr/local/nagios
[root@tia2665 nagios]# ls -la
total 36
drwxrwxr-x 9 nagios nagios 4096 Apr 15 13:52 ./
drwxr-xr-x 18 root root 4096 Jul 23 2004 …/
drwxrwxr-x 2 nagios nagios 4096 Mar 11 16:31 bin/
drwxrwxr-x 2 nagios nagios 4096 Apr 16 17:00 etc/
drwxrwxr-x 2 nagios nagios 4096 Feb 4 16:07 libexec/
drwxr-xr-x 4 root root 4096 Mar 21 11:25 nagiostat/
drwxrwxr-x 2 nagios nagios 4096 Mar 11 16:31 sbin/
drwxrwxr-x 9 nagios nagios 4096 Mar 11 16:31 share/
drwxrwxr-x 4 nagios nagios 4096 Apr 17 10:47 var/

[root@tia2665 libexec]# pwd
/usr/local/nagios/libexec
[root@tia2665 libexec]# ls -la check_ping
-rwxr-xr-x 1 nagios nagios 136880 Jun 22 2004 check_ping
[root@tia2665 libexec]#

1.The /ect/group file has nagios
nagios:x:501:
nagcmd:x:502:apache,nagios
2.The permission in /usr/local/nagios
drwxr-xr-x 8 nagios nagios 4096 3月 31 01:02 .
drwxr-xr-x 13 root root 4096 3月 5 00:43 …
drwxrwxr-x 2 nagios nagios 4096 3月 5 00:52 bin
drwxr-xr-x 2 root root 4096 4月 15 01:14 etc
drwxr-xr-x 2 root root 4096 3月 31 01:02 libexec
drwxrwxr-x 2 nagios nagios 4096 3月 6 07:13 sbin
drwxrwxr-x 9 nagios nagios 4096 3月 31 01:02 share
drwxrwxr-x 3 nagios nagios 4096 4月 18 17:25 var
3.The permission of check_ping
-rwxr-xr-x 1 root root 134903 3月 31 01:02 check_ping

Thanks to Jakkedup!

Please change your permissions as shown in my output. Yours are not correct.
Plus, post a ls -la of your rw directory. It seems that your groupname is nagcmd, which is not standard, and i wanna make sure you have rw folder set to the same group name.
drwxrwsr-x 2 nagios nagiocmd 4096 Apr 17 10:47 rw/

1.I change the permission of /usr/local/nagios as shown in your output
drwxr-xr-x 8 nagios nagios 4096 4

Sorry, but now we need a ls -la of the check_ping command, just to be sure you changed not only the libexec directory, but the files inside of it, since the permissions where wrong earlier.