10

Sep

Monitoring Machine with Mikrotik

Written by nofee   
 

Monitoring

Picture from Administrator.org

 

Mikrotik has a tool to monitoring another machine and when the machine is down or up, we can running script. This tool is netwatch.

Netwatch monitors state of hosts on the network. It does so by sending ICMP pings to the list of specified IP addresses. For each entry in netwatch table you can specify IP address, ping interval and console scripts.

The main advantage of netwatch is it's ability to issue arbitrary console commands on host state changes. If we want use this tool, we must install the advanced-tools.

Example :

I had external proxy server, ip address is 192.168.100.2

In firewall nat I make this rule :

/ip firewall nat add chain=dstnat scr-address=!192.168.100.2 protocol=tcp dst-port=80 action=dst-nat to-addresses=192.168.100.2 comment="RedirectToProxy"

 

First make script on system script :

For Proxy is down :

/system script add name=ProxyDown source={:log info "Proxy DOWN"; /ip firewall nat set [find comment="RedirectToProxy"] disabled=yes}

For Proxy is up :

/system script add name=ProxyUp source={:log info "Proxy UP"; /ip firewall nat set [find comment="RedirectToProxy"] disabled=no}

 

Then we must set on tool netwatch :

/tool netwatch add host=192.168.100.2 interval=10m up-script=ProxyUp down-script=ProxyDown

 

It's done.

Now every 10 minutes, mikrotik will check proxy server status, if status is down, then mikrotik will run script ProxyDown and when the proxy server is up again, mikrotik will run script ProxyUp.

You can use this tool for another reason, like swicthing gateway or anything else.

 

Trackback(0)
Comments (0)Add Comment

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

security code
Write the displayed characters


busy
PerformancingAds

More Sites

AdBlaze (272)
AdBux (315)
Chitika (330)
Crosslink Builder (371)
LinkWorth (351)
Make Money (69)
PayPal (368)

Statistics

Members 4
Content 39
Web Links 24
Content View Hits 34.129

Best Link

Copyright © 2009 MustNoFee
This blog is 362 days since Jan, 12 2008