cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2498
Views
0
Helpful
5
Replies

Environment variables for use with EEM routing trigger?

9jlitton
Level 1
Level 1

I've only recently started looking into EEM, and was hoping a guru here could clear something up for me:

The docs do not show there to be any environment variables that can be used with EEM's "routing" trigger, to determine which route was added, changed, or modified.

It seems odd that the trigger would allow you to fire specifically on adds or removes, but then give you no indication of the specific route that was added or removed. Is this info in some non-obvious generic variable?

Or, is the only available approach to cache the route table, and then parse the whole table when the event fires? I haven't seen any examples that use this trigger; maybe because of this lack of any documented routing-specific variables?

Thanks in advance!

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

Every event detector has its own set of internal variables. These are different than environment variables. Environment variables are those you can modify in the config with "event manager environment". If you have a device which supports the routing event detector, you can run the command, "show event manager detector routing detailed" and that will show you all of the available internal variables.

I actually did a programmatic applet example using the oruting ED for my Networkers session this past year. This example doesn't use any of the internal variables, but it will give you an idea of how this ED works:

event manager applet route-watch

event routing network 10.1.1.0/24 type add protocol ospf

action 001 cli command "enable"

action 002 set done 0

action 003 while $done eq 0

action 004 wait 5

action 005 cli command "ping ip 10.1.1.1"

action 005 regexp "!!!!!" "$_cli_result"

action 006 if $_regexp_result eq 1

action 007 cli command "config t"

action 008 cli command "int Tunnel0"

action 009 cli command "shut"

action 010 cli command "end"

action 011 set done 1

action 012 end

action 013 end

This applet will be triggered when the route 10.1.1.0/24 is learned via OSPF. The applet will then try and ping 10.1.1.1, and when it is 100% successful, it will take down the backup tunnel interface. Because it may take a little while before the ping is 100% successful, the applet will loop until it gets a 100% success (or until the 20 second maxrun timer expires).

View solution in original post

5 Replies 5

Joe Clarke
Cisco Employee
Cisco Employee

Every event detector has its own set of internal variables. These are different than environment variables. Environment variables are those you can modify in the config with "event manager environment". If you have a device which supports the routing event detector, you can run the command, "show event manager detector routing detailed" and that will show you all of the available internal variables.

I actually did a programmatic applet example using the oruting ED for my Networkers session this past year. This example doesn't use any of the internal variables, but it will give you an idea of how this ED works:

event manager applet route-watch

event routing network 10.1.1.0/24 type add protocol ospf

action 001 cli command "enable"

action 002 set done 0

action 003 while $done eq 0

action 004 wait 5

action 005 cli command "ping ip 10.1.1.1"

action 005 regexp "!!!!!" "$_cli_result"

action 006 if $_regexp_result eq 1

action 007 cli command "config t"

action 008 cli command "int Tunnel0"

action 009 cli command "shut"

action 010 cli command "end"

action 011 set done 1

action 012 end

action 013 end

This applet will be triggered when the route 10.1.1.0/24 is learned via OSPF. The applet will then try and ping 10.1.1.1, and when it is 100% successful, it will take down the backup tunnel interface. Because it may take a little while before the ping is 100% successful, the applet will loop until it gets a 100% success (or until the 20 second maxrun timer expires).

Ahhh... I knew there had to be be more than I was seeing.

Thank you VERY much; that was exactly what I needed to know!

Is it also possible to use a default routing event like 0.0.0.0/0 and thus every change will trigger the event. But then store the changed route into a variable to be used in an action cli command?

 

regards

 

W

Yes.  The routing prefix will be stored in a variable, $_routing_prefix that you can feed into another action.  Look at "show event manager detector routing detail" for all of the available variables.

Thanks! found it!

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: