tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ping(8) picking up another ping's echo replies



> 3. Ignore the ping(8) problem and teach the check_ping monitoring plugin to 
>    return CRITICAL if it finds "sendto: host is down" in ping's stderr.
I went for this one for now.
Nevertheless, I think that's a problem with ping(8) taht should be fixed.
--- plugins/check_ping.c.orig	2017-01-16 18:24:03.000000000 +0100
+++ plugins/check_ping.c	2018-02-09 15:47:17.000000000 +0100
@@ -520,11 +520,17 @@ run_ping (const char *cmd, const char *a
 int
 error_scan (char buf[MAX_INPUT_BUFFER], const char *addr)
 {
-	if (strstr (buf, "Network is unreachable") ||
+	if (strstr (buf, "Host is down"))
+		die (STATE_CRITICAL, _("CRITICAL - Host is down (%s)\n"), addr);
+	else if (strstr (buf, "Network is unreachable") ||
 		strstr (buf, "Destination Net Unreachable")
 		)
 		die (STATE_CRITICAL, _("CRITICAL - Network Unreachable (%s)\n"), addr);
-	else if (strstr (buf, "Destination Host Unreachable"))
+	else if (strstr (buf, "Network is down"))
+		die (STATE_CRITICAL, _("CRITICAL - Network is down (%s)\n"), addr);
+	else if (strstr (buf, "Destination Host Unreachable") ||
+		strstr (buf, "No route to host")
+		)
 		die (STATE_CRITICAL, _("CRITICAL - Host Unreachable (%s)\n"), addr);
 	else if (strstr (buf, "Destination Port Unreachable"))
 		die (STATE_CRITICAL, _("CRITICAL - Bogus ICMP: Port Unreachable (%s)\n"), addr);


Home | Main Index | Thread Index | Old Index