How do I create a Query to measure Bandwidth percentage of an Interface that's using SNMP and InfluxDB 2.7 (Flux)?

Hello, I’m new to InfluxDB, I was trying to follow a guide online, but I got stuck on editing the script for the query.

It seems that I am using Version 2.7 so when it came to this part of the guide, I wasn’t sure how to implement it in the Query editor. I already have the SNMP, and data coming in, but this query here is different than I am using in InfluxDB 2.7


The code below is what I have gotten so far in the query in InfluxDB, and I get some measurements, but the guide above says to use some sort of math function that multiplies the values by 8, and then group it by a certain time. This is where I’m stuck now, I have commented out the map function that has the math part in it as I don’t think I’m doing that right, and also I need to figure out how much percentage of the 1GB speed is being used on this port.

Am I on the right track? Is there a particular setting or graph that I should be using?

import “contrib/jsternberg/influxdb”
import “math”
import “sampledata”

from(bucket: “Intelgraf”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“agent_host”] == “A.B.C.D”)
|> filter(fn: (r) => r[“ifDesc”] == “TwoGigabitEthernet1/0/1” and r[“_field”] == “ifHCOutOctets”)
|> derivative(nonNegative: true)
//|> map(fn: (r) => ({ r with newColumn: ( r._value ) * 8)})
|> aggregateWindow(every: 1s, fn: last)