I’ve recently switched over to InfluxDB using Flux QL and for the most part I’ve managed to get some nice looking dashboards in Grafana v10.0.0 (they aren’t too fancy) which is nice but I’m after a couple of tips (if possible). One of the queries I’m running is below.
from(bucket: "influx_bucket")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "Cisco-IOS-XE-interfaces-oper:interfaces/interface")
|> filter(fn: (r) => r["_field"] == "statistics/rx_kbps" or r["_field"] == "statistics/tx_kbps")
|> filter(fn: (r) => r["diffserv_info/diffserv_target_classifier_stats/classifier_entry_name"] != "class-default")
|> filter(fn: (r) => r["source"] == "switch-name")
|> filter(fn: (r) => r["host"] == "telegraf-server")
|> filter(fn: (r) => r["name"] == "switch-interface")
|> map(fn: (r) => ({r with _value: r._value * 1000 }))
|> map(fn: (r) => ({
r with subscription:
if r._field == "statistics/rx_kbps" then "Inbound Traffic"
else if r._field == "statistics/tx_kbps" then "Outbound Traffic"
else "fail"
})
)
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
I would like to be able to do two things:
- Control the legend order (either based on the order of my _fields or by some kind of group mapping table); and
- Be able to create a trend line over some kind of period interval time range period so that I can start doing historic trending of my data. The use case here is that I can look at data over a period of 30days to see the actual metrics and then see a nice trend line of that data over the same time (or maybe there is a much better way to do it).
I looked around but my google-foo wasn’t working