I'm struggling to load custom MIBs in my first attempt at pysnmp. I have read that the old versions required a compiling of the custom mibs, and the newer versions embed the compiling in backend processes. When I try either method, the script just hangs ... indefinitely. The custom MIB is CISCO-PRODUCTS.MIB which I have downloaded and ends with a .my extension.
python3 mibdump.py --mib-source=file://./ --destination-directory=/home/myuser/Desktop/Ansible/mibs --destination-format=pysnmp CISCO-PRODUCTS-MIB
Source MIB repositories: file://./ Borrow missing/failed MIBs from:
http://mibs.snmplabs.com/pysnmp/notexts/@mib@
Existing/compiled MIB locations: pysnmp.smi.mibs, pysnmp_mibs
Compiled MIBs destination directory: /home/myuser/Desktop/Ansible/mibs
MIBs excluded from code generation: INET-ADDRESS-MIB, PYSNMP-USM-MIB, RFC-1212, RFC-1215, RFC1065-SMI, RFC1155-SMI, RFC1158-MIB, RFC1213-MIB, SNMP-FRAMEWORK-MIB, SNMP-TARGET-MIB, SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC, SNMPv2-TM, TRANSPORT-ADDRESS-MIB
MIBs to compile: CISCO-PRODUCTS-MIB
Destination format: pysnmp
Parser grammar cache directory: not used
Also compile all relevant MIBs: yes
Rebuild MIBs regardless of age: no
Dry run mode: no
Create/update MIBs: yes
Byte-compile Python modules: yes (optimization level no)
Ignore compilation errors: no
Generate OID->MIB index: no
Generate texts in MIBs: no
Keep original texts layout: no
Try various file names while searching for MIB module: yes
Traceback (most recent call last): File "mibdump.py", line 350, in
<module>
processed = mibCompiler.compile( File "/home/myuser/.local/lib/python3.8/site-packages/pysmi/compiler.py",
line 227, in compile
fileInfo, fileData = source.getData(mibname) File "/home/myuser/.local/lib/python3.8/site-packages/pysmi/reader/localfile.py",
line 105, in getData
for path in self.getSubdirs(self._path, self._recursive, self._ignoreErrors): File
"/home/myuser/.local/lib/python3.8/site-packages/pysmi/reader/localfile.py",
line 64, in getSubdirs
dirs.extend(self.getSubdirs(d, recursive)) File "/home/myuser/.local/lib/python3.8/site-packages/pysmi/reader/localfile.py",
line 64, in getSubdirs
dirs.extend(self.getSubdirs(d, recursive)) File "/home/myuser/.local/lib/python3.8/site-packages/pysmi/reader/localfile.py",
line 64, in getSubdirs
dirs.extend(self.getSubdirs(d, recursive)) [Previous line repeated 44 more times] File
"/home/myuser/.local/lib/python3.8/site-packages/pysmi/reader/localfile.py",
line 63, in getSubdirs
if os.path.isdir(d): File "/usr/lib/python3.8/genericpath.py", line 42, in isdir
st = os.stat(s) KeyboardInterrupt
The files in the same directory are:
- CISCO-PRODUCTS-MIB.my
- CISCO-SMI.my
- mibdump.py
- SNMPv2-CONF.my
- SNMPv2-SMI.my
- SNMPv2-TC.my
Does anyone know where the error is?