Skip to content

Commit a1ec6db

Browse files
authored
feat(dashboards): add "max allocatable" threshold to node (pods) (#1165)
1 parent 93e5db5 commit a1ec6db

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

dashboards/resources/node.libsonnet

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ local var = g.dashboard.variable;
8585
)
8686
+ prometheus.withLegendFormat('max capacity'),
8787

88+
prometheus.new(
89+
'${datasource}',
90+
'sum(kube_node_status_allocatable{%(clusterLabel)s="$cluster", %(kubeStateMetricsSelector)s, node=~"$node", resource="cpu"})' % $._config,
91+
)
92+
+ prometheus.withLegendFormat('max allocatable'),
93+
8894
prometheus.new(
8995
'${datasource}',
9096
'sum(max by (%(clusterLabel)s, %(namespaceLabel)s, pod, container)(node_namespace_pod_container:container_cpu_usage_seconds_total:sum_rate5m{%(clusterLabel)s="$cluster", node=~"$node"})) by (pod)' % $._config,
@@ -101,6 +107,15 @@ local var = g.dashboard.variable;
101107
+ fieldOverride.byName.withProperty('custom.stacking', { mode: 'none' })
102108
+ fieldOverride.byName.withProperty('custom.hideFrom', { tooltip: true, viz: false, legend: false })
103109
+ fieldOverride.byName.withProperty('custom.lineStyle', { fill: 'dash', dash: [10, 10] }),
110+
fieldOverride.byName.new('max allocatable')
111+
+ fieldOverride.byName.withPropertiesFromOptions(
112+
timeSeries.standardOptions.color.withMode('fixed')
113+
+ timeSeries.standardOptions.color.withFixedColor('super-light-red')
114+
)
115+
+ fieldOverride.byName.withProperty('custom.stacking', { mode: 'none' })
116+
+ fieldOverride.byName.withProperty('custom.hideFrom', { tooltip: true, viz: false, legend: false })
117+
+ fieldOverride.byName.withProperty('custom.lineStyle', { fill: 'dash', dash: [10, 10] })
118+
+ fieldOverride.byName.withProperty('custom.fillOpacity', 0),
104119
]),
105120

106121
table.new('CPU Quota')
@@ -184,6 +199,12 @@ local var = g.dashboard.variable;
184199
)
185200
+ prometheus.withLegendFormat('max capacity'),
186201

202+
prometheus.new(
203+
'${datasource}',
204+
'sum(kube_node_status_allocatable{%(clusterLabel)s="$cluster", %(kubeStateMetricsSelector)s, node=~"$node", resource="memory"})' % $._config,
205+
)
206+
+ prometheus.withLegendFormat('max allocatable'),
207+
187208
prometheus.new(
188209
'${datasource}',
189210
'sum(max by (%(clusterLabel)s, %(namespaceLabel)s, pod, container)(node_namespace_pod_container:container_memory_working_set_bytes{%(clusterLabel)s="$cluster", node=~"$node", container!=""})) by (pod)' % $._config,
@@ -200,6 +221,15 @@ local var = g.dashboard.variable;
200221
+ fieldOverride.byName.withProperty('custom.stacking', { mode: 'none' })
201222
+ fieldOverride.byName.withProperty('custom.hideFrom', { tooltip: true, viz: false, legend: false })
202223
+ fieldOverride.byName.withProperty('custom.lineStyle', { fill: 'dash', dash: [10, 10] }),
224+
fieldOverride.byName.new('max allocatable')
225+
+ fieldOverride.byName.withPropertiesFromOptions(
226+
timeSeries.standardOptions.color.withMode('fixed')
227+
+ timeSeries.standardOptions.color.withFixedColor('super-light-red')
228+
)
229+
+ fieldOverride.byName.withProperty('custom.stacking', { mode: 'none' })
230+
+ fieldOverride.byName.withProperty('custom.hideFrom', { tooltip: true, viz: false, legend: false })
231+
+ fieldOverride.byName.withProperty('custom.lineStyle', { fill: 'dash', dash: [10, 10] })
232+
+ fieldOverride.byName.withProperty('custom.fillOpacity', 0),
203233
]),
204234

205235
tsPanel.new('Memory Usage (w/o cache)')
@@ -211,6 +241,12 @@ local var = g.dashboard.variable;
211241
)
212242
+ prometheus.withLegendFormat('max capacity'),
213243

244+
prometheus.new(
245+
'${datasource}',
246+
'sum(kube_node_status_allocatable{%(clusterLabel)s="$cluster", %(kubeStateMetricsSelector)s, node=~"$node", resource="memory"})' % $._config,
247+
)
248+
+ prometheus.withLegendFormat('max allocatable'),
249+
214250
prometheus.new(
215251
'${datasource}',
216252
'sum(max by (%(clusterLabel)s, %(namespaceLabel)s, pod, container)(node_namespace_pod_container:container_memory_rss{%(clusterLabel)s="$cluster", node=~"$node", container!=""})) by (pod)' % $._config,
@@ -227,6 +263,15 @@ local var = g.dashboard.variable;
227263
+ fieldOverride.byName.withProperty('custom.stacking', { mode: 'none' })
228264
+ fieldOverride.byName.withProperty('custom.hideFrom', { tooltip: true, viz: false, legend: false })
229265
+ fieldOverride.byName.withProperty('custom.lineStyle', { fill: 'dash', dash: [10, 10] }),
266+
fieldOverride.byName.new('max allocatable')
267+
+ fieldOverride.byName.withPropertiesFromOptions(
268+
timeSeries.standardOptions.color.withMode('fixed')
269+
+ timeSeries.standardOptions.color.withFixedColor('super-light-red')
270+
)
271+
+ fieldOverride.byName.withProperty('custom.stacking', { mode: 'none' })
272+
+ fieldOverride.byName.withProperty('custom.hideFrom', { tooltip: true, viz: false, legend: false })
273+
+ fieldOverride.byName.withProperty('custom.lineStyle', { fill: 'dash', dash: [10, 10] })
274+
+ fieldOverride.byName.withProperty('custom.fillOpacity', 0),
230275
]),
231276

232277
table.new('Memory Quota')

0 commit comments

Comments
 (0)