#===============
TRAPVISION EVENT LOG TRAP HANDLER ==============
# The
following variables are being passed to this script by
TrapVision
# 'Pdu'
- SNMP Trap pdu containing trap specific information
#
'EventType' - the type of event (Error, Warning, etc.)
#================================================================
string
sOriginatorIPAddress
= GetPduIp(Pdu)
string
sTrapEnterprise =
GetPduEnterprise(Pdu)
int
nTrapCode =
GetPduTrapCode(Pdu)
string
sTrapOID =
sTrapEnterprise + "." +
ToString(nTrapCode)
string
sTrapName =
GetPduTrapName(Pdu)
if(sTrapName ==
"Enterprise specific")
sTrapName = sTrapOID
endif
string
sMessage =
"TrapVision received trap " +
sTrapName + " from " +
sOriginatorIPAddress + " on " +
GetTimeString() + CR
sMessage +=
"Variables:"
sMessage += CR
int
nVarCount =
GetVarCount(Pdu)
int
nIndex
snmpvar
Variable
string
sVariableRecord
for
(nIndex=0; nIndex < nVarCount;
nIndex++)
Variable = GetVarAt(Pdu, nIndex)
sVariableRecord = "OID: " +
GetVarOID(Variable) + TAB + TAB + "VALUE: " + GetVarValue(Variable) +
CR
sMessage += sVariableRecord
endfor
EventLogWriteRecord("localhost",
"Application", sMessage,
EventType)