diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-03-23 17:16:38 (GMT) |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-03-23 17:16:38 (GMT) |
commit | ada5f2fe02f4171e82ff7adc39d5f46dda40e4b1 (patch) | |
tree | 9fcc284629332af23c36449cd430c16bbacfb260 /plugins/check_disk.c | |
parent | f82e0dfa81f134c5e064730fac7690a7aa435f59 (diff) | |
download | monitoring-plugins-ada5f2fe02f4171e82ff7adc39d5f46dda40e4b1.tar.gz |
check_disk now errors if a specified directory does not exist (cf df /foo)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1351 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_disk.c')
-rw-r--r-- | plugins/check_disk.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index fa913ac..c7a2b8a 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -305,6 +305,7 @@ process_arguments (int argc, char **argv) | |||
305 | struct name_list **dptail = &dp_exclude_list; | 305 | struct name_list **dptail = &dp_exclude_list; |
306 | struct name_list *temp_list; | 306 | struct name_list *temp_list; |
307 | int result = OK; | 307 | int result = OK; |
308 | struct stat *stat_buf; | ||
308 | 309 | ||
309 | unsigned long l; | 310 | unsigned long l; |
310 | 311 | ||
@@ -553,7 +554,13 @@ process_arguments (int argc, char **argv) | |||
553 | 554 | ||
554 | if (path_select_list) { | 555 | if (path_select_list) { |
555 | temp_list = path_select_list; | 556 | temp_list = path_select_list; |
557 | stat_buf = malloc(sizeof stat_buf); | ||
556 | while (temp_list) { | 558 | while (temp_list) { |
559 | /* Stat each entry to check that dir exists */ | ||
560 | if (stat (temp_list->name, &stat_buf[0])) { | ||
561 | printf("DISK %s - ", _("CRITICAL")); | ||
562 | die (STATE_CRITICAL, _("%s does not exist\n"), temp_list->name); | ||
563 | } | ||
557 | if (validate_arguments (temp_list->w_df, | 564 | if (validate_arguments (temp_list->w_df, |
558 | temp_list->c_df, | 565 | temp_list->c_df, |
559 | temp_list->w_dfp, | 566 | temp_list->w_dfp, |
@@ -564,6 +571,7 @@ process_arguments (int argc, char **argv) | |||
564 | result = ERROR; | 571 | result = ERROR; |
565 | temp_list = temp_list->name_next; | 572 | temp_list = temp_list->name_next; |
566 | } | 573 | } |
574 | free(stat_buf); | ||
567 | return result; | 575 | return result; |
568 | } else { | 576 | } else { |
569 | return validate_arguments (w_df, c_df, w_dfp, c_dfp, w_idfp, c_idfp, NULL); | 577 | return validate_arguments (w_df, c_df, w_dfp, c_dfp, w_idfp, c_idfp, NULL); |