Forum Discussion
Katherine_G_106
Nimbostratus
Nov 03, 2006Variable or function to return name of current pool?
Good afternoon,
I have been writing a few simple iRules & a call to F5 support directed me to DevCentral. This looks like a super resource!
Now for my question: I am working on a generic iRule that will redirect to a maintenance site if no members of the pool are active. So far it looks like this:
when HTTP_REQUEST {
if { [active_members p_mypool_http ] < 1 } {
HTTP::redirect http://my.maint.page.com
}
}
I want to apply this iRule to all of my virtual servers, but I don't want to duplicate it for every virtual server just beacuse the name of the pool is explicitly referenced (p_mypool_http in this case).
How can I retrieve & assign the name of the virtual server's current pool to a variable so that I can write one rule for all virtual servers?
thanks!
Katherine
- unRuleY_95363Historic F5 Account
This will return the currently selected or attached pool. You can then test it with:set curpool [LB::server pool]
if { [active_members $curpool] < 1} {
- the LB::server value will return the name of the currently selected pool. So you could write a generic iRule like this
when HTTP_REQUEST { if { [active_members [LB::server] ] < 1 } { HTTP::redirect http://my.maint.page.com } }
- Katherine_G_106
Nimbostratus
Thanks unRuleY! I will give this a shot! - unRuleY beat me to it...
- Katherine_G_106
Nimbostratus
Thanks for your help guys, this works perfectly!
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects