#532 check_ping yields warning on a single lost package

closed-accepted
Holger Weiß
5
2012-06-24
2012-06-14
Anonymous
No

check_ping gives WARNING if a single packet is lost, regardless of what warning threshold is set.

The reason is that the ping exit status is used, and ref the manual page of ping a single lost packet will cause ping to exit with 1 instead of 0:

"If a packet count and deadline are both specified, and fewer than count packets are received by the time the deadline has arrived, it will also exit with code 1."

Tested with those versions of ping installed:

$ ping -V
ping utility, iputils-sss20071127
$ ping -V
ping utility, iputils-sss20101006

The attached patch will cause check_ping to ignore the exit code from ping.
Version 1.4.15 affected (even v1.4.15.61.g4d527)

Discussion


  • Anonymous
    2012-06-14

    Patch for fixing the bug

     
    Attachments

  • Anonymous
    2012-06-14

    For the reference, this is what the bug looks like:

    $ ./plugins/check_ping -H otherbox -w 90,60% -c 100,100% -p 4 -t 1
    PING WARNING - Packet loss = 25%, RTA = 0.24 ms|rta=0.242000ms;90.000000;100.000000;0.000000 pl=25%;60;100;0

    If I run it without "-t 1", check_ping will not send the "deadline" parameter to ping, and the bug will not be triggered:

    $ ./plugins/check_ping -H otherbox -w 90,60% -c 100,100% -p 4
    PING OK - Packet loss = 20%, RTA = 0.19 ms|rta=0.193000ms;90.000000;100.000000;0.000000 pl=20%;60;100;0

    ... but it will hang for 9 extra seconds waiting for a timeout if the network is down.

    FWIW, I used this crud to reproduce the bug:

    $ this=`hostname`
    $ other=someotherbox.in.the.universe
    $ ./plugins/check_ping -H $other -w 90,60% -c 100,100% -p 4 -t 1 & ssh $other sudo iptables -A INPUT -p icmp -s $this -j DROP ; sleep 1 ; ssh $other sudo iptables -D INPUT -p icmp -s $this -j DROP

     
  • Holger Weiß
    Holger Weiß
    2012-06-14

    • assigned_to: nobody --> hweiss
     
  • Holger Weiß
    Holger Weiß
    2012-06-24

    • status: open --> closed-accepted
     
  • Holger Weiß
    Holger Weiß
    2012-06-24

    This problem is now fixed in Git. Thank you for your report.