From 44d3e4c264506154373ffaeb13d6c924c580e6b5 Mon Sep 17 00:00:00 2001 From: Pere Diaz Bou Date: Tue, 26 Oct 2021 14:42:17 +0200 Subject: monitoring/grafana: Grafana query tester Signed-off-by: Pere Diaz Bou --- src/pybind/mgr/dashboard/ci/check_grafana_dashboards.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/pybind/mgr/dashboard/ci') 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']) -- cgit v1.2.3