| @@ -1405,6 +1405,8 @@ matrix_prometheus_enabled: false | |||||
| # Prometheus' HTTP port to the local host. | # Prometheus' HTTP port to the local host. | ||||
| matrix_prometheus_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:9090' }}" | matrix_prometheus_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:9090' }}" | ||||
| matrix_prometheus_scraper_node_enabled: "{{ matrix_prometheus_node_exporter_enabled }}" | |||||
| ###################################################################### | ###################################################################### | ||||
| # | # | ||||
| # /matrix-prometheus | # /matrix-prometheus | ||||
| @@ -26,9 +26,13 @@ matrix_prometheus_systemd_wanted_services_list: [] | |||||
| # Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9090"), or empty string to not expose. | # 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: '' | matrix_prometheus_container_http_host_bind_port: '' | ||||
| # 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. | # 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. | # 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_endpoint_node_targets: [] | |||||
| matrix_prometheus_scraper_node_targets: [] | |||||
| # Default prometheus configuration template which covers the generic use case. | # Default prometheus configuration template which covers the generic use case. | ||||
| # You can customize it by controlling the various variables inside it. | # You can customize it by controlling the various variables inside it. | ||||
| @@ -37,8 +37,8 @@ | |||||
| register: matrix_docker_network_info | register: matrix_docker_network_info | ||||
| - set_fact: | - set_fact: | ||||
| matrix_prometheus_endpoint_node_targets: ["{{ matrix_docker_network_info.network.IPAM.Config[0].Gateway }}:9100"] | |||||
| when: "matrix_prometheus_enabled|bool and matrix_prometheus_node_exporter_enabled|bool and matrix_prometheus_endpoint_node_targets|length == 0" | |||||
| matrix_prometheus_scraper_node_targets: ["{{ matrix_docker_network_info.network.IPAM.Config[0].Gateway }}:9100"] | |||||
| when: "matrix_prometheus_enabled|bool and matrix_prometheus_scraper_node_enabled|bool and matrix_prometheus_scraper_node_targets|length == 0" | |||||
| - name: Ensure prometheus.yml installed | - name: Ensure prometheus.yml installed | ||||
| copy: | copy: | ||||
| @@ -33,8 +33,8 @@ scrape_configs: | |||||
| - targets: ['matrix-synapse:{{ matrix_synapse_metrics_port }}'] | - targets: ['matrix-synapse:{{ matrix_synapse_metrics_port }}'] | ||||
| {% endif %} | {% endif %} | ||||
| {% if matrix_prometheus_node_exporter_enabled %} | |||||
| {% if matrix_prometheus_scraper_node_enabled %} | |||||
| - job_name: node | - job_name: node | ||||
| static_configs: | static_configs: | ||||
| - targets: {{ matrix_prometheus_endpoint_node_targets|to_json }} | |||||
| - targets: {{ matrix_prometheus_scraper_node_targets|to_json }} | |||||
| {% endif %} | {% endif %} | ||||