Bandwidth test - undocumented switches

I am trying to set up a script to run a bandwidth test but can’t get it to log the output to a file.

The entry in the wiki seems to be out of date as it doesn’t list all the available options.

The following options are listed in the CLI but not in the Wiki

append –
as-value –
do –
file –
once –

‘File’ writes output to a file, but only seems to write the initial screen (with all 0’s), ‘once’ seems to do the same at the CLI, ‘append’ I guess probably appends to the file rather than overwriting it, not sure what ‘do’ or ‘as-value’ do??

Thanks
David

What does the script look like?

never mind the script - at present I just want it to work from the CLI…

This works OK:
[ROS] > /tool bandwidth-test 192.168.42.11 direction=transmit duration=10s protocol=udp
status: done testing
duration: 10s
tx-current: 20.5Mbps
tx-10-second-average: 17.8Mbps
tx-total-average: 17.8Mbps
random-data: no
direction: transmit
tx-size: 1500

but if I send the output to a file:
[ROS] > /tool bandwidth-test 192.168.42.11 direction=transmit duration=10s protocol=udp file=btest
Then I get this:

may/24/2012 9:23: 4 by RouterOS 3.29

software id = 8WAI-BJ5C

status: connecting
duration: 0s
tx-current: 0bps
tx-10-second-average: 0bps
tx-total-average: 0bps
random-data: no
direction: transmit
tx-size: 1500


IE no results…

for my final purpose all I really want is (one of) the final speed figures so I will need to parse the output to print just that figure, but I can do this after I get the result file into my linux box so it doesn’t need to be done on the routerboard…

David

There might be a better way to do this, but here’s what worked for me. It runs the bandwidth test, and near the end of the test, desired variables are saved.

{
# tested on v5.7
:local txc;
:local tx10sa;
:local txta;
:local toggle 0;
/tool bandwidth-test 192.168.42.11 direction=transmit duration=10s protocol=udp do={
	:if (duration >= 10 && toggle = 0) do={
		:set txc (tx-current);
		:set tx10sa (tx-10-second-average);
		:set txta (tx-total-average);
		:set toggle 1;
	}
}
:put "tx-current: $txc";
:put "tx-10-second-average: $tx10sa";
:put "tx-total-average: $txta";
}