diff options
-rw-r--r-- | plugins/check_disk.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index feeff56..9421d06 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -54,6 +54,7 @@ float c_dfp = -1.0; | |||
54 | char *path = ""; | 54 | char *path = ""; |
55 | char *exclude_device = ""; | 55 | char *exclude_device = ""; |
56 | int verbose = 0; | 56 | int verbose = 0; |
57 | int erronly = FALSE; | ||
57 | int display_mntp = FALSE; | 58 | int display_mntp = FALSE; |
58 | 59 | ||
59 | 60 | ||
@@ -117,6 +118,9 @@ main (int argc, char **argv) | |||
117 | if (strcmp (file_system, "none") == 0) | 118 | if (strcmp (file_system, "none") == 0) |
118 | strncpy (file_system, mntp, MAX_INPUT_BUFFER-1); | 119 | strncpy (file_system, mntp, MAX_INPUT_BUFFER-1); |
119 | 120 | ||
121 | if (disk_result==STATE_OK && erronly && !verbose) | ||
122 | continue; | ||
123 | |||
120 | if (disk_result!=STATE_OK || verbose>=0) | 124 | if (disk_result!=STATE_OK || verbose>=0) |
121 | asprintf (&output, "%s [%d kB (%d%%) free on %s]", output, | 125 | asprintf (&output, "%s [%d kB (%d%%) free on %s]", output, |
122 | free_disk, 100 - usp, display_mntp ? mntp : file_system); | 126 | free_disk, 100 - usp, display_mntp ? mntp : file_system); |
@@ -172,6 +176,7 @@ process_arguments (int argc, char **argv) | |||
172 | {"partition", required_argument, 0, 'p'}, | 176 | {"partition", required_argument, 0, 'p'}, |
173 | {"verbose", no_argument, 0, 'v'}, | 177 | {"verbose", no_argument, 0, 'v'}, |
174 | {"version", no_argument, 0, 'V'}, | 178 | {"version", no_argument, 0, 'V'}, |
179 | {"errors-only", no_argument, 0, 'e'}, | ||
175 | {"help", no_argument, 0, 'h'}, | 180 | {"help", no_argument, 0, 'h'}, |
176 | {"mountpoint", no_argument, 0, 'm'}, | 181 | {"mountpoint", no_argument, 0, 'm'}, |
177 | {"exclude_device", required_argument, 0, 'x'}, | 182 | {"exclude_device", required_argument, 0, 'x'}, |
@@ -191,9 +196,9 @@ process_arguments (int argc, char **argv) | |||
191 | while (1) { | 196 | while (1) { |
192 | #ifdef HAVE_GETOPT_H | 197 | #ifdef HAVE_GETOPT_H |
193 | c = | 198 | c = |
194 | getopt_long (argc, argv, "+?Vqhvt:c:w:p:x:m", long_options, &option_index); | 199 | getopt_long (argc, argv, "+?Vqhvet:c:w:p:x:m", long_options, &option_index); |
195 | #else | 200 | #else |
196 | c = getopt (argc, argv, "+?Vqhvt:c:w:p:x:m"); | 201 | c = getopt (argc, argv, "+?Vqhvet:c:w:p:x:m"); |
197 | #endif | 202 | #endif |
198 | 203 | ||
199 | if (c == -1 || c == EOF) | 204 | if (c == -1 || c == EOF) |
@@ -249,6 +254,9 @@ process_arguments (int argc, char **argv) | |||
249 | case 'q': /* verbose */ | 254 | case 'q': /* verbose */ |
250 | verbose--; | 255 | verbose--; |
251 | break; | 256 | break; |
257 | case 'e': | ||
258 | erronly = TRUE; | ||
259 | break; | ||
252 | case 'm': /* display mountpoint */ | 260 | case 'm': /* display mountpoint */ |
253 | display_mntp = TRUE; | 261 | display_mntp = TRUE; |
254 | break; | 262 | break; |