Reputation: 545
I am trying to make net-snmp to support my own MIB, but I failed. I was following the instructions here: http://www.net-snmp.org/wiki/index.php/TUT:Writing_a_MIB_Module.
Then I think maybe I could just use the example MIB file and .c and .h file to test if the example works. Again, by following the tutorials in the above link, I get this to work:
snmpget -v2c -c public localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0
and I got this:
NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = INTEGER: 1
(which looks good).
But then I try to test snmpset like this:
snmpset -v 2c -c public localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 i 5
or
snmpset -v 2c -c public localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = 5
or
snmpset -v 2c -c public localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 INTEGER 5
and I got the following error:
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
Please help me understand where did I do wrong. All the files are from the tutorial and I did not change anything.
Thanks in advance!
Upvotes: 2
Views: 2967
Reputation: 4446
If you want to keep running on a 64bit machine you can change the variable from int to long:
static int nstAgentModuleObject = 1;
==> static long .....
netsnmp_register_int_instance(....)
==> netsnmp_register_long_instance(....)
Upvotes: 0