This is a discussion on Re: Strange error in test program... within the SNMP Coders forums, part of the Networking and Network Related category; On 08/04/2008, Kris van Rens <krisvanrens.list@gmail.com> wrote: > > But how do you ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
On 08/04/2008, Kris van Rens <krisvanrens.list@gmail.com> wrote:
> > But how do you know which ifIndex.{x} values to ask for? > > The {x} there is the same as the {x} in the ifPhysAddress.{x} > > OID. So this is just moving the problem (unnecessarily). > > > I suspected that for IF-MIB::ifIndex{x} = {y} the value {x} would be > in a strict consecutive order, that is, for your example this would > give: > > IF-MIB::ifIndex.0 = 2 > IF-MIB::ifIndex.1 = 3 > IF-MIB::ifIndex.2 = 27 Nope. The ifIndex value is exacly the same as the index subidentifier. So this walk would actually read: IF-MIB::ifIndex.2 = 2 IF-MIB::ifIndex.3 = 3 IF-MIB::ifIndex.27 = 27 That's why modern MIBs mark the index object as "not-accessible". It doesn't provide any useful information. These index values can be retrieved from walking any of the other columns instead. > So I would iterate three times (from IF-MIB::ifNumber.0) and build an > index list with which I can build the 'IF-MIB::ifPhysAddress.{y}' > strings. > > Very tedious, I know, but it works for SNMP v1, for which I must most > likely build in compatability. If you need SNMPv1 support, then the answer is to use GETNEXT: GETNEXT ifPhysAddress (gives back the value for ifPhysAddress.2) GETNEXT ifPhysAddress.2 (gives back the value for ifPhysAddress.3) GETNEXT ifPhysAddress.3 (gives back the value for ifPhysAddress.27) GETNEXT ifPhysAddress.27 (gives back the value for ifAdminStatus.2 which isn't relevant, so you can stop) Walking off the end of the column means you don't actually need to retrieve ifNumber.0 Dave ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2. http://ad.doubleclick.net/clk;198757...un.com/javaone _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/...et-snmp-coders |
![]() |
| Thread Tools | |
| Display Modes | |
|
|