Enable exposure of Prometheus metrics.

This commit is contained in:
dhose
2019-01-30 19:31:50 +01:00
parent f55a29a4d0
commit 87e3deebfd
9 changed files with 71 additions and 1 deletions

View File

@ -120,6 +120,28 @@ server {
proxy_max_temp_file_size 0;
}
{% if matrix_nginx_proxy_proxy_synapse_metrics %}
location /_synapse/metrics {
{% if matrix_nginx_proxy_enabled %}
{# Use the embedded DNS resolver in Docker containers to discover the service #}
resolver 127.0.0.11 valid=5s;
set $backend "{{ matrix_nginx_proxy_proxy_synapse_metrics_addr_with_container }}";
proxy_pass http://$backend;
{% else %}
{# Generic configuration for use outside of our container setup #}
proxy_pass http://{{ matrix_nginx_proxy_proxy_synapse_metrics_addr_sans_container }};
{% endif %}
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
{% if matrix_nginx_proxy_proxy_synapse_metrics_basic_auth_enabled %}
auth_basic "protected";
auth_basic_user_file .matrix-synapse-metrics-htpasswd;
{% endif %}
}
{% endif %}
location / {
rewrite ^/$ /_matrix/static/ last;
}

View File

@ -0,0 +1,2 @@
# User and password for protecting /_synapse/metrics URI
prometheus:{{ matrix_nginx_proxy_proxy_synapse_metrics_basic_auth_key }}