Modernized the plugin

Implemented fixes from Gitlab issues
from Marc Hagen & Trent Robinson (https://gitlab.com/jackgreyhat/librenms-speedtest/-/issues/2)
and fixes from m0nsieur Psych0 (https://gitlab.com/jackgreyhat/librenms-speedtest/-/issues/6)

I added support for darkmode, this is done by generating the graphs with white text, then using CSS to invert the image, for light mode users.

I also moved branding PNGs to vectors for higher resolutions

I will not be opening a PR at https://gitlab.com/jackgreyhat/librenms-speedtest as this seems to have been abbandoned.
This commit is contained in:
Sophia Atkinson 2023-09-15 15:59:51 -07:00
parent a0747a0fab
commit 8a516b8664
7 changed files with 295 additions and 28 deletions

View File

@ -1,15 +1,15 @@
<html>
<style>html .panel-body img,html .panel-body img.img-responsive,html div#overDiv table tbody tr td table tbody tr td font .overlib-contents img{filter:invert(1)}html.tw-dark .panel-body img,html.tw-dark .panel-body img.img-responsive,html.tw-dark div#overDiv table tbody tr td table tbody tr td font .overlib-contents img{filter:none!important}</style>
<body>
<div class="panel panel-default">
<div class="panel-body ">
<img src="plugins/Speedtest/images/speedtest-logo.png" title="Speedtest Logo" class="device-icon-header pull-left" style="max-height:25px;height:100%;margin-top:8px">
<img src="plugins/Speedtest/images/speedtest-logo.svg" title="Speedtest Logo" class="device-icon-header pull-left" style="max-height:25px;height:100%;margin-top:8px">
<div class="pull-left" style="margin-top: 5px;">
<span style="font-size: 12px;font-weight: bold">Last used Speedtest server:</span><br />
<span style="font-size: 12px;"><?php require_once("plugins/Speedtest/tmp/speedtest-server");?></span>
</div>
<div class="pull-right">
<img src="plugins/Speedtest/images/ookla-logo.png" title="Ookla Logo" style="max-height: 50px">
<img src="plugins/Speedtest/images/ookla-logo.svg" title="Ookla Logo" style="max-height: 50px">
</div>
</div>
</div>
@ -22,16 +22,16 @@
</div>
<div class="panel-body">
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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/png/speedtest-bandwidth-day.png" style="border: 0" /></a>
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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="img-responsive" src="plugins/Speedtest/png/speedtest-bandwidth-day.png" style="border: 0" loading="lazy"/></a>
</div>
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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/png/speedtest-bandwidth-week.png" style="border: 0" /></a>
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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="img-responsive" src="plugins/Speedtest/png/speedtest-bandwidth-week.png" style="border: 0" loading="lazy"/></a>
</div>
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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/png/speedtest-bandwidth-month.png" style="border: 0" /></a>
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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="img-responsive" src="plugins/Speedtest/png/speedtest-bandwidth-month.png" style="border: 0" loading="lazy"/></a>
</div>
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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/png/speedtest-bandwidth-year.png" style="border: 0" /></a>
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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="img-responsive" src="plugins/Speedtest/png/speedtest-bandwidth-year.png" style="border: 0" loading="lazy"/></a>
</div>
</div>
</div>
@ -41,16 +41,16 @@
</div>
<div class="panel-body">
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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/png/speedtest-latency-day.png" style="border: 0" /></a>
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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="img-responsive" src="plugins/Speedtest/png/speedtest-latency-day.png" style="border: 0" loading="lazy"/></a>
</div>
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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/png/speedtest-latency-week.png" style="border: 0" /></a>
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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="img-responsive" src="plugins/Speedtest/png/speedtest-latency-week.png" style="border: 0" loading="lazy"/></a>
</div>
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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/png/speedtest-latency-month.png" style="border: 0" /></a>
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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="img-responsive" src="plugins/Speedtest/png/speedtest-latency-month.png" style="border: 0" loading="lazy"/></a>
</div>
<div class="col-md-3">
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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/png/speedtest-latency-year.png" style="border: 0" /></a>
<a onmouseover="return overlib('<div class=\'overlib-contents\'><img src=\'plugins/Speedtest/png/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="img-responsive" src="plugins/Speedtest/png/speedtest-latency-year.png" style="border: 0" loading="lazy"/></a>
</div>
</div>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

1
images/ookla-logo.svg Normal file
View File

@ -0,0 +1 @@
<svg width="200" height="66" xmlns="http://www.w3.org/2000/svg"><path d="M137.297 1.082l-33.674 33.897 2.777 2.776 30.897-31.087zm-8.012.032L99.6 30.989l2.81 2.776 26.906-27.097zm.064 15.99l-21.736 21.864 2.808 2.777 18.96-19.087zM66.662 21.83c-12.48.032-21.29 9.415-21.257 21.544.032 12.13 8.905 21.45 21.385 21.417 12.48-.032 21.289-9.416 21.257-21.544-.032-12.13-8.905-21.45-21.385-21.417zm-45.068.127C9.114 21.988.304 31.372.336 43.5c.032 12.13 8.905 21.45 21.385 21.418 12.48-.032 21.29-9.416 21.258-21.545-.032-12.129-8.905-21.45-21.385-21.417zm161.09.511l-6.033.032-17.076 40.95 6.224-.032 13.63-33.768h.127l13.852 33.705 6.256-.032zm-50.878.16l.128 40.918 25.886-.096v-5.202l-20.364.064-.096-35.684zm-35.238.119l-5.617.018.13 40.887 5.618-.018zm-29.906 4.253c9.352-.032 15.448 7.31 15.48 16.247.032 8.937-6 16.31-15.384 16.341-9.352.032-15.448-7.309-15.48-16.246 0-8.97 6.032-16.31 15.384-16.342zm-45.068.128c9.352-.032 15.448 7.31 15.48 16.246.032 8.97-6.001 16.31-15.353 16.342-9.352.032-15.448-7.31-15.48-16.246-.032-8.97 6-16.31 15.353-16.342zm76.922 4.947l.032 5.554 26.077 25.917h5.554zm.032 7.916v5.65l18.066 17.937h5.649zm.032 8.075v5.586l10.054 9.958 5.554-.032z" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1 @@
<svg width="208" height="25" xmlns="http://www.w3.org/2000/svg"><path d="M14.967.17C6.861.17.557 6.73.557 14.708c0 3.346 1.158 6.69 3.346 9.264l.9 1.028 1.672-1.67-.643-.903c-1.8-2.188-2.702-4.89-2.702-7.72A12.08 12.08 0 0115.225 2.614a12.08 12.08 0 0112.094 12.095c0 2.83-1.03 5.531-2.704 7.72l-.64.901L25.646 25l.9-1.028c1.801-2.702 2.958-5.918 2.958-9.264C29.505 6.73 23.073.17 14.967.17zM44.43 3.128c-4.117 0-7.076 2.446-7.076 5.92 0 3.859 2.444 5.145 6.818 6.174 3.86.772 4.634 1.673 4.634 3.088 0 1.545-1.417 2.574-3.604 2.574-2.573 0-4.63-1.03-6.56-2.702l-2.19 2.573c2.446 2.188 5.534 3.217 8.622 3.217 4.247 0 7.333-2.316 7.333-6.177 0-3.473-2.187-5.016-6.562-6.045-3.988-.901-4.888-1.674-4.888-3.218 0-1.416 1.286-2.444 3.345-2.444 1.8 0 3.73.644 5.532 2.06l2.06-2.446c-2.059-1.672-4.505-2.574-7.464-2.574zm11.064 0v20.457h3.603v-6.562h4.119c4.503 0 8.233-2.444 8.233-7.076 0-4.117-3.088-6.82-7.848-6.82zm19.044 0v20.586h15.438v-3.217H78.139v-5.532h10.294V11.75H78.139V6.345h11.71V3.128zm19.17 0v20.586h15.438v-3.217H97.309v-5.532h10.294V11.75H97.309V6.345h11.709V3.128zm19.042 0v20.586h7.718c6.434 0 10.937-4.503 10.937-10.292 0-5.79-4.503-10.294-10.937-10.294zm20.713 0v3.347h6.564v17.24h3.6V6.474h6.563V3.128zm20.459 0v20.586h15.437v-3.217h-11.835v-5.532h10.292V11.75h-10.292V6.345h11.708V3.128zm26.374 0c-4.118 0-7.077 2.446-7.077 5.92 0 3.859 2.445 5.145 6.82 6.174 3.86.772 4.632 1.673 4.632 3.088 0 1.545-1.415 2.574-3.602 2.574-2.574 0-4.632-1.03-6.562-2.702l-2.188 2.573c2.444 2.188 5.405 3.217 8.75 3.474 4.245 0 7.332-2.315 7.332-6.175 0-3.474-2.186-5.02-6.56-6.049-3.988-.9-4.89-1.671-4.89-3.215 0-1.415 1.287-2.445 3.345-2.445 1.801 0 3.732.643 5.533 2.06l1.93-2.703c-2.059-1.672-4.504-2.574-7.463-2.574zm10.293 0v3.347h6.562v17.24h3.602V6.474h6.563V3.128zM59.097 6.345h4.247c2.83 0 4.502 1.287 4.502 3.732 0 2.187-1.8 3.73-4.502 3.73h-4.247zm57.383.257h4.118c4.375 0 7.205 2.96 7.205 6.948 0 3.988-2.83 6.947-7.205 6.947h-4.118zM20.242 8.275l-8.105 6.433 2.83 2.83L21.4 9.433z" fill="#fff" fill-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

25
install.sh Normal file
View File

@ -0,0 +1,25 @@
# Install speedtest pkg
sudo apt-get install curl
sudo apt remove speedtest-cli
curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
sudo apt-get install speedtest
# Go to your home dir
cd ~/
# Clone this repository into your home dir
git clone https://git.oldgate.org/Sophia/librenms-speedtest
# Create the plugin directory into LibreNMS plugin folder
mkdir /opt/librenms/html/plugins/Speedtest
# Copy the LibreNMS speedtest plugin contents into the newly created directory
cp -r ~/librenms-speedtest/. /opt/librenms/html/plugins/Speedtest
# Ensure correct ownership and permissions on the Speedtest plugin directory and files
chown -R librenms:librenms /opt/librenms/html/plugins/Speedtest
chmod -R --reference=/opt/librenms/html/plugins /opt/librenms/html/plugins/Speedtest
chmod +x /opt/librenms/html/plugins/Speedtest/librenms-speedtest.sh
# Accept the speedtest EULA and GDPR notice (if applicable) and run an initial speedtest
su -c 'speedtest --accept-license --accept-gdpr' librenms
# Create the RRD files
su -c 'bash /opt/librenms/html/plugins/Speedtest/librenms-speedtest.sh create' librenms
# Test and run the speedtest script
su -c 'bash /opt/librenms/html/plugins/Speedtest/librenms-speedtest.sh run' librenms
# Output the speedtest results into PNG files
su -c 'bash /opt/librenms/html/plugins/Speedtest/librenms-speedtest.sh graph' librenms

View File

@ -34,7 +34,7 @@ SpeedtestResultDir=$SpeedtestPluginDir/tmp
DATE=$(/bin/date +%s)
# Generate speedtest results, store them in a temp file
speedtest --accept-license --accept-gdpr -p no > $SpeedtestResultDir/speedtest-results 2>/dev/null
speedtest -p no > $SpeedtestResultDir/speedtest-results 2>/dev/null
# Get the Latency
Latency=$(cat $SpeedtestResultDir/speedtest-results | grep Latency | sed 's/.*Latency:\s*\([0-9]*.[0-9]*\).*/\1/')
@ -55,7 +55,6 @@ SpeedtestResultDir=$SpeedtestPluginDir/tmp
(graph)
# Create the Latency PNG of the last day
rrdtool graph $PNGImagesDir/speedtest-latency-day.png -J -a PNG --start "-1day" \
--title="Last Day" \
--vertical-label "ms" \
DEF:P=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:AVERAGE \
DEF:PMIN=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:MIN \
@ -74,13 +73,12 @@ SpeedtestResultDir=$SpeedtestPluginDir/tmp
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000000 \
-c FONT#bdbfbfff \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Create the Latency PNG of the last week
rrdtool graph $PNGImagesDir/speedtest-latency-week.png -J -a PNG --start "-1week" \
--title="Last Week" \
--vertical-label "ms" \
DEF:P=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:AVERAGE \
DEF:PMIN=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:MIN \
@ -99,13 +97,12 @@ SpeedtestResultDir=$SpeedtestPluginDir/tmp
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000000 \
-c FONT#bdbfbfff \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Create the Latency PNG of the last month
rrdtool graph $PNGImagesDir/speedtest-latency-month.png -J -a PNG --start "-1month" \
--title="Last Month" \
--vertical-label "ms" \
DEF:P=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:AVERAGE \
DEF:PMIN=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:MIN \
@ -124,13 +121,12 @@ SpeedtestResultDir=$SpeedtestPluginDir/tmp
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000000 \
-c FONT#bdbfbfff \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Create the Latency PNG of the last year
rrdtool graph $PNGImagesDir/speedtest-latency-year.png -J -a PNG --start "-1year" \
--title="Last Year" \
--vertical-label "ms" \
DEF:P=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:AVERAGE \
DEF:PMIN=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:MIN \
@ -149,13 +145,12 @@ SpeedtestResultDir=$SpeedtestPluginDir/tmp
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000000 \
-c FONT#bdbfbfff \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Create the Bandwidth PNG of the last day
rrdtool graph $PNGImagesDir/speedtest-bandwidth-day.png -J -a PNG --start "-1day" \
--title="Last Day" \
--vertical-label "Mbit/s" \
DEF:D=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:AVERAGE \
DEF:DMIN=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:MIN \
@ -188,13 +183,12 @@ SpeedtestResultDir=$SpeedtestPluginDir/tmp
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000000 \
-c FONT#bdbfbfff \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Create the Bandwidth PNG of the last week
rrdtool graph $PNGImagesDir/speedtest-bandwidth-week.png -J -a PNG --start "-1week" \
--title="Last Week" \
--vertical-label "Mbit/s" \
DEF:D=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:AVERAGE \
DEF:DMIN=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:MIN \
@ -227,13 +221,12 @@ SpeedtestResultDir=$SpeedtestPluginDir/tmp
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000000 \
-c FONT#bdbfbfff \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Create the Bandwidth PNG of the last month
rrdtool graph $PNGImagesDir/speedtest-bandwidth-month.png -J -a PNG --start "-1month" \
--title="Last Month" \
--vertical-label "Mbit/s" \
DEF:D=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:AVERAGE \
DEF:DMIN=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:MIN \
@ -266,13 +259,12 @@ SpeedtestResultDir=$SpeedtestPluginDir/tmp
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000000 \
-c FONT#bdbfbfff \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Create the Bandwidth PNG of the last year
rrdtool graph $PNGImagesDir/speedtest-bandwidth-year.png -J -a PNG --start "-1year" \
--title="Last Year" \
--vertical-label "Mbit/s" \
DEF:D=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:AVERAGE \
DEF:DMIN=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:MIN \
@ -305,7 +297,255 @@ SpeedtestResultDir=$SpeedtestPluginDir/tmp
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000000 \
-c FONT#bdbfbfff \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Create the Latency PNG of the last day
rrdtool graph $PNGImagesDir/speedtest-latency-light-day.png -J -a PNG --start "-1day" \
--vertical-label "ms" \
DEF:P=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:AVERAGE \
DEF:PMIN=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:MIN \
DEF:PMAX=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:MAX \
VDEF:Pavg=P,AVERAGE \
LINE1:Pavg#cc3300:"Avg \n" \
LINE2:P#3d61ab:"Last latency (ms)\n" \
GPRINT:Pavg:"Avg latency %2.1lf ms\n" \
-h 500 -w 1000 -y1:2 \
-c BACK#EEEEEE00 \
-c SHADEA#EEEEEE00 \
-c SHADEB#EEEEEE00 \
-c CANVAS#FFFFFF00 \
-c GRID#a5a5a5 \
-c MGRID#FF9999 \
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000 \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Create the Latency PNG of the last week
rrdtool graph $PNGImagesDir/speedtest-latency-light-week.png -J -a PNG --start "-1week" \
--vertical-label "ms" \
DEF:P=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:AVERAGE \
DEF:PMIN=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:MIN \
DEF:PMAX=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:MAX \
VDEF:Pavg=P,AVERAGE \
LINE1:Pavg#cc3300:"Avg \n" \
LINE2:P#3d61ab:"Last latency (ms)\n" \
GPRINT:Pavg:"Avg latency %2.1lf ms\n" \
-h 500 -w 1000 -y1:2 \
-c BACK#EEEEEE00 \
-c SHADEA#EEEEEE00 \
-c SHADEB#EEEEEE00 \
-c CANVAS#FFFFFF00 \
-c GRID#a5a5a5 \
-c MGRID#FF9999 \
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000 \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Create the Latency PNG of the last month
rrdtool graph $PNGImagesDir/speedtest-latency-light-month.png -J -a PNG --start "-1month" \
--vertical-label "ms" \
DEF:P=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:AVERAGE \
DEF:PMIN=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:MIN \
DEF:PMAX=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:MAX \
VDEF:Pavg=P,AVERAGE \
LINE1:Pavg#cc3300:"Avg \n" \
LINE2:P#3d61ab:"Last latency (ms)\n" \
GPRINT:Pavg:"Avg latency %2.1lf ms\n" \
-h 500 -w 1000 -y1:2 \
-c BACK#EEEEEE00 \
-c SHADEA#EEEEEE00 \
-c SHADEB#EEEEEE00 \
-c CANVAS#FFFFFF00 \
-c GRID#a5a5a5 \
-c MGRID#FF9999 \
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000 \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Create the Latency PNG of the last year
rrdtool graph $PNGImagesDir/speedtest-latency-light-year.png -J -a PNG --start "-1year" \
--vertical-label "ms" \
DEF:P=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:AVERAGE \
DEF:PMIN=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:MIN \
DEF:PMAX=$RRDGraphsDir/speedtest-latency.rrd:LATENCY:MAX \
VDEF:Pavg=P,AVERAGE \
LINE1:Pavg#cc3300:"Avg \n" \
LINE2:P#3d61ab:"Last latency (ms)\n" \
GPRINT:Pavg:"Avg latency %2.1lf ms\n" \
-h 500 -w 1000 -y1:2 \
-c BACK#EEEEEE00 \
-c SHADEA#EEEEEE00 \
-c SHADEB#EEEEEE00 \
-c CANVAS#FFFFFF00 \
-c GRID#a5a5a5 \
-c MGRID#FF9999 \
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000 \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Create the Bandwidth PNG of the last day
rrdtool graph $PNGImagesDir/speedtest-bandwidth-light-day.png -J -a PNG --start "-1day" \
--vertical-label "Mbit/s" \
DEF:D=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:AVERAGE \
DEF:DMIN=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:MIN \
DEF:DMAX=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:MAX \
DEF:U=$RRDGraphsDir/speedtest-bandwidth.rrd:UP:AVERAGE \
DEF:UMIN=$RRDGraphsDir/speedtest-bandwidth.rrd:UP:MIN \
DEF:UMAX=$RRDGraphsDir/speedtest-bandwidth.rrd:UP:MAX \
CDEF:Y0=U,0,* \
CDEF:NegU=U,-1,* \
VDEF:Yavg=Y0,AVERAGE \
VDEF:Davg=D,AVERAGE \
VDEF:Uavg=NegU,AVERAGE \
VDEF:Uavg2=U,AVERAGE \
AREA:D#61ab3d:"Download" \
AREA:NegU#3d61ab:"Upload" \
LINE1:Uavg#cc1100: \
LINE1:Davg#cc3300:"Avg\n" \
LINE1:Yavg#111111: \
GPRINT:D:LAST:"Last download bandwidth\: %2.1lf Mb/s\n" \
GPRINT:U:LAST:"Last upload bandwidth\: %2.1lf Mb/s\n" \
GPRINT:Davg:"Avg download bandwidth %2.1lf Mb/s\n" \
GPRINT:Uavg2:"Avg upload bandwidth %2.1lf Mb/s" \
-h 500 -w 1000 \
-c BACK#EEEEEE00 \
-c SHADEA#EEEEEE00 \
-c SHADEB#EEEEEE00 \
-c CANVAS#FFFFFF00 \
-c GRID#a5a5a5 \
-c MGRID#FF9999 \
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000 \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Create the Bandwidth PNG of the last week
rrdtool graph $PNGImagesDir/speedtest-bandwidth-light-week.png -J -a PNG --start "-1week" \
--vertical-label "Mbit/s" \
DEF:D=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:AVERAGE \
DEF:DMIN=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:MIN \
DEF:DMAX=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:MAX \
DEF:U=$RRDGraphsDir/speedtest-bandwidth.rrd:UP:AVERAGE \
DEF:UMIN=$RRDGraphsDir/speedtest-bandwidth.rrd:UP:MIN \
DEF:UMAX=$RRDGraphsDir/speedtest-bandwidth.rrd:UP:MAX \
CDEF:Y0=U,0,* \
CDEF:NegU=U,-1,* \
VDEF:Yavg=Y0,AVERAGE \
VDEF:Davg=D,AVERAGE \
VDEF:Uavg=NegU,AVERAGE \
VDEF:Uavg2=U,AVERAGE \
AREA:D#61ab3d:"Download" \
AREA:NegU#3d61ab:"Upload" \
LINE1:Uavg#cc1100: \
LINE1:Davg#cc3300:"Avg\n" \
LINE1:Yavg#111111: \
GPRINT:D:LAST:"Last download bandwidth\: %2.1lf Mb/s\n" \
GPRINT:U:LAST:"Last upload bandwidth\: %2.1lf Mb/s\n" \
GPRINT:Davg:"Avg download bandwidth %2.1lf Mb/s\n" \
GPRINT:Uavg2:"Avg upload bandwidth %2.1lf Mb/s" \
-h 500 -w 1000 \
-c BACK#EEEEEE00 \
-c SHADEA#EEEEEE00 \
-c SHADEB#EEEEEE00 \
-c CANVAS#FFFFFF00 \
-c GRID#a5a5a5 \
-c MGRID#FF9999 \
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000 \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Create the Bandwidth PNG of the last month
rrdtool graph $PNGImagesDir/speedtest-bandwidth-light-month.png -J -a PNG --start "-1month" \
--vertical-label "Mbit/s" \
DEF:D=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:AVERAGE \
DEF:DMIN=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:MIN \
DEF:DMAX=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:MAX \
DEF:U=$RRDGraphsDir/speedtest-bandwidth.rrd:UP:AVERAGE \
DEF:UMIN=$RRDGraphsDir/speedtest-bandwidth.rrd:UP:MIN \
DEF:UMAX=$RRDGraphsDir/speedtest-bandwidth.rrd:UP:MAX \
CDEF:Y0=U,0,* \
CDEF:NegU=U,-1,* \
VDEF:Yavg=Y0,AVERAGE \
VDEF:Davg=D,AVERAGE \
VDEF:Uavg=NegU,AVERAGE \
VDEF:Uavg2=U,AVERAGE \
AREA:D#61ab3d:"Download" \
AREA:NegU#3d61ab:"Upload" \
LINE1:Uavg#cc1100: \
LINE1:Davg#cc3300:"Avg\n" \
LINE1:Yavg#111111: \
GPRINT:D:LAST:"Last download bandwidth\: %2.1lf Mb/s\n" \
GPRINT:U:LAST:"Last upload bandwidth\: %2.1lf Mb/s\n" \
GPRINT:Davg:"Avg download bandwidth %2.1lf Mb/s\n" \
GPRINT:Uavg2:"Avg upload bandwidth %2.1lf Mb/s" \
-h 500 -w 1000 \
-c BACK#EEEEEE00 \
-c SHADEA#EEEEEE00 \
-c SHADEB#EEEEEE00 \
-c CANVAS#FFFFFF00 \
-c GRID#a5a5a5 \
-c MGRID#FF9999 \
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000 \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
# Create the Bandwidth PNG of the last year
rrdtool graph $PNGImagesDir/speedtest-bandwidth-light-year.png -J -a PNG --start "-1year" \
--vertical-label "Mbit/s" \
DEF:D=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:AVERAGE \
DEF:DMIN=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:MIN \
DEF:DMAX=$RRDGraphsDir/speedtest-bandwidth.rrd:DOWN:MAX \
DEF:U=$RRDGraphsDir/speedtest-bandwidth.rrd:UP:AVERAGE \
DEF:UMIN=$RRDGraphsDir/speedtest-bandwidth.rrd:UP:MIN \
DEF:UMAX=$RRDGraphsDir/speedtest-bandwidth.rrd:UP:MAX \
CDEF:Y0=U,0,* \
CDEF:NegU=U,-1,* \
VDEF:Yavg=Y0,AVERAGE \
VDEF:Davg=D,AVERAGE \
VDEF:Uavg=NegU,AVERAGE \
VDEF:Uavg2=U,AVERAGE \
AREA:D#61ab3d:"Download" \
AREA:NegU#3d61ab:"Upload" \
LINE1:Uavg#cc1100: \
LINE1:Davg#cc3300:"Avg\n" \
LINE1:Yavg#111111: \
GPRINT:D:LAST:"Last download bandwidth\: %2.1lf Mb/s\n" \
GPRINT:U:LAST:"Last upload bandwidth\: %2.1lf Mb/s\n" \
GPRINT:Davg:"Avg download bandwidth %2.1lf Mb/s\n" \
GPRINT:Uavg2:"Avg upload bandwidth %2.1lf Mb/s" \
-h 500 -w 1000 \
-c BACK#EEEEEE00 \
-c SHADEA#EEEEEE00 \
-c SHADEB#EEEEEE00 \
-c CANVAS#FFFFFF00 \
-c GRID#a5a5a5 \
-c MGRID#FF9999 \
-c FRAME#5e5e5e \
-c ARROW#5e5e5e \
-R normal \
-c FONT#000 \
--font LEGEND:8:DejaVuSansMono \
--font AXIS:7:DejaVuSansMono > /dev/null 2>&1
;;