my project is retrieve data from power meter and show on dashboard grafana ,i want to customize my message format but value that i want to retrive is not show in preview in notification template value that i want i metadata
this is my template
{{ define "test" }}
{{- if eq .Status "firing" -}}
{{- range .Alerts -}}
{{- $name := .Labels.alertname -}}
{{- $value := .Annotations.__value_string__ -}}
{{- if eq $name "Electricity-Cost" -}}
Alertname: {{ .Labels.alertname }}
Cost : {{ .Labels.cost }}
Value : {{ $value }}
{{- end -}}
{{- end -}}
{{- else -}}
There are no alerts
{{- end -}}
{{ end }}
this is payload
{
"status": "firing",
"annotations": {
"__dashboardUid__": "admg1lokxou80d",
"__orgId__": "1",
"__panelId__": "15",
"__value_string__": "[ var='C0' metric='Electricity-Cost' labels={} value=2.10375654e+06 ]",
"__values__": "{"C0":2103756.54}"
},
"labels": {
"__alert_rule_uid__": "ednq67wwieqkga",
"__grafana_autogenerated__": "true",
"__grafana_receiver__": "grafana-alert-telegram",
"alertname": "Electricity-Cost",
"cost": "costover",
"grafana_folder": "energy"
}
i need to show value in message if value of electricity cost is great than condition it’s will alert
New contributor
14.Vatthana ounnalath is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.