ansemjo / speedtest-plotter

running scheduled speedtests inside docker and plotting the results with gnuplot
MIT License
59 stars 12 forks source link

Possibility to plot tests against multiple servers? #118

Open CraigHead opened 1 year ago

CraigHead commented 1 year ago

I would like to test multiple Speedtest servers to eliminate single origin variances and to get a better picture of internet connectivity health. e.g.

-e TESTSERVER=stosat-dvre-01.sys.comcast.net.prod.hosts.ooklaserver.net:8080 \
-e TESTSERVER=speedtest-lgmt.mynextlight.net.prod.hosts.ooklaserver.net:8080 \
-e TESTSERVER=speedtest.implicit.systems.prod.hosts.ooklaserver.net:8080

or

-e TESTSERVER=stosat-dvre-01.sys.comcast.net.prod.hosts.ooklaserver.net:8080,speedtest-lgmt.mynextlight.net.prod.hosts.ooklaserver.net:8080,speedtest.implicit.systems.prod.hosts.ooklaserver.net:8080

Is this possible?

ansemjo commented 1 year ago

Not right now because this feature isn't implemented. But in principle .. sure.

If you're fine with the measurements appearing on the same plot line (which will then probably become a bit more jerky). The first syntax won't work though because you're just overwriting the same environment variable.

I took a quick look at taganaka/SpeedTest to see if it accepts multiple servers already and saw an .append(). Unfortunately, it only appends multiple arguments to a string and I'm not sure how it handles them without any separators ... https://github.com/taganaka/SpeedTest/blob/0f63cfbf7ce8d64ea803bf143b957eae76323405/CmdOptions.h#L61

So we'll probably just have to run take_measurement() multiple times.

ansemjo commented 1 year ago

As a short-term solution: you could just disable the cron schedule (or pick something very rare, like yearly) and trigger the measurements from outside the container:

docker run [...] -n speedtest -e SCHEDULE="0 0 1 1 *" ansemjo/speedtest

Then put this in a script and trigger it from your host's crontab, for example:

#!/usr/bin/env bash
for ts in \
  stosat-dvre-01.sys.comcast.net.prod.hosts.ooklaserver.net:8080 \
  speedtest-lgmt.mynextlight.net.prod.hosts.ooklaserver.net:8080 \
  speedtest.implicit.systems.prod.hosts.ooklaserver.net:8080; do
    docker exec speedtest measure -s "$ts"
done