cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
10592
Views
0
Helpful
3
Replies

Cisco EEM. Delay between action cli

Hi

I have Cisco  Catalyst 6500 with IOS Version 12.2(17r)SX5

I need  real-time monitornig of failed interface, to shut it administratively  down and after 5 minutes "no shutdown" it.

I think is good idea to use Cisco EEM for this task.

My algorithm is below:

1. EEM script is looking for event about  failed interface.

2. EEM script is shutting interface down.

3. EEM script is waiting 5 minutes.

4. EEM script is enabling interface.

I know how to configure EEM for steps 1, 2 and 4, but step 3 I do not.

Help solve this task, please.

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

That's not the version of code running on your switch. That looks like boot ROM code.  In any event, unless you have a Sup2T, you have EEM 2.x.  This solution should work for you.

event manager environment q "

!

event manager applet failed-interface

event ...

action 001 cli command "enable"

action 002 cli command "config t"

action 003 cli command "interface INTF"

action 004 cli command "shut"

action 005 cli command "event manager applet reenable-intf"

action 006 cli command "event timer countdown time 300"

action 007 cli command "action 1.0 cli command enable"

action 008 cli command "action 2.0 cli command $q config t$q"

action 009 cli command "action 3.0 cli command $q interface INTF$q"

action 010 cli command "action 4.0 cli command $q no shut$q"

action 011 cli command "action 4.1 cli command $q no event manager applet reenable-intf$q"

action 012 cli command "action 5.0 cli command end"

action 013 cli command "end"

View solution in original post

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

That's not the version of code running on your switch. That looks like boot ROM code.  In any event, unless you have a Sup2T, you have EEM 2.x.  This solution should work for you.

event manager environment q "

!

event manager applet failed-interface

event ...

action 001 cli command "enable"

action 002 cli command "config t"

action 003 cli command "interface INTF"

action 004 cli command "shut"

action 005 cli command "event manager applet reenable-intf"

action 006 cli command "event timer countdown time 300"

action 007 cli command "action 1.0 cli command enable"

action 008 cli command "action 2.0 cli command $q config t$q"

action 009 cli command "action 3.0 cli command $q interface INTF$q"

action 010 cli command "action 4.0 cli command $q no shut$q"

action 011 cli command "action 4.1 cli command $q no event manager applet reenable-intf$q"

action 012 cli command "action 5.0 cli command end"

action 013 cli command "end"

Joseph Clarke,

Thank you, your solution is fully working for me.

And you was right about IOS version, it was copy-paste error. Correct version is 12.2(33)SXI8

Hi suggested solution is not working , have set delay timer to 300 sec ( 5 minutes) but cli commands are executed without delay . Kindly advise , in EEM - Fallback , i want to wait for 5 mins and then proceed to unshut the bgp neighbor

 

 

 

Customer_End_Router#sh ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 10.10.0.2 YES NVRAM up up
FastEthernet0/1 10.10.1.2 YES NVRAM up up
FastEthernet1/0 unassigned YES NVRAM administratively down down
FastEthernet1/1 unassigned YES NVRAM administratively down down
Loopback500 5.5.5.5 YES NVRAM up up
Customer_End_Router#sh ip bgp summ
BGP router identifier 5.5.5.5, local AS number 65201
BGP table version is 6, main routing table version 6
4 network entries using 576 bytes of memory
9 path entries using 720 bytes of memory
3/2 BGP path/bestpath attribute entries using 408 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1728 total bytes of memory
BGP activity 4/0 prefixes, 9/0 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.10.0.1 4 65200 960 959 6 0 0 00:48:58 3
10.10.1.1 4 65200 59 58 6 0 0 00:48:56 3
Customer_End_Router#sh run | sec event
event manager applet Failover
event track 123 state down
action 1.0 syslog msg "Failover Started"
action 1.1 cli command "enable"
action 1.2 cli command "conf t"
action 1.3 cli command "router bgp 65201"
action 1.4 cli command "neighbor 10.10.0.1 shutdown"
action 1.5 syslog msg "Failover Successful"
event manager applet Fallback
event track 123 state up
action 1.0 syslog msg "Fallback timer initaited "
action 1.1 cli command "event timer countdown time 300"
action 1.2 syslog msg "Fallback begin "
action 1.3 cli command "enable"
action 1.4 cli command "conf t"
action 1.5 cli command "router bgp 65201"
action 1.6 cli command "no neighbor 10.10.0.1 shutdown"
action 1.7 syslog msg "Fallback successfull"
Customer_End_Router#
*Aug 10 12:49:00.299: %BGP-3-NOTIFICATION: sent to neighbor 10.10.0.1 4/0 (hold time expired) 0 bytes
Customer_End_Router#
*Aug 10 12:49:00.307: %BGP-5-NBR_RESET: Neighbor 10.10.0.1 reset (BGP Notification sent)
*Aug 10 12:49:00.315: %BGP-5-ADJCHANGE: neighbor 10.10.0.1 Down BGP Notification sent
*Aug 10 12:49:00.319: %BGP_SESSION-5-ADJCHANGE: neighbor 10.10.0.1 IPv4 Unicast topology base removed from session BGP Notification sent
Customer_End_Router#
*Aug 10 12:49:19.759: %TRACKING-5-STATE: 123 ip sla 123 reachability Up->Down
*Aug 10 12:49:19.859: %HA_EM-6-LOG: Failover: Failover Started
*Aug 10 12:49:20.415: %HA_EM-6-LOG: Failover: Failover Successful
Customer_End_Router#
*Aug 10 12:49:49.767: %TRACKING-5-STATE: 123 ip sla 123 reachability Down->Up
Customer_End_Router#
*Aug 10 12:49:49.791: %HA_EM-6-LOG: Fallback: Fallback timer initaited
*Aug 10 12:49:49.859: %HA_EM-6-LOG: Fallback: Fallback begin
*Aug 10 12:49:49.999: %HA_EM-6-LOG: Fallback: Fallback successfull
Customer_End_Router#
*Aug 10 12:49:50.587: %BGP-5-ADJCHANGE: neighbor 10.10.0.1 Up

Review Cisco Networking for a $25 gift card