> if you have a simple code fragment that does these simple things
> with traps please send me and tell me any other things i need to
> set up before executing it.
> The following is what I use in my .scottyrc and enables the displaying of traps
> as they arrive. NB that the list of community strings which I use
> may need to be changed to match the trap community used by the
> devices you're trying to monitor.
---START---
#
# If we are running interactivly set up a trap handler
#
if {$tcl_interactive} {
proc trapHandler { status index request ip list session} {
set msg "\n********************************************************************************\n"
append msg " SNMP Trap from $ip with '[lindex [$session configure] 1]'\n"
append msg " Session ID : $session \n"
append msg " Request ID : $request \n"
append msg " Error Status : \"$status\" on index $index \n"
append msg "--------------------------------------------------------------------------------\n"
foreach vb $list {
append msg [format "%-30s = \"%s\"\n"\
[mib name [lindex $vb 0]] [lindex $vb 2] ]
}
append msg "********************************************************************************\n"
puts stderr $msg
}
if ![info exists trap_session] {
set trap_session {}
foreach id {public security generic monitor} {
set trap [snmp session -port 162 -community $id]
$trap bind {} trap {trapHandler %E %I %R %A "%V" %S}
}
}
}
---END---
Hope this helps
Graeme