Skip to content

Commit 35badb3

Browse files
committed
Fixes #450: Fix pihole-exporter for all scenarios and add prometheus_monitor_prometheus.
1 parent 3e529d4 commit 35badb3

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

example.config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ monitoring_ping_hosts: # [URL];[HUMAN_READABLE_NAME]
2626
- https://www.apple.com/;apple.com
2727

2828
# Prometheus configuration.
29+
prometheus_monitor_prometheus: false
2930
prometheus_node_exporter_targets:
3031
- 'nodeexp:9100'
3132
prometheus_extra_scrape_configs: ''

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ services:
6464
pihole-exporter:
6565
container_name: pihole-exporter
6666
image: ekofr/pihole-exporter:latest
67-
hostname: '{{ pihole_hostname }}-exporter'
67+
hostname: 'pihole-exporter'
6868
ports:
6969
- "9617:9617"
7070
environment:

templates/prometheus.yml.j2

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ rule_files:
1010
- 'alert.rules'
1111

1212
scrape_configs:
13+
{% if prometheus_monitor_prometheus %}
1314
- job_name: 'prometheus'
1415
scrape_interval: 5s
1516
static_configs:
1617
- targets: ['localhost:9090']
18+
{% endif %}
1719

1820
- job_name: 'speedtest'
1921
metrics_path: /metrics
@@ -72,11 +74,12 @@ scrape_configs:
7274
- job_name: 'node'
7375
static_configs:
7476
- targets: {{ prometheus_node_exporter_targets | to_yaml }}
75-
{% if pihole_enable %}
76-
- job_name: 'pihole-exporter'
77+
78+
{% if pihole_enable %}
79+
- job_name: '{{ pihole_hostname }}'
7780
static_configs:
78-
- targets: ['pihole:9617']
79-
{% endif %}
81+
- targets: ['{{ pihole_hostname }}:9617']
82+
{% endif %}
8083

8184
{% filter indent(width=2,first=True) %}
8285
{{ prometheus_extra_scrape_configs }}

0 commit comments

Comments
 (0)