diff --git a/Speedtest.inc.php b/Speedtest.inc.php new file mode 100644 index 0000000..462618e --- /dev/null +++ b/Speedtest.inc.php @@ -0,0 +1,52 @@ + + + +
+
+
+
+

Bandwidth

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Latency during Speedtest

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/Speedtest.php b/Speedtest.php new file mode 100644 index 0000000..e69de29 diff --git a/librenms-speedtest.sh b/librenms-speedtest.sh index aec0c02..bd7b925 100644 --- a/librenms-speedtest.sh +++ b/librenms-speedtest.sh @@ -1,9 +1,15 @@ #!/bin/bash -# LibreNMS Speedtest plugin -RRDGraphsDir=/opt/librenms-speedtest/rrd -PNGImagesDir=/opt/librenms-speedtest/png -SpeedtestResultDir=/opt/librenms-speedtest/tmp +############################# +# LibreNMS Speedtest plugin # +############################# +# Main plugin dir +SpeedtestPluginDir=/opt/librenms/html/plugins +# Other data dirs +RRDGraphsDir=$SpeedtestPluginDir/rrd +PNGImagesDir=$SpeedtestPluginDir/png +SpeedtestResultDir=$SpeedtestPluginDir/tmp +# Active script code case $1 in (create) # Create the Latency measurement RRD @@ -28,10 +34,10 @@ SpeedtestResultDir=/opt/librenms-speedtest/tmp DATE=$(/bin/date +%s) # Generate speedtest results, store them in a temp file - speedtest-cli --simple --share > $SpeedtestResultDir/speedtest-results 2>/dev/null + speedtest --accept-license --accept-gdpr -p no > $SpeedtestResultDir/speedtest-results 2>/dev/null # Get the Latency - Latency=$(cat $SpeedtestResultDir/speedtest-results | grep Ping | sed -r 's/\s+//g'| cut -d":" -f2 | cut -d"m" -f1) + Latency=$(cat $SpeedtestResultDir/speedtest-results | grep Latency | sed -r 's/\s+//g'| cut -d":" -f2 | cut -d"m" -f1) # Get the Download speed DownloadSpeed=$(cat $SpeedtestResultDir/speedtest-results | grep Download | sed -r 's/\s+//g'| cut -d":" -f2 | cut -d"M" -f1) @@ -301,7 +307,7 @@ SpeedtestResultDir=/opt/librenms-speedtest/tmp --font AXIS:7:DejaVuSansMono > /dev/null 2>&1 # Move PNGs to the LibreNMS plugin location - cp $PNGImagesDir/*.png /opt/librenms/html/plugins/Speedtest/image + cp $PNGImagesDir/*.png /opt/librenms/html/plugins/Speedtest/png ;; (*) diff --git a/ookla-logo.png b/ookla-logo.png new file mode 100644 index 0000000..e0d1da5 Binary files /dev/null and b/ookla-logo.png differ diff --git a/speedtest-logo.png b/speedtest-logo.png new file mode 100644 index 0000000..0b04451 Binary files /dev/null and b/speedtest-logo.png differ