Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Webcast-Catalyst9k
New Member

tcl script to identify unused ports

So I've been trying to find a way to run a TCL script on a large number of 3750 switches which will identify any unused ports and disable them, but I'm not entirely sure since the ports would always differ from switch to switch, the rest of the script as far as disabling them and putting them into an unused vlan is no problem, only the identifying which actual ports would need to run through and be shut confuses me. I would be pushing a job to multiple switches containg the script however for the life of me I am unable to come up with a way to identify the correct ports on a per switch basis by pushing only one script.

Everyone's tags (3)
3 REPLIES

Re: tcl script to identify unused ports

Well

we struggled with some similar script or a while.

What we do is , a port is considered unused if both the input packet count and output packet count = 0 after an amount of time (days, weeks)

Example of unused port (we cleared all the counters on the switch 3 weeks ago)

GigabitEthernet1/0/6 is down, line protocol is down (notconnect)

   5 minute input rate 0 bits/sec, 0 packets/sec

  5 minute output rate 0 bits/sec, 0 packets/sec

    0 packets input, 0 bytes, 0 no buffer

     Received 0 broadcasts (0 multicasts)

     0 runts, 0 giants, 0 throttles

     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored

     0 watchdog, 0 multicast, 0 pause input

     0 input packets with dribble condition detected

     0 packets output, 0 bytes, 0 underruns

     0 output errors, 0 collisions, 1 interface resets

     0 unknown protocol drops

     0 babbles, 0 late collision, 0 deferred

     0 lost carrier, 0 no carrier, 0 pause output

     0 output buffer failures, 0 output buffers swapped out

Hope it helps!

New Member

Re: tcl script to identify unused ports

Oh wow, that is brilliant, but how would you pull that information. I assume you wrote it into an if statement, but how was that data pulled and differentiated from all others. Did you use a while loop to check all ports and then if the input and output packets were 0 then they were considered unused and placed into an unused vlan

Re: tcl script to identify unused ports

Did you use a while loop to check all ports and then if the input and output packets were 0 then they were considered unused and placed into an unused vlan

Hi

yes, thats how it works here.

558
Views
0
Helpful
3
Replies
CreatePlease to create content