Pārlūkot izejas kodu

Allow check_ifstatus to accept version=2c

Ton Voon 15 gadi atpakaļ
vecāks
revīzija
0205c7c0cf
3 mainītis faili ar 7 papildinājumiem un 2 dzēšanām
  1. 1 0
      NEWS
  2. 1 0
      THANKS.in
  3. 5 2
      plugins-scripts/check_ifstatus.pl

+ 1 - 0
NEWS

@@ -30,6 +30,7 @@ This file documents the major additions and syntax changes between releases.
 	Fix parsing of multi-line strings in check_snmp (broken in 1.4.14) and enhance output in such case (#2832451)
 	Fix parsing of multi-line strings in check_snmp (broken in 1.4.14) and enhance output in such case (#2832451)
 	Fix detection of pst3 64-bit compile flags with Sun CC
 	Fix detection of pst3 64-bit compile flags with Sun CC
 	Fix cmd_run overwriting the environment, which would break some commands that needed it
 	Fix cmd_run overwriting the environment, which would break some commands that needed it
+	Allow check_ifstatus to accept version=2c - used to only allow version=2 (Brian Landers)
 	WARNINGS
 	WARNINGS
 	Updated developer documentation to say that performance labels should not have an equals sign or
 	Updated developer documentation to say that performance labels should not have an equals sign or
 	single quote in the label
 	single quote in the label

+ 1 - 0
THANKS.in

@@ -264,3 +264,4 @@ Josip Rodin
 Dann Frazier
 Dann Frazier
 Stephane Chazelas
 Stephane Chazelas
 Craig Leres
 Craig Leres
+Brian Landers

+ 5 - 2
plugins-scripts/check_ifstatus.pl

@@ -280,7 +280,7 @@ sub process_arguments() {
 	$status = GetOptions(
 	$status = GetOptions(
 		"V"   => \$opt_V, "version"    => \$opt_V,
 		"V"   => \$opt_V, "version"    => \$opt_V,
 		"h"   => \$opt_h, "help"       => \$opt_h,
 		"h"   => \$opt_h, "help"       => \$opt_h,
-		"v=i" => \$snmp_version, "snmp_version=i"  => \$snmp_version,
+		"v=s" => \$snmp_version, "snmp_version=s"  => \$snmp_version,
 		"C=s" => \$community,"community=s" => \$community,
 		"C=s" => \$community,"community=s" => \$community,
 		"L=s" => \$seclevel, "seclevel=s" => \$seclevel,
 		"L=s" => \$seclevel, "seclevel=s" => \$seclevel,
 		"a=s" => \$authproto, "authproto=s" => \$authproto,
 		"a=s" => \$authproto, "authproto=s" => \$authproto,
@@ -317,7 +317,10 @@ sub process_arguments() {
 		$timeout = $TIMEOUT;
 		$timeout = $TIMEOUT;
 	}
 	}
 
 
-	if ($snmp_version !~ /[123]/){
+	# Net::SNMP wants an integer
+	$snmp_version = 2 if $snmp_version eq "2c";
+
+	if ($snmp_version !~ /^[123]$/){
 		$state='UNKNOWN';
 		$state='UNKNOWN';
 		print ("$state: No support for SNMP v$snmp_version yet\n");
 		print ("$state: No support for SNMP v$snmp_version yet\n");
 		exit $ERRORS{$state};
 		exit $ERRORS{$state};