Skip to content

Commit

Permalink
Fixes #450: Fix pihole-exporter for all scenarios and add prometheus_…
Browse files Browse the repository at this point in the history
…monitor_prometheus.
  • Loading branch information
geerlingguy committed Oct 14, 2022
1 parent 3e529d4 commit 35badb3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions example.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ monitoring_ping_hosts: # [URL];[HUMAN_READABLE_NAME]
- https://www.apple.com/;apple.com

# Prometheus configuration.
prometheus_monitor_prometheus: false
prometheus_node_exporter_targets:
- 'nodeexp:9100'
prometheus_extra_scrape_configs: ''
Expand Down
2 changes: 1 addition & 1 deletion templates/pi-hole-docker-compose.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ services:
pihole-exporter:
container_name: pihole-exporter
image: ekofr/pihole-exporter:latest
hostname: '{{ pihole_hostname }}-exporter'
hostname: 'pihole-exporter'
ports:
- "9617:9617"
environment:
Expand Down
11 changes: 7 additions & 4 deletions templates/prometheus.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ rule_files:
- 'alert.rules'

scrape_configs:
{% if prometheus_monitor_prometheus %}
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
{% endif %}

- job_name: 'speedtest'
metrics_path: /metrics
Expand Down Expand Up @@ -72,11 +74,12 @@ scrape_configs:
- job_name: 'node'
static_configs:
- targets: {{ prometheus_node_exporter_targets | to_yaml }}
{% if pihole_enable %}
- job_name: 'pihole-exporter'

{% if pihole_enable %}
- job_name: '{{ pihole_hostname }}'
static_configs:
- targets: ['pihole:9617']
{% endif %}
- targets: ['{{ pihole_hostname }}:9617']
{% endif %}

{% filter indent(width=2,first=True) %}
{{ prometheus_extra_scrape_configs }}
Expand Down

0 comments on commit 35badb3

Please sign in to comment.