[monitoring-plugins] check_ping: Fixing "time of day goes back"

Git Repository git at monitoring-plugins.org
Fri Jan 24 18:50:07 CET 2014


 Module: monitoring-plugins
 Branch: master
 Commit: 455fe96e7dcadd433973b1709ee79cdb58ffe428
 Author: Jan Wagner <waja at cyconet.org>
   Date: Fri Jan 24 18:33:37 2014 +0100
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=455fe96

check_ping: Fixing "time of day goes back"
by Geoff Oakham <goakham at oanda.com>

Patch of check_ping that allows it to gracefully handle when ping outputs
to stderr "Warning: time of day goes back (-XXXXus), taking countermeasures."

Closes: #809 and #1195

---

 THANKS.in            | 1 +
 plugins/check_ping.c | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/THANKS.in b/THANKS.in
index c5e6057..a77ecd4 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -301,4 +301,5 @@ Pall Sigurdsson
 Sebastian Schmidt
 Simon Kainz
 Steve Weinreich
+Geoff Oakham
 Tim Laszlo
diff --git a/plugins/check_ping.c b/plugins/check_ping.c
index c0bb32f..95ac7b4 100644
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.c
@@ -482,7 +482,11 @@ run_ping (const char *cmd, const char *addr)
 	/* check stderr, setting at least WARNING if there is output here */
 	/* Add warning into warn_text */
 	while (fgets (buf, MAX_INPUT_BUFFER - 1, child_stderr)) {
-		if (! strstr(buf,"WARNING - no SO_TIMESTAMP support, falling back to SIOCGSTAMP")) {
+		if (
+			! strstr(buf,"WARNING - no SO_TIMESTAMP support, falling back to SIOCGSTAMP")
+			&& ! strstr(buf,"Warning: time of day goes back")
+
+		) {
 			if (verbose >= 3) {
 				printf("Got stderr: %s", buf);
 			}



More information about the Commits mailing list