Patch adding snmp version support to 1.2.x tree of munin

Signed-off-by: Andreas Thienemann <andreas@bawue.net>

 snmp__df               |   12 +++++++-----
 snmp__fc_if_           |   11 ++++++-----
 snmp__fc_if_err_       |   11 ++++++-----
 snmp__if_              |   12 +++++++-----
 snmp__if_err_          |   12 +++++++-----
 snmp__load             |   12 +++++++-----
 snmp__processes        |   12 +++++++-----
 snmp__sensors_mbm_fan  |   18 +++++++++++-------
 snmp__sensors_mbm_temp |   19 +++++++++++--------
 snmp__sensors_mbm_volt |   19 +++++++++++--------
 snmp__users            |   12 +++++++-----
 11 files changed, 87 insertions(+), 63 deletions(-)

diff -up tmp/snmp__df.orig tmp/snmp__df
--- tmp/snmp__df.orig	2009-04-12 01:13:50.000000000 +0200
+++ tmp/snmp__df	2009-04-12 01:18:45.000000000 +0200
@@ -72,10 +72,11 @@ use Net::SNMP;
 my $DEBUG = 0;
 my $MAXLABEL = 20;
 
-my $host      = $ENV{host}      || undef;
-my $port      = $ENV{port}      || 161;
-my $community = $ENV{community} || "public";
-my $iface     = $ENV{interface} || undef;
+my $host        = $ENV{host}        || undef;
+my $port        = $ENV{port}        || 161;
+my $community   = $ENV{community}   || "public";
+my $snmpversion = $ENV{snmpversion} || "1";
+my $iface       = $ENV{interface}   || undef;
 
 my $response;
 
@@ -122,7 +123,8 @@ my $hrStorageUsed          = "1.3.6.1.2.
 my ($session, $error) = Net::SNMP->session(
 		-hostname  => $host,
 		-community => $community,
-		-port      => $port
+		-port      => $port,
+		-version   => $snmpversion
 	);
 
 if (!defined ($session))
diff -up tmp/snmp__fc_if_err_.orig tmp/snmp__fc_if_err_
--- tmp/snmp__fc_if_err_.orig	2009-04-12 01:20:35.000000000 +0200
+++ tmp/snmp__fc_if_err_	2009-04-12 01:22:03.000000000 +0200
@@ -78,10 +78,11 @@ use Net::SNMP;
 
 my $DEBUG = 0;
 
-my $host      = $ENV{host}      || undef;
-my $port      = $ENV{port}      || 161;
-my $community = $ENV{community} || "public";
-my $iface     = $ENV{interface} || undef;
+my $host        = $ENV{host}        || undef;
+my $port        = $ENV{port}        || 161;
+my $community   = $ENV{community}   || "public";
+my $snmpversion = $ENV{snmpversion} || "2c";
+my $iface       = $ENV{interface}   || undef;
 
 my $response;
 
@@ -120,7 +121,7 @@ my ($session, $error) = Net::SNMP->sessi
 		-hostname  => $host,
 		-community => $community,
 		-port      => $port,
-		-version   => "2c"
+		-version   => $snmpversion
 	);
 
 if (!defined ($session))
diff -up tmp/snmp__fc_if_.orig tmp/snmp__fc_if_
--- tmp/snmp__fc_if_.orig	2009-04-12 01:20:35.000000000 +0200
+++ tmp/snmp__fc_if_	2009-04-12 01:21:13.000000000 +0200
@@ -78,10 +78,11 @@ use Net::SNMP;
 
 my $DEBUG = 0;
 
-my $host      = $ENV{host}      || undef;
-my $port      = $ENV{port}      || 161;
-my $community = $ENV{community} || "public";
-my $iface     = $ENV{interface} || undef;
+my $host        = $ENV{host}        || undef;
+my $port        = $ENV{port}        || 161;
+my $community   = $ENV{community}   || "public";
+my $snmpversion = $ENV{snmpversion} || "2c";
+my $iface       = $ENV{interface}   || undef;
 
 my $response;
 
@@ -121,7 +122,7 @@ my ($session, $error) = Net::SNMP->sessi
 		-hostname  => $host,
 		-community => $community,
 		-port      => $port,
-		-version   => "2c"
+		-version   => $snmpversion
 	);
 
 if (!defined ($session))
diff -up tmp/snmp__if_err_.orig tmp/snmp__if_err_
--- tmp/snmp__if_err_.orig	2009-04-12 00:59:55.000000000 +0200
+++ tmp/snmp__if_err_	2009-04-12 01:00:31.000000000 +0200
@@ -90,10 +90,11 @@ use Net::SNMP;
 
 my $DEBUG = 0;
 
-my $host      = $ENV{host}      || undef;
-my $port      = $ENV{port}      || 161;
-my $community = $ENV{community} || "public";
-my $iface     = $ENV{interface} || undef;
+my $host        = $ENV{host}        || undef;
+my $port        = $ENV{port}        || 161;
+my $community   = $ENV{community}   || "public";
+my $snmpversion = $ENV{snmpversion} || "1";
+my $iface       = $ENV{interface}   || undef;
 
 my $response;
 
