[Nagiosplug-devel] [ nagiosplug-Bugs-1373801 ] check_ping timeout on Mandrake 10.1

SourceForge.net noreply at sourceforge.net
Mon Oct 9 15:08:51 CEST 2006


Bugs item #1373801, was opened at 2005-12-05 15:01
Message generated for change (Comment added) made by alex_b
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1373801&group_id=29880

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Alex Burger (alex_b)
Assigned to: Ton Voon (tonvoon)
Summary: check_ping timeout on Mandrake 10.1

Initial Comment:
With Mandrake 10.1 and nagios-plugins-1.4 I had a
problem where devices that were down would return a
result of 'plugin timed out'.  The attached patch fixes
the problem by adding 2 seconds to the alarm() call.

The problem was that Nagios passed a timeout value of
10 seconds to the plugin.  The plugin would then call
ping with a timeout of 10 seconds (PING_HAS_TIMEOUT is
defined).  This would cause the plugin to abort before
it got the result from the ping command.  Adding 2
seconds to alarm will cause it to abort the plugin
after 12 seconds which will give ping enough time to
respond.

It may be better to reduce the timeout value passed to
ping.  For example, instead of:

# ifdef PING_HAS_TIMEOUT
asprintf (&cmd, rawcmd, timeout_interval, max_packets,
addresses[i]);
# else

use:

# ifdef PING_HAS_TIMEOUT
if (timeout_interval > 2)
asprintf (&cmd, rawcmd, timeout_interval-2,
max_packets, addresses[i]);
else
asprintf (&cmd, rawcmd, timeout_interval, max_packets,
addresses[i]);
# else


----------------------------------------------------------------------

>Comment By: Alex Burger (alex_b)
Date: 2006-10-09 09:08

Message:
Logged In: YES 
user_id=85836

I think max(1,(timeout_interval-1))/number of addresses
would be a good idea.

The help screen could be updated to say:

 -t, --timeout=INTEGER
    Seconds before connection times out (default: 10)
    Note:  If multiple host addresses are specified, the
           ping timeout for each host is 
           timeout / # of hosts.

Alex



This should be mentioned in the help screen for the plugin
so users know that the timeout is split evenly between all
the addresses to ping.

----------------------------------------------------------------------

Comment By: Ton Voon (tonvoon)
Date: 2006-03-23 06:24

Message:
Logged In: YES 
user_id=664364

Alex,

Thanks for the report.

It seems to me that there are two things going on here:

1. a timeout could be placed on each ping command
2. an overall timeout of the plugin, timeout_interval

I'm not keen on your suggestion of just bumping timeout_interval by 2, so I 
think what we need to do is calculate the timeout for each ping command.

This is complicated by the fact that you can specify a number of addresses to 
ping.

I'm guessing each individual ping command should have a timeout of max(1,
(timeout_interval-1))/number of addresses.

There's also a bit of code which alters the timeout_interval based on the 
number of packets requested and the critical rta threshold:

        max_seconds = crta / 1000.0 * max_packets + max_packets;
        if (max_seconds > timeout_interval)
                timeout_interval = (int)max_seconds;

I'm really not keen on this because I think the timeout_interval should be 
fixed to whatever has been specified on the command line.

I'm not sure what the best way to proceed is. Any other opinions?

Ton

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1373801&group_id=29880




More information about the Devel mailing list