- What Grafana version and what operating system are you using?
Docker / grafana version 10.0.2 + InfluxDB v2.7.1
- What are you trying to achieve?
Using Flux’s variables to perform multiple aggregations and Grafana’s variables for the dashboard. I would like to get the two series with just one query, because currently I have to execute one query to get the output and a second query to get the input.
- How are you trying to achieve it?
dataRetuned = from(bucket: "${BUCKET}")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "ifXTable")
|> filter(fn: (r) => r["sysName"] == "${DEVICE}")
|> filter(fn: (r) => r["ifName"] == "${DEVICE}")
|> fill(usePrevious: true)
output = dataReturned
|> filter(fn: (r) => r["_field"] == "output")
|> map(fn: (r) => ({r with _value: float(v: r._value) * 8.0}))
|> derivative(unit: 1s, nonNegative: true)
|> yield(name: "output")
input = dataReturned
|> filter(fn: (r) => r["_field"] == "input")
|> map(fn: (r) => ({r with _value: float(v: r._value) * 8.0}))
|> derivative(unit: 1s, nonNegative: true)
|> yield(name: "input")
- What happened?
No Data returned.
If I manually enter values instead of the dashboard variables, I get the answers
For example:
dataReturned = from(bucket: "Metrics")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "ifXTable")
|> filter(fn: (r) => r["sysName"] == "sw-core")
|> filter(fn: (r) => r["ifName"] == "gi1")
|> fill(usePrevious: true)
output = dataReturned
|> filter(fn: (r) => r["_field"] == "output")
|> map(fn: (r) => ({r with _value: float(v: r._value) * 8.0}))
|> derivative(unit: 1s, nonNegative: true)
|> yield(name: "output")
input = dataReturned
|> filter(fn: (r) => r["_field"] == "input")
|> map(fn: (r) => ({r with _value: float(v: r._value) * 8.0}))
|> derivative(unit: 1s, nonNegative: true)
|> yield(name: "input")
Thanks in advance for any helps,
Andrea