ā10-18-2016 10:46 PM
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
ā10-19-2016 07:11 AM
Its strange that I can't have both event state track and watchdog timer in one applet ?
Router is accepting both the state track and watch dog time, however when I do show run, track state is gone .. If I chnage the sequence while adding i.e., insert state track first and then watchdog, state track will be gone or if I do watchdog and then state track, watch dog is gone from the applet.
Any way to work around this ?
ā10-19-2016 07:52 AM
EEM policies historically have only had one event. Multiple event support was added in EEM 2.4, but you need a slightly different syntax. For example, to configure a policy with two events where either event can happen to trigger the policy:
event tag e1 timer watchdog time 60
event tag e2 track 3 state down
trigger
correlate event e1 or event e2
ā10-19-2016 11:59 PM
Mine should definitely support multiple events, as a matter of fact my router was supporting until last night.
Embedded Event Manager Version 3.10
Component Versions:
eem: (v310_throttle)4.1.23
eem-gold: (v310_throttle)1.0.7
eem-call-home: (v310_throttle)1.0.6
ā10-20-2016 06:00 AM
2 Issues.
1) action 110 cli command "action 1 reload"
Throws an error and doesn't reload the router ?
2)The below command doesn't do anything.
When the state is down it doesn't even print the message?
event manager applet WatchDogApplet
event tag e1 timer watchdog time 60
event tag e2 track 3 state down
trigger correlate event e1 or event e2
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
Sorry for being a newbie :)
ā10-20-2016 06:16 AM
action 110 is being run when in EXEC mode, so of course it's not going to do anything other than generate an error. You need to relabel it action 85 to work with your current flow.
The trigger command needs to be entered on its own. That will put you in trigger sub-mode where you configure the correlation. Then, when the track transitions to a down state, that applet should execute.
ā10-20-2016 06:31 AM
Thanks for the prompt reply, if action 85 is to reload, then the router will not have enough time to write mem ?
Actually I had the trigger command on its own and I was in the sub mode. It was just a formatting mistake.
(config-applet-trigger#)
I actually had it like this
event manager applet WatchDogApplet
event tag e1 timer watchdog time 60
event tag e2 track 3 state down
trigger
correlate event e1 or event e2
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
ā10-20-2016 06:55 AM
Moving the action should not interrupt write mem unless the tracked object goes down the moment you leave config mode.
This applet looks fine. Provided the tracked object actually transitions state to down, then it should run. Of course, it will run automatically 60 seconds arfter it's registered.
ā10-20-2016 07:12 AM
When you say the applet will run automatically 60 seconds after it's registered. Did you mean the watchdog timer will reset every 60s and reloads the router or did you mean to say the timer will reset but however the actions will only be executed if the tracked objects state goes down?
FYI: I am trying to achieve the later result.
ā10-20-2016 07:19 AM
The applet will execute either when the tracked object goes down (not if it's already down) or when 60 seconds goes by after the applet is registered.
ā10-20-2016 07:36 AM
Is there any way I can add a Boolean or so that the it will only get executed after the timer expires but only if the track object is down, if it's not down then the timer should simply reset back and start counting down.
ā10-20-2016 07:41 AM
In this case, you should probably just use the watchdog timer event, and add a track read action and actions to test to see if it's down:
track read 3
if $_track_state eq "down"
reload
end
ā10-20-2016 07:48 PM
event manager applet Shut-NoShut
event track 3 state down
action 1.0 cli command "en"
action 2.0 cli command "conf t"
action 3.0 cli command "interface di0"
action 4.0 cli command "shut"
action 5.0 cli command "no shut"
action 6.0 wait 10
action 7.0 cli command "event manager applet Reload-Applet"
action 8.0 cli command "event track 3 state down"
action 8.1 syslog msg "we are here"
action 8.2 cli command "action 1 reload"
action 9.0 cli command "end"
action 9.1 cli command "write memory"
action 9.3 cli command "end"
event manager applet Reload-Applet
event track 3 state down
action 1 reload
Now the "event manager applet Reload-Applet" accepts the reload action,
however after shutting and no shutting it's not reloading the router?
ā10-20-2016 09:16 PM
When you say read the track - how do you suggest I do that.
track read 3 is not a valid command under (config-applet)
I can check if $_track_state eq "down" - NO issues here.
ā10-21-2016 09:10 AM
track read is an action, just like "if" and "cli". You need to precede "track read" with action and a label.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: