Conflicting Traffic values between GUI and API

ptouch
Comes here often

Conflicting Traffic values between GUI and API

Hi I'm trying to extract the current bandwidth of a given MS port.

For this I'm using the API call: 
https://api.meraki.com/api/v1/devices/{MSserialNumber}/switch/ports/statuses?timespan=86400 

 

On the UI I get:

ptouch_0-1733222556526.png

 

On the API output I get following JSON for that same port:

        "usageInKb": {
            "total"1028182893,
            "sent"322472038,
            "recv"705710855
        },
        "clientCount"1,
        "powerUsageInWh"0.0,
        "trafficInKbps": {
            "total"97486.9,
            "sent"30575.1,
            "recv"66911.8
        }
    },

 

-> the usageInKb seems to match, but the trafficInKbps doesn't

 

1. What's the timespan (currently 86400) to use to get the most recent trafficInKbps of a given switchport?

2. How comes these values are different between UI and API?

3. Is there a more accurate way to get the current BW used on a given port over API

 

 

7 Replies 7
Oren
Meraki Employee
Meraki Employee

This might be a matter of conversion.
1Mb = 1,024 Kb (not 1,000).
1Gb = 1,024 Mb = 1,048,576 Kb.

Therefore 1,051,718,192 Kb = 1,003 Gb.

 

Does it make sense?

 

ptouch
Comes here often

Hi Oren, indeed the usage corresponds correct, but the Traffic numbers are way off

Oren
Meraki Employee
Meraki Employee

Thanks for the clarification.

Traffic is defined as "A breakdown of the average speed of data that has passed through this port during the timespan."
While Usage is defined as "A breakdown of how many kilobytes have passed through this port during the timespan."

 

Oren_0-1733359000041.png

 

Reference: https://developer.cisco.com/meraki/api-v1/get-device-switch-ports-statuses/

 

ptouch
Comes here often

Hi Oren,

Thanks for pointing out, I kind of missed that. It's somewhat confusing as the dashboard URI timespan is similar as the API but showing different values:
https://n170.meraki.com/Org/n/key/manage/nodes/new_list/number/ports/18?timespan=86400

but understood, I overlooked this in the description.

This means I need to find another way to get the latest speed of that port

Oren
Meraki Employee
Meraki Employee

I probably would have missed it too, unless I was looking for it.

By latest speed, do you mean 100M/1G/10G/etc’?


The getDeviceSwitchPortsStatuses operation will get you that (there’s a new org-wide version coming out later this week).

ptouch
Comes here often

I'm looking for the API call to readout the exact value as you can see on the UI. To read out every 10s to get the actual speed at that moment

ptouch_0-1733388974498.png

 

Oren
Meraki Employee
Meraki Employee

I understand. The real-time traffic value you’re looking for is not currently available via API.

Get notified when there are additional replies to this discussion.