Question

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 );
Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top