summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/ci
diff options
context:
space:
mode:
authorPere Diaz Bou <pdiazbou@redhat.com>2021-10-26 14:42:17 +0200
committerPere Diaz Bou <pdiazbou@redhat.com>2021-11-16 10:30:49 +0100
commit44d3e4c264506154373ffaeb13d6c924c580e6b5 (patch)
tree9414f7999e457f0a4238c9cc0cb53525c8473b60 /src/pybind/mgr/dashboard/ci
parentMerge pull request #43938 from neha-ojha/wip-quick-fix (diff)
downloadceph-44d3e4c264506154373ffaeb13d6c924c580e6b5.tar.xz
ceph-44d3e4c264506154373ffaeb13d6c924c580e6b5.zip
monitoring/grafana: Grafana query tester
Signed-off-by: Pere Diaz Bou <pdiazbou@redhat.com>
Diffstat (limited to 'src/pybind/mgr/dashboard/ci')
-rw-r--r--src/pybind/mgr/dashboard/ci/check_grafana_dashboards.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/pybind/mgr/dashboard/ci/check_grafana_dashboards.py b/src/pybind/mgr/dashboard/ci/check_grafana_dashboards.py
index 47e553c84e5..03b31a45e17 100644
--- a/src/pybind/mgr/dashboard/ci/check_grafana_dashboards.py
+++ b/src/pybind/mgr/dashboard/ci/check_grafana_dashboards.py
@@ -76,6 +76,22 @@ def get_grafana_dashboards(base_dir):
with open(json_file) as f:
dashboard_config = json.load(f)
uid = dashboard_config.get('uid')
+ # if it's not a grafana dashboard, skip checks
+ # Fields in a dasbhoard:
+ # https://grafana.com/docs/grafana/latest/dashboards/json-model/#json-fields
+ expected_fields = [
+ 'id', 'uid', 'title', 'tags', 'style', 'timezone', 'editable',
+ 'hideControls', 'graphTooltip', 'panels', 'time', 'timepicker',
+ 'templating', 'annotations', 'refresh', 'schemaVersion', 'version', 'links',
+ ]
+ not_a_dashboard = False
+ for field in expected_fields:
+ if field not in dashboard_config:
+ not_a_dashboard = True
+ break
+ if not_a_dashboard:
+ continue
+
assert dashboard_config['id'] is None, \
"'id' not null: '{}'".format(dashboard_config['id'])