Page 1 of 1

CHECK_NRPE: Error - Could not connect to x.x.x.x

Posted: Mon Nov 05, 2018 4:17 pm
by dlukinski
Hi

We are having troubles with XI server, not being able to monitor another XI server

CHECK_NRPE: Error - Could not connect to x.x.x.x: Connection reset by peer

XI server is entered into NRPE configurations, but not working

Thank you

Re: CHECK_NRPE: Error - Could not connect to x.x.x.x

Posted: Mon Nov 05, 2018 5:15 pm
by npolovenko
@dlukinski, Please share the /etc/xinetd.d/nrpe and the /usr/local/nagios/etc/nrpe.cfg files in this thread or send them over to me in a PM.

Re: CHECK_NRPE: Error - Could not connect to x.x.x.x

Posted: Mon Nov 05, 2018 5:15 pm
by tgriep
What OS and release version is the remote XI server running?
Is the NRPE agent installed and running on the server?
If the firewall setup to allow inbound traffic on port 5666?

Can you run the following on the remote XI server and post the output here?

Code: Select all

netstat -anp |grep 5666
ps -ef |grep nrpe
iptables -L
Take a look at this KB article for some troubleshooting steps for this.
https://support.nagios.com/kb/article/c ... r-616.html

Re: CHECK_NRPE: Error - Could not connect to x.x.x.x

Posted: Tue Nov 06, 2018 9:41 am
by dlukinski
tgriep wrote:What OS and release version is the remote XI server running?
Is the NRPE agent installed and running on the server?
If the firewall setup to allow inbound traffic on port 5666?

Can you run the following on the remote XI server and post the output here?

Code: Select all

netstat -anp |grep 5666
ps -ef |grep nrpe
iptables -L
Take a look at this KB article for some troubleshooting steps for this.
https://support.nagios.com/kb/article/c ... r-616.html
--------------------------------------------------------------------------------
The agent seems to be installed, but unsure what is the condition (also unsure if OK to reinstall "on top")


tcp 0 0 10.102.36.162:43870 10.74.16.166:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:35802 10.102.75.46:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:44922 10.102.35.71:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:44254 10.255.249.50:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:33914 10.102.33.70:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:52422 10.102.35.162:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:38662 10.102.74.222:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:35512 10.102.36.121:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:52730 10.102.35.248:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:44006 10.102.35.220:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:54932 10.102.36.123:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:46724 10.102.35.248:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:38640 10.102.75.44:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:58090 10.102.33.70:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:56830 10.102.35.121:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:56278 10.102.35.224:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:41762 10.102.74.235:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:55978 10.102.35.79:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:33278 10.64.200.20:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:40662 10.102.35.28:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:54926 10.255.249.22:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:60522 10.102.35.246:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:45004 10.102.35.245:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:50746 10.102.35.225:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:47542 10.102.74.70:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:60794 10.102.36.126:5666 TIME_WAIT -
tcp 0 0 10.102.36.162:58836 10.102.36.126:5666 TIME_WAIT -
tcp 0 0 :::5666 :::* LISTEN 64068/nrpe
tcp 0 0 ::1:56668 ::1:5432 TIME_WAIT -
[root@fikc-nagxiprod01 ~]# ps -ef | grep nrpe
nagios 51896 30497 0 14:38 ? 00:00:00 /usr/local/nagios/libexec/check_nrpe -H 10.102.76.70 -t 30 -c check_cpu_stats -a -w 95 -c 98
nagios 51930 30495 0 14:38 ? 00:00:00 /usr/local/nagios/libexec/check_nrpe -H 10.64.92.16 -t 30 -c CheckCounter -a Counter:C: Split IO/sec=\LogicalDisk(C:)\Split IO/Sec ShowAll MaxWarn=10 MaxCrit=20
nagios 51947 30500 0 14:38 ? 00:00:00 /usr/local/nagios/libexec/check_nrpe -H 10.89.0.170 -t 30 -c check_disk -a -w 20% -c 10% -p /var/crash
nagios 51950 30496 0 14:38 ? 00:00:00 /usr/local/nagios/libexec/check_nrpe -H 10.102.35.121 -t 30 -c check_cpu_stats -a -w 85 -c 95
nagios 51957 30501 0 14:38 ? 00:00:00 /usr/local/nagios/libexec/check_nrpe -H 10.64.92.12 -t 30 -c CheckCounter -a Counter:C: Split IO/sec=\LogicalDisk(C:)\Split IO/Sec ShowAll MaxWarn=10 MaxCrit=20
nagios 51987 30498 0 14:38 ? 00:00:00 /usr/local/nagios/libexec/check_nrpe -H 10.102.74.221 -t 30 -c check_cpu_stats -a -w 85 -c 95
nagios 51992 30501 1 14:38 ? 00:00:00 /usr/local/nagios/libexec/check_nrpe -H 10.64.8.24 -t 30 -c check_users -a -w 5 -c 10
nagios 51995 30497 0 14:38 ? 00:00:00 /usr/local/nagios/libexec/check_nrpe -H 10.102.36.39 -t 30 -c CheckCounter -a Counter:C: % Read Time=\LogicalDisk(C:)\% Disk Read Time ShowAll MaxWarn=50 MaxCrit=100
nagios 51996 30495 0 14:38 ? 00:00:00 /usr/local/nagios/libexec/check_nrpe -H 10.102.35.78 -t 30 -c check_cpu_stats -a -w 85 -c 90
nagios 51997 30496 0 14:38 ? 00:00:00 /usr/local/nagios/libexec/check_nrpe -H 10.102.36.137 -t 30 -c CheckCounter -a Counter:C: % Read Time=\LogicalDisk(C:)\% Disk Read Time ShowAll MaxWarn=50 MaxCrit=100
nagios 52003 30496 0 14:38 ? 00:00:00 /usr/local/nagios/libexec/check_nrpe -H 10.89.0.170 -t 30 -c check_disk -a -w 20% -c 10% -p /usr
nagios 52004 30501 0 14:38 ? 00:00:00 /usr/local/nagios/libexec/check_nrpe -H 10.102.75.47 -t 30 -c check_procs -a -w 250 -c 300
root 52006 50473 0 14:38 pts/0 00:00:00 grep nrpe
nagios 64068 1 0 Nov05 ? 00:00:00 /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
[root@fikc-nagxiprod01 ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp dpt:gearman
ACCEPT tcp -- anywhere anywhere tcp dpt:gearman
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:https
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:nsca
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:nrpe
ACCEPT udp -- anywhere anywhere state NEW udp dpt:snmptrap
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@fikc-nagxiprod01 ~]#

