ltm rule command TMM cmp unit
iRule(1) BIG-IP TMSH Manual iRule(1)
TMM::cmp_unit
Returns the number (0-x) of the CPU executing the rule.
SYNOPSIS
TMM::cmp_unit
DESCRIPTION
This command returns the number (0-x) of the CPUs executing the rule.
Helpful if you believe one of the CPUs is doing something it shouldn't
and you want to isolate the issue rather than see an aggregate of all
CPUs. To determine the total number of TMM instances running, see the
TMM::cmp_count page. To determine which blade an iRule is current
executing on, see the TMM::cmp_group page.
Note that in versions v10.1.0 through v10.2.2 and v11.0.0, this command
is valid in all events except RULE_INIT. This limitation was removed in
v10.2.3 and v11.1.0 (ID 342860). You can work around this limitation as
shown in the example below.
Syntax
TMM::cmp_unit
RETURN VALUE
Returns the number (0-x) of the CPU executing the rule.
VALID DURING
ANY_EVENT
EXAMPLES
# Note this example won't work in 10.1.0 - 10.2.x
# as the iRule parser doesn't allow TMM::cmp_unit in RULE_INIT
when RULE_INIT {
# Check if we're running on the first CPU right now
if {[TMM::cmp_unit] == 0}{
# This execution is happening on the first TMM instance
# Conduct any initialization functionality just once here
log local0. "some code"
}
}
# Instead, you can use an alternate method to hide the TMM::cmp_unit
# command from the parser:
when RULE_INIT {
set tmm_cmd TMM::cmp_unit
# Check if we're running on the first CPU right now
if {[eval $tmm_cmd] == 0}{
# This execution is happening on the first TMM instance
# Conduct any initialization functionality just once here
log local0. "some code"
}
}
HINTS
SEE ALSO
CHANGE LOG
@BIGIP-10.1.0 --First introduced the command.
BIG-IP 2017-01-31 iRule(1)