Page 1 of 2

check_nrpe socket timeout after n seconds

Posted: Tue Sep 18, 2012 3:22 pm
by manish2tiwari
Hi All,

We are facing check_nrpe socket timeout after 10 seconds error whenever we are trying to use check_nrpe command for one of our Unix server.
We are using Red Hat Enterprise Linux Server release 5.6 (Tikanga) as the target server and virtual machine as the Source Nagios server.

We are able to use the same command for our windows server.

We have done the configuration settings as required in all the configuration file but not able to run the command on target server. local host in unix server is working fine and giving below output

Command: /usr/local/nagios/libexec/check_nrpe -H localhost
Output: NRPE v2.12

Please let us know if we are missing anything here.

Thanks in advance,
Manish
+004917687766033

Re: check_nrpe socket timeout after n seconds

Posted: Tue Sep 18, 2012 3:34 pm
by slansing
Are you using this check to see if they can communicate?:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H host.ip.address.here
Or a custom check? Just making sure you are trying the same thing. Do you have the NRPE standard port 5666 opened on the RHEL server?

Re: check_nrpe socket timeout after n seconds

Posted: Tue Sep 18, 2012 3:45 pm
by scottwilkerson
Also, for some background also, did you use the our Linux agent installer?

And, on the machine with the agent installed can you see it listening on port 5666

Code: Select all

 netstat -lnp |grep 5666
Finally you may need to verify you don't have a firewall blocking port 5666

Re: check_nrpe socket timeout after n seconds

Posted: Tue Sep 18, 2012 3:56 pm
by manish2tiwari
Hi Scott,

The command (netstat -lnp |grep 5666) is giving below reply:

tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 19004/nrpe

Hi Slansing,

Yes i am using that check on the Nagios hosting server and getting socket timeout error there.

Thanks,
Manish

Re: check_nrpe socket timeout after n seconds

Posted: Tue Sep 18, 2012 4:12 pm
by slansing
Can you check your nrpe.cfg file and make sure that you have your XI server listed as an allowed host?:

Code: Select all

vi /usr/local/nagios/etc/nrpe.cfg

Re: check_nrpe socket timeout after n seconds

Posted: Tue Sep 18, 2012 4:17 pm
by manish2tiwari
yes /usr/local/nagios/etc/nrpe.cfg contains below line:

allowed_hosts=10.123.4.21

10.123.4.21 is our Nagios XI server.

Thanks,
Manish

Re: check_nrpe socket timeout after n seconds

Posted: Tue Sep 18, 2012 4:34 pm
by slansing
Did you restart the NRPE service after editing the nrpe.cfg?

Code: Select all

service nrpe restart
Are you running any custom firewalls?

Re: check_nrpe socket timeout after n seconds

Posted: Tue Sep 18, 2012 4:38 pm
by lmiltchev
Can you also run the following command and the output of it?

Code: Select all

iptables -L -n | grep 5666

Re: check_nrpe socket timeout after n seconds

Posted: Tue Sep 18, 2012 5:03 pm
by manish2tiwari
@Slansing: service restart nrpe is giving command cannot found error, is there any specific path where i have to run it.

@limiltchev: iptables -L -n | grep 5666 command in my Nagios XI server giving below output:

tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:5666
ACCEPT - tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:5666
ACCEPT - tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:5666
ACCEPT - tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:5666
tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:5666
ACCEPT - tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:5666
ACCEPT - tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:5666
ACCEPT - tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:5666

Thanks,
Manish

Re: check_nrpe socket timeout after n seconds

Posted: Wed Sep 19, 2012 9:10 am
by scottwilkerson
Not sure why you have so many extra lines in there, also you have a single line without ACCEPT in front of it

Code: Select all

tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:5666
Here is what I would recommend, edit /etc/sysconfig/iptables-config and change the following to yes
IPTABLES_SAVE_ON_STOP
IPTABLES_SAVE_ON_RESTART

Then stop iptables, and edit /etc/sysconfig/iptables to have a line like

Code: Select all

-A INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT
Then start iptables

also to restart nrpe you may need to run

Code: Select all

/etc/init.d/nrpe restart