Giter Site home page Giter Site logo

speedtest's Introduction

Internet Speed Monitor

Keep track of your internet connection speeds over time with a Raspberry Pi.

Dashboard

This Helm chart deploys:

  • InfluxDB 2.x database for time series data.
  • Grafana dashboard.
  • Python app to run the speed test on a schedule.

Prerequisites

  1. Set up your Raspberry Pi.
  2. Install and configure MicroK8s (or another lightweight Kubernetes distribution with DNS and Helm addons) on your Pi.

Note: MicroK8s by default uses Dqlite as its storage backend instead of etcd. Further securing of Secret objects with encryption at rest for either storage backend is outside the scope of this project.

Install

  1. Prepare your Raspberry Pi's local storage for both the database and dashboard

    # On your Pi
    sudo mkdir -p /var/lib/influxdb2
    sudo mkdir -p /etc/influxdb2
    sudo mkdir -p /var/lib/grafana
  2. If installing from the repository

    # On your Pi
    
    helm repo add santisbon https://santisbon.github.io/charts/
    # or 
    helm repo update
    
    CHART="santisbon/speedtest"

    Or if installing from source

    # On your Pi
    git clone https://github.com/santisbon/speedtest.git && cd speedtest
    CHART="./speedtestchart"
    
    nano $CHART/values.yaml
    # edit the values
  3. Install the Helm chart which will enforce the installation order. Set parameters like the schedule to run the test if you didn't do it through the values.yaml file.
    If using MicroK8s add it to the typed commands e.g. microk8s helm, microk8s kubectl.

    # On your Pi
    RELEASE=speedtest
    NAMESPACE=speedtest-n
    
    helm install $RELEASE $CHART \
        -n $NAMESPACE \
        --create-namespace \
        --set nodeHostname=raspberrypi4 \
        --set influxdbpassword=supersecret \
        --set influxdbtoken=my-super-secret-auth-token \
        --set schedule="*/10 * * * *"
  4. Grab the NodePort assigned to the Grafana service (by default in the 30000-32767 range).

    # On your Pi
    kubectl -n $NAMESPACE get svc $RELEASE-grafana-svc
    
    NAME                    TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
    speedtest-grafana-svc   NodePort   10.152.182.171   <none>        3000:32425/TCP   52s

    In this example it's 32425.

  5. From your desktop, access the Grafana dashboard using your Raspberry Pi's IP address or DNS name and the NodePort from the previous step e.g. http://raspberrypi4.local:32425. The default credentials are admin/admin.

  6. Add a new connection with data source InfluxDB.

    1. Set query language to Flux.
    2. Set the URL using your Helm release name and InfluxDB port e.g. http://speedtest-influxdb-svc:8086.
    3. Use the organization, token, and bucket you set in values.yaml or the command line. If you didn't set a token, one was created for you. You can retrieve it from a shell in the influxdb-c container with the command influx auth list.
    4. Click on Save & Test.
    5. Build a dashboard and add a visualization (panel) with the data source you created.
    6. Write the Flux queries you want for your visualizations filtering by _measurement or _field. Some examples:
      speeds = from(bucket: "internetspeed")
          |> range(start: -1d)
          |> filter(fn: (r) => r._field == "download" or r._field == "upload")
          |> yield(name: "_results")
      
      latency = from(bucket: "internetspeed")
          |> range(start: -1d)
          |> filter(fn: (r) => r._field == "ping" or r._field == "jitter")
          |> yield(name: "_results")
      
    7. Save your dashboard. You can add multiple panels and set units like megabits per second (Mbps) and ms. The units are in the Standard options section of the panel.

Upgrade

helm upgrade $RELEASE $CHART -n $NAMESPACE

Uninstall

helm uninstall $RELEASE -n $NAMESPACE --wait
kubectl delete namespaces $NAMESPACE

speedtest's People

Contributors

santisbon avatar

Stargazers

Jirawat S avatar Eugen Mayer avatar  avatar Joaquín González avatar  avatar Guillaume Richard avatar José Carlos García avatar

Watchers

 avatar  avatar

Forkers

pisit-wa

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.