05-26-2022 12:40 PM - edited 05-26-2022 12:42 PM
Hi, I have a Poe switch that I need to configure to shut a port at a specific time and enable it the next day. Was looking at timed ACL but I understand this only denies protocols and not the port. Just started to read about eem. Is this the way forward ? I have searched for anything similar I can use and I’m out of my depth especially the tcl Side of things.
Any advice appreciated.
Solved! Go to Solution.
05-26-2022 12:58 PM
Hi
You can use EEM script.
This is not new here in the forum. Take a look here:
05-27-2022 09:09 AM
Hello,
I think the 2960X does not fully support EEM. You should be able to do this with TCL and Kron. I'll test and get back with you...
05-27-2022 09:46 AM
Hello,
here are two scripts that should work. The first one will shut interface GigabitEthernet0/0 at 17:00 each day, the second one will unshut it at 08:00 each day. Change the interface number and the time to what applies to you. Also, my device uses 'flash0', yours might just be named 'flash'...
2960X#tclsh
puts [open "flash0:shutdown_port.tcl" w] {
set ports [lindex $argv 0]
ios_config "int $ports" "shut" "end"
}
tclquit
config t
kron policy-list policy_shutdown_interface
cli tclsh flash:shutdown_port.tcl "GigabitEthernet0/0"
exit
kron occurrence policy_shutdown_interface at 17:00 recurring
policy-list policy_shutdown_interface
!
exit
exit
wr mem
2960X#tclsh
puts [open "flash0:unshut_port.tcl" w] {
set ports [lindex $argv 0]
ios_config "int $ports" "no shut" "end"
}
tclquit
config t
kron policy-list policy_unshut_interface
cli tclsh flash:unshut_port.tcl "GigabitEthernet0/0"
exit
kron occurrence policy_unshut_interface at 08:00 recurring
policy-list policy_unshut_interface
!
exit
exit
wr mem
05-26-2022 12:58 PM
Hi
You can use EEM script.
This is not new here in the forum. Take a look here:
05-26-2022 01:05 PM
Thank you for your time.
05-27-2022 03:21 AM
Slight update as the link sent me to a script for a diiferent system. I have a cisco WS-C2960X-24PS-L running c2960x-universalk9-mz.152-2.E6 ios.
In conf t i don't have the event command.
05-27-2022 09:09 AM
Hello,
I think the 2960X does not fully support EEM. You should be able to do this with TCL and Kron. I'll test and get back with you...
05-27-2022 09:46 AM
Hello,
here are two scripts that should work. The first one will shut interface GigabitEthernet0/0 at 17:00 each day, the second one will unshut it at 08:00 each day. Change the interface number and the time to what applies to you. Also, my device uses 'flash0', yours might just be named 'flash'...
2960X#tclsh
puts [open "flash0:shutdown_port.tcl" w] {
set ports [lindex $argv 0]
ios_config "int $ports" "shut" "end"
}
tclquit
config t
kron policy-list policy_shutdown_interface
cli tclsh flash:shutdown_port.tcl "GigabitEthernet0/0"
exit
kron occurrence policy_shutdown_interface at 17:00 recurring
policy-list policy_shutdown_interface
!
exit
exit
wr mem
2960X#tclsh
puts [open "flash0:unshut_port.tcl" w] {
set ports [lindex $argv 0]
ios_config "int $ports" "no shut" "end"
}
tclquit
config t
kron policy-list policy_unshut_interface
cli tclsh flash:unshut_port.tcl "GigabitEthernet0/0"
exit
kron occurrence policy_unshut_interface at 08:00 recurring
policy-list policy_unshut_interface
!
exit
exit
wr mem
05-28-2022 10:31 AM
You sir are a magician…
hats off to the people who can come up with this stuff. I thought doing a ccna was tough.
Awesome work fella,
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide