Solve NRPE Socket timeout issue
Hello once again! First, I wanna apologize for the lack of updates (again). I have been so busy with new and exciting work and the possibilities and new skills have been really pouring in. Regardless, I wanna thank everyone for your continued support and finding this blog’s articles useful. My sincerest gratitudes. Anyways, I am sharing another really good solution for all of you guys out there.
Have you deployed Nagios and installed the NRPE plugin on your local and remote servers? Have you by any chance encountered, and was not quite able to solve, this error?
Actually this has also bugged our team a lot and we were really sure (or so we thought) that we have configured Nagios and the NRPE plugin correctly.
CHECK_NRPE: Socket timeout after 10 seconds
We thought it might be a problem with Nagios or the NRPE plugin and we haven’t been able to dedicate a lot of time to find out the problem due to other pressing tasks. But recently, I was able to find the time to diagnose the issue and now I am sharing with you the fix. And yes, it was really really straight forward and so damn simple! DOH!
On your remote machine, make sure that you have installed the NRPE plugin correctly. You can download the NRPE plugin documentation at http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf.
Once, you’ve configured your remote machine’s NRPE already, do local checking first.
If you get a response with a version of your NRPE, then you’re all set.
# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.8
And do not forget to open port 5666 on your firewall (iptables or other wise). Refer to the NRPE documentation for more details.
On your monitoring machine, where Nagios was installed, install the NRPE plugin as well. Then do the remote NRPE check.
Now, don’t be surprised if you get the CHECK_NRPE: Socket timeout error. We now need to make sure that our monitoring machine allows incoming and outgoing connections via port 5666.
# /usr/local/nagios/libexec/check_nrpe -H
CHECK_NRPE: Socket timeout after 10 seconds.
To do just that, we open up our IPTables by doing:
The first command will allow our monitoring box to accept incoming connections from our remote_host via port 5666 and no other hosts and the second command will allow our remote machine to initiate connection via port 5666 to any remote machine. Of course we can make it tighter by specifying the destination box, but I don’t see the need for the meantime.
# /sbin/iptables -A INPUT -s-p tcp -m tcp –dport 5666 -j ACCEPT
# /sbin/iptables -A OUTPUT -p tcp -m tcp –dport 5666 -j ACCEPT
After adding the rules, make sure to save your new IPTables rules by doing
That’s it!
# /sbin/iptables-save > /etc/sysconfig/iptables
Try out some of these combinations to your remote host and see what the outputs are.
# /usr/local/nagios/libexec/check_nrpe -H -c check_load -t 120
#/usr/local/nagios/libexec/check_nrpe -H -c check_users
#/usr/local/nagios/libexec/check_nrpe -H -c check_zombie_procs
Enjoy!
Technorati
linux, nagios, nrpe, monitoring
Site Search Tags: linux, nagios, nrpe, monitoring











