summaryrefslogtreecommitdiffstats
path: root/plugins/check_disk.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_disk.c')
-rw-r--r--plugins/check_disk.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index 4b5ba5f..e73a008 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -165,7 +165,6 @@ 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;
169 char *details; 168 char *details;
170 char *perf; 169 char *perf;
171 char *preamble; 170 char *preamble;
@@ -185,7 +184,6 @@ main (int argc, char **argv)
185 184
186 preamble = strdup (" - free space:"); 185 preamble = strdup (" - free space:");
187 output = strdup (""); 186 output = strdup ("");
188 ko_output = strdup ("");
189 details = strdup (""); 187 details = strdup ("");
190 perf = strdup (""); 188 perf = strdup ("");
191 stat_buf = malloc(sizeof *stat_buf); 189 stat_buf = malloc(sizeof *stat_buf);
@@ -350,6 +348,9 @@ main (int argc, char **argv)
350 TRUE, 0, 348 TRUE, 0,
351 TRUE, path->dtotal_units)); 349 TRUE, path->dtotal_units));
352 350
351 if (disk_result==STATE_OK && erronly && !verbose)
352 continue;
353
353 if(disk_result && verbose >= 1) { 354 if(disk_result && verbose >= 1) {
354 xasprintf(&flag_header, " %s [", state_text (disk_result)); 355 xasprintf(&flag_header, " %s [", state_text (disk_result));
355 } else { 356 } else {
@@ -375,27 +376,15 @@ main (int argc, char **argv)
375 (unsigned long)w_df, (unsigned long)c_df, w_dfp, c_dfp); 376 (unsigned long)w_df, (unsigned long)c_df, w_dfp, c_dfp);
376 */ 377 */
377 378
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
388 } 379 }
389 380
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;
392 } 381 }
393 382
394 if (verbose >= 2) 383 if (verbose >= 2)
395 xasprintf (&output, "%s%s", output, details); 384 xasprintf (&output, "%s%s", output, details);
396 385
397 386
398 printf ("DISK %s%s%s|%s\n", state_text (result), preamble, output, perf); 387 printf ("DISK %s%s%s|%s\n", state_text (result), (erronly && result==STATE_OK) ? "" : preamble, output, perf);
399 return result; 388 return result;
400} 389}
401 390