Pool Member Status HTML5 Page
Problem this snippet solves:
This allows a publicly accessible status page of Pools and Pool Members. No cron job is needed.
How to install:
If you only have one pool, you will probably have ...
Updated Sep 20, 2022
Version 2.0LoyalSoldier
Altostratus
Joined September 14, 2020
LoyalSoldier
Altostratus
Joined September 14, 2020
Maneesh_72711
Apr 14, 2017Cirrostratus
when HTTP_REQUEST { IP Block. Allow specific users/groups to access the status page. if { [IP::addr [IP::client_addr] equals 10.0.0.0/8 ] } { if { [HTTP::uri] eq "/servicexml" } { set response "\r\n"
Code to display inactive pools in XML Format
append response "\r\n"
append response "Inactive\r\n"
foreach { selectedpool } [class get test] {
set thispool [getfield $selectedpool " " 1]
if { [catch {
if { [active_members $thispool] < 1 } {
Pool Status for pools with no active members
append response "$thispool\r\n"
} else {
Skip
}
} errmsg ] } {
append response "$thispool: ERROR: Invalid pool name\r\n"
}
}
End XML containing "F5 Locations" and "Critical" sections.
Code to display active pools in XML Format
append response "Active\r\n"
foreach { selectedpool } [class get test] {
set thispool [getfield $selectedpool " " 1]
if { [catch {
if { [active_members $thispool] < 1 } {
Pool Status for pools with no active members
Skip. This is implemented above in the first table.
} else {
Pool Status
append response "$thispool\r\n"
Pool Member Status Section
foreach { pmem } [members -list $thispool] {
append response "$pmem\r\n"
set nodestatus "[LB::status pool $thispool member [getfield $pmem " " 1] [getfield $pmem " " 2]]"
if {$nodestatus == "up"} {
append response "Up\r\n"
} elseif {$nodestatus == "down"} {
append response "Down\r\n"
} elseif {$nodestatus == "session_disabled"} {
append response "Disabled\r\n"
} else {
append response "$nodestatus\r\n"
}
set nodestatus null
}
}
} errmsg ] } {
append response "$thispool: ERROR: Invalid pool name\r\n"
}
}
append response "\r\n"
End Pool Member Status Section
HTTP::respond 200 content $response "Content-Type" "text"
}
} }