diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_disk.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 62858b5f..585c4a66 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -106,6 +106,7 @@ static int require_sync = 0; | |||
106 | struct name_list | 106 | struct name_list |
107 | { | 107 | { |
108 | char *name; | 108 | char *name; |
109 | int found; | ||
109 | struct name_list *name_next; | 110 | struct name_list *name_next; |
110 | }; | 111 | }; |
111 | 112 | ||
@@ -190,6 +191,7 @@ main (int argc, char **argv) | |||
190 | 191 | ||
191 | struct mount_entry *me; | 192 | struct mount_entry *me; |
192 | struct fs_usage fsp; | 193 | struct fs_usage fsp; |
194 | struct name_list *temp_list; | ||
193 | char *disk; | 195 | char *disk; |
194 | 196 | ||
195 | mount_list = read_filesystem_list (0); | 197 | mount_list = read_filesystem_list (0); |
@@ -252,6 +254,16 @@ main (int argc, char **argv) | |||
252 | if (verbose > 2) | 254 | if (verbose > 2) |
253 | asprintf (&output, "%s%s", output, details); | 255 | asprintf (&output, "%s%s", output, details); |
254 | 256 | ||
257 | /* Override result if paths specified and not found */ | ||
258 | temp_list = path_select_list; | ||
259 | while (temp_list) { | ||
260 | if (temp_list->found != TRUE) { | ||
261 | asprintf (&output, "%s [%s not found]", output, temp_list->name); | ||
262 | result = STATE_CRITICAL; | ||
263 | } | ||
264 | temp_list = temp_list->name_next; | ||
265 | } | ||
266 | |||
255 | terminate (result, "DISK %s%s\n", state_text (result), output, details); | 267 | terminate (result, "DISK %s%s\n", state_text (result), output, details); |
256 | } | 268 | } |
257 | 269 | ||
@@ -369,7 +381,7 @@ process_arguments (int argc, char **argv) | |||
369 | mult = (unsigned long)1024 * 1024 * 1024 * 1024; | 381 | mult = (unsigned long)1024 * 1024 * 1024 * 1024; |
370 | units = "TB"; | 382 | units = "TB"; |
371 | } else { | 383 | } else { |
372 | terminate (STATE_UNKNOWN, "unit type %s not known", optarg); | 384 | terminate (STATE_UNKNOWN, "unit type %s not known\n", optarg); |
373 | } | 385 | } |
374 | break; | 386 | break; |
375 | case 'k': /* display mountpoint */ | 387 | case 'k': /* display mountpoint */ |
@@ -383,7 +395,7 @@ process_arguments (int argc, char **argv) | |||
383 | case 'l': | 395 | case 'l': |
384 | show_local_fs = 1; | 396 | show_local_fs = 1; |
385 | break; | 397 | break; |
386 | case 'p': /* selec path */ | 398 | case 'p': /* select path */ |
387 | se = (struct name_list *) malloc (sizeof (struct name_list)); | 399 | se = (struct name_list *) malloc (sizeof (struct name_list)); |
388 | se->name = strdup (optarg); | 400 | se->name = strdup (optarg); |
389 | se->name_next = NULL; | 401 | se->name_next = NULL; |
@@ -504,8 +516,10 @@ int | |||
504 | walk_name_list (struct name_list *list, const char *name) | 516 | walk_name_list (struct name_list *list, const char *name) |
505 | { | 517 | { |
506 | while (list) { | 518 | while (list) { |
507 | if (! strcmp(list->name, name)) | 519 | if (! strcmp(list->name, name)) { |
520 | list->found = 1; | ||
508 | return TRUE; | 521 | return TRUE; |
522 | } | ||
509 | list = list->name_next; | 523 | list = list->name_next; |
510 | } | 524 | } |
511 | return FALSE; | 525 | return FALSE; |