Skip to content

Instantly share code, notes, and snippets.

@deveth0
Forked from digitalpardoe/speedtest-cli.sh
Last active November 5, 2021 16:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save deveth0/3dae2c52719e63560152 to your computer and use it in GitHub Desktop.
Save deveth0/3dae2c52719e63560152 to your computer and use it in GitHub Desktop.
git clone git://github.com/sivel/speedtest-cli.git speedtest-cli
0,20,40 * * * * root /usr/local/speedtest-cli/speedtest_cli.py --simple > /tmp/speedtest.out
#!/bin/bash
if [ "$1" = "config" ]; then
echo "graph_category network"
echo "graph_title Speedtest"
echo "graph_args --base 1000 -l 0"
echo "graph_vlabel DL / UL"
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 "ping.label PING"
echo "ping.type GAUGE"
echo "ping.draw LINE1"
echo "graph_info Graph of Internet Connection Speed"
exit 0
fi
OUTPUT=`cat /tmp/speedtest.out`
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/'`
PING=`echo "$OUTPUT" | grep Ping | sed 's/[a-zA-Z:]* \([0-9]*\.[0-9]*\) [a-zA-Z/]*/\1/'`
echo "down.value $DOWNLOAD"
echo "up.value $UPLOAD"
echo "ping.value $PING"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment