Forum Discussion
gclafiguera
Nimbostratus
Oct 08, 2019VIP to go offline if 50% of servers behind it is down
Is there a way to configure a BIG-IP LTM to turn a VIP offline if 50% of the servers behind it goes down?
iaine
Nacreous
Oct 08, 2019...or you could use iCall. Following Jason's post here - https://devcentral.f5.com/s/articles/disable-interface-if-pool-member-availability-drops-below-threshold - you can modify his code slightly to something like
## Script ##
sys icall script poolCheck.v1.0.0 {
app-service none
definition {
set pn "/Common/my_pool"
set vip "/Common/my_vip"
set total 0
set usable 0
foreach obj [tmsh::get_status /ltm pool $pn detail] {
#puts $obj
foreach member [tmsh::get_field_value $obj members] {
#puts $member
incr total
if { [tmsh::get_field_value $member status.availability-state] == "available" && \
[tmsh::get_field_value $member status.enabled-state] == "enabled" } {
incr usable
}
}
}
if { [expr $usable.0 / $total] <= 0.5 } {
tmsh::log "Not enough pool members in pool $pn, VIP $vip disabled"
tmsh::modify /ltm virtual $vip disabled
} else {
tmsh::log "Enough pool members in pool $pn, VIP $vip enabled"
tmsh::modify /ltm virtual $vip enabled
}
}
description none
events none
}
## Handler ##
sys icall handler periodic poolCheck.v1.0.0 {
first-occurrence 2014-09-16:11:00:00
interval 60
script poolCheck.v1.0.0
}
gclafiguera
Nimbostratus
Oct 08, 2019Thanks you
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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