MikroTik Tutorial 72 - Monitor network links using Netwatch
Ғылым және технология
Learn MikroTik RouterOs Tutorial Series (english)
In this tutorial I will show you how to monitor your network links using netwatch. This feature can be used to monitor your internet or local area connections.
Script:
/tool netwatch
add down-script=":global myVarDownTime
\
:set myVarDownTime \"\$[/system clock get time]\"
\
:log error \"WAN link is down\"" host=8.8.8.8 up-script=":global myVarDo\
wnTime
\
:log error \"WAN link is up again\"
\
/tool e-mail send to=\"YourEmailAddress@gmail.com\" subject=\"\$[/sy\
stem identity get name] WAN Link is up on \$[/system clock get time]. Down\
\_from \$myVarDownTime\""
Mikrotik supported devices
---------------------------------------------
RB951Ui-2nD,hAP
RB3011UIAS-RM
RB2011UiAS-2HnD-IN
RB750Gr2
hEX,RB750Gr3
RB2011iLS-IN
CRS109-8G-1S-2HnD-IN
hAP lite
hAP ac mAP
wAP
RB951Ui-2HnD
RB951G-2HnD
RB2011UiAS-2HnD-IN
RB941-2nD-TC
RB2011iL-RM
RB2011UiAS-IN
RB2011UiAS-RM
RB1100AHx4
CCR1009-7G-1C-PC
CCR1009-7G-1C-1S+PC
LDF 5
SXTsq Lite5
DISC Lite5
SXT Lite2
SXTsq 5 ac
LHG 2
Groove 52
LHG 5
LHG XL 2
LHG HP5
SXT 2
LHG
OmniTIK 5
BaseBox
wAP 60G,SEXTANT G
OmniTIK 5
mANTBox
QRT
DynaDish
Пікірлер: 70
It is Very Useful , Thanks
Big up yourself sir, keep the videos coming.
@TKSJa
6 жыл бұрын
You are welcome
You are wonderful!
very helpful, it is posibble if netwatch give notification on email by hourly while the host target still down ? , its kind like reminder , thanks
nice video what i want to know is there any option we can create Nwatch Monitoring for specific interface as i have 3 Wan in my case ...Wan1 wan2 and wan3 i want if only wan 1 goes down then generate a log error or when its up then generate email is it possible ?
very helful thank u so much
His videos worth a subscribe .. Thumbs up!
@TKSJa
3 жыл бұрын
Thanks!
Thank very much for the video. This was really useful. I added a global variable in "Down" script to store the time when the link goes down and reused it in "Up" script for e-mail notification.
@TKSJa
6 жыл бұрын
Cool, could you share your script?
@AliMirjamali
6 жыл бұрын
Sure. Here the script I used: /tool netwatch add down-script=":global myVarDownTime \ :set myVarDownTime \"\$[/system clock get time]\" \ :log error \"WAN link is down\"" host=8.8.8.8 up-script=":global myVarDo\ wnTime \ :log error \"WAN link is up again\" \ /tool e-mail send to=\"ali.mirjamali@gmail.com\" subject=\"\$[/system id\ entity get name] WAN Link is up on \$[/system clock get time]. Down from \ \$myVarDownTime\""
@TKSJa
6 жыл бұрын
Thank for sharing. It works like a charm.
@DuskoMandic
2 жыл бұрын
@@TKSJa doesn’t work anymore. They have changed permissions for Netwatch and now it can not set global variables or read them. Need to set scripts in system/scripts, have them with “Don’t require permissions” enabled and call them from Netwatch
@Stephen_M02
Жыл бұрын
@@DuskoMandic Thanks so much for posting this - I was able to use this to implement an ISP downtime monitor, and really wanted it to be able to email me with the timestamp that it went down at, when it came back up.
I have two WAN link from different ISP. So I have configured it PCC load balance with fail over. When my primary link getting down I want to get notification for this particular link. In this vedio you have configured to it using a single WAN link. How could i do this?
I was looking for this Netwatch.. Tks à lot
@TKSJa
6 жыл бұрын
You are welcome
@breakena
6 жыл бұрын
TKSJa can i get a email address for you
hello friend I followed your guide to monitor the ADSL connection and an NSM5 antenna connected in the network that I use as AP, Mikrotik logs is seen when the connection is missing or when I remove the M5 but I receive no email (email setting OK tested) can you tell me where I'm wrong? I have pravo to write on Netwatch what you wrote but it does not go, I tried to load the script you put in the description for the terminal charging as incorrect, you can help me Thanks
How can you send email when internet is down?
Can you help me with a script that will disable and enable dhcp client when the ping to 8.8.8.8 is down? thank you
great i am using telegram and netwatch for monitoring, hope it will be on your next video :)
@TKSJa
6 жыл бұрын
I have never used telegram, hope you could share how you send messages from your router to telegram.
Don't you need to set up the Email server on the router to be able to send emails?
Do you have any videos about how to set up a hotspot from scratch?
@TKSJa
6 жыл бұрын
Here is the Hotspot playlist kzread.info/dash/bejne/lHyTmK-MabfFnpc.html
Awesome! Very helpful man! One question! I am not getting the "from" time value... Do I have to change anything?
@TKSJa
6 жыл бұрын
I notice that it stop working since the last update. I will have to investigate.
I think this method is useful for your internal servers to keep monitoring everything is UP and if one of your servers is down you will know that by checking your mail but it useless for testing your wan interface cuz you may have a tow or three wan interfaces
Thank you for the video very helpful as always, the email shows = WAN Link is up on 22:38:51. Down from, How can i make it show the down time on the email ?
@AhmedAbbas76
Жыл бұрын
no way cuz there is no connection but it depends on your ping from outside to your firewall using your static ip if no replay so the link is down
Hi. Thanks for these tutorials, they have helped a lot. I would like to know how to setup a 3G USB modem for backup.
@geraldallaire9904
6 жыл бұрын
Me too I would like to know how to setup a 3G USB modem for backup. on my RB2011UiAS-2HnD-IN
@TKSJa
6 жыл бұрын
You are welcome. I don't have a 3G modem, but you could take a look at this wiki.mikrotik.com/wiki/Category:3G
Please Suggest SFP Port Down Alarm system in microtik Thankyou in Advance TKSJa
Hi bro! Plz make video when hotspot user login or logout then microtik send ua email
how can it send email when internet is down?
@S4Simple
4 жыл бұрын
It can send but remove global variable since they dont work in netwatch tool.
breddren bigup
Hello I'd like to integrate netwatch with telegram. you can tell me how to set it so that using the bot id I get the notification when the link goes down. thank you
@TKSJa
6 жыл бұрын
I have never used telegram.
@user-ol2ms2xi2b
4 жыл бұрын
You can use this replace the $$$$ by your bot token and @@@@ by your chat I'd and ???? The text you want /tool fetch url="api.telegram.org/bot$$$$$$$$$$$$$$$$$$/sendMessage?chat_id=@@@@@@@&text=?????" keep-result=no;
I want to monitor 2 different ISP link; in a failover load balance setup. How do I setup hosts in Netwatch? @TKSJa
@TKSJa
6 жыл бұрын
Netwatch pings an IP address and is not concerned with the interface that it goes through. So I am not sure how that would work.
@SaidulHassan
6 жыл бұрын
Thanks +TKSJa I was afraid this was the case. So what tool/method I can use to get alert when one of my ISP is down? I mean the physical link is up but internet is inaccessible? Btw, could you please place all your tutorial scripts here tksja.com/downloads/ so we can download, save, import directly.
@SyakirIshak
5 жыл бұрын
Have you found your solution for this? I'm having the same problem.
Mikrotik Team Việt Nam ơi, các bạn có thể làm chủ đề về các thông báo người quản trị khi có sự cố về mất đường wan, mất đường internet, người truy cập bất hợp pháp thành công vào router. Chủ đề về Netwach. Thanks
When link is down how router send you mail???????
@S4Simple
4 жыл бұрын
Remove global variable since global variable in netwatch script will not be readable by scheduler or other users
I've configured it but i'm not getting e-mails why ?
@TKSJa
6 жыл бұрын
Configure this first: kzread.info/dash/bejne/dYGEp7h7lJfKido.html
@leonelchabela9381
5 жыл бұрын
same with me, did you solved it?
how to check for mack address?
@TKSJa
4 жыл бұрын
That's very technical
Is it possible to send e-mail to multiple adresses?
@TKSJa
3 жыл бұрын
Yes, just use a comma. Example "john@abc.com, mary@gmail.com"
@gunchag
3 жыл бұрын
@@TKSJa Thank you!
if wan link is down how it ll be send mail ?
@leonelchabela9381
5 жыл бұрын
not possible to send
@jefftee448
5 жыл бұрын
If you have a 2nd WAN link, it can.
Internet connection when the electricity is disconnected
Make watchdog video
@TKSJa
6 жыл бұрын
Adding it to my list
@Rouly88
5 жыл бұрын
Please how to use this tutorial for monitoring Local networks
2 wan link how?
@TKSJa
3 жыл бұрын
kzread.info/dash/bejne/eZmp17B-Y6i2cqQ.html