diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_disk.c | 32 | ||||
-rw-r--r-- | plugins/check_ntp.c | 2 | ||||
-rw-r--r-- | plugins/runcmd.c | 2 | ||||
-rw-r--r-- | plugins/t/check_imap.t | 2 | ||||
-rw-r--r-- | plugins/t/check_users.t | 2 | ||||
-rwxr-xr-x | plugins/tests/check_curl.t | 2 |
6 files changed, 26 insertions, 16 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 7dc1c4b..2f066c7 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -93,11 +93,11 @@ static int stat_remote_fs = 0; | |||
93 | 93 | ||
94 | /* Linked list of filesystem types to omit. | 94 | /* Linked list of filesystem types to omit. |
95 | If the list is empty, don't exclude any types. */ | 95 | If the list is empty, don't exclude any types. */ |
96 | static struct name_list *fs_exclude_list; | 96 | 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 | ||
@@ -300,7 +300,7 @@ main (int argc, char **argv) | |||
300 | } else if (me->me_dummy && !show_all_fs) { | 300 | } else if (me->me_dummy && !show_all_fs) { |
301 | continue; | 301 | continue; |
302 | /* Skip excluded fstypes */ | 302 | /* Skip excluded fstypes */ |
303 | } else if (fs_exclude_list && np_find_name (fs_exclude_list, me->me_type)) { | 303 | } else if (fs_exclude_list && np_find_regmatch (fs_exclude_list, me->me_type)) { |
304 | continue; | 304 | continue; |
305 | /* Skip excluded fs's */ | 305 | /* Skip excluded fs's */ |
306 | } else if (dp_exclude_list && | 306 | } else if (dp_exclude_list && |
@@ -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 | } |
@@ -543,7 +543,7 @@ process_arguments (int argc, char **argv) | |||
543 | if (argc < 2) | 543 | if (argc < 2) |
544 | return ERROR; | 544 | return ERROR; |
545 | 545 | ||
546 | np_add_name(&fs_exclude_list, "iso9660"); | 546 | np_add_regex(&fs_exclude_list, "iso9660", REG_EXTENDED); |
547 | 547 | ||
548 | for (c = 1; c < argc; c++) | 548 | for (c = 1; c < argc; c++) |
549 | if (strcmp ("-to", argv[c]) == 0) | 549 | if (strcmp ("-to", argv[c]) == 0) |
@@ -716,10 +716,18 @@ process_arguments (int argc, char **argv) | |||
716 | np_add_name(&dp_exclude_list, optarg); | 716 | np_add_name(&dp_exclude_list, optarg); |
717 | break; | 717 | break; |
718 | case 'X': /* exclude file system type */ | 718 | case 'X': /* exclude file system type */ |
719 | np_add_name(&fs_exclude_list, optarg); | 719 | err = np_add_regex(&fs_exclude_list, optarg, REG_EXTENDED); |
720 | if (err != 0) { | ||
721 | regerror (err, &fs_exclude_list->regex, errbuf, MAX_INPUT_BUFFER); | ||
722 | die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), _("Could not compile regular expression"), errbuf); | ||
723 | } | ||
720 | break; | 724 | break; |
721 | case 'N': /* include file system type */ | 725 | case 'N': /* include file system type */ |
722 | 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 | } | ||
723 | break; | 731 | break; |
724 | case 'v': /* verbose */ | 732 | case 'v': /* verbose */ |
725 | verbose++; | 733 | verbose++; |
@@ -1003,10 +1011,10 @@ print_help (void) | |||
1003 | printf (" %s\n", "-u, --units=STRING"); | 1011 | printf (" %s\n", "-u, --units=STRING"); |
1004 | printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)")); | 1012 | printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)")); |
1005 | printf (UT_VERBOSE); | 1013 | printf (UT_VERBOSE); |
1006 | printf (" %s\n", "-X, --exclude-type=TYPE"); | 1014 | printf (" %s\n", "-X, --exclude-type=TYPE_REGEX"); |
1007 | printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)")); | 1015 | printf (" %s\n", _("Ignore all filesystems of types matching given regex(7) (may be repeated)")); |
1008 | printf (" %s\n", "-N, --include-type=TYPE"); | 1016 | printf (" %s\n", "-N, --include-type=TYPE_REGEX"); |
1009 | printf (" %s\n", _("Check only filesystems of indicated type (may be repeated)")); | 1017 | printf (" %s\n", _("Check only filesystems where the type matches this given regex(7) (may be repeated)")); |
1010 | 1018 | ||
1011 | printf ("\n"); | 1019 | printf ("\n"); |
1012 | printf ("%s\n", _("General usage hints:")); | 1020 | printf ("%s\n", _("General usage hints:")); |
@@ -1037,7 +1045,7 @@ print_usage (void) | |||
1037 | printf ("%s\n", _("Usage:")); | 1045 | printf ("%s\n", _("Usage:")); |
1038 | printf (" %s {-w absolute_limit |-w percentage_limit%% | -W inode_percentage_limit } {-c absolute_limit|-c percentage_limit%% | -K inode_percentage_limit } {-p path | -x device}\n", progname); | 1046 | printf (" %s {-w absolute_limit |-w percentage_limit%% | -W inode_percentage_limit } {-c absolute_limit|-c percentage_limit%% | -K inode_percentage_limit } {-p path | -x device}\n", progname); |
1039 | printf ("[-C] [-E] [-e] [-f] [-g group ] [-k] [-l] [-M] [-m] [-R path ] [-r path ]\n"); | 1047 | printf ("[-C] [-E] [-e] [-f] [-g group ] [-k] [-l] [-M] [-m] [-R path ] [-r path ]\n"); |
1040 | printf ("[-t timeout] [-u unit] [-v] [-X type] [-N type]\n"); | 1048 | printf ("[-t timeout] [-u unit] [-v] [-X type_regex] [-N type]\n"); |
1041 | } | 1049 | } |
1042 | 1050 | ||
1043 | bool | 1051 | bool |
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c index 3614650..99537c8 100644 --- a/plugins/check_ntp.c +++ b/plugins/check_ntp.c | |||
@@ -486,7 +486,7 @@ double offset_request(const char *host, int *status){ | |||
486 | } | 486 | } |
487 | 487 | ||
488 | /* cleanup */ | 488 | /* cleanup */ |
489 | /* FIXME: Not closing the socket to avoid re-use of the local port | 489 | /* FIXME: Not closing the socket to avoid reuse of the local port |
490 | * which can cause old NTP packets to be read instead of NTP control | 490 | * which can cause old NTP packets to be read instead of NTP control |
491 | * packets in jitter_request(). THERE MUST BE ANOTHER WAY... | 491 | * packets in jitter_request(). THERE MUST BE ANOTHER WAY... |
492 | * for(j=0; j<num_hosts; j++){ close(socklist[j]); } */ | 492 | * for(j=0; j<num_hosts; j++){ close(socklist[j]); } */ |
diff --git a/plugins/runcmd.c b/plugins/runcmd.c index bc0a497..4f3e349 100644 --- a/plugins/runcmd.c +++ b/plugins/runcmd.c | |||
@@ -60,6 +60,8 @@ | |||
60 | # define SIG_ERR ((Sigfunc *)-1) | 60 | # define SIG_ERR ((Sigfunc *)-1) |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | #include "../lib/maxfd.h" | ||
64 | |||
63 | /* This variable must be global, since there's no way the caller | 65 | /* This variable must be global, since there's no way the caller |
64 | * can forcibly slay a dead or ungainly running program otherwise. | 66 | * can forcibly slay a dead or ungainly running program otherwise. |
65 | * Multithreading apps and plugins can initialize it (via NP_RUNCMD_INIT) | 67 | * Multithreading apps and plugins can initialize it (via NP_RUNCMD_INIT) |
diff --git a/plugins/t/check_imap.t b/plugins/t/check_imap.t index 7c74e56..cf2f81c 100644 --- a/plugins/t/check_imap.t +++ b/plugins/t/check_imap.t | |||
@@ -25,7 +25,7 @@ $t = NPTest->testCmd( "./check_imap $host_tcp_imap -p 143 -wt 9 -ct 9 -to 10 -e | |||
25 | cmp_ok( $t->return_code, '==', 0, "Check old parameter options" ); | 25 | cmp_ok( $t->return_code, '==', 0, "Check old parameter options" ); |
26 | 26 | ||
27 | $t = NPTest->testCmd( "./check_imap $host_nonresponsive" ); | 27 | $t = NPTest->testCmd( "./check_imap $host_nonresponsive" ); |
28 | cmp_ok( $t->return_code, '==', 2, "Get error with non reponsive host" ); | 28 | cmp_ok( $t->return_code, '==', 2, "Get error with non responsive host" ); |
29 | 29 | ||
30 | $t = NPTest->testCmd( "./check_imap $hostname_invalid" ); | 30 | $t = NPTest->testCmd( "./check_imap $hostname_invalid" ); |
31 | cmp_ok( $t->return_code, '==', 2, "Invalid hostname" ); | 31 | cmp_ok( $t->return_code, '==', 2, "Invalid hostname" ); |
diff --git a/plugins/t/check_users.t b/plugins/t/check_users.t index 088f3b5..9ebc2fc 100644 --- a/plugins/t/check_users.t +++ b/plugins/t/check_users.t | |||
@@ -2,7 +2,7 @@ | |||
2 | # | 2 | # |
3 | # Logged in Users Tests via check_users | 3 | # Logged in Users Tests via check_users |
4 | # | 4 | # |
5 | # Trick: This ckeck requires at least 1 user logged in. These commands should | 5 | # Trick: This check requires at least 1 user logged in. These commands should |
6 | # leave a session open forever in the background: | 6 | # leave a session open forever in the background: |
7 | # | 7 | # |
8 | # $ ssh -tt localhost </dev/null >/dev/null 2>/dev/null & | 8 | # $ ssh -tt localhost </dev/null >/dev/null 2>/dev/null & |
diff --git a/plugins/tests/check_curl.t b/plugins/tests/check_curl.t index 72f2b7c..3c91483 100755 --- a/plugins/tests/check_curl.t +++ b/plugins/tests/check_curl.t | |||
@@ -9,7 +9,7 @@ | |||
9 | # Country Name (2 letter code) [AU]:DE | 9 | # Country Name (2 letter code) [AU]:DE |
10 | # State or Province Name (full name) [Some-State]:Bavaria | 10 | # State or Province Name (full name) [Some-State]:Bavaria |
11 | # Locality Name (eg, city) []:Munich | 11 | # Locality Name (eg, city) []:Munich |
12 | # Organization Name (eg, company) [Internet Widgits Pty Ltd]:Monitoring Plugins | 12 | # Organization Name (eg, company) [Internet Widgets Pty Ltd]:Monitoring Plugins |
13 | # Organizational Unit Name (eg, section) []: | 13 | # Organizational Unit Name (eg, section) []: |
14 | # Common Name (e.g. server FQDN or YOUR name) []:Monitoring Plugins | 14 | # Common Name (e.g. server FQDN or YOUR name) []:Monitoring Plugins |
15 | # Email Address []:devel@monitoring-plugins.org | 15 | # Email Address []:devel@monitoring-plugins.org |