cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
22695
Views
36
Helpful
16
Replies

Find Unused Ports - Script

emcclend
Level 1
Level 1

I came across this script to find ports that have not been used for 6 weeks or more.  I can get it to work for anything up to 9 weeks or more.  However I'm struggling to figure out how to modify this script to show double digit weeks or more.

 

For example, I want to show unused ports for 16 weeks or more, but I'm not sure what to change/add.

 

Shows only admin down or unconnected ports that have no input/input for +6 weeks

show int | i proto.*notconnect|proto.*administratively down|Last in.* [6-9]w|Last in.*[0-9][0-9]w|[0-9]y|disabled|Last input never, output never, output hang never

 

Script Source:

https://www.m00nie.com/2012/02/show-free-not-used-for-a-while-ports-on-cisco-switch-with-one-command/

16 Replies 16

I am new to regex and I appreciate your advise on the smaller pattern.
Thanks and be safe
-Mike

t_s
Level 1
Level 1

I created a small python script which filters down inactive port with description. Currently it is locked on 26 weeks. (Value can be changed) It is only tested with a 4500 series switch, it probably works for other series as well. More information can be found @:

tslenter/cisco-port-filter-for-inactive-ports: Extracts port information for inactive ports. (github.com)

 and the code:

cisco-port-filter-for-inactive-ports/free_port_check.py at main · tslenter/cisco-port-filter-for-inactive-ports (github.com)

Review Cisco Networking for a $25 gift card