Skip to content
This repository was archived by the owner on Mar 22, 2025. It is now read-only.

Commit 906029c

Browse files
authored
Update readme for auth, summaryRaw endpoint (#65)
1 parent ee64d82 commit 906029c

File tree

2 files changed

+20
-26
lines changed

2 files changed

+20
-26
lines changed

README.md

+19-25
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# Pi-hole-Influx
22

3-
43
[![Build Status](https://github.com/janw/pi-hole-influx/actions/workflows/docker-build.yaml/badge.svg?branch=fix-readme-badges)](https://github.com/janw/pi-hole-influx/pkgs/container/pi-hole-influx)
54

65
[![Coverage Status](https://codecov.io/gh/janw/pi-hole-influx/branch/master/graph/badge.svg?token=EZTLSEAZD9)](https://codecov.io/gh/janw/pi-hole-influx)
76
[![Maintainability](https://api.codeclimate.com/v1/badges/cfe71020e6505ca65cfc/maintainability)](https://codeclimate.com/github/janw/pi-hole-influx/maintainability)
87

98
[![Code style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
109

11-
A simple daemonized script to report Pi-Hole stats to an InfluxDB, ready to be displayed via Grafana. **Nowadays I store Pi-hole statistics in Prometheus using [eko/pihole-exporter](https://github.com/eko/pihole-exporter) instead. Thus am no longer actively using this project myself. I will try to merge Pull Reqests in a timely manner though.**
10+
A simple daemonized script to report Pi-Hole stats to an InfluxDB (v1) instance, ready to be displayed via Grafana. **Nowadays I store Pi-hole statistics in Prometheus using [eko/pihole-exporter](https://github.com/eko/pihole-exporter) instead. Thus am no longer actively using this project myself. I will try to merge Pull Reqests in a timely manner though.**
1211

1312
**⚠️ The docker image name has been changed to `ghcr.io/janw/pi-hole-influx`. Please update your deployment accordingly.**
1413

@@ -25,44 +24,39 @@ A simple daemonized script to report Pi-Hole stats to an InfluxDB, ready to be d
2524
-e PIHOLE_INFLUXDB_USERNAME="myusername" \
2625
-e PIHOLE_INFLUXDB_PASSWORD="mysupersecretpassword" \
2726
-e PIHOLE_INFLUXDB_DATABASE="pihole" \
28-
-e PIHOLE_INSTANCES="localhost=http://127.0.0.1/admin/api.php" \
27+
-e PIHOLE_INSTANCES="localhost=http://127.0.0.1/admin/api.php?summaryRaw" \
28+
--network host \
2929
ghcr.io/janw/pi-hole-influx
3030
```
3131

32-
* For running it on a Raspberry Pi (arm v7 arch), use the dedicated `armv7` image tag:
32+
The following values are the defaults and will be used if not set:
3333

34-
```bash
35-
docker run \
36-
-e PIHOLE_INFLUXDB_HOST="myhostname" \
37-
-e PIHOLE_INFLUXDB_USERNAME="myusername" \
38-
-e PIHOLE_INFLUXDB_PASSWORD="mysupersecretpassword" \
39-
--network host \
40-
ghcr.io/janw/pi-hole-influx:armv7
41-
```
34+
* `PIHOLE_INFLUXDB_PORT="8086"`
35+
* `PIHOLE_INFLUXDB_HOST="127.0.0.1"`
36+
* `PIHOLE_INFLUXDB_DATABASE="pihole"`
37+
* `PIHOLE_INSTANCES="localhost=http://127.0.0.1/admin/api.php?summaryRaw"`
4238

43-
Before you can run the above, you will need to have your docker server authenticated with registry.gitlab.com:
39+
Note that the API URL is suffixed with `?summaryRaw` to allow pi-hole-influx to receive the correct data format.
4440

45-
* Create a personal access token [following the GitLab documentation](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html). Put the token somewhere safe. Once you leave or refresh the page, you won’t be able to access it again.
46-
* Login to the registry with:
41+
### Authentication (new as of November 2022)
4742

48-
```bash
49-
docker login -u <your-gitlab-username> -p <access-token> registry.gitlab.com
50-
```
43+
Newer versions of Pi-hole [require authentication when accessing the API](https://pi-hole.net/blog/2022/11/17/upcoming-changes-authentication-for-more-api-endpoints-required/#page-content) of an instance that has been configured with a web-interface password. If that is the case for your instance (as it should be), please make sure the API URL follows the format of
5144

52-
The following values are the defaults and will be used if not set:
45+
```text
46+
http://<INSTANCE_HOST>/admin/api.php?summaryRaw&auth=<AUTH_TOKEN>
47+
```
5348

54-
* `PIHOLE_INFLUXDB_PORT="8086"`
55-
* `PIHOLE_INFLUXDB_HOST="127.0.0.1"`
56-
* `PIHOLE_INFLUXDB_DATABASE="pihole"`
57-
* `PIHOLE_INSTANCES="localhost=http://127.0.0.1/admin/api.php"`
49+
where `<AUTH_TOKEN>` should be replaced with the token you can find on the Pi-hole admin panel under Settings -> API / Web interface -> Show API token.
50+
51+
### Multiple instances
5852

5953
`PIHOLE_INSTANCES` contains the Pi-hole instances that are to be reported. Multiple instances can given in a dict-like boxed syntax, known as [Inline Tables in TOML](https://github.com/toml-lang/toml#inline-table):
6054

6155
```bash
62-
PIHOLE_INSTANCES="{first_one='http://127.0.0.1/admin/api.php',second_pihole='http://192.168.42.79/admin/api.php'[,…]}"
56+
PIHOLE_INSTANCES="{first_one='http://127.0.0.1/admin/api.php?summaryRaw',second_pihole='http://192.168.42.79/admin/api.php?summaryRaw'[,…]}"
6357
```
6458

65-
Note that instances are prefixed by a custom name.
59+
Note that instances can be prefixed by a custom name.
6660

6761
## Docker-compose example
6862

default.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ request_timeout = 10
1111
request_verify_ssl = "True"
1212
reporting_interval = 30
1313

14-
instances="localhost=http://127.0.0.1/admin/api.php"
14+
instances="localhost=http://127.0.0.1/admin/api.php?summaryRaw"
1515

1616
[development]
1717

0 commit comments

Comments
 (0)