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!
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).