From ea4ee93b13cfffc43b75e1688c0f953e0b439dcc Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Thu, 28 Jul 2022 03:56:59 +0200 Subject: [PATCH] if variable to bind an exporter container to a host port is set, have matrix-domain.conf (nginx) support this --- roles/matrix-prometheus-node-exporter/tasks/init.yml | 6 +++--- roles/matrix-prometheus-postgres-exporter/tasks/init.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/roles/matrix-prometheus-node-exporter/tasks/init.yml b/roles/matrix-prometheus-node-exporter/tasks/init.yml index 51dd94f2a..064699117 100644 --- a/roles/matrix-prometheus-node-exporter/tasks/init.yml +++ b/roles/matrix-prometheus-node-exporter/tasks/init.yml @@ -23,10 +23,10 @@ resolver 127.0.0.11 valid=5s; set $backend "matrix-prometheus-node-exporter:9100"; proxy_pass http://$backend/metrics; + {% elif matrix_prometheus_postgres_exporter_container_http_host_bind_port != '' %} + proxy_pass http://{{ matrix_prometheus_postgres_exporter_container_http_host_bind_port }}/metrics; {% else %} - {# Generic configuration for use outside of our container setup #} - {# This may be implemented in the future. #} - return 404 "matrix-nginx-proxy is disabled, so metrics are unavailable"; + return 404 "matrix-nginx-proxy is disabled and no host port was bound to the container, so metrics are unavailable"; {% endif %} } diff --git a/roles/matrix-prometheus-postgres-exporter/tasks/init.yml b/roles/matrix-prometheus-postgres-exporter/tasks/init.yml index 6da169370..0de0c0054 100644 --- a/roles/matrix-prometheus-postgres-exporter/tasks/init.yml +++ b/roles/matrix-prometheus-postgres-exporter/tasks/init.yml @@ -23,10 +23,10 @@ resolver 127.0.0.11 valid=5s; set $backend "matrix-prometheus-postgres-exporter:9187"; proxy_pass http://$backend/metrics; + {% elif matrix_prometheus_node_exporter_container_http_host_bind_port != '' %} + proxy_pass http://{{ matrix_prometheus_node_exporter_container_http_host_bind_port }}/metrics; {% else %} - {# Generic configuration for use outside of our container setup #} - {# This may be implemented in the future. #} - return 404 "matrix-nginx-proxy is disabled, so metrics are unavailable"; + return 404 "matrix-nginx-proxy is disabled and no host port was bound to the container, so metrics are unavailable"; {% endif %} }