giovedì , Aprile 18 2024
Ultime Notizie
Home / Wireless & Networking / Mikrotik / Mikrotik Scripting: Queue Tree Limit Exceeded

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
  3.  
  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="[email protected]" to="[email protected]" 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)

Enjoy!

 

Info Paolo Daniele

Ingegnere delle Telecomunicazioni, appassionato di informatica fin da piccolo ho trasformato la passione in lavoro. Con il PHP faccio tutto (o quasi...) ma non disprezzo altri linguaggi all'occorrenza. Se vi piace il mio sito, o vi è utile, o vi sto simpatico, offritemi una birra!

Ti potrebbe interessare

Mikrotik Site to Site Wireguard VPN

Ciao Ragazzi, a volte ritornano! Dopo diverso tempo che non posto nulla (per motivi lavorativi!) …

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *