Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

This may not necessarily be perl related per se, but I'm hoping someone knows enough about SNMP to help anyways as I'm sure I'm not implementing the Net::SNMP get_bulk_request properly. If I use my MIB walk via SolarWinds, I get a tree that represents all of the MAC addresses of the APs connected to the controller. I see an OID that represents the AP MAC address in general, but each MAC address has additional OID digits that are added on to show each individual record. So if I try to enter the root OID that is common to each AP, I get an error that states that there is noSuchInstance. This behavior goes away when I input the OID for a particular AP. So how does my SolarWinds program walk the MIB successfully, yet I cannot perform the same function with Net::SNMP? A couple of the OIDs are as follows:

Root OID: 1.3.6.1.4.1.9.9.513.1.1.1.1.2
AP Specific OID: 1.3.6.1.4.1.9.9.513.1.1.1.1.2.0.23.223.167.189.192

So I'm hoping someone can tell me either what it is about how SNMP works that I don't understand, or what it is about my code that doesn't work to grab all of the MAC addresses for my APs. Code is below:

Thanks,
Scott
#!c:/perl/bin/perl use strict; use warnings; use Net::SNMP; #my $OID = '1.3.6.1.4.1.9.9.513.1.1.1.1.2.0.23.223.167.189.192'; my $OID = ("1.3.6.1.4.1.9.9.513.1.1.1.1.2"); my ($session, $error) = Net::SNMP->session( -hostname => '172.16.0.2', -version => 'snmpv2c', -community => 'private' ); if (!defined $session) { printf "ERROR: %s.\n", $error; exit 1; } my $result = $session->get_request(-varbindlist => [ $OID ],); #my $result = $session->get_bulk_request(-varbindlist => [ \@OID ],); if (!defined $result) { printf "ERROR: %s.\n", $session->error(); $session->close(); exit 1; } #print "$result->{$OID}\n"; foreach my $key ( sort keys %$result ) { print "$key => $$result{$key}\n"; } $session->close();

In reply to Net::SNMP get_bulk_request Not Working by spickles

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (7)
    As of 2020-09-22 09:14 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      If at first I donít succeed, I Ö










      Results (128 votes). Check out past polls.

      Notices?