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

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,807
Latest member
ryef

Latest Threads

Top