grafanagraphite

Grafana dashboard custom variable as a json object


We are using grafana to visualize our metrics and very glad to use it.

For one dashboard I need to create custom variable to show host name. For example, we have the first variable: host with query collectd.localhost.ping.ping-* and regexp /ping-(.*)/. It returns a list of hosts that we ping. Now I want to add showing title depends on selected host. I think need to add another custom variable title like map host1:Title1;host2:Title2 and in the panel's title write something like Proxy ${title:json}.${host} in result get Proxy TitleN.

How to do it? We use 7.2.1 grafana version. Thank you!


Solution

  • I'm not sure if this is a great answer, but given it's been nearly two years without any answer, I'll proffer it. Having just commented how I was surprised no one had in fact answered, I kept poking around. Eventually I found that if added a variable interactively, and then I clicked dashboard settings followed by JSON Model I got to a description that included new data in the templating field. I pasted that into my original JSON description of the dashboard, and restarted Grafana --- the change persisted.