prometheusgrafanametrics

Decode label value in Grafana panel


I have a Grafana panel that display server states:

Server back-up state

I need to give the servers human recognizable names like: "London", "Paris", "Milan", "Berlin", "Frankfurt" etc. (for example)

The panel definition is very simple:

enter image description here

This is the scrape example:

channel_sign_gauge{id="0001"} 0
channel_sign_gauge{id="0777"} 0
channel_sign_gauge{id="1000"} 1
channel_sign_gauge{id="2000"} 1
channel_sign_gauge{id="3000"} 0
channel_sign_gauge{id="4200"} 1
channel_sign_gauge{id="5200"} 1

I have defined dashboard variable "server_location":

enter image description here

How can I bind a server names variable to their indexes on the panel?


Solution

  • The question was cross-posted on Grafana community forum and receive acceptable solution using Field Overrides section of panel definition:
    enter image description here
    Inside of panel definition this overrides results in this JSON section:

        "overrides": [
          {
            "matcher": { "id": "byName", "options": "0001" },
            "properties": [ { "id": "displayName", "value": "London" } ]
          },
          {
            "matcher": { "id": "byName", "options": "0777" }, 
            "properties": [ { "id": "displayName", "value": "Paris" } ]
          },
    ...
          {
            "matcher": { "id": "byName", "options": "5200" },
            "properties": [ { "id": "displayName", "value": "Riga)" } ]
          }
        ]
    

    Now I will collect all possible and potential server locations and create an overrides for each of them.