in reply to Re^2: SNMP from script conflicts with snmpwalk
in thread SNMP from script conflicts with snmpwalk
This is what the code looks like now. Only made a couple changes - since I only need the queue name and comments, I only collect that ...
sub QuerySNMP { use SNMP; #$SNMP::debugging = 2; $ENV{'MIBFILES'} = "LanMgr-Mib-II-MIB.my"; my ($hostname) = shift @_; my ($session) = new SNMP::Session( DestHost => $hostname, Community => "public", UseSprintValue => 1, ); if (!(defined($session))) { die "Session creation error: $SNMP::Session::ErrorStr + - $!\n" ; } my ($vars) = new SNMP::VarList(['svPrintQName'], ['s +vShareComment '], ); my ($q, $num_jobs, $share_comment) = $session->getnext($vars) +; if ($session->{ErrorStr}) {; die "Getnext failed - error: " . $session->{ErrorStr} +. " - $!\n" } while (!$session->{ErrorStr} ) { print "q - $q, comment - $share_comment\n"; my ($q, $share_comment) = $session->getnext($vars); } }
|
|---|