Nagios running but, Return code of 127


#1

j’ai resolu le prbl de permission, & j’arrive a démarrer Nagios. Mais, quand je lance l’interface web, je n’arrive pas a monitorer le reseau & je recois un messages d’error:
:x

Error: Could not read host and service status information!

The most common cause of this error message (especially for new users), is the fact that Nagios is not actually running. If Nagios is indeed not running, this is a normal error message. It simply indicates that the CGIs could not obtain the current status of hosts and services that are being monitored. If you’ve just installed things, make sure you read the documentation on starting Nagios.

je check que nagios est up avec la commande :
[[email protected] /]# ps -ef|grep nagios
root 1529 1 0 Oct13 ? 00:01:30 gedit file:///etc/rc.d/init.d/nagios
theboss 23051 1 0 02:26 ? 00:00:01 [nagios]
nagios 23074 1170 0 02:31 ? 00:00:00 [httpd]
nagios 23075 1170 0 02:31 ? 00:00:00 [httpd]
nagios 23076 1170 0 02:31 ? 00:00:00 [httpd]
nagios 23077 1170 0 02:31 ? 00:00:00 [httpd]
nagios 23078 1170 0 02:31 ? 00:00:00 [httpd]
nagios 23081 1170 0 02:31 ? 00:00:00 [httpd]
nagios 23082 1170 0 02:31 ? 00:00:00 [httpd]
nagios 23083 1170 0 02:31 ? 00:00:00 [httpd]
root 25717 12170 0 03:20 pts/0 00:00:00 grep nagios

Je n’arrive pas a comprendre pourquoi la commande ping ne marche pas… voila comment je l’ai defenie dans le fichier commands.cfg

‘check_ping’ command definition

define command{
command_name check_ping
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
}

je refere a la commande dans le fichier services.cfg :
###############################################################################

Ping Test

###############################################################################

Service definition for Ping Tests

define service{

use generic-service ; Name of service template to use
host_name msebbane,bnassreddin,redouane,Linux,linux1
service_description PING
is_volatile 0
check_period 24x7
contact_groups apache
notification_options w,u,c,r
check_command check_ping
}

dans le fichier resources, j’ai specifier l’emplacement des plugins :

Sets $USER1$ to be the path to the plugins

$USER1$=/usr/local/nagios/libexec

j’ai aussi telecharger les plugins necessaire & installer sous /usr/local/nagios/libexec

[[email protected] /]# ls /usr/local/nagios/libexec
check_breeze check_http check_nagios check_real check_ups check_by_ssh check_ifoperstatus check_nntp check_rpc check_users
check_dig check_ifstatus check_nt check_sensors check_wave check_disk check_imap check_ntp check_smtp
negate check_disk_smb check_ircd check_nwstat check_ssh urlize
check_dns check_load check_oracle check_swap utils.pm check_dummy check_log check_overcr check_tcp utils.sh check_file_age check_mailq check_ping check_time
check_flexlm check_mrtg check_pop check_udp
check_ftp check_mrtgtraf check_procs check_udp2
Quand le lance nagios avec l’option -v, il donne 0 erreurs & 0 warning:

***[[email protected] /]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg ***
***Nagios 1.2
Copyright © 1999-2004 Ethan Galstad ([email protected])
Last Modified: 02-02-2004
License: GPL

Reading configuration data…

Running pre-flight check on configuration data…

Checking services…
Checked 5 services.
Checking hosts…
Checked 5 hosts.
Checking host groups…
Checked 2 host groups.
Checking contacts…
Checked 3 contacts.
Checking contact groups…
Checked 1 contact groups.
Checking service escalations…
Checked 0 service escalations.
Checking host group escalations…
Checked 0 host group escalations.
Checking service dependencies…
Checked 0 service dependencies.
Checking host escalations…
Checked 0 host escalations.
Checking host dependencies…
Checked 0 host dependencies.
Checking commands…
Checked 38 commands.
Checking time periods…
Checked 5 time periods.
Checking for circular paths between hosts…
Checking for circular service execution dependencies…
Checking global event handlers…
Checking obsessive compulsive service processor command…
Checking misc settings…

Total Warnings: 0
Total Errors: 0***

Mais quand je check le fichier de messages:
$ vi /var/log/messages

