MySQL Alert message based on variable name

Grafana 8.0, Mac OS

if I am using MySQL as the data source, can I have the alert message specify the variable that is being alerted on?

For example, I have an alert set up with many different queries. Here is an example of one:
SELECT
meta_staged_timestamp AS ‘time’,
data_set as ‘metric’,
tot_rec_cnt
FROM intake_qa_metrics
WHERE
$__timeFilter(meta_staged_timestamp) AND data_set = “9A”
AND $__timeFilter(meta_staged_timestamp)
ORDER BY meta_staged_timestamp,metric

The only thing that changes among the numerous queries is the data_set variable. I tried putting this in the alert Description: ${data_set} but the alert message doesn’t replace data_set with the data set that needs to be alerted on. Is there a way to do this?

Hi @jaclynfink

Are you using the old alerting system, of the NG (next gen) Unified Alerting that shipped with Grafana 8.

Unified is still behind a feature toggle, but it greatly expands support for template variables. You can play with the new platform by changing your config like so:

docker run -p 3000:3000 -e "GF_FEATURE_TOGGLES_ENABLE=ngalert" grafana/grafana:8.1.0-beta3

And here are some more notes about the migration:

Thank you, I enabled this feature and re-sent the alert as a test. In the alert message it still shows as ${data_set}
Do I need to use a different syntax?
@mattabrams

check out this doc @jaclynfink