@@ -131,7 +132,8 @@ my $ifEntryOutErrors = "1.3.6.1.2.1.2.2.
 my ($session, $error) = Net::SNMP->session(
 		-hostname  => $host,
 		-community => $community,
-		-port      => $port
+		-port      => $port,
+		-version   => $snmpversion
 	);
 
 if (!defined ($session))
diff -up tmp/snmp__if_.orig tmp/snmp__if_
--- tmp/snmp__if_.orig	2009-04-12 01:01:28.000000000 +0200
+++ tmp/snmp__if_	2009-04-12 01:02:07.000000000 +0200
@@ -87,10 +87,11 @@ use Net::SNMP;
 
 my $DEBUG = 0;
 
-my $host      = $ENV{host}      || undef;
-my $port      = $ENV{port}      || 161;
-my $community = $ENV{community} || "public";
-my $iface     = $ENV{interface} || undef;
+my $host        = $ENV{host}        || undef;
+my $port        = $ENV{port}        || 161;
+my $community   = $ENV{community}   || "public";
+my $snmpversion = $ENV{snmpversion} || "1";
+my $iface       = $ENV{interface}   || undef;
 
 my $response;
 
@@ -128,7 +129,8 @@ my $ifEntryOutOctets = "1.3.6.1.2.1.2.2.
 my ($session, $error) = Net::SNMP->session(
 		-hostname  => $host,
 		-community => $community,
-		-port      => $port
+		-port      => $port,
+		-version   => $snmpversion
 	);
 
 if (!defined ($session))
diff -up tmp/snmp__load.orig tmp/snmp__load
--- tmp/snmp__load.orig	2009-04-12 01:15:05.000000000 +0200
+++ tmp/snmp__load	2009-04-12 01:19:35.000000000 +0200
@@ -70,10 +70,11 @@ use Net::SNMP;
 my $DEBUG = 0;
 my $MAXLABEL = 20;
 
-my $host      = $ENV{host}      || undef;
-my $port      = $ENV{port}      || 161;
-my $community = $ENV{community} || "public";
-my $iface     = $ENV{interface} || undef;
+my $host        = $ENV{host}        || undef;
+my $port        = $ENV{port}        || 161;
+my $community   = $ENV{community}   || "public";
+my $snmpversion = $ENV{snmpversion} || "1";
+my $iface       = $ENV{interface}   || undef;
 
 my $response;
 
@@ -101,7 +102,8 @@ elsif (!defined($host))
 my ($session, $error) = Net::SNMP->session(
 		-hostname  => $host,
 		-community => $community,
-		-port      => $port
+		-port      => $port,
+		-version   => $snmpversion
 	);
 
 if (!defined ($session))
diff -up tmp/snmp__processes.orig tmp/snmp__processes
--- tmp/snmp__processes.orig	2009-04-12 01:15:13.000000000 +0200
+++ tmp/snmp__processes	2009-04-12 01:16:29.000000000 +0200
@@ -67,10 +67,11 @@ use Net::SNMP;
 my $DEBUG = 0;
 my $MAXLABEL = 20;
 
-my $host      = $ENV{host}      || undef;
-my $port      = $ENV{port}      || 161;
-my $community = $ENV{community} || "public";
-my $iface     = $ENV{interface} || undef;
+my $host        = $ENV{host}        || undef;
+my $port        = $ENV{port}        || 161;
+my $community   = $ENV{community}   || "public";
+my $snmpversion = $ENV{snmpversion} || "1";
+my $iface       = $ENV{interface}   || undef;
 
 my $response;
 
@@ -98,7 +99,8 @@ elsif (!defined($host))
 my ($session, $error) = Net::SNMP->session(
 		-hostname  => $host,
 		-community => $community,
-		-port      => $port
+		-port      => $port,
+		-version   => $snmpversion
 	);
 
 if (!defined ($session))
diff -up tmp/snmp__sensors_mbm_fan.orig tmp/snmp__sensors_mbm_fan
--- tmp/snmp__sensors_mbm_fan.orig	2009-04-12 01:20:28.000000000 +0200
+++ tmp/snmp__sensors_mbm_fan	2009-04-12 01:27:17.000000000 +0200
@@ -23,9 +23,10 @@
 #
 # Variables:
 #
-# 	host      - SNMP host
-# 	port      - SNMP port
-# 	community - SNMP community
+# 	host        - SNMP host
+# 	port        - SNMP port
+# 	community   - SNMP community
+#       snmpversion - SNMP version
 #
 # $Log$
 # Revision 1.3  2004/11/16 20:08:26  jimmyo
@@ -47,9 +48,11 @@ use Net::SNMP;
 my $DEBUG = 0;
 my $MAXLABEL = 20;
 
-my $host      = $ENV{host}      || undef;
-my $port      = $ENV{port}      || 161;
-my $community = $ENV{community} || "public";
+my $host        = $ENV{host}        || undef;
+my $port        = $ENV{port}        || 161;
+my $community   = $ENV{community}   || "public";
+my $snmpversion = $ENV{snmpversion} || "1";
+my $iface       = $ENV{interface}   || undef;
 
 my $response;
 
