MikroTik Tutorial 72 - Monitor network links using Netwatch
HTML-код
- Опубликовано: 8 ноя 2024
- 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
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.
Cool, could you share your script?
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\""
Thank for sharing. It works like a charm.
@@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
@@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.
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 ?
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
very helpful, it is posibble if netwatch give notification on email by hourly while the host target still down ? , its kind like reminder , thanks
His videos worth a subscribe .. Thumbs up!
Thanks!
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
I was looking for this Netwatch.. Tks à lot
You are welcome
TKSJa can i get a email address for you
Don't you need to set up the Email server on the router to be able to send emails?
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?
Big up yourself sir, keep the videos coming.
You are welcome
You are wonderful!
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 ?
Hi. Thanks for these tutorials, they have helped a lot. I would like to know how to setup a 3G USB modem for backup.
Me too I would like to know how to setup a 3G USB modem for backup. on my RB2011UiAS-2HnD-IN
You are welcome. I don't have a 3G modem, but you could take a look at this wiki.mikrotik.com/wiki/Category:3G
How can you send email when internet is down?
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
Do you have any videos about how to set up a hotspot from scratch?
Here is the Hotspot playlist
ruclips.net/video/bH_6MS9T_n4/видео.html
great i am using telegram and netwatch for monitoring, hope it will be on your next video :)
I have never used telegram, hope you could share how you send messages from your router to telegram.
It is Very Useful , Thanks
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
breddren bigup
very helful thank u so much
Awesome! Very helpful man! One question! I am not getting the "from" time value... Do I have to change anything?
I notice that it stop working since the last update. I will have to investigate.
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
Please Suggest SFP Port Down Alarm system in microtik Thankyou in Advance TKSJa
When link is down how router send you mail???????
Remove global variable since global variable in netwatch script will not be readable by scheduler or other users
how can it send email when internet is down?
It can send but remove global variable since they dont work in netwatch tool.
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
I have never used telegram.
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;
Is it possible to send e-mail to multiple adresses?
Yes, just use a comma. Example "john@abc.com, mary@gmail.com"
@@TKSJa Thank you!
I want to monitor 2 different ISP link; in a failover load balance setup. How do I setup hosts in Netwatch? @TKSJa
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.
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.
Have you found your solution for this? I'm having the same problem.
Hi bro! Plz make video when hotspot user login or logout then microtik send ua email
how to check for mack address?
That's very technical
I've configured it but i'm not getting e-mails why ?
Configure this first: ruclips.net/video/CMPEVBd4dYw/видео.html
same with me, did you solved it?
Make watchdog video
Adding it to my list
Please how to use this tutorial for monitoring Local networks
if wan link is down how it ll be send mail ?
not possible to send
If you have a 2nd WAN link, it can.
Internet connection when the electricity is disconnected
2 wan link how?
ruclips.net/video/GeuuNE3EPBA/видео.html