cpu

Description

The cpu usage command returns the average TMM cpu load for the given interval. All averages are exponential weighted moving averages over the interval.

Syntax

cpu usage [1sec | 5secs | 15secs | 1min | 5mins | 15mins | all_seconds | all_minutes]

cpu usage [1sec | 5secs | 15secs | 1min | 5mins | 15mins | all_seconds | all_minutes]

  • Returns the average TMM cpu load for the given interval

Examples

when HTTP_REQUEST {
  if{ [cpu usage 5sec] <= 1} {
    pool1
  } else {
    HTTP::redirect "http://anotherpool.com"
  }
}

when RULE_INIT {
    foreach slice [split "1sec|5secs|15secs|1min|5mins|15mins|all_seconds|all_minutes" "|"] {
        log local0. "\[cpu usage $slice\]: [cpu usage $slice]"
    }
}

# Log output (from an unloaded LTM unit):

[cpu usage 1sec]: 0
[cpu usage 5secs]: 0
[cpu usage 15secs]: 0
[cpu usage 1min]: 0
[cpu usage 5mins]: 0
[cpu usage 15mins]: 0
[cpu usage all_seconds]: 0 0 0
[cpu usage all_minutes]: 0 0 0