No output on stdout) stderr: connect to address XXX.XXX.XXX.XXX port 5666: Connection refused 

This was tested on a CentOS 7.

This might have TWO possible causes

  • nrpe service is down
    use service nrpe status to test it.
    You might wanna see ‘section’ Add NRPE to service bellow, to activate nrpe as a service.
  • firewall on nrpe machine is blocking it

 

Some important files/directories

nrpe.cfg – /etc/nagios/nrpe.cfg
nagios/nrpe plugins folder – /usr/lib64/nagios/plugins/
logs – /var/log/messages

 

nrpe.cfg

My nrpe.cfg, in a CentOS 7, is located at /etc/nagios/nrpe.cfg

nano /etc/nagios/nrpe.cfg
nrpe log

In a default nrpe installation log is disabled!
You might want to enable it for better debug of the issues… Go to  and enable it.

log_file=/var/run/nrpe.log

nrpe debug mode

Yah!, the default installation will came also with debug disabled.
We want it enabled to see more information while we try to use service nrpe status for example.

debug=1

server_address

Server address… it might confuse you!
Server address ISN’T the NAGIOS’s ip address. It’s the actual external IP address of the current machine! allowed_hosts it’s actually it!

Lets check out the status of 5666 port.
lsof -i:5666
netstat -an |grep 5666

If you don’t see any result… this probably means that nrpe is down!
See the ‘section’ Add NRPE to service bellow.

Open PORT on the firewall
sudo firewall-cmd --permanent --zone=public --add-port=5666/tcp
firewall-cmd --reload
Add NRPE to service  – this will lunch nrpe on reboots –
sudo systemctl enable nrpe.service
sudo systemctl start nrpe.service

On my nrpe server /var/log/messages

tail -f /var/log/messages

Sep 30 15:20:43 sd-116969 nrpe[29928]: is_an_allowed_host (AF_INET): is host >137.74.69.69< an allowed host >137.74.69.69<
Sep 30 15:20:43 sd-116969 nrpe[29928]: is_an_allowed_host (AF_INET): is host >137.74.69.69< an allowed host >137.74.69.69<
Sep 30 15:20:43 sd-116969 nrpe[29928]: Host 137.74.69.69 is not allowed to talk to us!

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.