how to handle Multi Value Hash output?

Discussion in 'Perl Misc' started by HansHG, Feb 21, 2007.

  1. HansHG

    HansHG Guest

    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
     
    HansHG, Feb 21, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Leon
    Replies:
    2
    Views:
    564
  2. rp
    Replies:
    1
    Views:
    589
    red floyd
    Nov 10, 2011
  3. Une bévue
    Replies:
    5
    Views:
    176
    Une bévue
    Aug 10, 2006
  4. Srijayanth Sridhar
    Replies:
    19
    Views:
    673
    David A. Black
    Jul 2, 2008
  5. Antonio Quinonez
    Replies:
    2
    Views:
    195
    Antonio Quinonez
    Aug 14, 2003
Loading...

Share This Page