how to handle Multi Value Hash output?

H

HansHG

Hi all!

I have a script that returns one SNMP OID from an SNMP Agent. It works
perfectly:
#!/usr/bin/perl -w
use strict;
use IO::Handle;
use Net::SNMP;
my $agentIdUniqueId = '.1.3.6.1.4.1.1977.1.1.2.1.0';
sub getuid {
my ($session, $error) = Net::SNMP->session
(
-hostname => shift || $_[0],
-community => shift || $community,
-port => shift || $port
);
my %hash = ($session->hostname, $result->{$agentIdUniqueId});

while ( ($k, $v) = each %hash) {
print "key $k value $v\n";
}

this works. But what do I do, when I have more than one varbind in my
varbindlist? Like:
my $result = $session->get_request(-varbindlist =>
[$agentIdUniqueId,$agentIdName,$agentBuildDescription,
$agentBuildVersion,$agentBuildNumber,$agentIdPlatformDescription]);

How do I need to change the script so that it returns all requested
OIDs? The query is done from perl. I can see the OIDs getting
requested in wireshark. But how do I return them?

please help
cheers
Hans
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top