Show results of a query in a notification

Hello,

I have an alert include a Panel with threshold on RAM usage, I want to create a notification sends sends the RAM value when gets triggered + RAM_Usage_Per_Process from another Query I have

image

Hi @mashqar51,

if I understood correctly you want to display in the notification the RAM value and RAM_Usage_Per_Process.

1 - You need to set up both queries in the alert rule.
2 - Then, create an annotation or two distinct annotations to display the query values using the template language. See Template annotation docs.

For instance, a RAM_USAGE annotation like:

{{ $values.TOTAL_RAM_usage.Value }}

3 - The default notification displays all annotations.

Optionally, you can implement a notification template to customize the notification message and format. For more info, refer to Template notification docs.

{{ define "custom.alerts" -}}
{{ range .Alerts -}}
Status: {{ .Status }}
Total RAM usage: {{.Annotations.RAM_USAGE}}
{{ end -}}
{{ end -}}