From f00e552b55436809e7e5f2004ac9c6a93456a9a6 Mon Sep 17 00:00:00 2001 From: Tom Feiner Date: Wed, 23 Feb 2011 14:14:39 +0100 Subject: [PATCH] v1 used Net::SNMP module, and hard coded snmp v2c. This v2 version uses Munin::Plugin::SNMP which transparently supports all snmp versions. --- plugins/other/snmp__cpu_usage | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/other/snmp__cpu_usage b/plugins/other/snmp__cpu_usage index 7d0f3db0..54d34542 100755 --- a/plugins/other/snmp__cpu_usage +++ b/plugins/other/snmp__cpu_usage @@ -125,12 +125,14 @@ my %cpuCounters = ( cpuIdle => "1.3.6.1.4.1.2021.11.11.$cpu", # The percentage of processor time spent idle, calculated over the last minute ); -my ($session, $error) = Net::SNMP->session( - -hostname => $host, - -community => $community, - -port => $port, - -version => "2c" - ); +my $session = Munin::Plugin::SNMP->session(-translate => + [ -timeticks => 0x0 ]); + +if (!defined ($session)) +{ + die "Croaking: could not establish SNMP object"; +} + if (!defined ($session)) {