Script to change traffic shaping

Guys!

Please go easy on me. I know a huge amount about wireless networking and TCP/IP, but my knowledge of the dark art of scripting is lacking.

Basically, what I want to do is to give certain clients more bandwidth after hours.

Basically, I’ve got the following commands that I enter:

/ queue simple
add name=“main” target-addresses=192.168.x.y/32 max-limit=128000/512000
add name=“http” parent=main packet-marks=http max-limit=128000/500000 priority=1
add name=“p2p” parent=main packet-marks=p2p max-limit=6400/64000 priority=8
add name=“other” parent=main packet-marks=other max-limit=32000/64000 priority=4

What I’d like to do is to change the max-limit at certain times of the day or night.
For example, I’d like to throttle him down to 128K for 20 minutes on a Monday morning when everyone’s checking their email and bank balances and then give him 2Mb from 11:00pm to 6:00am

How would I go about doing this?

Thanks

A good starting point is to simply enter the commands you’d like to run into a script (the exact same commands that you would run manually if it wasn’t a script), and use “/system scheduler” to execute the script at certain times. When making the scheduled task, set the start-date to the current date, the start-time to the time you’d like to run the script to be executed automatically (e.g., 18:00) and the delay to 24h so that the script runs every day at 6pm.

Hope that helps.

I’ve been heading in that direction and come up with this for a start:

/queue simple edit NameOfQueue max-limit=64000/128000

It doesn’t work.

I’m not sure how to pass the numbers on.

A whole day of research and struggling has brought these two lines of code forth:

/queue simple
set QueueName max-limit=64000/128000

That gives the queue 64/128K and the numbers can then be changed as I need them.

I’ve added a scheduled task to call one script at 7:25am and another script at 5:25pm.

That should solve the problem. We’ll see :slight_smile:

You don’t use the queue name to refer to it, you use the unique queue identifier. If you need to determine the identifier first, you’ll have to programatically do so. Also, ‘edit’ as an action opens up a text editor for a person to set a property with. You want to use the ‘set’ option.

/queue simple set [/queue simple find name=NameOfQueue] max-limit=64000/128000;

This is necessary because the name of something is not necessarily always unique (address-lists, for example, have multiple entries), or the unique identifier for an item is not always a name. It’s better to abstract that away and always use a unique identifier that has nothing to do with real the properties of an entry.

If you post the output of

/queue simple print detail

and are more specific in what you want to do, I can give more specific examples.

http://wiki.mikrotik.com/wiki/Scripting is also a good starting point if you haven’t read it yet.

Thanks fewi,

I’ve now got it sorted.