Hi guys,
This is my first post here, I’m a Network Engineer who works a lot with Mikrotik devices and Server Administration and you can see more of my posts on my website. I found this blog some time ago and was invited to contribute with some of my own scripts that may help others!
Today i’ll show you a little script for RouterOS to check if queue tree exceed the limit you set.
For. Example I’ve got a queue tree that limits the amount of 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:
12345678910:
global
checkrate [/
queue
tree
get
total-traffic rate]
:
local
limit 50000000
:
if
( $checkrate < $limit )
do
={
:
log
info
(
"Queue not Exceeded"
)
}
:
if
( $checkrate > $limit )
do
={
:
log
info
(
"Queue Exceeded"
)
/
tool
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)
}
Enjoy!