Some new alerts not using alert template


I’m fairly new to LibreNMS but I’m slowly getting the hang of it. I do notice an issue with Alert Templates. I customized mine so that it sends using HTML with some custom formatting (I’m using the docker version of LibreNMS but I couldn’t get the @extends thing to work in my case so I just put the HTML in there all in-line). Works well for the most part. I can unplug a device and it’ll email me using the template I created (both the alert and the recovery).

The device rule is a slightly modified Devices Up/Down rule (macros.device_down = 1 AND devices.status_reason = “icmp”). It’s set for “all devices” and going to the transport group I specified. (I also tried the default Devices Up/Down rule (macros.device_down = 1) and it still gets triggered in this issue specified below)

The alert template should be the one I specified to handle the Devices Up/Down rule (but I also modified the Default Alert Template to match the body of the one I created just in case it’s falling back to that one)… so I just have those 2 templates in the system. It’s just basic HTML and it’s working for all devices except one!

What’s actually happening is I’m getting an alert that seems to get triggered by the Device Up/Down alert rule, but it doesn’t use the new Alert Template I specified! The timestamp is currently so it’s not a phantom alert, but it seems to be a phantom template!? I tried restarting all the docker containers but it still gives the same issue.

How would I go about troubleshooting why this device is triggering Device Up/Down constantly (daily, but not constantly… it’s random, but at least 10 times per day for that one specific device) and also using a template that isn’t in the list of Alert Templates?

Thank you.

Make sure you properly mapped the template to the rule. It is slightly odd because you have to do this from the alert templates screen.

That’s the only place I’ve been editing the template.

It looks like this:

And again, both the default and the new one that all the Alert Rules are attached to are the same… but I’m still getting alerts for that one device on my network and it’s using the original template (but other devices are using this template properly so I know the alert template I have set up is working), so I have no idea where it’s getting it from for that one device, as it’s not saved here.

After speaking to others on the Discord channel, someone was kind enough to share their html Alert Template config with me. Their config is working well, without those issues, so it seems there must have been an error/issue with something in my code.

You were kind enough to point out that LibreNMS sends a backup template based alert if something is wrong with any custom one (as a fallback). You also added code was introduced in version 23.11.0 that should help identify this is the case: Give reason for alert template fallback by murrant · Pull Request #15583 · librenms/librenms · GitHub (just putting this in the notes here in case someone else has a similar issue/question).

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