Tag Archives: script

Mikrotik Script: Alert on queue tree limit exceeded

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:

: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 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)

The Mother of all QoS Trees – v6.0

Contained in this post is a free copy of my 2013 QoS tree (compatible with v6.0) for anyone to do what they want with, I only ask that if you republish this you include a link to this post.

It is intended to work on a per-interface basis; with you specifying the WAN interface and the speed limit it is to have. You can then use simple-queues for your internal users for a full double-qos solution.

Continue reading The Mother of all QoS Trees – v6.0

Gmail + Google Drive + MikroTik scripting = Automated Backups Folder

I was recently looking for a simpler alternative to something like RANCID to periodically backup all our MikroTik configs.

RANCID is great and all, but I didn’t really need the diff copies of each file, and I was plenty happy just knowing that I have a .backup and .rsc file for each router I manage.

Given I use Gmail it might have been ok just to have each router send them there and leave it at that, but I’m not really the sort of person to half-ass my afterhours projects.. I learnt from Greg that you have to just whole-ass them 🙂

Continue reading Gmail + Google Drive + MikroTik scripting = Automated Backups Folder

Check utilisation of RouterOS IP Pools

I was looking for a way to do a quick summary of the utilisation of my DHCP/PPP pools and stumbled across a helpful little script.

This was originally found on the MikroTik forums and posted back in 2010 written by dssmiktik, and surprisingly enough it works perfectly on even v6.0 with no changes required.

Continue reading Check utilisation of RouterOS IP Pools

Script Fu – Changing RADIUS server source address

Just a quick post to show an example of day to day usage of RouterOS scripting.

Goal: We had to change the src-address for a bunch of radius-server listings across 40 MikroTik devices, to match a new pptp-tunnel address. What would’ve been a pain was that the address is different on each device.

Solution: Create a scriptlet to pull the IP into the update (set) routine, ensuring it is formatted correctly for use.

Continue reading Script Fu – Changing RADIUS server source address