This article covers how to send a trap to Nagios server to test SNMP Trap functionality.
Basically, when troubleshooting an SNMP Trap issue, it can be very helpful to remove the actual device that could be causing problems and use the snmptrap command instead.
So in this guide, you will learn all the methods of sending a trap to your Nagios server to test SNMP Trap functionality.
SNMP Trap Definition
The following trap definition can be placed in /etc/snmp/snmptt.conf which will allow the test traps sent above to be passed through to Nagios:
EVENT netSnmpExampleHeartbeatRate .126.96.36.199.4.1.8072.2.3.0.1 "netSnmpExampleHeartbeatRate" Normal
FORMAT SNMP netSnmpExampleHeartbeatRate
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "" "netSnmpExampleHeartbeatRate"
The default SNMP Trap configuration is stored in the /etc/snmp/snmptrapd.conf file and contains just two lines:
traphandle default /usr/sbin/snmptthandler