cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1798
Views
0
Helpful
16
Replies

EEM time-based applet suppression

lyranvolcrane
Level 1
Level 1

Our company is trying to implement a time-based WAN failover schedule. We want to use EEM for this purpose and have created some applets with syslog event detectors to fire off various shutdown commands on the router when site router detects it's BGP peer go down, and suppress the failover event if it is after 9pm local time to the router.

Now I was thinking about approaching this from various angles, but one of the most promising angles requires a few question.

First, is there any way to parse the system time for conditional statement for the execution of the failover, basically forcing an "action if goto" conditional to skip to the last action of the applet instead of going through with the various no shut commands necessary to bring up the backup WAN link.

Second, I was thinking about using the applets to define a variable i.e. variable = 1 (when the BGP peer is down), variable = 0 (when the BGP peer is up). But there are a couple of applets that would use this, so I was wondering if the variables defined in a given applet are considered local variables, and are cleared from memory once the applet actions are completed (after the event detector finishes executing the actions that caused the applet to start in the first place), or are they global variables that stay in RAM persistently, and can be referenced by other applets if needed. I am hoping that they are global and persistent, or if there is such a thing that can be modified by an EEM applet so I can use that feature. My purpose for having this global variable is to have another EEM applet run at 8AM every morning to check to see if the BGP peer is still down, and if so it will automatically fire off the failover commands manually, which should have been supressed when the other applet I mentioned would fire.

I cannot imagine this is a difficult script, I am trying to find, and define the various mechanisms within the framework of the EEM system.

I will be more than happy to explain in detail what our goals are if anything is unclear. Thanks for any responses in this regard.

16 Replies 16

Your solution for the NTP issue could be solved more easily. This one line could take the place of your trim statements:

action 005 regexp "^[\\.\\*]?([0-9]+):" "$_string_result" ignore hours

You come through again!

I kept experimenting with various regex patterns, and my rusty regex skills couldn't cut it. I apologize for your having to as much time into this as you have. Everything is working smoothly, and the regex pattern did the trick.

I really appreciate everything done. You wrote 95 percent of the code for me, and I cannot possibly thank you enough.

Getting Started

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: