Skip to content

Instantly share code, notes, and snippets.

@DennisTT
Forked from deveth0/speedtest-cli.sh
Last active March 14, 2016 11:06
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/f60e0b08373eba2aec66 to your computer and use it in GitHub Desktop.
Save DennisTT/f60e0b08373eba2aec66 to your computer and use it in GitHub Desktop.
Speed test client pushing data to munin server
git clone git://github.com/sivel/speedtest-cli.git speedtest-cli
*/15 * * * * OUTPUT=`/home/youruser/speedtest-cli/speedtest_cli.py --simple`;curl --data "target=yourusername&password=yourpassword&data=$OUTPUT" https://www.example.com/yourspeedtest/speedtest_upload.php
# replace /home/youruser/speedtest-cli/speedtest_cli.py with location of cloned speedtest-cli Github repository
# replace yourusername and yourpassword with the ones setup in speedtest_upload.php
# replace https://www.example.com/yourspeedtest/speedtest_upload.php with the URL to your own speedtest_upload.php
#!/bin/bash
if [ "$1" = "config" ]; then
# 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
fi
OUTPUT=`cat /var/www/default/speedtest/yourusername.txt` # replace this with where your speedtest_upload.php script is saving the files
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
if [ "$1" = "config" ]; then
# 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
fi
OUTPUT=`cat /var/www/default/speedtest/yourusername.txt` # replace this with where your speedtest_upload.php script is saving the files
PING=`echo "$OUTPUT" | grep Ping | sed 's/[a-zA-Z:]* \([0-9]*\.[0-9]*\) [a-zA-Z/]*/\1/'`
echo "ping.value $PING"
<?php
$passwords['<em>username</em>'] = '<em>password</em>';
if (isset($passwords[$_POST['target']]) && $passwords[$_POST['target']] == $_POST['password'])
{
file_put_contents('./'.$_POST['target'].'.txt', $_POST['data']);
echo "Success";
}
else
{
echo "Failure";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment