aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Richard Leitner <me@g0hl1n.net> 2013-03-22 16:15:49 +0100
committerGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2013-03-25 23:47:12 +0100
commit10a4de3c4cc8465ca08e0cc7b1898cc791761477 (patch)
tree006c52cae087a46f2b1c3111db889959867f2bb7 /plugins
parentfe5fa2a4802215bbc33132b8fc2cc25201c00109 (diff)
downloadmonitoring-plugins-10a4de3c4cc8465ca08e0cc7b1898cc791761477.tar.gz
Fixed SF.net bug 3560976, added --include-type/-N option
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_disk.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index 6ba7bdf3..4ea03935 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -91,9 +91,12 @@ static int stat_remote_fs = 0;
/* Linked list of filesystem types to omit.
If the list is empty, don't exclude any types. */
-
static struct name_list *fs_exclude_list;
+/* Linked list of filesystem types to check.
+ If the list is empty, include all types. */
+static struct name_list *fs_include_list;
+
static struct name_list *dp_exclude_list;
static struct parameter_list *path_select_list = NULL;
@@ -255,6 +258,9 @@ main (int argc, char **argv)
(np_find_name (dp_exclude_list, me->me_devname) ||
np_find_name (dp_exclude_list, me->me_mountdir))) {
continue;
+ /* Skip not included fstypes */
+ } else if (fs_include_list && !np_find_name (fs_include_list, me->me_type)) {
+ continue;
}
stat_path(path);
@@ -419,6 +425,7 @@ process_arguments (int argc, char **argv)
{"partition", required_argument, 0, 'p'},
{"exclude_device", required_argument, 0, 'x'},
{"exclude-type", required_argument, 0, 'X'},
+ {"include-type", required_argument, 0, 'N'},
{"group", required_argument, 0, 'g'},
{"eregi-path", required_argument, 0, 'R'},
{"eregi-partition", required_argument, 0, 'R'},
@@ -452,7 +459,7 @@ process_arguments (int argc, char **argv)
strcpy (argv[c], "-t");
while (1) {
- c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklLg:R:r:i:I:MEA", longopts, &option);
+ c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:N:mklLg:R:r:i:I:MEA", longopts, &option);
if (c == -1 || c == EOF)
break;
@@ -591,6 +598,9 @@ process_arguments (int argc, char **argv)
case 'X': /* exclude file system type */
np_add_name(&fs_exclude_list, optarg);
break;
+ case 'N': /* include file system type */
+ np_add_name(&fs_include_list, optarg);
+ break;
case 'v': /* verbose */
verbose++;
break;
@@ -900,6 +910,8 @@ print_help (void)
printf (UT_VERBOSE);
printf (" %s\n", "-X, --exclude-type=TYPE");
printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)"));
+ printf (" %s\n", "-N, --include-type=TYPE");
+ printf (" %s\n", _("Check only filesystems of indicated type (may be repeated)"));
printf ("\n");
printf ("%s\n", _("Examples:"));
@@ -922,7 +934,7 @@ print_usage (void)
printf ("%s\n", _("Usage:"));
printf (" %s -w limit -c limit [-W limit] [-K limit] {-p path | -x device}\n", progname);
printf ("[-C] [-E] [-e] [-g group ] [-k] [-l] [-M] [-m] [-R path ] [-r path ]\n");
- printf ("[-t timeout] [-u unit] [-v] [-X type]\n");
+ printf ("[-t timeout] [-u unit] [-v] [-X type] [-N type]\n");
}
void