Speedtest-for-InfluxDB-and-Grafana icon indicating copy to clipboard operation
Speedtest-for-InfluxDB-and-Grafana copied to clipboard

ValueError: invalid literal for int() with base 10: ''

Open techie2000 opened this issue 3 years ago • 16 comments

Starting last night I got intermittent errors in the log and as a result, speedtests are not occurring/recorded. After a few hours, the intermittent nature went away and failure is consistent.

Here is a sample of the log upon startup

Loading Configuration File config.ini
Configuration Successfully Loaded
2021-04-08 15:11:51,512 - INFO: Starting Speed Test For Server None
Traceback (most recent call last):
File "/src/influxspeedtest.py", line 8, in <module>
collector.run()
File "/src/influxspeedtest/InfluxdbSpeedtest.py", line 171, in run
self.run_speed_test()
File "/src/influxspeedtest/InfluxdbSpeedtest.py", line 119, in run_speed_test
self.setup_speedtest(server)
File "/src/influxspeedtest/InfluxdbSpeedtest.py", line 71, in setup_speedtest
self.speedtest = speedtest.Speedtest()
File "/usr/local/lib/python3.7/site-packages/speedtest.py", line 1091, in __init__
self.get_config()
File "/usr/local/lib/python3.7/site-packages/speedtest.py", line 1174, in get_config
map(int, server_config['ignoreids'].split(','))
ValueError: invalid literal for int() with base 10: ''
Loading Configuration File config.ini
Configuration Successfully Loaded
2021-04-08 15:12:52,124 - INFO: Starting Speed Test For Server None
Traceback (most recent call last):
File "/src/influxspeedtest.py", line 8, in <module>
collector.run()
File "/src/influxspeedtest/InfluxdbSpeedtest.py", line 171, in run
self.run_speed_test()
File "/src/influxspeedtest/InfluxdbSpeedtest.py", line 119, in run_speed_test
self.setup_speedtest(server)
File "/src/influxspeedtest/InfluxdbSpeedtest.py", line 71, in setup_speedtest
self.speedtest = speedtest.Speedtest()
File "/usr/local/lib/python3.7/site-packages/speedtest.py", line 1091, in __init__
self.get_config()
File "/usr/local/lib/python3.7/site-packages/speedtest.py", line 1174, in get_config
map(int, server_config['ignoreids'].split(','))
ValueError: invalid literal for int() with base 10: ''

techie2000 avatar Apr 08 '21 15:04 techie2000

I got past this error by rebuilding the docker image. The python requirements in the current image are out of date. There is an update to the speedtest-ci that has fixed this error.

Step-by-Step First I cloned this repo Then I ran "docker build -t speedtest-for-influxdb ." in the directory of the repo. Then I ran docker run with the new image "speedtest-for-influxdb" This resolved the issue.

everythingguy avatar Apr 08 '21 16:04 everythingguy

Same Problem. The tip did not worked in unraid.

IamTheLoki avatar Apr 08 '21 16:04 IamTheLoki

I am using unraid as well. Make sure the built image is in the same context as your unraid docker. Make sure you switch the image in the template to the one you built.

everythingguy avatar Apr 08 '21 16:04 everythingguy

Switch to what?

IamTheLoki avatar Apr 08 '21 20:04 IamTheLoki

Bildschirmfoto 2021-04-08 um 22 19 24

IamTheLoki avatar Apr 08 '21 20:04 IamTheLoki

The repo maintainer needs to rebuild the docker image to resolve this issue. If you want to resolve it on your end then you can follow the steps I provided in my original post.

I got past this error by rebuilding the docker image. The python requirements in the current image are out of date. There is an update to the speedtest-ci that has fixed this error.

Step-by-Step First I cloned this repo Then I ran "docker build -t speedtest-for-influxdb ." in the directory of the repo. Then I ran docker run with the new image "speedtest-for-influxdb" This resolved the issue.

Since you are using unraid instead of the docker run command, you would simply update the repo in the template to the name you used when building the image. The template is what you took a screenshot of. If you don't know how to build docker images your best bet is to wait for the maintainer to do it and then the container will ask to be updated in your unraid gui.

