×

Warning message

  • Cisco Support Forums is in Read Only mode while the site is being migrated.
  • Cisco Support Forums is in Read Only mode while the site is being migrated.

tcl script to identify unused ports

Unanswered Question
Jan 27th, 2014
User Badges:

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Ton V Engelen Tue, 01/28/2014 - 00:22
User Badges:
  • Bronze, 100 points or more

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!

nikkitodd92 Tue, 01/28/2014 - 08:45
User Badges:

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

Ton V Engelen Tue, 01/28/2014 - 22:38
User Badges:
  • Bronze, 100 points or more

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.

Actions

This Discussion

Related Content