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 aware of any way of assigning multiple templates to one alert rule either.
Two suggestions though:
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.
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.
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