Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Speedtest script for collectd-exec plugin
#!/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