cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
593
Views
0
Helpful
2
Replies

How do I create an EEM applet that only shuts a port down on the weekends?

rweir0001
Level 1
Level 1

Hi,

I'm just learning how to use EEM on my switch and created an applet that shuts the port down every day after production hours, and brings it back up in the morning. The applet is working well but I want to create a second applet that shuts the port down on Friday evening and doesn't bring it back up until Monday morning. Is there a way to do this? If so, will a second time-based applet on the same port conflict with the first applet I created to bring the port down after production hours every day, and back up every morning?

 

This is the configuration for the applet I already created:

 

event manager applet noshut
event timer cron name noshut cron-entry "30 7 * * *"
action 1 cli command "configure terminal"
action 2 cli command "interface gi1/0/12"
action 3 cli command "no shutdown"



event manager applet shut
event timer cron name shut cron-entry "30 16 * * *"
action 1 cli command "configure terminal"
action 2 cli command "interface gi1/0/12"
action 3 cli command "shutdown"

 

I'm assuming that the "* * *" in the commands are instructing EEM to execute the command every day. I can run a "sh clock" command and it will specify a day by name (i.e., Tue, Sat, etc). So can I configure an applet that instructs EEM to keep the port down every Sat and Sun?

1 Accepted Solution

Accepted Solutions

Martin Hruby
Level 1
Level 1

Hello

Why not reuse the same applet just with a different cron entry? There should be no conflict in having multiple applets running with similar objective. For example:

run on Friday at 5:00pm
"0 17 * * 5"

run on Monday at 7:00am
"0 7 * * 1"

Would that work for you?

Another option, if port gi1/0/12 is an L3 port, would be to configure a time-based access-list which would filter out all traffic received in a certain time period but without shutting the port down. Have a look here: http://www.cisco.com/c/en/us/support/docs/security/ios-firewall/23602-confaccesslists.html#timebasedtimerange

Best regards,
Martin

View solution in original post

2 Replies 2

Martin Hruby
Level 1
Level 1

Hello

Why not reuse the same applet just with a different cron entry? There should be no conflict in having multiple applets running with similar objective. For example:

run on Friday at 5:00pm
"0 17 * * 5"

run on Monday at 7:00am
"0 7 * * 1"

Would that work for you?

Another option, if port gi1/0/12 is an L3 port, would be to configure a time-based access-list which would filter out all traffic received in a certain time period but without shutting the port down. Have a look here: http://www.cisco.com/c/en/us/support/docs/security/ios-firewall/23602-confaccesslists.html#timebasedtimerange

Best regards,
Martin

Thanks! I created a second cron entry. I'll wait and see if it works this weekend.