members

Description

This command behaves much like active_members, but counts or lists all members (IP+port combinations) in a pool, not just active ones.

Note

When assigning a snatpool to static variable and using “members -list” to reference it in RULE_INIT, failures will be observed at startup but won’t show up in a reload afterwards. Expected behavior is to fail it in any case as “members -list” is not designed to reference a snatpool name.

Syntax

members [-list] <pool>

#v12 change to include QTYPE
members [-list] [QTYPE] <poolName> [blue green yellow red gray]

  • Returns the number of pool members.

  • Returns a list of the pool members.

Examples

when HTTP_REQUEST {
    set response "<?xml version=\"1.0\" encoding=\"utf-8\"?><rss version=\"2.0\"><channel>"
    append response "<title>BigIP Server Pool Status</title>"
    append response "<description>Server Pool Status</description>"
    append response "<language>en</language>"
    append response "<pubDate>[clock format [clock seconds]]</pubDate>"
    append response "<ttl>60</ttl>"
    if { [HTTP::uri] eq "/status" } {
        foreach { selectedpool } [class get pooltest] {
            set thispool [getfield $selectedpool " " 1]
            if {  [catch {
                if { [active_members $thispool] < 1 } {
                    append response "<item>"
                    append response "<title>$thispool status</title>"
                    append response "<description>$thispool is <b><font style=\"color:red\">DOWN</font></b></description>"
                    append response "</item>"
                } else {
                    append response "<item>"
                    append response "<title>$thispool status</title>"
                    append response "<description>$thispool is <b>UP</b></description>"
                    append response "</item>"
                    # Member Status Section for "UP" pools"
                    append response "<item><title>$thispool member status</title><description><!\[CDATA\["
                    foreach { pmem } [members -list $thispool] {
                        append response "Pool Member [join $pmem ":"] is [LB::status pool $thispool member [getfield $pmem " " 1] [getfield $pmem " " 2] ] <br></br>"
                    }
                    append response "\]\]></description></item>"
                    # End Member Status Section
                }
            } errmsg ] } {
                append response "<item>"
                append response "<title>$thispool ERROR</title>"
                append response "<description><b><font style=\"color:purple\">Invalid pool name: $thispool</font></b></description>"
                append response "</item>"
            }
        }
        append response "</channel>"
        append response "</rss>"
        log local0.info "$response"
        HTTP::respond 200 content $response "Content-Type" "text/xml"
    }
}