From cbb507c89feebf2fc46a6341584de0c730ecf458 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Tue, 1 Oct 2013 02:12:33 +0200 Subject: check_disk: show troubled partition in verbose mode I'm submitting a small patch to check_disk that will show which partitions are actually causing the error state. This helps the human operator to quickly identify the exact issue. I made it so a single -v flag is required so it doesn't harm legacy code that may be parsing the original style of output. Thanks to Jason Benguerel. --- Closes #984 Closes #1182 diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 925dfa8..0d73a4f 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -171,6 +171,7 @@ main (int argc, char **argv) char *details; char *perf; char *preamble; + char *flag_header; double inode_space_pct; double warning_high_tide; double critical_high_tide; @@ -353,18 +354,23 @@ main (int argc, char **argv) if (disk_result==STATE_OK && erronly && !verbose) continue; - xasprintf (&output, "%s %s %.0f %s (%.0f%%", - output, + if(disk_result && verbose >= 1) { + xasprintf(&flag_header, " %s [", state_text (disk_result)); + } else { + xasprintf(&flag_header, ""); + } + xasprintf (&output, "%s%s %s %.0f %s (%.0f%%", + output, flag_header, (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, path->dfree_units, units, path->dfree_pct); if (path->dused_inodes_percent < 0) { - xasprintf(&output, "%s inode=-);", output); + xasprintf(&output, "%s inode=-)%s;", output, (disk_result ? "]" : "")); } else { - xasprintf(&output, "%s inode=%.0f%%);", output, path->dfree_inodes_percent ); + xasprintf(&output, "%s inode=%.0f%%)%s;", output, path->dfree_inodes_percent, ((disk_result && verbose >= 1) ? "]" : "")); } - + free(flag_header); /* TODO: Need to do a similar debug line xasprintf (&details, _("%s\n\ %.0f of %.0f %s (%.0f%% inode=%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"), -- cgit v0.10-9-g596f From 29844037cc4325fced47bdb7a15ddc9d995ac3b7 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Tue, 29 Jul 2014 15:43:44 +0200 Subject: Adding Jason Benguerel diff --git a/THANKS.in b/THANKS.in index b6dc294..4f65260 100644 --- a/THANKS.in +++ b/THANKS.in @@ -326,3 +326,4 @@ Mikael Falkvidd Patric Wust Julius Kriukas Patrick McAndrew +Jason Benguerel -- cgit v0.10-9-g596f