Network client bandwidth usage via API

umbertocalo
Comes here often

Network client bandwidth usage via API

Hi everyone

I've been trying to get each network's last day bandwidth usage with getNetworkClientsBandwidthUsageHistory(NetworkId) and it returns a list of dict where every element represents a capture of a 20 minutes slot (73 elements for a 24h timespan) and if i want to get the total of upstream, downstream and total i need to sum each key of the 73 dicts to get a unique one with the 24h sum

 

Example: 

[
    {
        "ts": "2024-10-21T15:40:00.000Z",
        "total": 13.733489583333334,
        "upstream": 3.972428385416667,
        "downstream": 9.761061197916666
    },
    {
        "ts": "2024-10-21T16:00:00.000Z",
        "total": 11.941809895833334,
        "upstream": 3.28517578125,
        "downstream": 8.656634114583333
    },
    {
        [...]
    },
]

 

I've also tried using getOrganizationSummaryTopNetworksByStatus(OrganizationId) that runs at an organization level and that also gives me other information i need for other functions beside the last 7 days bandiwth

 

Example from DevNet:

[
    {
        "networkId": "N_24329156",
        "name": "Main Office",
        "url": "https://n1.meraki.com//n//manage/nodes/list",
        "tags": [ "tag1", "tag2" ],
        "clients": {
            "counts": { "total": 72 },
            "usage": {
                "upstream": 3732658.44,
                "downstream": 983732658.87
            }
        },
        "statuses": {
            "overall": "online",
            "byProductType": [
                {
                    "productType": "wireless",
                    "counts": {
                        "online": 2,
                        "offline": 1,
                        "alerting": 0,
                        "dormant": 3
                    }
                }
            ]
        },
        "devices": {
            "byProductType": [
                {
                    "productType": "wireless",
                    "url": "https://n1.meraki.com//n//manage/nodes/new_list/000000000000"
                }
            ]
        },
        "productTypes": [
            "appliance",
            "switch",
            "wireless"
        ]
    }

 

The fact is that i need to run these calls for more than three thousands networks and it takes too much time to process, expecially the one that runs at an Organization level

 

Do you know any other API I can use to get each network's banwidth usage?

7 Replies 7
sungod
Kind of a big deal

It depends on what you mean by 'network', and where you want to measure usage.

 

If, for instance, each 'network' has an MX or Z with one or more WAN connections, and you want the send/receive usage on those WAN connections, then you can use...

 

https://developer.cisco.com/meraki/api-v1/get-organization-appliance-uplinks-usage-by-network/

 

umbertocalo
Comes here often

Hi sungod, thanks

 

I've just tried using this API since i have at least 1x MX in every network but i receive a timeout error;

I found this post in the community where it's suggested to use the node/shard FQDN of the client but nothing seems to change.

 

Meraki API timeout after 120 seconds - The Meraki Community

I've also tried using the same API on another client's Org but that client had also two thousand networks and it returned the timeout error too..

sungod
Kind of a big deal

Hmm, that's quite an old issue in the post you linked, I'm surprised it's not fixed yet.

 

I suggest open a support case - if it is still not fixed, perhaps they can advise a better workaround.

 

John_on_API
Meraki Employee
Meraki Employee

You could alternatively calculate the total usage by multiplying the "average" usage with the "counts" value from this operation: https://developer.cisco.com/meraki/api-v1/get-network-clients-overview/

 

x = counts.total = total number of clients

y = usages.average = average usage per client

 

x * y = total client usage

umbertocalo
Comes here often

HI, thanks for your reply

It's actually a good idea but the numbers don't add up:

I'm collecting an 11.62Mbps usage via getNetworkClientsBandwidthUsageHistory
But if i multiply getNetworkClientsOverview clients and average i obtain different values (13*96734)

 

umbertocalo_0-1729850097607.png

We also noticed that within the dashboard itself bandwidth's usage is different based on where you look for it

umbertocalo_0-1729872915371.png

 

 

John_on_API
Meraki Employee
Meraki Employee

I'm not sure how closely those numbers should align, because I'm not familiar with the methods that produce the data. But it is something that you can review with Support, if you're interested.

 

If you're comparing API with GUI, then you'll need to make sure that you're using the same timespan controls on the API as on the GUI, and it's possible that you'll need to map timezones if you want them to line up (API uses UTC, org-wide data in GUI typically uses UTC, network-specific data in GUI often uses the network's configured timezone).

Jamieinbox
Building a reputation

Just dropping this here, I have a client where we connected SolarWinds to Meraki, and that's a report right out of box. It's kind of neat-o Meraki and SolarWinds work together with an API.

Get notified when there are additional replies to this discussion.