HA::status

Description

This iRules 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
HA::status standby

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.

Examples

when CLIENT_ACCEPTED {
    log local0. "active: [HA::status active]"
    log local0. "standby: [HA::status standby]"
}
# /var/log/ltm log output:
# <CLIENT_ACCEPTED>: active: 1
# <CLIENT_ACCEPTED>: 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]"
    }
}