[Nagiosplug-devel] check_ping duplicates bug

Andreas Ericsson ae at op5.se
Tue Jul 19 15:43:35 CEST 2005


Christian G. Warden wrote:
> 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.
> 

This patch will almost certainly cause an identical bug on some other 
distribution or platform or whatnot. Try check_icmp instead. Since it 
does its own low-level work it doesn't have this kind of bug (which is 
the most common type for the check_ping plugin).

> [I sent this yesterday, but I wasn't subscribed.  Sorry if you get a
> duplicate.]
> 
> Christian
> 
> 
> ------------------------------------------------------------------------
> 
> 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 ||

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




More information about the Devel mailing list