bundles/grafana: add support for custom managed dashboards
This commit is contained in:
parent
fe668fd5d4
commit
c1b1dc1a29
1 changed files with 16 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
from itertools import count
|
from itertools import count
|
||||||
from os.path import join
|
from os import listdir
|
||||||
|
from os.path import isdir, isfile, join
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
|
@ -113,3 +114,17 @@ for rnode in repo.nodes:
|
||||||
'svc_systemd:grafana-server:restart',
|
'svc_systemd:grafana-server:restart',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
additional_path = join(repo.path, 'data', 'grafana', 'files', node.name, 'dashboards')
|
||||||
|
if isdir(additional_path):
|
||||||
|
for file in listdir(additional_path):
|
||||||
|
if not isfile(join(additional_path, file)) or file.startswith('.') or file.startswith('_'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
files[f'/var/lib/grafana/dashboards/{file}'] = {
|
||||||
|
'source': join(node.name, 'dashboards', file),
|
||||||
|
'triggers': {
|
||||||
|
'svc_systemd:grafana-server:restart',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue