Sending INFORM Requests
The SNMP Session's inform
subcommand is used to send SNMP inform requests to the configured target for the session. Inform requests are a special type of notification, similar to a trap and typically sent to a management application (but not necessarily). Unlike traps, which are unconfirmed and are simply sent and forgotten, inform requests require a response, similar to manager-to-agent requests. Note that inform requests are not supported by SNMPv1.
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.
Syntax:
% snmpcmd inform ?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.
To be a valid inform request, the snmpTrapOID.0
and sysUpTime.0
variables must be present in the varBindList
, identifying the notification and the time at which it occurred, although the SDK will transmit the notification even without these values.
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
inform
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 SNMPv1 or 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.
-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, except for SNMPv1.
Example 1 - Asynchronous linkUp inform request
% snmplib inform -port 162 -callback informResponse \
[list sysUpTime.0 1234] [list [list snmpTrapOID.0 linkUp]]