Skip to content

Commit 6e8655a

Browse files
committed
dashboards/resources: add max CPU and memory capacity to node dashboards
Signed-off-by: paulfantom <[email protected]>
1 parent ef28541 commit 6e8655a

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

dashboards/resources/node.libsonnet

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,29 @@ local template = grafana.template;
4444
g.row('CPU Usage')
4545
.addPanel(
4646
g.panel('CPU Usage') +
47-
g.queryPanel('sum(node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate{%(clusterLabel)s="$cluster", node=~"$node"}) by (pod)' % $._config, '{{pod}}') +
48-
g.stack,
47+
g.queryPanel([
48+
'sum(kube_node_status_capacity{%(clusterLabel)s="$cluster", node=~"$node", resource="cpu"})' % $._config,
49+
'sum(node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate{%(clusterLabel)s="$cluster", node=~"$node"}) by (pod)' % $._config,
50+
], [
51+
'max capacity',
52+
'{{pod}}',
53+
]) +
54+
g.stack +
55+
{
56+
seriesOverrides: [
57+
{
58+
alias: 'max capacity',
59+
color: '#F2495C',
60+
fill: 0,
61+
hideTooltip: true,
62+
legend: true,
63+
linewidth: 2,
64+
stack: false,
65+
hiddenSeries: true,
66+
dashes: true,
67+
},
68+
],
69+
},
4970
)
5071
)
5172
.addRow(
@@ -72,9 +93,30 @@ local template = grafana.template;
7293
.addPanel(
7394
g.panel('Memory Usage (w/o cache)') +
7495
// Like above, without page cache
75-
g.queryPanel('sum(node_namespace_pod_container:container_memory_working_set_bytes{%(clusterLabel)s="$cluster", node=~"$node", container!=""}) by (pod)' % $._config, '{{pod}}') +
96+
g.queryPanel([
97+
'sum(kube_node_status_capacity{%(clusterLabel)s="$cluster", node=~"$node", resource="memory"})' % $._config,
98+
'sum(node_namespace_pod_container:container_memory_working_set_bytes{%(clusterLabel)s="$cluster", node=~"$node", container!=""}) by (pod)' % $._config,
99+
], [
100+
'max capacity',
101+
'{{pod}}',
102+
]) +
76103
g.stack +
77-
{ yaxes: g.yaxes('bytes') },
104+
{ yaxes: g.yaxes('bytes') } +
105+
{
106+
seriesOverrides: [
107+
{
108+
alias: 'max capacity',
109+
color: '#F2495C',
110+
fill: 0,
111+
hideTooltip: true,
112+
legend: true,
113+
linewidth: 2,
114+
stack: false,
115+
hiddenSeries: true,
116+
dashes: true,
117+
},
118+
],
119+
},
78120
)
79121
)
80122
.addRow(

0 commit comments

Comments
 (0)