Brian_Deitch_11
Sep 22, 2011Historic F5 Account
Dynamic query of all pools
I'm working on a dynamic iRule that will load balance based on the URI. I have that part working fine but the pool selection deviates from our standard. I need to figure out how I can query all the pools that are on the LTM so I can select the right pool.
This is the iRule in question:
when HTTP_REQUEST {
Grab the 1st folder after the hostname
set lbfolder [string tolower [URI::path [HTTP::uri] 1 1]]
Strip out the "/"
set lbfolder pool_[string trim $lbfolder "/"]
log local0. "testing01 $lbfolder"
if { [catch {pool $lbfolder} exc] } {
If a client sends a uri that does not match a pool, send to default pool or throw message
pool default
HTTP::respond 200 content "No matching pool for that URI"
}
}
As you can see, the current irule construct the pool selection by pool_URI but I need to get pool_URI_port. I'm hoping I can create a dynamic class of all the pool members, match lbfolder to the class and select the correct pool from there.
Thanks in advance.