Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

EEM and cron polling

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?

Everyone's tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: EEM and cron polling

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"
2 REPLIES
Cisco Employee

Re: EEM and cron polling

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"
New Member

EEM and cron polling

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

873
Views
0
Helpful
2
Replies