Mikrotik Scripting: Queue Tree Limit Exceeded

Today i’ll show you a little script for RouterOS to check if queue tree exceed the limit you set.

For. Example i’ve a queue tree that limit the amount o total traffic(Upload+Download) to 50MBps

I want to know whenever this queue exceed the limit, and i want the system to send me an email.

This is the script:

  1. :global checkrate [/queue tree get total-traffic rate]
  2. :local limit 50000000
  4. :if ( $checkrate < $limit ) do={
  5. :log info ("Queue not Exceeded")
  6. }
  7. :if ( $checkrate > $limit ) do={
  8. :log info ("Queue Exceeded")
  9. /tool e-mail send server=xxx.xxx.xxx.xxx from="me@myself.com" to="me@myself.com" subject=("Queue Limit Exceed") body=("Queue Limit Exceed, Limit is: " . $checkrate)
  10. }


I’ll explain the code:

First i define a variable checkrate that represent the instant rate of the queue tree named total-traffic then i define a limit(this case i’ve used 50Mbps) then i check if rate less than limit do nothing or just log to test the script.

If checkrate greater than limit send an email to myself.

Be sure to specify as email server an IP address and not the name of the server(ex. mail.myself.com)



About Paolo Daniele

Inserisci un commento

Il tuo indirizzo email non sarà pubblicato. Required fields are marked *


È possibile utilizzare questi tag ed attributi XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>