-
What Grafana version and what operating system are you using?
Grafana Cloud -
What are you trying to achieve?
I have defined several Notification Policies based onalertnameandsitelabels. All of these Policies should go to the same Contact Point (Slack channel) but some of them need to use different templates in the message body. For example — an alert saying 10 servers are down at one site should look different than an alert saying one device temperature is too high. -
How are you trying to achieve it?
I don’t see any way to apply templates to Notification Policies. So I made one Contact Point with one Notification Template Group. The word “group” doesn’t make sense to me, since this is actually one big go template. Inside that text box, I have defined one template with a long series ofif/elsestatements so that each alert shows the right text/links/formatting. -
What happened?
While this approach works so far, it’s confusing to manage and I worry it will get worse at scale when we add hundreds of different alert rules and templates. Is there a better way to manage this?
Yes, create generic notification template and all those per alert “customization” should be done on the alert level, e. g. annoations.
Thank you! This simple advice has made my job a whole lot easier, now it makes sense.