Re: [tkined] traps handling in Windows

Erik Schoenfelder (saustin_deja@my-deja.com)
Fri, 09 Jul 1999 05:53:34 -0700

You don't need straps or the NT SNMPTRAP.EXE to be running, all the trap processing is built into 3.0.0.
SNMPTRAP.EXE is started if you use the NT Snmp trap service - you'll want to disable this.

If you have some 2.1.10 scripts you'll have to modify them, the syntax of some of the snmp commands have changed.

Another problem I was having was making sure I knew which version of SNMP my traps were in - our agent uses SNMPv2c for management but generates traps only in SNMPv1 format. So I had to use the SNMPv1 vesion in my Tnm scripts.

Here's a short example (hopefully this will be readable!):

#
# Tcl script for trap testing, using v 3.0.0 of Tnm
#

package require Tnm 3.0.0

# make the Tnm commands available without needing
# namespace qualifier Tnm::

if {[namespace which ined] == ""} {
puts "Importing Tnm namespace"
namespace import Tnm::*
}

set target 10.99.99.99

#
# "callback" function that is bound to the trap.
#
proc trapHandler {trap ip args} {
#
# parse the trap varbinds that come in as args
#
set trapName [lindex [lindex $args 1] 2]
puts "Got trap $trapName from $ip: $args"
}

puts "Loading MIB and establishing SNMP session with \
$target"

# MIBs must be in directory for these commands
mib load myBox.mib

# get a handle to an trap management session with the
#target
set trapRxer \
[snmp listener -version SNMPv1 -notify public]

# this is a handle for sets 'n' gets:
set s \
[snmp generator -address $target \
-read public -write private]

# associate the trapHandler proc with the traps
$trapRxer bind trap "trapHandler %S %A %V"

--== Sent via Deja.com http://www.deja.com/ ==--
Share what you know. Learn what you don't.

--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.