Created
March 14, 2016 11:31
-
-
Save DennisTT/7622fc5ad8b4c1002776 to your computer and use it in GitHub Desktop.
Speed test client, Munin pulling data
This file contains 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
git clone git://github.com/sivel/speedtest-cli.git speedtest-cli |
This file contains 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
*/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 |
This file contains 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/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" |
This file contains 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/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