bottrap
< Prev Back to Table of Contents Next >

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 target to send the request to, varBindList is an optional list of zero or more Variable Bindings to include in the request, and a series of option/value pairs may be present to override some configuration parameters or other aspects of 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

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, except for SNMPv1.
-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.
-requestid 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.
-messageid 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.

Example 1 - Asynchronous linkUp inform request

% snmplib inform -port 162 -callback informResponse \
    [list sysUpTime.0 1234] [list [list snmpTrapOID.0 linkUp]]
< Prev Back to Table of Contents Next >