当前位置:首页 > Mikrotik > 正文

ROS断线报警,线路恢复自动解除报警

 

发一个监控脚本,断线报警,线路恢复自动解除报警


经过几天的思索,终于编写出断线报警,线路恢复自动解除报警,并且记录日志的脚本

在/system script里添加脚本
name=你要监控的ip
内容如下
:set i 0
:while ($i=0) do={:beep length=2s frequency=2755;:delay 5;:set a abc;\
:foreach i in=[/tool netwatch find host=你要监控的ip] \
do={:set a [/tool netwatch get $i status]};:put $a;:if($a=up) do={:set i 1}}

然后再在/tool netwatch里添加监控
host=你要监控的ip
在down里填写
/system script run 你要监控的ip
:set shendown1 [/system clock get date]
:set shendown2 [/system clock get time]
:set shendown ("你要监控的ip down " . $shendown1 . " " . $shendown2)
:log warning $shendown

更新时间 2015-07-22