Hi,
I’m trying to get a panel to repeat for every value of a variable but I don’t want the user to be able to have control over this variable (i.e. it should be hidden).
Is there any way to achieve this?
Thanks.
Hi,
I’m trying to get a panel to repeat for every value of a variable but I don’t want the user to be able to have control over this variable (i.e. it should be hidden).
Is there any way to achieve this?
Thanks.
Hi,
Yes, you can select Hide=Variable, see screenshot below:
You can play with this here.
Good luck
Marcus
Thanks for the answer. Unfortunately, it doesn’t answer my question.
I know that I can set a variable to hidden. The question is how I can then use this hidden variable to repeat a row or panel.
Hi,
Understood. So you can use a template variable to repeat either a row or a panel. If you look at http://play.grafana.org/dashboard/db/graphite-templated-nested?orgId=1&panelId=3&fullscreen&edit&tab=general you can see that the server template variable have been set to repeat panels.
You can repeat by panels:
And you can repeat by rows:
See templating documentation for more information.
Hope this makes it more clear
Marcus
I’m sorry, maybe I phrased my initial question confusingly.
Let me try again in the most straightforward manner possible:
I want to repeat a panel or row by all values of a hidden variable.
Is that possible?
Thanks
No worries.
Yes you can.
So in my example above I used a template variable of type Query. For that type you use a query against a datasource and returns a list of values that you can use to repeat a panel or row while having the template variable hidden.
In below example I’m using a template variable of type Custom where I’ve defined three values backend_01, backend_02 and backend_03 and set it to hidden and repeating the panels below so that a I get one panel each for backend_01, backend_02 and backend_03.
Marcus
Hm this doesn’t work for me.
The variable only ever holds the first value. If I set it to visible and check all values repetition of course works as expected.
Probably important detail I forgot to mention: I’m using prometheus as datasource
Here is the configuration I’m using:
Template:
Panel “General” tab:
Hi,
I’ve verified that your above configuration works, at least on the latest version of Grafana.
Make sure to save your dashboard and then reload the browser to make sure that your settings have been updated in UI. I didn’t need to do this though, but I verified that it still works after I saved it, navigate to home and then back to dashboard.
Please see my configuration screenshots below using Prometheus as datasource:
Template variable setting:
(First, variable are not hidden so that I can select the values I’m interested in, see Selecting two values out of 3: below)
Singlestat panel settings:
Selecting two values out of 3:
Then I hide the variable according to Template variable setting screenshot above.
And final result:
I think my configuration are exactly like yours. What version of Grafana are you using?
Marcus
Ok! Now we’re getting to the root of this!
I’m hoping for a solution that doesn’t require manual selection of the target hosts. In our environment hosts are added semi-frequently and I’d like the dashboards to automatically adapt by showing all hosts that match the template variable query.
Hi,
Okay. So if you want to repeat for all values/hosts (even if hosts come and go) you want to select Include All option when configuring your template variable. Then you just need to make sure that the manual selection of All are set and you would never need to update that again.
Marcus
Hi,
Is it possible in templating put a checkbox when I select “Include All option” to check All for default ?
Then I dont need to manual select.
Juliano
Hi,
I found a solution for this, with help of my friends of “Grafana Brasil” group in telegram:
Juliano
This just helped me as well… thank you. Seems like an odd functionality.
Hi , i have similar task to do but using Influxdb…
I have created custom variables as query is not working for me, now whole issue is, if i select more than one from drop down it displays as “no data”