How to monitor your internet connection with virtual custom sensors

Client tools or tools that can connect with Domoticz. Tools for Windows, iOS, Android, Linux etc.

Moderator: leecollings

safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: monitor internet connection with virtual sensors

Post by safi78 »

@Derik:

I realised the package has different names, and maybe its even added in the latest distro's only, I don't know.

@hourly runs every xx:00 if I recall correctly, not sure though.

Glad your're happy with it :)
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: monitor internet connection with virtual sensors

Post by Derik »

emme wrote:low ping means fast response.... so it's good
high ping means slow response... that' bad

Watch out the unit: normally it's ms-->milliseconds

Thanks
What's a normal/good ping?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: monitor internet connection with virtual sensors

Post by safi78 »

The lower the better. Here's my graph, lowest I got was 25'ish (on cablemodem)
Screen Shot 2016-10-23 at 19.09.29.png
Screen Shot 2016-10-23 at 19.09.29.png (292.29 KiB) Viewed 3480 times
I eventually found out my problem so, the very high pings are either other stuff that's going on (downloading stuff with sabnzbd full throttle) or my connection with my cable modem and switch flappy (probably the auto-negiotation about duplex / speed etc going haywire). Still have to fix that, but TP-link doesn't offer a lot of Mac-software to manage stuff :(

regards!
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: monitor internet connection with virtual sensors

Post by Derik »

mmm
Hope this "garbage " give no trouble...
ScreenShot075.jpg
ScreenShot075.jpg (83.55 KiB) Viewed 3473 times
I mean the Json files


Or i there something that i do wrong ...

This going to kill my sd ...[ after a few months .]
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: monitor internet connection with virtual sensors

Post by safi78 »

hmm i have the same thing, even with the 'wget -q' and redirect to /dev/null etc. weird. gotto look into that.

somewhat reassuring, I think I'm using my SSD for about 2 years now with a lot of scripting, testing, trial and error, etc and it's still fine.
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: monitor internet connection with virtual sensors

Post by Derik »

safi78 wrote:hmm i have the same thing, even with the 'wget -q' and redirect to /dev/null etc. weird. gotto look into that.

somewhat reassuring, I think I'm using my SSD for about 2 years now with a lot of scripting, testing, trial and error, etc and it's still fine.

Ok like to hear from you when you think you have a solution, i will test :-)

My sd is stable ony this stuff is not the best option in that place...
When domoticz kills... some people here @ home get nervous..
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: monitor internet connection with virtual sensors

Post by safi78 »

backup, backup backup ;)

Anyway, you can always create a 'ram-drive' to redirect this stuff to? Saves you disk-trashing :)
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: monitor internet connection with virtual sensors

Post by Derik »

safi78 wrote:backup, backup backup ;)

Anyway, you can always create a 'ram-drive' to redirect this stuff to? Saves you disk-trashing :)
Backup is not the problem....

Code: Select all

0 1 * * * sudo ~/domoticz/scripts/domoticz_backup.sh
5 1 * * 6 sudo ~/domoticz/scripts/scripts_backup.sh
10 1 * * 6 sudo ~/domoticz/scripts/domoticz_map_backup.sh
1 1 1 * * sudo ~/domoticz/scripts/raspberry_backup.sh
Only everytime the work/time...
And Domoticz is going so fast that i do not every time how anything is working..
1 person says to me... when you can hold your card clean why don;t you do that
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
geho
Posts: 13
Joined: Thursday 08 August 2013 22:30
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: monitor internet connection with virtual sensors

Post by geho »

Try this:

curl -s -i -H "Accept: application/json" "http://$host:$port/json.htm?type=command&param=udevice&idx=$idxdl&svalue=$download"
curl -s -i -H "Accept: application/json" "http://$host:$port/json.htm?type=command&param=udevice&idx=$idxul&svalue=$upload"
curl -s -i -H "Accept: application/json" "http://$host:$port/json.htm?type=command&param=udevice&idx=$idxpng&svalue=$png"

this will not add files
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: monitor internet connection with virtual sensors

Post by Derik »

do i need to replace this.. or add?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
geho
Posts: 13
Joined: Thursday 08 August 2013 22:30
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: monitor internet connection with virtual sensors

Post by geho »

replace it
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: monitor internet connection with virtual sensors

