diff options
author | rincewind <rincewind@vulgrim.de> | 2021-07-09 14:07:23 (GMT) |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2021-11-17 13:23:24 (GMT) |
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 423ecbe..7d58b10 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c | |||
@@ -37,6 +37,8 @@ const char *email = "devel@monitoring-plugins.org"; | |||
37 | #include "popen.h" | 37 | #include "popen.h" |
38 | #include "utils.h" | 38 | #include "utils.h" |
39 | 39 | ||
40 | #include <signal.h> | ||
41 | |||
40 | #define WARN_DUPLICATES "DUPLICATES FOUND! " | 42 | #define WARN_DUPLICATES "DUPLICATES FOUND! " |
41 | #define UNKNOWN_TRIP_TIME -1.0 /* -1 seconds */ | 43 | #define UNKNOWN_TRIP_TIME -1.0 /* -1 seconds */ |
42 | 44 | ||
@@ -163,10 +165,14 @@ main (int argc, char **argv) | |||
163 | printf ("</A>"); | 165 | printf ("</A>"); |
164 | 166 | ||
165 | /* Print performance data */ | 167 | /* Print performance data */ |
166 | printf("|%s", fperfdata ("rta", (double) rta, "ms", | 168 | if (pl != 100) { |
167 | wrta>0?TRUE:FALSE, wrta, | 169 | printf("|%s", fperfdata ("rta", (double) rta, "ms", |
168 | crta>0?TRUE:FALSE, crta, | 170 | wrta>0?TRUE:FALSE, wrta, |
169 | TRUE, 0, FALSE, 0)); | 171 | crta>0?TRUE:FALSE, crta, |
172 | TRUE, 0, FALSE, 0)); | ||
173 | } else { | ||
174 | printf("|"); | ||
175 | } | ||
170 | printf(" %s\n", perfdata ("pl", (long) pl, "%", | 176 | printf(" %s\n", perfdata ("pl", (long) pl, "%", |
171 | wpl>0?TRUE:FALSE, wpl, | 177 | wpl>0?TRUE:FALSE, wpl, |
172 | cpl>0?TRUE:FALSE, cpl, | 178 | cpl>0?TRUE:FALSE, cpl, |