简体   繁体   English

使用一个SNMP代理监视同一设备的多个实例

[英]Monitor several instances of the same equipment with one SNMP agent

I have equipment that is non SNMP-enabled . 我的设备不支持SNMP I have the API to get its status and am implementing an SNMP agent for it. 我有API来获取其状态,并正在为其实现SNMP代理。 I did that with SNMP4j and can answer GET requests and send traps. 我使用SNMP4j做到了这一点,并且可以回答GET请求并发送陷阱。

The problem I have is that there are several (2) such equipments to monitor with the same instance of my program. 我的问题是要用我的程序的同一实例监视几(2)个这样的设备。 So far, I added a branch for each equipment in the MIB like 1.3.6.1.4.1.PEN.devices.1.xxx and 1.3.6.1.4.1.PEN.devices.2.xxx but 1-that's ugly and 2-I can't give a MIB usable for each equipment but a single MIB for the whole System with redundant information and that's also ugly ;) 到目前为止,我为MIB中的每个设备都添加了一个分支,如1.3.6.1.4.1.PEN.devices.1.xxx1.3.6.1.4.1.PEN.devices.2.xxx但是1-很难看,2-I不能为每个设备提供可用的MIB,而是为整个系统提供一个具有冗余信息的MIB,这也很丑陋;)

I'm not sure if the MIB Table object is suitable for that, but it doesn't sound like the way to go (I have a fixed number of equipment). 我不确定MIB Table对象是否适合该对象,但听起来并不可行(我有固定数量的设备)。 I also saw that RFC 3413 §3.5 describes SNMP proxy forwarder but I'm not sure it is what I need to implement (my equipments are not SNMP-enabled), and SNMP4j ProxyForwarder seems to map a MIB to another MIB. 我还看到RFC 3413§3.5描述了SNMP代理转发器,但是我不确定这不是我需要实现的(我的设备未启用SNMP),而SNMP4j ProxyForwarder似乎将一个MIB映射到另一个MIB。

With SNMP4j, I implemented the processPDU() method of the CommandResponder interface and I was hoping that, if the Supervision software is configured to use my program as a "proxy forwarder", there could be some information available in the CommandResponderEvent for me to send the correct response PDU (though I didn't find any such thing, I might have missed something). 使用SNMP4j,我实现了CommandResponder接口的processPDU()方法,并且希望,如果将Supervision软件配置为将我的程序用作“代理转发器”,则CommandResponderEvent可能有一些信息可供我发送正确的响应PDU(尽管我没有找到任何此类东西,但我可能错过了一些东西)。

I could start several instances of my agent (one per equipment) but I'd rather not for sparse ressources reasons. 我可以启动代理的多个实例(每个设备一个),但我不想出于稀疏资源的原因。 What would be the best way to tackle that problem? 解决该问题的最佳方法是什么? Table? 表? Proxy? 代理? Other? 其他? Not possible? 不可能?

EDIT: 编辑:

I have found that some NNM add an extra Variable Binding in the GET request to indicate which equipment to address (SNMP-proxy-like), while some other map the equipment by changing the community in the GET. 我发现有些NNM在GET请求中添加了一个额外的变量绑定,以指示要寻址的设备(类似于SNMP代理),而另一些则通过更改GET中的社区来映射设备。 Are these viable options? 这些可行的选择吗? Which one is the most common/acceptable? 哪个是最常见/可以接受的?

Using a simple table here to show general concepts of tables and rows ... 在这里使用一个简单的表来显示表和行的一般概念...

This is how to retrieve a example table (with an index and 2 more columns). 这是如何检索示例表(带有索引和另外2列)的方法。 Perhaps each of your equipments would be a row in your own table (with a bunch of data in your own columns) 也许您的每台设备在您自己的表中都是一行(在您自己的列中有一堆数据)

snmptable  -M +.  -m +ALL -v 2c -c public  -Ci  myhost   SNMPv2-MIB::sysORTable
SNMP table: SNMPv2-MIB::sysORTable

 index                                        sysORID                                              sysORDescr  sysORUpTime
     1          SNMP-MPD-MIB::snmpMPDMIBObjects.3.1.1         The MIB for Message Processing and Dispatching. 0:0:00:00.33
     2       SNMP-USER-BASED-SM-MIB::usmMIBCompliance         The MIB for Message Processing and Dispatching. 0:0:00:00.33

Walk that table : 走那张桌子:

snmpwalk   -M +.  -m +ALL -v 2c -c public  myhost  SNMPv2-MIB::sysORTable
SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDMIBObjects.3.1.1
SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORDescr.1 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.2 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (33) 0:00:00.33
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (33) 0:00:00.33 

Access one part of above by walk : 步行进入以上部分:

snmpwalk   -M +.  -m +ALL -v 2c -c public  myhost  SNMPv2-MIB::sysORDescr.2
SNMPv2-MIB::sysORDescr.2 = STRING: The MIB module for SNMPv2 entities

Access one part of above by GET : 通过GET访问以上内容的一部分:

snmpget   -M +.  -m +ALL -v 2c -c public  myhost  SNMPv2-MIB::sysORDescr.2
SNMPv2-MIB::sysORDescr.2 = STRING: The MIB module for SNMPv2 entities

EDIT: To see how this OID fits into the tree look at ... 编辑:要查看此OID如何适合树,请看...

snmptranslate -M+. -m +ALL    1.3.6.1.2.1.1
SNMPv2-MIB::system
snmptranslate -M+. -m +ALL    1.3.6.1.2.1.1.9
SNMPv2-MIB::sysORTable
snmptranslate -M+. -m +ALL    1.3.6.1.2.1.1.9.1
SNMPv2-MIB::sysOREntry
snmptranslate -M+. -m +ALL    1.3.6.1.2.1.1.9.1.3
SNMPv2-MIB::sysORDescr
snmptranslate -M+. -m +ALL    1.3.6.1.2.1.1.9.1.3.2
SNMPv2-MIB::sysORDescr.2

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

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