Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuratyion for speedtest-cli #383

Open
Scoperius opened this issue Oct 9, 2021 · 15 comments
Open

Configuratyion for speedtest-cli #383

Scoperius opened this issue Oct 9, 2021 · 15 comments

Comments

@Scoperius
Copy link

Hi I tried to make a running configuration for speedtest-cli (https://github.com/sivel/speedtest-cli). But without any success. Can you please point me the right way? May proposed conf does not display anything:

dynamic.101.name=Ping
dynamic.101.source=/home/pi/speedtest-cli/speedtest.py --simple | grep "Ping: "
dynamic.101.regexp=(.*)

web.status.1.content.10.line.2="Internet Ping: " + data.Ping

although /home/pi/speedtest-cli/speedtest.py --simple | grep "Ping: " returns Ping value properly

Thanks for help,

Petr

@dirdled
Copy link

dirdled commented Oct 16, 2021

Hi Scoperius, I'm not sure if it has to be this way, but I had the best luck when I put just the command for the source, and then did the filtering using the regexp line, so for your config I would try something like

dynamic.101.name=Ping
dynamic.101.source=/home/pi/speedtest-cli/speedtest.py --simple
dynamic.101.regexp=(Ping:.*)
dynamic.101.postprocess=$1

Also there may be a better way to do this, but when I wanted to monitor my internet stats using speedtest-cli and rpimonitor, I built a wrapper for the speedtest command, because it takes so long to run. I think you can also use the interval and timeout values to do it, but I had other reasons why I wanted to use a wrapper. Basically what my wrapper does is checks the age (and existence) of the previous output file, and only runs the speedtest if the file is older than a certain age. Then rpimonitor is able to read that output file as often as it likes without having to worry about
a) Creating a lot of extra bandwidth
and
b) How long the command takes to run.

Like I said there may be better ways to do all of this, but that is what worked for me

@sgrayban
Copy link

@dirdled Care to share your wrapper?

@dirdled
Copy link

dirdled commented Dec 23, 2021

Hi sgrayban,

I can share, but I'm not sure my code is suitable for mass consumption. I tend to do Quick and dirty stuff, with the intention of going back and polishing it if I ever run out of projects and have spare time...So far that hasn't happened

@sgrayban
Copy link

sgrayban commented Dec 23, 2021

@dirdled

Well I was just wondering how you managed to remove the text out of the speedtest results.

Currently I have a cron running every 10 minutes that saves the results to a file which is pulled by the software.

cat /root/speedtest.txt

Ping: 29.792 ms
Download: 113.56 Mbit/s
Upload: 17.67 Mbit/s

Have you been able to clean that up to only get the numbers?

@dirdled
Copy link

dirdled commented Dec 23, 2021

The output that I save is just exactly like that, but when RPIMonitor reads the file it runs it though this line

cat $speedTestOut|sed -n "/$dataType/Is/.*: \(.*\) .*/\1/p"
Where
$speedTestOut is the name of the output file (it looks like /root/speedtest.txt in your case)
and
$datatype is either ping, download, or upload

@sgrayban
Copy link

@dirdled thanks !!!

image

My script has this now....

#!/bin/bash
# file: /root/speedtest.sh

speedtest --simple > /root/speedtest.txt
cat /root/speedtest.txt|sed -n "/ping/Is/.*: \(.*\) .*/\1/p" > /root/ping.txt
cat /root/speedtest.txt|sed -n "/download/Is/.*: \(.*\) .*/\1/p" > /root/download.txt
cat /root/speedtest.txt|sed -n "/upload/Is/.*: \(.*\) .*/\1/p" > /root/upload.txt

Now to get that into the graph stats!!

@dirdled
Copy link

dirdled commented Dec 24, 2021

@sgrayban Nice... If I can figure out how to to a private message on here, I can share the whole script and also show you what I have for a configuration to use the script...But I'm not sure my fragile ego can handle having people who really know what they're doing critique my code (I guess I'm assuming that you're OK to show because you're asking me questions :) )

@sgrayban
Copy link

@dirdled no PM's here. Are you on Facebook?

@sgrayban
Copy link

@dirdled and just to tease you more

image

Got the icons working

@dirdled
Copy link

dirdled commented Dec 24, 2021

@sgrayban Yeah, I'm on facebook (same ID), I don't login often, but I have an account

Here's what mine looks like

image

Looks like they bumped my upload speed, so I should adjust my gauge settings

@Ajimaru
Copy link

Ajimaru commented Dec 24, 2021

No worries, poste your script, we are curious.

@sgrayban
Copy link

@Ajimaru @dirdled did send it to me and it's a nifty bit of code. I don't know why he doesn't wasn't to share it publicly. Maybe he will reconsider with my praise??

@dirdled
Copy link

dirdled commented Dec 24, 2021

Ok, Ok, Since it sounds like @sgrayban doesn't think the code is a dumpster fire I'll share... Here are 2 files one is the speedtest Wrapper (in bash), and the other is the config file for Rpi-Monitor.
SpeedChk.txt
internet.conf.txt

@sgrayban
Copy link

image

@xgenosis
Copy link

xgenosis commented May 3, 2024

Ok, Ok, Since it sounds like @sgrayban doesn't think the code is a dumpster fire I'll share... Here are 2 files one is the speedtest Wrapper (in bash), and the other is the config file for Rpi-Monitor. SpeedChk.txt internet.conf.txt

So this is pretty old but I'm trrying to get this up and running and i cannot. I have setup both files but does the speedchk need to run on a timer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants