[nagiosplug] Allow check_ifstatus to accept version=2c
Ton Voon
tonvoon at users.sourceforge.net
Wed Jul 7 10:56:46 CEST 2010
Module: nagiosplug
Branch: master
Commit: 0205c7c0cfc5ba182f2cb675d1df4de72f13c9e2
Author: Ton Voon <ton.voon at opsera.com>
Date: Wed Jul 7 09:56:21 2010 +0100
URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=0205c7c
Allow check_ifstatus to accept version=2c
---
NEWS | 1 +
THANKS.in | 1 +
plugins-scripts/check_ifstatus.pl | 7 +++++--
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index 79ddc53..dc2092d 100644
--- a/NEWS
+++ b/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 detection of pst3 64-bit compile flags with Sun CC
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
Updated developer documentation to say that performance labels should not have an equals sign or
single quote in the label
diff --git a/THANKS.in b/THANKS.in
index 0b1dab6..6666de4 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -264,3 +264,4 @@ Josip Rodin
Dann Frazier
Stephane Chazelas
Craig Leres
+Brian Landers
diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl
index 2263823..63c71ff 100755
--- a/plugins-scripts/check_ifstatus.pl
+++ b/plugins-scripts/check_ifstatus.pl
@@ -280,7 +280,7 @@ sub process_arguments() {
$status = GetOptions(
"V" => \$opt_V, "version" => \$opt_V,
"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,
"L=s" => \$seclevel, "seclevel=s" => \$seclevel,
"a=s" => \$authproto, "authproto=s" => \$authproto,
@@ -317,7 +317,10 @@ sub process_arguments() {
$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';
print ("$state: No support for SNMP v$snmp_version yet\n");
exit $ERRORS{$state};
More information about the Commits
mailing list