Pool status page on a virtual server

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 "BIGIP Pool Status - [clock format [clock seconds]]" 
 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"
 }  
}
Published Mar 18, 2015
Version 1.0
No CommentsBe the first to comment