Post by safi78 »

@Derik: I've been running beta since the beginning, never had any problems. A quick reinstall, yes, but restoring the db / scripts etc gets me up-and-running in an hour.

And, I see you are Dutch as well, so you can have a new SSD within 24 hours with BOL or CoolBlue ;)

@geho: Thanks a bundle! Added to original post.
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: monitor internet connection with virtual sensors

Post by Derik »

Code: Select all

pi@raspberrypi ~/domoticz/scripts $ ./speedtest.sh
ping = 37.035 ms
download = 33.04 Mbps
upload =  9.32 Mbps
HTTP/1.1 200 OK
Content-Length: 24
Content-Type: application/json;charset=UTF-8
Cache-Control: no-cache
Pragma: no-cache
Access-Control-Allow-Origin: *

{
   "status" : "ERR"
}
HTTP/1.1 200 OK
Content-Length: 24
Content-Type: application/json;charset=UTF-8
Cache-Control: no-cache
Pragma: no-cache
Access-Control-Allow-Origin: *

{
   "status" : "ERR"
}
HTTP/1.1 200 OK
Content-Length: 24
Content-Type: application/json;charset=UTF-8
Cache-Control: no-cache
Pragma: no-cache
Access-Control-Allow-Origin: *

{
   "status" : "ERR"
}
Got some errors.. With the new curl..
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: monitor internet connection with virtual sensors

Post by safi78 »

Works fine here. What did you put in your script?
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: monitor internet connection with virtual sensors

Post by Derik »

Code: Select all

#!/bin/bash

#setup
host=192.168.5.75
port=8081
username=LOGIN
password=WW
pingidx=4427
downloadidx=4426
uploadidx=4425

# 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&param=udevice&idx=$idxdl&svalue=$download"
curl -s -i -H "Accept: application/json" "http://$host:$port/json.htm?type=command&param=udevice&idx=$idxul&svalue=$upload"
curl -s -i -H "Accept: application/json" "http://$host:$port/json.htm?type=command&param=udevice&idx=$idxpng&svalue=$png"
Sorry i am not sooooo smart//..
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: monitor internet connection with virtual sensors

Post by safi78 »

Not sure, but didn't you forget the $username & $password like so:

Code: Select all

curl -s -i -H "Accept: application/json" "http://$username:$password@$host:$port/json.htm?type=command&param=udevice&idx=$pingidx&svalue=$ping"
curl -s -i -H "Accept: application/json" "http://$username:$password@$host:$port/json.htm?type=command&param=udevice&idx=$downloadidx&svalue=$download"
curl -s -i -H "Accept: application/json" "http://$username:$password@$host:$port/json.htm?type=command&param=udevice&idx=$uploadidx&svalue=$upload"
?
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: monitor internet connection with virtual sensors

Post by safi78 »

And seriously, do you have like 4000+ devices in your domoticz history? :shock:
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: monitor internet connection with virtual sensors

Post by Derik »

Dear Safi,

looks working @ my crontab time.. without garbage in my sd.. [ love your great work ]
See tomorrow, how his is working

And yes my history is real great.... the reason my complicated Zwave network....
did open new sensors for long time to see my new devices.
Then i delete them all, when i get my new devices..
Did this servile times.....
And Domoticz is still counting...
Only working like a rocket....
Thanks!!
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: monitor internet connection with virtual sensors

Post by Derik »

Thanks again
Works great without garbage
ScreenShot076.jpg
ScreenShot076.jpg (64.97 KiB) Viewed 3325 times
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
manjh
Posts: 708
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: monitor internet download speed with virtual sensor

Post by manjh »

jumbotroll wrote:
manjh wrote:This is great for the R-Pi, but is there an alternative for a Windows based server?
On windows 10 it's working here.
Install python 3.5.2 from https://www.python.org/downloads/
Open cmd as Administrator and type: pip install speedtest-cli
Then you can type: speedtest
I installed it and ran an admin-cmd. But PIP is not recognized as command or program...
In which directory does Python install? I can't find anything that looks recognizable!

Edit: never mind, I found the directory and was able to install the speedtest package, and run the speedtest manually.
Thanks!
Last edited by manjh on Monday 24 October 2016 21:47, edited 1 time in total.
Hans
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests