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