Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tmapes/pihole-influx-exporter
Python Script to Scrape PiHole metrics and push to InfluxDB
https://github.com/tmapes/pihole-influx-exporter
influxdb pihole python
Last synced: about 2 months ago
JSON representation
Python Script to Scrape PiHole metrics and push to InfluxDB
- Host: GitHub
- URL: https://github.com/tmapes/pihole-influx-exporter
- Owner: tmapes
- Archived: true
- Created: 2023-12-04T00:02:32.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-06-22T15:21:20.000Z (5 months ago)
- Last Synced: 2024-09-22T19:32:16.836Z (about 2 months ago)
- Topics: influxdb, pihole, python
- Language: Python
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pihole-influx-exporter
Allows visualising many of the graphs seen on the Pi-Hole dashboard, in Grafana for an expanded historical view of your
DNS metrics.Note, this requires using an Influx Database running v2. It is **NOT** compatible with Influx v1.
### Configuration
A few environment variables are required to get this up and running.
| Name | Default | Required | Description |
|--------------------|-------------------------|----------|-----------------------------------------------------|
| PI_HOLE_HOST | `http://pi.hole` | Yes | Hostname & Port of your PiHole |
| PI_HOLE_API_TOKEN | `` | Yes | API Token for accessing PiHole |
| INFLUX_URL | `http://localhost:8086` | Yes | Schema, Hostname, & Port of your Influx v2 Instance |
| INFLUX_ORG | `` | Yes | What Influx organization to write into |
| INFLUX_BUCKET | `` | Yes | What Influx bucket to write into |
| INFLUX_TOKEN | `` | Yes | What Influx token to use for authentication |
| INFLUX_ENABLE_GZIP | `true` | No | Enable GZIP body compression for Influx Requests |### Metrics
Below are the metrics that are created from this repository.
All metrics are tagged as `pi_hole_host` with the host value from the `PI_HOLE_HOST` URI.
`pi_hole`
- No Tags
- Fields:
- `ads_blocked_today` - int - Incrementing counter of # of ads blocked today
- `ads_percentage_today` - float - (0.0 - 100.0) % of how many DNS requests were blocked due to being on an ad list
- `queries_cached` - int - How many queries were served from the cache
- `queries_forwarded` - int - How many queries were forwarded to the configured upstream DNS servers
- `dns_queries_all_replies` - int - Incrementing count of total amount of replies
- `dns_queries_all_types` - int - Incrementing count of all DNS query types
- `dns_queries_today` - int - How many queries were served today
- `domains_being_blocked` - int - Counter of all domains blocked by ad lists
- `unique_clients` - int - How many distinct clients have been served by Pi Hole
- `unique_domains` - int - How many distinct domains have been served by PI Hole---
`pi_hole_top_sources`
- Tags:
- `host` - string - Hostname of the client
- `ip_address` - string - IP addres of the client
- Fields:
- `count` - int - Incrementing count of DNS requests from this client---
`pi_hole_query_types`
- Tags:
- `type` - string - Type of DNS request (A, AAAA, etc...)
- Fields:
- `percentage` - float (0.0 -100.00) - Percent of total DNS requests are of this type---
`pi_hole_forward_destinations`
- Tags:
- `host` - string - Hostname of the upstream dns server
- `ip_address` - string - IP addres of the upstream dns server
- Fields:
- `percentage` - float (0.0 -100.00) - Percent of upstream DNS requests sent to this server---
`pi_hole_top_ads`
- Tags:
- `host` - string - Hostname of the blocked ad
- Fields:
- `count` - int - Incrementing count of DNS requests for this blocked ad---
`pi_hole_top_queries`
- Tags:
- `host` - string - Hostname of the client
- Fields:
- `count` - int - Incrementing count of DNS requests for this client---
`pi_hole_gravity`
- No Tags
- Fields:
- `updated` - int - Millisecond Epoch timestamp when the gravity file was last updated