Geeks With Blogs

Lance's TextBox
By default, the IPWorks SNMPAgent component automatically sends certain variable bindings with an SNMPv2 or SNMPv3 trap: sysUpTime (1.3.6.1.2.1.1.3.0) equal to SNMPAgent1.SysUpTime snmpTrapOID (1.3.6.1.6.3.1.1.4.1.0) equal to TrapOID passed to the SendTrap method (i.e., "1.3.6.1.6.3.1.1.5.1" which is coldstart) These are required in v2 and v3 traps. If you need to send more objects with your trap, and you modify the ObjId/ObjType/ObjValue variables, then you're responsible for setting ALL of the object ID's for the trap itself (e.g. the sysUptime and the snmpTrapOID). This means that the first two objects you add should be those mentioned above, like so:
SNMPAgent1.ObjCount = 4;

//add the sysUpTime:
SNMPAgent1.ObjId[1] = "1.3.6.1.2.1.1.3.0";
SNMPAgent1.ObjValue[1] = SNMPAgent1.SysUpTime;
SNMPAgent1.ObjType[1] = otTimeTicks;

//add the snmpTrapOID
SNMPAgent1.ObjId[2] = "1.3.6.1.6.3.1.1.4.1.0";
SNMPAgent1.ObjValue[2] = "1.3.6.1.6.3.1.1.5.2"; //warmstart
SNMPAgent1.ObjType[2] = otObjectId;

//now add additional objects:
SNMPAgent1.ObjId[3] = ...
...
SNMPAgent1.ObjId[4[ = ...
...
Posted on Thursday, June 9, 2005 4:29 PM Programming | Back to top


Comments on this post: Sending SNMPv2/v3 Traps with additional variable bindings

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Lance Robinson | Powered by: GeeksWithBlogs.net