Skip to content

Docker-compose setup consisting of Grafana incl. a pre-configured dashboard, InfluxDB and a speedtest.net - all deployed by Ansible scripts.

Notifications You must be signed in to change notification settings

tillg/home.server.docker-compose

Repository files navigation

home.server.docker-compose

A network monitor for my home network. Based on docker-compose and Ansible. It uses ideas and code from frdmn/docker-speedtest-grafana.

Grafana Speedtest

Overview

The goal is to have a monitoring of the internet access as I would want it on my small home server. All this packaged in a Docker Compose. And easy to deploy on a fresh Unix server thru an Ansible script.

In a first version, these are the components I have integrated:

Architecture overview

At a later stage I could add monitoring of my FritzBox, logging the ping time to google and may be more.

Getting started

As a first step, make sure the file hosts points to the machine you want to provision (i.e. your home server or a local VM if you are testing). To get a starting point you can cp hosts.sample hosts and then edit the hosts file.

In order to deploy the services, these are the commands that need to be executed:

# Install the required roles (only needed to run once or if requirements changed)
ansible-galaxy install -r requirements.yml 
ansible-galaxy collection install -r requirements-collections.yml

ansible-playbook setup.yml 

Once the infrastructure (i.e. the docker daemon) is installed on the server and you only want to push modifications:

ansible-playbook setup.yml --tags deploy

In order to see what's happening on the server:

ssh <Server IP or name>

# To follow the changes 'real time' I usually have one terminal like so:
watch docker ps

Once the services are running, Grafana can be accessed in the browser at http://<IP Address of the server>:80.

Configuration

Configurations can be made in the vars/all.yml file and are pretty self explanatory.

Change log

  • Build images (26.6.2021): The docker-compose file now has a build section, and builds the speedtest docker image when launched. This way we can add / modify functionality in the index.js node script and see it reflected rigth after start.
  • Properly see network drop outs (29.6.2021): When my network stops working, I now return 0-values, so I can recognize drop-outs in the graph like so: Network drop-out
  • Use variables for paths (30.6.2021), so it can also be executed on my local Mac w/o polluting it.

Future features

  • Add round trip to Google: Another way than speedtest to measure latency is pinging google. And as it is far less heavy than using speedtest, I could add this measurement.
  • Monitor the server itself: In order to have a real monitoring of my home infrastructure, I should add some metrics of my server on which the docker-compose setup is running: Processor, disk space, memory usage...
  • Monitor Fritz!Box, especially the data volume bein up- and downloaded.
  • Show logs of all dockers in an easy way, i.e. something similar to docker logs all.

Testing

In order to test my Ansible scripts, I use locally running VM using multipass from Ubuntu: It worked best for me in order to easily get fresh instances up and running in order to test my Ansible scripts.

See here for my Multipass Cheatsheet and for a guide for testing the Ansible scripts with multipass.

Reading & Problems

Related and unrelated...

About

Docker-compose setup consisting of Grafana incl. a pre-configured dashboard, InfluxDB and a speedtest.net - all deployed by Ansible scripts.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published