Reputation: 4617
In a simple SNMP table like mib-2.interfaces.ifTable
, ifIndex
is the index for the table, so you read ifIndex
.1 (i.e. read value from direct child nodes of ifIndex
) to get the index for the first row of the table. Simple enough.
But it's not as obvious with something like mib-2.ip.ipRouteTable
. In that case ipRouteIfIndex
is the index column. It's defined as INTEGER just like ifIndex
was. However, you can't read the direct child nodes (i.e. ifIndex
.0 is a direct child), but instead need to read ifIndex.0.0.0.0
to get to the value. So how does one know how to find the value when it's not a direct child of the index column?
There is some concept that I'm not understanding. (Probably having to do with the fact that SNMP objects are delimited by . but so are IP addresses, and I can't tell how to recognize the difference).
Upvotes: 2
Views: 4496
Reputation: 1110
Note that you have a table with multiple indices in this particular case.
The fact is that you cannot directly read the table entries with snmp-get
service, since the index is dynamic (and, as a consequence, the OID address). But you can discover the values with snmp-get-next
(v1) and snmp-get-bulk
(v2) services.
For example, you can read the indices (and store them for querying table items later) or directly read the items of the table :
snmp-get-next
for IP-MIB::ipAdEntNetMaskThe service snmp-get-bulk
will enable you to query N values directly in this way.
Have a look at Net-Snmp's snmptable
that does good job with tables : http://net-snmp.sourceforge.net/wiki/index.php/TUT:snmptable
Upvotes: 3