我试图使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请帮我弄清楚我哪里做错了。所有文件都来自教程,我没有更改任何内容。
提前感谢!
发布于 2012-01-10 00:36:00
如果您是在64位目标系统上编程,this可以帮助您
发布于 2012-06-06 19:18:05
如果您想继续在64位计算机上运行,可以将变量从int更改为long:
static int nstAgentModuleObject = 1; ==> static long ..... netsnmp_register_int_instance(....) ==> netsnmp_register_long_instance(....)
https://stackoverflow.com/questions/8650274
复制相似问题