[Grafana 8] [Unified Alerting] Email notification template redifinition

What Grafana version and what operating system are you using?

Grafana v8.3.4 on Linux RPM

What are you trying to achieve?

I need to redefine the standard “Email notification” template for Unified Alerting within Grafana User Interface.

How are you trying to achieve it?

I am trying to use “Message Templating” functionality for this.

What happened?

Email notification template seem to be impossible to be customized via Grafana User Interface, which is a huge frustration. As a result:

  • Not clear at all how to redefine email notification “Subject
  • Not clear at all how to redefine email notification “Body”, when you do not have direct access to Grafana server, which is 99% of the cases, when we speak about big enough organization (it seems to still be possible to replace the template HTML file)
  • It is not possible to have different HTML templates for different alerts, which use email as the notification channel.
  • Default email notification template is too general and sometimes is completely useless.

What did you expect to happen?

That notification templates are easily configurable, within Grafana UI.

That different “contact points”/“alerts” may be associated with different alert templates.

Did you follow any online instructions? If so, what is the URL?

I used only official Grafana docs, which are not in the ideal state, to be honest:

So, is there any way to redefine email notification “subject” and “body”?
I suppose the only currently available way to redefince email “body” is to replace the ng_alert_notification.html file? But still, how do I change the subject?

Is it going to be added to Grafana UI, so HTML templates are also editable there?

same question for me

Do you find a solution?

1 Like

No, I haven’t found any solution yet.

Changing the “html” template by changing the file on Grafana server is also very painful for us, because we don’t usually have direct access to the infrastructure. Also, there’s no way to define different templates for different alerts or teams with changing the ‘html’ file.

So, we’re still looking for suggestions from Grafana Labs and the community…

I switched back to the old legacy alerting.

There you can edit more stuff

Both Legacy Alerting and Unified Alerting lack proper customizations for the email alert notifications. Legacy Alerting is even less configurable and there you cannot even control what values will go to the alert, and in which format. That’s basically the reason why they implemented all these functions for the value formatting.

So, for us both options have their crucial downsides, but we also already think about switching back, since in Legacy Alerting it is at least much more transparent “what will go to notification subject” and “what will go to the body”.

It looks like Grafana Labs wanted to add more customizations to the alerts, but in fact they broke the simplicity, and some functionality was completely destroyed…

Your assessment is correct.
Unified alerting broke Email Template functionality.
There has been quite a bit of discussion on GitHub regarding a way to fix the issue.
Some custom email templates stopped working after migration to Grafana Alerting · Issue #42946 · grafana/grafana (github.com)

1 Like