snmp# walk
varName vbl body
snmp# walk vbl script
The snmp# walk session command
walks a whole MIB sub-tree. The command repeats sending getbulk
requests until the returned
varbind list is outside
of the sub-tree rooted at the varbind list vbl.
The first version of the
walk command is synchronous. For each valid varbind list retrieved from
the agent, the Tcl script body is evaluated.
Before evaluation of body
starts, the actual varbind list is assigned to the variable named varName.
Below is a simple example
that prints the two columns ifDescr and ifType of the interface table:
$s walk x “IF-MIB!ifDescr
IF-MIB!ifType” {
puts
“[snmp value $x 0] ([snmp value $x 1])”
}
The second version of
the walk command is asynchronous. For each valid varbind list retrieved
from the agents, the callback script script is evaluated.
Substitutions of % escape
sequences take place as described above and scripts are always evaluated
at global level.
The script is called with
an error status set to endOfWalk and an empty varbind list when the walk
terminates.
Below is the asynchronous
version of the example which prints the two columns ifType and ifDescr
of the interface table:
$s walk “IF-MIB!ifDescr
IF-MIB!ifType” {
if {”%E” == “noError”} {
puts
[subst {[snmp value “%V” 0] ([snmp value “%V” 1])}]
}
}
|