I checked the configuration on both of the machines:
Configuring on the Remote Host with the ‘nrpe’ daemon
1) Getting "Error receiving data from daemon." may mean that the allowed_hosts property in the nrpe.cfg of the remote host you are monitoring does not include the IP address of your nagios server.
The nagios server included into the mesmes nrpe.cfg:
2) It also may mean that the version of check_nrpe on your nagios server is not the same version as nrpe on the remote host you are monitoring.
The same version of nrpe installed on both machines:
on mesmes nrpe : Version: 2.5.1
on nagios nrpe: Version: 2.5.1
NRPE - Nagios Remote Plugin Executor
Copyright (c) 1999-2006 Ethan Galstad (email@example.com)
Last Modified: 04-09-2006
Usage: nrpe -n] -c
3) One other thing to note, the -c qualifier for check_nrpe (defined on the nagios server) has to match the command pneumonic which is specified in nrpe.cfg on the remote host you are monitoring.
i.e. if you are trying check_nrpe from the nagios server manually, -c needs to match the string specified in the command...] declaration in nrpe.cfg on the remote host you are monitoring.
I mention this because you have specified it as a statement executed on the command line, and that should be in the nrpe.cfg instead.
In the nrpe.cfg on the nrpe daemon host the command is defined the following way:
command[check_nrpe]=/usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
I am using xinetd:
[root@mesmes etc]# vi /etc/xinetd.d/nrpe
flags = REUSE
disable = no
port = 5666
socket_type = stream
wait = no
user = root
server = /usr/local/nagios/bin/nrpe
server_args = -n -d -c /user/local/nagios/etc/nrpe.cfg
log_on_failure += USERID
only_from = 126.96.36.199
nrpe 5666/tcp # Nagios – nrpe
[root@mesmes etc]# /etc/rc.d/init.d/xinetd restart
Stopping xinetd: OK ]
Starting xinetd: OK ]
[root@mesmes etc]# /etc/rc.d/init.d/xinetd status
xinetd (pid 13888) is running...
[root@mesmes etc]# netstat -pta
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :nrpe *: LISTEN 13888/xinetd
hosts.allow This file describes the names of the hosts which are
nrpe: LOCAL, 188.8.131.52
[root@mesmes etc]# vi /etc/hosts.deny
Configuring on the Nagios Host
In the "checkcommands.cfg"
'check_nrpe' command definition
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
I do not even defined a nagios service, because I am still getting the same error, when I try to run it from the nagios machine from the command line:
CHECK_NRPE: Error receiving data from daemon.