Manual:Tools/Traffic Monitor

From MikroTik Wiki
Jump to: navigation, search

Applies to RouterOS: v2.9, v3, v4+


Sub-menu: /tool traffic-monitor
Packages required: advanced-tools

The traffic monitor tool is used to execute console scripts when interface traffic crosses a given threshold. Each item in traffic monitor list consists of its name (which is useful if you want to disable or change properties of this item from another script), some parameters, specifying traffic condition, and the pointer to a script or scheduled event to execute when this condition is met.


Property Description
interface (name; Default: ) Interface to monitor
name (string; Default: ) Name of the traffic monitor item
on-event (string; Default: ) Script source
threshold (integer: 0..4294967295; Default: 1000000) Traffic threshold, in bits per second
traffic (received | transmitted; Default: transmitted) Type of traffic to monitor
  • received - Received packets
  • transmitted - Transmitted packets
trigger (above | always | below; Default: above) Condition on which to execute script
  • above -- The script will be run each time traffic exceeds the threshold
  • below -- Triggers script in the opposite condition, when traffic drops under the threshold
  • always -- Triggers script on both above and below conditions


In this example the traffic monitor enables the interface ether2, if the received traffic exceeds 15kbps on ether1, and disables the interface ether2, if the received traffic falls below 12kbps on ether1.

[admin@MikroTik] > system script
[admin@MikroTik] /system script> add name=eth-down source="/interface disable \
[admin@MikroTik] /system script> add name=eth-up source="/interface enable \

[admin@MikroTik] > tool traffic-monitor
[admin@MikroTik] /tool traffic-monitor> add disabled=no interface=ether1 \
name=turn_on on-event=eth-up threshold=15000 traffic=received trigger=above
[admin@MikroTik] /tool traffic-monitor> add disabled=no interface=ether1 \
name=turn_off on-event=eth-down threshold=12000 traffic=received trigger=below

[admin@MikroTik] /tool traffic-monitor> print 
Flags: X - disabled, I - invalid 
 0   turn_on      ether1          received    above   15000      eth-up        
 1   turn_off     ether1          received    below   12000      eth-down      
[admin@MikroTik] /tool traffic-monitor> 

[ Top | Back to Content ]