Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Webcast-Catalyst9k
New Member

EEM script to track 2 routes and then trigger failover

We have MPLS network.  We need to create EEM script to track 2 routes using icmp (in our BGP table) and if both are unavailable, then i need to shutdown BGP.  I am new to EEM scripting and I could not find any document where I can track 2 routes using icmp.

Below is what i will use to shutdown bgp.  What i need help with is how i can track 2 routes eg. 10.1.1.1 and 10.2.2.2 which i want to do continous ping and if BOTH of the pings fail, i want to trigger bgp shutdown.

event track 1 state down

action 1.0 cli command "enable"

action 1.1 cli command “config t”

action 1.2 cli command “router bgp 1”

action 1.3 cli command “neighbor x.x.x.x shut”

action 1.4 cli command “exit"

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
New Member

Ismail,That's correct. If you

Ismail,

That's correct. If you want to bring it back up when both SLA are up, change the "or" to an "and" as per the down applet.

The example IP SLA operates every 6 seconds with a timeout of 4 seconds. It only takes a single failure to bring the track state down.

See here for IP SLA ICMP operations, and

See here for an example of delayed down ( only change state after a number of echo failures )

Regards,

Robert.

 

3 REPLIES
New Member

You can use event correlation

You can use event correlation to cause actions to occur on multiple conditional events. See this-link

For example, the following causes the shutdown of the neighbor if both SLA tracks are down, it will reactivate the neighbor if either of the tracks return to an up state.

ip sla 11
 icmp-echo 1.1.1.1
 threshold 4000
 frequency 6
ip sla schedule 11 life forever start-time now
!
ip sla 12
 icmp-echo 2.2.2.2
 threshold 4000
 frequency 6
ip sla schedule 12 life forever start-time now
!
track 11 ip sla 11
 default-state up
track 12 ip sla 12
 default-state up
!
event manager applet BOTHDOWN
 event tag e1 track 11 state down
 event tag e2 track 12 state down
 trigger occurs 1 period 60
  correlate event e1 and event e2
 action 1 cli command "enable"
 action 2 cli command "conf t"
 action 3 cli command "router bgp 1"
 action 4 cli command "neighbor x.x.x.x shut"
 action 5 cli command "end"
!
event manager applet ONEUP
 event tag e1 track 11 state up
 event tag e2 track 12 state up
 trigger occurs 1 period 60
  correlate event e1 or event e2
 action 1 cli command "enable"
 action 2 cli command "conf t"
 action 3 cli command "router bgp 1"
 action 4 cli command "neighbor x.x.x.x activate"
 action 5 cli command "end"

 

New Member

Hi Robert, Thank you for your

Hi Robert,

 

Thank you for your reply.  If I want the event applet to bring up the bgp neighbor only when both of the icmp (ping to both ip address) is good, then i think i will only need to change the correlate event e1 OR to AND correct?

Also how many pings will need to be dropped before the action is taken - is it 6?

 

Regards,

Ismail

New Member

Ismail,That's correct. If you

Ismail,

That's correct. If you want to bring it back up when both SLA are up, change the "or" to an "and" as per the down applet.

The example IP SLA operates every 6 seconds with a timeout of 4 seconds. It only takes a single failure to bring the track state down.

See here for IP SLA ICMP operations, and

See here for an example of delayed down ( only change state after a number of echo failures )

Regards,

Robert.

 

967
Views
0
Helpful
3
Replies
CreatePlease to create content