ltm rule command HA statusΒΆ

iRule(1)						BIG-IP TMSH Manual						  iRule(1)

HA::status
       Returns true or false based on whether the unit the command is executed on is active or standby.

SYNOPSIS
       HA::status (active | standby)

DESCRIPTION
       This iRule command returns true or false based on whether the unit the command is executed on is active or standby in the
       context of the command used. The primary use-case is for iRules that utilize sideband or HSL commands. This can be used to
       prevent the standby from opening extra connections.  A Virtual IP (VIP) is bound to a Traffic Group, which handles failover
       for the VIP. A unit can, at the same time, be "active" for one traffic-group and "standby" for a different traffic-group.
       This command will return the correct value for the unit's active/standby state based on the traffic-group state that
       handles the VS to which the iRule is bound.

       Syntax

       HA::status active

	    * Returns 1 (true) if the unit is currently active and 0 (false) if
	      the unit is currently standby

       HA::status standby

	    * Returns 1 (true) if the unit is currently standby and 0 (false) if
	      the unit is currently active. This will only be relevant in the
	      case where mirroring is active for the VS; otherwise an iRule won't
	      execute on a standby unit.

RETURN VALUE
       HA::status active

	    * Returns 1 (true) if the unit is currently active and 0 (false) if
	      the unit is currently standby

       HA::status standby

	    * Returns 1 (true) if the unit is currently standby and 0 (false) if
	      the unit is currently active. This will only be relevant in the
	      case where mirroring is active for the VS; otherwise an iRule won't
	      execute on a standby unit.

VALID DURING
       ANY_EVENT, except RULE_INIT

EXAMPLES
	when CLIENT_ACCEPTED {
	    log local0. "active: [HA::status active]"
	    log local0. "standby: [HA::status standby]"
	}
	# /var/log/ltm log output:
	# : active: 1
	# : standby: 0

	when HTTP_REQUEST {
	    if { [HA::status active] } {
		set hsl [HSL::open -publisher "publisher-customer-abc"]
		HSL::send $hsl "[IP::client_addr] -> [HTTP::host]/[HTTP::path]"
	    }
	}

HINTS
SEE ALSO
CHANGE LOG
       @BIGIP-11.4.0 --First introduced the command.

BIG-IP							    2022-04-12							  iRule(1)