Search code examples
snmp

get-next order of returned OIDS defined?


I notice that the order that my agent returns the OIDs in a V2c GET-NEXT request from a table is different to another common agent. Each row is correctly filled with data and its relevant OID.

Does the row order have any significance?

I would welcome any feedback on this. John


Solution

  • There is a well-defined "lexicographical" order prescribed by the RFCs, so one of the agents is wrong and should be fixed.

    When ordering the variables in a MIB, each integer in the OID string should be compared as a number. Make sure your agent isn't just sorting alphabetically or something silly like that. 1.2.10.4 comes after 1.2.9.4 because 10 is lexicographically greater than 9.

    That said, as long as the order your agent uses is consistent between attempts, managers shouldn't have too many problems. Ordering is entirely the Agent's responsibility after all.

    You can study section 4.4.2 of RFC 1905 for more information, or have some further reading from Dave Perkins (who should be considered an authority on the topic):

    http://iwl.com/white-papers/snmp/lexicographic-ordering

    Sequence S is lexicographically less than sequence T if either of the following are true:

    1. p < q, and for all i <= p, s(i)=t(i)

    2. there exists an i such that (i<=p) & (i<=q), s(i) < t(i) and for all j < i, s(j)=t(j)