0

I'm using net-snmp. Given a specific OID such as .1.3.6.1, how do I find the corresponding MIB/module/filename/anything where that OID is described?

I've looked through all the #include file in <net-snmp/*> but I cannot figure it out.

I was expecting something along the lines of:

struct module *netsnmp_get_module_from_oid( oid *, int oidlen );
Stéphane
  • 19,459
  • 24
  • 95
  • 136
  • Off-course there is do you have source code of net-snmp look you will find in parse.c. – Grijesh Chauhan Mar 02 '13 at 20:43
  • [**Please read this question and its answer**](http://stackoverflow.com/questions/13641802/why-the-description-of-the-snmp-oid-giving-null/13776327#13776327) – Grijesh Chauhan Mar 02 '13 at 20:46
  • Yes, I have the source, and no, that question is about getting the OID description text which isn't saved by default. – Stéphane Mar 02 '13 at 21:00

1 Answers1

0

I figured it out. It is a 3-step process:

struct tree *head = get_tree_head();
struct tree *t = get_tree( o, l, head );
struct module *m = find_module( t->modid );

This gives the module name, the filename, and a list of imports made by the module which can then be looked up further. When calling this with the .1.3.6.1 example from the original question, this gives me:

NAME=SNMPv2-SMI
FILE=/usr/share/mibs/ietf/SNMPv2-SMI
COUNT=3
#0: LABEL=joint-iso-ccitt, ID=-1
#1: LABEL=ccitt, ID=-1
#2: LABEL=iso, ID=-1
Stéphane
  • 19,459
  • 24
  • 95
  • 136