change folder structure: Merge all into the plugins dir

This commit is contained in:
Jack Greyhat
2021-01-26 15:42:38 +01:00
parent 7210ed6e89
commit a6a2ddb8d0
5 changed files with 65 additions and 7 deletions

52
Speedtest.inc.php Normal file
View File

@ -0,0 +1,52 @@
<html>
<body>
<div style='clear: both;'>
<div style='margin: 5px;'>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Bandwidth</h3>
</div>
<div class="panel-body">
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/image/speedtest-bandwidth-day.png\' style=\'border:0;\' /></div>',FGCOLOR,'#ffffff', BGCOLOR, '#e5e5e5', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#555555', TEXTCOLOR, '#3e3e3e',WRAP,HAUTO,VAUTO); " onmouseout="return nd();"><img class="lazy img-responsive" data-original="plugins/Speedtest/image/speedtest-bandwidth-day.png" style="border: 0" /></a>
</div>
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/image/speedtest-bandwidth-week.png\' style=\'border:0;\' /></div>',FGCOLOR,'#ffffff', BGCOLOR, '#e5e5e5', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#555555', TEXTCOLOR, '#3e3e3e',WRAP,HAUTO,VAUTO); " onmouseout="return nd();"><img class="lazy img-responsive" data-original="plugins/Speedtest/image/speedtest-bandwidth-week.png" style="border: 0" /></a>
</div>
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/image/speedtest-bandwidth-month.png\' style=\'border:0;\' /></div>',FGCOLOR,'#ffffff', BGCOLOR, '#e5e5e5', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#555555', TEXTCOLOR, '#3e3e3e',WRAP,HAUTO,VAUTO); " onmouseout="return nd();"><img class="lazy img-responsive" data-original="plugins/Speedtest/image/speedtest-bandwidth-month.png" style="border: 0" /></a>
</div>
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/image/speedtest-bandwidth-year.png\' style=\'border:0;\' /></div>',FGCOLOR,'#ffffff', BGCOLOR, '#e5e5e5', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#555555', TEXTCOLOR, '#3e3e3e',WRAP,HAUTO,VAUTO); " onmouseout="return nd();"><img class="lazy img-responsive" data-original="plugins/Speedtest/image/speedtest-bandwidth-year.png" style="border: 0" /></a>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Latency during Speedtest</h3>
</div>
<div class="panel-body">
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/image/speedtest-latency-day.png\' style=\'border:0;\' /></div>',FGCOLOR,'#ffffff', BGCOLOR, '#e5e5e5', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#555555', TEXTCOLOR, '#3e3e3e',WRAP,HAUTO,VAUTO); " onmouseout="return nd();"><img class="lazy img-responsive" data-original="plugins/Speedtest/image/speedtest-latency-day.png" style="border: 0" /></a>
</div>
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/image/speedtest-latency-week.png\' style=\'border:0;\' /></div>',FGCOLOR,'#ffffff', BGCOLOR, '#e5e5e5', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#555555', TEXTCOLOR, '#3e3e3e',WRAP,HAUTO,VAUTO); " onmouseout="return nd();"><img class="lazy img-responsive" data-original="plugins/Speedtest/image/speedtest-latency-week.png" style="border: 0" /></a>
</div>
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/image/speedtest-latency-month.png\' style=\'border:0;\' /></div>',FGCOLOR,'#ffffff', BGCOLOR, '#e5e5e5', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#555555', TEXTCOLOR, '#3e3e3e',WRAP,HAUTO,VAUTO); " onmouseout="return nd();"><img class="lazy img-responsive" data-original="plugins/Speedtest/image/speedtest-latency-month.png" style="border: 0" /></a>
</div>
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/image/speedtest-latency-year.png\' style=\'border:0;\' /></div>',FGCOLOR,'#ffffff', BGCOLOR, '#e5e5e5', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#555555', TEXTCOLOR, '#3e3e3e',WRAP,HAUTO,VAUTO); " onmouseout="return nd();"><img class="lazy img-responsive" data-original="plugins/Speedtest/image/speedtest-latency-year.png" style="border: 0" /></a>
</div>
</div>
</div>
</div>
</div>
<?php
?>
</body>
</html>

0
Speedtest.php Normal file
View File

View File

@ -1,9 +1,15 @@
#!/bin/bash #!/bin/bash
# LibreNMS Speedtest plugin #############################
RRDGraphsDir=/opt/librenms-speedtest/rrd # LibreNMS Speedtest plugin #
PNGImagesDir=/opt/librenms-speedtest/png #############################
SpeedtestResultDir=/opt/librenms-speedtest/tmp # 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) case $1 in (create)
# Create the Latency measurement RRD # Create the Latency measurement RRD
@ -28,10 +34,10 @@ SpeedtestResultDir=/opt/librenms-speedtest/tmp
DATE=$(/bin/date +%s) DATE=$(/bin/date +%s)
# Generate speedtest results, store them in a temp file # 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 # 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 # Get the Download speed
DownloadSpeed=$(cat $SpeedtestResultDir/speedtest-results | grep Download | sed -r 's/\s+//g'| cut -d":" -f2 | cut -d"M" -f1) 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 --font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Move PNGs to the LibreNMS plugin location # 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
;; ;;
(*) (*)

BIN
ookla-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
speedtest-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB