Skip to content

Commit 49569b4

Browse files
committed
add recording rule for cluster:node_cpu:ratio_rate5m
1 parent d6f710f commit 49569b4

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

dashboards/resources/cluster.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ local template = grafana.template;
140140
})
141141
.addPanel(
142142
g.panel('CPU Utilisation') +
143-
g.statPanel('cluster:node_cpu:ratio{%(clusterLabel)s="$cluster"}' % $._config)
143+
g.statPanel('cluster:node_cpu:ratio_rate5m{%(clusterLabel)s="$cluster"}' % $._config)
144144
)
145145
.addPanel(
146146
g.panel('CPU Requests Commitment') +

dashboards/resources/multi-cluster.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ local g = import 'github.com/grafana/jsonnet-libs/grafana-builder/grafana.libson
2222
})
2323
.addPanel(
2424
g.panel('CPU Utilisation') +
25-
g.statPanel('cluster:node_cpu:ratio')
25+
g.statPanel('cluster:node_cpu:ratio_rate5m')
2626
)
2727
.addPanel(
2828
g.panel('CPU Requests Commitment') +

rules/node.libsonnet

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@
5252
) by (%(clusterLabel)s)
5353
||| % $._config,
5454
},
55+
{
56+
// This rule gives cpu utilization per cluster
57+
record: 'cluster:node_cpu:ratio_rate5m',
58+
expr: |||
59+
sum(rate(node_cpu_seconds_total{%(nodeExporterSelector)s,mode!="idle",mode!="iowait",mode!="steal"}[5m])) /
60+
count(sum(node_cpu_seconds_total{%(nodeExporterSelector)s}) by (%(clusterLabel)s, instance, cpu))
61+
||| % $._config,
62+
},
5563
],
5664
},
5765
],

0 commit comments

Comments
 (0)