@@ -88,7 +91,8 @@ my $mbmValue         = "1.3.6.1.4.1.9600
 my ($session, $error) = Net::SNMP->session(
 		-hostname  => $host,
 		-community => $community,
-		-port      => $port
+		-port      => $port,
+		-version   => $snmpversion
 	);
 
 if (!defined ($session))
diff -up tmp/snmp__sensors_mbm_temp.orig tmp/snmp__sensors_mbm_temp
--- tmp/snmp__sensors_mbm_temp.orig	2009-04-12 01:20:28.000000000 +0200
+++ tmp/snmp__sensors_mbm_temp	2009-04-12 01:25:48.000000000 +0200
@@ -23,9 +23,10 @@
 #
 # Variables:
 #
-# 	host      - SNMP host
-# 	port      - SNMP port
-# 	community - SNMP community
+# 	host        - SNMP host
+# 	port        - SNMP port
+# 	community   - SNMP community
+#       snmpversion - SNMP version
 #
 # $Log$
 # Revision 1.3  2004/11/16 20:08:26  jimmyo
@@ -47,10 +48,11 @@ use Net::SNMP;
 my $DEBUG = 0;
 my $MAXLABEL = 20;
 
-my $host      = $ENV{host}      || undef;
-my $port      = $ENV{port}      || 161;
-my $community = $ENV{community} || "public";
-my $iface     = $ENV{interface} || undef;
+my $host        = $ENV{host}        || undef;
+my $port        = $ENV{port}        || 161;
+my $community   = $ENV{community}   || "public";
+my $snmpversion = $ENV{snmpversion} || "1";
+my $iface       = $ENV{interface}   || undef;
 
 my $response;
 
@@ -89,7 +91,8 @@ my $mbmValue         = "1.3.6.1.4.1.9600
 my ($session, $error) = Net::SNMP->session(
 		-hostname  => $host,
 		-community => $community,
-		-port      => $port
+		-port      => $port,
+		-version   => $snmpversion
 	);
 
 if (!defined ($session))
diff -up tmp/snmp__sensors_mbm_volt.orig tmp/snmp__sensors_mbm_volt
--- tmp/snmp__sensors_mbm_volt.orig	2009-04-12 01:20:28.000000000 +0200
+++ tmp/snmp__sensors_mbm_volt	2009-04-12 01:24:39.000000000 +0200
@@ -23,9 +23,10 @@
 #
 # Variables:
 #
-# 	host      - SNMP host
-# 	port      - SNMP port
-# 	community - SNMP community
+# 	host        - SNMP host
+# 	port        - SNMP port
+# 	community   - SNMP community
+# 	snmpversion - SNMP version
 #
 # $Log$
 # Revision 1.4  2004/11/16 20:08:26  jimmyo
@@ -50,10 +51,11 @@ use Net::SNMP;
 my $DEBUG = 0;
 my $MAXLABEL = 20;
 
-my $host      = $ENV{host}      || undef;
-my $port      = $ENV{port}      || 161;
-my $community = $ENV{community} || "public";
-my $iface     = $ENV{interface} || undef;
+my $host        = $ENV{host}        || undef;
+my $port        = $ENV{port}        || 161;
+my $community   = $ENV{community}   || "public";
+my $snmpversion = $ENV{snmpversion} || "1";
+my $iface       = $ENV{interface}   || undef;
 
 my $response;
 
@@ -92,7 +94,8 @@ my $mbmValue         = "1.3.6.1.4.1.9600
 my ($session, $error) = Net::SNMP->session(
 		-hostname  => $host,
 		-community => $community,
-		-port      => $port
+		-port      => $port,
+		-version   => snmpversion
 	);
 
 if (!defined ($session))
diff -up tmp/snmp__users.orig tmp/snmp__users
--- tmp/snmp__users.orig	2009-04-12 01:15:20.000000000 +0200
+++ tmp/snmp__users	2009-04-12 01:17:08.000000000 +0200
@@ -70,10 +70,11 @@ use Net::SNMP;
 my $DEBUG = 0;
 my $MAXLABEL = 20;
 
-my $host      = $ENV{host}      || undef;
-my $port      = $ENV{port}      || 161;
-my $community = $ENV{community} || "public";
-my $iface     = $ENV{interface} || undef;
+my $host        = $ENV{host}        || undef;
+my $port        = $ENV{port}        || 161;
+my $community   = $ENV{community}   || "public";
+my $snmpversion = $ENV{snmpversion} || "1";
+my $iface       = $ENV{interface}   || undef;
 
 my $response;
 
@@ -101,7 +102,8 @@ elsif (!defined($host))
 my ($session, $error) = Net::SNMP->session(
 		-hostname  => $host,
 		-community => $community,
-		-port      => $port
+		-port      => $port,
+		-version   => $snmpversion
 	);
 
 if (!defined ($session))
