summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2026-04-06 11:55:27 +0200
committerGitHub <noreply@github.com>2026-04-06 11:55:27 +0200
commitc57381d789fb246602966fccfcb80131a7fb0461 (patch)
tree2087b6db4410047c93cd2e2a4fb84d2486238d36 /lib
parenta71ce153082565e5728424749475593dc0623492 (diff)
downloadmonitoring-plugins-c57381d789fb246602966fccfcb80131a7fb0461.tar.gz
Revert check_disk performance data back to used space (#2243)
* Implement simple output shortcut for ranges If ranges start with zero (e.g. 0:10), the zero and the colon can be left out. This patch implements this by default, since some systems (icinga2) do not fully implement the whole range format and this reduces errors in the common case of just an upper border. * switch check_disk perfdata back to used space
Diffstat (limited to 'lib')
-rw-r--r--lib/perfdata.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/perfdata.c b/lib/perfdata.c
index f4eaf843..e3710ec7 100644
--- a/lib/perfdata.c
+++ b/lib/perfdata.c
@@ -251,7 +251,16 @@ char *mp_range_to_string(const mp_range input) {
251 if (input.start_infinity) { 251 if (input.start_infinity) {
252 asprintf(&result, "%s~:", result); 252 asprintf(&result, "%s~:", result);
253 } else { 253 } else {
254 asprintf(&result, "%s%s:", result, pd_value_to_string(input.start)); 254 // check for zeroes, so we can use the short form
255 if ((input.start.type == PD_TYPE_NONE) ||
256 ((input.start.type == PD_TYPE_INT) && (input.start.pd_int == 0)) ||
257 ((input.start.type == PD_TYPE_UINT) && (input.start.pd_uint == 0)) ||
258 ((input.start.type == PD_TYPE_DOUBLE) && (input.start.pd_double == 0))){
259 // nothing to do here
260 } else {
261 // Start value is an actual value
262 asprintf(&result, "%s%s:", result, pd_value_to_string(input.start));
263 }
255 } 264 }
256 265
257 if (!input.end_infinity) { 266 if (!input.end_infinity) {