| < Prev | Back to Table of Contents | Next > |
Versions 3.4 and later of MIB Smithy SDK support automated SNMP
Get-Next walks of subtrees or entire agents using the SNMP
Session's walk subcommand. Like individual requests,
the command may be used either in synchronous or asynchronous mode,
depending on whether or not the -callback parameter is
been specified. Using the walk command is particularly
useful for gathering table data, and most options available to other
request types are available to the walk.
% snmpcmd walk ?option value ...?
?varBindList?
..where snmpcmd is the name of session
whose configuration identifies the agent to send the request to,
varBindList is an optional list of zero or
more Variable Bindings to include
in the initial request, and a series of
option/value pairs
may be present to override some configuration parameters or other
aspects of the requests.
If the varBindList parameter is unspecified or empty,
the SDK will walk the entire agent starting at 0.0. Otherwise, the
SDK will issue a get-next with the given variable bindings and
continue issuing get-nexts with the response OIDs until one or more
of them is in a different subtree. In either case, the walk stops if
a request times out, is cancelled, or the end of the MIB view is
reached.
In asynchronous mode: a unique identifier that can be used by the callback procedure to later correlate response and result information to the request.
In synchronous mode: a list of variable bindings containing all of the values returned by the agent during the walk.
| Option | Description |
|---|---|
-callback |
Specifies the name of a Tcl procedure to be evaluated when a response is received or a timeout occurs. This procedure will be passed the unique identifier for the pending request and any result and response information received. If specified, the request will be performed in asynchronous mode, and synchronous mode otherwise. |
-db |
Specifies the name of the SMI Database to use for any necessary lookups for data types or converting names to OIDs in the request. This option overrides the default SMI Database configured for the session. |
-version |
Specifies the SNMP version to use when sending the request.
This option overrides the default SNMP version configured for the
session. The valid values accepted are the same as those for the
config command. |
-address |
Specifies the IP address or hostname to send the request to. This option overrides the default address configured for the session. |
-port |
Specifies the integer port number to send the request to. This option overrides the default port configured for the session. |
-timeout |
Specifies the integer timeout (in milliseconds) to wait before either retransmitting the message or signalling a timeout to the calling script (or callback), depending on the number of attempts made and the number of configured retries. This option overrides the default timeout configured for the session. |
-retries |
Specifies the number of attempts to be made to retransmit the request if no response is received. This option overrides the default number of retries configured for the session. |
-community |
Specifies the community string to use in the request if transmitting via SNMPv1 or SNMPv2c. This option overrides the default read community string configured for the session. |
% foreach vb [snmplib walk system] { puts $vb }
1.3.6.1.2.1.1.1.0 {OCTET STRING} {Example sysDescr}
1.3.6.1.2.1.1.2.0 {OBJECT IDENTIFIER} 1.3.6.1.4.1.8072.3.2.8
1.3.6.1.2.1.1.3.0 TimeTicks 772878758
1.3.6.1.2.1.1.4.0 {OCTET STRING} {Example sysContact}
1.3.6.1.2.1.1.5.0 {OCTET STRING} {Example sysName}
1.3.6.1.2.1.1.6.0 {OCTET STRING} Unknown
1.3.6.1.2.1.1.8.0 TimeTicks 4
% proc cb { id args } {
array set resp $args
if {$resp(-status) == "noError"} {
foreach vb $resp(-varbinds) { puts $vb }
}
}
% snmplib walk -callback cb system
2
%
1.3.6.1.2.1.1.1.0 {OCTET STRING} {Example sysDescr}
1.3.6.1.2.1.1.2.0 {OBJECT IDENTIFIER} 1.3.6.1.4.1.8072.3.2.8
1.3.6.1.2.1.1.3.0 TimeTicks 772878758
1.3.6.1.2.1.1.4.0 {OCTET STRING} {Example sysContact}
1.3.6.1.2.1.1.5.0 {OCTET STRING} {Example sysName}
1.3.6.1.2.1.1.6.0 {OCTET STRING} Unknown
1.3.6.1.2.1.1.8.0 TimeTicks 4
% puts "Agent has [llength [snmplib walk]] variables" Agent has 1529 variables
| < Prev | Back to Table of Contents | Next > |