bottrap
< Prev Back to Table of Contents Next >

Sending Traps

The SNMP Session's trap subcommand is used to send SNMPv1 and SNMPv2/v3 traps to the configured target for the session. Traps are one of two classes of notifications supported by SNMP, typically sent to management applications (but not necessarily). Unlike inform requests, traps are unconfirmed (that is, they are and are simply sent and forgotten; the recipient does not send back a response to them). Thus no callback is ever called when sending a trap message.

Syntax:

% snmpcmd trap ?option value ...? ?varBindList?

..where snmpcmd is the name of session whose configuration identifies the target to send the trap to, varBindList is an optional list of zero or more Variable Bindings to include in the trap, and a series of option/value pairs may be present to override some configuration parameters or other aspects of the message.

To be a valid trap, 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. Additional variable bindings: snmpTrapAddress.0, snmpTrapEnterprise.0, and snmpTrapCommunity.0 may also be present, in addition to those required by the specific trap definition. The latter three are typically used in proxy configurations when translating a received SNMPv1 trap to SNMPv2c or SNMPv3 prior to retransmission. Also, the SDK will translate all but snmpTrapCommunity.0 into appropriate fields (enterprise, generic-trap, specific-trap, time-stamp, and agent-addr) when transmitting an SNMPv1 trap. It will use default, session and local values if they are not present.

Returns:

Nothing.

Trap Options

Option Description
-db Specifies the name of the SMI Database to use for any necessary lookups for data types or converting names to OIDs in the trap. This option overrides the default SMI Database configured for the session.
-version Specifies the SNMP version to use when sending the trap. 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 trap to. This option overrides the default address configured for the session.
-port Specifies the integer port number to send the trap to. This option overrides the default port configured for the session.
-community Specifies the community string to use in the trap 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.
< Prev Back to Table of Contents Next >