11# Pi-hole Prometheus Exporter
22
3- ![ Build/Push (master)] ( https://github.com/eko/pihole-exporter/workflows/Build/Push%20(master)/badge.svg )
3+ ![ Build/Push (master)] ( < https://github.com/eko/pihole-exporter/workflows/Build/Push%20(master)/badge.svg > )
44[ ![ GoDoc] ( https://godoc.org/github.com/eko/pihole-exporter?status.png )] ( https://godoc.org/github.com/eko/pihole-exporter )
55[ ![ GoReportCard] ( https://goreportcard.com/badge/github.com/eko/pihole-exporter )] ( https://goreportcard.com/report/github.com/eko/pihole-exporter )
66
@@ -10,32 +10,32 @@ This is a Prometheus exporter for [Pi-hole](https://pi-hole.net/)'s Raspberry PI
1010
1111Available Grafana Dasboards:
1212
13- * Prometheus: [ Grafana Labs] ( https://grafana.com/grafana/dashboards/10176-pi-hole-exporter/ ) / [ JSON/Github] ( https://raw.githubusercontent.com/eko/pihole-exporter/master/grafana/dashboard.json ) --> [ Preview] ( https://raw.githubusercontent.com/eko/pihole-exporter/master/dashboard.jpg )
14- * InfluxDB 2 (Flux): [ Grafana Labs] ( https://grafana.com/grafana/dashboards/17094-pi-hole-exporter-influxdb-2/ ) / [ JSON/Github] ( https://raw.githubusercontent.com/eko/pihole-exporter/master/grafana/dashboard-influxdb2.json ) --> [ Preview] ( https://raw.githubusercontent.com/eko/pihole-exporter/master/dashboard-influxdb2.png )
13+ - Prometheus: [ Grafana Labs] ( https://grafana.com/grafana/dashboards/10176-pi-hole-exporter/ ) / [ JSON/Github] ( https://raw.githubusercontent.com/eko/pihole-exporter/master/grafana/dashboard.json ) --> [ Preview] ( https://raw.githubusercontent.com/eko/pihole-exporter/master/dashboard.jpg )
14+ - InfluxDB 2 (Flux): [ Grafana Labs] ( https://grafana.com/grafana/dashboards/17094-pi-hole-exporter-influxdb-2/ ) / [ JSON/Github] ( https://raw.githubusercontent.com/eko/pihole-exporter/master/grafana/dashboard-influxdb2.json ) --> [ Preview] ( https://raw.githubusercontent.com/eko/pihole-exporter/master/dashboard-influxdb2.png )
1515
1616## Prerequisites
1717
18- * [ Go] ( https://golang.org/doc/ )
18+ - [ Go] ( https://golang.org/doc/ )
1919
2020## Installation
2121
2222### Download binary
2323
2424You can download the latest version of the binary built for your architecture here:
2525
26- * Architecture ** i386** [
27- [ Linux] ( https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-linux-386 ) /
28- [ Windows] ( https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-windows-386.exe )
29- ]
30- * Architecture ** amd64** [
31- [ Darwin] ( https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-darwin-amd64 ) /
32- [ Linux] ( https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-linux-amd64 ) /
33- [ Windows] ( https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-windows-amd64.exe )
34- ]
35- * Architecture ** arm** [
36- [ Darwin] ( https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-darwin-arm64 ) /
37- [ Linux] ( https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-linux-arm )
38- ]
26+ - Architecture ** i386** [
27+ [ Linux] ( https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-linux-386 ) /
28+ [ Windows] ( https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-windows-386.exe )
29+ ]
30+ - Architecture ** amd64** [
31+ [ Darwin] ( https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-darwin-amd64 ) /
32+ [ Linux] ( https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-linux-amd64 ) /
33+ [ Windows] ( https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-windows-amd64.exe )
34+ ]
35+ - Architecture ** arm** [
36+ [ Darwin] ( https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-darwin-arm64 ) /
37+ [ Linux] ( https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-linux-arm )
38+ ]
3939
4040### Using Docker
4141
@@ -57,7 +57,7 @@ Or use PiHole's `WEBPASSWORD` as an API token instead of the password
5757$ API_TOKEN=$( awk -F= -v key=" WEBPASSWORD" ' $1==key {print $2}' /etc/pihole/setupVars.conf)
5858$ docker run \
5959 -e ' PIHOLE_HOSTNAME=192.168.1.2' \
60- -e " PIHOLE_API_TOKEN =$API_TOKEN " \
60+ -e " PIHOLE_PASSWORD =$API_TOKEN " \
6161 -e ' PORT=9617' \
6262 -p 9617:9617 \
6363 ekofr/pihole-exporter:latest
@@ -84,7 +84,7 @@ To do so, you can specify a list of hostnames, protocols, passwords/API tokens a
8484$ docker run \
8585 -e 'PIHOLE_PROTOCOL=http,http,http" \
8686 -e 'PIHOLE_HOSTNAME=192.168.1.2,192.168.1.3,192.168.1.4"' \
87- -e "PIHOLE_API_TOKEN =$API_TOKEN1,$API_TOKEN2,$API_TOKEN3" \
87+ -e "PIHOLE_PASSWORD =$API_TOKEN1,$API_TOKEN2,$API_TOKEN3" \
8888 -e "PIHOLE_PORT=8080,8081,8080" \
8989 -e 'PORT=9617' \
9090 -p 9617:9617 \
@@ -97,7 +97,7 @@ If port, protocol and API token/password is the same for all instances, you can
9797$ docker run \
9898 -e 'PIHOLE_PROTOCOL=http" \
9999 -e 'PIHOLE_HOSTNAME=192.168.1.2,192.168.1.3,192.168.1.4"' \
100- -e "PIHOLE_API_TOKEN =$API_TOKEN" \
100+ -e "PIHOLE_PASSWORD =$API_TOKEN" \
101101 -e "PIHOLE_PORT=8080" \
102102 -e 'PORT=9617' \
103103 -p 9617:9617 \
@@ -107,6 +107,7 @@ $ docker run \
107107### From sources
108108
109109Optionally, you can download and build it from the sources. You have to retrieve the project sources by using one of the following way:
110+
110111``` bash
111112$ go install github.com/eko/pihole-exporter@latest
112113# or
@@ -116,10 +117,11 @@ $ git clone https://github.com/eko/pihole-exporter.git
116117Install the needed vendors:
117118
118119```
119- $ GO111MODULE=on go mod vendor
120+ $ go mod vendor
120121```
121122
122123Then, build the binary (here, an example to run on Raspberry PI ARM architecture):
124+
123125``` bash
124126$ GOOS=linux GOARCH=arm GOARM=7 go build -o pihole_exporter .
125127```
@@ -138,7 +140,7 @@ Or use PiHole's `WEBPASSWORD` as an API token instead of the password
138140
139141``` bash
140142$ API_TOKEN=$( awk -F= -v key=" WEBPASSWORD" ' $1==key {print $2}' /etc/pihole/setupVars.conf)
141- $ ./pihole_exporter -pihole_hostname 192.168.1.10 -pihole_api_token $API_TOKEN
143+ $ ./pihole_exporter -pihole_hostname 192.168.1.10 -pihole_password $API_TOKEN
142144```
143145
144146``` bash
@@ -178,12 +180,13 @@ Once the exporter is running, you also have to update your `prometheus.yml` conf
178180
179181``` yaml
180182scrape_configs :
181- - job_name : ' pihole'
182- static_configs :
183- - targets : [' localhost:9617' ]
183+ - job_name : " pihole"
184+ static_configs :
185+ - targets : [" localhost:9617" ]
184186` ` `
185187
186188## Available CLI options
189+
187190` ` ` bash
188191# Hostname of the host(s) where Pi-hole is installed
189192 -pihole_hostname string (optional) (default "127.0.0.1")
@@ -195,42 +198,41 @@ scrape_configs:
195198 -timeout duration (optional) (default 5s)
196199
197200# WEBPASSWORD / api token defined on the Pi-hole interface at `/etc/pihole/setupVars.conf`
198- -pihole_api_token string (optional)
201+ -pihole_password string (optional)
199202
200203# Address to be used for the exporter
201204 -bind_addr string (optional) (default "0.0.0.0")
202205
203206# URL Context (first segments of URL path) to the PI-hole admin application
204207 -pihole_admin_context string (optional) (default "admin")
205-
208+
206209# Port to be used for the exporter
207210 -port string (optional) (default "9617")
208211```
209212
210213## Available Prometheus metrics
211214
212- | Metric name | Description |
213- | :----------------------------: | ------------------------------------------------------------------------------------------- |
215+ | Metric name | Description |
216+ | :--------------------------: | ----------------------------------------------------------------------------------------- |
214217| pihole_domains_being_blocked | This represent the number of domains being blocked |
215- | pihole_dns_queries_today | This represent the number of DNS queries made over the current day |
216- | pihole_ads_blocked_today | This represent the number of ads blocked over the current day |
218+ | pihole_dns_queries_today | This represent the number of DNS queries made over the current day |
219+ | pihole_ads_blocked_today | This represent the number of ads blocked over the current day |
217220| pihole_ads_percentage_today | This represent the percentage of ads blocked over the current day |
218- | pihole_unique_domains | This represent the number of unique domains seen |
219- | pihole_queries_forwarded | This represent the number of queries forwarded |
220- | pihole_queries_cached | This represent the number of queries cached |
221- | pihole_clients_ever_seen | This represent the number of clients ever seen |
222- | pihole_unique_clients | This represent the number of unique clients seen |
221+ | pihole_unique_domains | This represent the number of unique domains seen |
222+ | pihole_queries_forwarded | This represent the number of queries forwarded |
223+ | pihole_queries_cached | This represent the number of queries cached |
224+ | pihole_clients_ever_seen | This represent the number of clients ever seen |
225+ | pihole_unique_clients | This represent the number of unique clients seen |
223226| pihole_dns_queries_all_types | This represent the number of DNS queries made for all types |
224- | pihole_reply | This represent the number of replies made for all types |
225- | pihole_top_queries | This represent the number of top queries made by Pi-hole by domain |
226- | pihole_top_ads | This represent the number of top ads made by Pi-hole by domain |
227- | pihole_top_sources | This represent the number of top sources requests made by Pi-hole by source host |
227+ | pihole_reply | This represent the number of replies made for all types |
228+ | pihole_top_queries | This represent the number of top queries made by Pi-hole by domain |
229+ | pihole_top_ads | This represent the number of top ads made by Pi-hole by domain |
230+ | pihole_top_sources | This represent the number of top sources requests made by Pi-hole by source host |
228231| pihole_forward_destinations | This represent the number of forward destinations requests made by Pi-hole by destination |
229- | pihole_querytypes | This represent the number of queries made by Pi-hole by type |
230- | pihole_status | This represent if Pi-hole is enabled |
231- | queries_last_10min | This represent the number of queries in the last full slot of 10 minutes |
232- | ads_last_10min | This represent the number of ads in the last full slot of 10 minutes |
233-
232+ | pihole_querytypes | This represent the number of queries made by Pi-hole by type |
233+ | pihole_status | This represent if Pi-hole is enabled |
234+ | queries_last_10min | This represent the number of queries in the last full slot of 10 minutes |
235+ | ads_last_10min | This represent the number of ads in the last full slot of 10 minutes |
234236
235237## Pihole-Exporter Helm Chart
236238
0 commit comments