05-21-2012 07:05 PM
Hi- Please help out this newbie...
I am looking for an example EEM script/applet that would cause my router to change a path selection, based on a triggered event. I usually employ Policy Based Routing on my networks which makes next hop decisions based on the source IP. I want to do something similar with EEM, but rather than a simple source address based decision, I want a next hop selection to be based on an event. (for the example, it could be anything...bandwidth threshold, or at a certain time of day, or whatever). First I want to know if this can be done, and second I would appreciate it if someone could share a simple example configuration with me. -it's the best way I learn it.
Also, in the example, how is the applet or script applied to the router?
Thanks!
05-22-2012 12:09 AM
You can adjust routes or add class-maps based on EEM events. However, you can't match on something that can be controlled by an EEM event (i.e., match within a route-map). However, you can create a route-map on the fly when an event occurs. That is, when your event occurs, you can define a route-map to match on the interesting traffic and adjust the IP next-hop. Bottom line is if you can do something manually on the CLI, you can automate it with EEM.
Without knowing more specifics, I'll provide an example that will allow you to run CLI at a specific time (at midnight). You can adapt this to meet your specific needs. This applet can be copy and pasted directly into config t mode:
event manager applet timed-cli
event timer cron cron-entry "0 0 * * *"
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "route-map TEST"
action 4.0 cli command "match interface gi0/0"
action 5.0 cli command "set ip next-hop 10.1.1.1"
action 6.0 cli command "end"
05-22-2012 05:47 AM
That is great, thank you. Easy to follow. Next is a tcl script to do the same thing, but I'm not tcl savvy.
The event in your example is 'time of day'. Is there an overall list of EEM events that you can point me to?
05-22-2012 03:46 PM
It really depends on your version of IOS. If you have a new enough version, run:
show event manager detector all
That will give you a list of all events. If you then run:
show event manager detector DETECTOR detail
You can get more details about a specific event detector.
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