robinmanuelthiel / speedtest

Check internet bandwidth from a Docker container and save the results to an InfluxDB
MIT License
169 stars 48 forks source link

request #7

Closed georgelza closed 2 years ago

georgelza commented 2 years ago

not a issue... more a request... currently... or in the past ran the container on a Raspberry pi... but thats was/is limited to 100Mbps wifi, currently only have one Rpi4, but that runs HomeAssitant so can't run the container on there.

I do have a nice hefty TrueNAS Core NAS.... but sadly that does not run containers, only jails. Any chance I can have access to the actual code, so that I can deploy that into a jail.

G

robinmanuelthiel commented 2 years ago

Sure thing, the code is all here: https://github.com/robinmanuelthiel/speedtest/blob/master/speedtest.sh It's not much, as it just uses the speedtest.net CLI.

georgelza commented 2 years ago

awesome, thank you. G

georgelza commented 2 years ago

... sadly it looks like the speedtest-cli avail on freebsd which is the base for TrueNAS Core jail is very different from linux version of sweetest (https://www.cyberciti.biz/faq/how-to-install-speedtest-cli-on-a-freebsd-to-check-internet-speed/)

run_speedtest() { DATE=$(date +%s) HOSTNAME=$(hostname)

# Start speed test
echo "Running a Speed Test..."    JSON=$(speedtest )
DOWNLOAD="$(echo $JSON | jq -r '.download.bandwidth')"
UPLOAD="$(echo $JSON | jq -r '.upload.bandwidth')"    PING="$(echo $JSON | jq -r '.ping.latency')"
echo "Your download speed is $(($DOWNLOAD  / 125000 )) Mbps ($DOWNLOAD Bytes

/s)." speedtest.sh: 51 lines, 1584 characte

george@mail:~/speedtest $ ./speedtest.sh Running a Speed Test... parse error: Invalid numeric literal at line 1, column 11 parse error: Invalid numeric literal at line 1, column 11 parse error: Invalid numeric literal at line 1, column 11 ./speedtest.sh: arithmetic expression: expecting primary: " / 125000 " george@mail:~/speedtest $

robinmanuelthiel commented 2 years ago

I would suggest, you follow these instructions to install the CLI: https://www.speedtest.net/apps/cli

georgelza commented 2 years ago

AWESOME, thanks for the help, really appreciated, fixed...

G