Forum Discussion

Scot_85536's avatar
Scot_85536
Icon for Nimbostratus rankNimbostratus
Dec 02, 2008

matchclass using active members

Hi everyone!

 

 

This is my current irule:

 

 

when HTTP_REQUEST {

 

 

sets the timer to return client to host URL

 

set sectime 10

 

 

Use the Host header value for the responses if it's set. If not, use the VIP address.

 

if {[string length [HTTP::host]]}{

 

set host [HTTP::host]

 

} else {

 

set host [IP::local_addr]

 

}

 

 

Check if the URI is /maintenance

 

switch [HTTP::uri] {

 

"/maintenance" {

 

 

Send an HTTP 200 response with a Javascript meta-refresh pointing to the host using a refresh time

 

HTTP::respond 200 content \

 

"Maintenance page\

 

 

Sorry! This site is down for maintenance.

 

" "Content-Type" "text/html"

 

return

 

}

 

}

 

If the pool_testLB is down, redirect to the maintenance page

 

if { [active_members E1PD ] < 1 } {

 

HTTP::redirect "http://$host/maintenance"

 

return

 

}

 

}

 

 

I'm trying to rewrite it so it uses a data group list for the active_members pool. That way I don't have to have one rule for each pool, I can have a single irule and have it match the value in the data group list. I'm a noob to the F5 platform and irules, so any help or advice appreciated.
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    All you'd need to do is set up a datagroup list that associates some piece of request info (hostname, IP, etc) with the pool that request is going to be sent to. Once you have that the iRule code change is relatively trivial. You'd just perform a findclass to get the pool your request is going to go to, and then substitute that data for the "E1PD" in this example.

     

     

    Colin