Forum Discussion
Kiran_Kumar
Oct 12, 2022Nimbostratus
iRule: Pool selection based on percentage active members available
Anyone has an idea for below requirement. vip with 2 pools. Need to select primary pool if active members is greater than 10% of total pool members Else, select secondary pool. if both pools have ...
CA_Valli
Oct 13, 2022MVP
Hello,
I've used active_members and members function for this scope, plus some math expressions. Tested in BIG-IPv13
# note: round() returned closest integer value in my tests, so with 2 members in pool expression result was 0.2 which was rounded to 0. This is why i added +1 in expression. With >10 pool members I think math should work fine
# EDIT - note 2 : ceil() TCL command could be a better fit but I'm not sure iRule support this.
when CLIENT_ACCEPTED {
# log local0. "active members: [active_members primaryPool]"
# log local0. "total members: [members primaryPool]"
# log local0. "minimum req. members: [expr round([members primaryPool]*0.1)+1]"
# note: round() returned closest value in my tests, so with 2 members in pool expression result was 0.2 which was rounded to 0. This is why i added +1 in expression.
if { [active_members primaryPool] >= [expr round([members primaryPool]*0.1)+1] }{
pool primaryPool
} else {
pool secondaryPool
}
}
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