modified on 21 lip 2010 at 09:54 ••• 3 947 views

Narzędzia/Monitor Ruchu

Z MikroTik Wiki

Dla RouterOS:
v2.9, v3, v4+

Spis treści

Summary

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.

Properties

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

Example

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 \
ether2"
[admin@MikroTik] /system script> add name=eth-up source="/interface enable \
ether2"

[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 
 #   NAME         INTERFACE       TRAFFIC     TRIGGER THRESHOLD  ON-EVENT      
 0   turn_on      ether1          received    above   15000      eth-up        
 1   turn_off     ether1          received    below   12000      eth-down      
[admin@MikroTik] /tool traffic-monitor> 

[Powrót do menu strony]