Variable time filters


Im trying to create a dropdown of all servers available however the list is too big since the timeFilter is missing. I figured out that in 5.3+ it is possible to use queries in templating so i bumped Grafana to 5.4.x

What im trying now to test is this query (using Telegraf to push data to influx)
SELECT mean(“load1”) FROM “system” WHERE $timeFilter

However it shows me below error when i do:

Template variables could not be initialized: error parsing query: missing parameter: timeFilter

What is the right way to get a list of all hostnames there which i can then use in my dashboards?

Thanks in advance

you have a aggregation function mean in your query, that requires a group by clause. You should select a tag value in your query. like SELECT “host”::tag from “system”

Hmm strange since it is not returning any results:

This does:
SELECT mean(“load1”) AS “mean_load1” FROM “telegraf”.“autogen”.“system” WHERE time > now() - 1h AND “host”=‘dev’ GROUP BY time(:interval:) FILL(null)

This doesnt:
SELECT “host”::tag from “telegraf".“autogen”."system”

@torkel any idea on above? Since what you mention should be a solid answer overall but somehow it is not picking it up. I tried it with Kapacitor directly on the DB