In my Grafana, I retrieve data from InfluxDB. So for example Iretrieve memory value on two computer named WIN0 and LIN1
On my Grafana dashboard, I created a variable called "host" with this query:
import "influxdata/influxdb/schema"
schema.tagValues(
bucket: "COMPUTER",
tag: "host"
)
The request is correct, i can see the both value WIN0 and LIN1
So in my Dashboard I created a Panel, and in this panel I putted the request below
from(bucket: "COMPUTER")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "mem")
|> filter(fn: (r) => r["_field"] == "used_percent")
|> filter(fn: (r) => r["host"] == "$host")
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "mean")
In the panel configuration, I selected the parameters below:
title = $host to display the value of the variable "host" as title
Repeat options
Repeat by variable = i select my variable "host"
repeat direction = Horizontal
max per row = 4
But every time i display only the graph for one computer WIN0 on the entire page of grafana.
What i would like to do is something like that (the 4 graph IE, SE, US, ZA) Grafana example
I have the feeling that the problem is more in my Influx request than Grafana configuration , but i'm lost.
Thanks for your help.
If you need to display more than one host, you need to change the following line in your query:
|> filter(fn: (r) => r["host"] == "$host")
to this one:
|> filter(fn: (r) => r["host"] =~ /^${host:regex}$/ )
This will let to get information on all chosen hosts. Of course, Multi-value and Include all options should be enabled for that:
If you want all hosts to be chosen by default when you open dashboard, choose them and save dashboard with Save current variable values as dashboard default checked: