EEM Script with boolean

same lab to test :

SW35 run EEM Script and tracl eth 0/0 and eth0/1

if both the interface down, then run EEM Script to download other LAN Interface. Once both the Interface come up and bring up the LAN Interface.

track 1 ip sla 1 reachability
track 2 ip sla 2 reachability
track 3 list boolean and
object 1
object 2
delay down 60

track 4 list boolean or
object 1
object 2
delay up 10


exit


!
ip sla 1
icmp-echo 10.10.20.1 source-interface Ethernet0/1
frequency 10
exit
ip sla schedule 1 life forever start-time now
!
ip sla 2
icmp-echo 10.10.30.1 source-interface Ethernet0/0
frequency 10
exit
ip sla schedule 2 life forever start-time now
!

event manager applet test_down
event syslog pattern “%TRACK-6-STATE: 3 list boolean and Up -> Down”
action 1 cli command “enable”
action 2 cli command “configure terminal”
action 3 cli command “interface range Et0/2-3”
action 4 cli command “shutdown”
action 5 cli command “end”
action 8 cli command “write memory”

Track up we use here Track 4 – if any one of the up we bring up the interface range

event manager applet test_up
event syslog pattern “%TRACK-6-STATE: 4 list boolean or Down -> Up”
action 1 cli command “enable”
action 2 cli command “configure terminal”
action 3 cli command “interface range Et0/2-3”
action 4 cli command “no shutdown”
action 5 cli command “end”
action 8 cli command “write memory”

Testing shutdown eth0/0 and eth0/1

%TRACK-6-STATE: 1 ip sla 1 reachability Up -> Down

%TRACK-6-STATE: 2 ip sla 2 reachability Up -> Down

%TRACK-6-STATE: 3 list boolean and Up -> Down

and EEM Script runs :

%SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:test_down)

we can see eth0/2 and0/3 disabled – that means EEM script run as expected

Lets bring up Eth 0/0 and eth 0/1 and show track 3

and we can see log message EEM Script up activated.

%SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:test_up)

happy Labbing……………………!