Difference between revisions of "Mibs in dmd"
(Added signature) |
|||
Line 39: | Line 39: | ||
[[User:Jcurry|JaneCurry]] ([[User talk:Jcurry|talk]]) 18:17, 16 December 2014 (UTC) | [[User:Jcurry|JaneCurry]] ([[User talk:Jcurry|talk]]) 18:17, 16 December 2014 (UTC) | ||
− | [[Category: | + | [[Category:Deployment]] |
Revision as of 16:55, 19 October 2015
Requirement
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.
mibs_in_dmd.py
#!/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 1.3.6.1.4.1 id is enterprises
This shows that enterprises is 1.3.6.1.4.1 and is defined in the SNMPv2-SMI MIB.