使用Grafana和InfluxDB数据库,使用以下查询构建一个面板:
SELECT "ZoomRendered01" FROM "exec" WHERE ("host" =~ /^$host$/) AND $timeFilter GROUP BY time($__interval) fill(null)
我应该对这些字段重复相同的查询:
ZoomRendered02
:
SELECT "ZoomRendered02" FROM "exec" WHERE ("host" =~ /^$host$/) AND $timeFilter GROUP BY time($__interval) fill(null)
ZoomRendered03
SELECT "ZoomRendered03" FROM "exec" WHERE ("host" =~ /^$host$/) AND $timeFilter GROUP BY time($__interval) fill(null)
ZoomRendered04
SELECT "ZoomRendered04" FROM "exec" WHERE ("host" =~ /^$host$/) AND $timeFilter GROUP BY time($__interval) fill(null)
...
ZoomRendered20
是否可以要求Grafana在同一面板上为所有这些字段自动重复这些查询?
编辑:增加精度:重复的查询应显示在同一面板上。
答案 0 :(得分:0)
一种可能的方法是使用Grafana模板:
fieldName
: ZoomRendered01 , ZoomRendered02 , ZoomRendered03 ,... multi-value
选项SELECT "$fieldName" FROM "exec" WHERE ("host" =~ /^$host$/) AND $timeFilter GROUP BY time($__interval) fill(null)
Repeating
部分中的$ fieldName的所有值打开General
。这些步骤应在仪表板上生成多个面板(每个$ fieldName值一个)。
答案 1 :(得分:0)
influxdb接受查询中字段名称匹配的正则表达式:
SELECT /^ZoomRendered(0[1-9]|1[0-9]|20)$/ FROM "exec" WHERE ("host" =~ /^$host$/) AND $timeFilter GROUP BY time($__interval) fill(null)
或者,如果您只想从“ exec”中获取所有字段,则可以使用:
SELECT * FROM "exec" WHERE ("host" =~ /^$host$/) AND $timeFilter GROUP BY time($__interval) fill(null)