Hi,
Using Grafana 8.3.3 (Ubuntu 20.0.4)
I am trying to create an alert message template based on Postgresql time series data using the new Grafana alert manager.
The alerts are firing okay and emails are being sent using the default template, but I would like to create a custom message template to make the data more presentable. I am yet to find a sample message template that uses data from a relational database (all the sample templates I have seen use Prometheus-like data structures).
My query for alerts:
select time, store_name as metric, data as value
from sensors
where time >= now() - Interval ‘1 hour’
The default message template sends the alert email in this format:
Value: [ metric=‘Store1’ labels={} value=0.4138 ], [ metric=‘Store2’ labels={} value=0.6061 ], [ metric=‘Store3’ labels={} value=0.6098 ]
Labels:
alertname: Sensor Level
But I would like to the alert email to show this:
Store1 0.4138
Store2 0.6061
Store3 0.6098
I have read through the Grafana alert message template documentation, but unable to figure out how to use data from Postgresql to create a custom message template.
Any assistance greatly appreciated. Thanks!