[Nagiosplug-devel] check_ping duplicates bug

Christian G. Warden cwarden at zerolag.com
Wed Jul 20 21:08:12 CEST 2005


There's a bug in check_ping in which it incorrectly reports the number
of duplicate packets received as the packet loss.  A patch is attached
which correctly parses the last line of the ping output.  It should work
for netkit-ping and iputils-ping.

[Oops, I forgot the patch the first time]

Christian
-------------- next part --------------
diff -ruw nagios-plugins-HEAD-200507151647.orig/plugins/check_ping.c nagios-plugins-HEAD-200507151647/plugins/check_ping.c
--- nagios-plugins-HEAD-200507151647.orig/plugins/check_ping.c  2005-05-25 07:25:55.000000000 -0700
+++ nagios-plugins-HEAD-200507151647/plugins/check_ping.c       2005-07-18 17:27:25.634662410 -0700
@@ -415,6 +415,8 @@

                /* get the percent loss statistics */
                if(sscanf(buf,"%*d packets transmitted, %*d packets received, +%*d errors, %d%% packet loss",&pl)==1 ||
+                        sscanf(buf,"%*d packets transmitted, %*d packets received, +%*d duplicates, %d%% packet loss", &pl) == 1 ||
+                        sscanf(buf,"%*d packets transmitted, %*d received, +%*d duplicates, %d%% packet loss", &pl) == 1 ||
                         sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% packet loss",&pl)==1   ||
                         sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% loss, time",&pl)==1 ||
                         sscanf(buf,"%*d packets transmitted, %*d received, %d%% loss, time", &pl)==1 ||


More information about the Devel mailing list