Home
You are not currently signed in.

MIB Smithy

  1. Up to Table of Contents

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. The SDK uses the value provided for snmpTrapOID.0 in the variable bindings to identify the notification regardless of SNMP version: its value will be translated appropriately for SNMPv1 traps.

Syntax:

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

Where:

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

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. These 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

-address address
Specifies the IP address or hostname to send the trap 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 trap command.
-community string
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.
-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 trap. 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 trap 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.
-version 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.
  1. Up to Table of Contents