Hi, i am in the process of migrating a dashboard in particular two alert queries which look similar but have different outputs.
SELECT mean(“usage_user”) FROM “cpu” WHERE (“host” =~ /^$Host$/) AND $timeFilter GROUP BY time($__interval), “cpu” fill(null)
2)
SELECT mean(“usage_user”) FROM “cpu” WHERE (“host” =~ /^$Host$/) AND $timeFilter GROUP BY time($__interval) fill(null)
For query 1 I managed to migrate it using the below query:
import “influxdata/influxdb/schema”
windowPeriod = int(v: v.windowPeriod)
myWindow = if windowPeriod < int(v: 100000000) then 1s else v.windowPeriod
from(bucket: “telegraf/one_week_only”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == “cpu”)
|> filter(fn: (r) => r._field == “usage_user”)
|> filter(fn: (r) => r.host =~ /^$Host$/)
|>aggregateWindow(every: myWindow, timeSrc: “_start”, fn: mean)
However the second one i am not sure how to migrate that.