From ada5f2fe02f4171e82ff7adc39d5f46dda40e4b1 Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Thu, 23 Mar 2006 17:16:38 +0000 Subject: 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 --- plugins/check_disk.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'plugins/check_disk.c') diff --git a/plugins/check_disk.c b/plugins/check_disk.c index fa913ac7..c7a2b8a3 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -305,6 +305,7 @@ process_arguments (int argc, char **argv) struct name_list **dptail = &dp_exclude_list; struct name_list *temp_list; int result = OK; + struct stat *stat_buf; unsigned long l; @@ -553,7 +554,13 @@ process_arguments (int argc, char **argv) if (path_select_list) { temp_list = path_select_list; + stat_buf = malloc(sizeof stat_buf); while (temp_list) { + /* Stat each entry to check that dir exists */ + if (stat (temp_list->name, &stat_buf[0])) { + printf("DISK %s - ", _("CRITICAL")); + die (STATE_CRITICAL, _("%s does not exist\n"), temp_list->name); + } if (validate_arguments (temp_list->w_df, temp_list->c_df, temp_list->w_dfp, @@ -564,6 +571,7 @@ process_arguments (int argc, char **argv) result = ERROR; temp_list = temp_list->name_next; } + free(stat_buf); return result; } else { return validate_arguments (w_df, c_df, w_dfp, c_dfp, w_idfp, c_idfp, NULL); -- cgit v1.2.3-74-g34f1