diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2003-03-09 10:39:49 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2003-03-09 10:39:49 +0000 |
commit | 3dfd480b220f6ccdd410357fec457f6280a409f4 (patch) | |
tree | 36556a80f8a5ccdc23cf0c66c90762d4f6469b95 /plugins | |
parent | e5785a500037649a286f927586416bbdf14c7424 (diff) | |
download | monitoring-plugins-3dfd480b220f6ccdd410357fec457f6280a409f4.tar.gz |
Implement error-only option for check_disk (Ian Duggan)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@388 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-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 feeff560..9421d060 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; |