pnajm
April 19, 2019, 12:33am
1
I’m trying to build a script to DOUBLE some pcq rates on a certain hour of the day.
this is what I tried
/queue type set [find where pcq-rate!=0] pcq-rate=([/get [find where name~"MYPCQ"] value-name=pcq-rate]*2)
/queue type set [find where pcq-rate!=0] pcq-rate=([get [find where kind=pcq] value-name=pcq-rate]*2)
i’m getting this error everytime
invalid internal item number
Please advise on how to do it.
Jotne
April 19, 2019, 6:50am
2
You can create two script and schedule them as start and stop like this
Lower pcq-rate
/queue type set pcq-rate=50 [/queue type find where name=MYPCQ]
Increase pcq-rate
/queue type set pcq-rate=100 [/queue type find where name=MYPCQ]
pnajm
April 19, 2019, 8:59am
3
There is a large number of pcq types and everyone has a different value, i need something to multiply the current value of ALL pcq-rates and multiply it by 2.
Please advise.
Jotne
April 19, 2019, 7:40pm
4
This should do:
:foreach i in=[/queue type find where name~"MYPCQ"] do={
/queue type set pcq-rate=([/queue type get number=$i pcq-rate]*2) numbers=$i }
It will double all pcq-rate for all queues that do contains the text MYPCQ
You can use the same to divide it by later /2
pnajm
April 19, 2019, 7:45pm
5
Awesome! I will try it out.
Thank you so much!
Jotne
April 19, 2019, 7:52pm
6
You are welcome
Did an update of the post above to shorten it more.
Example test for all Queues with letter D
[admin@test-router] > /queue type export
# apr/19/2019 21:33:29 by RouterOS 6.44.2
# software id = xxxx
#
#
#
/queue type
add kind=pcq name=Demo pcq-rate=400
add kind=pcq name=Data pcq-rate=100
[admin@test-router] > [
[... :foreach i in=[/queue type find where name~"D"] do={
[{... /queue type set pcq-rate=([/queue type get number=$i pcq-rate]*2) numbers=$i }
[... ]
[admin@test-router] > /queue type export
# apr/19/2019 21:33:40 by RouterOS 6.44.2
# software id = xxxx
#
#
#
/queue type
add kind=pcq name=Demo pcq-rate=800
add kind=pcq name=Data pcq-rate=200