> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Pachiappan D
> Sent: Tuesday, July 29, 2008 11:36 AM

> I use net-snmp 5.4.1 and am using "snmpgetnext" to retrieve 
> the table rows/columns.
> 
> To retrieve a row , i did as below,
> snmpgetnext -v3 -uadmin -lauthNoPriv -aMD5 -Apassword 
> localhost ifTable  - gives the first row ( 1st column )
> IF-MIB::ifIndex.1 = INTEGER: 1
> 
> snmpgetnext -v3 -uadmin -lauthNoPriv -aMD5 -Apassword 
> localhost ifTable.1 ( Index1 of 3 ) - Need to give the second 
> row (1st column )
> IF-MIB::ifIndex.1 = INTEGER: 1 ( i am getting the first row 
> again wrongly )
> 
> Can anyone help me on this?

        The MIB says:

[SNIP]
ifTable OBJECT-TYPE
    SYNTAX      SEQUENCE OF IfEntry
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
            "A list of interface entries.  The number of entries is
            given by the value of ifNumber."
    ::= { interfaces 2 }
[/SNIP]

        ...so that's the base of our table.  Next:

[SNIP]
ifEntry OBJECT-TYPE
    SYNTAX      IfEntry
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
            "An entry containing management information applicable to a
            particular interface."
    INDEX   { ifIndex }
    ::= { ifTable 1 }
[/SNIP]

        You'll see this in every table.  Don't ask why - it just has to be 
there[1].  Note that it attaches to ifTable.  After this:

[SNIP]
IfEntry ::=
    SEQUENCE {
        ifIndex                 InterfaceIndex,
        ifDescr                 DisplayString,
        ifType                  IANAifType,
        ifMtu                   Integer32,
        ifSpeed                 Gauge32,
        ifPhysAddress           PhysAddress,
        ifAdminStatus           INTEGER,
        ifOperStatus            INTEGER,
        ifLastChange            TimeTicks,
        ifInOctets              Counter32,
        ifInUcastPkts           Counter32,
        ifInNUcastPkts          Counter32,  -- deprecated
        ifInDiscards            Counter32,
        ifInErrors              Counter32,
        ifInUnknownProtos       Counter32,
        ifOutOctets             Counter32,
        ifOutUcastPkts          Counter32,
        ifOutNUcastPkts         Counter32,  -- deprecated
        ifOutDiscards           Counter32,
        ifOutErrors             Counter32,
        ifOutQLen               Gauge32,    -- deprecated
        ifSpecific              OBJECT IDENTIFIER -- deprecated
    }
[/SNIP]

        This is another if those "don't ask" type of features that must be 
there[1].  After that:

[SNIP]
ifIndex OBJECT-TYPE
    SYNTAX      InterfaceIndex
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
            "A unique value, greater than zero, for each interface.  It
            is recommended that values are assigned contiguously
            starting from 1.  The value for each interface sub-layer
            must remain constant at least from one re-initialization of
            the entity's network management system to the next re-
            initialization."
    ::= { ifEntry 1 }
[/SNIP]

        You will never see one of these objects.  Why?  Because it's an index 
(see the INDEX clause of ifEntry), and in SNMP indices are never returned as 
objects, since they are already included as part of the OID.  After that:

[SNIP]
ifDescr OBJECT-TYPE
    SYNTAX      DisplayString (SIZE (0..255))
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
            "A textual string containing information about the
            interface.  This string should include the name of the
            manufacturer, the product name and the version of the
            interface hardware/software."
    ::= { ifEntry 2 }
[/SNIP]

        ...which is the first returnable object.  Note that, like ifIndex, this 
is attached to ifEntry, not ifTable.

        To sum it all up the first returnable object is 
ifTable.ifEntry.ifDescr, or ifTable.1.2 .  If you get next on ifTable, the 
correct response is ifTable.1.2.(first index).  If you get next on ifIndex.1, 
or ifTable.1.1, the correct response is ifTable.1.2.(first index).

        Note that ifIndex is not guarant3eed to start at 1, nor are values 
guaranteed to be contiguous.

        You may be interested in the snmptable command.


        HTH,

Mike


[1] - Not that you should never ask - it's just not relevant to the immediate 
problem.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to