Skip to content

Commit

Permalink
Merge pull request #9 from QuadStingray/ndt7_go
Browse files Browse the repository at this point in the history
refactoring to ndt7 go client
  • Loading branch information
QuadStingray authored Feb 3, 2021
2 parents 328f57c + c4d32d2 commit da6d91f
Show file tree
Hide file tree
Showing 18 changed files with 1,078 additions and 288 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ ENV INTERVAL=3600 \
HOST="local" \
SPEEDTEST_SERVER="" \
SPEEDTEST_LIST_SERVERS="false" \
SPEEDTEST_LIST_KEEP_CONTAINER_RUNNING="false" \
SPEEDTEST_ALGO_TYPE="max" \
SPEEDTEST_LIST_KEEP_CONTAINER_RUNNING="true" \
SPEEDTEST_DISTANCE_UNIT="K" \
INCLUDE_READABLE_OUTPUT="false" \
SHOW_EXTERNAL_IP="false"

RUN apk add ca-certificates
Expand Down
91 changes: 76 additions & 15 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 8 additions & 27 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[prune]
go-tests = true
unused-packages = true

[[constraint]]
name = "github.com/m-lab/ndt7-client-go"
version = "0.4.1"

[[constraint]]
name = "github.com/influxdata/influxdb"
version = "1.8.3"
69 changes: 43 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,86 +1,103 @@
# speedtest-influxdb:0.9.3
# speedtest-influxdb:1.0.0

- [Introduction](#introduction)
- [Contributing](#contributing)
- [Issues](#issues)
- [Contributing](#contributing)
- [Issues](#issues)
- [Getting started](#getting-started)
- [Installation](#installation)
- [Quickstart](#quickstart)
- [Environment Variables](#environment-variables)
- [Grafana](#grafana)
- [Installation](#installation)
- [Quickstart](#quickstart)
- [Environment Variables](#environment-variables)
- [Grafana](#grafana)

# Introduction
Git-Repository to build [Docker](https://www.docker.com/) Container Image to run speedtest with [speedtest.net](http://www.speedtest.net/) to influxdb. The Implementation is inspired by https://github.com/frdmn/docker-speedtest

Git-Repository to build [Docker](https://www.docker.com/) Container Image to run speedtest with [NDT7 Server](https://github.com/m-lab/ndt-server) from [mLabs](https://www.measurementlab.net/tests/ndt/ndt7/) 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](https://github.com/QuadStingray/docker-speedtest-influxdb/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](https://docs.docker.com/installation) for instructions.

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](https://docs.docker.com/installation) for instructions.

If that recommendations do not help then [report your issue](https://github.com/QuadStingray/docker-speedtest-influxdb/issues/new) 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.
- 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](https://hub.docker.com/r/quadstingray/speedtest-influxdb/)

```bash
docker pull speedtest-influxdb:0.9.3
docker pull speedtest-influxdb:1.0.0
```

Alternatively you can build the image yourself.

```bash
docker build . --tag 'speedtest-influxdb:dev';
```

## Quickstart

```bash
docker run -e "HOST=local" speedtest-influxdb:0.9.3
docker run -e "HOST=local" speedtest-influxdb:1.0.0
```

*Alternatively, you can use the sample [docker-compose.yml](docker-compose.yml) file to start the container using [Docker Compose](https://docs.docker.com/compose/)*


## Environment Variables

| Variable | Default Value | Informations |
|:-----------------|:-----------------------|:----------------------------------------------------------------------------------------------|
| INTERVAL | 3600 | Seconds between import of statistics |
| HOST | local | host where the speedtest is running for grafana filter |
| [SPEEDTEST_SERVER](#environment-variable-speedtest_server) | '' | speedtest.net server. Empty string, means speedtest return server for test |
| SPEEDTEST_ALGO_TYPE | 'max' | how to calculate the speedtest up- and downlad values. changing of `SPEEDTEST_ALGO_TYPE` means avg |
| SPEEDTEST_LIST_SERVERS | 'false' | list all available speedtest.net servers at the console |
| SPEEDTEST_LIST_KEEP_CONTAINER_RUNNING | 'false' | keep docker container running after listing all speedtet.net servers |
| [SPEEDTEST_SERVER](#environment-variable-speedtest_server) | '' | ndt 7 server. Empty string, means speedtest return server for test |
| INCLUDE_READABLE_OUTPUT | false | Log Speedtest Output to Console |
| 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 by speedtest.net, but you can set `SPEEDTEST_SERVER` with the id of your favorite server.
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.

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.

```
...
2018/07/18 00:16:53 County: Virgin Islands | Location: Saint Croix | ServerId: 4470 | Sponsor: Viya
2018/07/18 00:16:53 County: Virgin Islands | Location: Saint Croix | ServerId: 6762 | Sponsor: VI Next Generation Network
2018/07/18 00:16:53 County: Virgin Islands | Location: Road Town | ServerId: 7633 | Sponsor: CCTBVI
2018/07/18 00:16:53 County: Virgin Islands, British | Location: Road Town | ServerId: 17056 | Sponsor: Flow BVI
2018/07/18 00:16:53 County: Wales | Location: Pembrokeshire | ServerId: 16607 | Sponsor: Pembs Wifi Ltd
2018/07/18 00:16:53 County: Wales | Location: Newport | ServerId: 5833 | Sponsor: Hub Network Services Ltd
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](docker/grafana/provisioning/dashboards/speedtest.json)

![](https://raw.githubusercontent.com/QuadStingray/docker-speedtest-influxdb/master/images/speedtest_dashboard.png)
Expand Down
Loading

0 comments on commit da6d91f

Please sign in to comment.