Read config from $

Signed-off-by: Johannes 'fish' Ziemke <github@freigeist.org>
This commit is contained in:
Johannes 'fish' Ziemke 2021-07-20 17:39:52 +02:00
parent 3731f93fd7
commit 7fc5c6045a

View file

@ -22,18 +22,6 @@ local datasourceTemplate = {
type: 'datasource', type: 'datasource',
}; };
local clusterTemplate =
template.new(
name='cluster',
datasource='$datasource',
query='label_values(node_time_seconds, %s)' % c._config.clusterLabel,
current='',
hide=if c._config.showMultiCluster then '' else '2',
refresh=2,
includeAll=false,
sort=1
);
local CPUUtilisation = local CPUUtilisation =
graphPanel.new( graphPanel.new(
'CPU Utilisation', 'CPU Utilisation',
@ -142,6 +130,17 @@ local diskSpaceUtilisation =
) { tooltip+: { sort: 2 } }; ) { tooltip+: { sort: 2 } };
{ {
_clusterTemplate:: template.new(
name='cluster',
datasource='$datasource',
query='label_values(node_time_seconds, %s)' % $._config.clusterLabel,
current='',
hide=if $._config.showMultiCluster then '' else '2',
refresh=2,
includeAll=false,
sort=1
),
grafanaDashboards+:: { grafanaDashboards+:: {
'node-rsrc-use.json': 'node-rsrc-use.json':
@ -154,7 +153,7 @@ local diskSpaceUtilisation =
graphTooltip='shared_crosshair' graphTooltip='shared_crosshair'
) )
.addTemplate(datasourceTemplate) .addTemplate(datasourceTemplate)
.addTemplate(clusterTemplate) .addTemplate($._clusterTemplate)
.addTemplate( .addTemplate(
template.new( template.new(
'instance', 'instance',
@ -219,7 +218,7 @@ local diskSpaceUtilisation =
graphTooltip='shared_crosshair' graphTooltip='shared_crosshair'
) )
.addTemplate(datasourceTemplate) .addTemplate(datasourceTemplate)
.addTemplate(clusterTemplate) .addTemplate($._clusterTemplate)
.addRow( .addRow(
row.new('CPU') row.new('CPU')
.addPanel( .addPanel(