change tmp location

This commit is contained in:
Jack Greyhat 2021-01-21 15:00:13 +01:00
parent 27632fb0ee
commit 5ccf218555
2 changed files with 9 additions and 4 deletions

View File

@ -2,6 +2,7 @@
# LibreNMS Speedtest plugin
RRDGraphsLocation=/opt/librenms-speedtest/rrd
SpeedtestResulstTMP=/opt/librenms-speedtest/tmp
case $1 in (create)
# Create the Ping measurement RRD
@ -26,16 +27,16 @@ RRDGraphsLocation=/opt/librenms-speedtest/rrd
DATE=$(/bin/date +%s)
# Generate speedtest results, store them in a temp file
speedtest-cli --simple --share > /tmp/speedtest.results 2>/dev/null
speedtest-cli --simple --share > $SpeedtestResulstTMP/speedtest.results 2>/dev/null
# Get the Ping time
PingTime=$(cat /tmp/speedtest.results | grep Ping | sed -r 's/\s+//g'| cut -d":" -f2 | cut -d"m" -f1)
PingTime=$(cat $SpeedtestResulstTMP/speedtest.results | grep Ping | sed -r 's/\s+//g'| cut -d":" -f2 | cut -d"m" -f1)
# Get the Download speed
DownloadSpeed=$(cat /tmp/speedtest.results | grep Download | sed -r 's/\s+//g'| cut -d":" -f2 | cut -d"M" -f1)
DownloadSpeed=$(cat $SpeedtestResulstTMP/speedtest.results | grep Download | sed -r 's/\s+//g'| cut -d":" -f2 | cut -d"M" -f1)
# Get the Upload speed
UploadSpeed=$(cat /tmp/speedtest.results | grep Upload | sed -r 's/\s+//g'| cut -d":" -f2 | cut -d"M" -f1)
UploadSpeed=$(cat $SpeedtestResulstTMP/speedtest.results | grep Upload | sed -r 's/\s+//g'| cut -d":" -f2 | cut -d"M" -f1)
# Update the RRD graphs
rrdtool update $RRDGraphsLocation/speedtest_ping.rrd $DATE:$PingTime

4
tmp/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore