groups:
- name: example-node-exporter-rules
  rules:
  # The count of CPUs per node, useful for getting CPU time as a percent of total.
  - record: instance:node_cpu_seconds_total:count
    expr: count(node_cpu_seconds_total{mode="idle"}) without (cpu,mode)

  # CPU in use by CPU.
  - record: instance_cpu:node_cpu_seconds_total:rate5m
    expr: sum(rate(node_cpu_seconds_total{mode!="idle"}[5m])) without (mode)

  # CPU in use by mode.
  - record: instance_mode:node_cpu_seconds_total:rate5m
    expr: sum(rate(node_cpu_seconds_total[5m])) without (cpu)

groups:
- name: example-node-exporter-rules
  rules:
  # The count of CPUs per node, useful for getting CPU time as a percent of total.
  - record: instance:node_cpu_seconds_total:count
    expr: count(node_cpu_seconds_total{mode="idle"}) without (cpu,mode)

  # CPU in use by CPU.
  - record: instance_cpu:node_cpu_seconds_total:rate5m
    expr: sum(rate(node_cpu_seconds_total{mode!="idle"}[5m])) without (mode)

  # CPU in use by mode.
  - record: instance_mode:node_cpu_seconds_total:rate5m
    expr: sum(rate(node_cpu_seconds_total[5m])) without (cpu)

  # CPU in use ratio.
  - record: instance:node_cpu_seconds_total_in_use:ratio
    expr: sum(instance_mode:node_cpu_seconds_total:rate5m{mode!="idle"}) / instance:node_cpu_seconds_total:count

Add a CPU in-use recording example.
Add a CPU in-use recording example.

Signed-off-by: Ben Kochie <9bbf917dc63fbaa40c67921332d26cf16a50db75@gmail.com>
