I apologise if I’m not using the correct terminology, but I’ve tried searching and not finding anything relating to the Flux language that might help point the right way.
I have SNMP data coming from some network switches, this has a number of fields such as ifName, ifHCInOctets, ifHCOutOctets, and ifConnectorPresent.
I can happily graph ifHCInOctets and ifHCInOctets using a query like so:
from(bucket: "mikrotik") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["_measurement"] == "snmp") |> filter(fn: (r) => r["_field"] == "ifHCInOctets" or r["_field"] == "ifHCOutOctets") |> filter(fn: (r) => r["hostname"] == "desk-sw1") |> derivative(unit: 1s, nonNegative: true) |> yield(name: "nonnegative derivative")
What I am trying to do, however, is exclude data when the value of ifConnectorPresent is 0. At a minimum just for that measurement, but ideally just totally exclude the whole series if the value is 0 for the entire range I’m looking at.
If it were SQL it would be something along the lines of:
SELECT time, ifName, ifHCInOctets, ifHCOutOctets FROM mikrotik WHERE ifConnectorPresent==1
SELECT time, ifName, ifHCInOctets, ifHCOutOctets FROM mikrotik m join (select distinct ifName from mikrotik where ifConnectorPresent = 1) up on m.ifName = up.ifName