I have just started to study EEM and look into the amazing power this has. The script below I now use in production to monitor routing changes on the network. Any change to the routing table is instantly emailed to me, I am just working on tweaking this script as it does email every single change and I need to configure it to bundle all changes in a time period into one email
When I figure how to do this I will post the updated script.
event manager applet route-table-monitor
event routing network 0.0.0.0/0 ge 1
action 0.5 set msg "Route changed: Type: $_routing_type, Network: $_routing_network, Mask/Prefix:
$_routing_mask, Protocol: $_routing_protocol, GW: $_routing_lastgateway, Intf: $_routing_lastinterface"
action 1.0 syslog msg "$msg"
action 2.0 cli command "enable"
action 4.0 info type routername
action 5.0 mail server "(IP of Mail server)" to "(email address)" from "(device name)"
subject "Routing Table Change" body "$msg $_cli_result"
Just put this config into the device and ensure your mail server will relay mail and it will work a treat!
debug event manager action cli
If the script is not working as you expected you can use debug event manager action cli this will show you any errors with your script as it runs.