balena-io-examples / internetspeedtest

Log your internet download, upload and ping metrics ti influxDB, and Grafana it. Grafana all the things!
GNU General Public License v3.0
56 stars 18 forks source link

Packet loss graphing #23

Open chrisys opened 2 years ago

chrisys commented 2 years ago

It would be great to monitor packet loss as well as latency!

phil-d-wilson commented 2 years ago

@chrisys I'm pretty sure you just need to add:

"Packetloss": str(result['packetLoss'])

to the json body : https://github.com/balenalabs-incubator/internetspeedtest/blob/d8e94b670971f68919962de19cf24943eae4f942/speedtest/speedtest.py#L46

that will then send the value over MQTT to Influx, and you can then add the value to your dashboard.

😸

phil-d-wilson commented 2 years ago

My packet loss appears to be 0%.....forever.....so I'm slightly less motivated than you to test and PR the change.

phil-d-wilson commented 2 years ago
{"type":"result","timestamp":"2022-08-24T17:42:23Z","ping":{"jitter":0.36099999999999999,"latency":11.217000000000001},"download":{"bandwidth":79853157,"bytes":763092400,"elapsed":9711},"upload":{"bandwidth":96484915,"bytes":1400822239,"elapsed":15003},"packetLoss":0,"isp":"Box Broadband Limited","interface":{"internalIp":"***","name":"eth0","macAddr":"DC:A6:32:84:81:E5","isVpn":false,"externalIp":"149.102.7.172"},"server":{"id":50179,"name":"TREJJCOMMS","location":"London","country":"United Kingdom","host":"speedtest.trejj.net","port":8080,"ip":"***"},"result":{"id":"e1e635dd-57bc-4078-801a-8b3da04b3f34","url":"https://www.speedtest.net/result/c/e1e635dd-57bc-4078-801a-8b3da04b3f34"}}

A quick manual run of the speedtest CLI shows that packetLoss is the index. :)

chrisys commented 2 years ago

@phil-d-wilson sick, will try this!

chrisys commented 2 years ago

it works, but I realised it doesn't work for my situation as I need to run the packetloss check almost continuously in order to catch the errors