[monitoring-plugins] Do not show RTA if no connection was possible
RincewindsHat
git at monitoring-plugins.org
Thu Nov 18 10:10:11 CET 2021
Module: monitoring-plugins
Branch: master
Commit: 27d96dcf23c44c74d0a2be7ea94f47798e37030a
Author: rincewind <rincewind at vulgrim.de>
Committer: RincewindsHat <12514511+RincewindsHat at users.noreply.github.com>
Date: Fri Jul 9 16:07:23 2021 +0200
URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=27d96dc
Do not show RTA if no connection was possible
---
plugins/check_ping.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/plugins/check_ping.c b/plugins/check_ping.c
index 423ecbe..7d58b10 100644
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.c
@@ -37,6 +37,8 @@ const char *email = "devel at monitoring-plugins.org";
#include "popen.h"
#include "utils.h"
+#include <signal.h>
+
#define WARN_DUPLICATES "DUPLICATES FOUND! "
#define UNKNOWN_TRIP_TIME -1.0 /* -1 seconds */
@@ -163,10 +165,14 @@ main (int argc, char **argv)
printf ("</A>");
/* Print performance data */
- printf("|%s", fperfdata ("rta", (double) rta, "ms",
- wrta>0?TRUE:FALSE, wrta,
- crta>0?TRUE:FALSE, crta,
- TRUE, 0, FALSE, 0));
+ if (pl != 100) {
+ printf("|%s", fperfdata ("rta", (double) rta, "ms",
+ wrta>0?TRUE:FALSE, wrta,
+ crta>0?TRUE:FALSE, crta,
+ TRUE, 0, FALSE, 0));
+ } else {
+ printf("|");
+ }
printf(" %s\n", perfdata ("pl", (long) pl, "%",
wpl>0?TRUE:FALSE, wpl,
cpl>0?TRUE:FALSE, cpl,
More information about the Commits
mailing list