From 37fc36aba8d107facbd8e02df1f1138ed14efa10 Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Fri, 12 Sep 2003 11:51:48 +0000 Subject: *new output format reported by Patrick Allen , also move atrribution for Richard Brodie to thanks file git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/branches/release-1.3.0@720 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/check_ping.c | 43 ++++++++++++------------------------------- 1 file changed, 12 insertions(+), 31 deletions(-) (limited to 'plugins/check_ping.c') diff --git a/plugins/check_ping.c b/plugins/check_ping.c index 0c0f2e44..342a89ef 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c @@ -383,41 +383,22 @@ run_ping (char *command_line) } /* get the percent loss statistics */ - if (sscanf - (input_buffer, "%*d packets transmitted, %*d packets received, +%*d errors, %d%% packet loss", - &pl) == 1 - || sscanf - (input_buffer, "%*d packets transmitted, %*d packets received, %d%% packet loss", - &pl) == 1 - || sscanf - (input_buffer, "%*d packets transmitted, %*d packets received, %d%% loss, time", &pl) == 1 - || sscanf - (input_buffer, "%*d packets transmitted, %*d received, %d%% loss, time", &pl) == 1 - /* Suse 8.0 as reported by Richard * Brodie */ - ) + if (sscanf(input_buffer,"%*d packets transmitted, %*d packets received, +%*d errors, %d%% packet loss",&pl)==1 || + sscanf(input_buffer,"%*d packets transmitted, %*d packets received, %d%% packet loss",&pl)==1 || + sscanf(input_buffer,"%*d packets transmitted, %*d packets received, %d%% loss, time",&pl)==1 || + sscanf(input_buffer,"%*d packets transmitted, %*d received, +%*d errors, %d%% packet loss",&pl)==1 || + sscanf(input_buffer,"%*d packets transmitted, %*d received, %d%% loss, time",&pl)==1) continue; /* get the round trip average */ else - if (sscanf (input_buffer, "round-trip min/avg/max = %*f/%f/%*f", &rta) - == 1 - || sscanf (input_buffer, - "round-trip min/avg/max/mdev = %*f/%f/%*f/%*f", - &rta) == 1 - || sscanf (input_buffer, - "round-trip min/avg/max/sdev = %*f/%f/%*f/%*f", - &rta) == 1 - || sscanf (input_buffer, - "round-trip min/avg/max/stddev = %*f/%f/%*f/%*f", - &rta) == 1 - || sscanf (input_buffer, - "round-trip min/avg/max/std-dev = %*f/%f/%*f/%*f", - &rta) == 1 - || sscanf (input_buffer, "round-trip (ms) min/avg/max = %*f/%f/%*f", - &rta) == 1 - || sscanf (input_buffer, "rtt min/avg/max/mdev = %*f/%f/%*f/%*f ms", - &rta) == 1 - ) + if (sscanf(input_buffer,"round-trip min/avg/max = %*f/%f/%*f",&rta)==1 || + sscanf(input_buffer,"round-trip min/avg/max/mdev = %*f/%f/%*f/%*f",&rta)==1 || + sscanf(input_buffer,"round-trip min/avg/max/sdev = %*f/%f/%*f/%*f",&rta)==1 || + sscanf(input_buffer,"round-trip min/avg/max/stddev = %*f/%f/%*f/%*f",&rta)==1 || + sscanf(input_buffer,"round-trip min/avg/max/std-dev = %*f/%f/%*f/%*f",&rta)==1 || + sscanf(input_buffer,"round-trip (ms) min/avg/max = %*f/%f/%*f",&rta)==1 || + sscanf(input_buffer,"rtt min/avg/max/mdev = %*f/%f/%*f/%*f ms",&rta)==1) continue; } -- cgit v1.2.3-74-g34f1