Livius
Nov 06, 2017Altostratus
Check number of active pool members when HTTP request incoming to a VS contains a specific string
Hi,
I need to create an iRule which checks the number of active pool members if an incoming HTTP request contains "test" string and report either 200 or 400 error message based on pool availability. I was thinking about the following iRule code :
when HTTP_REQUEST {log local0. "HTTP request"
if { [HTTP::path] ends_with "test" } {
log local0. "HealthCheck - test_p got [active_members test_p] active members"
if {[active_members test_p] > 1 } {
HTTP::respond 200 content "OK"
} else {
HTTP::respond 404 "Not found"
TCP::close
event disable
}
}
}
Does that look OK ? is there any way to make it more generic, without specifying pool name, so I can apply it to multiple virtual servers?
Thanks in advance!