[Nagiosplug-checkins] nagiosplug/plugins check_disk.c,1.62,1.63
Ton Voon
tonvoon at users.sourceforge.net
Thu Mar 23 09:17:07 CET 2006
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18117/plugins
Modified Files:
check_disk.c
Log Message:
check_disk now errors if a specified directory does not exist (cf df /foo)
Index: check_disk.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- check_disk.c 23 Mar 2006 12:01:18 -0000 1.62
+++ check_disk.c 23 Mar 2006 17:16:38 -0000 1.63
@@ -305,6 +305,7 @@
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 @@
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 @@
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);
More information about the Commits
mailing list