While configuring and testing nagios monitoring, you may sometimes get the above error. Then check for the following.
In the remote server being monitored,
1) Check the file /etc/xinetd.d/nrpe. Make sure that the only_from field contains the nagios server IP, which is shown as x.x.x.x below.
# default: on
# description: NRPE (Nagios Remote Plugin Executor)
flags = REUSE
socket_type = stream
port = 5666
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /usr/local/nagios/etc/nrpe.cfg –inetd
log_on_failure += USERID
disable = no
only_from = 127.0.0.1 x.x.x.x
2) In the remote server being monitored, make sure that the nagios IP is added to the allowed_hosts section of the file /usr/local/nagios/libexec/nrpe.cfg
allowed_hosts=127.0.0.1, x.x.x.x where x.x.x.x is the nagios server IP
3) Also make sure that the file /usr/local/nagios/libexec/nrpe.cfg has enough permissions.
Once these are done, the above error should vanish.