ltm rule command active members
iRule(1) BIG-IP TMSH Manual iRule(1)
active_members
Returns the number or list of active members in the specified pool.
SYNOPSIS
active_members ('-list')? POOL_OBJ
DESCRIPTION
Returns the number or list of active members in the specified pool.
RETURN VALUE
active_members
Returns the number of active members in the specified pool.
active_members -list
Returns a tcl list of lists, each containing the IP and port of an
active member in the specified pool. (see output example below)
Note: GTM does not support the -list option
VALID DURING
DNS_REQUEST GLOBAL_GTM LB_FAILED LB_SELECTED
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}}
HINTS
SEE ALSO
CHANGE LOG
@BIGIP-9.0.0 --First introduced the command. @BIGIP-9.2.2 --First
introduced the command. @BIGIP-9.4.1 --Introduced -list switch
BIG-IP 2017-01-31 iRule(1)