简体   繁体   English

pysnmp如何加载asn.1格式的自定义MIB模块

[英]pysnmp how to load custom MIB modules which are in asn.1 format

I am having trouble in figuring out how to load custom MIBs which with .txt extensions using pysnmp module 我在弄清楚如何使用pysnmp模块加载具有.txt扩展名的自定义MIB时遇到麻烦

This is what I am doing currently 这是我目前正在做的

b = builder.MibBuilder()
compiler.addMibCompiler(b, sources=[mib_location])

mib_location is folder on which all my MIBs are located. mib_location是所有我的MIB所在的文件夹。 something like file:///<my_folder> 类似于file:///<my_folder>

But still I am not able to load these MIBs. 但是我仍然无法加载这些MIB。

I am thinking that may be I'll have to specify that my MIBs have an extension of .txt but not sure where. 我想可能是我必须指定我的MIB扩展名为.txt,但不确定在哪里。

MIB files should be found by MIB module name without any extension or with .txt one. MIB文件应通过MIB模块名称找到,不带任何扩展名或以.txt为扩展名。

Here is an example that should work out of the box. 这是一个开箱即用的示例

If not, try adding: 如果没有,请尝试添加:

from pysmi import debug
debug.setLogger(debug.Debug('all'))

To your script and watch stdout -- pysmi will report where exactly it is looking for MIB files. 对于您的脚本并查看stdout,pysmi将报告它在哪里寻找MIB文件。 Hope it gives you enough information to figure out what goes wrong. 希望它能为您提供足够的信息以找出问题所在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM