简体   繁体   English

从文件加载自定义mib的pySNMP代理

[英]pySNMP Agent with custom mib loaded from file

I have for a couple of days been looking for a solution to a problem. 我有几天一直在寻找解决问题的方法。

I'm supposed to implement an SNMP agent that is SNMP v2c compliant, but in my quest to get there I have gotten stuck on writing an agent that can serve a manager with a predefined MIB file. 我应该实现一个与SNMP v2c兼容的SNMP代理,但是为了实现这一目标,我被困在编写一个可以为管理器提供预定义MIB文件的代理上。

Is there any way for me to load a mib file into my python program and have it serve the OID in the mib. 有什么办法可以将mib文件加载到我的python程序中,并使其在mib中提供OID。 Of course, I know that I need to implement some mechanism to update the values of the OID's as the values in the real world change. 当然,我知道我需要实现某种机制来随着现实世界中值的变化而更新OID的值。

I have been looking at examples and reading the documentation at http://snmplabs.com/pysnmp/ but I don't seem to be able to find a good solution, and some of the examples on the git repository seem to be broken. 我一直在查看示例,并在http://snmplabs.com/pysnmp/阅读文档,但似乎无法找到一个好的解决方案,并且git存储库中的某些示例似乎已损坏。 Also, all the similar questions I have found on stack overflow seem to be outdated as well. 另外,我在堆栈溢出中发现的所有类似问题似乎也已经过时了。

Hope someone can point me to an example that can help me out. 希望有人可以给我提供一个可以帮助我的例子。

One thing to keep in mind is that MIB file does not contain any values you could serve to your manager. 有一点要记住的是,MIB文件包含你可以成为你的经理的任何值。 MIB is just a schema, so to speak. 可以这么说,MIB只是一个模式。

Therefore what you may need to do is to "instantiate" a MIB eg do two things: 因此,您可能需要做的是“实例化” MIB,例如做两件事:

  1. Create a bunch of OIDs out of those described in MIB 根据MIB中描述的内容创建一堆OID
  2. Attach some static values or callbacks to pull the actual values to the manager 附加一些静态值或回调以将实际值拉到管理器

Let's see what is broken in the pysnmp repo? 让我们看看pysnmp仓库中有什么坏处吗? I'm eager to fix that. 我很想解决这个问题。 ;-) ;-)

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

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