would anyone know how would this be in Flux ?
SELECT mean(“usage_idle”) *-1 +100 FROM “cpu” WHERE (“host” =~ /^$hostname$/) AND $timeFilter GROUP BY time($__interval) fill(null)
would anyone know how would this be in Flux ?
SELECT mean(“usage_idle”) *-1 +100 FROM “cpu” WHERE (“host” =~ /^$hostname$/) AND $timeFilter GROUP BY time($__interval) fill(null)
Maybe something like this? Very difficult to get everything right without some test data.
from(bucket: "your_bucket")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "cpu")
|> filter(fn: (r) => r["_field"] == "usage_idle")
|> filter(fn: (r) => r["host"] =~ /^${host:regex}$/ )
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> map(fn: (r) => ({ r with newColumn: r._value * -1.0 + 100.0 }))
|> yield(name: "your_query")
Thank you, I will try it! And confirm
Luis