Community discussions

MikroTik App
 
chadd
Member
Member
Topic Author
Posts: 348
Joined: Fri Dec 31, 2004 2:40 am

Anyway to export simple que's to an address list?

Thu Apr 14, 2011 10:44 pm

Anyone out there know of a way to export a group of simple ques to an address list? I have an old shaper with a bunch of simple ques running on that I am getting ready to retire and move to PCQ on another RB.

The current shaper has individual simple ques setup for each customer based off of IP address and package speeds. I have about 5 different packages and what I would like to do is be able to create address lists for each individual package. So for example I have 25 simple ques for package 1 and 50 for package 2.

I know this sounds confusing but does anyone know of anyway to do this?

Chadd
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Anyway to export simple que's to an address list?

Thu Apr 14, 2011 10:50 pm

Sure, that's pretty simple. Details, however, depend on what your simple queues actually look like. Any chance of posting an edited export ("/queue simple export") that shows just 2 user entries for each package?
 
chadd
Member
Member
Topic Author
Posts: 348
Joined: Fri Dec 31, 2004 2:40 am

Re: Anyway to export simple que's to an address list?

Fri Apr 15, 2011 4:10 am

Here are a two different ones, I changed the name and target address but other than that this is what they look like


2 name="customer 1" target-addresses=99.99.99.3/32
dst-address=0.0.0.0/0 interface=all parent=Top direction=both
priority=8 queue=default/default limit-at=0/0 max-limit=256000/256000
burst-limit=768000/1500000 burst-threshold=256000/256000
burst-time=15s/15s total-queue=default

3 name="customer 2" target-addresses=99.99.99.2/32 dst-address=0.0.0.0/>
interface=all parent=Top direction=both priority=8
queue=default/default limit-at=0/0 max-limit=512000/512000
burst-limit=1500000/1500000 burst-threshold=512000/512000
burst-time=15s/15s total-queue=default

Thanks,
Chadd
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Anyway to export simple que's to an address list?

Fri Apr 15, 2011 4:49 am

I assume the distinguishing feature is the rate limit.
/queue simple {
:foreach ITEM in=[find] do={
  :local IP [get $ITEM target-address];
  :local name [get $ITEM name];
  :local limit [get $ITEM max-limit];
  /ip firewall adress-list add list="$limit" address="$IP" comment="$name";
}
}
That will create one address list per rate limit, named after the rate limit. Each one will contain all the target addresses of queues that had that max-limit, with a comment taken from the queue's name.

Written free form and untested but it should work. You could also make another variable per iteration that is a word based on an if block that checks the max-limit and uses that word as the name of the address list but I figured I'd keep it simple for starters.
 
chadd
Member
Member
Topic Author
Posts: 348
Joined: Fri Dec 31, 2004 2:40 am

Re: Anyway to export simple que's to an address list?

Fri Apr 15, 2011 10:58 pm

Fewi,

Thanks for the help.

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 117 guests