Repeating Panel data links - how to get instance value?

I’m using Grafana to demo a project showing statistics for a number of Assets each having a number of Sensors.

So there’s an Assets variable obtained using a query:
select name from monitored_assets where asset_group_id=(select id from asset_groups where site_id=(select id from sites where name='test') and name='Test Pump')
This allows the user to select a view of all four of their sensors on a selected Asset.

Next there’s a Sensors variable obtained using the query:
select metadata->>'identifier' from assets_sensors where asset_id = (select id from monitored_assets where name='$Assets')

The panel is setup to repeat and the query obtains the data using $Sensors and $Assets perfectly. The Panel title works perfectly too giving the name of each sensor using $Sensors.

So the problem is when a data link is added, I want to pull out the, Time, Assets, and current Sensors value so that I can post it to another board to display more specific info about the statistics. But what ever I try I cannot get the Sensor value for the panel I am clicking on, instead I get the whole list, so the Data link URL:
http://localhost/Asset 1/{Non-driven end bearing,Driven end bearing,Gearbox bearing,Auger bearing}/1573187824000

But… If I use the Panel Links in the General tab with the URL:
http://localhost/${Assets}/${SelectedSensors} the value is resolved properly:
http://localhost/Asset 1/Non-driven end bearing.

I see that this question has been asked two times before: Current value of a repeat variable Getting a single variable from a repeated row without a response.

1 Like

Grafana Documentation is a little ambigous and scattered …
Because I did not find any Information - except Grafana Documentation - I tried it out and want to share with others …

Following Information are related to Grafana v.8.0.3. Dashboards are built for Prometheus Datasource. (Grafana v5 and v6 are working different but more “intuitive”, v7 I never used)

Assume you have a variable “server” which is derivated with “label_values(host)” and a Dashboard (“All Servers”) with repeating Panels (not “Repeating Rows”, but should work also) which e.g. should show CPU usage for each “server” (Query in Panel: cpu_usage_system{host=~"$server",cpu=“cpu-total”}).

You have a second Dashboard (“Host Details”) which shows detailed information for servers, with variable “host” with same definition like “server” in the first panel. (For clearness I took two different variable names, see later).

Now you want to “drill downfrom first Dashboard (“All Servers”, CPU-Panel) to the second Dashboard (“Host Details”), using the “current instance” of variable “server” as parameter for the Drill Down Dashboard.


  1. Copy URL of Dashboard “Host Details” (from Browser)
  2. Dashboard “All Servers”, Panel “CPU”: edit “Panel Link”: Paste copied URL into field “url”:
    (copied URL)?var-host=${server}&${__url_time_range}


var-host=${server}: The important information is: The parameter name “var-host” is concatenated: Prefix “var-” tells Grafana to use the suffix “host” as variable name of the target dashboard, filled with Instance ($server) of the source dashboard.

${__url_time_range}: Grafana Target Dashboard “Host Details” will use the same time range as the Source Dashboard …

I hope I could clear that for all interested people … :upside_down_face:


1 Like