I want to display a list of various MIBS with net-snmp and show other informations related to the SNMP tree structure.
Now it turns out that my customer's SMIv1 MIBS does not show up in the listing, but are correctly loaded by net-snmp.
Sample net-snmp code goes through the MIB structure in memory and assumes that we have the SMIv2 bijection between a MIB and a MODULE-IDENTITY note in the tree. So when we find a MODULE-IDENTITY node, we find a MIB.
Does anybody knows what is the correct method to list SMIv1 MIBS with net-snmp ? (or any workaround ?)
// Read mibs and obtain memory structures
struct tree * head = read_all_mibs();
// Walk down the SNMP tree
for ( struct tree * tp = head; tp; tp = tp->next_peer )
{
// Module-indentity
if ( tp->type == TYPE_MODID )
{
// XXX We found a SMIv2 MIB, but SMIv1 MIBs have no MODULE-IDENTITY node
}
}
NB: I found a converter smidump (a command line tool, or as a web service at http://www.ibr.cs.tu-bs.de/projects/libsmi/tools/) but it does not adds a MODULE-IDENTITY node to the MIB.
Edit: Note that any tool that would convert an old SNMP MIB to a more recent one (SMIv2 style), could solve the problem. Any help in that particular direction ?
One suggestion could be, in the absence of MODULE-IDENTIFIER, to find the root OBJECT-IDENTIFIER of the MIB (sometimes the MIB will add node at many different and unrelated places so this would not work). With a root node I could show most of the tree related to that MIB.