Problem this snippet solves:
The following irule allows clients/users who do not have access to the load balancer to view the quick status of the pool assigned on a virtual server for troubleshooting. The code is reusable
Code :
when HTTP_REQUEST {
set response "<title>BIGIP Pool Status - [clock format [clock seconds]]</title><meta http-equiv="refresh" content="10; url=http://[HTTP::host]/status">"
if {[HTTP::uri] eq "/status" } {
foreach { selectedpool } [LB::server] {
pool $selectedpool
if { [active_members [LB::server pool] ] < 1 } {
set response "$response DOWN - $selectedpool"
} else {
set response "$response UP - $selectedpool"
}
}
HTTP::respond 200 content $response "Content-Type" "text/html"
}
}