我想让net-snmp支持我自己的MIB,但是我失败了。我按照这里的说明: http://www.net-snmp.org/wiki/index.php/TUT:Writing_a_MIB_Module。net-snmp tutorial snmpset failed
然后,我想也许我可以使用示例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
请帮我理解我在哪里做错了。所有的文件都来自教程,我没有 改变任何东西。
在此先感谢!
是的,这是因为我在一台64位机器上运行它。在我切换到32位机器后,我可以设置并且没有任何问题。 – user195678 2012-03-26 22:39:52