cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2104
Views
5
Helpful
3
Replies

IP SLA TCP connect towards FQDN - EEM or TCL required?

daniel.dib
Level 7
Level 7

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.

Daniel Dib
CCIE #37149
CCDE #20160011

Please rate helpful posts.
1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

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"

View solution in original post

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

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"

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?

Daniel Dib
CCIE #37149
CCDE #20160011

Please rate helpful posts.

No, shouldn't be an issue with a minute interval.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: