Send an SNMP TRAP message to a host


snmptrap [-d] -v 1 host community trap_type
         specific_type device_description
         [-a agent_addr]

snmptrap [-d] [-v 2] host noAuth trap_type
         specific_type device_description
         [-a agent_addr]

snmptrap [-d] [-v 2] host srcparty dstparty
         context trap_type specific_type
         device_description [-a agent_addr]

Runs on:



-a agent_addr
Change the address that the trap reports it's being sent from. By default, snmptrap uses the sending host's address.
Dump the output packet.
-v 1|2
SNMP version (default is 2).
The community name for the transaction with the remote system.
The collection of object resources available to the dstparty.
A textual description of the device sending this trap. The description is used as the value of a system.sysDescr.0 variable.
The name of the party performing the action.
An Internet address specified in dot notation or a host name.
The name of the party requesting an action.
An integer that specifies user-defined additional information about trap_type.
An integer that specifies the type of trap message being sent. Trap types are defined in the table below.


The snmptrap utility forms and sends an SNMP TRAP message to a host.

This trap type: Signifies that the sending protocol entity:
0 (coldStart) Is reinitializing itself--the agent's configuration or the protocol entity implementation may be altered.
1 (warmStart) Is reinitializing itself--neither the agent's configuration nor the protocol entity implementation is altered.
2 (linkDown) Recognizes a failure in one of the communication links represented in the agent's configuration.
3 (linkUp) Recognizes that one of the communication links represented in the agent's configuration has come up.
4 (authenticationFailure) Is the addressee of a protocol message that isn't properly authenticated.
5 (egpNeighborLoss) Had an EGP neighbor as an EGP peer, and the neighbor has been marked down so that the peer relationship no longer exists.
6 (enterpriseSpecific) Recognizes that some enterprise-specific event has occurred. The specific trap field identifies the particular trap that occurred.

If you're using SNMP version 2, you must configure the following files:

For a description on how to configure the files, see the documentation for each of the configuration files listed above. If you wish to change the location of your configuration files, you must include a snmpd.conf file.


Send a cold start trap to the specified host:

Using SNMPv1

snmptrap -v 1 public 0 0 \
'SUN 3/60: SUNOS4.0'

Using SNMPv2

snmptrap manager_party \
agent_party agent_context 0 0 'SUN 3/60: SUNOS4.0'

Environment variables:

Specify the location of the mib.txt file. For example, MIBFILE=path/mib.txt (the default path is /etc).
If SUFFIX exists in your environment, all object IDs with a symbolic name are printed with only the last element. Examples:

This ID:


is printed as:


This ID:


is printed as:


See also:

snmpd, snmpget, snmpgetnext, snmpnetstat, snmpstatus, snmpset, snmptest, snmptranslate, snmptrapd, snmpwalk

/etc/acl.conf, /etc/context.conf, /etc/mib.txt, /etc/party.conf, /etc/snmpd.conf, /etc/view.conf files

RFC 1065, RFC 1066, RFC 1067
RFC 1441, RFC 1445, RFC 1446
RFC 1448, RFC 1449

Marshall T. Rose, The Simple Book: An Introduction to Internet Management, Revised 2nd ed. (Prentice-Hall, 1996, ISBN 0-13-451659-1)