05-06-2023 09:29 PM
I'm labbing some EEM scripting to get a feel for it.
I've configured tracking icmp-echo, which works fine, however I can't get RTR 1 toi turn on interface e0/1 when the icmp-echo track/reachability goes down from RTR 1 to RTR 2
here is the ip sla tracking config:
conf t
event manager session cli username "EEM_SCRIPT"
event manager applet ISP-1_IS_DOWN
event syslog pattern "1 ip sla 10 state Up->Down"
action 1.0 cli command "enable"
action 2.0 cli command "configure terminal"
action 3.0 cli command "interface eth 0/1"
action 4.0 cli command "no shut"
action 5.0 syslog msg "EEM has Turned UP the BACKUP port"
event manager applet ISP-1_IS_DOWN
event syslog pattern "1 ip sla 10 state Down->Up"
action 1.0 cli command "enable"
action 2.0 cli command "configure terminal"
action 3.0 cli command "interface eth 0/1"
action 4.0 cli command "shut"
action 5.0 syslog msg "EEM has Turned DOWN the BACKUP port"
end
and here is the event-manager configuration
conf t
event manager session cli username "EEM_SCRIPT"
event manager applet ISP-1_IS_DOWN
event syslog pattern "1 ip sla 10 state Up->Down"
action 1.0 cli command "enable"
action 2.0 cli command "configure terminal"
action 3.0 cli command "interface eth 0/1"
action 4.0 cli command "no shut"
action 5.0 syslog msg "EEM has Turned UP the BACKUP port"
event manager applet ISP-1_IS_DOWN
event syslog pattern "1 ip sla 10 state Down->Up"
action 1.0 cli command "enable"
action 2.0 cli command "configure terminal"
action 3.0 cli command "interface eth 0/1"
action 4.0 cli command "shut"
action 5.0 syslog msg "EEM has Turned DOWN the BACKUP port"
end
when I shut down the interface from RTR2 I get in the output
but the event manager isn't turning on the interface for eth 0/1 for the other link. Any ideas?
Here is the config on RTR1
no aaa new-model
mmi polling-interval 60
no mmi auto-configure
no mmi pvc
mmi snmp-timeout 180
no ip icmp rate-limit unreachable
!
no ip domain lookup
ip cef
no ipv6 cef
!
multilink bundle-name authenticated
!
redundancy
!
no cdp log mismatch duplex
!
track 1 ip sla 10
!
track 2 application home-agent
!
track 3 list threshold percentage
threshold percentage down 25 up 30
!
ip tcp synwait-time 5
!
interface Ethernet0/0
ip address 1.1.1.2 255.255.255.0
!
interface Ethernet0/1
ip address 2.2.2.2 255.255.255.0
shutdown
!
interface Ethernet0/2
no ip address
shutdown
!
interface Ethernet0/3
no ip address
shutdown
!
ip forward-protocol nd
!
no ip http server
no ip http secure-server
!
ip sla auto discovery
ip sla 10
icmp-echo 1.1.1.1
threshold 2
timeout 1000
frequency 5
ip sla schedule 10 life forever start-time now
ip sla logging traps
ip sla enable reaction-alerts
!
control-plane
!
alias exec cc event manager run CLEAR-COUNTERS
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
line vty 0 4
login
transport input none
!
event manager session cli username "EEM_SCRIPT"
event manager applet ISP-1_IS_DOWN
event syslog pattern "1 ip sla 10 state Down->Up"
action 1.0 cli command "enable"
action 2.0 cli command "configure terminal"
action 3.0 cli command "interface eth 0/1"
action 4.0 cli command "shut"
action 5.0 syslog msg "EEM has Turned DOWN the BACKUP port"
!
end
action 5.0 syslog msg "EEM has Turned DOWN the BACKUP port"
!
05-07-2023 06:31 AM - edited 05-07-2023 06:33 AM
csico#debug embedded event manager action cli
please share this
fore me I dont like use pattern
event syslog pattern "1 ip sla 10 state Down->Up"
instead add track for this IP SLA and detect the track status with
event track x state UP/DOWN
05-10-2023 11:51 AM
Your pattern seems to be wrong:
event syslog pattern "1 ip sla 10 state Up->Down"
event syslog pattern "1 ip sla 10 state Down->Up"
Comparing to the log-output, you missed some spaces - these pattern should match (hope so;) )
event syslog pattern "1 ip sla 10 state Up -> Down"
event syslog pattern "1 ip sla 10 state Down -> Up"
To avoid this, you should better use the event track 1 state down and event track 1 state up - as mentioned by MHM before.
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