diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index c32c7ab3eb80e939c974c222dbab50b6a4f93285..845c74585ebcb3fff03a99ccf9de6e1e71a85493 100644 (file)
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
struct fs_usage fsp, tmpfsp;
struct parameter_list *temp_list, *path;
struct name_list *seen = NULL;
+ struct stat *stat_buf;
preamble = strdup (" - free space:");
output = strdup ("");
/* Error if no match found for specified paths */
temp_list = path_select_list;
+
+ stat_buf = malloc(sizeof *stat_buf);
while (temp_list) {
if (! temp_list->best_match) {
die (STATE_CRITICAL, _("DISK %s: %s not found\n"), _("CRITICAL"), temp_list->name);
}
+
+ /* Stat each entry to check that dir exists */
+ if (stat (temp_list->name, &stat_buf[0])) {
+ printf("DISK %s - ", _("CRITICAL"));
+ die (STATE_CRITICAL, _("%s %s: %s\n"), temp_list->name, _("is not accessible"), strerror(errno));
+ }
temp_list = temp_list->name_next;
}
+ free(stat_buf);
-
/* Process for every path in list */
for (path = path_select_list; path; path=path->name_next) {
struct parameter_list *temp_path_select_list = NULL;
struct mount_entry *me;
int result = OK;
- struct stat *stat_buf;
regex_t re;
int cflags = REG_NOSUB | REG_EXTENDED;
char errbuf[MAX_INPUT_BUFFER];
mult = (uintmax_t)1024 * 1024;
}
- 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,
- temp_list->c_dfp,
- temp_list->w_idfp,
- temp_list->c_idfp,
- temp_list->name) == ERROR)
- result = ERROR;
- */
- temp_list = temp_list->name_next;
- }
- free(stat_buf);
- return result;
- } else {
- return TRUE;
- /* return validate_arguments (w_df, c_df, w_dfp, c_dfp, w_idfp, c_idfp, NULL); */
- }
+ return TRUE;
}
printf ("%s\n", _("Examples:"));
printf (" %s\n", "check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /");
printf (" %s\n", _("Checks /tmp and /var at 10% and 5%, and / at 100MB and 50MB"));
+ printf (" %s\n", "check_disk -w 100M -c 50M -C -w 1000M -c 500M -g sidDATA -r '^/oracle/SID/data.*$'");
+ printf (" %s\n", _("Checks all filesystems not matching -r at 100M and 50M. The fs matching the -r regex"));
+ printf (" %s\n", _("are grouped which means the freespace thresholds are applied to all disks together"));
+ printf (" %s\n", "check_disk -w 100M -c 50M -C -w 1000M -c 500M -p /foo -C -w 5% -c 3% -p /bar");
+ printf (" %s\n", _("Checks /foo for 1000M/500M and /bar for 5/3%. All remaining volumes use 100M/50M"));
printf (_(UT_SUPPORT));
}