From d01192c1601cb037e7869afd33e4649eb4447032 Mon Sep 17 00:00:00 2001 From: Doug Szumski Date: Tue, 13 Apr 2021 15:19:12 +0000 Subject: [PATCH] Extend support for custom Grafana dashboards The current behaviour is to support supplying a single folder of Grafana dashboards which can then be populated into a single folder in Grafana. Some users may wish to have sub-folders of Dashboards, and load these into separate dashboard folders in Grafana via a custom provisioning file. For example, a user may have a sub-folder of Ceph dashboards that they wish to keep separate from OpenStack dashboards. This patch supports sub-folders whilst not affecting the original mechanism. Trivial-Fix Change-Id: I9cd289a1ea79f00cee4d2ef30cbb508ac73f9767 --- ansible/roles/grafana/tasks/config.yml | 20 ++----------------- .../logging-and-monitoring/grafana-guide.rst | 8 +++++--- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/ansible/roles/grafana/tasks/config.yml b/ansible/roles/grafana/tasks/config.yml index d959c914c3..ec99252b9c 100644 --- a/ansible/roles/grafana/tasks/config.yml +++ b/ansible/roles/grafana/tasks/config.yml @@ -139,26 +139,12 @@ - inventory_hostname in groups[service.group] - service.enabled | bool -- name: Create custom Grafana dashboards folder - become: true - vars: - service: "{{ grafana_services['grafana'] }}" - file: - dest: "{{ node_config_directory }}/grafana/dashboards/" - state: "directory" - mode: "0770" - when: - - grafana_custom_dashboards_folder.stat.exists - - grafana_custom_dashboards_folder.stat.isdir - - inventory_hostname in groups[service.group] - - service.enabled | bool - - name: Copying over custom dashboards vars: service: "{{ grafana_services['grafana'] }}" copy: - src: "{{ item }}" - dest: "{{ node_config_directory }}/grafana/dashboards/" + src: "{{ node_custom_config }}/grafana/dashboards" + dest: "{{ node_config_directory }}/grafana/" mode: "0660" become: true when: @@ -166,7 +152,5 @@ - grafana_custom_dashboards_folder.stat.isdir - inventory_hostname in groups[service.group] - service.enabled | bool - with_fileglob: - - "{{ node_custom_config }}/grafana/dashboards/*.json" notify: - Restart grafana container diff --git a/doc/source/reference/logging-and-monitoring/grafana-guide.rst b/doc/source/reference/logging-and-monitoring/grafana-guide.rst index b0edd11bd8..12f123a20a 100644 --- a/doc/source/reference/logging-and-monitoring/grafana-guide.rst +++ b/doc/source/reference/logging-and-monitoring/grafana-guide.rst @@ -35,9 +35,11 @@ Custom dashboards provisioning Kolla Ansible sets custom dashboards provisioning using `Dashboard provider `_. -Dashboard's JSON files should be placed into -``{{ node_custom_config }}/grafana/dashboards/`` folder. -Dashboards will be imported to Grafana dashboards General Folder. +Dashboard JSON files should be placed into the +``{{ node_custom_config }}/grafana/dashboards/`` folder. The use of +sub-folders is also supported when using a custom ``provisioning.yaml`` +file. Dashboards will be imported into the Grafana dashboards 'General' +folder by default. Grafana provisioner config can be altered by placing ``provisioning.yaml`` to ``{{ node_custom_config }}/grafana/`` folder.