Skip to content

Commit 3e6f4ce

Browse files
mixin: exclude iowait and steal from CPU Utilisation (#2194)
'iowait' and 'steal' indicate specific idle/wait states, which shouldn't be counted into CPU Utilisation. Also see prometheus-operator/kube-prometheus#796 and kubernetes-monitoring/kubernetes-mixin#667. Per the iostat man page: %idle Show the percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request. %iowait Show the percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request. %steal Show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor. Signed-off-by: Julian Wiedmann <[email protected]>
1 parent 2a28266 commit 3e6f4ce

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

docs/node-mixin/dashboards/node.libsonnet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ local gauge = promgrafonnet.gauge;
2323
.addTarget(prometheus.target(
2424
|||
2525
(
26-
(1 - rate(node_cpu_seconds_total{%(nodeExporterSelector)s, mode="idle", instance="$instance"}[$__rate_interval]))
26+
(1 - sum without (mode) (rate(node_cpu_seconds_total{%(nodeExporterSelector)s, mode=~"idle|iowait|steal", instance="$instance"}[$__rate_interval])))
2727
/ ignoring(cpu) group_left
28-
count without (cpu)( node_cpu_seconds_total{%(nodeExporterSelector)s, mode="idle", instance="$instance"})
28+
count without (cpu, mode) (node_cpu_seconds_total{%(nodeExporterSelector)s, mode="idle", instance="$instance"})
2929
)
3030
||| % $._config,
3131
legendFormat='{{cpu}}',

docs/node-mixin/rules/rules.libsonnet

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
||| % $._config,
1515
},
1616
{
17-
// CPU utilisation is % CPU is not idle.
17+
// CPU utilisation is % CPU without {idle,iowait,steal}.
1818
record: 'instance:node_cpu_utilisation:rate%(rateInterval)s' % $._config,
1919
expr: |||
20-
1 - avg without (cpu, mode) (
21-
rate(node_cpu_seconds_total{%(nodeExporterSelector)s, mode="idle"}[%(rateInterval)s])
20+
1 - avg without (cpu) (
21+
sum without (mode) (rate(node_cpu_seconds_total{%(nodeExporterSelector)s, mode=~"idle|iowait|steal"}[%(rateInterval)s]))
2222
)
2323
||| % $._config,
2424
},

0 commit comments

Comments
 (0)