I am trying to generate the custom MIB to pysnmp MIB using mibdump.py utility. I have MIB's with different names MY-CUSTOM-MIB, EXAMPLE-MIB. When i am trying to generate the pysnmp MIB for these MIBs, it is always generating the PYSNMP MIBS with name as MY-MIB.py.
mibdump.py --destination-format=pysnmp --destination-directory=`pwd` ./MY-CUSTOM-MIB
mibdump.py --destination-format=pysnmp --destination-directory=`pwd` ./EXAMPLE-MIB
Output:
MY-MIB.py
Expecting Output as
EXAMPLE-MIB.py
MY-CUSTOM-MIB.py
Could any throw some ideas to generate MIB with actual name rather than MY-MIB.
The name mibdump
uses for output file name is taken literally from MIB module definition, which is inside the MIB file.
That makes sense, for example, if other MIBs want to import your MIB as a dependency, they can only do that by canonical MIB name because that's the only thing present in the IMPORT statement.
If you place MY-MIB
into a file named EXAMPLE-MIB.txt
, some additional map would be required to find your non-canonically named MIB by its canonical name. Perhaps some SNMP implementations might have such mapping facilities, but some do not.
That makes me think that it's best to have exactly the same name for the MIB module and MIB file.
However, it's indeed possible (and quite easy, it seems) to teach mibdump
to reuse the original file name where the MIB is read from.