Home
You are not currently signed in.

MIB Smithy

  1. Up to Table of Contents

Sending GET-BULK Requests

The SNMP Session's bulk subcommand is used to send SNMP GET-BULK requests to the configured agent for the session. The command may be used either in synchronous (wait for timeout or response before returning) or asynchronous (return immediately) mode, depending on whether or not the -callback parameter has been specified. When used in synchronous mode, the SDK will take care of instructing Tcl/Tk to handle idle events such as GUI updates, so synchronous mode is safe to use in a GUI environment.

This request is automatically translated into a get-next request by the SDK if the version used to send the message will be SNMPv1. If max-repetitions is 0, the varBindList will be trimmed to the first non-repeaters varbinds.

Syntax:

% snmpcmd bulk ?option value ...? ?varBindList?

Where:

snmpcmd
is the name of session whose configuration identifies the agent to send the request to;
option value
are zero or more option+value pairs that may be present to override session configuration or other aspects of the request; and
varBindList
is an optional list of zero or more Variable Bindings to include in the request.

In particular, this request supports the -nonreps and -maxreps options for controlling the non-repeaters and max-repetitions fields specific to the GET-BULK request.

Returns:

  • 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 name+value pairs -- the same as those passed to the args parameter of a callback when used in asynchronous mode -- containing all of the response and result information for the request (See Callback Functions for details).

Request Options

-address address
Specifies the IP address or hostname to send the request to. This option overrides the default address configured for the session.
-alias name
Specifies the name an alias of preconfigured options that are to be subsituted in place of the alias in the bulk command.
-callback proc
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.
-community string
Specifies the community string to use in the request if transmitting via SNMPv2c. This option overrides the default read community string configured for the session.
-ctxengineid string
Specifies the contextEngineID value to use for SNMPv3 messages. An empty string (default) indicates that the same value as msgAuthoritativeEngineID is to be used for contextEngineID.
-ctxname string
Specifies the contextName value to use for SNMPv3 messages.
-db name
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.
-delay ms
Specifies a delay (in milliseconds) to wait before sending the SNMP message, which may be used to mitigate network congestion issues. This option overrides the default delay configured for the session.
-nonreps count
Specifies the integer value for the non-repeaters field of the GET-BULK request. The default value for this property is 0, which means that each variables provided in the variable bindings are is to be treated as repeaters that should return up to the number of objects specified by the max-repetitions field.
-maxreps count
Specifies the integer value for the max-repetitions field of the GET-BULK request. The default value for this property is 1.
-messageid integer
Specifies the Message ID to use in generating a transmitted SNMPv3 message. This option overrides the default Message ID that the SDK would otherwise automatically generate and encode in the message header.
-port port
Specifies the integer port number or service name to send the request to. This option overrides the default port configured for the session.
-requestid integer
Specifies the Request ID to use in generating the transmitted PDU, regardless of SNMP version. This option overrides the default Request ID that the SDK would otherwise automatically generate and encode in the PDU.
-retries count
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.
-timeout ms
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.
-version 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.

Example 1 - Synchronous GET-BULK Request on system as relative OID

% set result [snmplib bulk system]
-mpd snmplib -address 127.0.0.1 -port 161 -version SNMPv3
-community public -pdutype response -requestid 0
-status noError -eindex 0 -varbinds
{{1.3.6.1.2.1.1.1.0 {OCTET STRING} {Generic SNMP Agent}}}

% array set params $result
% array get params -status
-status noError

Example 2 - Asynchronous GET-BULK Request on system as relative OID

% set id [snmplib bulk -callback onResponseCmd system]
5104

Example 3 - Asynchronous GET-BULK Request with 10 max-repetitions

% set id [snmplib bulk -maxreps 10 -callback onResponseCmd system]
5105
  1. Up to Table of Contents