Watch Netwatch Script

I would like a script that goes through all my netwatch rules every 15 minutes and emails my pager a list of any netwatch IP’s that are down. Anyone know how to do that?

The way it is now is I only get paged once when an IP goes down. This way it could keep reminding me tell its fixed.

Matt

here is the script that send one e-mail whenever it find a ‘down’ rule under netwatch submenu:

:local stat
:foreach in in [/tool netw find] do={
:set stat [/tool netwatch get $i status]
:if ($stat=“down”) do={
/tool e-mail send to test@test.com body=[/tool netwatch get $i host]
}

}

You should put into the system scheduler to run each 15min.

You can also optimize it by putting all those unreachable host into one file (some latest RouterOS versions allows to append the existing file) and send this file then as an attachment via e-mail.

Hope that it helps!
Edgars

/tool netwatch get 1 host

This does not appear to return the host for some odd reason. Does it on your box?

Matt

sorry,my mistake - the correct line is

:foreach i in [/tool netw find] do={

}

Edgars

This is what I have so far and it works well.

:local stat
:foreach i in [/tool netw find] do={
:set stat [/tool netwatch get $i status]
:if ($stat=“down”) do={
/tool e-mail send to mypager@mydomain.com server=“12.12.12.12” from=“info@mydomain.com” subject=“Netwatch Down IP” body=[/tool netwatch get $i host]}}

What I would like is that instead of an email for each IP down it sent one email with all the IP’s in body that our down. Is there an easy way to do that?

Matt

via one e-mail letter - no.

Edgars