Another interesting use case I want to capture in this thread. What to do about metric names that have a dot in the label name!
The template variables for values are now described here: How to template annotations and labels | Grafana documentation
If you have a label like netflow.ipv4_dst_addr
with a value of 192.168.1.1
, you might find that your alert template just shows the raw template (which is what happens if there’s an error in the evaluation).
If you’re using a classic condition, here’s an example of using the go index function:
{{ index $values.B0.Labels “netflow.ipv4_dst_addr” }}
if your alert has two or more conditions or an expression, then you can use the $labels variable:
{{ index $labels “netflow.ipv4_dst_addr” }}