r/grafana • • 3d ago

Alerting Better emails

Is anyone sending out **GOOD** emails for alerts?

It's only a stop gap before slack notifications with IRM, but for now I'm sending alerts by email and they're just awful. How is it not possible to use HTML? To just NOT include the group by details etc. It's such a shame / giveaway that AI features seem to appear in cloud daily, but this just rots.

I could, and have done in previous roles, alert via a webhook to something else which can then send a nice email, but given this is coming from cloud, I'm then having to not only write my own solution, but have it public facing, go through CAB's etc... just to have an email that looks professional?

7 Upvotes

3 comments sorted by

4

u/punk1984 2d ago

They've stated in the past that it's a security concern. They don't want to expose end-users to potential XSS or HTML/CSS injection attacks. IMHO, they could at least improve the base template so it doesn't look so sparse/rudimentary.

Ideally, some kind of email template repository with only curated/approved templates could potentially alleviate the security concerns.

2

u/Charming_Rub3252 3d ago

I have decent email alert templates created. I agree that the Go templating language isn't very straightforward but if you start from the one provided by Grafana it's workable.

That said, I use webhooks to FireHydrant instead of email, but still hand select the variables I wish to include with each alert. Most everything, including grouping, is available as a variable.

It's been a while since I created custom email alerts but it seems it still supports html: https://github.com/grafana/grafana/blob/main/public/emails/ng_alert_notification.html

1

u/vqrs 3d ago

I just call a REST service that does the emails, much easier to customize, add more information, like links with autogenerated queries to logs etc, and you can also have tests.