Imported Upstream version 2.0

This commit is contained in:
Jan Wagner 2014-07-11 21:01:00 +02:00
parent c89ccc3c74
commit 0841b5c7c7
165 changed files with 25440 additions and 4442 deletions

View file

@ -1,9 +1,9 @@
/*****************************************************************************
*
* Nagios check_disk plugin
* Monitoring check_disk plugin
*
* License: GPL
* Copyright (c) 1999-2008 Nagios Plugins Development Team
* Copyright (c) 1999-2008 Monitoring Plugins Development Team
*
* Description:
*
@ -29,7 +29,7 @@
const char *progname = "check_disk";
const char *program_name = "check_disk"; /* Required for coreutils libs */
const char *copyright = "1999-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
const char *email = "devel@monitoring-plugins.org";
#include "common.h"
@ -52,6 +52,11 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
#endif
#include "regex.h"
#ifdef __CYGWIN__
# include <windows.h>
# undef ERROR
# define ERROR -1
#endif
/* If nonzero, show inode information. */
static int inode_format = 1;
@ -175,6 +180,10 @@ main (int argc, char **argv)
struct fs_usage fsp, tmpfsp;
struct parameter_list *temp_list, *path;
#ifdef __CYGWIN__
char mountdir[32];
#endif
preamble = strdup (" - free space:");
output = strdup ("");
details = strdup ("");
@ -221,7 +230,6 @@ main (int argc, char **argv)
/* Process for every path in list */
for (path = path_select_list; path; path=path->name_next) {
if (verbose >= 3 && path->freespace_percent->warning != NULL && path->freespace_percent->critical != NULL)
printf("Thresholds(pct) for %s warn: %f crit %f\n",path->name, path->freespace_percent->warning->end,
path->freespace_percent->critical->end);
@ -234,6 +242,13 @@ main (int argc, char **argv)
me = path->best_match;
#ifdef __CYGWIN__
if (strncmp(path->name, "/cygdrive/", 10) != 0 || strlen(path->name) > 11)
continue;
snprintf(mountdir, sizeof(mountdir), "%s:\\", me->me_mountdir + 10);
if (GetDriveType(mountdir) != DRIVE_FIXED)
me->me_remote = 1;
#endif
/* Filters */
/* Remove filesystems already seen */
@ -877,7 +892,7 @@ print_help (void)
printf (" %s\n", "-K, --icritical=PERCENT%");
printf (" %s\n", _("Exit with CRITICAL status if less than PERCENT of inode space is free"));
printf (" %s\n", "-p, --path=PATH, --partition=PARTITION");
printf (" %s\n", _("Path or partition (may be repeated)"));
printf (" %s\n", _("Mount point or block device as emitted by the mount(8) command (may be repeated)"));
printf (" %s\n", "-x, --exclude_device=PATH <STRING>");
printf (" %s\n", _("Ignore device (only works if -p unspecified)"));
printf (" %s\n", "-C, --clear");
@ -911,7 +926,7 @@ print_help (void)
printf (" %s\n", _("Regular expression to ignore selected path/partition (case insensitive) (may be repeated)"));
printf (" %s\n", "-i, --ignore-ereg-path=PATH, --ignore-ereg-partition=PARTITION");
printf (" %s\n", _("Regular expression to ignore selected path or partition (may be repeated)"));
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
printf (UT_PLUG_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
printf (" %s\n", "-u, --units=STRING");
printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)"));
printf (UT_VERBOSE);
@ -970,6 +985,10 @@ get_stats (struct parameter_list *p, struct fs_usage *fsp) {
} else {
/* find all group members */
for (p_list = path_select_list; p_list; p_list=p_list->name_next) {
#ifdef __CYGWIN__
if (strncmp(p_list->name, "/cygdrive/", 10) != 0)
continue;
#endif
if (p_list->group && ! (strcmp(p_list->group, p->group))) {
stat_path(p_list);
get_fs_usage (p_list->best_match->me_mountdir, p_list->best_match->me_devname, &tmpfsp);