cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1425
Views
0
Helpful
2
Replies

EEM and cron polling

dmalloch
Level 1
Level 1

Good day -

I want to check an interface every minute for line status. If line status
is down, then wait 30 minutes and reload. If on reload, still down, reload every 30
minutes and check status of track 1 until it comes up. 
Here is what I have.

track 1 interface Cellular0/0/0 line-protocol

!
event manager applet watch_4_interface_changes event timer cron name EVERY_MINUTE_CHECK cron-entry "0-59/1 * * * *" action 1.0 cli command "enable" action 2.0 cli command "event manager run track_interface" ! event manager applet track_interface event track 1 state down action 1.0 cli command "enable" action 2.0 cli command "event manager run tracked_action" ! event manager applet tracked_action event none maxrun 1860 action 1.0 cli command "enable" action 2.0 cli command "reload in 30" pattern "yes" action 2.5 cli command "n" pattern "confirm" action 3.0 cli command "y" action 4.0 cli command ""

!

I have looked at it too long and am lost in the weeds. Anyone have some ideas?

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

Why not simply track the interface state.  IF it goes down, start the 30 minute timer.  If it is allowed to hit 0, then reload.  If not, delete the applet.  For example:

event manager applet track_interface_down

event track 1 state down
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "event manager applet reload_count"
action 4.0 cli command "event timer countdown time 1800"
action 5.0 cli command "action 1.0 reload"
action 6.0 cli command "end"
!
event manager applet track_interface_up
event track 1 state up
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "no event manager applet reload_count"
action 4.0 cli command "end"
!
event manager applet on_reload
event syslog pattern "SYS-5-RESTART"
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "event manager applet reload_count"
action 4.0 cli command "event timer countdown 1800"
action 5.0 cli command "action 1.0 reload"
action 6.0 cli command "end"

View solution in original post

2 Replies 2

Joe Clarke
Cisco Employee
Cisco Employee

Why not simply track the interface state.  IF it goes down, start the 30 minute timer.  If it is allowed to hit 0, then reload.  If not, delete the applet.  For example:

event manager applet track_interface_down

event track 1 state down
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "event manager applet reload_count"
action 4.0 cli command "event timer countdown time 1800"
action 5.0 cli command "action 1.0 reload"
action 6.0 cli command "end"
!
event manager applet track_interface_up
event track 1 state up
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "no event manager applet reload_count"
action 4.0 cli command "end"
!
event manager applet on_reload
event syslog pattern "SYS-5-RESTART"
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "event manager applet reload_count"
action 4.0 cli command "event timer countdown 1800"
action 5.0 cli command "action 1.0 reload"
action 6.0 cli command "end"

Thank you Joseph - That worked perfectly for what we needed.