Scheduled check for loaded interfaces (auto adding queue to some IP or interface)
If you have MikroTik as main router on your network (business and residential clients using the same downlink) and you wont to make QoS for business users.
Simple:
If your downlink is about 2Mbps and you grants business client min 1Mbit.
But on the same MikroTik you have connected residential users.
This script can check out-interface (for $sent-bits-per-second/$received-bits-per-second)
and if sent/received bits > 1Mbps, script can add queue for some interface or IP address(es).
/system script
add name="tl_down" source="/interface monitor-traffic [/interface find name "interface"] once do {
:if ($received-bits-per-second > 1048576) do {
/queue simple add name=(username . "_" . [:pick [/system clock get date] 4 6] . "-" . [:pick [/system clock get date] 0 3] \
. "-" . [:pick [/system clock get date] 7 11] . "-" . [:pick [/system clock get time] 0 9]) limit-at=262144/262144 \
max-limit=262144/262144 target-addresses="ip address" priority=1 comment="Traffic limit for residential users"
}
}"
add name="tl_remove_down" source="/interface monitor-traffic [/interface find name "interface"] once do {
:if ($received-bits-per-second < 1048576) do {
/queue simple remove [/queue simple find comment="Traffic limit for residential users"]
}
}"
/system scheduler
add name="name-unloaded" on-event=tl_remove_down start-date=jan/01/2007 start-time=00:00:00 interval=9m comment="" disabled=no
add name="name-loaded" on-event=tl_down start-date=jan/01/2007 start-time=00:00:00 interval=10m comment="" disabled=no
I hope that this script can help someone.
Best regards,
Mladen Čolić
Network Division
Alfa Support d.o.o.
Zanatski centar 42, Gornji Milanovac, Serbia
tel. +381 32 717 536; fax: +381 32 717 735
mob. +381 64 641 7244
mladen[dot]colic[et]alfa-support[dot]co[dot]yu
www.alfa-support.co.yu