I want to get the number of clients per day for more than half a year

Shichigahama
New here

I want to get the number of clients per day for more than half a year

I get Clients per day from the browser summary report (about half a year). 
I want to do the same thing with the API,
but getNetworkTraffic seems to only get 30 days.
What I want is the number of daily clients for any period of time.
2 Replies 2
sungod
Kind of a big deal

I believe maximum look-back for client info is 31 days, afaik there's no way in the API to go back further.

 

To get daily client counts and usage with the API I use https://developer.cisco.com/meraki/api-v1/#!get-network-clients

 

Example usage (I'm using aio as it's a lot faster when there are multiple networks, this would be called from a higher level function that runs the call on all network IDs 'at once')...

# get list of devices on network for the last 24 hours
# alternative to timespan is use t0 to specify a consistent start time

t = 24 * 60 * 60
clients = await aiomeraki.networks.getNetworkClients(net_id, timespan=t, perPage=1000, total_pages="all")

 

This call only allows start time/timespan of collection to be specified, we run every day at the same time UTC with start time a day ago to get 24 hours of data, then store and consolidate these to build long-term data.

 

Because of runtime timing variations etc., it's not perfect, there could be slight gaps/overlap between adjacent days, but at least in our application it is not significant.

 

You could use the full 31 day look back and run monthly to reduce any overlap effects, but with hundreds of networks and tens of thousands of clients I prefer to do it daily to spread the load out, it minimises overall impact if the run fails due to some issue with our systems/WAN/API server.

Shichigahama
New here

Thank you for answering.


And I regret that I can't rollback more than 31 days.

 

I have 4 networks and I don't get more than 100 clients per day, so I'll try to find a way to get them regularly.


Now, I was able to get all the network ids, so I decided to download an Excel format manually by generating the URL for the Summary page "https://n232.meraki.com/network id........."

 

import meraki

dashboard = meraki.DashboardAPI(API_KEY)
organizations = dashboard.organizations.getOrganizations()

for organization in organizations:
    organization_id = organization['id']
    print(f"organiztion_id : {organization_id}")    
    networks = dashboard.organizations.getOrganizationNetworks(organization_id)    

    for network in networks:
        network_id = network['id']
        network_name = network['name']
        print(f"network_id : {network_id}")
        print(f"network_name : {network_name}")
Get notified when there are additional replies to this discussion.