Using labels or tags with grafana alerting

How can i use labels or tags from my querys/alerts into the alerting system of Grafana.

For example im trying to pass the host to the alert.
Query is:
namedprocess_namegroup_num_procs{groupname=“dbloader”,env=“production”}

It holds fields like:
Time, name, ddis, env, groupname, host, instance, job, srvrole

Time and name are standard fields like also instance. But the other ones we assign during scraping.

If i use the host label/tag in an alert i get in the mail like:
summary: The host has a problem with the DBLoader service

While in the alert i state to take the host field:
The host {{ $labels.host }} has a problem with the DBLoader service

Who can help me in the right direction to get this working?

1 Like