- What Grafana version and what operating system are you using?
– Grafana V 11.2.0 on Windows Server
I have a dashboard that uses a repeat panel tied to a dashboard variable to select which machines we want to pull data from. Each machine is in a separate table due to how the data collector stores its results. Table names are in a format of “area_1_machine_101”, where the 1 and 101 can be replaced by other values.
The dashboard variable (machineList) is a custom, multi-value variable with the “custom options” values having the key being the machine number, and the value being the name of the table.
Using repeated panels works great with the query:
SELECT `time@timestamp` AS "time",
data_format_0 AS ${machineList}
FROM production.${machineList:csv}
WHERE `time@timestamp` > ($__from / 1000) AND `time@timestamp` <= ($__to / 1000)
This produces a table of values that I transform using a “MEAN” function to get an average of data_format_0, which is uptime for the machine. Yay.
What I need now is to create a table that has a row for each machine that is selected in the dashboard variable. First column will be the machine number (I can get that from the dashboard variable key) and second column is the averaged uptime.
I can do this by having multiple queries in the table panel if I hard code the machine name and table name into the query.
How do I dynamically run queries for only the selected values in the dashboard variable? I think I can do the data transforms once I get that far.
If there is any other information I need to provide, I will happily do so.