mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-12-21 12:14:01 +00:00
Replace matrix-prometheus with an external Prometheus role
This commit is contained in:
parent
d351213486
commit
14b8efcad2
21
CHANGELOG.md
21
CHANGELOG.md
@ -1,3 +1,22 @@
|
||||
# 2023-03-21
|
||||
|
||||
## The matrix-prometheus role lives independently now
|
||||
|
||||
**TLDR**: the `matrix-prometheus` role is now included from the [ansible-role-prometheus](https://github.com/mother-of-all-self-hosting/ansible-role-prometheus) repository, part of the [MASH playbook](https://github.com/mother-of-all-self-hosting/mash-playbook). Some variables have been renamed. All functionality remains intact.
|
||||
|
||||
The `matrix-prometheus` role has been relocated in its own repository, part of the [MASH playbook](https://github.com/mother-of-all-self-hosting/mash-playbook) project - an Ansible playbook for self-hosting [a growing list of FOSS software](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/supported-services.md). If hosting a Prometheus stack on the Matrix server itself did not stand right with you or you always wanted to host most stuff, you can now use this new playbook to do so.
|
||||
|
||||
Extracting the Prometheus role out of this Matrix playbook required huge internal refactoring to the way the Prometheus configuration (scraping jobs) is generated. If you notice any breakage after upgrading, let us know.
|
||||
|
||||
You need to **update you roles** (`just roles` or `make roles`) regardless of whether you're using Prometheus or not.
|
||||
|
||||
If you're making use of Prometheus via this playbook, you will need to update variable references in your `vars.yml` file:
|
||||
|
||||
- `matrix_prometheus_docker_image_` -> `matrix_prometheus_container_image_`
|
||||
- `matrix_prometheus_` -> `prometheus_`
|
||||
- some other internal variables have changed, but the playbook will tell you about them
|
||||
|
||||
|
||||
# 2023-03-12
|
||||
|
||||
## synapse-auto-compressor support
|
||||
@ -830,7 +849,7 @@ See our [Setting up the ntfy push notifications server](docs/configuring-playboo
|
||||
|
||||
**If you are using the [Hookshot bridge](docs/configuring-playbook-bridge-hookshot.md)**, you may find that:
|
||||
1. **Metrics may not be enabled by default anymore**:
|
||||
- If Prometheus is enabled (`matrix_prometheus_enabled: true`), then Hookshot metrics will be enabled automatically (`matrix_hookshot_metrics_enabled: true`). These metrics will be collected from the local (in-container) Prometheus over the container network.
|
||||
- If Prometheus is enabled (`prometheus_enabled: true`), then Hookshot metrics will be enabled automatically (`matrix_hookshot_metrics_enabled: true`). These metrics will be collected from the local (in-container) Prometheus over the container network.
|
||||
- **If Prometheus is not enabled** (you are either not using Prometheus or are using an external one), **Hookshot metrics will not be enabled by default anymore**. Feel free to enable them by setting `matrix_hookshot_metrics_enabled: true`. Also, see below.
|
||||
2. When metrics are meant to be **consumed by an external Prometheus server**, `matrix_hookshot_metrics_proxying_enabled` needs to be set to `true`, so that metrics would be exposed (proxied) "publicly" on `https://matrix.DOMAIN/metrics/hookshot`. To make use of this, you'll also need to enable the new `https://matrix.DOMAIN/metrics/*` endpoints mentioned above, using `matrix_nginx_proxy_proxy_matrix_metrics_enabled`. Learn more in our [Collecting metrics to an external Prometheus server](docs/configuring-playbook-prometheus-grafana.md#collecting-metrics-to-an-external-prometheus-server) documentation.
|
||||
3. **We've changed the URL we're exposing Hookshot metrics at** for external Prometheus servers. Until now, you were advised to consume Hookshot metrics from `https://stats.DOMAIN/hookshot/metrics` (working in conjunction with `matrix_nginx_proxy_proxy_synapse_metrics`). From now on, **this no longer works**. As described above, you need to start consuming metrics from `https://matrix.DOMAIN/metrics/hookshot`.
|
||||
|
@ -7,7 +7,7 @@ You can enable this with the following settings in your configuration file (`inv
|
||||
Remember to add `stats.<your-domain>` to DNS as described in [Configuring DNS](configuring-dns.md) before running the playbook.
|
||||
|
||||
```yaml
|
||||
matrix_prometheus_enabled: true
|
||||
prometheus_enabled: true
|
||||
|
||||
# You can remove this, if unnecessary.
|
||||
prometheus_node_exporter_enabled: true
|
||||
@ -39,7 +39,7 @@ The retention policy of Prometheus metrics is [15 days by default](https://prome
|
||||
|
||||
Name | Description
|
||||
-----|----------
|
||||
`matrix_prometheus_enabled`|[Prometheus](https://prometheus.io) is a time series database. It holds all the data we're going to talk about.
|
||||
`prometheus_enabled`|[Prometheus](https://prometheus.io) is a time series database. It holds all the data we're going to talk about.
|
||||
`prometheus_node_exporter_enabled`|[Node Exporter](https://prometheus.io/docs/guides/node-exporter/) is an addon of sorts to Prometheus that collects generic system information such as CPU, memory, filesystem, and even system temperatures
|
||||
`prometheus_postgres_exporter_enabled`|[Postgres Exporter](configuring-playbook-prometheus-postgres.md) is an addon of sorts to expose Postgres database metrics to Prometheus.
|
||||
`matrix_prometheus_nginxlog_exporter_enabled`|[NGINX Log Exporter](configuring-playbook-prometheus-nginxlog.md) is an addon of sorts to expose NGINX logs to Prometheus.
|
||||
@ -57,7 +57,7 @@ Most of our docker containers run with limited system access, but the `prometheu
|
||||
|
||||
## Collecting metrics to an external Prometheus server
|
||||
|
||||
**If the integrated Prometheus server is enabled** (`matrix_prometheus_enabled: true`), metrics are collected by it from each service via communication that happens over the container network. Each service does not need to expose its metrics "publicly".
|
||||
**If the integrated Prometheus server is enabled** (`prometheus_enabled: true`), metrics are collected by it from each service via communication that happens over the container network. Each service does not need to expose its metrics "publicly".
|
||||
|
||||
When you'd like **to collect metrics from an external Prometheus server**, you need to expose service metrics outside of the container network.
|
||||
|
||||
|
@ -12,7 +12,7 @@ You can enable this role by adding the following settings in your configuration
|
||||
matrix_prometheus_nginxlog_exporter_enabled: true
|
||||
|
||||
# required depency
|
||||
matrix_prometheus_enabled: true
|
||||
prometheus_enabled: true
|
||||
|
||||
# optional for visualization
|
||||
grafana_enabled: true
|
||||
@ -20,7 +20,7 @@ grafana_enabled: true
|
||||
|
||||
x | Prerequisites | Variable | Description
|
||||
|:--:|:--:|:--:|:--|
|
||||
**REQUIRED** | `matrix-prometheus`| `matrix_prometheus_enabled`|[Prometheus](https://prometheus.io) is a time series database. It holds all the data we're going to talk about.
|
||||
**REQUIRED** | `matrix-prometheus`| `prometheus_enabled`|[Prometheus](https://prometheus.io) is a time series database. It holds all the data we're going to talk about.
|
||||
_Optional_ | [`matrix-grafana`](configuring-playbook-prometheus-grafana.md) | [`grafana_enabled`](configuring-playbook-prometheus-grafana.md)|[Grafana](https://grafana.com) is the visual component. It shows (on the `stats.<your-domain>` subdomain) graphs that we're interested in. When enabled the `NGINX PROXY` dashboard is automatically added.
|
||||
|
||||
## Docker Image Compatibility
|
||||
|
@ -338,7 +338,7 @@ devture_systemd_service_manager_services_list_auto: |
|
||||
+
|
||||
([{'name': (devture_postgres_backup_identifier + '.service'), 'priority': 5000, 'groups': ['matrix', 'backup', 'postgres-backup']}] if devture_postgres_backup_enabled else [])
|
||||
+
|
||||
([{'name': 'matrix-prometheus.service', 'priority': 4000, 'groups': ['matrix', 'monitoring', 'prometheus', 'prometheus-core']}] if matrix_prometheus_enabled else [])
|
||||
([{'name': (prometheus_identifier + '.service'), 'priority': 4000, 'groups': ['matrix', 'monitoring', 'prometheus']}] if prometheus_enabled else [])
|
||||
+
|
||||
([{'name': (prometheus_node_exporter_identifier + '.service'), 'priority': 3900, 'groups': ['matrix', 'monitoring', 'prometheus-exporters', 'prometheus-node-exporter']}] if prometheus_node_exporter_enabled else [])
|
||||
+
|
||||
@ -871,7 +871,7 @@ matrix_mautrix_facebook_bridge_presence: "{{ matrix_synapse_presence_enabled if
|
||||
# - `matrix_mautrix_facebook_metrics_enabled`
|
||||
# - `matrix_mautrix_facebook_proxying_metrics_enabled`
|
||||
# - `matrix_nginx_proxy_proxy_matrix_metrics_enabled`
|
||||
matrix_mautrix_facebook_metrics_enabled: "{{ matrix_prometheus_enabled }}"
|
||||
matrix_mautrix_facebook_metrics_enabled: "{{ prometheus_enabled }}"
|
||||
|
||||
# We'd like to force-set people with external Postgres to SQLite, so the bridge role can complain
|
||||
# and point them to a migration path.
|
||||
@ -1004,7 +1004,7 @@ matrix_mautrix_instagram_bridge_presence: "{{ matrix_synapse_presence_enabled if
|
||||
# - `matrix_mautrix_instagram_metrics_enabled`
|
||||
# - `matrix_mautrix_instagram_proxying_metrics_enabled`
|
||||
# - `matrix_nginx_proxy_proxy_matrix_metrics_enabled`
|
||||
matrix_mautrix_instagram_metrics_enabled: "{{ matrix_prometheus_enabled }}"
|
||||
matrix_mautrix_instagram_metrics_enabled: "{{ prometheus_enabled }}"
|
||||
|
||||
# We'd like to force-set people with external Postgres to SQLite, so the bridge role can complain
|
||||
# and point them to a migration path.
|
||||
@ -1055,7 +1055,7 @@ matrix_mautrix_signal_login_shared_secret: "{{ matrix_synapse_ext_password_provi
|
||||
# - `matrix_mautrix_signal_metrics_enabled`
|
||||
# - `matrix_mautrix_signal_proxying_metrics_enabled`
|
||||
# - `matrix_nginx_proxy_proxy_matrix_metrics_enabled`
|
||||
matrix_mautrix_signal_metrics_enabled: "{{ matrix_prometheus_enabled }}"
|
||||
matrix_mautrix_signal_metrics_enabled: "{{ prometheus_enabled }}"
|
||||
|
||||
matrix_mautrix_signal_database_engine: 'postgres'
|
||||
matrix_mautrix_signal_database_hostname: "{{ devture_postgres_connection_hostname if devture_postgres_enabled else '' }}"
|
||||
@ -1185,7 +1185,7 @@ matrix_mautrix_whatsapp_login_shared_secret: "{{ matrix_synapse_ext_password_pro
|
||||
# - `matrix_mautrix_twitter_metrics_enabled`
|
||||
# - `matrix_mautrix_twitter_proxying_metrics_enabled`
|
||||
# - `matrix_nginx_proxy_proxy_matrix_metrics_enabled`
|
||||
matrix_mautrix_twitter_metrics_enabled: "{{ matrix_prometheus_enabled }}"
|
||||
matrix_mautrix_twitter_metrics_enabled: "{{ prometheus_enabled }}"
|
||||
|
||||
# Postgres is the default, except if not using internal Postgres server
|
||||
matrix_mautrix_whatsapp_database_engine: "{{ 'postgres' if devture_postgres_enabled else 'sqlite' }}"
|
||||
@ -1291,7 +1291,7 @@ matrix_hookshot_provisioning_enabled: "{{ matrix_hookshot_provisioning_secret an
|
||||
# - `matrix_hookshot_metrics_enabled`
|
||||
# - `matrix_hookshot_metrics_proxying_enabled`
|
||||
# - `matrix_nginx_proxy_proxy_matrix_metrics_enabled`
|
||||
matrix_hookshot_metrics_enabled: "{{ matrix_prometheus_enabled }}"
|
||||
matrix_hookshot_metrics_enabled: "{{ prometheus_enabled }}"
|
||||
|
||||
matrix_hookshot_urlprefix_port_enabled: "{{ matrix_nginx_proxy_container_https_host_bind_port == 443 if matrix_nginx_proxy_https_enabled else matrix_nginx_proxy_container_https_host_bind_port == 80 }}"
|
||||
matrix_hookshot_urlprefix_port: ":{{ matrix_nginx_proxy_container_https_host_bind_port if matrix_nginx_proxy_https_enabled else matrix_nginx_proxy_container_http_host_bind_port }}"
|
||||
@ -3034,7 +3034,7 @@ devture_postgres_backup_databases: "{{ devture_postgres_managed_databases | map(
|
||||
matrix_sygnal_enabled: false
|
||||
|
||||
# If someone instals Prometheus via the playbook, they most likely wish to monitor Sygnal.
|
||||
matrix_sygnal_metrics_prometheus_enabled: "{{ matrix_prometheus_enabled }}"
|
||||
matrix_sygnal_metrics_prometheus_enabled: "{{ prometheus_enabled }}"
|
||||
|
||||
matrix_sygnal_hostname: "{{ matrix_server_fqn_sygnal }}"
|
||||
|
||||
@ -3287,7 +3287,7 @@ matrix_synapse_tls_private_key_path: ~
|
||||
matrix_synapse_federation_port_openid_resource_required: "{{ not matrix_synapse_federation_enabled and (matrix_dimension_enabled or matrix_ma1sd_enabled or matrix_user_verification_service_enabled) }}"
|
||||
|
||||
# If someone instals Prometheus via the playbook, they most likely wish to monitor Synapse.
|
||||
matrix_synapse_metrics_enabled: "{{ matrix_prometheus_enabled }}"
|
||||
matrix_synapse_metrics_enabled: "{{ prometheus_enabled }}"
|
||||
|
||||
matrix_synapse_email_enabled: "{{ matrix_mailer_enabled }}"
|
||||
matrix_synapse_email_smtp_host: "matrix-mailer"
|
||||
@ -3452,6 +3452,7 @@ matrix_synapse_admin_container_labels_traefik_tls_certResolver: "{{ devture_trae
|
||||
#
|
||||
######################################################################
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# etke/prometheus_node_exporter
|
||||
@ -3486,6 +3487,7 @@ prometheus_node_exporter_container_labels_traefik_tls_certResolver: "{{ devture_
|
||||
#
|
||||
######################################################################
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# etke/prometheus_postgres_exporter
|
||||
@ -3530,6 +3532,7 @@ prometheus_postgres_exporter_systemd_required_services_list: |
|
||||
#
|
||||
######################################################################
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# matrix-prometheus-nginxlog-exporter
|
||||
@ -3544,45 +3547,101 @@ matrix_prometheus_nginxlog_exporter_enabled: false
|
||||
#
|
||||
######################################################################
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# matrix-prometheus
|
||||
# prometheus
|
||||
#
|
||||
######################################################################
|
||||
|
||||
matrix_prometheus_enabled: false
|
||||
prometheus_enabled: false
|
||||
|
||||
matrix_prometheus_container_network: "{{ matrix_docker_network }}"
|
||||
prometheus_identifier: matrix-prometheus
|
||||
|
||||
prometheus_base_path: "{{ matrix_base_data_path }}/prometheus"
|
||||
|
||||
prometheus_uid: "{{ matrix_user_uid }}"
|
||||
prometheus_gid: "{{ matrix_user_gid }}"
|
||||
|
||||
prometheus_container_additional_networks: |
|
||||
{{
|
||||
(
|
||||
([prometheus_node_exporter_container_network] if prometheus_self_node_scraper_enabled and prometheus_node_exporter_container_network != prometheus_container_network else [])
|
||||
+
|
||||
([matrix_synapse_container_network] if matrix_prometheus_services_connect_scraper_synapse_enabled and matrix_synapse_container_network != prometheus_container_network else [])
|
||||
+
|
||||
([prometheus_postgres_exporter_container_network] if matrix_prometheus_services_connect_scraper_postgres_enabled and prometheus_postgres_exporter_container_network != prometheus_container_network else [])
|
||||
+
|
||||
([matrix_hookshot_container_network] if matrix_prometheus_services_connect_scraper_hookshot_enabled and matrix_hookshot_container_network != prometheus_container_network else [])
|
||||
+
|
||||
([matrix_prometheus_nginxlog_exporter_container_network] if matrix_prometheus_services_connect_scraper_nginxlog_enabled and matrix_prometheus_nginxlog_exporter_container_network != prometheus_container_network else [])
|
||||
) | unique
|
||||
}}
|
||||
|
||||
# Normally, matrix-nginx-proxy is enabled and nginx can reach Prometheus over the container network.
|
||||
# If matrix-nginx-proxy is not enabled, or you otherwise have a need for it, you can expose
|
||||
# Prometheus' HTTP port to the local host.
|
||||
matrix_prometheus_container_http_host_bind_port: "{{ (matrix_playbook_service_host_bind_interface_prefix ~ '9090') if matrix_playbook_service_host_bind_interface_prefix else '' }}"
|
||||
prometheus_container_http_host_bind_port: "{{ (matrix_playbook_service_host_bind_interface_prefix ~ '9090') if matrix_playbook_service_host_bind_interface_prefix else '' }}"
|
||||
|
||||
matrix_prometheus_scraper_synapse_enabled: "{{ matrix_synapse_enabled and matrix_synapse_metrics_enabled }}"
|
||||
matrix_prometheus_scraper_synapse_targets: ['matrix-synapse:{{ matrix_synapse_metrics_port }}']
|
||||
matrix_prometheus_scraper_synapse_workers_enabled_list: "{{ matrix_synapse_workers_enabled_list }}"
|
||||
matrix_prometheus_scraper_synapse_rules_synapse_tag: "{{ matrix_synapse_docker_image_tag }}"
|
||||
prometheus_config_rule_files_auto: |
|
||||
{{
|
||||
(['synapse-v2.rules'] if matrix_prometheus_services_connect_synapse_rules_enabled else [])
|
||||
}}
|
||||
|
||||
matrix_prometheus_scraper_node_enabled: "{{ prometheus_node_exporter_enabled }}"
|
||||
matrix_prometheus_scraper_node_targets: "{{ [prometheus_node_exporter_identifier + ':9100'] if prometheus_node_exporter_enabled else [] }}"
|
||||
prometheus_self_node_scraper_enabled: "{{ prometheus_node_exporter_enabled }}"
|
||||
prometheus_self_node_scraper_static_configs_target: "{{ (prometheus_node_exporter_identifier + ':9100') if prometheus_node_exporter_enabled else '' }}"
|
||||
|
||||
matrix_prometheus_scraper_postgres_enabled: "{{ prometheus_postgres_exporter_enabled }}"
|
||||
matrix_prometheus_scraper_postgres_targets: "{{ [prometheus_postgres_exporter_identifier + ':' + prometheus_postgres_exporter_port | string] if matrix_prometheus_scraper_postgres_enabled else [] }}"
|
||||
|
||||
matrix_prometheus_scraper_hookshot_enabled: "{{ matrix_hookshot_metrics_enabled|default(false) }}"
|
||||
matrix_prometheus_scraper_hookshot_targets: "{{ [matrix_hookshot_container_url | string +':'+ matrix_hookshot_metrics_port | string] if matrix_hookshot_metrics_enabled else [] }}"
|
||||
|
||||
matrix_prometheus_scraper_nginxlog_enabled: "{{ matrix_prometheus_nginxlog_exporter_enabled }}"
|
||||
matrix_prometheus_scraper_nginxlog_server_port: "{{ (matrix_prometheus_nginxlog_exporter_container_hostname | string +':'+ matrix_prometheus_nginxlog_exporter_container_metrics_port | string)
|
||||
| default('') }}"
|
||||
prometheus_config_scrape_configs_auto: |
|
||||
{{
|
||||
(matrix_prometheus_services_connect_scraper_synapse_configs if matrix_prometheus_services_connect_scraper_synapse_enabled else [])
|
||||
+
|
||||
(matrix_prometheus_services_connect_scraper_postgres_scrape_configs if matrix_prometheus_services_connect_scraper_postgres_enabled else [])
|
||||
+
|
||||
(matrix_prometheus_services_connect_scraper_hookshot_scrape_configs if matrix_prometheus_services_connect_scraper_hookshot_enabled else [])
|
||||
+
|
||||
(matrix_prometheus_services_connect_scraper_nginxlog_scrape_configs if matrix_prometheus_services_connect_scraper_nginxlog_enabled else [])
|
||||
}}
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-prometheus
|
||||
# /prometheus
|
||||
#
|
||||
######################################################################
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# matrix-prometheus-services-connect
|
||||
#
|
||||
######################################################################
|
||||
|
||||
matrix_prometheus_services_connect_synapse_enabled: "{{ prometheus_enabled and matrix_synapse_enabled }}"
|
||||
|
||||
matrix_prometheus_services_connect_synapse_rules_download_synapse_tag: "{{ matrix_synapse_docker_image_tag }}"
|
||||
matrix_prometheus_services_connect_synapse_rules_download_dir_path: "{{ prometheus_config_path }}"
|
||||
matrix_prometheus_services_connect_synapse_rules_download_owner: "{{ prometheus_uid }}"
|
||||
matrix_prometheus_services_connect_synapse_rules_download_group: "{{ prometheus_gid }}"
|
||||
|
||||
matrix_prometheus_services_connect_scraper_synapse_enabled: "{{ matrix_synapse_enabled and matrix_synapse_metrics_enabled }}"
|
||||
matrix_prometheus_services_connect_scraper_synapse_main_process_static_configs_target: "matrix-synapse:{{ matrix_synapse_metrics_port }}"
|
||||
matrix_prometheus_services_connect_scraper_synapse_workers_enabled_list: "{{ matrix_synapse_workers_enabled_list }}"
|
||||
|
||||
matrix_prometheus_services_connect_scraper_postgres_enabled: "{{ prometheus_postgres_exporter_enabled }}"
|
||||
matrix_prometheus_services_connect_scraper_postgres_static_configs_target: "{{ prometheus_postgres_exporter_identifier }}:{{ prometheus_postgres_exporter_port | string }}"
|
||||
|
||||
matrix_prometheus_services_connect_scraper_hookshot_enabled: "{{ matrix_hookshot_enabled and matrix_hookshot_metrics_enabled }}"
|
||||
matrix_prometheus_services_connect_scraper_hookshot_static_configs_target: "{{ matrix_hookshot_container_url }}:{{ matrix_hookshot_metrics_port | string }}"
|
||||
|
||||
matrix_prometheus_services_connect_scraper_nginxlog_enabled: "{{ matrix_prometheus_nginxlog_exporter_enabled }}"
|
||||
matrix_prometheus_services_connect_scraper_nginxlog_static_configs_target: "{{ matrix_prometheus_nginxlog_exporter_container_hostname }}:{{ matrix_prometheus_nginxlog_exporter_container_metrics_port | string }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-prometheus-services-connect
|
||||
#
|
||||
######################################################################
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# etke/grafana
|
||||
@ -3607,7 +3666,7 @@ grafana_container_additional_networks: |
|
||||
(
|
||||
([matrix_playbook_reverse_proxyable_services_additional_network] if matrix_playbook_reverse_proxyable_services_additional_network else [])
|
||||
+
|
||||
([matrix_prometheus_container_network] if matrix_prometheus_enabled and matrix_prometheus_container_network != grafana_container_network else [])
|
||||
([prometheus_container_network] if prometheus_enabled and prometheus_container_network != grafana_container_network else [])
|
||||
) | unique
|
||||
}}
|
||||
|
||||
@ -3628,7 +3687,7 @@ grafana_provisioning_datasources: |
|
||||
'type': 'prometheus',
|
||||
'access': 'proxy',
|
||||
'url': 'http://matrix-prometheus:9090',
|
||||
}] if matrix_prometheus_enabled else [])
|
||||
}] if prometheus_enabled else [])
|
||||
}}
|
||||
|
||||
grafana_dashboard_download_urls: |
|
||||
@ -3665,6 +3724,8 @@ grafana_default_home_dashboard_path: |-
|
||||
#
|
||||
######################################################################
|
||||
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# matrix-registration
|
||||
|
@ -92,8 +92,9 @@
|
||||
- galaxy/prometheus_node_exporter
|
||||
- galaxy/prometheus_postgres_exporter
|
||||
- custom/matrix-prometheus-nginxlog-exporter
|
||||
- custom/matrix-prometheus
|
||||
- galaxy/prometheus
|
||||
- galaxy/grafana
|
||||
- custom/matrix-prometheus-services-connect
|
||||
- custom/matrix-prometheus-services-proxy-connect
|
||||
- custom/matrix-registration
|
||||
- custom/matrix-client-element
|
||||
|
@ -63,3 +63,7 @@
|
||||
- src: git+https://github.com/mother-of-all-self-hosting/ansible-role-aux.git
|
||||
name: aux
|
||||
version: v1.0.0-0
|
||||
|
||||
- src: git+https://github.com/mother-of-all-self-hosting/ansible-role-prometheus.git
|
||||
name: prometheus
|
||||
version: v2.42.0-0
|
||||
|
@ -13,7 +13,7 @@
|
||||
This role has added to configs in 'matrix-nginx-proxy', 'matrix-synapse-reverse-proxy-companion' and 'matrix-prometheus'.
|
||||
Running 'setup-synapse-reverse-proxy-companion' WILL NOT remove those settings from those roles.
|
||||
Run the playbook again with the `setup-all` tag or all three 'setup-nginx-proxy,setup-synapse-reverse-proxy-companion,setup-prometheus' tags while
|
||||
'matrix_prometheus_enabled: false' to rebuild their configs.
|
||||
'prometheus_enabled: false' to rebuild their configs.
|
||||
when: not ('setup-all' in ansible_run_tags or ('setup-nginx-proxy' in ansible_run_tags and 'setup-synapse-reverse-proxy-companion' in ansible_run_tags and 'setup-prometheus' in ansible_run_tags))
|
||||
|
||||
- name: Ensure matrix-prometheus-nginxlog-exporter is stopped
|
||||
|
@ -3,9 +3,9 @@
|
||||
- name: Fail if Prometheus not enabled
|
||||
ansible.builtin.fail:
|
||||
msg: >
|
||||
You need to set `matrix_prometheus_enabled: true` or configure an external Prometheus database
|
||||
You need to set `prometheus_enabled: true` or configure an external Prometheus database
|
||||
as this roles requires Prometheus for data storage.
|
||||
when: not matrix_prometheus_enabled and not matrix_prometheus_nginxlog_exporter_metrics_proxying_enabled
|
||||
when: not prometheus_enabled and not matrix_prometheus_nginxlog_exporter_metrics_proxying_enabled
|
||||
|
||||
- name: Fail if docker image not availble for arch
|
||||
ansible.builtin.fail:
|
||||
|
@ -0,0 +1,144 @@
|
||||
---
|
||||
|
||||
# matrix-prometheus-services-connect is a role which helps integrate
|
||||
# the various Matrix services with the Prometheus role.
|
||||
|
||||
# Controls whether Synapse integration should be done
|
||||
matrix_prometheus_services_connect_synapse_enabled: false
|
||||
|
||||
# Controls whether the synapse rules shall be loaded into Prometheus
|
||||
matrix_prometheus_services_connect_synapse_rules_enabled: "{{ matrix_prometheus_services_connect_synapse_enabled }}"
|
||||
|
||||
# Controls whether the synapse rules shall be downloaded
|
||||
matrix_prometheus_services_connect_synapse_rules_download_enabled: "{{ matrix_prometheus_services_connect_synapse_rules_enabled }}"
|
||||
matrix_prometheus_services_connect_synapse_rules_download_synapse_tag: master
|
||||
matrix_prometheus_services_connect_synapse_rules_download_src_url: "https://raw.githubusercontent.com/matrix-org/synapse/{{ matrix_prometheus_services_connect_synapse_rules_download_synapse_tag }}/contrib/prometheus/synapse-v2.rules"
|
||||
matrix_prometheus_services_connect_synapse_rules_download_dir_path: ''
|
||||
matrix_prometheus_services_connect_synapse_rules_download_owner: ''
|
||||
matrix_prometheus_services_connect_synapse_rules_download_group: ''
|
||||
|
||||
# Controls whether Synapse shall be scraped
|
||||
matrix_prometheus_services_connect_scraper_synapse_enabled: false
|
||||
|
||||
# Controls scraping the Synapse processes
|
||||
matrix_prometheus_services_connect_scraper_synapse_job_name: synapse
|
||||
matrix_prometheus_services_connect_scraper_synapse_metrics_path: /_synapse/metrics
|
||||
matrix_prometheus_services_connect_scraper_synapse_scrape_interval: 15s
|
||||
matrix_prometheus_services_connect_scraper_synapse_scrape_timeout: 15s
|
||||
|
||||
matrix_prometheus_services_connect_scraper_synapse_configs: |
|
||||
{{
|
||||
[{
|
||||
'job_name': matrix_prometheus_services_connect_scraper_synapse_job_name,
|
||||
'metrics_path': matrix_prometheus_services_connect_scraper_synapse_metrics_path,
|
||||
'scrape_interval': matrix_prometheus_services_connect_scraper_synapse_scrape_interval,
|
||||
'scrape_timeout': matrix_prometheus_services_connect_scraper_synapse_scrape_timeout,
|
||||
'static_configs': matrix_prometheus_services_connect_scraper_synapse_static_configs,
|
||||
}]
|
||||
}}
|
||||
|
||||
matrix_prometheus_services_connect_scraper_synapse_static_configs: |
|
||||
{{
|
||||
(matrix_prometheus_services_connect_scraper_synapse_main_process_static_configs if matrix_prometheus_services_connect_scraper_synapse_main_process_enabled else [])
|
||||
+
|
||||
(matrix_prometheus_services_connect_scraper_synapse_workers_static_configs if matrix_prometheus_services_connect_scraper_synapse_workers_enabled else [])
|
||||
}}
|
||||
|
||||
# Controls whether the Synapse main process shall be scraped
|
||||
matrix_prometheus_services_connect_scraper_synapse_main_process_enabled: "{{ matrix_prometheus_services_connect_scraper_synapse_enabled }}"
|
||||
|
||||
matrix_prometheus_services_connect_scraper_synapse_main_process_static_configs: |
|
||||
{{
|
||||
[{
|
||||
'targets': [matrix_prometheus_services_connect_scraper_synapse_main_process_static_configs_target],
|
||||
'labels': {
|
||||
'instance': matrix_prometheus_services_connect_scraper_synapse_main_process_static_configs_instance,
|
||||
'job': matrix_prometheus_services_connect_scraper_synapse_main_process_static_configs_job,
|
||||
'index': 0,
|
||||
}
|
||||
}]
|
||||
}}
|
||||
matrix_prometheus_services_connect_scraper_synapse_main_process_static_configs_target: ''
|
||||
matrix_prometheus_services_connect_scraper_synapse_main_process_static_configs_instance: "{{ matrix_domain }}"
|
||||
matrix_prometheus_services_connect_scraper_synapse_main_process_static_configs_job: master
|
||||
|
||||
# Controls whether Synapse workers shall be scraped
|
||||
matrix_prometheus_services_connect_scraper_synapse_workers_enabled: "{{ matrix_prometheus_services_connect_scraper_synapse_enabled and matrix_prometheus_services_connect_scraper_synapse_workers_enabled_list | length > 0 }}"
|
||||
|
||||
matrix_prometheus_services_connect_scraper_synapse_workers_enabled_list: []
|
||||
|
||||
matrix_prometheus_services_connect_scraper_synapse_workers_static_configs_as_yaml: |
|
||||
{% for worker in matrix_prometheus_services_connect_scraper_synapse_workers_enabled_list %}
|
||||
{% if worker.metrics_port != 0 %}
|
||||
- targets: ['{{ worker.name }}:{{ worker.metrics_port }}']
|
||||
labels:
|
||||
instance: {{ matrix_prometheus_services_connect_scraper_synapse_workers_static_configs_instance | to_json }}
|
||||
worker_id: {{ worker.id | to_json }}
|
||||
job: {{ worker.type | to_json }}
|
||||
app: {{ worker.app | to_json }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
matrix_prometheus_services_connect_scraper_synapse_workers_static_configs_instance: "{{ matrix_domain }}"
|
||||
|
||||
matrix_prometheus_services_connect_scraper_synapse_workers_static_configs: "{{ [] if matrix_prometheus_services_connect_scraper_synapse_workers_enabled_list | length == 0 else matrix_prometheus_services_connect_scraper_synapse_workers_static_configs_as_yaml | from_yaml }}"
|
||||
|
||||
# Controls whether Postgres (postgres-exporter) shall be scraped
|
||||
matrix_prometheus_services_connect_scraper_postgres_enabled: false
|
||||
matrix_prometheus_services_connect_scraper_postgres_job_name: postgres
|
||||
matrix_prometheus_services_connect_scraper_postgres_metrics_path: /metrics
|
||||
matrix_prometheus_services_connect_scraper_postgres_scrape_interval: 15s
|
||||
matrix_prometheus_services_connect_scraper_postgres_scrape_timeout: 15s
|
||||
matrix_prometheus_services_connect_scraper_postgres_static_configs: "{{ [{'targets': [matrix_prometheus_services_connect_scraper_postgres_static_configs_target]}] }}"
|
||||
matrix_prometheus_services_connect_scraper_postgres_static_configs_target: ''
|
||||
# The final scrape config for the Postgers scraper
|
||||
matrix_prometheus_services_connect_scraper_postgres_scrape_configs: |
|
||||
{{
|
||||
[{
|
||||
'job_name': matrix_prometheus_services_connect_scraper_postgres_job_name,
|
||||
'metrics_path': matrix_prometheus_services_connect_scraper_postgres_metrics_path,
|
||||
'scrape_interval': matrix_prometheus_services_connect_scraper_postgres_scrape_interval,
|
||||
'scrape_timeout': matrix_prometheus_services_connect_scraper_postgres_scrape_timeout,
|
||||
'static_configs': matrix_prometheus_services_connect_scraper_postgres_static_configs,
|
||||
}]
|
||||
}}
|
||||
|
||||
# Controls whether Hookshot shall be scraped
|
||||
matrix_prometheus_services_connect_scraper_hookshot_enabled: false
|
||||
matrix_prometheus_services_connect_scraper_hookshot_job_name: hookshot
|
||||
matrix_prometheus_services_connect_scraper_hookshot_metrics_path: /metrics
|
||||
matrix_prometheus_services_connect_scraper_hookshot_scrape_interval: 15s
|
||||
matrix_prometheus_services_connect_scraper_hookshot_scrape_timeout: 15s
|
||||
matrix_prometheus_services_connect_scraper_hookshot_static_configs: "{{ [{'targets': [matrix_prometheus_services_connect_scraper_hookshot_static_configs_target]}] }}"
|
||||
matrix_prometheus_services_connect_scraper_hookshot_static_configs_target: ''
|
||||
# The final scrape config for the Hookshot scraper
|
||||
matrix_prometheus_services_connect_scraper_hookshot_scrape_configs: |
|
||||
{{
|
||||
[{
|
||||
'job_name': matrix_prometheus_services_connect_scraper_hookshot_job_name,
|
||||
'metrics_path': matrix_prometheus_services_connect_scraper_hookshot_metrics_path,
|
||||
'scrape_interval': matrix_prometheus_services_connect_scraper_hookshot_scrape_interval,
|
||||
'scrape_timeout': matrix_prometheus_services_connect_scraper_hookshot_scrape_timeout,
|
||||
'static_configs': matrix_prometheus_services_connect_scraper_hookshot_static_configs,
|
||||
}]
|
||||
}}
|
||||
|
||||
# Controls whether nginxlog shall be scraped
|
||||
matrix_prometheus_services_connect_scraper_nginxlog_enabled: false
|
||||
matrix_prometheus_services_connect_scraper_nginxlog_job_name: nginxlog
|
||||
matrix_prometheus_services_connect_scraper_nginxlog_metrics_path: /metrics
|
||||
matrix_prometheus_services_connect_scraper_nginxlog_scrape_interval: 15s
|
||||
matrix_prometheus_services_connect_scraper_nginxlog_scrape_timeout: 15s
|
||||
matrix_prometheus_services_connect_scraper_nginxlog_static_configs: "{{ [{'targets': [matrix_prometheus_services_connect_scraper_nginxlog_static_configs_target]}] }}"
|
||||
matrix_prometheus_services_connect_scraper_nginxlog_static_configs_target: ''
|
||||
# The final scrape config for the nginxlog scraper
|
||||
matrix_prometheus_services_connect_scraper_nginxlog_scrape_configs: |
|
||||
{{
|
||||
[{
|
||||
'job_name': matrix_prometheus_services_connect_scraper_nginxlog_job_name,
|
||||
'metrics_path': matrix_prometheus_services_connect_scraper_nginxlog_metrics_path,
|
||||
'scrape_interval': matrix_prometheus_services_connect_scraper_nginxlog_scrape_interval,
|
||||
'scrape_timeout': matrix_prometheus_services_connect_scraper_nginxlog_scrape_timeout,
|
||||
'static_configs': matrix_prometheus_services_connect_scraper_nginxlog_static_configs,
|
||||
}]
|
||||
}}
|
@ -0,0 +1,14 @@
|
||||
---
|
||||
|
||||
- name: Download synapse-v2.rules
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ matrix_prometheus_services_connect_synapse_rules_download_src_url }}"
|
||||
dest: "{{ matrix_prometheus_services_connect_synapse_rules_download_dir_path }}/synapse-v2.rules"
|
||||
force: true
|
||||
mode: 0440
|
||||
owner: "{{ matrix_prometheus_services_connect_synapse_rules_download_owner }}"
|
||||
group: "{{ matrix_prometheus_services_connect_synapse_rules_download_group }}"
|
||||
register: result
|
||||
retries: "{{ devture_playbook_help_geturl_retries_count }}"
|
||||
delay: "{{ devture_playbook_help_geturl_retries_delay }}"
|
||||
until: result is not failed
|
@ -0,0 +1,11 @@
|
||||
---
|
||||
|
||||
- tags:
|
||||
- setup-all
|
||||
- setup-prometheus
|
||||
- setup-prometheus-services-connect
|
||||
- install-all
|
||||
- install-prometheus-services-connect
|
||||
block:
|
||||
- when: matrix_prometheus_services_connect_synapse_rules_download_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/install_synapse_rules.yml"
|
@ -1,90 +0,0 @@
|
||||
---
|
||||
# matrix-prometheus is an open-source systems monitoring and alerting toolkit
|
||||
# See: https://github.com/matrix-org/synapse/blob/master/docs/metrics-howto.md
|
||||
# Project source code URL: https://github.com/prometheus/prometheus
|
||||
|
||||
matrix_prometheus_enabled: false
|
||||
|
||||
matrix_prometheus_version: v2.42.0
|
||||
matrix_prometheus_docker_image: "{{ matrix_container_global_registry_prefix }}prom/prometheus:{{ matrix_prometheus_version }}"
|
||||
matrix_prometheus_docker_image_force_pull: "{{ matrix_prometheus_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_prometheus_base_path: "{{ matrix_base_data_path }}/prometheus"
|
||||
matrix_prometheus_config_path: "{{ matrix_prometheus_base_path }}/config"
|
||||
matrix_prometheus_data_path: "{{ matrix_prometheus_base_path }}/data"
|
||||
|
||||
# A list of extra arguments to pass to the container
|
||||
matrix_prometheus_container_extra_arguments: []
|
||||
|
||||
# List of systemd services that matrix-prometheus.service depends on
|
||||
matrix_prometheus_systemd_required_services_list: ['docker.service']
|
||||
|
||||
# List of systemd services that matrix-prometheus.service wants
|
||||
matrix_prometheus_systemd_wanted_services_list: []
|
||||
|
||||
# The base container network. It will be auto-created by this role if it doesn't exist already.
|
||||
matrix_prometheus_container_network: ''
|
||||
|
||||
# A list of additional container networks that the container would be connected to.
|
||||
# The role does not create these networks, so make sure they already exist.
|
||||
# Use this to expose this container to another reverse proxy, which runs in a different container network.
|
||||
matrix_prometheus_container_additional_networks: []
|
||||
|
||||
# Controls whether the matrix-prometheus container exposes its HTTP port (tcp/9090 in the container).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9090"), or empty string to not expose.
|
||||
matrix_prometheus_container_http_host_bind_port: ''
|
||||
|
||||
# A list of default arguments to pass to the prometheus process
|
||||
matrix_prometheus_process_default_arguments:
|
||||
- "--config.file=/etc/prometheus/prometheus.yml"
|
||||
- "--storage.tsdb.path=/prometheus"
|
||||
- "--web.console.libraries=/usr/share/prometheus/console_libraries"
|
||||
- "--web.console.templates=/usr/share/prometheus/consoles"
|
||||
|
||||
# A list of extra arguments to pass to the prometheus process
|
||||
matrix_prometheus_process_extra_arguments: []
|
||||
|
||||
# holds the final list of process arguments
|
||||
matrix_prometheus_process_arguments: "{{ matrix_prometheus_process_default_arguments + matrix_prometheus_process_extra_arguments }}"
|
||||
|
||||
# Tells whether the "synapse" scraper configuration is enabled.
|
||||
matrix_prometheus_scraper_synapse_enabled: false
|
||||
|
||||
# Tells whether to download and load a Synapse rules file
|
||||
matrix_prometheus_scraper_synapse_rules_enabled: "{{ matrix_prometheus_scraper_synapse_enabled }}"
|
||||
matrix_prometheus_scraper_synapse_rules_synapse_tag: "master"
|
||||
matrix_prometheus_scraper_synapse_rules_download_url: "https://raw.githubusercontent.com/matrix-org/synapse/{{ matrix_prometheus_scraper_synapse_rules_synapse_tag }}/contrib/prometheus/synapse-v2.rules"
|
||||
|
||||
matrix_prometheus_scraper_synapse_targets: []
|
||||
matrix_prometheus_scraper_synapse_workers_enabled_list: []
|
||||
|
||||
# Tells whether the "node" scraper configuration is enabled.
|
||||
# This configuration aims to scrape the current node (this server).
|
||||
matrix_prometheus_scraper_node_enabled: false
|
||||
|
||||
# Target addresses for the "node" scraper configuration.
|
||||
# Unless you define this as a non-empty list, it gets populated at runtime with the IP address of `matrix-prometheus-node-exporter` and port 9100.
|
||||
matrix_prometheus_scraper_node_targets: []
|
||||
|
||||
# Default prometheus configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
# For a more advanced customization, you can extend the default (see `matrix_prometheus_configuration_extension_yaml`)
|
||||
# or completely replace this variable with your own template.
|
||||
matrix_prometheus_configuration_yaml: "{{ lookup('template', 'templates/prometheus.yml.j2') }}"
|
||||
|
||||
matrix_prometheus_configuration_extension_yaml: |
|
||||
# Your custom YAML configuration goes here.
|
||||
# This configuration extends the default starting configuration (`matrix_prometheus_configuration_yaml`).
|
||||
#
|
||||
# You can override individual variables from the default configuration, or introduce new ones.
|
||||
#
|
||||
# If you need something more special, you can take full control by
|
||||
# completely redefining `matrix_prometheus_configuration_yaml`.
|
||||
|
||||
matrix_prometheus_configuration_extension: "{{ matrix_prometheus_configuration_extension_yaml | from_yaml if matrix_prometheus_configuration_extension_yaml | from_yaml is mapping else {} }}"
|
||||
|
||||
# Holds the final configuration (a combination of the default and its extension).
|
||||
# You most likely don't need to touch this variable. Instead, see `matrix_prometheus_configuration_yaml`.
|
||||
matrix_prometheus_configuration: "{{ matrix_prometheus_configuration_yaml | from_yaml | combine(matrix_prometheus_configuration_extension, recursive=True) }}"
|
@ -1,20 +0,0 @@
|
||||
---
|
||||
|
||||
- tags:
|
||||
- setup-all
|
||||
- setup-prometheus
|
||||
- install-all
|
||||
- install-prometheus
|
||||
block:
|
||||
- when: matrix_prometheus_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
|
||||
- when: matrix_prometheus_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
|
||||
- tags:
|
||||
- setup-all
|
||||
- setup-prometheus
|
||||
block:
|
||||
- when: not matrix_prometheus_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
@ -1,57 +0,0 @@
|
||||
---
|
||||
|
||||
- name: Ensure matrix-prometheus image is pulled
|
||||
community.docker.docker_image:
|
||||
name: "{{ matrix_prometheus_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_prometheus_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_prometheus_docker_image_force_pull }}"
|
||||
register: result
|
||||
retries: "{{ devture_playbook_help_container_retries_count }}"
|
||||
delay: "{{ devture_playbook_help_container_retries_delay }}"
|
||||
until: result is not failed
|
||||
|
||||
- name: Ensure Prometheus paths exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- "{{ matrix_prometheus_base_path }}"
|
||||
- "{{ matrix_prometheus_config_path }}"
|
||||
- "{{ matrix_prometheus_data_path }}"
|
||||
|
||||
- name: Download synapse-v2.rules
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ matrix_prometheus_scraper_synapse_rules_download_url }}"
|
||||
dest: "{{ matrix_prometheus_config_path }}/synapse-v2.rules"
|
||||
force: true
|
||||
mode: 0440
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
when: "matrix_prometheus_scraper_synapse_rules_enabled | bool"
|
||||
register: result
|
||||
retries: "{{ devture_playbook_help_geturl_retries_count }}"
|
||||
delay: "{{ devture_playbook_help_geturl_retries_delay }}"
|
||||
until: result is not failed
|
||||
|
||||
- name: Ensure prometheus.yml installed
|
||||
ansible.builtin.copy:
|
||||
content: "{{ matrix_prometheus_configuration | to_nice_yaml(indent=2, width=999999) }}"
|
||||
dest: "{{ matrix_prometheus_config_path }}/prometheus.yml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure Prometheus container network is created
|
||||
community.general.docker_network:
|
||||
name: "{{ matrix_prometheus_container_network }}"
|
||||
driver: bridge
|
||||
|
||||
- name: Ensure matrix-prometheus.service installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-prometheus.service.j2"
|
||||
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-prometheus.service"
|
||||
mode: 0644
|
@ -1,20 +0,0 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-prometheus service
|
||||
ansible.builtin.stat:
|
||||
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-prometheus.service"
|
||||
register: matrix_prometheus_service_stat
|
||||
|
||||
- when: matrix_prometheus_service_stat.stat.exists | bool
|
||||
block:
|
||||
- name: Ensure matrix-prometheus is stopped
|
||||
ansible.builtin.service:
|
||||
name: matrix-prometheus
|
||||
state: stopped
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
|
||||
- name: Ensure matrix-prometheus.service doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-prometheus.service"
|
||||
state: absent
|
@ -1,15 +0,0 @@
|
||||
---
|
||||
|
||||
- name: Fail if Synapse metrics or Prometheus Node Exporter not enabled
|
||||
ansible.builtin.fail:
|
||||
msg: >
|
||||
You need to enable `matrix_prometheus_scraper_synapse_enabled` and/or `matrix_prometheus_scraper_node_enabled` for Prometheus grab metrics.
|
||||
when: "not matrix_prometheus_scraper_synapse_enabled and not matrix_prometheus_scraper_node_enabled"
|
||||
|
||||
- name: Fail if required Prometheus settings not defined
|
||||
ansible.builtin.fail:
|
||||
msg: >
|
||||
You need to define a required configuration setting (`{{ item }}`).
|
||||
when: "vars[item] == ''"
|
||||
with_items:
|
||||
- matrix_prometheus_container_network
|
@ -1,73 +0,0 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
global:
|
||||
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
|
||||
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
|
||||
# scrape_timeout is set to the global default (10s).
|
||||
|
||||
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
|
||||
rule_files:
|
||||
{% if matrix_prometheus_scraper_synapse_rules_enabled %}
|
||||
- 'synapse-v2.rules'
|
||||
{% endif %}
|
||||
|
||||
# A scrape configuration containing exactly one endpoint to scrape:
|
||||
# Here it's Prometheus itself.
|
||||
scrape_configs:
|
||||
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
|
||||
- job_name: 'prometheus'
|
||||
|
||||
# Override the global default and scrape targets from this job every 5 seconds.
|
||||
scrape_interval: 5s
|
||||
scrape_timeout: 5s
|
||||
|
||||
# metrics_path defaults to '/metrics'
|
||||
# scheme defaults to 'http'.
|
||||
|
||||
static_configs:
|
||||
- targets: ['localhost:9090']
|
||||
|
||||
{% if matrix_prometheus_scraper_synapse_enabled %}
|
||||
- job_name: 'synapse'
|
||||
metrics_path: '/_synapse/metrics'
|
||||
static_configs:
|
||||
- targets: {{ matrix_prometheus_scraper_synapse_targets|to_json }}
|
||||
labels:
|
||||
instance: {{ matrix_domain | to_json }}
|
||||
job: master
|
||||
index: 0
|
||||
{% for worker in matrix_prometheus_scraper_synapse_workers_enabled_list %}
|
||||
{% if worker.metrics_port != 0 %}
|
||||
- targets: ['{{ worker.name }}:{{ worker.metrics_port }}']
|
||||
labels:
|
||||
instance: {{ matrix_domain | to_json }}
|
||||
worker_id: {{ worker.id | to_json }}
|
||||
job: {{ worker.type | to_json }}
|
||||
app: {{ worker.app | to_json }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if matrix_prometheus_scraper_node_enabled %}
|
||||
- job_name: node
|
||||
static_configs:
|
||||
- targets: {{ matrix_prometheus_scraper_node_targets|to_json }}
|
||||
{% endif %}
|
||||
|
||||
{% if matrix_prometheus_scraper_postgres_enabled %}
|
||||
- job_name: postgres
|
||||
static_configs:
|
||||
- targets: {{ matrix_prometheus_scraper_postgres_targets|to_json }}
|
||||
{% endif %}
|
||||
|
||||
{% if matrix_prometheus_scraper_hookshot_enabled %}
|
||||
- job_name: hookshot
|
||||
static_configs:
|
||||
- targets: {{ matrix_prometheus_scraper_hookshot_targets|to_json }}
|
||||
{% endif %}
|
||||
|
||||
{% if matrix_prometheus_scraper_nginxlog_enabled %}
|
||||
- job_name: nginxlog
|
||||
static_configs:
|
||||
- targets:
|
||||
- {{ matrix_prometheus_scraper_nginxlog_server_port}}
|
||||
{% endif %}
|
@ -1,51 +0,0 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=matrix-prometheus
|
||||
{% for service in matrix_prometheus_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
{% for service in matrix_prometheus_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
|
||||
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill matrix-prometheus 2>/dev/null || true'
|
||||
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-prometheus 2>/dev/null || true'
|
||||
|
||||
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
|
||||
--rm \
|
||||
--name=matrix-prometheus \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--read-only \
|
||||
--network={{ matrix_prometheus_container_network }} \
|
||||
{% if matrix_prometheus_container_http_host_bind_port %}
|
||||
-p {{ matrix_prometheus_container_http_host_bind_port }}:9090 \
|
||||
{% endif %}
|
||||
-v {{ matrix_prometheus_config_path }}:/etc/prometheus:z \
|
||||
-v {{ matrix_prometheus_data_path }}:/prometheus:z \
|
||||
{% for arg in matrix_prometheus_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
{{ matrix_prometheus_docker_image }} {{ matrix_prometheus_process_arguments|join(' ') }}
|
||||
|
||||
{% for network in matrix_prometheus_container_additional_networks %}
|
||||
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-prometheus
|
||||
{% endfor %}
|
||||
|
||||
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-prometheus
|
||||
|
||||
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill matrix-prometheus 2>/dev/null || true'
|
||||
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-prometheus 2>/dev/null || true'
|
||||
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-prometheus
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -39,6 +39,25 @@
|
||||
- {'old': 'matrix_playbook_traefik_certs_dumper_role_enabled', 'new': 'devture_traefik_certs_dumper_enabled'}
|
||||
- {'old': 'matrix_playbook_traefik_role_enabled', 'new': 'devture_traefik_enabled'}
|
||||
|
||||
# Most important variables from the old Prometheus role here, for people who miss the changelog entry
|
||||
- {'old': 'matrix_prometheus_enabled', 'new': 'prometheus_enabled'}
|
||||
- {'old': 'matrix_prometheus_process_default_arguments', 'new': 'prometheus_process_default_arguments'}
|
||||
- {'old': 'matrix_prometheus_process_extra_arguments', 'new': 'prometheus_process_extra_arguments'}
|
||||
- {'old': 'matrix_prometheus_configuration_extension_yaml', 'new': 'prometheus_configuration_extension_yaml'}
|
||||
- {'old': 'matrix_prometheus_scraper_synapse_enabled', 'new': 'matrix_prometheus_services_connect_synapse_enabled'}
|
||||
- {'old': 'matrix_prometheus_scraper_synapse_targets', 'new': '<superseded by matrix_prometheus_services_connect_scraper_synapse_main_process_static_configs_target>'}
|
||||
- {'old': 'matrix_prometheus_scraper_synapse_workers_enabled_list', 'new': 'matrix_prometheus_services_connect_scraper_synapse_workers_enabled_list'}
|
||||
- {'old': 'matrix_prometheus_scraper_synapse_rules_synapse_tag', 'new': 'matrix_prometheus_services_connect_synapse_rules_download_synapse_tag'}
|
||||
- {'old': 'matrix_prometheus_scraper_node_enabled', 'new': 'prometheus_self_node_scraper_enabled'}
|
||||
- {'old': 'matrix_prometheus_scraper_node_targets', 'new': '<superseded by prometheus_self_node_scraper_static_configs_target>'}
|
||||
- {'old': 'matrix_prometheus_scraper_postgres_enabled', 'new': 'matrix_prometheus_services_connect_scraper_postgres_enabled'}
|
||||
- {'old': 'matrix_prometheus_scraper_postgres_targets', 'new': '<superseded by matrix_prometheus_services_connect_scraper_postgres_static_configs_target>'}
|
||||
- {'old': 'matrix_prometheus_scraper_hookshot_enabled', 'new': 'matrix_prometheus_services_connect_scraper_hookshot_enabled'}
|
||||
- {'old': 'matrix_prometheus_scraper_hookshot_targets', 'new': '<superseded by matrix_prometheus_services_connect_scraper_hookshot_static_configs_target>'}
|
||||
- {'old': 'matrix_prometheus_scraper_nginxlog_enabled', 'new': 'matrix_prometheus_services_connect_scraper_nginxlog_enabled'}
|
||||
- {'old': 'matrix_prometheus_scraper_nginxlog_server_port', 'new': 'matrix_prometheus_services_connect_scraper_nginxlog_static_configs_target'}
|
||||
- {'old': 'XXXXX', 'new': 'XXXXX'}
|
||||
|
||||
- name: (Deprecation) Catch and report matrix_postgres variables
|
||||
ansible.builtin.fail:
|
||||
msg: |-
|
||||
|
Loading…
Reference in New Issue
Block a user