everythingguy avatar Apr 08 '21 20:04 everythingguy

Here is a better guide

Click the terminal button in your unraid gui and run the follow commands

git clone https://github.com/barrycarey/Speedtest-for-InfluxDB-and-Grafana.git cd Speedtest-for-InfluxDB-and-Grafana docker build -t speedtest-for-influxdb . (DO NOT FORGET THE PERIOD)

After your machine completes these commands you can exit the terminal and go to the template for the container. In the template, update the repository to speedtest-for-influxdb

Hope that helps

everythingguy avatar Apr 08 '21 20:04 everythingguy

Thanks @everythingguy At first , I struggled to spot the subtly (re)named flavour of the container in your build command vs the original and wondered why it wasn't working when I changed my template startup command! For anyone else reading this and struggling, note the original is speedtest-for-influxdb-and-grafana and the instructions above will create speedtest-for-influxdb

FYI, I modified the Dockerfile after cloning it/before building form it, and now use FROM python:3.7-alpine in preference to the original FROM python:alpine and have seen a couple of test go through successfully

Looking at the recent git activity/history of @barrycarey, it would appear that he is taking at least a short sabbatical so we shouldn't expect an update just yet i guess. image

techie2000 avatar Apr 09 '21 14:04 techie2000

For those users not using docker (e.g. I am in a TrueNAS jail with it running as a cron [have modified for my use case]), simply do:

$ pip3 install -r requirements.txt --upgrade

jack828 avatar Apr 13 '21 14:04 jack828

For those users not using docker (e.g. I am in a TrueNAS jail with it running as a cron [have modified for my use case]), simply do:

$ pip3 install -r requirements.txt --upgrade

Does that help? I tried it with the container but it does not help: docker run <speedtestimageid> pip3 install -r requirements.txt --upgrade

Any ideas why and how to do it better?

maichai avatar May 06 '21 09:05 maichai

Indeed, the rebuild worked for me. I pushed the working image here: https://hub.docker.com/r/husdupflorin/speedtest-for-influxdb so you don't have to spend the time rebuilding it.

husdupflorin avatar Jun 06 '21 13:06 husdupflorin

If you're very lazy and don't want to rebuild this image, you could download the latest speedtest.py locally (https://github.com/sivel/speedtest-cli/blob/master/speedtest.py) and mount that file to the docker image to override the existing one (which "patches" this bug in the 2 year old image):

docker run --name="speedtest" --restart="always" -v /path/to/config.ini:/src/config.ini -v /path/to/speedtest.py:/usr/local/lib/python3.7/site-packages/speedtest.py atribe/speedtest-for-influxdb-and-grafana:latest

benjaminchodroff avatar Aug 18 '21 22:08 benjaminchodroff

Sorry for the lack of movement on this. Life got in the way the last few months. I spent this weekend reworking most of this project. I should have it merged by next weekend.

It will include an option to use speedtest.py or the official Speedtest.net CLI app for improved results. It will also include support for Influx V1, Influx v2 and Graphite.

barrycarey avatar Aug 30 '21 02:08 barrycarey

Thanks @barrycarey I know the 'life got in the way' thing way too well :) I'll keep an eye out for further updates.

techie2000 avatar Sep 20 '21 08:09 techie2000

Hey All,

I'm retiring this repo and it is being Replaced by Speedmon

The new tool is very similar in function except it's using the official Speedtest.net CLI app for more accurate results. It also has support for Inlflux V1 & V3 along with Graphite.

Configuration process is different so take note of the changes.

Image is now up on Docker Hub

barrycarey avatar Oct 04 '21 01:10 barrycarey

@barrycarey is the output to influx the same model, ie can I use my existing influx db, or will I need to create a new one (and change the Grafana dashboard to point at new source) ?

reading [https://github.com/barrycarey/Speedmon/issues/4#issue-1015537002](https://github.com/barrycarey/Speedmon/issues/4#issue-1015537002) it seems the data defs have changed between the old and new versions, so a new db and loss of the old stored data will be required I guess.

techie2000 avatar Oct 09 '21 14:10 techie2000