Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^2: Net::SNMP get_bulk_request Not Working

by spickles (Scribe)
on Jul 31, 2010 at 01:04 UTC ( #852198=note: print w/replies, xml ) Need Help??

in reply to Re: Net::SNMP get_bulk_request Not Working
in thread Net::SNMP get_bulk_request Not Working

It's the same code, but different issues. Khen suggested I turn on debugging for the no response issue, which appears to be host specific. For that, I'll put a sniffer on the wire as you suggest, but I'm not good at reading those. I think my current problem with why Net::SNMP doesn't do what I want is the following:

SolarWinds will do a MIB walk, starting on the branch OID that I specified and I'm assuming that's how it 'discovers' the other device specific OIDs. What I'm trying to do with Net::SNMP is essentially the same thing, but I now understand that the get_request and get_bulk_request methods are for known OIDs rather than a MIB walk. So it may turn out that Net::SNMP can't do a MIB walk? At this point I don't understand enough of the module to know for sure. I'll keep working on it and hopefully people will post back with other useful pointers for me.


Replies are listed 'Best First'.
Re^3: Net::SNMP get_bulk_request Not Working
by Khen1950fx (Canon) on Jul 31, 2010 at 01:21 UTC
    Actually, it does mibwalk. There's an example script in the examples directory. See:
      my $punishment = new punisher(); while (idiot) { $punishment->slap ( -forehead => hard ); }

      Thanks Khen. I thought that the examples were all included on the main page. I turns out that I also figured out that the function get_table returned what I wanted. The example you provided has lots of arguments and some decent checks.

      Can anybody write how to extract measure units (Kb, Mb, e.t.c.) from get_bulk_request unless it's impossible.
Re^3: Net::SNMP get_bulk_request Not Working
by zengargoyle (Deacon) on Aug 31, 2011 at 13:48 UTC

    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: = 42 = 43 = 44 = 'a' = 'b' = 'c'
    get( -> error
    get_next( -> (, 42)
    get_next( -> (, 43)
    get_next( ->, 'a)
    get_next( ->, 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 it would stop at and not give you and later.

    A get_table is just a wrapper that walks multiple tree roots at the same time, e.g. get_table(, 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:

     [, 42,, 'a' ],
     [, 43,, '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.

      HI guys i think when u r using snmp version 2. Net::SNMP uses one optional variable -maxrepetitions for get_bulk_request() function. default it was set to 0. you need to set it to 1.then it will work

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://852198]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2023-06-01 16:01 GMT
Find Nodes?
    Voting Booth?

    No recent polls found