multiple values from grafana variable in prometheus query
12,064
Grafana generates a regex for you when you use the variable in queries.
I assume you have a variable $host
defined by collecting the label values.
Ex:
label_values(node_load1, instance)
Then simply use the request:
node_load1{instance=~"$host"}
Related videos on Youtube
Author by
Anil Kumar
Updated on June 04, 2022Comments
-
Anil Kumar almost 2 years
We have a situation where we need to select the multiple values (instances/servers) from grafana variable field, and multiple values needs to passed to the Prometheus query using some regex, so that i can see selected hosts metrics in single graph. but i am not able to make it work. Can someone please help me with this.
lets take an example , if i select multiples values host1,host2,host3 and then the query should be looks something like this node_load1(instance="host1", instance="host2" , instance="host3").
Hope i made it clear my question.
Thanks in well advance.