This commit is contained in:
mwiegand 2021-07-04 22:20:50 +02:00
parent 710b30792d
commit 9ed91592f8
3 changed files with 9 additions and 4 deletions

View file

@ -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({

View file

@ -1,6 +1,6 @@
{
'usage': {
'stacked': True,
'stacked': False,
'queries': {
'usage': {
'filters': {

View file

@ -15,7 +15,7 @@
'display_name': '__field.labels.name'
},
'write': {
'stacked': False,
'stacked': True,
'queries': {
'load': {
'filters': {