Value variable in alert message

tried them in the alert message filed can not the current value.
Total rentals: {${labels.Value}}.
Total rentals: {${labels.value}}.
Total rentals: {{.Value}}.
Total rentals: {{.value}}.
Total rentals: {${Value}}.
Total rentals: {${value}}.
Total rentals: {{value}}.
Total rentals: {{ $value }}.

is there a way to get the value in the alert message?

Grafana v8.2.5

it’s look like you are using the legacy alerting platform and not Unified Alerting. Is that correct @sonysadi?

handlebar templating like this should work with a multi-dimensional rule in Unified Alerting.

Yes, I am using the legacy alerting platform and not Unified Alerting.
And the Doc is not helpful about messaging templete

Legacy alerts templating is here - Alert notification templating | Grafana Labs

Thanks for the reply, I saw that old doc already,
But it does not tell how to print the gauge “value” of metrics in the notification template

Hello @sonysadi , did you find any solution on legacy alerting to get the value in alert message ? :slight_smile:

Try something like this to parse value with regexp:

{{ define "templatename" }}{{ range .Alerts }}{{ .Labels.alertname }}: {{ .Status }}
{{ reReplaceAll ".*value=([^ ]*).*" "$1" .ValueString }}
{{ .ValueString }}{{ end }}{{ end }}

Improved the regex a bit to support ValueString with more than one occurrence of value=.

{{ reReplaceAll "[[][^]]*metric='{?([^}']*)}?'[^]]*value=([0-9]*([.][0-9]{1,3})?)[^]]*](, )?" "$1: $2\n" .ValueString }}

Full template example (uses HTML tags, works file with Telegram, unsure about Slack, email, and so on)

{{ define "tgshortbody" }}{{ range . }} <b>{{ or .Annotations.message .Labels.alertname }}</b>
{{ range .Annotations.SortedPairs }}{{ if ne .Name "message" }}{{ .Name }}: {{ .Value }}
{{ end }}{{ end }}
{{ with .ValueString }}{{ reReplaceAll "[[][^]]*metric='{?([^}']*)}?'[^]]*value=([0-9]*([.][0-9]{,3})?)[^]]*](, )?" "$1: <b>$2</b>\n" . }}
{{ end }}{{ with .PanelURL }}<a href="{{ . }}">Chart</a> {{ end }}{{ with .DashboardURL }}@<a href="{{ . }}">Dashboard</a> {{ end }}{{ with .GeneratorURL }} <a href="{{ . }}">Edit</a> {{ end }}{{ with .SilenceURL }} <a href="{{ . }}">Mute</a> {{ end }}
{{ end }}{{ end }}
{{ define "tgshort" }}{{ with .Alerts.Firing }}⚠️{{ template "tgshortbody" . }}{{ end }}{{ with .Alerts.Resolved }}✅{{ template "tgshortbody" . }}{{ end }}{{ end }}

Telegram notification sample:
image

is there any regex for parse value with regexp for StartsAt to specify start time of firing, default one is very long