All Projects → janw → Pi Hole Influx

janw / Pi Hole Influx

A python daemon to send Pi-Hole stats for Grafana to InfluxDB

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Pi Hole Influx

ruuvitag-demo
Demo of reading Bluetooth Low Energy sensor measurements of RuuviTag environmental sensors and feeding them to MQTT, a database and dashboards
Stars: ✭ 14 (-88.89%)
Mutual labels:  influxdb, grafana, grafana-dashboard
Personal Influxdb
Import data from various APIs into InfluxDB
Stars: ✭ 51 (-59.52%)
Mutual labels:  influxdb, grafana, grafana-dashboard
Unifiedmetrics
Fully-featured metrics collection agent for Minecraft servers. Supports Prometheus and InfluxDB. Dashboard included out-of-box.
Stars: ✭ 29 (-76.98%)
Mutual labels:  influxdb, grafana, grafana-dashboard
Appmetrics
App Metrics is an open-source and cross-platform .NET library used to record and report metrics within an application.
Stars: ✭ 1,986 (+1476.19%)
Mutual labels:  influxdb, grafana, grafana-dashboard
netdata-influx
Netdata ➡️ InfluxDB metrics exporter & Grafana dashboard
Stars: ✭ 29 (-76.98%)
Mutual labels:  influxdb, grafana, grafana-dashboard
Pi Hole Monitoring
Monitoring Pi-Hole statistics with Grafana
Stars: ✭ 196 (+55.56%)
Mutual labels:  pi-hole, influxdb, grafana
Grafana Influx Dashboard
Grafana InfluxDB scripted dashboard
Stars: ✭ 130 (+3.17%)
Mutual labels:  influxdb, grafana, grafana-dashboard
nfCollector
Collects Netflow version 1, 5, 6, 7, 9 & IPFIX & stores them on InfluxData time-series DB (InfluxDB)
Stars: ✭ 30 (-76.19%)
Mutual labels:  influxdb, grafana, grafana-dashboard
Monitoring
Monitor ESXi, Synology, Docker, PiHole and Raspberry Pi and Windows using Grafana, InfluxDB and Telegraf
Stars: ✭ 493 (+291.27%)
Mutual labels:  pi-hole, influxdb, grafana
Pgwatch2
PostgreSQL metrics monitor/dashboard
Stars: ✭ 960 (+661.9%)
Mutual labels:  influxdb, grafana
Solarthing
Monitors an Outback MATE and a Renogy Rover - MPPT Charge Controller. Integrates with Grafana, PVOutput and more!
Stars: ✭ 33 (-73.81%)
Mutual labels:  influxdb, grafana
Ssh Log To Influx
Send SSH authentication logs to influxdb with geohashing IP
Stars: ✭ 49 (-61.11%)
Mutual labels:  influxdb, grafana
Docker Compose Grafana Influxdb
Demonstration scripts for running Grafana with InfluxDB as datasource.
Stars: ✭ 29 (-76.98%)
Mutual labels:  influxdb, grafana
Docker Flask Mongodb Example
Uses docker compose with a python flask microservice and MongoDB instance to make a sample application
Stars: ✭ 49 (-61.11%)
Mutual labels:  influxdb, grafana
Cms Grafana Builder
helps you run a grafana server that include aliyun cms dashboard.
Stars: ✭ 26 (-79.37%)
Mutual labels:  grafana, grafana-dashboard
Go Web Backend
Dockerized backend services for web application
Stars: ✭ 50 (-60.32%)
Mutual labels:  influxdb, grafana
Varken
Standalone application to aggregate data from the Plex ecosystem into InfluxDB using Grafana for a frontend
Stars: ✭ 829 (+557.94%)
Mutual labels:  influxdb, grafana
Influx Crypto Trader
Node js trading bot, let you create trading strategy and run it (backtest/simulation/live)
Stars: ✭ 49 (-61.11%)
Mutual labels:  influxdb, grafana
Unifi Poller
Application: Collect ALL UniFi Controller, Site, Device & Client Data - Export to InfluxDB or Prometheus
Stars: ✭ 1,050 (+733.33%)
Mutual labels:  influxdb, grafana-dashboard
Internet Speedtest Docker
Internet testing running on Docker Compose.
Stars: ✭ 88 (-30.16%)
Mutual labels:  influxdb, grafana

Pi-hole-Influx

Build Status Coverage Status Maintainability Code style: black

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 instead. Thus am no longer actively using this project myself. I will try to merge Pull Reqests in a timely manner though.

Example Grafana Dashboard

