Forum Discussion

Marcus_59536's avatar
Marcus_59536
Icon for Nimbostratus rankNimbostratus
Jun 04, 2010

Checking 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

  • 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
  • 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:

    See CLIENT_ACCPTED wiki entry at the bottom to see available commands within this event: http://devcentral.f5.com/wiki/default.aspx/iRules/CLIENT_ACCEPTED.html

    
    when CLIENT_ACCEPTED {
    if { [active_members [LB::server pool]] == 0 } {
    pool website_down_pool
    }
    }
    
  • To add, if the virtual is marked DOWN on purpose the active_members will still respond as active.

     

     

     

    Thanks

     

    Bhattman