-
-
Save DennisTT/f60e0b08373eba2aec66 to your computer and use it in GitHub Desktop.
Speed test client pushing data to munin server
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 * * * * 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 |
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 | |
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" |
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 | |
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" |
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
<?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