Forum Discussion
Charles_Harris
Nimbostratus
Dec 12, 2008Health Monitor Min Avail Members
Hi,
I've written a monitor for disabling all of a pool's members should a minimum number be unavailable (all disabled + session states) with the idea that it could be targeted to the po...
Ian_Smith
Dec 13, 2008Ret. Employee
When I need to provide this functionality, I use another virtual server (with an iRule that checks the minimum members requirement for the target pool) as the target for a monitor assigned to the pool rather than an external script. This approach has the advantage of using all organic mechanisms, of being supported by F5 support, and of no risk of an external script causing a system failure.
The example below assumes two different pools of 10 members (any service), one which has a 40% available members requirement and the other with 60% availability.
Assign the appropriate monitor to the pool and require all monitors - when the monitor fails, the virtual server is disabled and the route advertisement withdrawn from dynamic routing (if in use). When used in conjunction with GTM, the wideip will stop delivering the destination address of the virtual server.
The configuration of the additional virtual server that is used just for monitoring:
virtual vs_percent_avail {
destination 5.5.5.6:http
ip protocol tcp
vlans stealth enable
rules pool_percent_check
profiles
http
tcp
}
The irule applied to the additional virtual server:
(The positive answer when no members are available is required to let the other monitors fire when the minimum available members threshold hasn't been met.)
when HTTP_REQUEST {
switch -glob [http_uri] {
"/40" {
if { [active_members web_pool_secondary] == 0 } {
log local0. "40% check - no members in pool"
HTTP::respond 200 content "UP"
}
elseif { [active_members web_pool_secondary] >= 4 } {
log local0. "40% check good"
HTTP::respond 200 content "UP"
}
else {
HTTP::respond 503
}
}
"/60" {
if { [active_members web_pool_primary] == 0 } {
log local0. "60% check - no members in pool"
HTTP::respond 200 content "UP"
}
elseif { [active_members web_pool_primary] >= 6 } {
log local0. "60% check good"
HTTP::respond 200 content "UP"
}
else {
HTTP::respond 503
log local0. "60% check fail"
}
}
default {
HTTP::respond 503
log local0. "monitor check error [http_uri]"
}
}
}
A couple of monitors applied to pools with different minimum members requirements:
monitor pool_percent_40 {
defaults from http
dest 5.5.5.6:http
recv "UP"
send "GET /40"
}
monitor pool_percent_60 {
defaults from http
dest 5.5.5.6:http
recv "UP"
send "GET /60"
}
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