diff --git a/docs/node-mixin/lib/linux/config.libsonnet b/docs/node-mixin/lib/linux/config.libsonnet index 4a10c69b..e7857c3d 100644 --- a/docs/node-mixin/lib/linux/config.libsonnet +++ b/docs/node-mixin/lib/linux/config.libsonnet @@ -100,6 +100,8 @@ dashboardTimezone: 'default', dashboardRefresh: '1m', + // Opt-in for USE method dashboards + enableUseDashboards: true, // Opt-in for multi-cluster support (USE method). showMultiCluster: true, //used in USE dashboards only. For others, add cluster label to groupLabels var. diff --git a/docs/node-mixin/lib/linux/dashboards.libsonnet b/docs/node-mixin/lib/linux/dashboards.libsonnet index b07adc5e..ee0f6ab7 100644 --- a/docs/node-mixin/lib/linux/dashboards.libsonnet +++ b/docs/node-mixin/lib/linux/dashboards.libsonnet @@ -104,63 +104,71 @@ local logslib = import 'github.com/grafana/jsonnet-libs/logs-lib/logs/main.libso ) ) + root.applyCommon(vars.singleInstance, uid + '-disk', tags, links, annotations, timezone, refresh, period), - - 'node-rsrc-use.json': - g.dashboard.new(prefix + 'USE method / node') - + g.dashboard.withPanels( - g.util.panel.resolveCollapsedFlagOnRows( - g.util.grid.wrapPanels( - [ - rows.use.cpuUseMethod, - rows.use.memoryUseMethod, - rows.use.networkUseMethod, - rows.use.diskUseMethod, - rows.use.filesystemUseMethod, - ], 12, 7 - ) - ) - ) - + root.applyCommon(this.grafana.variables.use.singleInstance, std.md5(uid + '-cluster-rsrc-use.json'), tags, links, annotations, timezone, refresh, period), - - 'node-cluster-rsrc-use.json': - g.dashboard.new(prefix + 'USE method / cluster') - + g.dashboard.withPanels( - g.util.panel.resolveCollapsedFlagOnRows( - g.util.grid.wrapPanels( - [ - rows.use.cpuUseClusterMethod, - rows.use.memoryUseClusterMethod, - rows.use.networkUseClusterMethod, - rows.use.diskUseClusterMethod, - rows.use.filesystemUseClusterMethod, - ], 12, 7 - ) - ) - ) - + root.applyCommon(this.grafana.variables.useCluster.singleInstance, std.md5(uid + '-cluster-rsrc-use.json'), tags, links, annotations, timezone, refresh, period), } + ( - if this.config.showMultiCluster + if this.config.enableUseDashboards then + { - 'node-multicluster-rsrc-use.json': - g.dashboard.new(prefix + 'USE method / Multi-cluster') + 'node-rsrc-use.json': + g.dashboard.new(prefix + 'USE method / node') + g.dashboard.withPanels( g.util.panel.resolveCollapsedFlagOnRows( g.util.grid.wrapPanels( [ - rows.use.cpuUseClusterMethodMulti, - rows.use.memoryUseClusterMethodMulti, - rows.use.networkUseClusterMethodMulti, - rows.use.diskUseClusterMethodMulti, - rows.use.filesystemUseClusterMethodMulti, + rows.use.cpuUseMethod, + rows.use.memoryUseMethod, + rows.use.networkUseMethod, + rows.use.diskUseMethod, + rows.use.filesystemUseMethod, ], 12, 7 ) ) ) - + root.applyCommon(this.grafana.variables.useCluster.multiInstance, std.md5(uid + '-multicluster-rsrc-use.json'), tags, links, annotations, timezone, refresh, period), + + root.applyCommon(this.grafana.variables.use.singleInstance, std.md5(uid + '-cluster-rsrc-use.json'), tags, links, annotations, timezone, refresh, period), + + 'node-cluster-rsrc-use.json': + g.dashboard.new(prefix + 'USE method / cluster') + + g.dashboard.withPanels( + g.util.panel.resolveCollapsedFlagOnRows( + g.util.grid.wrapPanels( + [ + rows.use.cpuUseClusterMethod, + rows.use.memoryUseClusterMethod, + rows.use.networkUseClusterMethod, + rows.use.diskUseClusterMethod, + rows.use.filesystemUseClusterMethod, + ], 12, 7 + ) + ) + ) + + root.applyCommon(this.grafana.variables.useCluster.singleInstance, std.md5(uid + '-cluster-rsrc-use.json'), tags, links, annotations, timezone, refresh, period), } + + + ( + if this.config.showMultiCluster + then + { + 'node-multicluster-rsrc-use.json': + g.dashboard.new(prefix + 'USE method / multi-cluster') + + g.dashboard.withPanels( + g.util.panel.resolveCollapsedFlagOnRows( + g.util.grid.wrapPanels( + [ + rows.use.cpuUseClusterMethodMulti, + rows.use.memoryUseClusterMethodMulti, + rows.use.networkUseClusterMethodMulti, + rows.use.diskUseClusterMethodMulti, + rows.use.filesystemUseClusterMethodMulti, + ], 12, 7 + ) + ) + ) + + root.applyCommon(this.grafana.variables.useCluster.multiInstance, std.md5(uid + '-multicluster-rsrc-use.json'), tags, links, annotations, timezone, refresh, period), + } + else {} + ) else {} ) +