SNMP traps are notifications generated by networked devices and sent to network management systems to alert administrators of events, errors, or threshold violations. SNMP stands for Simple Network Management Protocol, and traps are a key component of SNMP-based monitoring.
Traps allow devices to asynchronously report issues as they occur on the network. This enables proactive monitoring instead of relying solely on periodic polling by the management system.
Traps are critical for identifying and quickly resolving network problems to minimize downtime. Without traps, network issues may go undetected for longer periods leading to major outages and performance impact.
Some examples of important events that can be monitored using SNMP traps include:
- Device reboots
- Link status changes
- Bandwidth threshold exceeded
- Hardware component failures
- Loss of power
- Security violations
- Buffer overflows
- High CPU/Memory utilization
Traps are generated automatically by devices when configured, and immediately notify admins of network changes.
This allows administrators to promptly investigate and troubleshoot problems before they spiral out of control. Traps are therefore essential for managing network operations, performance, availability, and security.
What are SNMP Traps?
SNMP traps are unsolicited notification messages sent from SNMP-enabled devices to network management systems (NMS) upon the occurrence of a significant event or condition that requires the attention of network administrators. Traps alert the NMS that something has changed in the network environment.
Traps contain data about the event such as trap ID, timestamp, source IP address, uptime, trap type, error code, severity level, bandwidth utilization, etc.
Different types of traps are defined for various events. By monitoring and analyzing traps, NMS can determine the status of devices and identify issues for troubleshooting.
How do SNMP Traps Work?
SNMP traps operate over UDP using port 162. They work on top of the SNMP protocol. When an event like an error, threshold violation, or change of state occurs on a router, switch, server, etc., the SNMP agent on the device will detect it.
The agent will then send an SNMP trap message to the pre-configured IP address and port of the NMS trap receiver.
The receiver processes the trap, extracts the critical information like trap type, source, and timestamp, and updates the database. The NMS can then present the SNMP trap data to the administrator through an interface or dashboard.
The admin can take appropriate action based on the trap details. SNMP traps are connectionless and fire-and-forget. The device won’t know if the trap was received or not.
Types of SNMP Traps
There are various standard SNMP trap types defined in different MIB (Management Information Base) modules. Some common traps include:
- coldStart – Device rebooted
- warmStart – Device reinitialized
- linkDown – Network interface connection down
- linkUp – Network interface connection up
- authenticationFailure – Invalid community string
- egpNeighborLoss – EGP neighbor lost
- enterpriseSpecific – Vendor specific trap
- risingAlarm – Threshold crossed
- fallingAlarm – Fell below threshold
Vendors also define custom traps in their enterprise MIBs for events specific to their devices. For example, Cisco routers have traps like ciscoConfigManEvent for configuration changes.
How to Configure SNMP Traps?
Steps to Configure SNMP Traps:
Step 1: Enable SNMP trap capabilities on the source network device:
enable configure terminal snmp-server enable traps
Step 2: Create an Access Control List (ACL) specifying the IP addresses of NMS servers allowed to receive traps:
ip access-list standard SNMP-ACL permit <NMS_IP1> permit <NMS_IP2> ...
Step 3: Configure the trap receiver in the NMS:
This step involves configuring the NMS software to listen for and process SNMP traps. The configuration may vary depending on your NMS software, and it’s typically done through a GUI or command-line interface provided by the NMS software.
Step 4: Enable the required trap types on the device using SNMP-server commands:
snmp-server enable traps <trap-type>
You should replace
<trap-type> with the specific SNMP trap types you want to enable, such as
Step 5: Specify the IP address and UDP port of the NMS trap receiver on the device:
snmp-server host <NMS_IP> <udp-port> version <snmp-version> <community-string>
<NMS_IP>: The IP address of your NMS server.
<udp-port>: The UDP port on which the NMS is listening for traps.
<snmp-version>: The SNMP version being used (e.g., SNMPv2c or SNMPv3).
<community-string>: The SNMP community string or credentials for authentication.
Step 6: Filter unwanted traps using INCLUDES/EXCLUDES view options:
This step involves configuring SNMP views to include or exclude specific traps. The exact commands may vary depending on your device and SNMP version. Typically, you’d use the
snmp-server view command.
Step 7: Set trap severity levels to categorize issues based on urgency:
This step involves configuring the severity levels for different traps. The configuration may vary depending on your device and SNMP version. Typically, you’d use the
snmp-server trap-source and
snmp-server enable traps commands with severity levels.
Step 8: Configure trap handler scripts or commands to automate response:
This step involves creating scripts or commands that are triggered when specific traps are received. The configuration will depend on your device and the scripting language or automation tool you are using.
Step 9: Test traps by generating test events and verify reception:
You can test traps by simulating events on the device (e.g., link up/down) and checking if the NMS receives the corresponding traps.
Step 10: Monitor delivery success rates and update configurations as needed:
Regularly monitor the NMS for trap reception and delivery success rates. Adjust configurations and scripts as necessary to improve monitoring and response to network events.
Tools for Configuring SNMP Traps:
- Command Line Interfaces – All SNMP devices allow trap configuration via CLI using SNMP-server commands
- Device Management GUI – Hardware consoles like Cisco Prime for configuring device monitoring
- NMS Platforms – SolarWinds, PRTG, Nagios, and ManageEngine provide automated trap handling
- SNMP MIB Browsers – To view supported traps, modify trap OIDs
Best Practices for SNMP Trap Setup:
- Use SNMPv3 with encryption for security
- Specify multiple trap receivers for redundancy
- Create ACL rules to limit the source of traps
- Categorize traps by severity for triage
- Filter unwanted trap types to reduce alerts
- Monitor and collect trap delivery success rates
- Set up automation responses via scripts
- Schedule regular testing of traps
Benefits of SNMP Traps
- Real-time Monitoring of Network Devices:
A key advantage of SNMP traps is enabling real-time monitoring and visibility into network infrastructure.
Traps provide continuous updates enabling admins to instantly detect outages, bottlenecks, errors, etc. without waiting for polling cycles. This allows for rapid fault identification and troubleshooting.
- Early Detection of Network Issues:
SNMP traps allow network administrators to identify issues at the onset before they create major disruption.
For example, a linkDown trap can indicate connectivity loss as soon as it occurs. Traps can also warn about performance problems like high bandwidth utilization before they cause slowness or outage.
Proactive alerts mean admins can diagnose and rectify problems early on.
- Improved Network Performance and Uptime:
By facilitating early issue detection through urgent trap alerts, network administrators can troubleshoot and resolve problems in a timely manner before they spiral out of control.
This helps minimize network disruptions, resolve temporary glitches, address developing performance bottlenecks, and prevent prolonged outages.
As a result, network uptime and availability improve significantly.
In summary, SNMP traps are real-time event notifications sent from managed devices to NMS platforms. Traps are critical for proactive monitoring and early issue detection.
Key benefits include real-time visibility, reduced mean-time-to-repair, and improved network uptime. Implementing effective SNMP trap management should be a priority for robust infrastructure monitoring.