Send SNMP Traps in Nagios

A passive check is used in Nagios for SNMP Trap notifications, ie the device notifies Nagios about the events. To create a trap on the device, read the documentation: SNMP Traps notification.

To receive and interpret SNMP Traps requires the following tools:

1) Net-SNMP  snmptrapd  SNMP Trap receive service (http://www.net-snmp.org/)

2) SNMPTTSNMP Trap messages interpretation service (http://snmptt.sourceforge.net/)

Net-SNMP snmptrapd utility configured as follows:

/etc/snmp/snmptrapd.conf
traphandle default /usr/sbin/snmptthandler disableAuthorization yes

thus, the incoming SNMP Traps redirected in  “/usr/sbin/snmptt” handler of SNMPTT translator

SNMPTT translator is used for the collection of information received in the SNMP Trap.
For processing of Traps with SNMPTT service,  SNMP Trap OID must be converted with a mib file into a file with extension .conf conversion utility snmpttconvertmib and plugged to a file /etc/snmp/snmptt.ini:

/etc/snmp/snmptt.ini
... [TrapFiles] snmptt_conf_files = <<END /etc/snmp/snmptt.conf END

Content of snmpd.conf file after conversion into vutlan.mib:

/etc/snmp/snmptt.conf
EVENT ctlUnitTrapNotification .1.3.6.1.4.1.39052.1.5 "Status Events" Normal FORMAT $* EXEC /usr/lib/nagios/plugins/eventhandlers/submit_check_result $r TRAP 1 "$*" SDESC Vutlan EMS trap Variables: EDESC

ie all Trap messages are sent to the script  submit_check_result, which interprets the state of the element in the logic, formats the message and sends it to the Nagios passive checks pipe:

/etc/snmp/snmptt.conf

This script defines the name set when the SNMP Trap notification in the master module is created, as well as the state of the element, which led to the triggering logic.

In the Nagios configuration file, you must add a template for passive testing and tie this pattern, for example, with a group of hosts:

/etc/nagios/objects/schosts.cfg

'Trap1' name must match the SNMP Trap notification name in the master module.

And when you send a text message to the Nagios in some the service status should be changed:


To send a notification, you must create a logic circuit in a master unit interface, the result of which is associated with sending SNMP Trap1 notification


Example of such notification:

Unfortunately, a bunch snmptrapd and SNMPD do not accept UTF8, so names must be specified in Latin.