Skip to content

Dashboard Variables

Video Lecture

Dashboard Variables Dashboard Variables


In the next few lessons, we will look at how to create and use dashboard variables.

We will create the variables using the Data sources set up in all the previous lessons.

Example Variables

Name Type DataSource Value/Query
interval Interval 1m,10m,30m,1h,6h,12h,1d,7d,14d,30d
custom Custom abc, def, ghi, jkl
dataSource Datasource Elasticsearch
userName Query MySQL SELECT username AS metric FROM exampledb.simple_table ORDER BY id
name Query Loki label_names()
host Query Loki label_values(host)
job Query Loki label_values(job)
promNames Query Prometheus label_names()
promJob Query Prometheus label_values(job)
promHost Query Prometheus label_values(node_uname_info{job="$promJob"}, nodename)
source Query InfluxDB from(bucket: "telegraf")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "snmp")
|> group(columns: ["_field"])
|> distinct(column: "source")
interface Query InfluxDB from(bucket: "telegraf")
|> range(start: -1m)
|> filter(fn: (r) => r["_measurement"] == "interface")
|> filter(fn: (r) => r["source"] == "${source}")
|> group(columns: ["_field"])
|> distinct(column: "ifDescr")
zabbixHost Query Zabbix Query Type Host, Group /.*/, Host /.*/
unit Query Elasticsearch-Metricbeat {"find": "terms", "field": "systemd.unit"}