I have 12 servers which are scraped by Prometheus, and their metrics are shown in Grafana.
I can filter servers being shown on the dashboard by selecting desired servers in a dropdown for a variable var
Ex: var="server1,server2";
. Variable can contain one or multiple servers being selected.
I am trying to make a link with current variable values being passed as parameters.
There is a link to a more detailed dashboard (for matters of this question should it be link.to.gui/overview
).
Current situation is when you click onto this link, it shows you all servers without the filter, and you have to re-select desired servers again.
I would like to edit this link, so that it passes selected variables from the current dashboard to the detailed one.
I tried this way: link.to.gui/overview?var=$var
, but got link like this: link.to.gui/overview?var={server1,server2}
It needs to be: link.to.gui/overview?var=server1&var=server2
All I can edit is the link itself, so i need a way to reformat the "$var" inside the link.
How can it be done?
Grafana supports Advanced variable format options, and specifically query parameters format.
So in your example link will be link.to.gui/overview?${var:queryparam}
. It will automatically convert variable into format supported by Grafana's dashboards.
Notice: contrary to your description, dashboards are expecting query parameters to be in format: var-name_of_variable=first_value&var-name_of_variable=second_value
(at least in the current 9th version of Grafana).