diff options
-rw-r--r-- | plugins/check_disk.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index e73a0083..4b5ba5fe 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -165,6 +165,7 @@ main (int argc, char **argv) | |||
165 | int result = STATE_UNKNOWN; | 165 | int result = STATE_UNKNOWN; |
166 | int disk_result = STATE_UNKNOWN; | 166 | int disk_result = STATE_UNKNOWN; |
167 | char *output; | 167 | char *output; |
168 | char *ko_output; | ||
168 | char *details; | 169 | char *details; |
169 | char *perf; | 170 | char *perf; |
170 | char *preamble; | 171 | char *preamble; |
@@ -184,6 +185,7 @@ main (int argc, char **argv) | |||
184 | 185 | ||
185 | preamble = strdup (" - free space:"); | 186 | preamble = strdup (" - free space:"); |
186 | output = strdup (""); | 187 | output = strdup (""); |
188 | ko_output = strdup (""); | ||
187 | details = strdup (""); | 189 | details = strdup (""); |
188 | perf = strdup (""); | 190 | perf = strdup (""); |
189 | stat_buf = malloc(sizeof *stat_buf); | 191 | stat_buf = malloc(sizeof *stat_buf); |
@@ -348,9 +350,6 @@ main (int argc, char **argv) | |||
348 | TRUE, 0, | 350 | TRUE, 0, |
349 | TRUE, path->dtotal_units)); | 351 | TRUE, path->dtotal_units)); |
350 | 352 | ||
351 | if (disk_result==STATE_OK && erronly && !verbose) | ||
352 | continue; | ||
353 | |||
354 | if(disk_result && verbose >= 1) { | 353 | if(disk_result && verbose >= 1) { |
355 | xasprintf(&flag_header, " %s [", state_text (disk_result)); | 354 | xasprintf(&flag_header, " %s [", state_text (disk_result)); |
356 | } else { | 355 | } else { |
@@ -376,15 +375,27 @@ main (int argc, char **argv) | |||
376 | (unsigned long)w_df, (unsigned long)c_df, w_dfp, c_dfp); | 375 | (unsigned long)w_df, (unsigned long)c_df, w_dfp, c_dfp); |
377 | */ | 376 | */ |
378 | 377 | ||
378 | /* OS: #1420 save all not ok paths to different output, but only in case of error only option */ | ||
379 | if (disk_result!=STATE_OK && erronly) { | ||
380 | xasprintf (&ko_output, "%s%s %s %.0f %s (%.0f%%", | ||
381 | ko_output, flag_header, | ||
382 | (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
383 | path->dfree_units, | ||
384 | units, | ||
385 | path->dfree_pct); | ||
386 | } | ||
387 | |||
379 | } | 388 | } |
380 | 389 | ||
390 | /* OS: #1420 only show offending paths if error only option is set, but show all paths if everything is ok */ | ||
391 | output = (erronly && result!=STATE_OK) ? ko_output : output; | ||
381 | } | 392 | } |
382 | 393 | ||
383 | if (verbose >= 2) | 394 | if (verbose >= 2) |
384 | xasprintf (&output, "%s%s", output, details); | 395 | xasprintf (&output, "%s%s", output, details); |
385 | 396 | ||
386 | 397 | ||
387 | printf ("DISK %s%s%s|%s\n", state_text (result), (erronly && result==STATE_OK) ? "" : preamble, output, perf); | 398 | printf ("DISK %s%s%s|%s\n", state_text (result), preamble, output, perf); |
388 | return result; | 399 | return result; |
389 | } | 400 | } |
390 | 401 | ||