Setup (Using Docker)

  • To use docker for running the daemon, use the following command:

    docker run \
      -e PIHOLE_INFLUXDB_HOST="myhostname" \
      -e PIHOLE_INFLUXDB_PORT="8086" \
      -e PIHOLE_INFLUXDB_USERNAME="myusername" \
      -e PIHOLE_INFLUXDB_PASSWORD="mysupersecretpassword" \
      -e PIHOLE_INFLUXDB_DATABASE="pihole" \
      -e PIHOLE_INSTANCES="localhost=http://127.0.0.1/admin/api.php" \
      registry.gitlab.com/janw/pi-hole-influx
    
  • For running it on a Raspberry Pi (arm v7 arch), use the dedicated armv7 image tag:

    docker run \
      -e PIHOLE_INFLUXDB_HOST="myhostname" \
      -e PIHOLE_INFLUXDB_USERNAME="myusername" \
      -e PIHOLE_INFLUXDB_PASSWORD="mysupersecretpassword" \
      --network host \
      registry.gitlab.com/janw/pi-hole-influx:armv7
    

Before you can run the above, you will need to have your docker server authenticated with registry.gitlab.com:

  • Create a personal access token following the GitLab documentation. Put the token somewhere safe. Once you leave or refresh the page, you won’t be able to access it again.

  • Login to the registry with:

    docker login -u <your-gitlab-username> -p <access-token> registry.gitlab.com
    

The following values are the defaults and will be used if not set:

  • PIHOLE_INFLUXDB_PORT="8086"
  • PIHOLE_INFLUXDB_HOST="127.0.0.1"
  • PIHOLE_INFLUXDB_DATABASE="pihole"
  • PIHOLE_INSTANCES="localhost=http://127.0.0.1/admin/api.php"

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:

PIHOLE_INSTANCES="{first_one='http://127.0.0.1/admin/api.php',second_pihole='http://192.168.42.79/admin/api.php'[,…]}"

Note that instances are prefixed by a custom name.

Docker-compose example

If you want to run the daemon through Docker-compose, you might appreciate the configuration example below.

version: "2"
services:
  piholeinflux:
    image: registry.gitlab.com/janw/pi-hole-influx
    container_name: piholeinflux
    restart: unless-stopped
    environment:

      # Replace details with your InfluxDB's hostname and credentials
      PIHOLE_INFLUXDB_HOST: "10.10.10.1"
      PIHOLE_INFLUXDB_PORT: "8086"
      PIHOLE_INFLUXDB_USERNAME: "pihole"
      PIHOLE_INFLUXDB_PASSWORD: "pihole"
      PIHOLE_INFLUXDB_DATABASE: "pihole"

      # Replace with your Pi-Hole's address including path to API below
      PIHOLE_INSTANCES: "pihole=http://10.10.0.10/admin/api.php"

    # OPTIONAL: Instead of the aobove environment variables,
    #           use a custom copy of the user.toml config file.
    volumes:
      - ./custom/config.toml:/user.toml

Setup (Traditional Way)

As Pi-hole (as the name suggests) is built specifically with the Raspberry Pi in mind (and I run it on there as well), the following steps assume an instance of Pi-hole on Raspbian Strech Lite, with no additional modifications so far. Piholestatus will be configured to run on the same Pi.

First install the necessary packages via apt as Raspbian Lite does have neither git nor pip installed.

sudo apt update
sudo apt install git python3-pip -y

Now clone the repo, install the Python dependencies, and make sure to copy and adjust the example configuation file to match your setup.

git clone https://github.com/janw/pi-hole-influx.git ~/pi-hole-influx
cd ~/pi-hole-influx

# Install requirements via pip
pip3 install -r requirements.txt

# Copy config.example and modify it (should be self-explanatory)
cp user.toml.example user.toml
vi user.toml

Before starting the daemon for the first time, symlink the systemd service into place, reload, and enable the service.

sudo ln -s /home/pi/pi-hole-influx/piholeinflux.service /etc/systemd/system/
sudo systemctl --system daemon-reload
sudo systemctl enable piholeinflux.service

Now you're ready to start the daemon. Wait a few seconds to check its status.

sudo systemctl start piholeinflux.service
sudo systemctl status piholeinflux.service

The status should look as follows. Note the Status: line showing the last time, the daemon reported to InfluxDB:

● piholeinflux.service - Pi-hole-Influx - Send Pi-hole statistics to InfluxDB for visualization
   Loaded: loaded (/home/pi/pi-hole-influx/piholeinflux.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-06-22 19:03:56 UTC; 10min ago
     Docs: https://github.com/janw/pi-hole-influx
 Main PID: 21329 (python)
   Status: "Reported to InfluxDB at 2018-06-22 19:14:09 +0000"
   CGroup: /system.slice/piholeinflux.service
           └─21329 /usr/bin/python /home/pi/pi-hole-influx/piholeinflux.py

Set up a Grafana Dashboard

The example dashboard seen at the top uses the collected data and displays it in concise and sensible graphs and single stats. The dashboard can be imported into your Grafana instance from the dashboard.json file included in the repo, or by using ID 6603 to import it from Grafana's Dashboard Directory.

Attributions

The script originally created by Jon Hayward, adapted to work with InfluxDB by /u/tollsjo in December 2016, and improved and extended by @johnappletree. "If I have seen further it is by standing on the shoulders of giants". 🤓

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].