cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1227
Views
0
Helpful
3
Replies

Reload Router max. once/24 hr while other actions will run all the time within an EEM applet

kiqbal0941
Level 1
Level 1

I have an EEM script which runs on a track when it goes down, within the actions i have different other things to check and take actions accordingly and they are working fine. I want to include a router reload within the same applet which should only trigger once within 24 hrs., no matter how many times the EEM runs during 24 hrs.

 

Here is my current applet:

 

event manager applet MyApplet authorization bypass
 event track 10 state down maxrun 3600
 action 1.0 cli command "enable"
 action 2.0 cli command "conf t"
 action 3.0 cli command "service internal"
 action 3.1 cli command "do test cellular 0 modem-power-cycle"
 action 3.2 cli command "no service internal"
 action 4.0 wait 720
 action 5.0 track read 10
 action 6.0 if $_track_state eq "down"
 action 6.1  cli command "int cell0"
 action 6.2  cli command "shut"
 action 6.3  cli command "controller cell 0"
 action 6.4  cli command "lte radio off"
 action 6.5  wait 60
 action 6.6  cli command "no lte radio off"
 action 6.7  cli command "int cell0"
 action 6.8  cli command "no shut"
 action 6.9 end
At the end i want to add another wait of 10 sec. and check the track state again, if it is still Down I want to trigger a reload, but when router comes back after reload and my EEM triggers again, i don't want to reload if the last reload was triggered within last 24 hrs.

 

 

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

What version of IOS is this?

c800-universalk9-mz.SPA.154-1.T.bin

The way you're using wait in this applet is not ideal.  It would be better, especially for the long wait, to have this broken up into multiple applets so that they can run asynchronously.  In fact, given what you want to do for this reload, that would be the better way to go.  If you configured a second applet at the end of this applet like:

 

event manager environment q "

!

action 7.0 cli command "event manager applet reload-countdown"

action 7.1 cli command "event timer countdown 10"

action 7.2 cli command "action 1.0 cli command enable"

action 7.3 cli command "action 2.0 cli command $q config t$q"

action 7.4 cli command "action 3.0 cli command $q no event manager applet reload-countdown$q"

action 7.5 cli command "action 4.0 cli command end"

action 7.6 cli command "action 5.0 cli command $q write mem$q"

action 7.7 cli command "action 1.0 reload"

 

Then you could have another applet that reacts to the tracked object coming up.  This applet would simply unconfigure the reload-countdown applet.  Thus, if the track comes back up, the reload will not happen.

Review Cisco Networking for a $25 gift card