I'm looking at this EEM feature for the first time and I think it can solve a problem that I have. I would prefer to find a way to fix my problem with a CLI script over a TCL, but will take what I can get.
I have an MPLS network and want to backup one of my sites with a GRE/IPSEC tunnel on a different ISR router. Because of the way OSPF works and other factors, I cannot leave the tunnel0 interface up when my MPLS network is up too. Some routes will be preferred over the tunnel, and some over the MPLS router. No amount of changing metrics can fix that. So for now, I leave the tunnel interface shutdown and only bring it up manually if there is an outage.
I'd like to automate that procedure of bringing up the tunnel interface with EEM if it's possible. Is there a sample config somewhere which looks for a particular event, like a routing table change, and brings up the tunnel? Or a way to ping an external IP through an interface on the MPLS network, and if it goes down, issue that 'no shutdown' on the tunnel interface?
Of course, I'd need the reverse to put the tunnel back down too. Is this what EEM is used for?