PySNMP 找不到现有的现有 JUNIPER-SMI 模块

PySNMP not finding existing existing JUNIPER-SMI module

我正在尝试使用 mibdump.py 工具为 PySNMP 编译一些 Juniper MIB。似乎找不到 pysnmp-mibs 包中现有的 JUNIPER_SMI 模块。

模块似乎存在:

root@2a614c91783e:~# ls -al /usr/local/lib/python3.6/site-packages/pysnmp_mibs/JUNIPER-SMI.py 
-rw-r--r-- 1 root staff 10690 Dec 11 23:03 /usr/local/lib/python3.6/site-packages/pysnmp_mibs/JUNIPER-SMI.py

mibdump.py 的输出表明正在使用 pysnmp.smi.mibspysnmp_mibs 作为现有包:

root@2a614c91783e:~# /usr/local/bin/mibdump.py --mib-source /mibs/JuniperMibs --mib-source /ibs/StandardMibs --mib-stub mib-jnx-bgpmib2.txt mib-jnx-exp.txt
Source MIB repositories: /mibs/JuniperMibs, /ibs/StandardMibs
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: /root/.pysnmp/mibs
MIBs excluded from code generation: mib-jnx-bgpmib2.txt
MIBs to compile: mib-jnx-exp
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
Created/updated MIBs: 
Pre-compiled MIBs borrowed: 
Up to date MIBs: 
Missing source MIBs: JUNIPER-SMI, SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
Ignored MIBs: 
Failed MIBs: JUNIPER-EXPERIMENT-MIB (no module "JUNIPER-SMI" in symbolTable at MIB JUNIPER-EXPERIMENT-MIB)

Python 和包版本:

root@2a614c91783e:~# pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
pip (9.0.1)
ply (3.10)
pyasn1 (0.4.2)
pycryptodomex (3.4.7)
pysmi (0.2.2)
pysnmp (4.4.2)
pysnmp-mibs (0.1.6)
setuptools (36.6.0)
wheel (0.30.0)
root@2a614c91783e:~# python --version
Python 3.6.3

不确定我在这里遗漏了什么。我是否遗漏了一些明显的东西,无法让我检测到现有模块?

mibdump.py 工具将搜索已经存在的 JUNIPER-SMI.py 以节省 JUNIPER-SMI.txt 编译。如果您有另一个依赖于 JUNIPER-SMI.txt 的 MIB,那么已经编译的 JUNIPER-SMI.py 将无济于事。

如果您只是将 --mib-source http://mibs.snmplabs.com/asn1/ 参数添加到 mibdump.py 命令调用中,该工具将从上面的 URL 中获取所有必需的 ASN.1 MIB,并将它们编译成 .py .