Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

First EEM script

                   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?


Everyone's tags (4)
Cisco Employee

First EEM script

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"

action 6.0 cli command "end"

New Member

First EEM script

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?

Cisco Employee

First EEM script

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.