|
SendTrap
int
ForwardTrap(string
ipAddress, snmppdu
pdu)
Return
Value
Returns
OK if success. Otherwise returns FAIL.
Parameters
ipAddress
–the IP address
of the SNMP manager.
Note: The
following syntax of ipAddress provides the ability to specify the
SNMP trap port value: ipAddress:Port
Example:
“65.35.64.170:3000”
If SNMP trap
port is not specified explicitly, default value (162) is
considered.
pdu
–the SNMP
PDU.
Remarks
Call this
function to send SNMP trap forward to another destination.Used in
NetDecision TrapVision and NetDecision Network Manager to forward
traps (Trap Handling Action - Forward Trap).
Example
#===============
TRAPVISION FORWARD TRAP HANDLER ================
# The following variables are being
passed to this script by TrapVision
# 'Pdu' - SNMP Trap pdu containing trap
specific information
# 'Destinations' - two-dimensional
array containing the list of trap destinations
# Attributes of the destination record
can be accessed as array elements at
# the following predefined
indexes:
# - Destinations[sIndex]["IPAddress"] -
IP address of destination host
# - Destinations[sIndex]["Port"] - port
number
#================================================================
string sDestinationIPAddress
int nPort
int nPosition
string sIndex
for(nPosition
= 0; nPosition < GetArraySize(Destinations); nPosition ++)
sIndex = GetArrayIndex(Destinations, nPosition)
sDestinationIPAddress =
Destinations[sIndex]["IPAddress"]
nPort =
Destinations[sIndex]["Port"]
ForwardTrap(sDestinationIPAddress + ":" + ToString(nPort), Pdu)
endfor
|