diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2021-11-18 10:00:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-18 10:00:12 +0100 |
commit | d6d2254312aede137dcd998a4cdfa26ecd07e379 (patch) | |
tree | 2fc0272f526bb6c53ccf1888764f749acfbd7ee4 /plugins | |
parent | 4549a9524349c4384c0a7a2ca8662a418fc8fbe5 (diff) | |
parent | e030c2d17c10446bda840d66f6753b9bf573d715 (diff) | |
download | monitoring-plugins-d6d2254312aede137dcd998a4cdfa26ecd07e379.tar.gz |
Merge pull request #1697 from RincewindsHat/dont_show_rta_if_useless
check_ping: Do not show RTA if no connection was possible
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_ping.c | 14 | ||||
-rw-r--r-- | plugins/utils.c | 6 |
2 files changed, 14 insertions, 6 deletions
diff --git a/plugins/check_ping.c b/plugins/check_ping.c index 423ecbe5..ba7af373 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("| rta=U;%f;%f;;", wrta, crta); | ||
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, |
diff --git a/plugins/utils.c b/plugins/utils.c index ebdae2e1..17dd5814 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
@@ -589,10 +589,12 @@ char *perfdata (const char *label, | |||
589 | xasprintf (&data, "%s;", data); | 589 | xasprintf (&data, "%s;", data); |
590 | 590 | ||
591 | if (minp) | 591 | if (minp) |
592 | xasprintf (&data, "%s%ld", data, minv); | 592 | xasprintf (&data, "%s%ld;", data, minv); |
593 | else | ||
594 | xasprintf (&data, "%s;", data); | ||
593 | 595 | ||
594 | if (maxp) | 596 | if (maxp) |
595 | xasprintf (&data, "%s;%ld", data, maxv); | 597 | xasprintf (&data, "%s%ld", data, maxv); |
596 | 598 | ||
597 | return data; | 599 | return data; |
598 | } | 600 | } |