話說用 Netwatch 一段時間了 , 但三不五十收到 down-up 的 mail , 應該是掉包造成的。
就看看是否有 retry , 不要掉一包就發mail 給我吧 !
修改後如下 :
/system scheduler add comment=test interval=10s name=test on-event="/system script run test"
/system script add comment=test name=test source="
:local i 0; {:do {:set i (\\$i + 1)} while ((\\$i < 5) && ([/ping 192.168.0.44 interval=1 count=1]=0))};
:if (\\$i=5 && [/tool netwatch get [find comment=\\"TC test\"] disabled]=yes) do={/tool netwatch set [find comment=\"TC test\"] disabled=no}"
/tool netwatch add comment="TC test" disabled=yes down-script="/tool e-mail send to=echochio@XXXcom from=echochio@XXXcom subject=(\\"[TC test 192.168.0.44 down] \" . [/system clock get time] . \"TC test 192.168.0.44 down\") body=\"TC test 192.168.0.44 down\"" host=\
192.168.0.44 interval=10s timeout=100ms up-script="/tool e-mail send to=echochio@XXXcom from=echochio@XXXcom subject=(\\"[TC test 192.168.0.44 up] \" . [/system clock get time] . \"TC test 192.168.0.44 up\") body=\"TC test 192.168.0.44 up\";/tool \
netwatch set [find comment=\"TC test\"] disabled=yes "
好了 ...這樣會retry 了。
參考:
http://forum.mikrotik.com/viewtopic.php?t=46014
--------------------------------------------------
PS : RouterOS 是否可以 check port ? 我需要這功能至少可監控 80 port 監控多台 web 80 port 是否掛掉。
當然能夠取 web 值看看是否正確更好 .....哈哈
http://wiki.mikrotik.com/wiki/Manual:Tools/Fetch
THKAW wrote:
可以參考fetch...(恕刪)
感謝 ....還沒試過應該可以
google 到
/tool fetch url="http://www.example.com/test.html" mode=http
:local checkpage "test.html";
:local found "0";
:foreach i in=[/file find] do={
:local filename [/file get $i name];
if ( $filename = $checkpage) do={ :set found "1"; :log info "found"; }
}
:log info "$found";
if ( $found = "0" ) do={ :log info "Disable rule, service down"; /ip firewall filter disable 0 } else={ :log info "Enable rule, service up"; /ip firewall filter enable 0; }
/file remove $checkpage;
內文搜尋

X