Forum Discussion
Marcus_59536
Nimbostratus
Jun 04, 2010Checking if pool is up before using LB::SELECT in HTTP_REQUEST
I was wondering if there is any way to check if the virtual server is up before implementing LB::SELECT inside of an HTTP_REQUEST event of an iRule?
code:
when HTTP_REQUEST {
if { [HTTP::uri] eq "/troubleshoot" } {
[LB::SELECT]
}
}
Works when the virtual server is up, it errors out when the virtual server is down.
Thanks
Thanks
5 Replies
- Michael_Yates
Nimbostratus
Sure. You can do that.when HTTP_REQUEST { if { [active_members mypool] == 0 } { HTTP::redirect "http://www.google.com" } else { do something... } }
- Marcus_59536
Nimbostratus
How do I find the value of "mypool" before doing a load-balancing decision (or how can I handle this situation otherwise)? I want all of the variables of this connection to be filled in dynamically when the users triggers this iRule. i.e. virtual name, status if available pool name, status member names, status - Michael_Yates
Nimbostratus
If you want to be more dynamic you will have to go up a level and check in the CLIENT_ACCEPTED, doing is a bit more restrictive on what you can do though (HTTP::redirect is no longer available), but you can verify that the pool has members, if so it will pass through and you can do your LB::select in the when HTTP_REQUEST event. If no pool members are available, you route them somewhere else before the HTTP_REQUEST event and no further iRule processing is done:when CLIENT_ACCEPTED { if { [active_members [LB::server pool]] == 0 } { pool website_down_pool } }
- The_Bhattman
Nimbostratus
To add, if the virtual is marked DOWN on purpose the active_members will still respond as active. - Marcus_59536
Nimbostratus
Thanks, thats exactly what I needed
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