diff options
author | Richard Leitner <me@g0hl1n.net> | 2013-03-22 15:15:49 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-03-25 22:47:12 (GMT) |
commit | 10a4de3c4cc8465ca08e0cc7b1898cc791761477 (patch) | |
tree | 006c52cae087a46f2b1c3111db889959867f2bb7 /plugins | |
parent | fe5fa2a4802215bbc33132b8fc2cc25201c00109 (diff) | |
download | monitoring-plugins-10a4de3c4cc8465ca08e0cc7b1898cc791761477.tar.gz |
Fixed SF.net bug 3560976, added --include-type/-N option
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_disk.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 6ba7bdf..4ea0393 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -91,9 +91,12 @@ static int stat_remote_fs = 0; | |||
91 | 91 | ||
92 | /* Linked list of filesystem types to omit. | 92 | /* Linked list of filesystem types to omit. |
93 | If the list is empty, don't exclude any types. */ | 93 | If the list is empty, don't exclude any types. */ |
94 | |||
95 | static struct name_list *fs_exclude_list; | 94 | static struct name_list *fs_exclude_list; |
96 | 95 | ||
96 | /* Linked list of filesystem types to check. | ||
97 | If the list is empty, include all types. */ | ||
98 | static struct name_list *fs_include_list; | ||
99 | |||
97 | static struct name_list *dp_exclude_list; | 100 | static struct name_list *dp_exclude_list; |
98 | 101 | ||
99 | static struct parameter_list *path_select_list = NULL; | 102 | static struct parameter_list *path_select_list = NULL; |
@@ -255,6 +258,9 @@ main (int argc, char **argv) | |||
255 | (np_find_name (dp_exclude_list, me->me_devname) || | 258 | (np_find_name (dp_exclude_list, me->me_devname) || |
256 | np_find_name (dp_exclude_list, me->me_mountdir))) { | 259 | np_find_name (dp_exclude_list, me->me_mountdir))) { |
257 | continue; | 260 | continue; |
261 | /* Skip not included fstypes */ | ||
262 | } else if (fs_include_list && !np_find_name (fs_include_list, me->me_type)) { | ||
263 | continue; | ||
258 | } | 264 | } |
259 | 265 | ||
260 | stat_path(path); | 266 | stat_path(path); |
@@ -419,6 +425,7 @@ process_arguments (int argc, char **argv) | |||
419 | {"partition", required_argument, 0, 'p'}, | 425 | {"partition", required_argument, 0, 'p'}, |
420 | {"exclude_device", required_argument, 0, 'x'}, | 426 | {"exclude_device", required_argument, 0, 'x'}, |
421 | {"exclude-type", required_argument, 0, 'X'}, | 427 | {"exclude-type", required_argument, 0, 'X'}, |
428 | {"include-type", required_argument, 0, 'N'}, | ||
422 | {"group", required_argument, 0, 'g'}, | 429 | {"group", required_argument, 0, 'g'}, |
423 | {"eregi-path", required_argument, 0, 'R'}, | 430 | {"eregi-path", required_argument, 0, 'R'}, |
424 | {"eregi-partition", required_argument, 0, 'R'}, | 431 | {"eregi-partition", required_argument, 0, 'R'}, |
@@ -452,7 +459,7 @@ process_arguments (int argc, char **argv) | |||
452 | strcpy (argv[c], "-t"); | 459 | strcpy (argv[c], "-t"); |
453 | 460 | ||
454 | while (1) { | 461 | while (1) { |
455 | c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklLg:R:r:i:I:MEA", longopts, &option); | 462 | c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:N:mklLg:R:r:i:I:MEA", longopts, &option); |
456 | 463 | ||
457 | if (c == -1 || c == EOF) | 464 | if (c == -1 || c == EOF) |
458 | break; | 465 | break; |
@@ -591,6 +598,9 @@ process_arguments (int argc, char **argv) | |||
591 | case 'X': /* exclude file system type */ | 598 | case 'X': /* exclude file system type */ |
592 | np_add_name(&fs_exclude_list, optarg); | 599 | np_add_name(&fs_exclude_list, optarg); |
593 | break; | 600 | break; |
601 | case 'N': /* include file system type */ | ||
602 | np_add_name(&fs_include_list, optarg); | ||
603 | break; | ||
594 | case 'v': /* verbose */ | 604 | case 'v': /* verbose */ |
595 | verbose++; | 605 | verbose++; |
596 | break; | 606 | break; |
@@ -900,6 +910,8 @@ print_help (void) | |||
900 | printf (UT_VERBOSE); | 910 | printf (UT_VERBOSE); |
901 | printf (" %s\n", "-X, --exclude-type=TYPE"); | 911 | printf (" %s\n", "-X, --exclude-type=TYPE"); |
902 | printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)")); | 912 | printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)")); |
913 | printf (" %s\n", "-N, --include-type=TYPE"); | ||
914 | printf (" %s\n", _("Check only filesystems of indicated type (may be repeated)")); | ||
903 | 915 | ||
904 | printf ("\n"); | 916 | printf ("\n"); |
905 | printf ("%s\n", _("Examples:")); | 917 | printf ("%s\n", _("Examples:")); |
@@ -922,7 +934,7 @@ print_usage (void) | |||
922 | printf ("%s\n", _("Usage:")); | 934 | printf ("%s\n", _("Usage:")); |
923 | printf (" %s -w limit -c limit [-W limit] [-K limit] {-p path | -x device}\n", progname); | 935 | printf (" %s -w limit -c limit [-W limit] [-K limit] {-p path | -x device}\n", progname); |
924 | printf ("[-C] [-E] [-e] [-g group ] [-k] [-l] [-M] [-m] [-R path ] [-r path ]\n"); | 936 | printf ("[-C] [-E] [-e] [-g group ] [-k] [-l] [-M] [-m] [-R path ] [-r path ]\n"); |
925 | printf ("[-t timeout] [-u unit] [-v] [-X type]\n"); | 937 | printf ("[-t timeout] [-u unit] [-v] [-X type] [-N type]\n"); |
926 | } | 938 | } |
927 | 939 | ||
928 | void | 940 | void |