{"id":819,"date":"2009-10-12T19:09:34","date_gmt":"2009-10-13T01:09:34","guid":{"rendered":"http:\/\/gregsowell.com\/?p=819"},"modified":"2010-03-17T10:09:57","modified_gmt":"2010-03-17T16:09:57","slug":"mikrotik-netwatch-%e2%80%93-kick-off-a-script-or-email-when-a-host-goes-down","status":"publish","type":"post","link":"https:\/\/gregsowell.com\/?p=819","title":{"rendered":"Mikrotik Netwatch \u2013 Kick off a script or email when a host goes down"},"content":{"rendered":"<p>This post was born out of a question, so see, I do listen\u2026sometimes. hehe<br \/>\nThe 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.<\/p>\n<p>Tools -> Netwatch<\/p>\n<p>An example script you can run is one that will email you.<\/p>\n<p>tool e-mail send from=greg@mydomain.com server=1.1.1.1 to=Greg@mydomain.com subject=This guy just bit the dust<\/p>\n<p>Here\u2019s the code for an up\/down email:<\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">\/tool netwatch\r\nadd comment=&quot;&quot; disabled=no down-script=&quot;tool e-mail send from=greg@mydomain.co\\\r\n    m server=1.1.1.1 to=Greg@mydomain.com subject=\\&quot;This guy just went down\\&quot;&quot; \\\r\n    host=127.0.0.1 interval=1m timeout=1s up-script=&quot;tool e-mail send from=gre\\\r\n    g@mydomain.com server=1.1.1.1 to=Greg@mydomain.com subject=\\&quot;This guy just\\\r\n    \\_came back up\\&quot;&quot;<\/code><\/pre>\n<p>And here\u2019s the winbox version:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2009\/10\/1.JPG\" alt=\"1\" title=\"1\" width=\"471\" height=\"343\" class=\"alignnone size-full wp-image-820\" srcset=\"https:\/\/gregsowell.com\/wp-content\/uploads\/2009\/10\/1.JPG 471w, https:\/\/gregsowell.com\/wp-content\/uploads\/2009\/10\/1-300x218.jpg 300w\" sizes=\"auto, (max-width: 471px) 100vw, 471px\" \/><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2009\/10\/up.png\" alt=\"\" title=\"up\" width=\"331\" height=\"243\" class=\"alignnone size-full wp-image-1638\" srcset=\"https:\/\/gregsowell.com\/wp-content\/uploads\/2009\/10\/up.png 331w, https:\/\/gregsowell.com\/wp-content\/uploads\/2009\/10\/up-300x220.png 300w\" sizes=\"auto, (max-width: 331px) 100vw, 331px\" \/><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2009\/10\/down.png\" alt=\"\" title=\"down\" width=\"330\" height=\"244\" class=\"alignnone size-full wp-image-1639\" srcset=\"https:\/\/gregsowell.com\/wp-content\/uploads\/2009\/10\/down.png 330w, https:\/\/gregsowell.com\/wp-content\/uploads\/2009\/10\/down-300x221.png 300w\" sizes=\"auto, (max-width: 330px) 100vw, 330px\" \/><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2009\/10\/4.JPG\" alt=\"1\" title=\"1\" width=\"471\" height=\"343\" class=\"alignnone size-full wp-image-820\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post was born out of a question, so see, I do listen\u2026sometimes. hehe The question was, can I ping a host and then\u2026<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,17],"tags":[],"class_list":["post-819","post","type-post","status-publish","format-standard","hentry","category-mikrotik","category-mikrotik-tutorials"],"_links":{"self":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/819","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=819"}],"version-history":[{"count":6,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/819\/revisions"}],"predecessor-version":[{"id":825,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/819\/revisions\/825"}],"wp:attachment":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}