Is there a way to get interface speed in bytes?

I know you can use monitor and filter for rate to get something like “10Gbps”, but is there something like

“/interface ethernet get rate” that will return it in bytes? For example “10000000000”. Reason is so we can do math on it in our scripts for changing cost, on interfaces, etc.

Why not just have a pair of lists like {“1Gbps”;“2.5Gbps”;“10Gbps”} and {1000;2500;10000} and then :find in one and index the other…

EDIT: Oh, you meant bytes :slight_smile:

Just one example

/interface ethernet
:global arrRates   [:toarray "10Mbps,100Mbps,1Gbps,2.5Gbps,5Gbps,10Gbps,25Gbps,40Gbps,50Gbps,100Gbps"]
:global arrMSpeeds [:toarray "    10,    100, 1000,   2500, 5000, 10000, 25000, 40000, 50000, 100000"]
:foreach item in=[find] do={
    :if ([get $item running]) do={
        :local read  [monitor $item once as-value]
        :local srate ($read->"rate")
        :local Brate (($arrMSpeeds->[:find $arrRates $srate -1]) * 1000000 / 8)
        :put "$($read->"name") rate is $srate ($Brate Bps)"
    } else={
        :put "$[get $item name] is not running"
    }
}
1 Like

Oh my gosh drift boss… thanks for pointing that out!

1 Like

@TrevinLC1997 But did you read my answer?

I did and I actually added it in my script. Got side tracked that day and completely forgot to reply. Thank you!