Hi,
I am trying to customize the message the Alertmanager is sending to opsgenie.
I am using:
Grafana 9.1
Alertmanager Grafana
I noticed that the message can be templated without problems, the full template data are available (i.e .Annotations, .Labels etc). On the contrary the title is impossible to template, it seems there is something wrong in the data visibility.
level=warn msg="failed to template Opsgenie message" err="template: :1:14: executing \"\" at <.Annotations.summary>: can't evaluate field Annotations in type *channels.ExtendedData"
I am having a very simialr issue when sending alerts to Discord:
logger=alerting.notifier.discord t=2023-02-27T20:14:15.846740432Z level=warn msg="failed to template Discord notification title" error="template: main:3:30: executing \"main\" at <.Annotations.summary>: can't evaluate field Annotations in type *channels.ExtendedData"
This is what the contact point template looks like:
(I’ve also tried with a lower case ‘s’ for ‘summary’)
Is this also not implemented in discord? Grafana does send information related to the instances (found in the queries themselves), but only when I use the default template (nothing filled in). The problem with that is that I’ve no idea what the go template actually looks like, so I don’t know how to access that label.
Hi! The template is incorrect as you need to first range over the alerts first. We have some examples of this in our new and improved documentation Customize notifications | Grafana documentation.