Mibs in dmd
You have lots of MIBs imported into Zenoss, probably in several different groups so it is non-trivial even to see what MIBs you have, let alone their contents. Classic example is when you have imported the SNMP version 1 Structure of Management Information (SMI) that is defined in RFC1155. This defines things like iso, org, dod, internet, private, enterprises,....... Now you want to import the SNMP version 2 equivalent, SNMPv2-SMI. If you import it, you find that only the delta between what is in RFC1155 and SNMPv2-SMI is imported and it often breaks other imports that require SNMPv2-SMI as a prerequisite.
This script trawls through the MIBs imported into the Zope database and prints out MIB path, MIB oid and MIB name for each OID, to /tmp/dmd_mibs.out.
I wanted to find which MIB defined "enterprises" so I simply searched the output file for that string.
#!/usr/bin/env python # Author: Jane Curry # Date: April 17th 2013 # Updated: # Description: Write out all imported MIBs with path, oid, id to /tmp/dmd_mibs.out # of = open('/tmp/dmd_mibs.out', 'w') # import the stuff that zendmd needs and create the dmd context import Globals from Products.ZenUtils.ZenScriptBase import ZenScriptBase dmd = ZenScriptBase(connect=True, noopts=True).dmd for b in dmd.Mibs.mibSearch(): of.write('Path is %s oid is %s id is %s \n' % (b.getPath(), b.oid, b.id)) of.close()
To search for a particular string:
$ grep enterprises /tmp/dmd_mibs.out Path is /zport/dmd/Mibs/mibs/SNMPv2-SMI/nodes/enterprises oid is 18.104.22.168.4.1 id is enterprises
This shows that enterprises is 22.214.171.124.4.1 and is defined in the SNMPv2-SMI MIB.