Re: CHECK_NRPE: Error - Could not connect to x.x.x.x

Posted: Tue Nov 06, 2018 10:39 am
by tgriep
Did you edit the /usr/local/nagios/etc/nrpe.cfg file on the serevr and add the IP address of the other Nagios server in the allowed_hosts option?
If not, add it to the list separated by a comma, save the file and restart the NRPE agent by running the following as root.

Code: Select all

service nrpe restart
Then test it from the other host.

Re: CHECK_NRPE: Error - Could not connect to x.x.x.x

Posted: Tue Nov 06, 2018 7:59 pm
by dlukinski
tgriep wrote:Did you edit the /usr/local/nagios/etc/nrpe.cfg file on the serevr and add the IP address of the other Nagios server in the allowed_hosts option?
If not, add it to the list separated by a comma, save the file and restart the NRPE agent by running the following as root.

Code: Select all

service nrpe restart
Then test it from the other host.
Somehow NRPE got defaulted (I think)

So now the error message have changed to NRPE: Command 'check_disk' not defined (same for all NRPE commands)

Re: CHECK_NRPE: Error - Could not connect to x.x.x.x

Posted: Wed Nov 07, 2018 10:49 am
by tgriep
Please post the following file from the server

Code: Select all

/usr/local/nagios/etc/nrpe.cfg
and all of the files in this folder if they exists.

Code: Select all

/usr/local/nagios/etc/nrpe
Run this as root and post the output here.

Code: Select all

ls -l /usr/local/nagios/libexec
Thanks

Re: CHECK_NRPE: Error - Could not connect to x.x.x.x

Posted: Thu Nov 22, 2018 5:09 pm
by dlukinski
tgriep wrote:Please post the following file from the server

Code: Select all

/usr/local/nagios/etc/nrpe.cfg
and all of the files in this folder if they exists.

Code: Select all

/usr/local/nagios/etc/nrpe
Run this as root and post the output here.

Code: Select all

ls -l /usr/local/nagios/libexec
Thanks

Hi

This have now changed to "NRPE: Command 'check_disk' not defined" / "not defined" messages

Re: CHECK_NRPE: Error - Could not connect to x.x.x.x

Posted: Mon Nov 26, 2018 9:21 am
by tgriep
Usually this is caused by a mismatch between the command name declared in Nagios XI to be check through NRPE and the actual command name of the command directive in the remote host's nrpe.cfg file.
So take a look at the command defined in the remote systems NRPE config file and if it is defined, restart the NRPE config file so it loads the changes.

This article has more details if needed.
https://support.nagios.com/kb/article/n ... d-621.html