Forum Discussion

andrew_witherid's avatar
andrew_witherid
Icon for Nimbostratus rankNimbostratus
Apr 19, 2017

Applying a health monitor with DNS returned IP address

HI all,

 

i am looking to monitor a Destination selection based upon a DNS lookup, our current setup takes a HTTP request, extracts the Destination URL and preforms a DNS lookup, once the IP is resolved we then fill in the destination IP address and release the Traffic, then wrapping it in TLS.

 

this as you can understand leaves the Virtual Server as unknown, i am being asked to add a Health monitor to the Virtual server that has no Pool attatched just the Following Irule

 

 

is there a way that i can Add a Health monitor to this I-rule that takes the IP address from the DNS lookup and then allow the Virtual Server to be marked as Green ? and therefor up when the destination is available ? and then down when the destination is unresolved ?

 

thanks in Advance

 

Andy

 

2 Replies

  • Hi,

    you can try with LB_FAILED event!!

    when HTTP_REQUEST {
        if {[HTTP::uri] starts_with http} { HTTP::uri [findstr [HTTP::uri] [HTTP::host] [string length [HTTP::host]]} 
       set ips [RESOLV::lookup -a [HTTP::host]]
    
        Check if the first list element was empty
       if {$ips eq ""}{
           Input wasn't an IP address, take some default action?
       } else {
           Select the IP 
          node [lindex $ips 0]
       }
    }
    
    when LB_FAILED {
         The node timed out... 
    }
    
  • Hi,

    Even if I gave you a solution, I think it is obviously not the best practice. create a pool with pool member is as easy as create a DNS record.

    The best solution is still to create pools with same name as host :

    tmsh create ltm pool www.company.com monitor tcp members add { www.company.com:443 { fqdn { name www.company.com autopopulate enabled } } } 
    

    then, use the following irule:

    when HTTP_REQUEST {
        if {[HTTP::uri] starts_with http} { HTTP::uri [findstr [HTTP::uri] [HTTP::host] [string length [HTTP::host]]} 
        if {[catch {pool [getfield [HTTP::host] ":" 1]}]} {
            HTTP::redirect "https://www.company.com/" 
        }
    }