An SNMP trap is an unsolicited notification that an SNMP agent on a network device sends to a management station when a specific event occurs, such as an interface going down, a power supply failing or a temperature threshold being exceeded. In network monitoring, traps complement regular polling: instead of waiting for the manager to ask, the device reports the event immediately.
Traps are part of the Simple Network Management Protocol in networking and are normally sent over UDP to port 162 on the receiving system, called the trap receiver or notification receiver. Their content is described by objects defined in a MIB, so the receiver can translate numeric identifiers into meaningful event names.
How an SNMP trap is generated and delivered
An SNMP trap starts with an internal event on the agent. The device firmware detects a condition defined as notifiable, builds a protocol data unit and sends it to every configured trap destination. The message contains a notification OID that identifies the event type, a timestamp in the form of sysUpTime, and a list of variable bindings with details such as the interface index or the measured value.
Because traps travel over UDP, delivery is fire-and-forget: the agent does not know whether the message arrived. A lost packet means a lost event. To address this, SNMPv2c introduced the InformRequest, a notification the receiver must acknowledge; the agent retransmits it until it receives a response or reaches its retry limit.
The table below compares the two notification types available to SNMP agents.
| Property | Trap | Inform |
|---|---|---|
| Acknowledgment | None | Required from receiver |
| Reliability | Lost if a packet drops | Retransmitted on timeout |
| Agent resources | Minimal | Buffers kept until acknowledged |
| Available since | SNMPv1 | SNMPv2c |
| Typical use | High-volume events | Critical alerts |
SNMP trap formats across protocol versions
The structure of a trap differs between versions. The SNMPv1 trap PDU has its own format with an enterprise OID, the agent address, a generic trap number from 0 to 6 and a specific trap code. SNMPv2c and SNMPv3 replaced this with a uniform SNMPv2-Trap PDU in which the event identity is carried as the snmpTrapOID variable binding.
The main difference that matters in operation is security. SNMPv1 and SNMPv2c authenticate only by a community string sent in clear text, which anyone capturing traffic can read. SNMPv3 adds the User-based Security Model with message authentication and encryption, so a receiver can verify that a trap really came from the claimed device.
| Version | PDU format | Security | Inform support |
|---|---|---|---|
| SNMPv1 | Trap-PDU with generic and specific codes | Community string | No |
| SNMPv2c | SNMPv2-Trap PDU | Community string | Yes |
| SNMPv3 | SNMPv2-Trap PDU in secured message | Authentication and privacy | Yes |
With SNMPv3 traps, the receiver must know the agent’s engine ID and user credentials in advance, because the sender is authoritative for trap messages. A mismatched engine ID is one of the most frequent reasons why SNMPv3 traps are silently discarded.
Standard SNMP trap types
A small set of generic traps is defined for all devices, while vendors add enterprise-specific traps in their own MIB modules. The generic set covers basic availability events that every monitoring system should handle.
| Trap | Generic number | Meaning |
|---|---|---|
| coldStart | 0 | Agent restarted, configuration may have changed |
| warmStart | 1 | Agent reinitialized without configuration change |
| linkDown | 2 | An interface left the operational state |
| linkUp | 3 | An interface returned to operation |
| authenticationFailure | 4 | Request with a wrong community or credentials |
| egpNeighborLoss | 5 | EGP peer lost, now historical |
| enterpriseSpecific | 6 | Vendor event defined in a private MIB |
Enterprise-specific traps carry the most operational value, for example fan failure, power supply loss, high CPU or BGP session changes. To decode them, the trap receiver needs the vendor MIB files loaded; otherwise it displays only raw numeric OIDs.
Traps compared with polling and other telemetry
SNMP traps and SNMP polling answer different questions. Polling asks devices for counters at fixed intervals, often every one to five minutes, and is suited to trends and graphs. Traps report discrete events within seconds, but they cannot show what happened between events or confirm that a silent device is healthy.
| Need | Recommended method | Reason |
|---|---|---|
| Immediate alert on failure | SNMP trap or inform | Event is pushed when it happens |
| Bandwidth and error trends | SNMP polling | Regular counter samples |
| Detecting a dead device | Polling or ping checks | A dead device sends no trap |
| Traffic flow analysis | NetFlow or IPFIX | Per-flow records, not events |
| High-frequency metrics | Streaming telemetry | Sub-second push of structured data |
The usual design combines both: traps trigger fast reaction, and polling provides the baseline and detects devices that have stopped responding entirely. Syslog often runs alongside traps, giving richer free-text context for the same events.
Common problems and good practice with SNMP traps
Most trap problems come from configuration drift and volume, not from the protocol itself. A flapping interface can generate hundreds of linkDown and linkUp traps per minute, a so-called trap storm that buries important alerts and overloads the receiver. Another frequent issue is a source address mismatch: when a device sends traps from an unexpected interface address, the receiver may fail to associate them with the correct device record.
- Allow UDP port 162 from management networks through firewalls and access control lists.
- Configure at least two trap receivers so a single server failure does not lose events.
- Use informs for critical events where loss is unacceptable.
- Apply rate limiting and deduplication on the agent or receiver to contain trap storms.
- Prefer SNMPv3 with authentication to block spoofed traps.
- Keep vendor MIBs current so new firmware traps are decoded correctly.
The short version
An SNMP trap is a message a network device sends on its own when something important happens, such as a cable being unplugged or a fan breaking. It works like a smoke alarm: it does not wait to be asked, it simply sounds when there is a problem.
The monitoring system collects these messages and alerts the people responsible. The catch is that a broken device may not send anything at all, so traps are always combined with regular checks.
Where it makes a difference
A regional hospital runs about 250 switches and routers across three buildings. Previously, its monitoring system polled every device every five minutes, so a failed uplink could go unnoticed for several minutes while clinical systems lost connectivity.
The network team configured all core and distribution switches to send SNMPv3 informs for linkDown, power supply and fan events to two redundant receivers, and loaded the vendor MIBs so alerts showed readable names. When a fiber uplink to the radiology wing was cut during construction work, the alert reached the on-call engineer within about ten seconds, and traffic was moved to a backup link before most staff noticed any interruption.