summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ROADMAP117
-rw-r--r--configure.ac29
-rwxr-xr-xopttest.pl50
-rw-r--r--[-rwxr-xr-x]plugins-scripts/check_sensors.sh1
-rw-r--r--plugins/negate.c4
-rwxr-xr-xtools/opttest.pl74
6 files changed, 94 insertions, 181 deletions
diff --git a/ROADMAP b/ROADMAP
deleted file mode 100644
index 6378ec74..00000000
--- a/ROADMAP
+++ /dev/null
@@ -1,117 +0,0 @@
1
2Releases in the 1.3 series will be for development. Version 1.4.0 will
3be the next full production release. I am not planning on dates right now,
4but you can expect maintennence releases for 1.2.9 as well.
5
6With that done, it's time to figure out what we are doing for release
71.3 development. I have a few ideas. Maybe others do as well.
8
9DOCUMENTATION:
10 We pretty much have decided that we will doing something along
11 the lines of a literate programming model. So far, we have site
12 documentation in DocBook. I have some ideas here, which I will
13 discuss in a separate thread.
14
15
16
17OPTION PROCESSING:
18 I believe we can remove reverse compatibility for non-Getopt
19 option specifications. For example, 'check_ping 1 2 3 4 -p 2'
20 would not be supported anymore. Support for this is a hack,
21 and making it portable is bug-prone. We should also review
22 standardization of our options -- the current list is a little
23 ad hoc, it should be nailed down. Details in a separate thread.
24
25Also,
26
27 check_http -p 443 --ssl www.infoplease.com
28
29should be fine, but if the getopt in use does not natively support it,
30things like
31
32 check_http www.infoplease.com -p 443 --ssl
33
34should be trapped and result in a call to one of the usage macros
35(which print a message and then exit STATE_UNKNOWN).
36
37This means that the call_getopt() function can go away. It's an
38inconsistent mess and I'd love to ditch it. I only created it to
39satisfy people that wanted reverse compatibility and did not have
40GNU getopt.
41
42But I would like to urge that all standard plugins contain
43validate_arguments(). I think this will help convey the idea that
44validations should be done, even if we don't insist on the specific
45extent that each plugin must do that validation.
46
47This is the set of standard options I envision:
48
49Reserved:
50
51-h, --help (REQUIRED!!!!!)
52-V, --version (REQUIRED!!!!!)
53-v, --verbose
54-q, --quiet
55-t, --timeout = INTEGER (senonds)
56-c, --critical = (INT|FLOAT|RANGE|LIST)
57-w, --warning = (INT|FLOAT|RANGE|LIST)
58-H, --hostname = STRING
59-F, --file = STRING (usually input)
60-O, --output = STRING (output file)
61
62Recommended, but not reserved:
63
64-I, --ipaddress = STRING
65-C, --community = STRING
66-a, --auth(info) = STRING (authentication or password)
67-l, --logname = STRING
68-p, --password = STRING
69-P, --port = INT
70-u, --url = STRING (also --username if --url is not needed)
71
72I am suggesting that port always be '-P' (uppercase) -- we are
73currently inconsistent in that regard.
74
75I am also adding '-q' for silent running. This is totally self
76centered--I am planning to use a plugin in a cron script, and I
77don't want nightly emails.
78
79As has been the case, ranges are specified with colons, like 'i:j'
80and list are specified with commas like 'i,k' and may contain ranges
81if it makes sense to do so. Perhaps it would be good to build a
82standard list/range processing function for this task.
83
84
85Programming:
86 I would like to follow the GNU guidelines and remove all fixed
87 length character assignments, at least to the extent possible,
88 from the C-based plugins. To that end, I have made strscpy and
89 friends in utils.c -- I'd like to deploy them. I have comments
90 that there is a lot of duplicated code, and techniques used that
91 should be cleaned up. Details in a separate thread.
92
93Remote checks:
94 I have a proposal in hand to incorporate ssh check into spopen()
95 so that remote machine checks can be seamless. A nice idea, but
96 complex enough to require discussion. Another thread.
97
98I also have a wish list, and I'm sure I've forgot some items. I'll
99list mine, please respond with other items that can be put into the
100sourceforge task manager:
101
102 Indent all code in a GNU-compatible manner (indent -ts 2 -br)
103 Add RAND_seed to check_http for --ssl on systems without /dev/random
104 Add regex filtering to check_procs --args option
105 Add working procs syntax for AIX check_procs
106 Allow check_disk to exclude non-local disks
107 Add md5 checksumming to check_http
108 Complete unification of check_tcp and friends
109 Add SSL in a general way to check_tcp and friends
110 Patches to check_log from Joonas
111 Add calculator engine and snmpwalk to check_snmp
112 Is there a bug in check_oracle
113 Are there outstanding bugs in check_snmp
114 Change check_http --onredirect to default as STATE_UNKNOWN
115 Create plugin to check tftp servers
116 Create plugin wrapper to invert error status
117
diff --git a/configure.ac b/configure.ac
index ef3d26e2..204fc6e3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1460,23 +1460,30 @@ AC_ARG_WITH(snmpget_command,
1460 ACX_HELP_STRING([--with-snmpget-command=PATH], 1460 ACX_HELP_STRING([--with-snmpget-command=PATH],
1461 [Path to snmpget command]), 1461 [Path to snmpget command]),
1462 PATH_TO_SNMPGET=$withval) 1462 PATH_TO_SNMPGET=$withval)
1463if test -n "$PATH_TO_SNMPGET"
1464then
1465 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1466 EXTRAS="$EXTRAS check_hpjd check_snmp\$(EXEEXT)"
1467else
1468 AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
1469fi
1470 1463
1471AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext) 1464AC_PATH_PROG(PATH_TO_SNMPGETNEXT,snmpgetnext)
1472AC_ARG_WITH(snmpgetnext_command, 1465AC_ARG_WITH(snmpgetnext_command,
1473 ACX_HELP_STRING([--with-snmpgetnext-command=PATH], 1466 ACX_HELP_STRING([--with-snmpgetnext-command=PATH],
1474 [Path to snmpgetnext command]), 1467 [Path to snmpgetnext command]),
1475 PATH_TO_SNMPGETNEXT=$withval) 1468 PATH_TO_SNMPGETNEXT=$withval)
1476if test -n "$PATH_TO_SNMPGETNEXT" 1469
1477then 1470AS_IF([test -n "$PATH_TO_SNMPGET"], [
1478 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary]) 1471 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
1479fi 1472 EXTRAS="$EXTRAS check_hpjd"
1473
1474 dnl PATH_TO_SNMPGETNEXT is used unconditionally in check_snmp:
1475 dnl
1476 dnl https://github.com/nagios-plugins/nagios-plugins/issues/788
1477 dnl
1478 AS_IF([test -n "$PATH_TO_SNMPGETNEXT"], [
1479 AC_DEFINE_UNQUOTED(PATH_TO_SNMPGETNEXT,"$PATH_TO_SNMPGETNEXT",[path to snmpgetnext binary])
1480 EXTRAS="$EXTRAS check_snmp\$(EXEEXT)"
1481 ], [
1482 AC_MSG_WARN([Get snmpgetnext from https://net-snmp.sourceforge.io/ to build the check_snmp plugin])
1483 ])
1484], [
1485 AC_MSG_WARN([Get snmpget from https://net-snmp.sourceforge.io/ to build the check_hpjd and check_snmp plugins])
1486])
1480 1487
1481if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null ) 1488if ( $PERL -M"Net::SNMP 3.6" -e 'exit' 2>/dev/null )
1482then 1489then
diff --git a/opttest.pl b/opttest.pl
deleted file mode 100755
index 85e3b494..00000000
--- a/opttest.pl
+++ /dev/null
@@ -1,50 +0,0 @@
1#!/usr/bin/perl -w
2use strict;
3use Test;
4
5use vars qw($dir $file $prog $idx $state $output %progs @dirs);
6
7my $tests = 0;
8
9@dirs = qw(plugins plugins-scripts);
10
11foreach $dir (@dirs) {
12 opendir(DIR, $dir) || die "can't opendir $dir: $!";
13 while ($file = readdir(DIR)) {
14 if (-x "$dir/$file" && -f "$dir/$file") {
15 $tests++;
16 $progs{"$dir/$file"} = $file;
17 }
18 }
19 closedir DIR;
20}
21
22plan tests => $tests;
23
24for $prog (keys %progs) {
25 $state = 0;
26 $file = `basename $prog`;
27
28 $idx = 1;
29 $output = `$prog -h 2>&1`;
30 if($?) {$state++;print "$prog failed test $idx\n";}
31 unless ($output =~ m/$progs{$prog}/ms) {
32 $idx++; $state++;print "$output\n$prog failed test $idx\n";
33 }
34
35 $idx++;
36 `$prog --help 2>&1 > /dev/null`;
37 if($?) {$state++;print "$prog failed test $idx\n";}
38
39 $idx++;
40 `$prog -V 2>&1 > /dev/null`;
41 if($?) {$state++;print "$prog failed test $idx\n";}
42
43 $idx++;
44 `$prog --version 2>&1 > /dev/null`;
45 if($?) {$state++;print "$prog failed test $idx\n";}
46
47 print "$prog ($idx tests) ";
48 ok $state,0;
49}
50
diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh
index 866e0e0f..ba3581b1 100755..100644
--- a/plugins-scripts/check_sensors.sh
+++ b/plugins-scripts/check_sensors.sh
@@ -20,7 +20,6 @@ print_help() {
20 echo "This plugin checks hardware status using the lm_sensors package." 20 echo "This plugin checks hardware status using the lm_sensors package."
21 echo "" 21 echo ""
22 support 22 support
23 exit "$STATE_OK"
24} 23}
25 24
26case "$1" in 25case "$1" in
diff --git a/plugins/negate.c b/plugins/negate.c
index 7e52fe67..750c0bfb 100644
--- a/plugins/negate.c
+++ b/plugins/negate.c
@@ -133,11 +133,11 @@ static const char **process_arguments(int argc, char **argv) {
133 break; 133 break;
134 case 'h': /* help */ 134 case 'h': /* help */
135 print_help(); 135 print_help();
136 exit(EXIT_SUCCESS); 136 exit(STATE_UNKNOWN);
137 break; 137 break;
138 case 'V': /* version */ 138 case 'V': /* version */
139 print_revision(progname, NP_VERSION); 139 print_revision(progname, NP_VERSION);
140 exit(EXIT_SUCCESS); 140 exit(STATE_UNKNOWN);
141 case 't': /* timeout period */ 141 case 't': /* timeout period */
142 if (!is_integer(optarg)) 142 if (!is_integer(optarg))
143 usage2(_("Timeout interval must be a positive integer"), optarg); 143 usage2(_("Timeout interval must be a positive integer"), optarg);
diff --git a/tools/opttest.pl b/tools/opttest.pl
new file mode 100755
index 00000000..98213082
--- /dev/null
+++ b/tools/opttest.pl
@@ -0,0 +1,74 @@
1#!/usr/bin/perl -w
2use strict;
3use warnings;
4use Test;
5
6# This script (when executed from the monitoring plugins top level directory)
7# executes all the plugins with -h, --help, -V and --version to verify that
8# all of them exit properly with the state UNKNOWN (3)
9
10use vars qw($dir $file $prog $idx $state $output %progs @dirs);
11
12my $tests = 0;
13
14@dirs = qw(plugins plugins-scripts);
15
16foreach my $dir (@dirs) {
17 opendir(DIR, $dir) || die "can't opendir $dir: $!";
18 while ($file = readdir(DIR)) {
19 if (-x "$dir/$file" && -f "$dir/$file") {
20 $tests++;
21 $progs{"$dir/$file"} = $file;
22 }
23 }
24 closedir DIR;
25}
26
27plan tests => $tests;
28
29for my $prog (keys %progs) {
30 $state = 0;
31 $file = `basename $prog`;
32
33 $idx = 1;
34 $output = `$prog -h 2>&1`;
35 if(($? >> 8) != 3) {
36 $state++;
37 print "$prog failed test $idx (help exit code (short form))\n";
38 exit(1);
39 }
40
41 unless ($output =~ m/$progs{$prog}/ms) {
42 $idx++;
43 $state++;
44 print "$output\n$prog failed test $idx\n";
45 }
46
47 $idx++;
48 `$prog --help 2>&1 > /dev/null`;
49 if(($? >> 8) != 3) {
50 $state++;
51 print "$prog failed test $idx (help exit code (long form))\n";
52 exit(1);
53 }
54
55 $idx++;
56 `$prog -V 2>&1 > /dev/null`;
57 if(($? >> 8) != 3) {
58 $state++;
59 print "$prog failed test $idx (version exit code (short form))\n";
60 exit(1);
61 }
62
63 $idx++;
64 `$prog --version 2>&1 > /dev/null`;
65 if(($? >> 8) != 3) {
66 $state++;
67 print "$prog failed test $idx (version exit code (long form))\n";
68 exit(1);
69 }
70
71 print "$prog ($idx tests) ";
72 ok $state,0;
73}
74