Download CSV of all clients including unused port all all switch

MrDoubiw
New here

Download CSV of all clients including unused port all all switch

Hello all,

For my work, and to automate some things, I need to export all off my switches including all of the clients connected and including all unused port in a CSV file.

Is it possible ? If yes, how ?

 

Thanks for your time

3 Replies 3
Mloraditch
Kind of a big deal
Kind of a big deal

This is not directly possible. 

If you only have a few networks to do, you can just export all clients from that view and all switch ports from that switch port configuration page and cross reference in excel with a lookup to assign clients to online ports.

 

For a large number of networks, the API is probably the path.

 

https://developer.cisco.com/meraki/api-v1/get-network-clients/

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

and again cross referencing the data 

If you found this post helpful, please give it Kudos. If my answer solves your problem please click Accept as Solution so others can benefit from it.
MrDoubiw
New here

Thanks for the rapid answer. I'll do it with your first way and mix with google sheets formulas.

PhilipDAth
Kind of a big deal
Kind of a big deal

Meraki provide a sample script in their SDK github to export info on all clients in the org.

https://github.com/meraki/dashboard-api-python/blob/main/examples/aio_org_wide_clients_v1.py

 

You can use something along these lines for finding unused ports.

dashboard = meraki.DashboardAPI('your_api_key', suppress_logging=True)
devices = dashboard.organizations.getOrganizationDevices('your_org_id', total_pages='all')
for device in devices:
    if device['productType'] == 'switch':
        port_statuses = dashboard.switch.getDeviceSwitchPortsStatuses(device['serial'], timespan=(31*24*60*60))
        for port_status in port_statuses:
            port_id = port_status['portId']
            total_usage_kb = port_status['usageInKb']['total']

            # This shuts the port down
            #if total_usage_kb == 0:
            #    dashboard.switch.updateDeviceSwitchPort(device['serial'], port_id,enabled=False)
Get notified when there are additional replies to this discussion.