summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2015-10-08 12:52:10 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2015-10-08 12:52:10 +0200
commit37928b52a59f80183004cc36b646aec5f9546ff5 (patch)
tree1d93f5906b99cfc78be4a1a7ee7c9bc0058d6af0
parent934fa89f46789f40834d276a87b939c5df2e6c4f (diff)
parent5a9ca0590f847ef96421912bd2562292580a7d7c (diff)
downloadmonitoring-plugins-37928b5.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--NEWS1
-rw-r--r--plugins-root/check_dhcp.c43
-rw-r--r--plugins/check_snmp.c3
-rw-r--r--plugins/check_ups.c12
-rw-r--r--plugins/t/check_snmp.t4
5 files changed, 22 insertions, 41 deletions
diff --git a/NEWS b/NEWS
index f36326a9..ce1a3895 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ This file documents the major additions and syntax changes between releases.
19 mandated by 2326 19 mandated by 2326
20 Fix check_procs on HP-UX 20 Fix check_procs on HP-UX
21 check_smtp's -e/--expect option can now be combined with -S/--starttls 21 check_smtp's -e/--expect option can now be combined with -S/--starttls
22 Fix incorrect performance data thresholds emitted by check_ups
22 23
23 WARNINGS 24 WARNINGS
24 The format of the performance data emitted by check_mrtgtraf has been 25 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;
229 229
230int process_arguments(int, char **); 230int process_arguments(int, char **);
231int call_getopt(int, char **); 231int call_getopt(int, char **);
232int validate_arguments(void); 232int validate_arguments(int, int);
233void print_usage(void); 233void print_usage(void);
234void print_help(void); 234void print_help(void);
235 235
@@ -1059,29 +1059,19 @@ int get_results(void){
1059 1059
1060/* process command-line arguments */ 1060/* process command-line arguments */
1061int process_arguments(int argc, char **argv){ 1061int process_arguments(int argc, char **argv){
1062 int c; 1062 int arg_index;
1063 1063
1064 if(argc<1) 1064 if(argc<1)
1065 return ERROR; 1065 return ERROR;
1066 1066
1067 c=0; 1067 arg_index = call_getopt(argc,argv);
1068 while((c+=(call_getopt(argc-c,&argv[c])))<argc){ 1068 return validate_arguments(argc,arg_index);
1069
1070 /*
1071 if(is_option(argv[c]))
1072 continue;
1073 */
1074 }
1075
1076 return validate_arguments();
1077 } 1069 }
1078 1070
1079 1071
1080 1072
1081int call_getopt(int argc, char **argv){ 1073int call_getopt(int argc, char **argv){
1082 int c=0; 1074 extern int optind;
1083 int i=0;
1084
1085 int option_index = 0; 1075 int option_index = 0;
1086 static struct option long_options[] = 1076 static struct option long_options[] =
1087 { 1077 {
@@ -1098,25 +1088,14 @@ int call_getopt(int argc, char **argv){
1098 }; 1088 };
1099 1089
1100 while(1){ 1090 while(1){
1101 c=getopt_long(argc,argv,"+hVvt:s:r:t:i:m:u",long_options,&option_index); 1091 int c=0;
1102 1092
1103 i++; 1093 c=getopt_long(argc,argv,"+hVvt:s:r:t:i:m:u",long_options,&option_index);
1104 1094
1105 if(c==-1||c==EOF||c==1) 1095 if(c==-1||c==EOF||c==1)
1106 break; 1096 break;
1107 1097
1108 switch(c){ 1098 switch(c){
1109 case 'w':
1110 case 'r':
1111 case 't':
1112 case 'i':
1113 i++;
1114 break;
1115 default:
1116 break;
1117 }
1118
1119 switch(c){
1120 1099
1121 case 's': /* DHCP server address */ 1100 case 's': /* DHCP server address */
1122 resolve_host(optarg,&dhcp_ip); 1101 resolve_host(optarg,&dhcp_ip);
@@ -1181,12 +1160,14 @@ int call_getopt(int argc, char **argv){
1181 break; 1160 break;
1182 } 1161 }
1183 } 1162 }
1184 1163 return optind;
1185 return i;
1186 } 1164 }
1187 1165
1188 1166
1189int validate_arguments(void){ 1167int validate_arguments(int argc, int arg_index){
1168
1169 if(argc-optind > 0)
1170 usage(_("Got unexpected non-option argument"));
1190 1171
1191 return OK; 1172 return OK;
1192 } 1173 }
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";
41#define DEFAULT_PORT "161" 41#define DEFAULT_PORT "161"
42#define DEFAULT_MIBLIST "ALL" 42#define DEFAULT_MIBLIST "ALL"
43#define DEFAULT_PROTOCOL "1" 43#define DEFAULT_PROTOCOL "1"
44#define DEFAULT_TIMEOUT 1
45#define DEFAULT_RETRIES 5 44#define DEFAULT_RETRIES 5
46#define DEFAULT_AUTH_PROTOCOL "MD5" 45#define DEFAULT_AUTH_PROTOCOL "MD5"
47#define DEFAULT_PRIV_PROTOCOL "DES" 46#define DEFAULT_PRIV_PROTOCOL "DES"
@@ -227,7 +226,7 @@ main (int argc, char **argv)
227 outbuff = strdup (""); 226 outbuff = strdup ("");
228 delimiter = strdup (" = "); 227 delimiter = strdup (" = ");
229 output_delim = strdup (DEFAULT_OUTPUT_DELIMITER); 228 output_delim = strdup (DEFAULT_OUTPUT_DELIMITER);
230 timeout_interval = DEFAULT_TIMEOUT; 229 timeout_interval = DEFAULT_SOCKET_TIMEOUT;
231 retries = DEFAULT_RETRIES; 230 retries = DEFAULT_RETRIES;
232 231
233 np_init( (char *) progname, argc, argv ); 232 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)
242 } 242 }
243 xasprintf (&data, "%s %s", data, 243 xasprintf (&data, "%s %s", data,
244 perfdata ("battery", (long)ups_battery_percent, "%", 244 perfdata ("battery", (long)ups_battery_percent, "%",
245 check_warn, (long)(1000*warning_value), 245 check_warn, (long)(warning_value),
246 check_crit, (long)(1000*critical_value), 246 check_crit, (long)(critical_value),
247 TRUE, 0, TRUE, 100)); 247 TRUE, 0, TRUE, 100));
248 } else { 248 } else {
249 xasprintf (&data, "%s %s", data, 249 xasprintf (&data, "%s %s", data,
@@ -271,8 +271,8 @@ main (int argc, char **argv)
271 } 271 }
272 xasprintf (&data, "%s %s", data, 272 xasprintf (&data, "%s %s", data,
273 perfdata ("load", (long)ups_load_percent, "%", 273 perfdata ("load", (long)ups_load_percent, "%",
274 check_warn, (long)(1000*warning_value), 274 check_warn, (long)(warning_value),
275 check_crit, (long)(1000*critical_value), 275 check_crit, (long)(critical_value),
276 TRUE, 0, TRUE, 100)); 276 TRUE, 0, TRUE, 100));
277 } else { 277 } else {
278 xasprintf (&data, "%s %s", data, 278 xasprintf (&data, "%s %s", data,
@@ -308,8 +308,8 @@ main (int argc, char **argv)
308 } 308 }
309 xasprintf (&data, "%s %s", data, 309 xasprintf (&data, "%s %s", data,
310 perfdata ("temp", (long)ups_temperature, tunits, 310 perfdata ("temp", (long)ups_temperature, tunits,
311 check_warn, (long)(1000*warning_value), 311 check_warn, (long)(warning_value),
312 check_crit, (long)(1000*critical_value), 312 check_crit, (long)(critical_value),
313 TRUE, 0, FALSE, 0)); 313 TRUE, 0, FALSE, 0));
314 } else { 314 } else {
315 xasprintf (&data, "%s %s", data, 315 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: {
166SKIP: { 166SKIP: {
167 skip "no non responsive host defined", 2 if ( ! $host_nonresponsive ); 167 skip "no non responsive host defined", 2 if ( ! $host_nonresponsive );
168 $res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:"); 168 $res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:");
169 cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" ); 169 cmp_ok( $res->return_code, '==', 2, "Exit CRITICAL with non responsive host" );
170 like($res->output, '/External command error: Timeout: No Response from /', "String matches timeout problem"); 170 like($res->output, '/Plugin timed out while executing system call/', "String matches timeout problem");
171} 171}
172 172
173SKIP: { 173SKIP: {