Created
September 12, 2020 12:50
-
-
Save janaz/edc26e298e00d8bc172a78eff4bea770 to your computer and use it in GitHub Desktop.
Speedtest script for collectd-exec plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
HOSTNAME="${COLLECTD_HOSTNAME:-localhost}" | |
INTERVAL="${COLLECTD_INTERVAL:-3600}" | |
while true; do | |
result="$(speedtest --csv)" | |
upload="$(echo "$result" | cut -d, -f8)" | |
download="$(echo "$result" | cut -d, -f7)" | |
echo "PUTVAL \"$HOSTNAME/speedtest/upload\" interval=$INTERVAL N:$upload" | |
echo "PUTVAL \"$HOSTNAME/speedtest/download\" interval=$INTERVAL N:$download" | |
sleep "$INTERVAL" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment