09-02-2009 08:35 AM
There are instances that a particular event detector may trigger a policy multiple times within a short time-span. An example of this is if we are using the Interface ED to trigger a policy when the rxload passes a certain threshold. If we are polling every 10 seconds and the bandwidth spike is sustained for a minute then that would cause the policy to run 6 times within 60 seconds. In certain situations we would rather simply have the policy run once during the initial spike and not run again unless a certain length of time has passed. Is there a way we can configure a policy to run only a maximum of X number of times throughout a given time range?
Thanks for your help.
09-02-2009 08:37 AM
By default, there is only one thread allocated to the default scheduling queue. Therefore, only one policy will run concurrently. It depends on your version of IOS as to whether or not this can be changed.
09-02-2009 08:45 AM
Joe, thanks for such a quick response. We are running 12.4(24)T1 on most of our equipment. I guess my question is somewhat two-fold: 1)does eem queue policies to run if another policy is currently running, and 2)is there a way that we can limit this activity by timer
Using the example that I mentioned let's say that an event detector triggers a policy to run and then 10 seconds later the same event detector triggers the same policy to run again. We would prefer this policy to be limited to only running 1 time within a 60 second time frame.
09-02-2009 08:50 AM
No, the policies will queue up (you can see this with show event manager policy pending). You cannot control this based on time.
To solve your problem, you need to add code to your policies. I recommend using contexts to store the last execution time. For example:
set time [clock seconds]
context_save MYCTXT time
Then, at the top of your policy:
set now [clock seconds]
if { [catch {context_retrieve MYCTXT time} result] } {
set time $now
} else {
set time $result
}
if { [expr $now - $time] <= 60 } {
exit
}
09-02-2009 08:57 AM
Joe we appreciate your help. We will integrate this into the polices in question. Thanks again for all of your assistance.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide