- Purple, 4500 points or more
Is it possible to create an applet that would monitor a remote ip address and then perform an action based on that reachability?
What I have is something like this:
I want to be able to monitor RTRC's reachability to RTRD, but I need to do it from RTRB. You can't see it above, but RTRA also connects to RTRD. If RTRB can't get to RTRD through RTRC, I want RTRB to apply a policy map in the direction of RTRA because traffic will get redirected. I'll also need RTRA to apply a policy map back in the direction of RTRB. Is this possible to do, or is there a better way of doing that?
I've got a script working that monitors the interface on RTRC, but RTRA would still need to know when RTRC can't get to RTRD somehow.
I went ahead and coded an example Tcl policy to do what you want. It will run every 60 seconds, and poll the latest operational state of an IP SLA collector on a remote device. It requires a few environment variables. For example:
event manager environment check_ipsla_ip 10.1.1.1
event manager environment check_ipsla_comm public
event manager environment check_ipsla_index 117
event manager environment check_ipsla_cmds config t;interface fa0/0;ip policy route-map redirect
In this example, the device 10.1.1.1 will be polled with a community string of public. The IP SLA collector on the device is configured with index 117. The commands to be run are separated with semi-colons. More help is available in the script header.
The show event manager version command was not introduced until EEM 2.4 (e.g. 12.4(20)T). Before that, you just had to know. 12.4 mainline includes EEM 2.1. 12.4(2)T includes EEM 2.2, 12.4(11)T comes with EEM 2.3.
If you setup an IP SLA collector on RTRC that tested the required reachability to RTRD, then you could have an EEM applet policy on RTRB which used SNMP to poll the IP SLA Collector state on RTRC. If the collector went down, then you could have RTRB apply the necessary policy map.
However, RTRA wouldn't know about that unless it, too was watching the collector state on RTRC. If you actually wanted RTRB to connect to RTRA, that is possible using EEM, but only with Tcl. RTRA could easily run the same applet as RTRB, though.
The only requirements would be that RTRC supports IP SLA source operations, and that both RTRA and RTRB are IOS devices capable of supporting EEM 2.1 or higher.