Skip to content

Commit 37a3186

Browse files
authored
Fix pihole-exporter configuration (#639)
* Fix pihole-exporter target target should be pihole-exporter container and not pihole * Fix pihole and pihole-exporter network config pihole-exporter can only access the metrics if both containers are in the same network
1 parent bf0a210 commit 37a3186

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

templates/pi-hole-docker-compose.yml.j2

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
# {{ ansible_managed }}
22
---
3+
networks:
34
{% if domain_name_enable and domain_name and domain_pihole %}
45
{# Make sure pihole and nginx-proxy are in the same network #}
5-
networks:
66
front-tier:
77
name: internet-monitoring-front-tier
88
external: true
99
{% endif %}
10+
{# pihole and pihole-exporter need to share network with Prometheus #}
11+
back-tier:
12+
name: internet-monitoring-back-tier
13+
external: true
14+
1015

1116
# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
1217
services:
@@ -35,7 +40,10 @@ services:
3540
VIRTUAL_HOST: {{ domain_pihole }}.{{ domain_name }}
3641
VIRTUAL_PORT: 80
3742
PROXY_LOCATION: {{ domain_pihole }}
43+
{% endif %}
3844
networks:
45+
- back-tier
46+
{% if domain_name_enable and domain_name and domain_pihole %}
3947
- front-tier
4048
{% endif %}
4149
dns:
@@ -68,6 +76,8 @@ services:
6876
image: ekofr/pihole-exporter:latest
6977
restart: unless-stopped
7078
hostname: 'pihole-exporter'
79+
networks:
80+
- back-tier
7181
ports:
7282
- "9617:9617"
7383
environment:

templates/prometheus.yml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ scrape_configs:
7878
{% if pihole_enable %}
7979
- job_name: '{{ pihole_hostname }}'
8080
static_configs:
81-
- targets: ['{{ pihole_hostname }}:9617']
81+
- targets: ['pihole-exporter:9617']
8282
{% endif %}
8383

8484
{% filter indent(width=2,first=True) %}

0 commit comments

Comments
 (0)