MikroTik Netwatch: get a Telegram message when a line goes down
Last updated: 11 October 2026
Netwatch pings an address every few seconds and runs a script when the address stops answering and again when it comes back. Combined with a Telegram bot, the router tells you on your phone when a line, a tower or a server goes down.
Before you change a live router: take a backup (how) and turn on Safe Mode in Winbox, so a mistake that locks you out is undone by itself.
1. A Telegram bot and your chat ID
- In Telegram, open @BotFather, send
/newbotand follow the steps. It gives you a token. Treat it like a password: anyone with it controls the bot. - Open your new bot and send it any message.
- In a browser, open
https://api.telegram.org/botYOUR-TOKEN/getUpdatesand find"chat":{"id":followed by a number. That number is your chat ID. (For a group, add the bot to the group, send a message there, and use the group's ID, which starts with a minus sign.)
2. A script that sends the message
/system script add name=tg-line1-down dont-require-permissions=yes source={
:local token "PUT-BOT-TOKEN-HERE"
:local chat "PUT-CHAT-ID-HERE"
:local text "Line%201%20is%20DOWN"
:do {
/tool fetch url=("https://api.telegram.org/bot" . $token . "/sendMessage?chat_id=" . $chat . "&text=" . $text) keep-result=no
} on-error={ :log warning "Telegram alert could not be sent" }
}Make a second script, tg-line1-up, the same with Line%201%20is%20back%20UP. Spaces in the text are written as %20. The same commands work on RouterOS v6 and v7. dont-require-permissions=yes lets Netwatch run the script with the rights it needs for fetch.
Test it by hand; the message should arrive within seconds:
/system script run tg-line1-down3. Make the check use line 1
To watch line 1 specifically, the pinged address must always go out through line 1, even when the router is using line 2. A host route does that. Pick an address you do not otherwise use (here 8.8.4.4) and line 1's gateway:
/ip route add dst-address=8.8.4.4/32 gateway=192.168.1.1 comment="Netwatch: always via line 1"For a PPPoE line use gateway=pppoe-out1. When line 1 loses its link, that route goes inactive and the ping would quietly go out through line 2 and get answers. A blackhole route behind it stops that, so the check really fails:
# RouterOS v7
/ip route add dst-address=8.8.4.4/32 blackhole distance=250 comment="Netwatch: never via another line"
# RouterOS v6
/ip route add dst-address=8.8.4.4/32 type=blackhole distance=250 comment="Netwatch: never via another line"Run the line for your version only.
4. The Netwatch entry
/tool netwatch add host=8.8.4.4 interval=30s down-script="/system script run tg-line1-down" up-script="/system script run tg-line1-up" comment="line 1"When the line dies the message goes out through line 2. If you have only one line, the "down" message cannot leave the router; the "back up" message arrives when the line returns, and that tells you how long it was down.
Watch other things
- A tower radio or a switch: its LAN address, for example
host=10.0.0.20. No host route needed. - A server: its address inside your network.
- Give each one its own pair of scripts with a clear message, such as
Tower%20North%20DOWN.
Check
/tool netwatch print
/log print where message~"Telegram"No message arrives
- Run the script by hand and read the log. "could not be sent" usually means no DNS on the router or a wrong token.
- The router's clock is far off and HTTPS fails: set NTP.
- You never sent your bot a message, so it is not allowed to write to you.
Where RadiusNest fits
These alerts are about your own network. RadiusNest's Telegram bot is for the other side: your customers check their package, data and days left and renew, and you get notices about sales. See the Telegram bot.
Start the free trial See pricing
Questions and answers
How do I get a Telegram alert from MikroTik?
Make a Telegram bot, then a script that calls /tool fetch on the Telegram sendMessage address, and run it from Netwatch's down-script and up-script.
Does this work on RouterOS v6?
Yes. The fetch command and the scripts above work on v6 and v7.
Why does Netwatch say my line is up when it is down?
The pinged address is reached through another line. Add a host route so it always goes through the line you want to watch.