VIP 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?

Hi gclafiguera,

You can use external monitor, when x members is down.

https://devcentral.f5.com/s/question/0D51T00006r7c5xSAA/irule-to-disable-vip-with-less-then-x-members-a-pool

https://devcentral.f5.com/s/question/0D51T00006i7k0u/mark-a-vs-down-when-1-pool-member-is-down

…or you could use iCall. Following Jason’s post here - Disable Interface if Pool Member Availability Drops Below Threshold - Community CodeShare - DevCentral - An F5 Technical Community - 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
}

Hi,

Otherwise, set juste a maintenance page:

when LB_FAILED {
  if { [active_members [LB::server pool]] == 0 } {
  HTTP::respond 503 content [ifile get " maintenance.html"]}
  }

you can set the number of server down before activating your error page.

it’s dynamic and easier to set up.

Regards

Thank you.

Thanks you

Thanks