Skip to main content

Application to check WAN connection and export metrics to Prometheus

Project description

Raspberry Pi 5 Wan Bot Exporter

Raspberry Pi Prometheus exporter. Works in Docker or as a standalone script to export data to Prometheus. It uses python's internal webserver. Supports Raspberry Pi 5 and Raspbian-based images. Currently, exports:

  • Ping to 8.8.8.8 and packet loss computed from 3 packages.
  • Upload, Download and latency to Bredbandskollen using bbk-cli

Credit to ChatGPT
Alt Text

Requirements

  • Python 3.x
  • (optional) Docker

Usage

Docker

It is recommended to build the image locally to ensure that it is compatible with you platform.

docker build -t rpi5_wanBot_exporter -t registry.gitlab.com/niklasme/wanbot:latest.

To bring up the container without mounted volumes for reading fan speed ant temperature sensors.

docker run -d -p 8878:8878 --name rpi5_wanBot_exporter rpi5_wanBot_exporter

Docker compose

You can also use Docker compose to simplify the process by placing the following content in the docker-compose.yaml file and also add the required links to the files containing the fan speed and cpu temperature. If the container fail to start, ensure that it is compatible with your platform; i.e. amd64 aarch64 etc.

services:
  rpi5_wanBfot_exporter:
    image: registry.gitlab.com/niklasme/wanbot:latest
    container_name: rpi5_wanBot_exporter
    ports:
     - 8878:8878
    volumes:
      - /sys/devices/platform/cooling_fan/hwmon/:/sensors/hwmon:ro
      - /sys/class/thermal/thermal_zone0/temp:/sensors/temp:ro

Bring up the container after building it with docker compose up. The additional -d is to run in detached mode as a service.

docker build -t rpi5_wanBot_exporter .
docker compose up -d

Standalone

  • clone this repository or download the script to your Raspberry Pi 5
  • run the exporter python3 rpi5_wanBot_exporter.py --webserver --port 8878

Integration with Prometheus:

To integrate with Prometheus, add the following job to your Prometheus configuration file (prometheus.yml):

scrape_configs:
  - job_name: 'rpi5_wanBot_exporter'
    static_configs:
      - targets: ['<Raspberry_Pi_IP>:8878']

License

This script is provided under the MIT License. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rpi5_wanbot_exporter-0.4.tar.gz (436.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rpi5_wanbot_exporter-0.4-py3-none-any.whl (438.0 kB view details)

Uploaded Python 3

File details

Details for the file rpi5_wanbot_exporter-0.4.tar.gz.

File metadata

  • Download URL: rpi5_wanbot_exporter-0.4.tar.gz
  • Upload date:
  • Size: 436.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for rpi5_wanbot_exporter-0.4.tar.gz
Algorithm Hash digest
SHA256 c0490415981d746d3fb79bd28ee00bf92a873fccf4b4ea6485c26aee5a98aee7
MD5 6a26b4340e46d3aed1e7120c2f87d620
BLAKE2b-256 a83da9528e5ea2c4466806cbcd216ef9beeb546f4a3584c483f4988db39d18f6

See more details on using hashes here.

File details

Details for the file rpi5_wanbot_exporter-0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for rpi5_wanbot_exporter-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bf971267d83efbf2cbeda87a3da296136b060a7a77edc36b586342275288f914
MD5 61ad8d1aa4e3bfaa8482184a82a7fd53
BLAKE2b-256 43ed4bad424818769eb880b35ea881115aa671bb9044d2dcca09671e1881e74d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page