diff options
author | rincewind <rincewind@vulgrim.de> | 2021-07-09 16:07:23 +0200 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2021-11-17 14:23:24 +0100 |
commit | 27d96dcf23c44c74d0a2be7ea94f47798e37030a (patch) | |
tree | 197f5675d5e01e110fc1adf6a8a9f0fc3239049b | |
parent | 024d268386353133af1a9ff5c0b5879397c19b1c (diff) | |
download | monitoring-plugins-27d96dcf23c44c74d0a2be7ea94f47798e37030a.tar.gz |
Do not show RTA if no connection was possible
-rw-r--r-- | plugins/check_ping.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/check_ping.c b/plugins/check_ping.c index 423ecbe5..7d58b103 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c @@ -37,6 +37,8 @@ const char *email = "devel@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, |