Error : Connection Refused By Host in Nagios
April 07 2014
You may get CRITICAL error "Connection refused by host" on Nagios monitoring tool after installed and configured Nagios in client system.
Service State Information
Current Status: | CRITICAL (for 0d 0h 6m 15s) |
Status Information: | Connection refused by host |
Login into your nagios server and check the configuration with client IP Address using below command,
bash-3.2# /usr/local/nagios/libexec/check_nrpe -H 192.168.0.10
Connection refused by host
Connection refused by host
Note : Assume that Client IP address is 192.168.0.10
or
Check in client system connection configuration,
bash-3.2# /usr/local/nagios/libexec/check_nrpe -H localhost
connect to address 127.0.0.1 port 5666: Connection refused
connect to host localhost port 5666: Connection refused
connect to address 127.0.0.1 port 5666: Connection refused
connect to host localhost port 5666: Connection refused
Solution:
1. We have to specified Service name, Port number of service on /etc/services file like below,
nrpe 5666/tcp # TCP Port for nagios (nrpe)
Also to check below configuration to fix few errors,
2. Check the Nagios server IP Address added in /etc/xinetd.d/nrpe
disable = no
only_from = 127.0.0.1 192.168.0.1
Note: Assume that the nagios server IP address is 192.168.0.1only_from = 127.0.0.1 192.168.0.1
3. May the Firewall does'nt allowed the port number 5666, can give accept permission in IPTABLES and check the status
bash-3.2# iptables -I INPUT -p tcp -m tcp --dport 5666 -j ACCEPT
bash-3.2# /etc/init.d/iptables save
bash-3.2# /etc/init.d/iptables save
If are you using csf tool you have to allow the port number 5666 in /etc/csf/csf.conf file on TCP_IN field and restart xinetd
bash-3.2# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
Now, can able to check with same command line.
bash-3.2# /usr/local/nagios/libexec/check_nrpe -H 192.168.0.10
NRPE v2.12
NRPE v2.12
This page is awesome. Saved my day!
Thank you,.