Community discussions

MikroTik App
 
bronco1980
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 63
Joined: Wed Jul 22, 2009 5:02 pm

Script doesn't work after an upgrade to v4

Fri Jan 18, 2013 8:09 pm

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
}
}
}
 
samsung172
Forum Guru
Forum Guru
Posts: 1193
Joined: Sat Apr 04, 2009 3:45 am
Location: Østfold - Norway
Contact:

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

Fri Jan 18, 2013 10:32 pm

Syntax change between releases, also within main releases. ITs a pain.
 
User avatar
skot
Long time Member
Long time Member
Posts: 584
Joined: Wed Nov 30, 2011 3:05 am

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

Sat Jan 19, 2013 1:18 am

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
		}
	}
}
 
bronco1980
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 63
Joined: Wed Jul 22, 2009 5:02 pm

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

Wed Jan 30, 2013 11:30 am

IT WORKS!!

thanks A LOT :)
 
User avatar
skot
Long time Member
Long time Member
Posts: 584
Joined: Wed Nov 30, 2011 3:05 am

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

Wed Jan 30, 2013 7:21 pm

yw :)
 
bronco1980
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 63
Joined: Wed Jul 22, 2009 5:02 pm

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

Mon Apr 15, 2013 4:44 pm

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
 
User avatar
skot
Long time Member
Long time Member
Posts: 584
Joined: Wed Nov 30, 2011 3:05 am

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

Mon Apr 15, 2013 7:08 pm

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.