Problem with e-mail notifications

Hello,
I’m trying to set up multiple alerts (sent by email) for servers, and I have an issue with the message that is being sent. I’m getting the message below, and to be honest, it’s completely unclear for other users:

Value: [ var=‘B0’ metric=‘value’ labels={agent.name=.SERWER1, metricId=3} value=0.978 ], [ var=‘B1’ metric=‘value’ labels={agent.name=.SERWER2, metricId=3} value=0.965 ], [ var=‘B2’ metric=‘value’ labels={agent.name=.SERWER3, metricId=3} value=0.9500000000000001 ], [ var=‘B3’ metric=‘value’ labels={agent.name=.SERWER4, metricId=3} value=0.9540000000000001 ], [ var=‘B4’ metric=‘value’ labels={agent.name=.SERWER5, metricId=3} value=0.907 ]
Labels:

  • alertname: RAM USAGE IN TIME
  • grafana_folder: Production

I need to get something like this instead:

The server SERWER1 has exceeded 90% of RAM usage. Current RAM usage used is 98%
The server SERWER2 has exceeded 90% of RAM usage. Current RAM usage used is 97%
The server SERWER3 has exceeded 90% of RAM usage. Current RAM usage used is 95%
The server SERWER4 has exceeded 90% of RAM usage. Current RAM usage used is 96%
The server SERWER4 has exceeded 90% of RAM usage. Current RAM usage used is 91%

I tried to find the solution in other threads, but most of them don’t have complete information about what should be done.
Im using Grafana [v9.2.2] and metricbeat

Hi @Puebloo, we recently updated the documentation and examples for implementing custom notification templates.

1 - You’ll need to template an annotation, for example the summary annotation like in this example:

The server {{ $labels.instance }} has exceeded 90% of RAM usage. 
Current RAM usage used is {{humanizePercentage  $values.A.Value }}

2 - Then, create a custom notification template that display the summary for all the alerts in the notification.

{{ define "print_summary" -}}
{{ range .Alerts -}}
{{.Annotations.summary}}
{{ end -}}
{{ end -}}

3 - Finally, configure the email contact point to use your custom template as detailed in Select a notification template for a contact point.