Oct 14 03:08:59 audit nagios: Warning: Return code of 127 for check of service ‘PING’ on host ‘bnassreddin’ was out of bounds. Make sure the plugin you’re trying to run actually exists.
Oct 14 03:14:59 audit nagios: Warning: Return code of 127 for check of service ‘PING’ on host ‘linux1’ was out of bounds. Make sure the plugin you’re trying to
run actually exists.
Oct 14 03:20:59 audit nagios: Warning: Return code of 127 for check of service ‘PING’ on host ‘msebbane’ was out of bounds. Make sure the plugin you’re trying to run actually exists.
Oct 14 03:26:59 audit nagios: Warning: Return code of 127 for check of service ‘PING’ on host ‘redouane’ was out of bounds. Make sure the plugin you’re trying to run actually exists.
Oct 14 03:30:08 audit kernel: set_rtc_mmss: can’t update from 49 to 0
Oct 14 03:31:09 audit kernel: set_rtc_mmss: can’t update from 49 to 1
Oct 14 03:32:10 audit kernel: set_rtc_mmss: can’t update from 49 to 2
Oct 14 03:32:59 audit nagios: Warning: Return code of 127 for check of service ‘PING’ on host ‘Linux’ was out of bounds. Make sure the plugin you’re trying to run actually exists.

j’ai lancé check_ping manuellement & ca marche…les autres check ossi marchent… :shock:
Je n’arrive vraiment a comprendre d’ou viens le probleme. Que dois-je faire Svp ?

Merci enormement pour votre aide,


#2

Make sure the nagios user has permissions to read the resources.cfg file. This caused me a problem as nagios could not read the $USER1$ variable for the plugins path.

After spending a few hours troubleshooting the same problem with check_tcp, its also helpful to run the command manually. Check_tcp was also giving me a 127 error, but it was related to missing symlinks to libssl and libcrypto. Once I recreated the symlinks, check_tcp was back to normal.

Moral of the story: run the tests manually :slight_smile:

Running FC4, nagios-2.0-0.rc2, nagios-plugins-1.4.1

$ sudo -u nagios ./check_tcp -H 192.168.100.40 -p 80
./check_tcp: error while loading shared libraries: libssl.so.4: cannot open shared object file: No such file or directory

sudo ln -s /lib/libssl.so.0.9.7f /lib/libssl.so.4

$ sudo -u nagios ./check_tcp -H 192.168.100.40 -p 80
./check_tcp: error while loading shared libraries: libcrypto.so.4: cannot open shared object file: No such file or directory

$ sudo ln -s /lib/libcrypto.so.0.9.7f /lib/libcrypto.so.4

$ sudo -u nagios ./check_tcp -H 192.168.100.40 -p 80
TCP OK - 0.000 second response time on port 80|time=0.000383s;0.000000;0.000000;0.000000;10.000000


#3

Yikes, French. From my limited knowledge of the language and what he’s posted, though, I can see why he’s upset/confused.

I’ll try what I can to communicate with him what Derek suggested and my own suggestions.

Les commandes:
[[email protected] /]chmod ugo+x /usr/local/nagios/*
[[email protected] /]/usr/local/nagios/check_ping 127.0.0.1 -w 1000.0,20% -c 1500.0,50% -p 5
Que dit-elle?

Le fischier services.cfg:
use generic-service ; Name of service template to use
host_name msebbane,bnassreddin,redouane,Linux,linux1
service_description PING
is_volatile 0
check_period 24x7
register 1
contact_groups apache
notification_options w,u,c,r
check_command check_ping
}

La commande:

[[email protected] /]/etc/init.d/nagios restart

Yikes, I hope that gets through.


#4

Sorry, Don’t do French - but for the English speakers who have tried:

If you google “return code 127” you’ll find the most common cause of this fault is actually using the Nagios restart command (sorry SonOfThunder).

This happens when the command doesn’t properly shut down the previous nagios process and they conflict when trying to use the ping command.

Always shutdown nagios and start it again manually - this resolved the error message for me a few months ago.


#5

Ah, google. Gotta love it. I’ve no idea how to explain that in French. Ah, well. Google’s got an online translator. Mayhap medimania can figure out the general idea.