[Nagiosplug-devel] Check_ping question

Andreas Ericsson ae at op5.se
Wed Nov 10 07:32:14 CET 2004


Robert Nelson wrote:
> On line 340 of check_ping.c from v1.3.1 of the nagios-plugins package:
> 
> =============================
>         if (max_packets == -1)
>                 max_packets = DEFAULT_MAX_PACKETS;
> 
>         max_seconds = crta / 1000.0 * max_packets + max_packets;
>         if (max_seconds > timeout_interval)
>                 timeout_interval = (int)max_seconds;
> =============================
> 
> For my check-host-alive command, I use the following:
> 
> =============================
> # 'check-host-alive' command definition
> define command{
>         command_name    check-host-alive
>         command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w
> 4999.0,99% -c 5000.0,100% -p 3 -t 5
>         }
> =============================
> 
> I use the warning/crit settings of 4999 and 5000ms because if I get to
> this point, I just care if the host is there, let the service checks
> (which are often pings themselves) tell me what's wrong. I send three
> packets and want the hostcheck to end after 5 seconds, because of how
> nagios serializes the hostchecks.
> 
> Here's my question - what good is a timeout value, if it will be
> overridden by the Critical time?

Nonsensical. The timeout for iterative plugins should always be 
calculated based on the sum of per-iteration timeouts (in this case, 5 
seconds * 3 packets).

> I end up with an *effective* timeout
> value of (5000.0 / 1000.0 * 3 + 3 =) 18 seconds. This seems "broken" to
> me.
> 

It isn't. If you specify a per-packet timeout value of 5 seconds and 
send 3 packets that means the complete timeout must be at least equal to 
15 seconds (I don't know where those extra three come from), otherwise 
the per-packet timeout wouldn't make sense (should you count packets as 
lost if they're not even sent?).

> I ended up commenting out the last three lines quoted from check_ping.c
> and recompiling it. I'm just curious whether this is behavior by design
> or by error, and whether I need to make notes about it for when
> plugins-1.3.2 comes out. Thanks!
> 

It's obviously by design, and 1.3.2 won't come out. They're at 1.4.0 
now. What would be good would be to remove the timeout value, but that 
would make a LOT of configurations out there return UNKNOWN instead.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer




More information about the Devel mailing list