This utility send the speedtest of the network on which it is performed on a MongoDB database.
All configurations are contained in the .env
file.
The possible keys in the file are:
MONGODB_URI
, the URI to the MongoDB databaseMONGODB_DB
, the MongoDB database nameSPEEDTEST_COLLECTION
, the MongoDB collection name for speedtest dataSPEEDTEST_DELAY_SECONDS
, the delay between each speedtest in secondsSPEEDTEST_SERVER_ID
, the https://www.speedtest.net server ID (e.g.: 4302 for Vodafone IT). If missing the speedtest-cli will autoselect a serverPING_COLLECTION
, the MongoDB collection name for ping dataPING_DELAY_SECONDS
, the delay between each ping in secondsPING_HOST
, the host to pingLOGGING_LEVEL
, the logging level. It can be one of these values:DEBUG
,INFO
,WARNING
,ERROR
,CRITICAL
A prerequisite is to install speedtest-cli by Ookla (https://www.speedtest.net/it/apps/cli).
Install dependencies with pip3 install -r requirements.txt
.
To run just type python3 speedtest.py
in your terminal.
Just type docker-compose up -d
in your terminal.
To have a full stack of the application (speedtest-to-mongodb, Grafana with MongoDB datasource plugin, MongoDB) use the command docker-compose -f docker-compose.full-stack.yml up -d
.
If you use the full stack you should add a MongoDB datasource in Grafana using as URL
http://localhost:3333, as MongoDB URL
the value of the environment variable MONGODB_URI
(the default is mongodb://root:password@mongodb:27017
) and as MongoDB Database
the value of the environment variable MONGODB_COLLECTION
(the default is network_monitoring
). Afterwards, you can import the dashboard below to visualize data or create your own.
You can find a Grafana dashboard to visualize data at https://grafana.com/grafana/dashboards/12350.