mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-11-10 04:37:36 +01:00
Only download Grafana dashboard URLs for enabled services
If someone is using Dendrite and enabling Grafana, we'll no longer download Synapse dashboards. If someone is not using node-exporter, we'll no longer download node exporter dashboards. Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/2133
This commit is contained in:
parent
3f4bedb31e
commit
f623cf3550
@ -2477,9 +2477,11 @@ matrix_grafana_enabled: false
|
||||
# Grafana's HTTP port to the local host.
|
||||
matrix_grafana_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:3000' }}"
|
||||
|
||||
matrix_grafana_dashboard_download_urls_all: |
|
||||
matrix_grafana_dashboard_download_urls: |
|
||||
{{
|
||||
matrix_grafana_dashboard_download_urls
|
||||
(matrix_synapse_grafana_dashboard_urls if matrix_homeserver_implementation == 'synapse' and matrix_synapse_metrics_enabled else [])
|
||||
+
|
||||
(matrix_prometheus_node_exporter_dashboard_urls if matrix_prometheus_node_exporter_enabled else [])
|
||||
+
|
||||
(matrix_prometheus_postgres_exporter_dashboard_urls if matrix_prometheus_postgres_exporter_enabled else [])
|
||||
}}
|
||||
|
@ -9,16 +9,8 @@ matrix_grafana_version: 9.1.6
|
||||
matrix_grafana_docker_image: "{{ matrix_container_global_registry_prefix }}grafana/grafana:{{ matrix_grafana_version }}"
|
||||
matrix_grafana_docker_image_force_pull: "{{ matrix_grafana_docker_image.endswith(':latest') }}"
|
||||
|
||||
# Not conditional, because when someone disables metrics
|
||||
# they might still want to look at the old existing data.
|
||||
# So it would be silly to delete the dashboard in such case.
|
||||
matrix_grafana_dashboard_download_urls:
|
||||
- "https://raw.githubusercontent.com/matrix-org/synapse/master/contrib/grafana/synapse.json"
|
||||
- "https://raw.githubusercontent.com/rfrail3/grafana-dashboards/master/prometheus/node-exporter-full.json"
|
||||
|
||||
# matrix_grafana_dashboard_download_urls_all contains the full list (of URLs) of dashboards to download.
|
||||
# This variable is overriden elsewhere and additional URLs are injected into it (besides those seen in `matrix_grafana_dashboard_download_urls`) based on the enabled components.
|
||||
matrix_grafana_dashboard_download_urls_all: "{{ matrix_grafana_dashboard_download_urls }}"
|
||||
# matrix_grafana_dashboard_download_urls holds a list of URLs of dashboards to download
|
||||
matrix_grafana_dashboard_download_urls: []
|
||||
|
||||
matrix_grafana_base_path: "{{ matrix_base_data_path }}/grafana"
|
||||
matrix_grafana_config_path: "{{ matrix_grafana_base_path }}/config"
|
||||
|
@ -68,7 +68,7 @@
|
||||
mode: 0440
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items: "{{ matrix_grafana_dashboard_download_urls_all }}"
|
||||
with_items: "{{ matrix_grafana_dashboard_download_urls }}"
|
||||
when: matrix_grafana_enabled | bool
|
||||
register: result
|
||||
retries: "{{ matrix_geturl_retries_count }}"
|
||||
|
@ -5,3 +5,12 @@
|
||||
msg: >
|
||||
You need to enable `matrix_prometheus_enabled` to use Prometheus as data source for Grafana.
|
||||
when: "not matrix_prometheus_enabled"
|
||||
|
||||
- name: (Deprecation) Catch and report renamed settings
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
Your configuration contains a variable, which now has a different name.
|
||||
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
|
||||
when: "item.old in vars"
|
||||
with_items:
|
||||
- {'old': 'matrix_grafana_dashboard_download_urls_all', 'new': 'matrix_grafana_dashboard_download_urls'}
|
||||
|
@ -60,3 +60,8 @@ matrix_prometheus_node_exporter_container_http_host_bind_port: ''
|
||||
# If matrix_prometheus_node_exporter_container_http_host_bind_port is set to an IP that is not 0.0.0.0 and a port, that "<ip>:<port>" value will be used
|
||||
# Otherwise this value will be empty and you will have to manually configure your NGINX config file. (If you are using the config files generated by this playbook, you will have to edit matrix-domain.conf)
|
||||
matrix_prometheus_node_exporter_matrix_nginx_proxy_not_enabled_proxy_pass_host: "{{ '127.0.0.1' + matrix_prometheus_node_exporter_container_http_host_bind_port_number_raw if not ':' in matrix_prometheus_node_exporter_container_http_host_bind_port else (matrix_prometheus_node_exporter_container_http_host_bind_port if matrix_prometheus_node_exporter_container_http_host_bind_port.split(':')[0] != '0.0.0.0' else '') }}"
|
||||
|
||||
# matrix_prometheus_node_exporter_dashboard_urls contains a list of URLs with Grafana dashboard definitions.
|
||||
# If the Grafana role is enabled, these dashboards will be downloaded.
|
||||
matrix_prometheus_node_exporter_dashboard_urls:
|
||||
- https://raw.githubusercontent.com/rfrail3/grafana-dashboards/master/prometheus/node-exporter-full.json
|
||||
|
@ -58,5 +58,7 @@ matrix_prometheus_postgres_exporter_container_http_host_bind_port: ''
|
||||
# Otherwise this value will be empty and you will have to manually configure your NGINX config file. (If you are using the config files generated by this playbook, you will have to edit matrix-domain.conf)
|
||||
matrix_prometheus_postgres_exporter_matrix_nginx_proxy_not_enabled_proxy_pass_host: "{{ '127.0.0.1' + matrix_prometheus_postgres_exporter_container_http_host_bind_port_number_raw if not ':' in matrix_prometheus_postgres_exporter_container_http_host_bind_port else (matrix_prometheus_postgres_exporter_container_http_host_bind_port if matrix_prometheus_postgres_exporter_container_http_host_bind_port.split(':')[0] != '0.0.0.0' else '') }}"
|
||||
|
||||
# matrix_prometheus_postgres_exporter_dashboard_urls contains a list of URLs with Grafana dashboard definitions.
|
||||
# If the Grafana role is enabled, these dashboards will be downloaded.
|
||||
matrix_prometheus_postgres_exporter_dashboard_urls:
|
||||
- "https://grafana.com/api/dashboards/9628/revisions/7/download"
|
||||
|
@ -365,6 +365,11 @@ matrix_url_preview_accept_language: ['en-US', 'en']
|
||||
matrix_synapse_metrics_enabled: false
|
||||
matrix_synapse_metrics_port: 9100
|
||||
|
||||
# matrix_synapse_grafana_dashboard_urls contains a list of URLs with Grafana dashboard definitions.
|
||||
# If the Grafana role is enabled, these dashboards will be downloaded.
|
||||
matrix_synapse_grafana_dashboard_urls:
|
||||
- https://raw.githubusercontent.com/matrix-org/synapse/master/contrib/grafana/synapse.json
|
||||
|
||||
# Controls whether Synapse metrics should be proxied (exposed) on:
|
||||
# - `matrix.DOMAIN/metrics/synapse/main-process` for the main process
|
||||
# - `matrix.DOMAIN/metrics/synapse/worker/{type}-{id}` for each worker process
|
||||
|
Loading…
Reference in New Issue
Block a user