我试图让 net-snmp 支持我自己的 MIB,但我失败了。我按照这里的说明进行操作:http: //www.net-snmp.org/wiki/index.php/TUT :Writing_a_MIB_Module 。
然后我想也许我可以使用示例 MIB 文件和 .c 和 .h 文件来测试示例是否有效。同样,通过按照上面链接中的教程,我得到了这个工作:
snmpget -v2c -c public localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0
我得到了这个:
NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = INTEGER: 1
(看起来不错)。
但后来我尝试像这样测试 snmpset:
snmpset -v 2c -c public localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 i 5
或者
snmpset -v 2c -c public localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = 5
或者
snmpset -v 2c -c public localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 INTEGER 5
我收到以下错误:
Error in packet.
Reason: wrongLength (The set value has an illegal length from what the agent expects)
Failed object: NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0
请帮助我了解我在哪里做错了。所有文件都来自教程,我没有更改任何内容。
提前致谢!