|Pathologically Eclectic Rubbish Lister|
Re^3: Net::SNMP get_bulk_request Not Workingby zengargoyle (Deacon)
|on Aug 31, 2011 at 13:48 UTC||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:
126.96.36.199.0 = 42 188.8.131.52.1 = 43 184.108.40.206.3 = 44 220.127.116.11.0 = 'a' 18.104.22.168.1 = 'b' 22.214.171.124.3 = 'c' get(126.96.36.199) -> error get_next(188.8.131.52) -> (184.108.40.206.0, 42) get_next(220.127.116.11.0) -> (18.104.22.168.1, 43) ... get_next(22.214.171.124.3) -> 126.96.36.199.0, 'a) ... get_next(188.8.131.52.3) -> 184.108.40.206.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 220.127.116.11 it would stop at 18.104.22.168.3 and not give you 22.214.171.124 and later.
A get_table is just a wrapper that walks multiple tree roots at the same time, e.g. get_table(126.96.36.199, 188.8.131.52) 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:
[ [ 184.108.40.206.0, 42, 220.127.116.11.0, 'a' ], [ 18.104.22.168.1, 43, 22.214.171.124.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.