I want to execute the single metrics query for multiple variable values


I have created a dropdown list vaiable/lable of hosts.

if i goinng to select one host from dropdown list… the matrics qurey will execute fine and proper graph
will display on screen.

but suppose i want to see same information for multiple select hosts from graph
then graph is not showing any data.
can you please help me how to executes same matrics query for multiple hosts.

your query needs to support a multi valued variable, for example you might need to use regex operator.

What datasource do you use? What does you query look like? Grafana will render a multi valued data source using regex, lucene or glob expression depending on what data source you use and how it handles multiple value condition.

Thanks for your quick response :slight_smile:

I am using influxdb datasource with Grafana. When I use a multi-value template variable for my queries, say A and B, I expect to get two separate graphs plotted in single graph, however i am getting two separate graph one for A and one for B . The image below illustrates what I can see.

I am using below metrics query.

and i have created below template variable for host

remove the repeat option, then you will get two lines in a single graph

Thanks Torkel, I tired what you suggested.
But now i am getting no data points

ok, then you need to investigate the query and influxdb response. Your query returns no data point. Nothing Grafana can do if your query returns no data points. Check Query Inspector in metrics tab.

Hi @sangramc, did you solve your issue?

How can I use the template variable in the middle of the field name?
For example, lets say I want to repeat the query for myvariable (which has the values U1,U2). The corresponding field names should be something like:
X1_U1_Speed and X1_U2_Speed

how to concatenate this and use the multiple values option?
X1_($myvariable)_Speed (just to illustrate)

Thanks in advance

Solved it with the sintax: /^X1_[[myvariable]]_Speed$/

Hi ,I have a similar scenario where i am connecting to restapi to fetch the data to grfana.

I am using dynamic variables in the query and when i select multiple values’s for the variable,the query is failing unable to fetch the data
I have tried enabling panel repetetion,then it it is working showing different panels for each value of the variable substituted in the url.
But i am trying to get the data in a single panel which i am not able to figure out how to fix
Any help would be appreciated.

1 Like

same here I want to create multiples queries on same pannel