Skip to content

Instantly share code, notes, and snippets.

@DennisTT
Created March 14, 2016 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DennisTT/7622fc5ad8b4c1002776 to your computer and use it in GitHub Desktop.
Save DennisTT/7622fc5ad8b4c1002776 to your computer and use it in GitHub Desktop.
Speed test client, Munin pulling data
git clone git://github.com/sivel/speedtest-cli.git speedtest-cli
*/15 * * * * /root/speedtest-cli/speedtest_cli.py --simple > /volume1/web/speedtest/speedtest.out; mv /volume1/web/speedtest/speedtest.out /volume1/web/speedtest/speedtest.txt; chmod 644 /volume1/web/speedtest/speedtest.txt
#!/bin/bash
case $1 in
config)
# echo "host_name yourhost.com" # if you want the speedtest data reported to a custom host, uncomment and edit
echo "graph_category network"
echo "graph_title Speedtest"
echo "graph_args --base 1000 -l 0"
echo "graph_vlabel DL / UL (Mbps)"
echo "graph_scale no"
echo "down.label DL"
echo "down.type GAUGE"
echo "down.draw LINE1"
echo "up.label UL"
echo "up.type GAUGE"
echo "up.draw LINE1"
echo "graph_info Graph of Internet Connection Speed"
exit 0;;
esac
OUTPUT=`curl -s http://www.example.com/speedtest/speedtest.txt` # Point this URL to the .txt file created in the cronjob
if [ $? -ne 0 ]; then
echo "curl exited with $?"
exit -1
fi
DOWNLOAD=`echo "$OUTPUT" | grep Download | sed 's/[a-zA-Z:]* \([0-9]*\.[0-9]*\) [a-zA-Z/]*/\1/'`
UPLOAD=`echo "$OUTPUT" | grep Upload | sed 's/[a-zA-Z:]* \([0-9]*\.[0-9]*\) [a-zA-Z/]*/\1/'`
echo "down.value $DOWNLOAD"
echo "up.value $UPLOAD"
#!/bin/bash
case $1 in
config)
# echo "host_name yourhost.com" # if you want the speedtest data reported to a custom host, uncomment and edit
echo "graph_category network"
echo "graph_title Speedtest Ping"
echo "graph_args --base 1000 -l 0"
echo "graph_vlabel Ping (ms)"
echo "graph_scale no"
echo "ping.label Ping"
echo "ping.type GAUGE"
echo "ping.draw LINE1"
echo "graph_info Graph of Internet Connection Ping"
exit 0;;
esac
OUTPUT=`curl -s http://www.example.com/speedtest/speedtest.txt` # Point this URL to the .txt file created in the cronjob
PING=`echo "$OUTPUT" | grep Ping | sed 's/[a-zA-Z:]* \([0-9]*\.[0-9]*\) [a-zA-Z/]*/\1/'`
echo "ping.value $PING"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment