[Nagiosplug-devel] [ nagiosplug-Bugs-1592605 ] check_ping times out

SourceForge.net noreply at sourceforge.net
Thu Jan 4 12:37:16 CET 2007


Bugs item #1592605, was opened at 2006-11-08 07:32
Message generated for change (Comment added) made by dermoth
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1592605&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: General plugin execution
Group: CVS
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Thomas Stewart (thomasdstewart)
Assigned to: Nobody/Anonymous (nobody)
Summary: check_ping times out

Initial Comment:
Hi,

I have noticed a minor time-out bug in check_ping. The
plug-in returns
"CRITICAL - Plugin timed out after 10 seconds" if it is
trying to ping a host
on a different network.

I have used 4 IPs in my example, a host that is on my
network and is up
(192.168.0.1), a host that it on my network but is down
(192.168.0.10), a host
that it not on my network and is up (192.168.1.1) and a
host that is not on my
network but is down (10 192.168.1.10).

Firstly I pinged each host in turn. See the Ping
Commands[1]. I got 0% loss on
the hosts that are up. For the down host that is on my
network I got
"Destination Host Unreachable". For the down host that
was not on my network I
received nothing.

Next I manually ran the check_ping command for each
host. See the Original
check_ping[2]. As expected the up hosts and host on my
network are fine, the
plug-in returns OK and "Host Unreachable". The problem
is the host that is down
and not on my network, the plug-in returns "CRITICAL -
Plugin timed out after
10 seconds". When really it should return some sort of
"CRITICAL PING 100%
packet loss" error, i.e. there is a ping issue, not an
issue with the plug-in.

On a very quick inspection, if the plug-in has a 10
second time-out then it
also sets the pings time-out to 10. Which means that it
never quite lets ping
finish in time, i.e. if the ping does not receive a
icmp unreachable its killed
before the pings time-out is reached.

I changed the time-out for check_ping to be the timeout
+ 1, then it seems to
behave itself better. See the Modified check_ping[2].
Where the plug-in now
correctly returns "PING CRITICAL - Packet loss = 100%".


---
nagios-plugins-HEAD-200611080052/plugins/check_ping.c 
     2006-11-08 11:07:47.000000000 +0000
+++
nagios-plugins-HEAD-200611080052/plugins/check_ping.c.orig
 2006-11-08 11:07:36.000000000 +0000
@@ -104,7 +104,7 @@
        }

        /* handle timeouts gracefully */
-       alarm (timeout_interval + 1);
+       alarm (timeout_interval);

        for (i = 0 ; i < n_addresses ; i++) {


[1] Ping Commands
$ ping -n -c 1 -w 10 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=255 time=0.559 ms

--- 192.168.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.559/0.559/0.559/0.000 ms

$ ping -n -c 1 -w 10 192.168.0.10
PING 192.168.0.10 (192.168.0.10) 56(84) bytes of data.
>From 192.168.0.206 icmp_seq=1 Destination Host Unreachable
>From 192.168.0.206 icmp_seq=2 Destination Host Unreachable
>From 192.168.0.206 icmp_seq=3 Destination Host Unreachable

--- 192.168.0.10 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100%
packet loss, time 2010ms
, pipe 3

$ ping -n -c 1 -w 10 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=255 time=0.514 ms

--- 192.168.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.514/0.514/0.514/0.000 ms

$ ping -n -c 1 -w 10 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.

--- 192.168.1.10 ping statistics ---
10 packets transmitted, 0 received, 100% packet loss,
time 9009ms


[2] Original check_ping
$ ./check_ping -H 192.168.0.1 -w 5000,100% -c 5000,100%
-p 1
PING OK - Packet loss = 0%, RTA = 0.54 ms

$ ./check_ping -H 192.168.0.10 -w 5000,100% -c
5000,100% -p 1
CRITICAL - Host Unreachable (192.168.0.10)

$ ./check_ping -H 192.168.1.1 -w 5000,100% -c 5000,100%
-p 1
PING OK - Packet loss = 0%, RTA = 0.70 ms

$ ./check_ping -H 192.168.1.10 -w 5000,100% -c
5000,100% -p 1
CRITICAL - Plugin timed out after 10 seconds


[3]Modified check_ping
$ ./check_ping -H 192.168.0.1 -w 5000,100% -c 5000,100%
-p 1
PING OK - Packet loss = 0%, RTA = 0.56 ms

$ ./check_ping -H 192.168.0.10 -w 5000,100% -c
5000,100% -p 1
CRITICAL - Host Unreachable (192.168.0.10)

$ ./check_ping -H 192.168.1.1 -w 5000,100% -c 5000,100%
-p 1
PING OK - Packet loss = 0%, RTA = 0.55 ms

$ ./check_ping -H 192.168.1.10 -w 5000,100% -c
5000,100% -p 1
PING CRITICAL - Packet loss = 100%


Regards
--
Tom


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

Comment By: Thomas Guyot (dermoth)
Date: 2007-01-04 06:37

Message:
Logged In: YES 
user_id=375623
Originator: NO

this problem is now fixed in cvs.  thank you for your report.

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

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




More information about the Devel mailing list