blank.gif (43 bytes)

Church Of The
Swimming Elephant

dns | icmp | ietf | ined | inet | job | map | mib | netdb | ntp | snmp | sunrpc | syslog | term | udp

snmp getbulk nr mr vbl [script]

The snmp# getbulk session command can be used to implement faster MIB tree walks by using get-bulk-requests. 

The getbulk session command performs a getnext on the first nr elements given in the varbind list vbl. For the remaining elements, the agent is asked to repeat the getnext operation mostly mr times. 

SNMPv1 sessions automatically map getbulk-requests to getnext-requests. If the getbulk session command contains a callback script, then the command sends the getbulk-request and returns immediately. 

The result is the request id for the asynchronous request. The getbulk session command is processed synchronously if the callback script is absent. In this case, the received varbind list is returned. 

The command fails with a Tcl error if the agent does not respond or if a protocol error happens.

The following synchronous example show how to retrieve the value of ifNumber.0 and how to use it to read columns of the ifTable in a single getbulk operation.

set err [catch {$s get ifNumber.0} vbl]
if {$err == 1} { exit 1 }
set m [snmp value $vbl 0]
set vbl {SNMPv2-MIB!sysUpTime\
    IF-MIB!ifDescr IF-MIB!ifLastChange} set err [catch \
    {$s getbulk 1 $m $vbl} vbl]
if {$err == 1} { exit 2 }
puts $vbl
The example below does the same thing asynchronously. Note, both examples are simplifications because the getbulk does not guarantee that all mr repetitions are actually made. You therefore have to ask ifNumber.0 + 1 repetitions so that you are able to detect whether you got the whole table or just parts of it.
proc getit {s m} {
  set vbl {SNMPv2-MIB!sysUpTime\
    IF-MIB!ifDescr IF-MIB!ifLastChange}
  $s getbulk 1 $m $vbl {
    if {”%E” == “noError”} {
      puts “%V”

$s get ifNumber.0 {
  if {”%E” == “noError”} {
  getit %S [snmp value “%V” 0]




Protect yourself from cyberstalkers, identity thieves, and those who would snoop on you.
Stop spam from invading your inbox without losing the mail you want. We give you more control over your e-mail than any other service.
Block popups, ads, and malicious scripts while you surf the net through our anonymous proxies.
Participate in Usenet, host your web files, easily send anonymous messages, and more, much more.
All private, all encrypted, all secure, all in an easy to use service, and all for only $5.95 a month!

Service Details

Have you gone to church today?
All pages ©1999, 2000, 2001, 2002, 2003 Church of the Swimming Elephant unless otherwise stated
Church of the Swimming Elephant©1999, 2000, 2001, 2002, 2003 is a wholly owned subsidiary of Packetderm, LLC.

Packetderm, LLC
210 Park Ave #308
Worcester, MA 01609