NRPE Socket timeout after 10 seconds

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

NRPE Socket timeout after 10 seconds

Post by kwhogster »

Nagios 4.1 Core

Every so often I get NRPE Socket timeout after 10 seconds on a lot of my services that use NRPE.

So I looked at my NRPE commands and found no -T value defined.

My current NRPE commands

Code: Select all

define command{
        command_name    check_nrpe
        command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ $ARG2$ $ARG3$ $ARG4$
}

define command{
        command_name    check_nrpe_test
        command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ $ARG2$ $ARG3$ $ARG4$ > /tmp/yourlog.txt
}

define command{
        command_name    check_users
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ $ARG3$
}
define command{
        command_name    check_windows_users
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_users -a 2 3 "$_HOSTALLOWEDUSERS$"
}
define command{
        command_name    check_ms_win_updates
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_ms_win_updates -a '-wd 15 -cd 30 -M PSWindowsUpdate'
}

AS an example I did this

Code: Select all

define command{
        command_name    check_nrpe
        command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -T 60 -c $ARG1$ $ARG2$ $ARG3$ $ARG4$
}

define command{
        command_name    check_nrpe_test
        command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -T 60 -c $ARG1$ $ARG2$ $ARG3$ $ARG4$ > /tmp/yourlog.txt
}

define command{
        command_name    check_users
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -T 60 -c $ARG1$ -a $ARG2$ $ARG3$
}
define command{
        command_name    check_windows_users
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -T 60 -c check_users -a 2 3 "$_HOSTALLOWEDUSERS$"
}
define command{
        command_name    check_ms_win_updates
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -T 60 -c check_ms_win_updates -a '-wd 15 -cd 30 -M PSWindowsUpdate'
}
After a restart of Nagios

All the NRPE defined services went to unknown status I had to revert back to the original code.

I looked at the NRPE document and it shows -T after the command -C

Does it matter where I place it?

Thanks
Tom
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: NRPE Socket timeout after 10 seconds

Post by dwhitfield »

If you are trying to set a timeout, use the lowercase t. Please let us know if I am missing what you are trying to do, and if that doesn't work for you.
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: NRPE Socket timeout after 10 seconds

Post by kwhogster »

dwhitfield

yes trying to set the timeout value

used the lower case t and now it did not fail after the restart.

I made it -t 60 I hoping not to get any more timeouts

Do you have a good suggestion for a time out value?


Update:

Even after restarting Nagios with the -t 60 I am still getting "CHECK_NRPE: Socket timeout after 10 seconds."

shouldn't be after 60 seconds?

Thoughts?
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: NRPE Socket timeout after 10 seconds

Post by dwhitfield »

On the remote host, what's the output of grep command_timeout /usr/local/nagios/etc/nrpe.cfg?

60 is a reasonable timeout. You could probably get away with a smaller #, but since you already have that, you might as well stick with it.
me@work55
Posts: 44
Joined: Sun Jan 22, 2017 6:15 pm

Re: NRPE Socket timeout after 10 seconds

Post by me@work55 »

grep does not run on Windows machines

What remote host you mean?

also

Why is it still showing 10 seconds? Is that in the nsclient
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: NRPE Socket timeout after 10 seconds

Post by kwhogster »

I found the nrpe.cfg file in /etc/Nagios

Code: Select all

# COMMAND TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# allow plugins to finish executing before killing them off.

command_timeout=60



# CONNECTION TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# wait for a connection to be established before exiting. This is sometimes
# seen where a network problem stops the SSL being established even though
# all network sessions are connected. This causes the nrpe daemons to
# accumulate, eating system resources. Do not set this too low.

connection_timeout=300


command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200


So why is it still getting only 10 seconds
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: NRPE Socket timeout after 10 seconds

Post by rkennedy »

The configuration file looks fine.

Can you attempt to run the command over the CLI and show us the full input / output to verify things?

In my mind, it's always a bit easier here as you can make sure it works BEFORE moving it into a setup. Then you know what's working and what isn't for sure.
Former Nagios Employee
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: NRPE Socket timeout after 10 seconds

Post by kwhogster »

rkennedy

Over the CLI ?????

From the Nagios server??

They are working just it still timeouts with 10 seconds it is as if the commands are not being used

Should I place the -t on the service definition instead?

Example please
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: NRPE Socket timeout after 10 seconds

Post by rkennedy »

kwhogster wrote:rkennedy

Over the CLI ?????

From the Nagios server??

They are working just it still timeouts with 10 seconds it is as if the commands are not being used

Should I place the -t on the service definition instead?

Example please
From the command line of the Nagios server. Please show us.
Former Nagios Employee
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: NRPE Socket timeout after 10 seconds

Post by kwhogster »

rkennedy

It run great from the command line

root@tgcs017:/usr/local/nagios/etc/objects# /usr/lib/nagios/plugins/check_nrpe -H TGCS011 -t 60 -c check_users -a 2 3 administrator
OK: 1 user logged in
Active Sessions: Administrator

Still puzzled.

Even at my job site the same thing happens but there we are on an older Nagios version.
Locked