As you can see creating a speedtest.cgi script would be easy. I don’t know what’s involved with adding a menu entry.
If users and devs think that this is a good idea, I could write a patch to add a speedtest.cgi page with some assistance (and patience since I’m kinda new to this ) on how to add the entry to the Web GUI menu system as I have no clue there.
Edit: I dug into the menu entry and it turns out I was looking in the wrong places. Actually was able to add the menu entry.
Here’s a demo package if you want to give it a try. It just adds the speedtest.cgi and the menu entry and installs speedtest-cli if it’s not there. It doesn’t include any language localizations or link to doc page which doesn’t exist anyway.
If you want to give it a try, upload the zip to your ipfire and extract it. Then go to the speedtestwebgui directory and run install.sh. The only error check that the install script does is to make sure that it’s only run once since it appends to the end of 20-status.menu and doing that multiple times would probably not be good.
I think adding a menu item for speedtest that just runs the command line command and then prints the same output as would be seen on the command line doesn’t seem to add much value.
More useful would be if a WUI page was created that enabled you to run it to show the result on the screen or to allow you to select the output going to a csv or json file with a choice of how often to run it, and for how long (for ever or just for a certain number of times) would be much more useful. Name and path of file could be user selectable.
There could also be a table to provide the list of servers that speedtest would select from and the option to exclude some of the servers or to only run the test from one server.
Incidentally I would always run the command with --secure applied so that https is used and not http.
I don’t think speedtest-cli is any good. Whenever I’ve used it, it has been unable to get anywhere near the right line speed reading much too low on an 800/80 internet connection. If I used the Ookla app in windows straight before or afterwards, I got a good reading in Windows…
It’s probably also worth noting the outgoing connection information for those who have multiple configured, i.e. interface/connection name & IP address, especially if looking to keep historical data.
Would make it obvious if using fallback / alternate connection.
Initially, the ability to run speedtest-cli from the Web GUI which is pretty much done with the exception of language localizations and documentation.
Then add the ability to run speedtest-cli at intervals and log that data. I’m working on a page in the Time Settings style with settings on top and “run now” on the bottom for this. The data would be the CSV or JSON produced by speedtest-cli with logrotate according to Log Settings value. It would be up to the user to decide/code how to consume the data. For the intervals, I’m limiting them to number of hours factors of 24 as in “how many times do you want to run speedtest-cli today” and plan to use fcron to drive that.
And finally add something to the Web GUI to be able to display some graphs modeled after existing graph.pl or produce some other useful output from the data that can be displayed. I haven’t spent a lot of time thinking about this.
I think that the first phase could be done with the installation of the speedtest-cli addon but I thought about it and am not comfortable with the idea or maybe the precedent of having an addon package modify the Web GUI i.e. IPFire Core. So I’m not going that route.
So that’s my plan for the time being.
Again thanks for the input and ideas. Feedback is welcome.
i think you don´t have to worry about this since a lot of Addons do use the WUI. Spoken from the possibility how to implement software which are only sorted in the additionals or Addons and which are not part of the Core system you can use the DEPS line → git.ipfire.org Git - ipfire-2.x.git/blob - lfs/wio so software needed to get a new feature to run will be installed automatically via Pakfire. Also, the posted LFS is also an Addon (WIO), like Hostapd, Tor and what not else.
But as @nickh mentioned, did you checked the consistence of speedtest-cli ? Or @nickh what measure did you do on your line which brings speedtest-cli to your evalution “don´t think is any good” ?
I compared speedtest-cli with the Ookla speed test in Windows. The Windows version gave very similar speeds to my ISP speeds - 800/80. The Linux version was way down on download. I’ve just tried again and in Linux (Centos 7 equivalent) I am seeing 291/67. The 67 is possibly understandable. The 291 is not. This is all on a wired 1000Mb/s LAN… Ubuntu 24.04 shows 309/72.
I tested librespeed-cli, ookla’s cli speedtest, and speedtest-cli and after multiple tests on two different Ipfire systems gave pretty much the same results on 100Mbit line.
here is the contents of my modified speedtest.cgi with the start button and a back button for anyone that wants it:
#!/usr/bin/perl
###############################################################################
# #
# IPFire.org - A linux based firewall #
# Copyright (C) 2011 IPFire Team <info@ipfire.org> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
###############################################################################
use strict;
# enable only the following on debugging purpose
#use warnings;
#use CGI::Carp 'fatalsToBrowser';
require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
my %color = ();
my %mainsettings = ();
my %speedparams=();
$speedparams{'ACTION'} = '';
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);
&Header::showhttpheaders();
&Header::openpage($Lang::tr{'status information'}, 1, '');
&Header::openbigbox('100%', 'left');
&Header::getcgihash(\%speedparams);
&Header::openbox('100%', 'left',"Speedtest");
print <<END
<table width="100%">
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<tr>
<td align="center"><input type='submit' name='ACTION' value="$Lang::tr{'start'}"></td>
</tr>
</table>
END
;
print '<br><textarea style="width:100%" rows=15 name="text" readonly="readonly">';
if ( $speedparams{'ACTION'} eq "$Lang::tr{'start'}" )
{
# Run speedtest-cli.
if ( -e "/usr/bin/speedtest-cli" ) {
my @speedtest = `speedtest-cli -secure`;
print "@speedtest";
}
else {
my @speedtest = "Error: The speedtest-cli addon is not installed. Use pakfire to install the speedtest-cli addon before running speedtest.";
print "@speedtest";
}
}
print '</textarea>';
print"<table width='100%'><tr><td align='center'><a href='/cgi-bin/speedtest.cgi'><img src='/images/back.png' alt='$Lang::tr{'back'}' title='$Lang::tr{'back'}' /></a></td></tr></table>";
&Header::closebox();
&Header::closebigbox();
&Header::closepage();