I’m trying to use Icinga2 to monitor the SNMP traps from devices.
According to the documents, /var/run/snmptrapd.pid should be used in the following two configuration files.
snmptrapd is not part of Icinga2, it’s part of the net-snmp software as daemon to receive SNMP traps.
You have to configure it (/etc/snmp/snmptrapd.conf), and if you start it as service there will be the
pid file you are looking for.
Usually you have to integrate SNMP traps into Icinga2 by forwarding traps to a traphandler like snmptt or the new Icingaweb2 module trapdirector. These tools process the traps (i.e. set severities based on trap variables, log,…) and are able to create check results for passive services which are fed into Icinga2.
You will find a howto in Icinga2 Doc here.
Now the SNMP trap can be received by SNMPTRAPD and recorded in the /var/log/snmptt/snmptt.log log file.
root@icingaserver:/var/log/snmptt# cat /var/log/snmptt/snmptt.log
Tue Sep 10 17:41:11 2019 .1.3.6.1.4.1.2011.2.91.10.2.1.0.1 Normal “Status Events” 8.44.143.66 - Array N/A Trap Test Alarm 2 1 4294967294 07 E3 09 0A 11 28 04 00 4294967295 This alarm just for testing.Please ignore it. 1 2305843009213693950 819 21023520526062910601
The next question is how to display the SNMP trap on the icingaweb2?
I followed the Icinga2 Doc to configure the two configuration files /etc/snmp/snmptt.conf and /etc/icinga2/conf.d/services.conf, however, it seems not work correctly.
On the icingaweb2, there does have an service DoradoTRAP, but it’s in “CRITICAL” status, the content of SNMP trap is not displayed.
Could you please advise how to modify the two configuration files?Thank you very much!
root@icingaserver:/var/log/snmptt# cat /etc/snmp/snmptt.conf
EVENT enterpriseSpecific .1.3.6.1.4.1.2011.2.91.10.2.1.0.1 “Status Events” Normal
FORMAT $*
EXEC echo “[$@] PROCESS_SERVICE_CHECK_RESULT;$A;$1;$2;$3” >> /var/run/icinga2/cmd/icinga2.cmd
SDESC
An enterprise specific trap.
The varbinds in order denote the Icinga service name, state and text.
EDESC
root@icingaserver:/var/log/snmptt#
root@icingaserver:/var/log/snmptt# cat /etc/icinga2/conf.d/services.conf
…
object Service “DoradoTRAP” {
import “generic-service”
vi /etc/snmp/snmptt.conf
EVENT enterpriseSpecific .1.3.6.1.4.1.2011.2.91.10.2.1.0.1 “Status Events” Normal
FORMAT $*
EXEC echo “[date +%s] PROCESS_SERVICE_CHECK_RESULT;host.Dorado;service.Dorado;$6;SourceIP:$A,AlarmName:$4” >> /var/run/icinga2/cmd/icinga2.cmd
SDESC
An enterprise specific trap.
The varbinds in order denote the Icinga service name, state and text.
EDESC