Forum Discussion

Glenn_32974's avatar
Glenn_32974
Icon for Nimbostratus rankNimbostratus
Oct 13, 2010

How to check pool availability whit-in an irule

This might be a simple question for you all but I was wondering if there's a way to re-direct traffic to a different pool in case Pool used with-in an irule declaration happens to be down?

 

 

Can you check for pool availability within the irule?

 

 

 

let say I have the following irule that directs traffic based on client ip address

 

 

What happenss in the event Pool_Global is down?

 

 

 

When CLIENT_ACCEPTED{

 

if {[IP::addr [IP::client_addr] eq "10.44.17.9" {

 

use pool Pool_Global

 

if pool Pool_Global is down...

 

use pool Pool_other

 

}

 

}

 

 

makes sense?

 

3 Replies

  • Hey Glenn,

     

     

    This can definitely be done. There are some neat examples in the LB::reselect page ( http://devcentral.f5.com/wiki/default.aspx/iRules/LB__reselect.html ) even. Depending on your version you can even do some nifty in-line monitoring with the LB::down and LB::up commands ( http://devcentral.f5.com/wiki/default.aspx/iRules/LB__down.html - http://devcentral.f5.com/wiki/default.aspx/iRules/LB__up.html ).

     

     

    Hope this helps a bit.

     

     

    // Ben

     

  • You can also check whether a pool has any active members using [active_members $pool_name]:

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/active_members

     

     

    Aaron
  • Hey Ben

     

     

    Thanks a lot for pointing the right direction. In consequence I was able to achieved pool member availability within the irule

     

     

     

    when CLIENT_ACCEPTED {

     

    switch [IP::client_addr] {

     

     

     

    "10.44.17.12" {

     

    if {[LB::status node 190.144.35.15] eq "up"}{

     

    rateclass Factura_Digital

     

    snatpool Factura_Electronica_aivmso_Telmex

     

    use pool Pool_Telmex

     

    log local0. "IP address : [IP::client_addr] - aivmso going out via [LB::server addr] Telmex!!! "

     

    } else {

     

    rateclass Factura_Digital

     

    snatpool Factura_Electronica_aivmso_Global

     

    use pool Pool_Global

     

    log local0. "IP address: [IP::client_addr] - aivmso going out via [LB::server addr] Global !!!"

     

    }

     

    }

     

     

    be safe!