Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

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

The general idea: SNMP v1 has set, get, get_next. set($oid,$value); ($oid, $value) = get($oid); ($oid, $value) = get_next($root). For the set, get you a full OID leaf value, for the get_next you can use either any OID value because get_next returns the next available OID in the MIB after the one you gave it. So if you have a tree like:

1.2.1.1.0 = 42
1.2.1.1.1 = 43
1.2.1.1.3 = 44
1.2.1.2.0 = 'a'
1.2.1.2.1 = 'b'
1.2.1.2.3 = 'c'

get(1.2.1.1) -> error
get_next(1.2.1.1) -> (1.2.1.1.0, 42)
get_next(1.2.1.1.0) -> (1.2.1.1.1, 43)
...
get_next(1.2.1.1.3) -> 1.2.1.2.0, 'a)
...
get_next(1.2.1.2.3) -> 1.2.1.3.something, something)

A walk just does a get_next over and over until the returned OID is outside of the tree root you gave it to start with. In this case if you started with 1.2.1.1 it would stop at 1.2.1.1.3 and not give you 1.2.1.2 and later.

A get_table is just a wrapper that walks multiple tree roots at the same time, e.g. get_table(1.2.1.1, 1.2.1.2) would return all six of the above values.

SNMP v2c and v3 have the bulk versions of these, they can just request/get multiple OIDs in the same data packet rather than doing a get_next for each OID in turn.

IIRC, the Net::SNMP module returns everything in a hash reference. The SNMP module for the net-snmp library returns VarBind objects (array references) and will return a get_table in columns like:

[
 [ 1.2.1.1.0, 42,  1.2.1.2.0, 'a' ],
 [ 1.2.1.1.1, 43,  1.2.1.2.1, 'b' ],
]

This is by no means a detailed description, method names, signatures, returns, details differ depending on which SNMP module you're using, and which version of SNMP you're using to communicate with the device. But it all pretty much breaks down to set, get, get_next.


In reply to Re^3: Net::SNMP get_bulk_request Not Working by zengargoyle
in thread 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 having an uproarious good time at the Monastery: (5)
    As of 2020-09-19 23:14 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      If at first I donít succeed, I Ö










      Results (116 votes). Check out past polls.

      Notices?