Page 1 of 1

Script doesn't work after an upgrade to v4

Posted: Fri Jan 18, 2013 8:09 pm
by bronco1980
Hi All ..

After the upgrade from version V2.9 to V4 this script is not working anymore!!
Anyone knows how to fix this pls!?



:local traf;
/queue simple
:for i from=1 to= 254 do = {
:if ([/queue simple find target-addresses=("10.10.4." . $i)] != "") do={
:set traf [get [find target-addresses=("10.10.4." . $i)] total-bytes]
:if ($traf <419430400) do = {
set [find target-addresses=("10.10.4." . $i)] max-limit=512000/1024000 limit-at=512000/1024000 burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s
}
}
}

Re: Script doesn't work after an upgrade to v4

Posted: Fri Jan 18, 2013 10:32 pm
by samsung172
Syntax change between releases, also within main releases. ITs a pain.

Re: Script doesn't work after an upgrade to v4

Posted: Sat Jan 19, 2013 1:18 am
by skot
Syntax change between releases, also within main releases. ITs a pain.
Ya, syntax between versions can be fun to sort out...

Looks like there were a couple changes:
  • 1. There cannot be any spaces in do={. The :for loop and the second :if loop both had spaces.
    2. I'm guessing the target-addresses in the queues are something like: 10.10.4.2, 10.10.4.3, etc. Even though it doesn't show in the queue, the /32 subnet mask is implied and when you search for the address, you need to add the /32 subnet mask.
Try this and see if it works.
:local traf;
/queue simple
:for i from=1 to=254 do={
	:if ([/queue simple find target-addresses=("10.10.4." . $i . "/32")] != "") do={
		:set traf [get [find target-addresses=("10.10.4." . $i . "/32")] total-bytes]
		:if ($traf < 419430400) do={
			set [find target-addresses=("10.10.4." . $i . "/32")] max-limit=512000/1024000 limit-at=512000/1024000 burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s
		}
	}
}

Re: Script doesn't work after an upgrade to v4

Posted: Wed Jan 30, 2013 11:30 am
by bronco1980
IT WORKS!!

thanks A LOT :)

Re: Script doesn't work after an upgrade to v4

Posted: Wed Jan 30, 2013 7:21 pm
by skot
yw :)

Re: Script doesn't work after an upgrade to v4

Posted: Mon Apr 15, 2013 4:44 pm
by bronco1980
Hey Guys..
After upgrading to v5.24.. the script that should monitor the amount of bandwidth is not working at all!!



:local traf;
/queue simple
:for i from=1 to=254 do={
:if ([/queue simple find target-addresses=("10.11.1." . $i . "/32")] != "") do={
:set traf [get [find target-addresses=("10.11.1." . $i . "/32")] total-bytes]
:if ($traf > 524288000) do={
set [find target-addresses=("10.11.1." . $i . "/32")] max-limit=128000/144000 limit-at=128000/144000 burst-limit=128000/256000 burst-threshold=128000/128000 burst-time=32s/32s
}
}
}


The ''Total bytes'' in simple queue is always 0!!



need your help here guys!!
Thanks

Re: Script doesn't work after an upgrade to v4

Posted: Mon Apr 15, 2013 7:08 pm
by skot
I have seen a similar problem... Solution that worked for me was this: http://forum.mikrotik.com/viewtopic.php ... 31#p333563

Open one of the simple queues, check Queue Types under the Advanced tab. Then check Total Queue Type under the Total tab. The default-small setting did not work for me, and changing to a different type solved the issue.