Coder Social home page Coder Social logo

kmichels / pihole-influxdb-monitor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from avojak/pihole-influxdb-monitor

0.0 0.0 0.0 2.46 MB

Export Pi-hole statistics to InfluxDB 2.x

License: MIT License

Shell 2.18% Python 94.70% Makefile 0.36% Dockerfile 2.76%

pihole-influxdb-monitor's Introduction

CI GitHub GitHub release (latest SemVer) Docker Pulls Image Size

Pi-hole InfluxDB Monitor

Export Pi-hole statistics to InfluxDB 2.x.

Environment Variables

Name Description Default
INTERVAL_SECONDS Interval (in seconds) between polling 60
PIHOLE_ALIAS Comma-separated list of aliases for the Pi-hole instances pihole
PIHOLE_ADDRESS Comma-separated list of Pi-hole adddresses to poll http://pi.hole:80
PIHOLE_TOKEN Comma-separated list of Pi-hole API tokens*
PIHOLE_NUM_TOP_ITEMS Number of top domains and ads to return 10
PIHOLE_NUM_TOP_CLIENTS Number of top clients to return 10
INFLUXDB_ADDRESS Address of the InfluxDB instance http://influxdb:8086
INFLUXDB_ORG InfluxDB organization my-org
INFLUXDB_TOKEN InfluxDB auth token
INFLUXDB_BUCKET InfluxDB bucket for storing the data pihole
INFLUXDB_CREATE_BUCKET Whether or not to create the InfluxDB bucket if it does not already exist False
INFLUXDB_VERIFY_SSL Whether or not to verify the InfluxDB SSL certificate (only applicable when using an HTTPS address) True

* Note: only required to retrieve data on top DNS queries, clients, etc.

Docker

docker run -d \
    -e PIHOLE_ALIAS="pihole" \
    -e PIHOLE_ADDRESS="http://pi.hole" \
    -e PIHOLE_TOKEN="pihole_api_token" \
    -e PIHOLE_NUM_TOP_ITEMS=25 \
    -e PIHOLE_NUM_TOP_CLIENTS=25 \
    -e INFLUXDB_ADDRESS="http://influxdb:8086" \
    -e INFLUXDB_ORG="my-org" \
    -e INFLUXDB_TOKEN="super_secret_token" \
    -e INFLUXDB_BUCKET="pihole" \
    avojak/pihole-influxdb:latest

Docker Compose

version: "3.9"
services:
  pihole-influxdb:
    image: avojak/pihole-influxdb:latest
    container_name: pihole-influxdb
    restart: unless-stopped
    environment:
      - "PIHOLE_ALIAS=pihole"
      - "PIHOLE_ADDRESS=http://pi.hole"
      - "PIHOLE_TOKEN=pihole_api_token"
      - "PIHOLE_NUM_TOP_ITEMS=25"
      - "PIHOLE_NUM_TOP_CLIENTS=25"
      - "INFLUXDB_ADDRESS=http://influxdb:8086"
      - "INFLUXDB_ORG=my-org"
      - "INFLUXDB_TOKEN=super_secret_token"
      - "INFLUXDB_BUCKET=pihole"

Command Line

python3 pihole-influxdb.py \
    --pihole-alias "pihole" \
    --pihole-address "http://pi.hole" \
    --pihole-token "pihole_api_token" \
    --pihole-num-top-items 25 \
    --pihole-num-top-clients 25 \
    --influxdb-address "http://influxdb:8096" \
    --influxdb-org "my-org" \
    --influxdb-token "super_secret_token" \
    --influxdb-bucket "pihole"

Screenshots

Simple dashboard in Grafana (See: grafana/Pi-hole.json):

Dashboard

References

Rough API documentation for the Pi-hole API is available here: https://discourse.pi-hole.net/t/pi-hole-api/1863

pihole-influxdb-monitor's People

Contributors

avojak avatar sirmaple avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.