diff --git a/npm_install.py b/npm_install.py index ca9819b..186a2b2 100644 --- a/npm_install.py +++ b/npm_install.py @@ -1527,14 +1527,13 @@ exec sudo -n /usr/sbin/angie "$@" def write_metrics_files(): - cert_path = NPM_ADMIN_CERT_PATH key_path = NPM_ADMIN_KEY_PATH """Create /etc/angie/metrics.conf (port 82/8282 with console & status).""" with step("Adding Angie metrics & console on :82 / :8282 (https)"): metrics = f"""include /etc/angie/prometheus_all.conf; -server { +server {{ listen 8282 ssl; http2 on; access_log off; @@ -1542,7 +1541,7 @@ server { ssl_certificate {cert_path}; ssl_certificate_key {key_path}; - location / { + location / {{ default_type text/html; echo ''; echo 'Status Page'; @@ -1553,40 +1552,40 @@ server { echo '
  • Prometheus Metrics
  • '; echo ''; echo ''; - } + }} - location /nginx_status { + location /nginx_status {{ stub_status on; access_log off; allow all; - } + }} auto_redirect on; - location /status/ { + location /status/ {{ api /status/; api_config_files on; - } + }} - location /console/ { + location /console/ {{ alias /usr/share/angie-console-light/html/; index index.html; - } + }} - location /console/api/ { + location /console/api/ {{ api /status/; - } + }} - location =/p8s { + location =/p8s {{ prometheus all; - } -} + }} +}} -server { +server {{ listen 82; access_log off; - location / { + location / {{ default_type text/html; echo ''; echo 'Status Page'; @@ -1597,34 +1596,34 @@ server { echo '
  • Prometheus Metrics
  • '; echo ''; echo ''; - } + }} - location /nginx_status { + location /nginx_status {{ stub_status on; access_log off; allow all; - } + }} auto_redirect on; - location /status/ { + location /status/ {{ api /status/; api_config_files on; - } + }} - location /console/ { + location /console/ {{ alias /usr/share/angie-console-light/html/; index index.html; - } + }} - location /console/api/ { + location /console/api/ {{ api /status/; - } + }} - location =/p8s { + location =/p8s {{ prometheus all; - } -} + }} +}} """ write_file(Path("/etc/angie/metrics.conf"), metrics, 0o644)