Created
July 12, 2015 14:49
-
-
Save johnmlang/598c92059fec0703ab36 to your computer and use it in GitHub Desktop.
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/sh | |
## Munin plugin: speedtest | |
## http://digitalpardoe.co.uk/2013/04/29/monitoring-internet-connection-speed-with-munin | |
## https://github.com/sivel/speedtest-cli | |
## Add to /etc/crontab: | |
# 3,33 * * * * root /usr/local/bin/speedtest-cli --simple > /tmp/speedtest.out | |
OUTPUT=/tmp/speedtest.out | |
case $1 in | |
config) | |
cat <<'EOM' | |
graph_category network | |
graph_title Speedtest | |
graph_args --base 1000 -l 0 | |
graph_vlabel Speed in Mbits/s / Time in ms | |
graph_scale no | |
down.label Download Speed | |
down.type GAUGE | |
down.draw LINE1 | |
up.label Upload Speed | |
up.type GAUGE | |
up.draw LINE1 | |
ping.label Ping Time | |
ping.type GAUGE | |
ping.draw LINE1 | |
graph_info Graph of Internet Connection Speed and Ping Time | |
EOM | |
exit 0;; | |
esac | |
## Plugin Output | |
echo -n "down.value " | |
grep Download ${OUTPUT} | sed 's/[a-zA-Z:]* \([0-9]*\.[0-9]*\) [a-zA-Z/]*/\1/' | |
echo -n "up.value " | |
grep Upload ${OUTPUT} | sed 's/[a-zA-Z:]* \([0-9]*\.[0-9]*\) [a-zA-Z/]*/\1/' | |
echo -n "ping.value " | |
grep Ping ${OUTPUT} | sed 's/[a-zA-Z:]* \([0-9]*\.[0-9]*\) [a-zA-Z/]*/\1/' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment