BLOG     |     FORUM

Trap Receiver Reference

Trap Receiver Diagram Links

How to select a trap processing mode ?

TrapReceiver reference

Trap reference

Varbind reference

Newly added: Support for long running trap receiver scripts. Check out the NewBufferDatabase and DeleteTrapByIdx methods.


Trap Receiver (top level object)

The top level object in this interface is called "UnbrowseSNMP.TrapReceiver".
This provides scripting access to start, stop, pause, resume the Unbrowse SNMP passive trap receiver. You can set filters, select adapters, and process traps as they arrive using the events mechanism.

Creating the top level object

VBScript

Set TrapRcvr = CreateObject("UnbrowseSNMP.TrapReceiver")

Ruby

trapRcr = WIN32OLE.New("UnbrowseSNMP.TrapReceiver")

Events

Event Name Parameters Description
TNF_NewTrap Numeric - Trap ID

Trap Object - The newly arrived trap
This event is fired whenever the trap receiver gets a new trap from the network. You can use this event to process the traps as they arrive.
TNF_Error Numeric - Error Code

String - Error Message
Fired whenever the trap receiver encounters an error. You can mostly ignore the error number, unless you want to contact Unleash Networks for help. The error message is quite descriptive and will give you more information about the error.

 

Methods and Properties

Name Parameters Access Description
Stop
NA Stop the trap receiver
Start NA Start the trap receiver. You must call NewDatabase or Load prior to this method.
NewDatabase
NA Creates a new trap database in the temp folder to store incoming traps. You can then call SaveAs to move it to your preferred location.
NewBufferDatabase NA Creates a new database that buffers received traps. After processing each trap you should call DeleteTrapByIdx so that you can reclaim buffer space and run the service forever.
Save
NA Save the trap database
SaveAs
String - Filename NA Saves the trap database in the specified file.
Close NA Close the trap database without saving.
Load String - Filename NA Load an existing trap database.
TrapCount Numeric Read The number of traps present in the trap database.
GetTrapByIdx Numeric - Index
Trap Object - Trap
NA

Returns the specified trap within the database. The traps are numbered 0 to TrapCount - 1.

Example:

This retrieves the trap number 39.
Set MyTrap = TrapRcv.GetTrapByIdx 39

DeleteTrapByIdx Numeric - Index NA

Delete the specified trap. This reclaims buffer space allowing you to run forever. After calling this method, if you attempt to reference the trap again, the server will return NULL.

Example:

This removes the trap number 39 and reclaims its buffer space.
TrapRcv.DeleteTrapByIdx 39

SetHostFilter String - allow these hosts (Allow List)

String - block these hosts (Block List)
NA Specify list of management stations or trap targets as a filter. 

Allow List = comma separated list of IP addresses of management stations 
Block List  = comma separated list of IP addresses of management stations

Example:
TrapRcv.SetHostFilter "192.168.1.1, 200.219.10.1",""
SetAgentFilter String - allow these agents (Allow List)

String - block these agents (Block List)
Na Specify list of agents as a filter.

AllowList = comma separated list of SNMP agents.
Block List  = comma separated list of IP addresses SNMP agents

Example:
TrapReceiver.SetAgentFilter "","192.168.1.0"
SetTrapFilter String - allow these trap OIDs (Allow List)

String - block these trap OIDs (Block List)
NA

Specify list of traps as filter.

Allow List = comma separated list of trap OIDs to allow.

Block List = comma separated list of trap OIDs to block.

Note : Each OID is of the form "name-oid". The name part is a string that is used in the Unbrowse UI. You can set it to a dummy value (eg, 'n') if you do not require the UI.

Example:
TrapRcv.SetTrapFilter "", "oid1-.1.3.6.1.4.1.9.9.497.2.0.3"

TrapRcv.SetTrapFilter "" ,   "oid1-.1.3.6.1.4.1.9.9.497.2.0.3, o-.1.3.6.1.4.1.9.9.497.2.0.4"

 

SetVersionFilter
Bool - allow SNMPv1

Bool - allow SNMPv2

Bool - allow SNMPv3
NA Filter out traps based on SNMP version

Example:
TrapRcv.SetVersionFilter True, False, True

The above line allows v1, and v3 traps
SetFormatFilter
Bool - allow TRAPs

Bool - allow NOTIFYs

Bool - allow INFORMs
NA Filter out traps based on message  format

Example:
TrapMgr.SetVersionFilter False, True, True
The above line allows NOTIFY and INFORMs only
IsRunning Bool NA Is the trap receiver currently running
Pause NA Pause the trap receiver
Resume NA Resume the trap receiver after a Pause
SetPortFilter String - allow these ports (Allow List)

String - block these ports (Block List)
NA Specify list of UDP ports as filter. This is useful in deployments where traps are sent to ports other than the standard UDP 162

Allow List - Comma separated list of ports to allow
Block List - Command separated list of ports to block
AdapterIndex
Numeric Read
Write
The active network adapter number  for the trap receiver. If your computer has multiple network adapters, then the adapter index corresponds to the order in which they appear on the Tools->Customize->Trap Console->Select adapter window.
UsePromiscuousMode Bool Read
Write
The trap receiver will put the network adapter in promiscuous mode if this is true. In most cases, set this to True (the default).
AdapterName String Read
Write
The adapter name. This is a GUID that Windows uses to identify the adapter. To see the name for the adapters on your system, go to Tools->Customize->Trap Console and then click on the Details button next to the selected adapter combo box.

Example :
TrapMgr.AdapterName = "{7727-AA8A-88374777-AB33}"
PreferRawOverPcap Bool Read
Write
The Unbrowse SNMP trap receiver can work with multiple providers. The two standard ones are "Windows Raw Sockets" and "Winpcap". If both are available then Unbrowse SNMP prefers Winpcap.

However, if the PreferRawOverPcap property is set to True, then the trap receiver will always use Windows Raw Sockets, even if the superior Winpcap is available.
IsWinpcapAvailable Bool Read Is Winpcap available for use ?
IsPaused Bool Read Is the trap receiver paused ?
Note that a paused trap receiver can be restarted by Resume. A Stopped trap receiver can be restarted by a Start.
AutoSave Bool Read Put the trap receiver in autosave mode.
ResetFilter NA Removes all filters
UDPServerMode Bool

Read
Write

If this is set to TRUE, the trap receiver will use normal UDP sockets to listen to SNMP traps.
UDPServerPort Bool

Read
Write

If UDPServerMode=True, then this property specifies the port on which the trap receiver will listen for SNMP Traps. The default is 162.
LogLevel
Numeric

Read Write

Logging options  ( 0 = Disable, 8 = Debug, 4= Errors).

Log files are found in %APPDATA%\Unleash Networks\Unbrowse\Logs directory

RespondToInforms
Bool

Read Write

Should the trap receiver respond to INFORM SNMP messages. The default is TRUE.
UseClientPortForInforms Bool
Read Write

When responding to INFORM messages, do you want to send the RESPONSE from the trap port (eg 162).

If you dont care what port the INFORM response comes from then you can set this to FALSE.

Note that no process should be listening on Port 162 if you set this option to TRUE.  Run Unbrowse in Raw Sockets or Winpcap mode for this to work.

LocalV3AgentSecurityName String
Read Write

For SNMPv3 INFORM messages you need to create a local agent for Unbrowse SNMP containing the EngineID.

This allows remote devices which wish to send INFORMs to perform an Engine ID discovery.


The Trap Object

Access the details of an individual trap object.

Events

None

Methods and Properties

Name Type / Access Parameters Description
SourceAddress
String Read The source IP addess in the trap message. Note: If using a proxy forwarding application, this is the address of the proxy forwarder.See AgentAddress for more.
DestinationAddress String Read The destination IP address in the trap message. Usually the address of the trap target or management application such as OpenView, CiscoWorks DFM, etc.
AgentAddress String Read The IP address of the agent sending the trap.
UserCommunity String Read For SNMPv1, v2c - this is the community string contained in the trap.
For SNMPv3 - this is the user name (USM) contained in the trap.
SnmpVersion 1 = v1
2 = v2c
3 = v3
Read The SNMP version
SysUpTime Numeric Read The value of the sysUpTime contained in the trap
GenericTrap Numeric Read The generic trap number
SpecificTrap Numeric Read The value of the specific trap number
EnterpriseOID
String Read The enterprise OID
VarbindCount Numeric Read Number of variable bindings (varbinds) contained sent along with the trap
TrapFormat
1 = TRAP
2 = NOTIFY
3 = INFORM
Read The type of trap
ContextName String Read The context name for SNMPv3 traps
TimestampLocal String Read Trap reception timestamp in the local timezone (at the machine running Unbrowse SNMP)
TimestampUTC String Read Trap reception timestamp (UTC)
TrapID Numeric Read Trap ID - Unbrowse SNMP assigns a unique number of each trap received
TrapOID String Read The OID of the trap
GetVarbindByIdx
Numeric - Index

Varbind Object
NA Returns the varbind at the specified index. Call VarbindCount to get the total number of varbinds sent along with the trap.
EffectiveTrapOID String Read Unbrowse SNMP can present a unified view of TRAPs, NOTIFYs, and INFORMs. The effective trap OID is equal to the Trap OID in NOTIFY and INFORM messages.
The effective trap OID is the enterprise OID followed by the specific trap number in TRAP messages.
AuxInfo String Read
Write
The auxiliary information attached to the trap. See the Unbrowse SNMP help for more details about this advanced feature.
VLANID Numeric Read The IEEE 802.1Q VLAN ID on which the trap message is sent.

The Varbind Object

A SNMP variable binding. An association of an OID with a value.

Events

None

Methods and Properties

Name Type / Access Parameters Description
OID
String Read The OID part of the variable binding
Value String Read The Value part