Bandwidth test script

Hello all,

I’m trying to create a script in RouterOS that does a bandwidth test (see below). The purpose of the script is to check if the bandwidth to another mikrotik router gets below a certain threshold (in my example I use 700 Mbps). If it does, the script has to raise an error. The $“tx-current” has to get above 700 Mbps before it can check if it gets below 700 Mbps.

/tool {
	:local a false
    bandwidth-test 10.10.10.1 duration=60s direction=transmit do={
    	:if ($status = "running") do={
    		:if ($a = false) do={
    			:if ($"tx-current" > 700) do={
					:set $a true
            	} 
            } if ($a = true) do={
            	:if ($"tx-current" < 700) do={
            		:error "bandwidth not enough"
            	}
        	}            
        }
    }	
}

I’m not able to get this script to raise the error, because I see the bandwidth drop below 700 all the time.

I’m wondering if this can also be done through the RouterOS PHP API?

700 = 700 bps not 700 Mbps
Try 700M or something around ~700000000

Were you able to get this script to work? I am on V6.41 and trying to read the variables from the bandwidth test and I am unable to. Ones such as $status and $duration.