cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2598
Views
0
Helpful
18
Replies

Conditional reload after shutting & upping an interface

Boo
Level 1
Level 1

Is there an easier way to perform nested applet actions i.e how to achieve the outcome using  If/else statement in one applet rather nested applets?

event manager applet Shut-NoShut

event track 3 state down

action 10 cli command "en"

action 20 cli command "conf t"

action 30 cli command "interface fa0/0"

action 40 cli command "shut"

action 50 cli command "unshut"

action 60 wait xx

action 70 cli command "event manager applet Reload-Applet"

action 80 cli command "event track 3 state down"

action 90 cli command "end"

action 100 cli command "write memory"

action 110 cli command "action 1 reload"

action 120 cli command "end"

!
event manager applet Router-Up

event track 3 state up

action 10 cli command "en"

action 20 cli command "conf t"

action 30 cli command "no event manager applet Reload-Applet"

action 40 cli command "end"

action 50 cli command "write memory"

action 60 cli command "end"

!

event manager applet WatchDogApplet

event track 3 state down

event timer watchdog time 86400

action 1 syslog msg "Adding a timer to track and reload every 24 hours when there is no Internet"

action 2 reload

action 3 end

18 Replies 18

event manager applet WatchDogApplet

event timer watchdog time 86400

action 1 track read 3

action 2 if $_track_state eq "down" 

action 3 syslog msg "Watchdog applet - Router reload"

action 4 else

action 5 syslog msg "Watchdog timer will reset - No action required"

action 6 end

The Reload-Applet policy will not run until track 3 transitions from up to down.  Since the shut/no-shut happens before the policy is created, that would have no effect on it.  You'd need to do the shut/no-shut again.

Does this sound right to you ?

event manager applet Shut-NoShut

 event track 3 state down

 action 100.0 cli command "en"

 action 110.0 cli command "conf t"

 action 120.0 cli command "interface di0"

 action 130.0 cli command "shut"

 action 140.0 cli command "no shut"

 action 150.0 wait 10

 action 160.0 cli command "event manager applet Reload-Applet"

 action 170.0 cli command “int di0”

 action 180.0 cli command “shut” 

 action 190.0 cli command “no shut”

 action 200.0 cli command "event manager applet Reload-Applet"

 action 210.0 cli command "event track 3 state down"

 action 210.1 syslog msg "we are here"

 action 210.2 cli command "action 1 reload"

 action 210.3 cli command "end"

 action 220.0 cli command "write memory"

 action 221.1 cli command "end"

If you expect track 3 to transition to down on its own after registering Reload-Applet, then yes.  But I suspect you will find some better solutions to your problem if you carefully study How To Introduce Large Delays In EEM Policies .