Bladeren bron

proxy metrics of nginx and buscarron

pull/2652/head
Aine 3 jaren geleden
bovenliggende
commit
75c155764f
Geen bekende sleutel gevonden voor deze handtekening in de database GPG sleutel-ID: 34969C908CCA2804
4 gewijzigde bestanden met toevoegingen van 62 en 7 verwijderingen
  1. +10
    -0
      roles/custom/matrix-prometheus-services-proxy-connect/defaults/main.yml
  2. +4
    -7
      roles/custom/matrix-prometheus-services-proxy-connect/tasks/main.yml
  3. +24
    -0
      roles/custom/matrix-prometheus-services-proxy-connect/tasks/matrix-bot-buscarron/inject_into_nginx_proxy.yml
  4. +24
    -0
      roles/custom/matrix-prometheus-services-proxy-connect/tasks/matrix-bot-honoroit/inject_into_nginx_proxy.yml

+ 10
- 0
roles/custom/matrix-prometheus-services-proxy-connect/defaults/main.yml Bestand weergeven

@@ -25,3 +25,13 @@ matrix_prometheus_services_proxy_connect_prometheus_postgres_exporter_metrics_pr
# If 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_services_proxy_connect_prometheus_postgres_exporter_matrix_nginx_proxy_not_enabled_proxy_pass_host: "{{ '127.0.0.1' + prometheus_postgres_exporter_container_http_host_bind_port_number_raw if not ':' in prometheus_postgres_exporter_container_http_host_bind_port else (prometheus_postgres_exporter_container_http_host_bind_port if prometheus_postgres_exporter_container_http_host_bind_port.split(':')[0] != '0.0.0.0' else '') }}"

# Controls whether buscarron metrics should be proxied (exposed) on `matrix.DOMAIN/metrics/buscarron`.
# This will only work take effect if `matrix_nginx_proxy_proxy_matrix_metrics_enabled: true`.
# See the `matrix-nginx-proxy` role for details about enabling `matrix_nginx_proxy_proxy_matrix_metrics_enabled`.
matrix_prometheus_services_proxy_connect_matrix_bot_buscarron_metrics_proxying_enabled: false

# Controls whether honoroit metrics should be proxied (exposed) on `matrix.DOMAIN/metrics/buscarron`.
# This will only work take effect if `matrix_nginx_proxy_proxy_matrix_metrics_enabled: true`.
# See the `matrix-nginx-proxy` role for details about enabling `matrix_nginx_proxy_proxy_matrix_metrics_enabled`.
matrix_prometheus_services_proxy_connect_matrix_bot_honoroit_metrics_proxying_enabled: false

+ 4
- 7
roles/custom/matrix-prometheus-services-proxy-connect/tasks/main.yml Bestand weergeven

@@ -17,12 +17,9 @@
block:
- when: prometheus_node_exporter_enabled | bool and matrix_prometheus_services_proxy_connect_prometheus_node_exporter_metrics_proxying_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/prometheus-node-exporter/inject_into_nginx_proxy.yml"

- tags:
- setup-all
- setup-nginx-proxy
- install-all
- install-nginx-proxy
block:
- when: prometheus_node_exporter_enabled | bool and matrix_prometheus_services_proxy_connect_prometheus_postgres_exporter_metrics_proxying_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/prometheus-postgres-exporter/inject_into_nginx_proxy.yml"
- when: matrix_bot_buscarron_enabled | bool and matrix_prometheus_services_proxy_connect_matrix_bot_buscarron_metrics_proxying_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/matrix-bot-buscarron/inject_into_nginx_proxy.yml"
- when: matrix_bot_honoroit_enabled | bool and matrix_prometheus_services_proxy_connect_matrix_bot_honoroit_metrics_proxying_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/matrix-bot-honoroit/inject_into_nginx_proxy.yml"

+ 24
- 0
roles/custom/matrix-prometheus-services-proxy-connect/tasks/matrix-bot-buscarron/inject_into_nginx_proxy.yml Bestand weergeven

@@ -0,0 +1,24 @@
---

- name: Generate buscarron metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/buscarron)
ansible.builtin.set_fact:
matrix_prometheus_services_proxy_connect_matrix_bot_buscarron_nginx_metrics_configuration_block: |
location /metrics/buscarron {
{% if matrix_nginx_proxy_enabled | default(False) %}
{# Use the embedded DNS resolver in Docker containers to discover the service #}
resolver 127.0.0.11 valid=5s;
set $backend "matrix-bot-buscarron:8080";
proxy_pass http://$backend/metrics;
{% else %}
return 404 "matrix-nginx-proxy is disabled and no host port was bound to the container, so metrics are unavailable";
{% endif %}
}

- name: Register buscarron metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/buscarron)
ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
{{
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks | default([])
+
[matrix_prometheus_services_proxy_connect_matrix_bot_buscarron_nginx_metrics_configuration_block]
}}

+ 24
- 0
roles/custom/matrix-prometheus-services-proxy-connect/tasks/matrix-bot-honoroit/inject_into_nginx_proxy.yml Bestand weergeven

@@ -0,0 +1,24 @@
---

- name: Generate honoroit metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/honoroit)
ansible.builtin.set_fact:
matrix_prometheus_services_proxy_connect_matrix_bot_honoroit_nginx_metrics_configuration_block: |
location /metrics/honoroit {
{% if matrix_nginx_proxy_enabled | default(False) %}
{# Use the embedded DNS resolver in Docker containers to discover the service #}
resolver 127.0.0.11 valid=5s;
set $backend "matrix-bot-honoroit:8080";
proxy_pass http://$backend/metrics;
{% else %}
return 404 "matrix-nginx-proxy is disabled and no host port was bound to the container, so metrics are unavailable";
{% endif %}
}

- name: Register honoroit metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/honoroit)
ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
{{
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks | default([])
+
[matrix_prometheus_services_proxy_connect_matrix_bot_honoroit_nginx_metrics_configuration_block]
}}

Laden…
Annuleren
Opslaan