grafana: set custom home dashboard

Set a home dashboard with a little logo, link to the source files and
a plain list of dashboards.

Change-Id: Ifa9373695c1edb7de83b342948d46a816702ee10
This commit is contained in:
Ian Wienand 2022-03-07 09:23:47 +11:00
parent f24bbf97a7
commit 50600f49a2
3 changed files with 105 additions and 1 deletions

View File

@ -0,0 +1,86 @@
{
"links": [],
"panels": [
{
"gridPos": {
"h": 8,
"w": 12,
"x": 6,
"y": 0
},
"id": 5,
"options": {
"content": "<img src=\"https://opendev.org/assets/img/opendev.svg\"\nalt=\"OpenDev Logo\"\nstyle=\"height: 100px; background-color:LightGray; padding: 10px; border-radius: 15px; display:block; margin-left: auto; margin-right:auto\" />\n\nWelcome to OpenDev Grafana\n\nThe following dashboards are populated automatically. Contributions are welcome in the [project-config](https://opendev.org/openstack/project-config/src/branch/master/grafana) repository.",
"mode": "markdown"
},
"pluginVersion": "8.4.3",
"title": "OpenDev Grafana",
"transparent": true,
"type": "text"
},
{
"gridPos": {
"h": 50,
"w": 18,
"x": 3,
"y": 8
},
"id": 3,
"links": [],
"options": {
"folderId": 0,
"maxItems": 50,
"query": "",
"showHeadings": false,
"showRecentlyViewed": false,
"showSearch": true,
"showStarred": false,
"tags": []
},
"pluginVersion": "8.4.3",
"tags": [],
"title": "Dashboards",
"transparent": true,
"type": "dashlist"
}
],
"schemaVersion": 35,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {
"hidden": true,
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
],
"type": "timepicker"
},
"timezone": "browser",
"title": "OpenDev Home"
}

View File

@ -41,6 +41,22 @@
group: root group: root
mode: 0644 mode: 0644
- name: Ensure home panel directory exists
file:
state: directory
path: /etc/grafana/home
owner: root
group: root
mode: 0755
- name: Copy home panel
copy:
src: 'home.json'
dest: '/etc/grafana/home/home.json'
owner: root
group: root
mode: 0644
- name: Write update script - name: Write update script
template: template:
src: update-grafana-dashboards.sh.j2 src: update-grafana-dashboards.sh.j2

View File

@ -13,5 +13,7 @@ services:
GF_SECURITY_SECRET_KEY__FILE: '/etc/grafana/secrets/secret_key' GF_SECURITY_SECRET_KEY__FILE: '/etc/grafana/secrets/secret_key'
GF_AUTH_ANONYMOUS_ENABLED: 'true' GF_AUTH_ANONYMOUS_ENABLED: 'true'
GF_USERS_ALLOW_SIGN_UP: 'false' GF_USERS_ALLOW_SIGN_UP: 'false'
GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH: '/etc/grafana/home/home.json'
volumes: volumes:
- /etc/grafana/secrets:/etc/grafana/secrets - /etc/grafana/secrets:/etc/grafana/secrets:ro
- /etc/grafana/home:/etc/grafana/home:ro