Email Alert for SNMP Trap

I have configured snmptrapd with a MIB file and now when I receive traps, the associated logs include a readable description of the received trap in the message field as expected. Now I want to send an email alert with that message. I tried editing the Alert Template according to: https://docs.librenms.org/Alerting/Templates/ however there is no “Placeholder” for the message parameter. How can I send an email alert that includes the message parameter to let the recipient know what went wrong?

bash-4.2$ ./validate.php

Component Version
LibreNMS 21.4.0-68-g99db4bf
DB Schema 2021_04_08_151101_add_foreign_keys_to_port_group_port_table (208)
PHP 7.3.28
Python 3.6.8
MySQL 10.3.28-MariaDB
RRDTool 1.4.8
SNMP NET-SNMP 5.7.2

====================================

[OK] Composer Version: 2.0.13
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct

Working on the same problem here…

Trap Message : {{ $value[‘message’] }}

^^^ this solved it for me. (in the alert template)

1 Like

Nice one, thank you! I see now that any of the iterated values must be enclosed in double braces, not just the special field $value['string'] as described in the doc.

Cheers!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.