TMM::cmp_group

Description

This command returns the number (0-x) of the group of the CPU currently executing the rule. Typically, a group refers to the blade number on a chassis system, and is always 0 on other platforms. New meanings may be added for future platform architectures.
This is helpful if you believe one CPU 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 the CPU ID an iRule is current executing on within a blade, see the TMM::cmp_unit page.
Note that use of this command in the RULE_INIT event is restricted by the validator in versions prior to v10.2.3 and v11.1.0 (ID342860). It is valid in all other events, and this limitation can be worked around in prior versions, as shown in an example below.

Syntax

TMM::cmp_group

Examples

# Note this example won't work in 10.1.0 - 10.2.2 and 11.0.x
# as the iRule parser doesn't allow these commands in RULE_INIT
when RULE_INIT {

   # Check if we're running on the first CPU right now
   if { [TMM::cmp_unit] == 0 && [TMM::cmp_group] == 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
# and TMM::cmp_group commands from the parser:
when RULE_INIT {

   set tmm_unit_cmd TMM::cmp_unit
   set tmm_group_cmd TMM::cmp_group
   # Check if we're running on the first CPU right now
   if {[eval $tmm_unit_cmd] == 0 && [eval $tmm_group_cmd] == 0}{
      # This execution is happening on the first TMM instance
      # Conduct any initialization functionality just once here
      log local0. "some code"
   }
}