active_members

Description

Returns the number or list of active members in the specified pool.

Syntax

active_members <pool_name>
active_members -list <pool_name>

#qtype option added in v12
active_members [QTYPE] <pool_name>

active_members [QTYPE] <pool_name>

  • Returns the number of active members in the specified pool.

active_members -list <pool_name>

  • Returns a tcl list of lists, each containing the IP and port of an active member in the specified pool. (see output example below)
  • (The -list option was added in 9.4.2)
  • Note: GTM does not support the -list option

Examples

Test the number of active members in a pool when a client connects to the VIP:
when CLIENT_ACCEPTED {
  if { [active_members http_pool] >= 2 } {
    pool http_pool
  }
}

Test the number of active members in a pool when a client makes an HTTP request:
when HTTP_REQUEST {
  if { [active_members http_pool] >= 2 } {
    pool http_pool
  }
}

To retrieve a list containing the active members in a pool
when HTTP_REQUEST {
  set members [active_members -list http_pool]
  log local0. "Active members are: $members"
}

logs the following:
Active members are: {{192.168.1.1 80} {192.168.1.2 80}}