Page 9 of 13
Re: How to monitor your internet connection with virtual custom sensors
Posted: Friday 19 May 2017 12:32
by bertbigb
Hi ilpier, nice that you have at least output in the txt file.
ok, please check if all the parameters are OK:
port=8080
username=Admin
password=***
host=localhost
pingidx=239
downloadidx=241
uploadidx=240
If that is the case then change:
curl -s -i -H "Accept: application/json" "http://$username:$password@$host:$port/json.htm type=command¶m=udevice&idx=$pingidx&svalue=$ping"
to
curl -s -i -H "Accept: application/json" "
http://Admin:***@localhost:8080/json.ht ... svalue=245"
and lets see if the ping on domoticz then get the value 245
Re: How to monitor your internet connection with virtual custom sensors
Posted: Friday 19 May 2017 12:32
by bertbigb
of course change the *** to your password
Re: How to monitor your internet connection with virtual custom sensors
Posted: Friday 19 May 2017 13:52
by ilpier
yes of course i've insert the correct password!
But no,nothing happen in Domoticz with the modify
curl -s -i -H "Accept: application/json" "
http://Admin:***@localhost:8080/json.ht ... svalue=245"
Re: How to monitor your internet connection with virtual custom sensors
Posted: Friday 19 May 2017 15:35
by ilpier
Now Work,reboot and work with first:
curl -s -i -H "Accept: application/json" "http://$username:$password@$host:$port/json.htm type=command¶m=udevice&idx=$pingidx&svalue=$ping"
Thx too much!
Re: How to monitor your internet connection with virtual custom sensors
Posted: Friday 19 May 2017 15:38
by bertbigb
ilpier wrote:Now Work,reboot and work with first:
curl -s -i -H "Accept: application/json" "http://$username:$password@$host:$port/json.htm type=command¶m=udevice&idx=$pingidx&svalue=$ping"
Thx too much!
Good to hear, lots of fun with it!
Re: How to monitor your internet connection with virtual custom sensors
Posted: Tuesday 20 June 2017 7:36
by visser
I'm really happy with the speed monitoring, it's been running since last year.
Download speed:
- screenshot-speedtestdom1.jpg (170.78 KiB) Viewed 6203 times
- screenshot-speedtestdom2.jpg (186.16 KiB) Viewed 6203 times
(Big drop off in speed moving from Hamburg, Germany to Brisbane, Australia)
Ping:
- screenshot-speedtestdom3.jpg (169.98 KiB) Viewed 6203 times
Re: How to monitor your internet connection with virtual custom sensors
Posted: Tuesday 20 June 2017 9:54
by safi78
visser wrote:I'm really happy with the speed monitoring, it's been running since last year.
Glad you like it
I never expected my simple script would attract such a large audience haha
Re: How to monitor your internet connection with virtual custom sensors
Posted: Tuesday 20 June 2017 12:30
by gielie
@safi
Tanks for the script, i changed it a little bit to use it on my Synology and send the data to my Domoticz Pi. Works great. Now to monitor my Ziggo account so i can complain about the slow speeds.
Re: How to monitor your internet connection with virtual custom sensors
Posted: Thursday 22 June 2017 9:59
by gielie
gielie wrote:@safi
Tanks for the script, i changed it a little bit to use it on my Synology and send the data to my Domoticz Pi. Works great. Now to monitor my Ziggo account so i can complain about the slow speeds.
ps. Is it possible to create a report from the log?
Re: How to monitor your internet connection with virtual custom sensors
Posted: Tuesday 25 July 2017 13:45
by safi78
gielie wrote:ps. Is it possible to create a report from the log?
What do you mean?
Re: How to monitor your internet connection with virtual custom sensors
Posted: Wednesday 26 July 2017 22:00
by Trigun
hi guys, I had it running well on my synology NAS unitll I decided To reinstall my NAS.
is there a chance anyone can help me out how to install it on my nas?
I already put the two files in a folder but I also need to install it am totaly lost.
Thx in advance!
Re: How to monitor your internet connection with virtual custom sensors
Posted: Wednesday 30 August 2017 20:48
by bertbigb
EdwinK wrote: ↑Tuesday 18 April 2017 19:54
Running this on a Synology NAS too, and had it working in matter of minutes.
Synology doesn't have apt-get, so you need to find another way to get the files. I used easy_install, but can't quite remember how I did install that.
Search for easy_install and Synology on the Google.
When someone search how to install on Synology --> this might be helpful
https://pypi.python.org/pypi/speedtest-cli/
Re: How to monitor your internet connection with virtual custom sensors
Posted: Wednesday 30 August 2017 20:52
by bertbigb
Trigun wrote: ↑Wednesday 26 July 2017 22:00
hi guys, I had it running well on my synology NAS unitll I decided To reinstall my NAS.
is there a chance anyone can help me out how to install it on my nas?
I already put the two files in a folder but I also need to install it am totaly lost.
Thx in advance!
Sorry for the late reply
Try this to download speedtest-cli -->
https://pypi.python.org/pypi/speedtest-cli/
and follow this wiki -->
https://www.domoticz.com/wiki/Bash_-_Sp ... monitoring
Let me know where you get stucked when you are not successful, but i think you will
Re: How to monitor your internet connection with virtual custom sensors
Posted: Tuesday 05 September 2017 23:45
by guantolento
Hi, it is possible send the result of the test with telegram in a bot ?
Re: How to monitor your internet connection with virtual custom sensors
Posted: Wednesday 06 September 2017 9:06
by safi78
guantolento wrote: ↑Tuesday 05 September 2017 23:45
Hi, it is possible send the result of the test with telegram in a bot ?
Yes.
Use the search function, there's alot of information about that in countless threads on how to do that.
Good luck!
Re: How to monitor your internet connection with virtual custom sensors
Posted: Sunday 17 September 2017 20:51
by Trigun
hi all, I finally managed to install speedtest on my synology.
when I run speedtest-cli I get results.
but when I try to run the script, it doesn't work.
when I run I get the following errors:
- Knipsel2.PNG (13.06 KiB) Viewed 5622 times
Line 2 and line 11 are empty lines.
Code: Select all
#!/bin/bash
#setup
host=192.168.1.21
port=8084
pingidx=3
downloadidx=1
uploadidx=2
# no need to edit
speedtest-cli --simple > output.txt
ping=$(cat output.txt | sed -ne 's/^Ping: \([0-9]*\.[0-9]*\).*/\1/p')
download=$(cat output.txt | sed -ne 's/^Download: \([0-9]*\.[0-9]*\).*/\1/p')
upload=$(cat output.txt | sed -ne 's/^Upload: \([0-9]*\.[0-9]*\).*/\1/p')
#output if you run it manually
echo "ping = $ping ms"
echo "download = $download Mbps"
echo "upload = $upload Mbps"
curl -s -i -H "Accept: application/json" "http://$host:$port/json.htm?type=command¶m=udevice&idx=$pingidx&svalue=$ping"
curl -s -i -H "Accept: application/json" "http://$host:$port/json.htm?type=command¶m=udevice&idx=$downloadidx&svalue=$download"
curl -s -i -H "Accept: application/json" "http://$host:$port/json.htm?type=command¶m=udevice&idx=$uploadidx&svalue=$upload"
strange thing is that I do get an "output.txt" file, but nothing in domoticz.
can anyone help me out here?
Re: How to monitor your internet connection with virtual custom sensors
Posted: Tuesday 19 September 2017 11:53
by freijn
As far as my knowledge goes \r is a dos<=>unix issue.
Please open the file in a good editor and see your CarageReturns and Linefeed at then end of each line.
Re: How to monitor your internet connection with virtual custom sensors
Posted: Thursday 21 September 2017 14:03
by dbfan
Hi guys,
I am running this script successfully nowsince 1 year, but yesterday internet connection dropped for 4 hrs (Ziggo storing) and I found out that the last value continues (sensor "last seen" did not change). So, no drop to zero for "download speed" f.i.
What needs to be changed in the script to force a zero value when there is no connection at all ?
thnx, dbfan
Re: How to monitor your internet connection with virtual custom sensors
Posted: Friday 22 September 2017 15:43
by Trigun
freijn wrote: ↑Tuesday 19 September 2017 11:53
As far as my knowledge goes \r is a dos<=>unix issue.
Please open the file in a good editor and see your CarageReturns and Linefeed at then end of each line.
Hi freijn,
i am using an exact copy of the script being used(with my own info)
not sure where it goed wrong, Ik keep getting the error.
the result is that I do get an output.txt file but no data is send to domoticz
Grtz
Re: How to monitor your internet connection with virtual custom sensors
Posted: Monday 25 September 2017 11:55
by freijn
Hi Trigun,
You wrote "(with my own info)" So you did edit the file and therefore changed it.
please read this :
https://stackoverflow.com/questions/186 ... -not-found
or search in Google on your error message : '\r': command not found [duplicate]
What OS system are you using edditing the file?
You could put the ORIGINAL ! file on the domoticz system and start editing using nano.
Doing so I am 100% you will not see this '\r' error again
Cheers,
Frank