opn-repo
opn-repo copied to clipboard
Speed test doesn't keep logs/reports
I'm running the following:
- OPNsense 23.1.8-amd64
- FreeBSD 13.1-RELEASE-p7
- os-speedtest-community 0.9_3
I wasn't able to use the speedtest-cli, but when I clicked on Ookla it presented me with a list of servers and I was able to perform a speed test just fine.
However, nothing ever shows for history or statistics. I haven't used this before, but was thinking it would show the results along with the date & time and the server used.
what happens when you click the "show log" toggle?
you need to have at least one valid test to get speedtest.csv generated - which is used for averages and for log.
Check /usr/local/opnsense/scripts/OPNsense/speedtest
directory and see if speedtest.csv is in there (most probably not).
now let's try some basic commands when you are in that directory:
python3 opn_speedtest.py list
should generate a list of closest speedtest servers
python3 opn_speedtest.py version
should list the installed speedtest (in your case Ookla)
python3 opn_speedtest.py 0
should run a test on auto-selected server
python3 opn_speedtest.py log
should list the content of speedtest.csv file (if it exists)
python3 opn_speedtest.py stat
generates stats from .csv file (if it exists)
try to find out what is not working - it might be problem with permissions so python can't write .csv file to that directory?
if speedtest.csv
doesn't exist, let's make one - before you hunt down what is wrong with your root permissions...
First, switch to superuser: sudo su
- and activate the shell (option 8). It should return you to the same speedtest folder, but with superuser permissions.
echo "Timestamp,ClientIp,ServerId,ServerName,Country,DlSpeed,UlSpeed,Latency,Link" > speedtest.csv
chmod ugo+w speedtest.csv
python3 opn_speedtest.py 0
Now you should have a valid speedtest.csv
and one entry in it. Check this with
python3 opn_speedtest.py log
And if it displays that first entry, you are good to go.
python3 opn_speedtest.py 0
When I run this, I get the following error. The previous two commands ran fine.
python3 /usr/local/opnsense/scripts/OPNsense/speedtest/opn_speedtest.py 0 Traceback (most recent call last): File "/usr/local/opnsense/scripts/OPNsense/speedtest/opn_speedtest.py", line 183, in <module> result = json.loads(subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True).stdout.decode('utf-8')) File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
When I look in speedtest.csv, I noticed that there were two headers. I removed one of them and then the report showed up in OPNsense and then the command mentioned above worked as well.
Thanks for your help!
can we close this issue? I know I wrote that Python script for speedtest like a chef using a chainsaw to slice bread - it was really messy, unnecessarily complex, and fascinatingly crude. But hey, it made for a great learning experience and it (somehow) still works!
I had the exact same issue and it turned out the headers for the csv were duplicated (2 sets of column titles), I removed one, saved, reloaded my webgui and the logs show up.
The speedtest.csv should have one line that should say Timestamp,ClientIp,ServerId,ServerName,Country,DlSpeed,UlSpeed,Latency,Link
the rest should be data.