Networking • Automation • Occasional Podcasting
,

Mikrotik Netwatch – Kick off a script or email when a host goes down

This post was born out of a question, so see, I do listen…sometimes. hehe
The question was, can I ping a host and then have the Mikrotik email me when it goes down/up. The answer is yes. If you use a little tool called netwatch.

Tools -> Netwatch

An example script you can run is one that will email you.

tool e-mail send [email protected] server=1.1.1.1 [email protected] subject=This guy just bit the dust

Here’s the code for an up/down email:

/tool netwatch
add comment="" disabled=no down-script="tool e-mail send [email protected]\
    m server=1.1.1.1 [email protected] subject=\"This guy just went down\"" \
    host=127.0.0.1 interval=1m timeout=1s up-script="tool e-mail send from=gre\
    [email protected] server=1.1.1.1 [email protected] subject=\"This guy just\
    \_came back up\""

And here’s the winbox version:

1


1

Comments

2 responses to “Mikrotik Netwatch – Kick off a script or email when a host goes down”

  1. Daniel Martinez Avatar
    Daniel Martinez

    Great! Thanks! your web its so informative about mikrotik!

  2. mojgan Avatar
    mojgan

    really nice…
    thanks and thanks

Leave a Reply

Your email address will not be published. Required fields are marked *