EEM And Tcl scripts

Answered Question
Jan 15th, 2010


Hi

Please teach me. How to implementation EEM.


I want use EEM this situation.

When gi1/1 detect down EEM scripts enable.

In case gi1/1 is up  within 3 seconds then finish the EEM scripts.

Another case gi1/1 down time is over 3 seconds, Then shutdown gi1/2 and gi1/3.


IOS version 12.2(46)SG.

Correct Answer by Joe Clarke about 7 years 1 month ago

You have a tight time margin here, but these EEM applet policies should work:


event manager environment quote "


event manager applet int-down

event syslog pattern "LINEPROTO-5-UPDOWN.*GigabitEthernet1/1.*changed state to down"

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "event manager applet int-down-countdown"

action 3.1 cli command "event timer countdown time 3"

action 3.2 cli command "action 1.0 cli command enable"

action 3.3 cli command "action 2.0 cli command $quote config t$quote"

action 3.4 cli command "action 3.0 cli command $quote int gi1/2$quote"

action 3.5 cli command "action 4.0 cli command $quote shutdown$quote"

action 3.6 cli command "action 5.0 cli command $quote int gi1/3$quote"

action 3.7 cli command "action 6.0 cli command $quote shutdown$quote"

action 3.8 cli command "action 7.0 cli command $quote no event manager applet int-down-countdown$quote"

action 3.9 cli command "action 8.0 cli command $quote end$quote"

action 4.0 cli command "end"


event manager applet int-up

event syslog pattern "LINEPROTO-5-UPDOWN.*GigabitEthernet1/1.*changed state to up"

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "no event manager applet int-down-countdown"

action 4.0 cli command "end"

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Correct Answer
Joe Clarke Fri, 01/15/2010 - 23:15

You have a tight time margin here, but these EEM applet policies should work:


event manager environment quote "


event manager applet int-down

event syslog pattern "LINEPROTO-5-UPDOWN.*GigabitEthernet1/1.*changed state to down"

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "event manager applet int-down-countdown"

action 3.1 cli command "event timer countdown time 3"

action 3.2 cli command "action 1.0 cli command enable"

action 3.3 cli command "action 2.0 cli command $quote config t$quote"

action 3.4 cli command "action 3.0 cli command $quote int gi1/2$quote"

action 3.5 cli command "action 4.0 cli command $quote shutdown$quote"

action 3.6 cli command "action 5.0 cli command $quote int gi1/3$quote"

action 3.7 cli command "action 6.0 cli command $quote shutdown$quote"

action 3.8 cli command "action 7.0 cli command $quote no event manager applet int-down-countdown$quote"

action 3.9 cli command "action 8.0 cli command $quote end$quote"

action 4.0 cli command "end"


event manager applet int-up

event syslog pattern "LINEPROTO-5-UPDOWN.*GigabitEthernet1/1.*changed state to up"

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "no event manager applet int-down-countdown"

action 4.0 cli command "end"

Joe Clarke Sat, 01/16/2010 - 10:45

There is a slight change I would make to prevent the regular expressions from matching interfaces such as Gi1/10, 1/11, etc.:


event manager environment quote "<br/><br/>event manager applet int-down<br/> event syslog pattern "LINEPROTO-5-UPDOWN.*GigabitEthernet1/1,.*changed state to down"<br/> action 1.0 cli command "enable"<br/> action 2.0 cli command "config t"<br/> action 3.0 cli command "event manager applet int-down-countdown"<br/> action 3.1 cli command "event timer countdown time 3"<br/> action 3.2 cli command "action 1.0 cli command enable"<br/> action 3.3 cli command "action 2.0 cli command $quote config t$quote"<br/> action 3.4 cli command "action 3.0 cli command $quote int gi1/2$quote"<br/> action 3.5 cli command "action 4.0 cli command $quote shutdown$quote"<br/> action 3.6 cli command "action 5.0 cli command $quote int gi1/3$quote"<br/> action 3.7 cli command "action 6.0 cli command $quote shutdown$quote"<br/> action 3.8 cli command "action 7.0 cli command $quote no event manager applet int-down-countdown$quote"<br/> action 3.9 cli command "action 8.0 cli command $quote end$quote"<br/> action 4.0 cli command "end"<br/><br/>event manager applet int-up<br/> event syslog pattern "LINEPROTO-5-UPDOWN.*GigabitEthernet1/1,.*changed state to up"<br/> action 1.0 cli command "enable"<br/> action 2.0 cli command "config t"<br/> action 3.0 cli command "no event manager applet int-down-countdown"<br/> action 4.0 cli command "end"<br/>
yutan8888 Thu, 01/21/2010 - 22:25

Thank you. And another question about How to enable EEM.


SwitchA And SwitchB directly connected each other.

Trunkport(g1/1) of SwitchA connected to Trunkport(g1/1) of SwitchB.


When tracking interface(g1/2) is down in SwitchA, SwitchB enable EEM.

Interface(g1/2) is not directly connected each other.

Interface g1/2 is L2 accessport.
Can't assign ip address.
Dou you have good idea?

Joe Clarke Fri, 01/22/2010 - 09:10

Start a new thread for this question.  Also, it would help if you try and explain exactly what you want to do in more details.

Actions

This Discussion

Related Content