Forum Discussion

Awkrd1_7470's avatar
Awkrd1_7470
Icon for Nimbostratus rankNimbostratus
Jan 11, 2012

Fallback to different VIP in iRule, need status checking and iRule exit

I used the example in a 2/15/2010 post "Fallback to different VIP in i-Rule" as a solution and it worked like a charm until the two VIPs (backing up each other) both lost all pool members. This caused an infinite loop of the i-Rule(s) due to no pool status checking and the LTM cored (9.4.8 HF4). I need to verify the pool members availability as a safe guard and exit the i-Rule if members are not available. What am I missing? The fail over is not working on the modified rule "Modified i-Rule with pool state check and exit to prevent looping". Thanks!

 

 

----------------------------------------------------------

 

Original i-Rule example from (2/15/2010)

 

when HTTP_REQUEST {

 

 

Check if currently selected pool has no active members

 

if {[active_members [LB::server pool]] == 0}{

 

 

Use the fallback VIP

 

 

virtual fallback_vip

 

}

 

}

 

-----------------------------------------------------------

 

My original modified i-Rule implemented across two VIPs (backing up each other), worked fine until both pool are down; causing LTM to core in infinite loop. }

 

 

rule Name {

 

when CLIENT_ACCEPTED {

 

 

Check if currently selected pool has no active members

 

if {[active_members [LB::server pool_A]] == 0}{

 

 

Use the fallback VIP

 

virtual fallback_vip_B

 

}

 

}

 

}

 

 

-----------------------------------------------------------

 

Modified i-Rule with pool state check and exit to prevent looping

 

 

rule name {

 

when CLIENT_ACCEPTED {

 

 

Check if currently selected pool has no active members

 

if {[active_members [LB::server pool_A]] == 0}{

 

 

Check if the fallback VIP has active members

 

extra if prevents looping

 

if {[active_members [LB::server Pool_B]] > 0}{

 

 

Use the fallback VIP

 

virtual fallback_vip_B

 

 

take corrective step

 

} else {

 

discard

 

}

 

}

 

}
  • can you try this?

    when CLIENT_ACCEPTED { 
       if {[active_members pool_A] == 0}{ 
          if {[active_members Pool_B] > 0}{ 
             virtual fallback_vip_B 
          } else { 
             discard 
          } 
       } 
    }
    
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Running active_members on LB::server Pool_B isn't going to get you the result you want. Like nitass showed above, the active_members command is best called against a pool directly. It returns the number of members currently active in a given pool, so it needs the actual pool name as an input.

     

     

    Colin
  • Thanks guys! This works.

     

     

    when CLIENT_ACCEPTED {

     

     

    Check if currently selected pool has no active members

     

    if {[active_members Pool A ] == 0}{

     

     

    Check if the fallback VIP has active members

     

    extra if prevents looping

     

    if {[active_members Pool B] > 0}{

     

     

    Use the fallback VIP

     

    virtual fall_back_vip_B

     

     

    take corrective step

     

    } else {

     

    discard

     

    }

     

    }

     

    }