Skip to main content

Export pihole metrics for prometheus

Project description

A prometheus exporter for PiHole written in Python 3.

Grafana Dashboard See grafana_dashboard.json

License: MIT Codacy Badge Docker Automated build


Available metrics

  • Queries forwarded (24h)
  • Domains being blocked
  • Ads percentage today
  • Ads blocked today
  • DNS queries today
  • Total clients
  • Unique clients
  • Queries cached
  • Unique Domains
  • Top Queries
  • Top Ads
  • Top clients
  • Forward destinations
  • Query type
  • Reply type
  • DNS queries by host

Metrics Example

Some metrics have been redacted.

pihole_exporter_version 0.1
pihole_domains_being_blocked 573713
pihole_dns_queries_today 13961
pihole_ads_blocked_today 3443
pihole_ads_percentage_today 24.661556
pihole_unique_domains 983
pihole_queries_forwarded 4346
pihole_queries_cached 3288
pihole_clients_ever_seen 9
pihole_unique_clients 5
pihole_dns_queries_all_types 13974
pihole_reply_nodata 34
pihole_reply_nxdomain 0
pihole_reply_cname 37
pihole_reply_ip 88
pihole_status 1
pihole_gravity_last_updated 1533820315
pihole_top_queries{domain=""} 321
pihole_top_queries{domain=""} 292
pihole_top_queries{domain=""} 165
pihole_top_queries{domain=""} 145
pihole_top_queries{domain=""} 124
pihole_top_queries{domain=""} 112
pihole_top_queries{domain=""} 112
pihole_top_queries{domain=""} 98
pihole_top_queries{domain=""} 72
pihole_top_ads{domain=""} 872
pihole_top_ads{domain=""} 169
pihole_top_ads{domain=""} 147
pihole_top_ads{domain=""} 133
pihole_top_ads{domain=""} 114
pihole_top_ads{domain=""} 89
pihole_top_ads{domain=""} 88
pihole_top_ads{domain=""} 75
pihole_top_ads{domain=""} 73
pihole_top_ads{domain=""} 71
pihole_top_sources{client=""} 2833
pihole_top_sources{client=""} 2799
pihole_top_sources{client=""} 1045
pihole_top_sources{client=""} 332
pihole_top_sources{client=""} 277
pihole_forward_destinations{resolver="blocklist|blocklist"} 31.08
pihole_forward_destinations{resolver="cache|cache"} 29.68
pihole_forward_destinations{resolver="|"} 39.23
pihole_query_type{type="A (IPv4)"} 76.53
pihole_query_type{type="AAAA (IPv6)"} 23.38
pihole_query_type{type="ANY"} 0
pihole_query_type{type="SRV"} 0
pihole_query_type{type="SOA"} 0
pihole_query_type{type="PTR"} 0.09
pihole_query_type{type="TXT"} 0




pip3 install --upgrade pihole_exporter

github master branch

pip3 install --upgrade git+


git clone
pip3 install -r requirements.txt
cd pihole_exporter



docker pull dr1s/pihole_exporter
docker run --net=host -v /etc/pihole:/etc/pihole -t dr1s/pihole_exporter


git clone
docker build -t dr1s/pihole_exporter .
docker run -d --net=host -v /etc/pihole:/etc/pihole -t dr1s/pihole_exporter


usage: [-h] [-o PIHOLE] [-p PORT] [-i INTERFACE] [-a AUTH]


optional arguments:
-h, --help            show this help message and exit
-o PIHOLE, --pihole PIHOLE
										pihole adress
-p PORT, --port PORT  port pihole_exporter is listening on
								interface pihole_exporter will listen on
-a AUTH, --auth AUTH  Pihole password hash

Usage Example

pihole_exporter --pihole pi.hole --interface --port 9311

The previous used arguements are the default options. If nothing needs to be changed, pihole_exporter can be started without arguments.



If pihole_exporter is installed on the same host as pihole and the auth argument is not set, pihole_exporter will try to read the password from setupVars.conf

Otherwise get the hashed password from setupVars.conf:

$ grep WEBPASSWORD /etc/pihole/setupVars.conf

Use this hash as the argument for --auth

pihole_exporter --auth da1a51f575cd740be233d22548ecac1dbcc96ffa297283a6a204f9213a8aca71
docker run -d --net=host -t dr1s/pihole_exporter --pihole pi.hole --auth da1a51f575cd740be233d22548ecac1dbcc96ffa297283a6a204f9213a8aca71

Prometheus config

- job_name: 'pihole'
  - targets: ['pi.hole:9311']

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pihole_exporter-0.4.4.tar.gz (5.5 kB view hashes)

Uploaded Source

Built Distribution

pihole_exporter-0.4.4-py2.py3-none-any.whl (5.8 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page