############ begin example ############
#!/usr/bin/scotty2.1.5
proc CreateTable {TableName EntryList} {
set TableOID [mib oid $TableName]
global SnmpSession MibArray
foreach TableRow $EntryList {
set index1 [lindex $TableRow 0]
set index2 [lindex $TableRow 1]
set counter 0
foreach RowEntry $TableRow {
incr counter
set TmpOID $TableOID.1.$counter.$index1.$index2
$SnmpSession instance $TmpOID MibArray($TmpOID) $RowEntry
$SnmpSession bind $TmpOID get {
puts "Received SNMP-Get on %o"
}
}
}
}
proc RemoveAddr Set {
global EntryList MibArray
set NewList {}
set TmpOID "[mib oid udpTable].1"
foreach SetEntry $EntryList {
if {[lindex $SetEntry 0] != $Set} then {
lappend NewList $SetEntry
} else {
set Index0 [lindex $SetEntry 0]
set Index1 [lindex $SetEntry 1]
set counter 0
foreach Entry $SetEntry {
incr counter
unset MibArray($TmpOID.$counter.$Index0.$Index1)
}
}
}
set EntryList $NewList
}
set MibArray() ""
set SnmpSession [ snmp session -port 1701 -agent "" ]
set EntryList {\
{127.0.0.1 255}\
{127.0.0.1 256}\
{0.0.0.0 1}\
{0.0.0.0 2}\
{192.168.13.0 0}\
{192.168.13.0 1}\
{192.168.13.0 2}\
{192.168.13.0 3}\
{192.168.13.0 4}\
{192.168.13.0 5}\
{192.168.14.0 6}\
{192.168.14.0 7}\
{192.168.14.0 8}\
{192.168.14.0 9}\
{192.168.14.0 10}\
}
CreateTable udpTable $EntryList
RemoveAddr 192.168.13.0
foreach blafasel [lsort [array names MibArray]] {
puts $blafasel
}
#exit
puts "Agent running..."
############ end example ############
-- Email: Andreas.Bokeloh@informatik.uni-oldenburg.de
-- !! 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.