Hi, i’m using grafana 9.5 with influxdb2 and telegraf. I’m using snmp in order to get badwidth utilization on a switch. I made the query, but the results are a graph with the Y Axes displaying i think the accumulated data not current data.
I’m using grafana with influxdb2 influx. Does anybody know how to do it?
Welcome
Since we do not have access to what you have please post sampling of data and query you used
I wanna collect a switch bandwidth utilization, using ifInOctets and ifOutOctet. The examples that I saw was using a different version of Grafana.
See the image below, that basically what I need.
I still don’t know how to create a query for this. Anybody to help?
That’s the query that i have.
from(bucket: “telegraf”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“hostname”] == “Netgear_sw”)
|> filter(fn: (r) => r[“_measurement”] == “ifXTable”)
|> filter(fn: (r) => r[“_field”] == “ifHCOutOctets” or r[“_field”] == “ifHCInOctets”)
|> filter(fn: (r) => r[“ifDescr”] == “g5”)
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: “mean”)
How can i convert this to the one on the picture above?
- using mean, non_negative_derivative, math(*8), alias()
i came up with the query below. It’s working as expected. I just don’t know if is the best way to do it. Another thing is how to change the label, i end up configuring grafana with regex in order to change the label manually,since i don’t have much devices it’s ok to do it manually. I used the map function in order to make it work. I hope this help somebody.
from(bucket: “telegraf”)
|> range(start: 2023-06-22T21:25:10.653Z, stop: 2023-06-23T03:25:10.653Z)
|> filter(fn: (r) => r[“hostname”] == “Netgear_sw”)
|> filter(fn: (r) => r[“_measurement”] == “ifXTable”)
|> filter(fn: (r) => r[“_field”] == “ifHCOutOctets” or r[“_field”] == “ifHCInOctets”)
|> filter(fn: (r) => r[“ifDescr”] == “Slot: 0 Port: 5 Gigabit - Level”)
|> map(fn: (r) => ({r with _value: r._value * 8 / 300}))
|> derivative(unit: 1s, nonNegative: true, columns: [“_value”], timeColumn: “_time”)
|> aggregateWindow(every: 5m, fn: mean, createEmpty: false)
|> yield(name: “mean”)