[Nagiosplug-help] Re: check_ping patch for Redhat Enterprise Linux 3
Dan Stromberg
strombrg at dcs.nac.uci.edu
Thu Aug 26 16:12:06 CEST 2004
Please ignore that first patch - it only covered one case, where at
least two different output changes are needed. The patch attached to
this message covers more cases.
Thanks.
On Thu, 2004-08-26 at 15:50, Dan Stromberg wrote:
> Please see the attached patch - I haven't tested it all that much, but
> it appears to make RHEL 3's ping output format work better when hosts
> are down. It already worked fine when hosts were up.
>
> Thanks.
--
Dan Stromberg DCS/NACS/UCI <strombrg at dcs.nac.uci.edu>
-------------- next part --------------
--- plugins/check_ping.c.t 2004-08-26 15:44:31.000000000 -0700
+++ plugins/check_ping.c 2004-08-26 16:09:14.000000000 -0700
@@ -388,6 +388,16 @@
strcpy (warn_text, WARN_DUPLICATES);
}
+ /* RHEL 3 puts Destination Host Unreachable messages on stdout,
+ * not stderr
+ */
+ if (strstr (input_buffer, "Network is unreachable"))
+ terminate (STATE_CRITICAL, "PING CRITICAL - Network unreachable (%s)",
+ server_address);
+ else if (strstr (input_buffer, "Destination Host Unreachable"))
+ terminate (STATE_CRITICAL, "PING CRITICAL - Host Unreachable (%s)",
+ server_address);
+
/* get the percent loss statistics */
if (sscanf
(input_buffer, "%*d packets transmitted, %*d packets received, +%*d errors, %d%% packet loss",
@@ -400,6 +410,13 @@
|| sscanf
(input_buffer, "%*d packets transmitted, %*d received, %d%% loss, time", &pl) == 1
/* Suse 8.0 as reported by Richard * Brodie */
+ || sscanf
+ (input_buffer, "%*d packets transmitted, %*d received, +%*d errors, %d%% packet loss, time", &pl) == 1
+ /* 5 packets transmitted, 0 received, +5 errors, 100% packet loss, time 4018ms */
+ /* 5 packets transmitted, 0 received, +4 errors, 100% packet loss, time 4021ms */
+ || sscanf
+ (input_buffer, "%*d packets transmitted, %*d received, %d%% packet loss, time", &pl) == 1
+ /* Above two are for RHEL 3 as reported by Dan Stromberg */
)
continue;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://www.monitoring-plugins.org/archive/help/attachments/20040826/a53e0f44/attachment.sig>
More information about the Help
mailing list