Revision history for SpeedtestDocker
No Differences
Deletions:
No Differences
Additions:
- ++add MQTT as well as influxdb support++
Deletions:
No Differences
Additions:
++- add MQTT as well as influxdb support++
No Differences
Additions:
=====Versions=====
=====Summary=====
Uses the Ookla speedtest cli to test the internet connection regularly, and push the results to influx db & MQTT.
An influx db instance must already be running somewhere, and the database created.
=====Summary=====
Uses the Ookla speedtest cli to test the internet connection regularly, and push the results to influx db & MQTT.
An influx db instance must already be running somewhere, and the database created.
Deletions:
No Differences
Additions:
%%(bash;;test_internet.sh)
Deletions:
No Differences
Additions:
%%(text;;docker-compose.yml)
%%(bash;;iest_internet.sh)
%%(bash;;iest_internet.sh)
Deletions:
No Differences
Additions:
%%(bash;;dockerfile)
%%(XML;;docker-compose.yml)
%%(XML;;docker-compose.yml)
Deletions:
No Differences
Additions:
%%(XML;docker-compose.yml)
No Differences
Additions:
RUN apk add --no-cache mosquitto-clients
No Differences
Additions:
MQTT_TOPIC="maintopic/SubTopic"
SERVER_ADDRESS="192.168.X.X"
SERVER_ADDRESS="192.168.X.X"
Deletions:
SERVER_ADDRESS="192.168.3.200"
No Differences
Additions:
V1.1 2021-04-12 Added mosquitto_pub and publish data to MQTT as well as influbdb
# V1.1 2021-04-12 Added mosquitto_pub and publish data to MQTT as well as influbdb
MQTT_TOPIC="viewroad/Internet"
SERVER_ADDRESS="192.168.3.200"
TIMESTAMP=$(date '+%s')
/app/speedtest-cli > $FILE
DOWNLOAD=$(cat $FILE | grep "Download:" | awk -F " " '{print $2}')
UPLOAD=$(cat $FILE | grep "Upload:" | awk -F " " '{print $2}')
echo "Download: $DOWNLOAD Upload: $UPLOAD $TIMESTAMP"
curl -i -XPOST http://$SERVER_ADDRESS:8086/write?db=speedtest --data-binary "download,host=local value=$DOWNLOAD"
curl -i -XPOST http://$SERVER_ADDRESS:8086/write?db=speedtest --data-binary "upload,host=local value=$UPLOAD"
mosquitto_pub -h $SERVER_ADDRESS -t $MQTT_TOPIC -m '{ "DownloadSpeed" : '$DOWNLOAD' , "UploadSpeed" : '$UPLOAD' }'
sleep $TEST_INTERVAL
# V1.1 2021-04-12 Added mosquitto_pub and publish data to MQTT as well as influbdb
MQTT_TOPIC="viewroad/Internet"
SERVER_ADDRESS="192.168.3.200"
TIMESTAMP=$(date '+%s')
/app/speedtest-cli > $FILE
DOWNLOAD=$(cat $FILE | grep "Download:" | awk -F " " '{print $2}')
UPLOAD=$(cat $FILE | grep "Upload:" | awk -F " " '{print $2}')
echo "Download: $DOWNLOAD Upload: $UPLOAD $TIMESTAMP"
curl -i -XPOST http://$SERVER_ADDRESS:8086/write?db=speedtest --data-binary "download,host=local value=$DOWNLOAD"
curl -i -XPOST http://$SERVER_ADDRESS:8086/write?db=speedtest --data-binary "upload,host=local value=$UPLOAD"
mosquitto_pub -h $SERVER_ADDRESS -t $MQTT_TOPIC -m '{ "DownloadSpeed" : '$DOWNLOAD' , "UploadSpeed" : '$UPLOAD' }'
sleep $TEST_INTERVAL
Deletions:
/data/speedtest-cli > $FILE
DOWNLOAD=$(cat $FILE | grep "Download:" | awk -F " " '{print $2}')
UPLOAD=$(cat $FILE | grep "Upload:" | awk -F " " '{print $2}')
echo "Download: $DOWNLOAD Upload: $UPLOAD $TIMESTAMP"
curl -i -XPOST 'http://192.168.X.X:8086/write?db=speedtest' --data-binary "download,host=local value=$DOWNLOAD"
curl -i -XPOST 'http://192.168.X.X:8086/write?db=speedtest' --data-binary "upload,host=local value=$UPLOAD"
sleep $TEST_INTERVAL
No Differences
Additions:
--
CategoryDocker
CategoryHomeAutomation
CategoryDocker
CategoryHomeAutomation
No Differences
Additions:
//WARNING: My wiki editor stuff up spacing currently and may transform spaces into tabs... so this YML file likely won't work if you don't tidy it up sorry (I plan to fix the editor...)//
No Differences
Additions:
#!/bin/sh
No Differences
Additions:
- add secrets for hostname etc in ENV
- improve grep mess
- run as non root
- replace curl with wget
- stick in a git repo
- improve grep mess
- run as non root
- replace curl with wget
- stick in a git repo
Deletions:
- improve grep mess
- run as non root
- replace curl with wget
- stick in a git repo
No Differences
Additions:
- add secrets for hostname etc in ENV
- improve grep mess
- run as non root
- replace curl with wget
- stick in a git repo
A forked/slimmed version of the above:
RUN apk add --no-cache curl
RUN wget -O /app/speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
COPY test_internet.sh /app/test_internet.sh
CMD ["sh","/app/test_internet.sh"]
TEST_INTERVAL=30
- improve grep mess
- run as non root
- replace curl with wget
- stick in a git repo
A forked/slimmed version of the above:
RUN apk add --no-cache curl
RUN wget -O /app/speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
COPY test_internet.sh /app/test_internet.sh
CMD ["sh","/app/test_internet.sh"]
TEST_INTERVAL=30
Deletions:
RUN apk add --update curl
RUN curl https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py -o /app/speedtest-cli
CMD sh -c /app/test_internet.sh
TEST_INTERVAL=10
No Differences
Additions:
- "/dockervolumes/speedtest/data:/app/data"
Deletions:
No Differences
Deletions:
- "/dockervolumes/speedtest/app:/app"
No Differences
Additions:
- "/dockervolumes/speedtest/app:/app"
No Differences
Additions:
RUN mkdir -p /app
RUN curl https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py -o /app/speedtest-cli
RUN chmod +x /app/speedtest-cli
CMD sh -c /app/test_internet.sh
RUN curl https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py -o /app/speedtest-cli
RUN chmod +x /app/speedtest-cli
CMD sh -c /app/test_internet.sh
Deletions:
RUN chmod +x /data/speedtest-cli
COPY /dockerfiles/speedtest/test_internet.sh /data/test_internet.sh
CMD sh -c /data/test_internet.sh
No Differences
Additions:
- Have it test 'on the minute' rather than just in a loop? (maybe use cron)
- Have some randomness built in to test times
- Have some randomness built in to test times
No Differences
Deletions:
No Differences
Additions:
=====""ToDo""=====
Deletions:
No Differences
Additions:
======An internet Speed test to ""InfluxDB"" with Docker======
Deletions:
No Differences
Additions:
======An internet Speed test to %%InfluxDB%% with Docker======
Deletions:
No Differences
Additions:
FILE="/data/test_internet.log"
/data/speedtest-cli > $FILE
/data/speedtest-cli > $FILE
Deletions:
/app/speedtest-cli > $FILE
No Differences
Additions:
A forked/slimmed version of the above
**internet-speedtest-docker** https://hub.docker.com/r/kjake/internet-speedtest-docker
**internet-speedtest-docker** https://hub.docker.com/r/kjake/internet-speedtest-docker
No Differences
Additions:
Uses the Ookla speedtest cli to test the internet connection regularly, and push the results to influx db. An influx db instance must already be running somewhere, and the database created.
Simplified from a bunch of similar projects - the ones I found had multiple container builds with influx/grafana included, or logged to a csv and I'd then need to use telegraf to push to the db. I just wanted something that ran from a script and pushed to influxdb via http directly.
=====ToDo=====
- Needs some error control to be sure it is still running
- Needs timeout checks and maybe round robin on servers?
- Should log latency also
- Also log current bandwidth being used for my network overall?
=====Refs and similar projects=====
**Ookla speedtest cli**: https://www.speedtest.net/apps/cli
This was the most useful and code was borrowed from here:
Simplified from a bunch of similar projects - the ones I found had multiple container builds with influx/grafana included, or logged to a csv and I'd then need to use telegraf to push to the db. I just wanted something that ran from a script and pushed to influxdb via http directly.
=====ToDo=====
- Needs some error control to be sure it is still running
- Needs timeout checks and maybe round robin on servers?
- Should log latency also
- Also log current bandwidth being used for my network overall?
=====Refs and similar projects=====
**Ookla speedtest cli**: https://www.speedtest.net/apps/cli
This was the most useful and code was borrowed from here:
Deletions:
View remotely with %%http://[HOST IP ADDR]:5810%%
You can also use a VNC client directly at port 5910
Originally from https://hub.docker.com/r/marcelkordek/tasmota-device-manager (but this appears to have been abandoned)
=====Similar projects and where code was taken from=====
No Differences
Additions:
======An internet Speed test to InfluxDB with Docker======
=====Similar projects and where code was taken from=====
**internet-speedtest-docker**: https://www.github.com/pedrocesar-ti/internet-speedtest-docker
**docker-speedtest-analyser**: https://www.github.com/roest01/docker-speedtest-analyser
**speedy**: https://github.com/stefanwalther/speedy
FROM python:2-alpine
RUN mkdir -p /data
RUN apk add --update curl
RUN curl https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py -o /data/speedtest-cli
RUN chmod +x /data/speedtest-cli
COPY /dockerfiles/speedtest/test_internet.sh /data/test_internet.sh
#ADD scripts/ /app/speedtest/
CMD sh -c /data/test_internet.sh
speedtest:
build: .
volumes:
- "/dockervolumes/speedtest/data:/data"
- "/etc/localtime:/etc/localtime:ro"
- "/etc/timezone:/etc/timezone:ro"
container_name: speedtest
hostname: speedtest
restart: unless-stopped
=====test_internet.sh=====
FILE="/app/test_internet.log"
TEST_INTERVAL=10
while true
do
TIMESTAMP=$(date '+%s')
/app/speedtest-cli > $FILE
DOWNLOAD=$(cat $FILE | grep "Download:" | awk -F " " '{print $2}')
UPLOAD=$(cat $FILE | grep "Upload:" | awk -F " " '{print $2}')
echo "Download: $DOWNLOAD Upload: $UPLOAD $TIMESTAMP"
curl -i -XPOST 'http://192.168.X.X:8086/write?db=speedtest' --data-binary "download,host=local value=$DOWNLOAD"
curl -i -XPOST 'http://192.168.X.X:8086/write?db=speedtest' --data-binary "upload,host=local value=$UPLOAD"
sleep $TEST_INTERVAL
done
=====Similar projects and where code was taken from=====
**internet-speedtest-docker**: https://www.github.com/pedrocesar-ti/internet-speedtest-docker
**docker-speedtest-analyser**: https://www.github.com/roest01/docker-speedtest-analyser
**speedy**: https://github.com/stefanwalther/speedy
FROM python:2-alpine
RUN mkdir -p /data
RUN apk add --update curl
RUN curl https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py -o /data/speedtest-cli
RUN chmod +x /data/speedtest-cli
COPY /dockerfiles/speedtest/test_internet.sh /data/test_internet.sh
#ADD scripts/ /app/speedtest/
CMD sh -c /data/test_internet.sh
speedtest:
build: .
volumes:
- "/dockervolumes/speedtest/data:/data"
- "/etc/localtime:/etc/localtime:ro"
- "/etc/timezone:/etc/timezone:ro"
container_name: speedtest
hostname: speedtest
restart: unless-stopped
=====test_internet.sh=====
FILE="/app/test_internet.log"
TEST_INTERVAL=10
while true
do
TIMESTAMP=$(date '+%s')
/app/speedtest-cli > $FILE
DOWNLOAD=$(cat $FILE | grep "Download:" | awk -F " " '{print $2}')
UPLOAD=$(cat $FILE | grep "Upload:" | awk -F " " '{print $2}')
echo "Download: $DOWNLOAD Upload: $UPLOAD $TIMESTAMP"
curl -i -XPOST 'http://192.168.X.X:8086/write?db=speedtest' --data-binary "download,host=local value=$DOWNLOAD"
curl -i -XPOST 'http://192.168.X.X:8086/write?db=speedtest' --data-binary "upload,host=local value=$UPLOAD"
sleep $TEST_INTERVAL
done
Deletions:
**Tasmota Device Manager**: https://github.com/jziolkowski/tdm
**""NoVNC""**: https://novnc.com/info.html
**Base container ENV variables** [[https://github.com/jlesage/docker-baseimage-gui/#environment-variables https://github.com/jlesage/docker-baseimage-gui/#environment-variables]]
FROM jlesage/baseimage-gui:debian-10
RUN apt-get update && apt-get upgrade -y
RUN add-pkg libqt5x11extras5 python3 python3-pip git -y --no-install-recommends
RUN pip3 install --upgrade pip
RUN pip3 install setuptools
# Install Tasmota Device Manager
RUN pip3 install tdmgr
# Set the name of the application (this appears in the browser)
ENV APP_NAME="Tasmota Device Manager"
# Environment Variables
# see https://github.com/jlesage/docker-baseimage-gui/#environment-variables
#ENV TZ="Pacific/Auckland"
# Copy the start script
COPY startapp.sh /startapp.sh
# Create volume
VOLUME /config
tasmota-device-manager:
build: .
volumes:
- "/dockervolumes/tasmota-device-manager/config:/config"
- "/etc/localtime:/etc/localtime:ro"
- "/etc/timezone:/etc/timezone:ro"
ports:
- '5810:5800'
- '5910:5900'
container_name: tasmota-device-manager
hostname: tasmota-device-manager
restart: unless-stopped
=====startapp.sh=====
#!/bin/sh
export HOME=/config
exec /usr/bin/python3 /usr/local/bin/tdmgr.py
No Differences
Full history for this page cannot be displayed within a single page, click here to view more.