Search code examples
prometheusgrafana

Change label display name in grafana


I have a custom variable I am using as a filter for my dashboard. I use this as a parameter to my queries in order to incdicate healthy or unhealthy status:

enter image description here

azure_metric_loadbalancer_heartbeat{subscriptionID=~"$sub"}$status

However, I would like to change the display name of the numbers to the words "unhealthy", "healthy", "all" so it is easier to understand for non technical users while maintaining its functionality on the query.

enter image description here

I was thinking of using another Custom variable with the display name Healthy, Unhealthy, all and map out the value of status from that

Something like this

health = "Healthy|Unhealthy|All" enter image description here

If $health="Healthy" then $status=">0"

If $health="Unhealthy" then $status="<1"

If $health="All" then $status="<2"

Is it possible to do this?


Solution

  • You can do it by putting values of your variable in format label : value.

    In your exact case it would be healthy : >0, unhealthy : <1, all : <2

    enter image description here

    Online demo of similar variable can be seen here.