/system script add name="record" source={
:global tmp
:global tx
:global rx
:foreach i in [/interface find] do={
/interface monitor-traffic $i once do={
:set tx ($sent-bits-per-second/1048576)
:set rx ($received-bits-per-second/1048576)
:if ([/system scheduler get record run-count]=1) do={
:global ttx
:set ttx $tx
:global trx
:set trx $rx
}
:if ($tx>$ttx) do={
/tool e-mail send \
to=example@example.com \
subject="Script message" \
body=("The transmission traffic on " . \
[/interface get $i name] . " got up to " . $tx . "Mbps")
:set ttx $tx
}
:if ($rx>$trx) do={
/tool e-mail send \
to=example@example.com \
subject="Script message" \
body=("The receiving traffic on " . \
[/interface get $i name] . " got up to " . $rx . "Mbps")
:set trx $rx
}
}
}
}
EmoticonEmoticon