diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2015-10-08 12:52:10 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2015-10-08 12:52:10 +0200 |
commit | 37928b52a59f80183004cc36b646aec5f9546ff5 (patch) | |
tree | 1d93f5906b99cfc78be4a1a7ee7c9bc0058d6af0 | |
parent | 934fa89f46789f40834d276a87b939c5df2e6c4f (diff) | |
parent | 5a9ca0590f847ef96421912bd2562292580a7d7c (diff) | |
download | monitoring-plugins-37928b52a59f80183004cc36b646aec5f9546ff5.tar.gz |
Merge branch 'maint'
* maint:
sslutils: Remove superfluous parenthesis for sslv3 function too
sslutils: remove superfluous parenthesis
check_snmp: modified tests
check_snmp.c: switched DEFAULT_TIMEOUT to DEFAULT_SOCKET_TIMEOUT (provided by utils.h), already used by help description, see issue #1318
install snmpd on travis tests
enable libtab on travis builds
add perl snmp to travis dependencies
NEWS: Mention check_ups performance data fix
Fix incorrect performance data thresholds
check_dhcp: Fix option parsing
Fixes segfaults when running via monitoring worker (off-by-one)
travis: fix http test host
sslutils: Check if OpenSSL supports SSLv3.
Conflicts:
NEWS
plugins/sslutils.c
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | plugins-root/check_dhcp.c | 43 | ||||
-rw-r--r-- | plugins/check_snmp.c | 3 | ||||
-rw-r--r-- | plugins/check_ups.c | 12 | ||||
-rw-r--r-- | plugins/t/check_snmp.t | 4 |
5 files changed, 22 insertions, 41 deletions
@@ -19,6 +19,7 @@ This file documents the major additions and syntax changes between releases. mandated by 2326 Fix check_procs on HP-UX check_smtp's -e/--expect option can now be combined with -S/--starttls + Fix incorrect performance data thresholds emitted by check_ups WARNINGS The format of the performance data emitted by check_mrtgtraf has been diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 3723e61a..d8afb172 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c @@ -229,7 +229,7 @@ struct in_addr requested_address; int process_arguments(int, char **); int call_getopt(int, char **); -int validate_arguments(void); +int validate_arguments(int, int); void print_usage(void); void print_help(void); @@ -1059,29 +1059,19 @@ int get_results(void){ /* process command-line arguments */ int process_arguments(int argc, char **argv){ - int c; + int arg_index; if(argc<1) return ERROR; - c=0; - while((c+=(call_getopt(argc-c,&argv[c])))<argc){ - - /* - if(is_option(argv[c])) - continue; - */ - } - - return validate_arguments(); + arg_index = call_getopt(argc,argv); + return validate_arguments(argc,arg_index); } int call_getopt(int argc, char **argv){ - int c=0; - int i=0; - + extern int optind; int option_index = 0; static struct option long_options[] = { @@ -1098,25 +1088,14 @@ int call_getopt(int argc, char **argv){ }; while(1){ - c=getopt_long(argc,argv,"+hVvt:s:r:t:i:m:u",long_options,&option_index); + int c=0; - i++; + c=getopt_long(argc,argv,"+hVvt:s:r:t:i:m:u",long_options,&option_index); if(c==-1||c==EOF||c==1) break; switch(c){ - case 'w': - case 'r': - case 't': - case 'i': - i++; - break; - default: - break; - } - - switch(c){ case 's': /* DHCP server address */ resolve_host(optarg,&dhcp_ip); @@ -1181,12 +1160,14 @@ int call_getopt(int argc, char **argv){ break; } } - - return i; + return optind; } -int validate_arguments(void){ +int validate_arguments(int argc, int arg_index){ + + if(argc-optind > 0) + usage(_("Got unexpected non-option argument")); return OK; } diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 28cc44dd..9839d6e8 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -41,7 +41,6 @@ const char *email = "devel@monitoring-plugins.org"; #define DEFAULT_PORT "161" #define DEFAULT_MIBLIST "ALL" #define DEFAULT_PROTOCOL "1" -#define DEFAULT_TIMEOUT 1 #define DEFAULT_RETRIES 5 #define DEFAULT_AUTH_PROTOCOL "MD5" #define DEFAULT_PRIV_PROTOCOL "DES" @@ -227,7 +226,7 @@ main (int argc, char **argv) outbuff = strdup (""); delimiter = strdup (" = "); output_delim = strdup (DEFAULT_OUTPUT_DELIMITER); - timeout_interval = DEFAULT_TIMEOUT; + timeout_interval = DEFAULT_SOCKET_TIMEOUT; retries = DEFAULT_RETRIES; np_init( (char *) progname, argc, argv ); diff --git a/plugins/check_ups.c b/plugins/check_ups.c index dc5a348b..e9e56a51 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c @@ -242,8 +242,8 @@ main (int argc, char **argv) } xasprintf (&data, "%s %s", data, perfdata ("battery", (long)ups_battery_percent, "%", - check_warn, (long)(1000*warning_value), - check_crit, (long)(1000*critical_value), + check_warn, (long)(warning_value), + check_crit, (long)(critical_value), TRUE, 0, TRUE, 100)); } else { xasprintf (&data, "%s %s", data, @@ -271,8 +271,8 @@ main (int argc, char **argv) } xasprintf (&data, "%s %s", data, perfdata ("load", (long)ups_load_percent, "%", - check_warn, (long)(1000*warning_value), - check_crit, (long)(1000*critical_value), + check_warn, (long)(warning_value), + check_crit, (long)(critical_value), TRUE, 0, TRUE, 100)); } else { xasprintf (&data, "%s %s", data, @@ -308,8 +308,8 @@ main (int argc, char **argv) } xasprintf (&data, "%s %s", data, perfdata ("temp", (long)ups_temperature, tunits, - check_warn, (long)(1000*warning_value), - check_crit, (long)(1000*critical_value), + check_warn, (long)(warning_value), + check_crit, (long)(critical_value), TRUE, 0, FALSE, 0)); } else { xasprintf (&data, "%s %s", data, diff --git a/plugins/t/check_snmp.t b/plugins/t/check_snmp.t index 2d6c44a7..aefd872a 100644 --- a/plugins/t/check_snmp.t +++ b/plugins/t/check_snmp.t @@ -166,8 +166,8 @@ SKIP: { SKIP: { skip "no non responsive host defined", 2 if ( ! $host_nonresponsive ); $res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:"); - cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" ); - like($res->output, '/External command error: Timeout: No Response from /', "String matches timeout problem"); + cmp_ok( $res->return_code, '==', 2, "Exit CRITICAL with non responsive host" ); + like($res->output, '/Plugin timed out while executing system call/', "String matches timeout problem"); } SKIP: { |