How to assign alert rule to multiple alert templates

I’m trying to setup an Alert Template to work with a SMS forwarder so I configured an alert template for plain text. However I’m not seeing any way to assign rules to more than 1 alert template in the web GUI. Is anyone aware of a way to do this in the backend by either editing a file or the database.

The ultimate goal would be send an html email normally for the alert while also sending the plain text alert for the SMS service.

The reason I’m using the templates and not the API is I don’t have the LibreNMS Server accessible from the outside. I can have the SMS service try to pick out the information from the html alert but I thought it would be easier to create 1 plane text template for all SMS alerts, barring the one alert template per alert rule in the GUI.

I’m not 100% sure, but I believe that Alerts can only be assigned to a single alert template.

1 Like

From the GUI that is true, but Im hoping to find some “hack” in the DB or files where I could create multiple associations.

I’m not aware of any way of assigning multiple templates to one alert rule either.

Two suggestions though:

  1. Does the secondary communication have to be SMS ? What about push notifications using something like Pushover ? As long as the LibreNMS server can connect out to the internet, you can use a push notification service.

I use the iOS Pushover app as my primary alerting mechanism for LibreNMS (and also other sources of push messages aside from LibreNMS as Pushover supports multiple alert sources each displayed in their own groups) and it does support HTML formatted messages.

  1. Are you sure you really need HTML formatted alerts ? After toying with them for a while I decided I didn’t really need them, and you can still put some raw URL’s in the messages if you like and most clients (including pushover) will detect them and turn them into clickable links and I’d say most SMS clients would as well.

For example all my alerts have a “Device URL” link in the alert which takes me directly to the device page for the alerting device - although if I receive that alert away from work I’d have to switch on my VPN to actually follow the link.

1 Like

Ill probably just create some duplicate rules for the important alerts.

The secondary doesn’t have to be SMS, but I can setup a transport rule that will just forward emails to the SMS service.

I don’t want the system accessible from the internet at this time. The one way communication is an interesting idea though.

I will also explore the Push Notifications thanks for the suggestions.

You should be able to do this within the template based on if/else statements using the $alert->transport_type or $alert->transport_name variables that are available: Templates - LibreNMS Docs

2 Likes

Ill look more into the transports I really have not delt with them at all. Thanks for the suggestion.

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