diff options
| author | Kristian Schuster <116557017+KriSchu@users.noreply.github.com> | 2023-02-20 02:03:01 +0100 |
|---|---|---|
| committer | Kristian Schuster <116557017+KriSchu@users.noreply.github.com> | 2023-02-20 02:03:01 +0100 |
| commit | e102b8a49e857a474db516455d2e871e6834ae34 (patch) | |
| tree | 6057994e8c341c481b8b50e9ba9aec12e978e864 /plugins/check_disk.c | |
| parent | a58293a0c288ee0e050c79715073da9fbdfc4c58 (diff) | |
| download | monitoring-plugins-e102b8a49e857a474db516455d2e871e6834ae34.tar.gz | |
check_disk: fix ugly output with -e option and adapt tests accordingly
Diffstat (limited to 'plugins/check_disk.c')
| -rw-r--r-- | plugins/check_disk.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index d32841d8..c52d1df4 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
| @@ -186,8 +186,8 @@ main (int argc, char **argv) | |||
| 186 | char mountdir[32]; | 186 | char mountdir[32]; |
| 187 | #endif | 187 | #endif |
| 188 | 188 | ||
| 189 | preamble = strdup (" free space:"); | 189 | preamble = strdup (" - free space:"); |
| 190 | ignored_preamble = strdup (" ignored paths:"); | 190 | ignored_preamble = strdup (" - ignored paths:"); |
| 191 | output = strdup (""); | 191 | output = strdup (""); |
| 192 | ignored = strdup (""); | 192 | ignored = strdup (""); |
| 193 | details = strdup (""); | 193 | details = strdup (""); |
| @@ -455,12 +455,12 @@ main (int argc, char **argv) | |||
| 455 | if (verbose >= 2) | 455 | if (verbose >= 2) |
| 456 | xasprintf (&output, "%s%s", output, details); | 456 | xasprintf (&output, "%s%s", output, details); |
| 457 | 457 | ||
| 458 | if (strcmp(output, "") == 0) { | 458 | if (strcmp(output, "") == 0 && ! erronly) { |
| 459 | preamble = ""; | 459 | preamble = ""; |
| 460 | xasprintf (&output, " No disks were found for provided parameters;"); | 460 | xasprintf (&output, " - No disks were found for provided parameters;"); |
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | printf ("DISK %s -%s%s%s%s|%s\n", state_text (result), ((erronly && result==STATE_OK)) ? "" : preamble, output, (strcmp(ignored, "") == 0) ? "" : ignored_preamble, ignored, perf); | 463 | printf ("DISK %s%s%s%s%s|%s\n", state_text (result), ((erronly && result==STATE_OK)) ? "" : preamble, output, (strcmp(ignored, "") == 0) ? "" : ignored_preamble, ignored, perf); |
| 464 | return result; | 464 | return result; |
| 465 | } | 465 | } |
| 466 | 466 | ||
