Community discussions

MikroTik App
 
Beelze
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 60
Joined: Tue Mar 04, 2014 12:21 pm

Bandwidth test script

Fri Mar 04, 2016 2:48 pm

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?
 
nikolasc
just joined
Posts: 11
Joined: Wed Jun 04, 2008 10:30 am

Re: Bandwidth test script

Sun Mar 13, 2016 8:35 am

700 = 700 bps not 700 Mbps
Try 700M or something around ~700000000
 
User avatar
vader7071
newbie
Posts: 39
Joined: Tue Jan 07, 2014 9:44 pm

Re: Bandwidth test script

Fri Jan 12, 2018 10:43 pm

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.

Who is online

Users browsing this forum: nglgkvigywempkgciv and 23 guests