Hello @ThePeltonian,
I’m a little confused by your question.
The schema.tagValues() function returns a list of tag values from a certain bucket.
If you want to query your data and filter for a specific hostname you can simply:
Sorry for the late reply, I have setup a variable of servers within Grafana called Host
Server1, Server2, Server3
This also contains an option for “All”
As Flux cant seem to handle the comma separated value as it stands I am using the /${Host:pipe}/
Hello @ThePeltonian ,
Yes to filter for multiple hosts you would have to: |> filter( fn: (r) => r.host == "servername1" and r.host == "servername2 and ...)
If you want to search for all of your hosts simply emit that filter.
Hello, thanks for coming back,
Its a shame about that as will have to put the list in every panel query, that could be up to 100 servers.
I was rather hoping I could just use a variable list, when running the above query within Grafana it does pull the data back from InfluxDB - but any alerting fires due to the error received.
@ThePeltonian The problem here is that Flux is trying to parse ${Host:pipe} as a regular expression literal. You can’t use string interpolation inside of an regular expression.
To get around this, define a variable outside of your filter() function that interpolates the Host:pipe variable as a string, then converts it to a regexp type using the regexp.compile() function.