From 9ed91592f82c2c181c06ff2356bb92e212df0ed4 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sun, 4 Jul 2021 22:20:50 +0200 Subject: [PATCH] wip --- bundles/grafana/items.py | 9 +++++++-- data/grafana/rows/cpu.py | 2 +- data/grafana/rows/disk_io.py | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bundles/grafana/items.py b/bundles/grafana/items.py index 08ff625..71d0af2 100644 --- a/bundles/grafana/items.py +++ b/bundles/grafana/items.py @@ -94,10 +94,10 @@ for dashboard_id, monitored_node in enumerate(monitored_nodes, start=1): dashboard = deepcopy(dashboard_template) dashboard['id'] = dashboard_id dashboard['title'] = monitored_node.name - panel_id = count() + panel_id = count(start=1) - for row_id, row_name in enumerate(sorted(monitored_node.metadata.get('grafana_rows'))): + for row_id, row_name in enumerate(sorted(monitored_node.metadata.get('grafana_rows')), start=1): with open(repo.path.join([f'data/grafana/rows/{row_name}.py'])) as file: row = eval(file.read()) @@ -111,6 +111,11 @@ for dashboard_id, monitored_node in enumerate(monitored_nodes, start=1): if 'display_name' in panel_config: panel['fieldConfig']['defaults']['displayName'] = '${'+panel_config['display_name']+'}' + + if panel_config.get('stacked', False): + panel['fieldConfig']['defaults']['custom']['stacking']['mode'] = 'normal' + else: + panel['fieldConfig']['defaults']['custom']['stacking']['mode'] = 'none' for query_name, query_config in panel_config['queries'].items(): panel['targets'].append({ diff --git a/data/grafana/rows/cpu.py b/data/grafana/rows/cpu.py index 140d471..35ebbe8 100644 --- a/data/grafana/rows/cpu.py +++ b/data/grafana/rows/cpu.py @@ -1,6 +1,6 @@ { 'usage': { - 'stacked': True, + 'stacked': False, 'queries': { 'usage': { 'filters': { diff --git a/data/grafana/rows/disk_io.py b/data/grafana/rows/disk_io.py index 257e739..ce36abf 100644 --- a/data/grafana/rows/disk_io.py +++ b/data/grafana/rows/disk_io.py @@ -15,7 +15,7 @@ 'display_name': '__field.labels.name' }, 'write': { - 'stacked': False, + 'stacked': True, 'queries': { 'load': { 'filters': {