Hi All,
Thank you in advance for your help. Is there any API to list the org or network wired ports and filter unused ports, then shut them down?
Solved! Go to solution.
Unfortunately, there is no single API call, which will do all of that. You'll have to write a script, that will implement several different API calls, that will filter ports that are unused, and disable them.
@AhmedJawad It would help if you defined what is "unused ports" for you.
Try to get the information on port usage (https://developer.cisco.com/meraki/api/get-device-switch-ports-statuses) for a defined timespan (max 31 days) then disable the ports which match your criteria (https://developer.cisco.com/meraki/api/update-device-switch-port)
If I'm using python SDK below , I just like to use SDK.
how do i pass the time 30 days for example to the SDK below , see the Status line in the end there Serial, how do I pass time?
I was able to get this to work!!
If you check in the change log of the switch it shows the values changed
I did have to change the last line
I have "dashboard.switch.updateDeviceSwitchPort(device['serial'], port_id,enabled=False)"
Yes, you are correct.
I was copy-pasting a fragment of my own script where 'serial' is a variable somewhere on my code to do other things.
I just tried to explain the logic and which API calls should be made.
In the end, your approach may vary to suit your own needs.
I appreciate you taking the time to post these. Using real world meraki examples is helping me understand python a little.
I wanted to share with anyone who is also new that this works and how I verified it worked.
Having time to sit, read, test and digest what I am doing is most of the time, far and few between. I have some time now in between projects so I'm trying to make as much progress as I can, while supporting all the IT services I need to.
What happens when a client device is shutdown overnight and it's powered on the next morning? Wouldn't this create more work than good?
When auditing I look for ports that have been down for a period of time I.e longer than a month. These are then shut and placed into a non routable VLAN
I guess we can check when the last time the port had a client on it was.