From 0a31313956fac3bde03975eb6d9419c018e564ed Mon Sep 17 00:00:00 2001 From: justin Date: Fri, 1 May 2026 03:21:27 -0500 Subject: [PATCH] Fix nginx-exporter: back to bridge network with host.docker.internal host network mode prevented Prometheus from reaching the exporter. Switched back to bridge with extra_hosts + explicit port mapping. Added timeout flag to prevent hanging on stub_status fetch. Co-Authored-By: Claude Opus 4.6 (1M context) --- docker-compose.yml | 8 ++++++-- monitoring/prometheus.yml | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index cf4525a..843a208 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -374,8 +374,12 @@ services: nginx-exporter: image: nginx/nginx-prometheus-exporter:latest command: - - -nginx.scrape-uri=http://127.0.0.1:8888/nginx_status - network_mode: host + - -nginx.scrape-uri=http://host.docker.internal:8888/nginx_status + - -nginx.timeout=5s + extra_hosts: + - "host.docker.internal:host-gateway" + ports: + - "127.0.0.1:9113:9113" restart: unless-stopped blackbox-exporter: diff --git a/monitoring/prometheus.yml b/monitoring/prometheus.yml index c93914f..a788af8 100644 --- a/monitoring/prometheus.yml +++ b/monitoring/prometheus.yml @@ -42,7 +42,7 @@ scrape_configs: # ── nginx ────────────────────────────────────────────────────────── - job_name: nginx static_configs: - - targets: ["host.docker.internal:9113"] + - targets: ["nginx-exporter:9113"] # ── Blackbox probes (HTTP endpoint monitoring) ───────────────────── - job_name: blackbox_http