12-16-2015 03:46 AM
Hi,
I have a setup today where we are testing reachability of a service through the IP SLA TCP connect probe. This is done towards an IP address, straight forward so far. Unfortunately they ISP will not be able to provide a static IP in the future which means that we won't know the IP address of the service we are testing.
We wanted to solve this by supplying a FQDN to the IP SLA probe instead but unfortunately it seems it resolves the FQDN directly and then enters an IP address in the TCP connect command. Not very elegant! This of course means that the probe would not be aware of any changes to the hostname -> IP address mapping.
Is it possible to solve this with EEM or TCL in some way? One option I was thinking of was to do a ping towards the hostname and then check what IP address it resolves to. If the IP address has changed then update the TCP connect command. It's a bit beyond my scripting capabilities though. Is this possible in EEM or would this require TCL?
Someone mentioned to me that IOS will cache answers to queries for four hours which would not work well in this situation obviously. Maybe it's possible to clear the cache to make sure that the query contains fresh information?
Thankful for any input the community can provide.
Solved! Go to Solution.
12-16-2015 01:27 PM
You can clear the cache using "clear host *". So you could automate this using an applet that runs, for example, every 10 minutes:
event manager applet get-ip
event timer watchdog time 600
action 001 cli command "enable"
action 002 cli command "clear host *"
action 003 cli command "ping ip HOST repeat 1"
action 004 regexp "Echos to ([0-9\.]+)" $_cli_result match ip
action 005 puts "Do what you want with $ip now"
12-16-2015 01:27 PM
You can clear the cache using "clear host *". So you could automate this using an applet that runs, for example, every 10 minutes:
event manager applet get-ip
event timer watchdog time 600
action 001 cli command "enable"
action 002 cli command "clear host *"
action 003 cli command "ping ip HOST repeat 1"
action 004 regexp "Echos to ([0-9\.]+)" $_cli_result match ip
action 005 puts "Do what you want with $ip now"
12-16-2015 01:58 PM
Thanks, Joe!
I got a similar reply from a Cisco SE. You had the timer included as well which I will need to use.
Do you think that resolving a hostname every minute or so could cause any CPU issues?
12-16-2015 02:11 PM
No, shouldn't be an issue with a minute interval.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide