Giter Club home page Giter Club logo

docker-speedtest-influxdb's Introduction

speedtest-influxdb:1.1.0

Introduction

Git-Repository to build Docker Container Image to run speedtest with NDT7 Server from mLabs to influxdb. The Implementation is inspired by https://github.com/frdmn/docker-speedtest

Contributing

If you find this image helpfull, so you can see here how you can help:

  • Create an new branch and send a pull request with your features and bug fixes
  • Help users resolve their issues.

Issues

Before reporting your issue please try updating Docker to the latest version and check if it resolves the issue. Refer to the Docker installation guide for instructions.

If that recommendations do not help then report your issue along with the following information:

  • Output of the docker version and docker info commands
  • The docker run command or docker-compose.yml used to start the image. Mask out the sensitive bits.

Getting started

Installation

Automated builds of the image are available on Dockerhub

docker pull quadstingray/speedtest-influxdb

Alternatively you can build the image yourself.

docker build . --tag 'quadstingray/speedtest-influxdb:dev';

Quickstart

docker run -e "HOST=local" quadstingray/speedtest-influxdb:1.1.0

Alternatively, you can use the sample docker-compose.yml file to start the container using Docker Compose

Environment Variables

Variable Default Value Informations
INTERVAL 3600 Seconds between import of statistics
RETRY_INTERVAL 300 Seconds between retry of statistics import
HOST local host where the speedtest is running for grafana filter
SPEEDTEST_SERVER '' ndt 7 server. Empty string, means speedtest return server for test
INCLUDE_READABLE_OUTPUT false Log Speedtest Output to Console
RETRY_ZERO_VALUE false Retry Speedtest at Zero Values returned
SPEEDTEST_DISTANCE_UNIT K Unit for Distance Calculation K = Kilometers, N = Nautical Miles other Values = Miles
SPEEDTEST_LIST_SERVERS 'false' list all available ndt7 servers at the console
SPEEDTEST_LIST_KEEP_CONTAINER_RUNNING 'true' keep docker container running after listing all ndt7 servers
SHOW_EXTERNAL_IP 'false' You can activate logging your external Ip to InfluxDb to monitor IP changes.
INFLUXDB_USE 'true' You can deactivate save speedtest results to influx
INFLUXDB_URL http://influxdb:8086 Url of your InfluxDb installation
INFLUXDB_DB speedtest Database at your InfluxDb installation
INFLUXDB_USER DEFAULT optional user for insert to your InfluxDb
INFLUXDB_PWD DEFAULT optional password for insert to your InfluxDb

Removed Variables

  • SPEEDTEST_ALGO_TYPE

Environment Variable: SPEEDTEST_SERVER

Per default the server is choosen automatically, but you can set SPEEDTEST_SERVER with the id of your favorite server. If your favorite Server doesn't answer a default search server is choosen. You can get a list of all available servers by set the evironment variable SPEEDTEST_LIST_SERVERS to true. The list is ordered by country.

...
2021/02/02 09:16:09 County: AU | Location: Sydney | ServerId: syd03 | UplinkSpeed: 10g | Roundrobin: true
2021/02/02 09:16:09 County: AU | Location: Sydney | ServerId: syd02 | UplinkSpeed: 10g | Roundrobin: true
2021/02/02 09:16:09 County: BE | Location: Brussels | ServerId: bru01 | UplinkSpeed: 10g | Roundrobin: true
2021/02/02 09:16:09 County: BE | Location: Brussels | ServerId: bru03 | UplinkSpeed: 10g | Roundrobin: true
2021/02/02 09:16:09 County: BE | Location: Brussels | ServerId: bru05 | UplinkSpeed: 10g | Roundrobin: true
2021/02/02 09:16:09 County: BE | Location: Brussels | ServerId: bru04 | UplinkSpeed: 10g | Roundrobin: true
2021/02/02 09:16:09 County: BE | Location: Brussels | ServerId: bru02 | UplinkSpeed: 10g | Roundrobin: true

...

Grafana

There is an sample grafana dashboard at this repository. You can import that to your Grafana installation. speedtest.json

Todo:

  • Code Clean Up

docker-speedtest-influxdb's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

docker-speedtest-influxdb's Issues

Higher upload speed in speed test than real life

I have a 60 Mbps uplink, and my usual speedtest values are matching this - speedtest-cli, speedtest.net, nperf.com, etc. but docker-speedtest-influxdb is consistently showing results like this:

2020/06/19 07:40:49 Ping: 16.93 ms | Download: 92.52 Mbps | Upload: 81.37 Mbps,

ping and download values are in line with the other measurements.

any idea why is this happening?

When ipapi.co cannot be resolved, container crashes

After the recent changes, I noticed my container instance was constantly running its speed test, then crashing. After some digging, I found that my pihole servers were blocking ipapi.co, which was causing the below crash:

2021/02/05 16:45:37 **************************************************************,
2021/02/05 16:45:37 ******** Parser started with following commands **************,
2021/02/05 16:45:37 **  interval 3600,
2021/02/05 16:45:37 **  Distance Unit K,
2021/02/05 16:45:37 **  Host dokpv01,
2021/02/05 16:45:37 **  showExternalIp: true,
2021/02/05 16:45:37 **  influxHost http://grafana.server:8086,
2021/02/05 16:45:37 **  influxDB speedtest,
2021/02/05 16:45:37 **  influxUser influxdb_speedtest,
2021/02/05 16:45:37 **  influxPwd is not Default,
2021/02/05 16:45:37 **************************************************************,
2021/02/05 16:45:37 **************************************************************,
Get "https://ipapi.co/.../json/": dial tcp 0.0.0.0:443: connect: connection refused,
panic: runtime error: invalid memory address or nil pointer dereference,
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x69a68a],
,
goroutine 1 [running]:,
quadstingray/speedtest-influxdb/model.CheckIpLocation(0xc000270000, 0xe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...),
	/go/src/quadstingray/speedtest-influxdb/model/geoip.go:47 +0x18a,
main.runTest(0xe10, 0x7ffffafa9d7e, 0x7, 0x7ffffafa9d87, 0x0, 0x7ffffafa9dc3, 0x1, 0x10000, 0x1, 0x7ffffafa9cfd, ...),
	/go/src/quadstingray/speedtest-influxdb/app.go:115 +0x26f,
main.main(),
	/go/src/quadstingray/speedtest-influxdb/app.go:42 +0xd8,

The main concern with the crash, is it was happening after the speed test was run. Since I had the container configured in Docker Swarm, it automatically restarted the container after it crashed. So it got stuck in a loop where it was running a speed test about once every 20 seconds.

After I whitelisted ipapi.co, the container runs normally.

I am not sure why ipapi.co was on a block list, but perhaps it should run a check to make sure it can resolve it prior to the speed test? Otherwise, more gracefully handle the "connection refused" error?

Docker version for reference:

root@dokpv01:~# docker version
Client: Docker Engine - Community
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46d9d
 Built:             Wed Sep 16 17:02:52 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46d9d
  Built:            Wed Sep 16 17:01:20 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.3.7
  GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Not available on docker hub?

I'm trying to get this using the docker pull command from the README, but it tells me

access denied for speedtest-influxdb, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

I tried doing a docker login, but that didn't help.

Container stops after a failed speedtest

Hi,

the container stops if one Speedtest fails or when Ookla do a server list maintenance and the url of the list is temporarily unavailable.

Is there a way to prevent this?

Thanks!

Capture 2019-05-29 um 07 38 30

Upload / Download / Ping metrics not accurate?

Hi There,

I’m only getting max 50Mbps / 3Mbps Download / Upload from this Docker image but my line is 1Gbps.

If I use a different speedtest method (for example https://hub.docker.com/r/atribe/speedtest-for-influxdb-and-grafana/ or speedtest-cli) running on the same host I get around 700-800Mbps Down and 400-500 Mbps up.

Also the ping stats seem to be inaccurate showing around 2-5seconds whereas the other methods above show around 10ms.

I’ve tried your grafana dashboard and viewed the stats from the Docker container logs - Any idea why the metrics are much worse than expected (and why they disagree so much with the other methods)?

Thanks!

Feature: Avoid zero values to influxdb

Hi,
sometimes there are zero-values in measurement, like:

image

please add an option to repeat on zero or do not write to influxdb when one of the results is 0.

Thank you

Scaling

Hello, i have a 1G line here, and get different speeds which is strange:
root@foo:/opt/docker-speedtest-influxdb# speedtest-cli --server 14704
Retrieving speedtest.net configuration...
Testing from Telecom Italia Business (85.44.190.68)...
Retrieving speedtest.net server list...
Retrieving information for the selected server...
Hosted by Telecom Italia S.p.A. (Reggio Calabria) [634.49 km]: 24.935 ms
Testing download speed................................................................................
Download: 433.86 Mbit/s
Testing upload speed................................................................................................
Upload: 435.34 Mbit/s

and on grafana for example Upload is always less then 100Mbit - do you have an idea what i am doing wrong?

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.