cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6542
Views
75
Helpful
48
Replies

Shutdown Ports not in use for a while with EEM Tcl

ANDAFBCCO
Level 1
Level 1

I have downloaded these 2 Tcl scripts from this previous discussion and from the sounds of it it's exactly what I've been looking for. But the problem is I'm new to EEM and have no idea how to go about putting these on the switches themselves. I've searched for configuration guides but to no prevail. Any help is greatly appreciated. Here's the link to previous discussion:

https://supportforums.cisco.com/thread/164684.pdf;jsessionid=EEEEE143342DAAB34706D608D5C4C920.node0

48 Replies 48

If you're seeing syslog messages, but the ports are not shutting down, make sure you have the following configured:

event manager session cli username USER

Where USER is a username configured on your AAA server and is authorized to run CLI commands like "config t" and shutdown an interface.

If I do "sho run". this is what is I see:

event manager environment suspend_ports_days 30

event manager environment suspend_ports_config flash:/susp_ports.dat

event manager directory user policy "flash:/"

event manager session cli username "fouriecl"

event manager policy sl_suspend_ports.tcl trap

event manager policy tm_suspend_ports.tcl trap

"sho log"

Jun 18 08:17:40: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/14, changed state to down

Jun 18 08:17:41: %LINK-3-UPDOWN: Interface GigabitEthernet1/0/14, changed state to down

Jun 18 06:22:43.075: %HA_EM-2-LOG: stateInterfacestatus.tcl: 163&InterfacePort Status Change |ifs|10114_2

Jun 18 08:51:00: %LINK-3-UPDOWN: Interface GigabitEthernet1/0/14, changed state to up

Jun 18 08:51:01: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/14, changed state to up

Jun 18 06:51:02.858: %HA_EM-6-LOG: sl_suspend_ports.tcl : DEBUG(cli_lib) : CTL : cli_open called.

Jun 18 06:51:03.102: %HA_EM-6-LOG: sl_suspend_ports.tcl : DEBUG(cli_lib) : OUT : Network_Desk>

Jun 18 06:51:03.102: %HA_EM-6-LOG: sl_suspend_ports.tcl : DEBUG(cli_lib) : IN  : Network_Desk>enable

Jun 18 06:51:03.219: %HA_EM-6-LOG: sl_suspend_ports.tcl : DEBUG(cli_lib) : OUT : Network_Desk#

Jun 18 06:51:03.219: %HA_EM-6-LOG: sl_suspend_ports.tcl : DEBUG(cli_lib) : IN  : Network_Desk#show event manager policy pending | include tm_suspend_ports.tcl

Jun 18 06:51:03.638: %HA_EM-6-LOG: sl_suspend_ports.tcl : DEBUG(cli_lib) : OUT : Network_Desk#

Jun 18 06:51:03.638: %HA_EM-6-LOG: sl_suspend_ports.tcl : DEBUG(cli_lib) : CTL : cli_close called.

Jun 18 10:49:20: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/11, changed state to down Jun 18 08:17:40: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/14, changed state to down
Jun 18 08:17:41: %LINK-3-UPDOWN: Interface GigabitEthernet1/0/14, changed state to down
Jun 18 06:22:43.075: %HA_EM-2-LOG: stateInterfacestatus.tcl: 163&InterfacePort Status Change |ifs|10114_2
Jun 18 08:51:00: %LINK-3-UPDOWN: Interface GigabitEthernet1/0/14, changed state to up
Jun 18 08:51:01: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/14, changed state to up
Jun 18 06:51:02.858: %HA_EM-6-LOG: sl_suspend_ports.tcl : DEBUG(cli_lib) : CTL : cli_open called.
Jun 18 06:51:03.102: %HA_EM-6-LOG: sl_suspend_ports.tcl : DEBUG(cli_lib) : OUT : Network_Desk>
Jun 18 06:51:03.102: %HA_EM-6-LOG: sl_suspend_ports.tcl : DEBUG(cli_lib) : IN  : Network_Desk>enable
Jun 18 06:51:03.219: %HA_EM-6-LOG: sl_suspend_ports.tcl : DEBUG(cli_lib) : OUT : Network_Desk#
Jun 18 06:51:03.219: %HA_EM-6-LOG: sl_suspend_ports.tcl : DEBUG(cli_lib) : IN  : Network_Desk#show event manager policy pending | include tm_suspend_ports.tcl
Jun 18 06:51:03.638: %HA_EM-6-LOG: sl_suspend_ports.tcl : DEBUG(cli_lib) : OUT : Network_Desk#
Jun 18 06:51:03.638: %HA_EM-6-LOG: sl_suspend_ports.tcl : DEBUG(cli_lib) : CTL : cli_close called.
Jun 18 10:49:20: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/11, changed state to down

Any other suggestions?

The way the scripts work is to keep track of those ports in a down state.  If a port comes up (as you show here), the syslog script (sl_suspend_ports.tcl) removes that port from the list of potential unused ports.  After your time period (30 days in your case), the ports that have been down that entire time are shutdown.

What you're showing is simply the syslog part.  The timer part (which runs every night at midnight by default) takes care of doing the actual shutdown work.  You'd need to make sure the ports in question have really been down for 30 days, and that is properly reflected in flash:/susp_ports.dat.  Certainly, Gi1/0/11 would not be included since it recently transitioned to up.