ActiveXperts Knowledge Base Article 1200040

Our mission at ActiveXperts Software is to deliver high quality Network Monitoring solutions and Windows Development components. Our goal is to supplement these solutions with timely support resources that can help at many different levels.
The first thing you want to do is try to find the answer to your problem in the Knowledge Base. If you cannot find an answer to your question in our Knowledge Base, or if you need additional information or assistance, please use our Contact Support form.


Q1200040 - Is possible to define specific and generic traps using Network Component SnmpTrapManager Object?

Yes this is possible. In SNMP V1, there is an extra field in the SNMP PDU, in SNMP V2, the generic trap is represented by an OID. You only have to set the 'GenericTrap' property of the SnmpTrap object as demonstrated in the code snippet below:

Option Explicit

' Declare objects
Dim objSnmpTrapManager, objSnmpTrap, objSnmpConstants, objSnmpObject

' Create object
Set objSnmpTrapManager = CreateObject ( "ActiveXperts.SnmpTrapManager" )
Set objSnmpTrap        = CreateObject ( "ActiveXperts.SnmpTrap" )
Set objSnmpObject      = CreateObject ( "ActiveXperts.SnmpObject" )
Set objSnmpConstants   = CreateObject ( "ActiveXperts.ASConstants" )

' Start manager
objSnmpTrapManager.Initialize
objSnmpTrapManager.ProtocolVersion = objSnmpConstants.asSNMP_VERSION_V2C

' Set trap properties 
objSnmpTrap.Clear()

objSnmpTrap.Host	      = "192.168.31.98"
objSnmpTrap.Community   = "public"
objSnmpTrap.GenericTrap = objSnmpConstants.asSNMP_TRAP_LINKUP

' Send the trap
objSnmpTrapManager.Send objSnmpTrap

' Shutdown the manager
objSnmpTrapManager.Shutdown

If you cannot find an answer to your question(s) in our Knowledge Base, or if you need additional information or assistance, please contact our Customer Support using our Contact Support Form

M