12-14-2018 07:10 PM
Hi Guys,
Please i am trying to right an EEM script to execute a command if an IPSLA 11 is not reachable and IPSLA 12 is reachable.
This is what i have for now. Pls i need your help.
track 11 ip sla 11 reachability
delay down 8 up 10
track 12 ip sla 11 reachability
delay down 8 up 10
ip sla enable reaction-alerts
ip sla 11
icmp-echo 192.168.1.2 source-interface Ethernet1/0
ip sla schedule 11 life forever start-time now
ip sla 12
icmp-echo 192.168.2.2 source-interface Ethernet1/1
ip sla schedule 12 life forever start-time now
ip sla reaction-configuration 11 react timeout threshold-type immediate
ip sla reaction-configuration 12 react timeout threshold-type immediate
event manager applet XXDC_DOWN
event syslog pattern "ip sla 11 reachability Up->Down"
action 1.0 cli command "enable"
action 1.1 cli command "config t"
action 1.2 cli command "router eigrp 1"
action 1.3 cli command "no passive-interface Tunnel2"
action 1.5 syslog msg "End of EEM"
event manager applet XXDC_UP
event syslog pattern "ip sla 11 reachability Down->Up"
action 1.0 cli command "enable"
action 1.1 cli command "config t"
action 1.2 cli command "router eigrp 1"
action 1.4 cli command "passive-interface Tunnel2"
action 1.5 syslog msg "End of EEM"
Solved! Go to Solution.
12-15-2018 01:24 AM
Add a boolean track statement
track 11 ip sla 11 reachability
track 12 ip sla 12 reachability
track 13 list boolean and
object 11
object 12 not
event manager applet APPLET
event track 13 state up
action 1.0 cli command "enable"
action 1.1 cli command "config t"
etc..
12-15-2018 07:16 PM
I put it in my lab.
R3#
R3#sh run
!
track 1 ip sla 1 reachability
!
track 2 ip sla 2 reachability
!
track 3 list boolean and
object 1 not
object 2
!
ip route 0.0.0.0 0.0.0.0 10.23.60.2
!
ip sla 1
icmp-echo 10.26.239.2 source-interface GigabitEthernet0/0.810
frequency 5
ip sla schedule 1 life forever start-time now
ip sla 2
icmp-echo 10.23.60.2 source-interface GigabitEthernet0/0.901
frequency 5
ip sla schedule 2 life forever start-time now
!
event manager environment q "
event manager session cli username "eem-user"
event manager applet CHANGE-ROUTE-BACKUP
event track 3 state down
action 1.0 cli command "enable"
action 1.1 cli command "conf t"
action 1.2 cli command "no ip route 0.0.0.0 0.0.0.0 10.26.239.2"
action 1.3 cli command "ip route 0.0.0.0 0.0.0.0 10.23.60.2"
action 1.5 cli command "end"
event manager applet CHANGE-ROUTE-PRIMARY
event track 3 state up
action 1.0 cli command "enable"
action 1.1 cli command "conf t"
action 1.2 cli command "ip route 0.0.0.0 0.0.0.0 10.26.239.2"
action 1.3 cli command "no ip route 0.0.0.0 0.0.0.0 10.23.60.2"
action 1.5 cli command "end"
!
end
R3#sh ip route static
S* 0.0.0.0/0 [1/0] via 10.23.60.2
R3#
%TRACKING-5-STATE: 1 ip sla 1 reachability Up->Down
%TRACKING-5-STATE: 3 list boolean and Down->Up
R3#sh ip route
%SYS-5-CONFIG_I: Configured from console by eem-user on vty0 (EEM:CHANGE-ROUTE-PRIMARY)
R3#sh ip route static
S* 0.0.0.0/0 [1/0] via 10.26.239.2
R3#
%TRACKING-5-STATE: 1 ip sla 1 reachability Down->Up
%TRACKING-5-STATE: 3 list boolean and Up->Down
R3#
%SYS-5-CONFIG_I: Configured from console by eem-user on vty0 (EEM:CHANGE-ROUTE-BACKUP)
R3#sh ip route static
S* 0.0.0.0/0 [1/0] via 10.23.60.2
R3#
R3#
12-15-2018 01:24 AM
Add a boolean track statement
track 11 ip sla 11 reachability
track 12 ip sla 12 reachability
track 13 list boolean and
object 11
object 12 not
event manager applet APPLET
event track 13 state up
action 1.0 cli command "enable"
action 1.1 cli command "config t"
etc..
12-16-2018 02:41 PM
Thanks Alot. It worked.
12-15-2018 07:16 PM
I put it in my lab.
R3#
R3#sh run
!
track 1 ip sla 1 reachability
!
track 2 ip sla 2 reachability
!
track 3 list boolean and
object 1 not
object 2
!
ip route 0.0.0.0 0.0.0.0 10.23.60.2
!
ip sla 1
icmp-echo 10.26.239.2 source-interface GigabitEthernet0/0.810
frequency 5
ip sla schedule 1 life forever start-time now
ip sla 2
icmp-echo 10.23.60.2 source-interface GigabitEthernet0/0.901
frequency 5
ip sla schedule 2 life forever start-time now
!
event manager environment q "
event manager session cli username "eem-user"
event manager applet CHANGE-ROUTE-BACKUP
event track 3 state down
action 1.0 cli command "enable"
action 1.1 cli command "conf t"
action 1.2 cli command "no ip route 0.0.0.0 0.0.0.0 10.26.239.2"
action 1.3 cli command "ip route 0.0.0.0 0.0.0.0 10.23.60.2"
action 1.5 cli command "end"
event manager applet CHANGE-ROUTE-PRIMARY
event track 3 state up
action 1.0 cli command "enable"
action 1.1 cli command "conf t"
action 1.2 cli command "ip route 0.0.0.0 0.0.0.0 10.26.239.2"
action 1.3 cli command "no ip route 0.0.0.0 0.0.0.0 10.23.60.2"
action 1.5 cli command "end"
!
end
R3#sh ip route static
S* 0.0.0.0/0 [1/0] via 10.23.60.2
R3#
%TRACKING-5-STATE: 1 ip sla 1 reachability Up->Down
%TRACKING-5-STATE: 3 list boolean and Down->Up
R3#sh ip route
%SYS-5-CONFIG_I: Configured from console by eem-user on vty0 (EEM:CHANGE-ROUTE-PRIMARY)
R3#sh ip route static
S* 0.0.0.0/0 [1/0] via 10.26.239.2
R3#
%TRACKING-5-STATE: 1 ip sla 1 reachability Down->Up
%TRACKING-5-STATE: 3 list boolean and Up->Down
R3#
%SYS-5-CONFIG_I: Configured from console by eem-user on vty0 (EEM:CHANGE-ROUTE-BACKUP)
R3#sh ip route static
S* 0.0.0.0/0 [1/0] via 10.23.60.2
R3#
R3#
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