diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2023-09-30 10:54:21 (GMT) |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2023-09-30 10:54:21 (GMT) |
commit | 6947a8cea9335c2eeefb8929aa663db49ecac5a1 (patch) | |
tree | a2e2191be4e772d44037bfa96afa7f5571d82386 /plugins | |
parent | 677bbd21a97a95bf149a8bbbeac397a92a0e19d2 (diff) | |
download | monitoring-plugins-6947a8cea9335c2eeefb8929aa663db49ecac5a1.tar.gz |
check_disk: Use regex also to include fs types
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_disk.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index e7e9378..06576d8 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -97,7 +97,7 @@ static struct regex_list *fs_exclude_list = NULL; | |||
97 | 97 | ||
98 | /* Linked list of filesystem types to check. | 98 | /* Linked list of filesystem types to check. |
99 | If the list is empty, include all types. */ | 99 | If the list is empty, include all types. */ |
100 | static struct name_list *fs_include_list; | 100 | static struct regex_list *fs_include_list; |
101 | 101 | ||
102 | static struct name_list *dp_exclude_list; | 102 | static struct name_list *dp_exclude_list; |
103 | 103 | ||
@@ -308,7 +308,7 @@ main (int argc, char **argv) | |||
308 | np_find_name (dp_exclude_list, me->me_mountdir))) { | 308 | np_find_name (dp_exclude_list, me->me_mountdir))) { |
309 | continue; | 309 | continue; |
310 | /* Skip not included fstypes */ | 310 | /* Skip not included fstypes */ |
311 | } else if (fs_include_list && !np_find_name (fs_include_list, me->me_type)) { | 311 | } else if (fs_include_list && !np_find_regmatch(fs_include_list, me->me_type)) { |
312 | continue; | 312 | continue; |
313 | } | 313 | } |
314 | } | 314 | } |
@@ -723,7 +723,11 @@ process_arguments (int argc, char **argv) | |||
723 | } | 723 | } |
724 | break; | 724 | break; |
725 | case 'N': /* include file system type */ | 725 | case 'N': /* include file system type */ |
726 | np_add_name(&fs_include_list, optarg); | 726 | err = np_add_regex(&fs_include_list, optarg, REG_EXTENDED); |
727 | if (err != 0) { | ||
728 | regerror (err, &fs_exclude_list->regex, errbuf, MAX_INPUT_BUFFER); | ||
729 | die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), _("Could not compile regular expression"), errbuf); | ||
730 | } | ||
727 | break; | 731 | break; |
728 | case 'v': /* verbose */ | 732 | case 'v': /* verbose */ |
729 | verbose++; | 733 | verbose++; |