wip
This commit is contained in:
parent
710b30792d
commit
9ed91592f8
3 changed files with 9 additions and 4 deletions
|
@ -94,10 +94,10 @@ for dashboard_id, monitored_node in enumerate(monitored_nodes, start=1):
|
||||||
dashboard = deepcopy(dashboard_template)
|
dashboard = deepcopy(dashboard_template)
|
||||||
dashboard['id'] = dashboard_id
|
dashboard['id'] = dashboard_id
|
||||||
dashboard['title'] = monitored_node.name
|
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:
|
with open(repo.path.join([f'data/grafana/rows/{row_name}.py'])) as file:
|
||||||
row = eval(file.read())
|
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:
|
if 'display_name' in panel_config:
|
||||||
panel['fieldConfig']['defaults']['displayName'] = '${'+panel_config['display_name']+'}'
|
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():
|
for query_name, query_config in panel_config['queries'].items():
|
||||||
panel['targets'].append({
|
panel['targets'].append({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
'usage': {
|
'usage': {
|
||||||
'stacked': True,
|
'stacked': False,
|
||||||
'queries': {
|
'queries': {
|
||||||
'usage': {
|
'usage': {
|
||||||
'filters': {
|
'filters': {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
'display_name': '__field.labels.name'
|
'display_name': '__field.labels.name'
|
||||||
},
|
},
|
||||||
'write': {
|
'write': {
|
||||||
'stacked': False,
|
'stacked': True,
|
||||||
'queries': {
|
'queries': {
|
||||||
'load': {
|
'load': {
|
||||||
'filters': {
|
'filters': {
|
||||||
|
|
Loading…
Reference in a new issue