分类目录归档:RouterOS Script

ROS 6.X 流量过高发送邮件。

直接贴代码:

:do {
:local arx
:local btx 
interface monitor-traffic pppoe-out1 once do={
:set arx $"rx-bits-per-second"
:set btx $"tx-bits-per-second" 
}
:local rxud ($arx  /1000000)
:if ($rxud>50) do={
:local smtp "smtp.qq.cn"
:local smtps [:resolve $smtp]
:local ports "25"
:local Mailings "e-mail@qq.cn"
:local pass "123456"
:local Collection "1432868020@qq.com"
:local Themes "警告!AD100M当前下载流量超过50M/s"
/tool e-mail set address=$smtps port=$ports from=$Mailings user=$Mailings password=$pass
/tool e-mail send to=$Collection from=$Mailings subject=$Themes body=("达到预设流量阀值 50Mbit/s\n当前下载流量 $rxud Mbit/s")
:log warning "下载流量超过设置阀值70Mbit/s 当前下载速率$rxud Mbit/s"
}
}