diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2021-10-25 17:35:29 +0200 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2021-10-26 17:07:09 +0200 |
commit | 8f2cfd1c805f68a21e221f9ea629800be1c88af8 (patch) | |
tree | 33d80078d96a3181b5503d039c48b22ea70bbfaa | |
parent | 078c69d2ddf6b7dd2dfef5ca0f3013a723ec0268 (diff) | |
download | monitoring-plugins-8f2cfd1.tar.gz |
Reformat a little bit for easier reading
-rw-r--r-- | plugins/check_disk.c | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 07862283..00afcad2 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -288,8 +288,17 @@ main (int argc, char **argv) | |||
288 | get_stats (path, &fsp); | 288 | get_stats (path, &fsp); |
289 | 289 | ||
290 | if (verbose >= 3) { | 290 | if (verbose >= 3) { |
291 | printf ("For %s, used_pct=%g free_pct=%g used_units=%g free_units=%g total_units=%g used_inodes_pct=%g free_inodes_pct=%g fsp.fsu_blocksize=%llu mult=%llu\n", | 291 | printf ("For %s, used_pct=%g free_pct=%g used_units=%llu free_units=%llu total_units=%llu used_inodes_pct=%g free_inodes_pct=%g fsp.fsu_blocksize=%llu mult=%llu\n", |
292 | me->me_mountdir, path->dused_pct, path->dfree_pct, path->dused_units, path->dfree_units, path->dtotal_units, path->dused_inodes_percent, path->dfree_inodes_percent, fsp.fsu_blocksize, mult); | 292 | me->me_mountdir, |
293 | path->dused_pct, | ||
294 | path->dfree_pct, | ||
295 | path->dused_units, | ||
296 | path->dfree_units, | ||
297 | path->dtotal_units, | ||
298 | path->dused_inodes_percent, | ||
299 | path->dfree_inodes_percent, | ||
300 | fsp.fsu_blocksize, | ||
301 | mult); | ||
293 | } | 302 | } |
294 | 303 | ||
295 | /* Threshold comparisons */ | 304 | /* Threshold comparisons */ |
@@ -344,12 +353,13 @@ main (int argc, char **argv) | |||
344 | 353 | ||
345 | /* Nb: *_high_tide are unset when == UINT_MAX */ | 354 | /* Nb: *_high_tide are unset when == UINT_MAX */ |
346 | xasprintf (&perf, "%s %s", perf, | 355 | xasprintf (&perf, "%s %s", perf, |
347 | perfdata ((!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | 356 | perfdata_uint64 ( |
348 | path->dused_units, units, | 357 | (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, |
349 | (warning_high_tide != UINT_MAX ? TRUE : FALSE), warning_high_tide, | 358 | path->dused_units * mult, "B", |
350 | (critical_high_tide != UINT_MAX ? TRUE : FALSE), critical_high_tide, | 359 | (warning_high_tide == UINT64_MAX ? FALSE : TRUE), warning_high_tide * mult, |
351 | TRUE, 0, | 360 | (critical_high_tide == UINT64_MAX ? FALSE : TRUE), critical_high_tide * mult, |
352 | TRUE, path->dtotal_units)); | 361 | TRUE, 0, |
362 | TRUE, path->dtotal_units * mult)); | ||
353 | 363 | ||
354 | if (display_inodes_perfdata) { | 364 | if (display_inodes_perfdata) { |
355 | /* *_high_tide must be reinitialized at each run */ | 365 | /* *_high_tide must be reinitialized at each run */ |
@@ -366,12 +376,12 @@ main (int argc, char **argv) | |||
366 | xasprintf (&perf_ilabel, "%s (inodes)", (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir); | 376 | xasprintf (&perf_ilabel, "%s (inodes)", (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir); |
367 | /* Nb: *_high_tide are unset when == UINT_MAX */ | 377 | /* Nb: *_high_tide are unset when == UINT_MAX */ |
368 | xasprintf (&perf, "%s %s", perf, | 378 | xasprintf (&perf, "%s %s", perf, |
369 | perfdata (perf_ilabel, | 379 | perfdata_uint64 (perf_ilabel, |
370 | path->inodes_used, "", | 380 | path->inodes_used, "", |
371 | (warning_high_tide != UINT_MAX ? TRUE : FALSE), warning_high_tide, | 381 | (warning_high_tide != UINT64_MAX ? TRUE : FALSE), warning_high_tide, |
372 | (critical_high_tide != UINT_MAX ? TRUE : FALSE), critical_high_tide, | 382 | (critical_high_tide != UINT64_MAX ? TRUE : FALSE), critical_high_tide, |
373 | TRUE, 0, | 383 | TRUE, 0, |
374 | TRUE, path->inodes_total)); | 384 | TRUE, path->inodes_total)); |
375 | } | 385 | } |
376 | 386 | ||
377 | if (disk_result==STATE_OK && erronly && !verbose) | 387 | if (disk_result==STATE_OK && erronly && !verbose) |
@@ -1055,8 +1065,14 @@ get_stats (struct parameter_list *p, struct fs_usage *fsp) { | |||
1055 | } | 1065 | } |
1056 | if (verbose >= 3) | 1066 | if (verbose >= 3) |
1057 | printf("Group %s now has: used_units=%g free_units=%g total_units=%g fsu_blocksize=%llu mult=%llu\n", | 1067 | printf("Group %s now has: used_units=%g free_units=%g total_units=%g fsu_blocksize=%llu mult=%llu\n", |
1058 | p->group, tmpfsp.fsu_bavail, tmpfsp.fsu_blocksize, p->best_match->me_mountdir, p->dused_units, | 1068 | p->group, |
1059 | p->dfree_units, p->dtotal_units, mult); | 1069 | tmpfsp.fsu_bavail, |
1070 | tmpfsp.fsu_blocksize, | ||
1071 | p->best_match->me_mountdir, | ||
1072 | p->dused_units, | ||
1073 | p->dfree_units, | ||
1074 | p->dtotal_units, | ||
1075 | mult); | ||
1060 | } | 1076 | } |
1061 | /* modify devname and mountdir for output */ | 1077 | /* modify devname and mountdir for output */ |
1062 | p->best_match->me_mountdir = p->best_match->me_devname = p->group; | 1078 | p->best_match->me_mountdir = p->best_match->me_devname = p->group; |