Hi David,

If you are using a template variable (they appear at the top of the dashboard or you can check ‘variables’ section at dashboard settings), it’s not possible to add an alert.

You can workaround this by replacing variables with actual values in your queries. When you remove the variable, Alerts section will become functional again.

For example we use the query below to see the pod count of a service.

sum(kube_deployment_status_replicas_available{deployment=~”${deployment_name}”}) by(deployment)

As you can see deployment_name is a template variable. Let’s say our deployment name is my_deployment. If we replace the variable, we can add alerts again.

sum(kube_deployment_status_replicas_available{deployment=~”my_deployment”}) by(deployment)

It’s a quick fix but not always practical or possible. I hope Grafana makes using template variables in alerts possible in the future releases.

Have a great day :)

No responses yet