Forum Discussion

George_33482's avatar
George_33482
Icon for Nimbostratus rankNimbostratus
Mar 10, 2012

iRule pool selection after checking

Hello,

 

 

Kindly i need some assistance to complete part of the iRule. i have a LC and i want to select a pool member based on source address. But first i want to check if the pool member is up before, otherwise i will select the whole default pool.

 

 

part of the iRule is:

 

 

when CLIENT_ACCEPTED {

 

if { [IP::addr [IP::client_addr] equals 10.10.10.10] } {

 

if {[check if the pool member 1.1.1.1 is up }{ ----------<<<<<< how to write it?

 

pool default_pool member 1.1.1.1

 

} else {

 

pool default_pool }

 

}

 

 

Do i need another function LB::SELECTED to make it work.

 

 

Regards,

 

George

 

 

 

 

6 Replies

  • can you try LB::status?

     

     

    LB::status wiki

     

    https://devcentral.f5.com/wiki/iRules.lb__status.ashx
  • Try something like:

    set p my_pool_name
    set m my_pool_member_ip:port
    if { [active_members $p] > "0" } {
        if { [lsearch -exact [active_members -list $p] $m] } {
          pool $p member $m
        } else {
          pool $p
        }
    }
    
  • Thank you. I will try the code.

     

    But while searching for every part of the line " if { [lsearch -exact [active_members -list $p] $m]" to understand it, I read that the option "list" in the active_member is not supportive in the GTM.

     

    Do you think LC also do not support this option?

     

     

    Regards,

     

    George
  • Hi Chris,

     

    Since i have a Link Controller, in which i faced a problem (a bug) when using the same node in multiple pool, so i cannot use the same node in multiple pool. I am trying to use the default_gateway pool and play on it.

     

    Otherwise, I could have created a pool including one node and check if this pool is up, without getting into this delimma

     

     

    All what i want is to check if a pool member is up in a Link controller license box....

     

     

    Regards,

     

    George
  • Hello,

     

     

    Thank you Ian, the code worked but i had a problem with the variable p and m and i had to reply them with there real names in the code.

     

     

    Anyway i appreciate everybody support.

     

     

    Regards,

     

    George