Comments on How to use speedtest on a Linux server to check, store and report internet speeds graphically
Following on from a set of problems of poor broadband connectivity I was experiencing I decided that I wanted to monitor the Mbps speed I was getting from my provider on a regular basis. I was seeing especially poor figures when trying to download files in the evening, with much faster speeds achieved very early in the morning.
12 Comment(s)
Comments
Awesome!
Thanks. I noticed I missed 'apt-get install sqlite3' from the start of step 5.
Also this SQL command is probably better than the one I used above as it doesn't rely on the number of servers being queried (which you might want to change over time).
SELECT serverid, strftime("%H:%M", times) || " " || strftime("%d/%m/%Y", times) AS timestamp, sponsor, servername, download FROM bandwidth WHERE serverid = 1234 ORDER BY times LIMIT 24 OFFSET (SELECT COUNT(*) FROM bandwidth WHERE serverid = 1234)-24;
You would need to change both of those '1234' entries to match your serverid selection.
I keep getting the following error in my /var/log/apache2/error.log
[Sat Sep 16 15:27:29.004545 2017] [:error] [pid 22384] [client 192.168.0.176:42448] PHP Parse error: syntax error, unexpected ']', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /var/www/html/bandwidth.php on line 41
Hi Alf, in my file line 41 is $results[] = $row; - Can you say what version of PHP you are using?
Hi Alf,
If you cut/paste from the website, then you will need to remove the extraneous whitespace from line 39 so that EOF; is the only thing on the line. (Darn here-docs)
My line 39 is "$results[] = $row;". I also checked all the EOF and there is no white space after the EOF's. I am also getting an error:
PHP Parse error: syntax error, unexpected ']', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /var/www/html/bandwidth.php on line 39
Same error for me as well ...
[Tue Aug 07 14:38:11.507845 2018] [:error] [pid 11427] [client 127.0.0.1:53862] PHP Parse error: syntax error, unexpected ']', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /var/www/html/bandwidth.php on line 39
Have you found a way to include download and upload speed in a single .PHP?
Thankyou! worked like a charm. Had to modify the command for the new speedtest.net program but that wasn't too hard to do once i worked it out. I had some issues with the database side of things, but after isolating and testing it a few times it was a naming issue/typo in my code. Thanks again, this tutorial really helped me - even if my ISP is less than useless and don't recognize the results but hey. that's a seperate issue.
Tengo ese error me pueden ayudar...
bandwidth.php:19 Uncaught TypeError: Cannot read property 'length' of null
at bandwidth.php:19
for (var i = 0; i < bandwidth_data.length ; i++){
bwlabels.push(bandwidth_data[i].timestamp);
I have the same Problem, tried php5.6 and php7. Is there anyone who could help fixing the problem?
My line 39 is "$results[] = $row;". I also checked all the EOF and there is no white space after the EOF's. I am also getting an error: PHP Parse error: syntax error, unexpected ']', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /var/www/html/bandwidth.php on line 39
Hi all, I'm also having the same error. Using php7. PHP Parse error: syntax error, unexpected ']', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /var/www/html/bw/bandwidth.php on line 39. Has anybody found a fix? Thanks.