소스 검색

proxy metrics of nginx and buscarron

pull/2652/head
Aine 3 년 전
부모
커밋
75c155764f
No known key found for this signature in database GPG 키 ID: 34969C908CCA2804
4개의 변경된 파일62개의 추가작업 그리고 7개의 파일을 삭제
  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 파일 보기

@@ -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 파일 보기

@@ -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 파일 보기

@@ -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 파일 보기

@@ -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]
}}

불러오는 중...
취소
저장