fbpx

Can you generate alerts when a MikroTik link goes down?

Yes, in MikroTik RouterOS you can configure alerts to notify when a link goes down. This is typically accomplished by monitoring network links and running scripts or sending email notifications when changes in connection status are detected. Below I explain how you can configure these alerts:

Step 1: Configure Link Monitoring

You can use tools like netwatch o Interface Monitoring in MikroTik to monitor the status of connections:

Using Netwatch:

Netwatch is a tool that allows you to monitor the availability of devices on the network, sending pings to specific IP addresses and running scripts in case of changes in connectivity.

/tool netwatch
add host=192.168.1.1 interval=30s timeout=1s
   down-script="/system script run send-email-down"
   up-script="/system script run send-email-up"

In this example, 192.168.1.1 is the IP address of the link you want to monitor. The scripts send-email-down y send-email-up They will be executed when the link goes down and when it is restored, respectively.

Interface Monitoring:

You can configure event-based alerts using the interface monitoring functionality to run a script when an interface changes state.

/system script
add name="check-interface-status" source={
    :local status [/interface get [find name="ether1"] disabled];
    if ($status = true) do={
        /tool e-mail send to="[email protected]" subject="Alerta de Enlace" body="El enlace ether1 está desactivado.";
    }
}

This script checks if the interface ether1 is disabled and send an email if so.

Step 2: Set Up Sending Emails

For MikroTik to send emails, you need to configure the SMTP server in RouterOS:

/tool e-mail
set address=smtp.example.com port=587 start-tls=yes from="[email protected]"
   user="[email protected]" password="password"

Make sure to replace smtp.example.com, [email protected], and the credentials with your own details.

Step 3: Create and Assign Scripts

RouterOS scripts must be prepared to be executed when Netwatch detects a change. Here is a basic script example to send an email:

/system script
add name="send-email-down" source={
    /tool e-mail send to="[email protected]" subject="Alerta de Conectividad" body="El enlace ha fallado.";
}

Conclusion

Setting up alerts in MikroTik RouterOS to monitor link status is an effective way to stay informed about network health. You can adapt and expand these examples to fit your specific needs and improve the resilience of your network.

There are no tags for this post.
Did this content help you?
Facebook
Twitter
LinkedIn
WhatsApp
Telegram

Other documents in this category

Leave your comment

Your email address will not be published. Required fields are marked with *

Tutorials available at MikroLABs

No Courses Found!

DISCOUNT CODE

AN24-LIB

applies to MikroTik books and book packs

Days
Hours
Minutes
Seconds

Introduction to
OSPF - BGP - MPLS

Sign up for this Free course

MAE-RAV-ROS-240118
Days
Hours
Minutes
Seconds

Sign up for this Free course

MAS-ROS-240111

Promo for Three Kings Day!

KINGS24

15%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the Three Kings Day discount code!

* promotion valid until Sunday January 7, 2024
** the code (KINGS24) applies to shopping cart
*** buy your course now and take it until March 31, 2024

New Year's Eve Promo!

NY24

20%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the New Year's Eve discount code!

* promotion valid until Monday, January 1, 2024
** the code (NY24) applies to shopping cart
*** buy your course now and take it until March 31, 2024

Christmas discounts!

XMAS23

30%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the discount code for Christmas!!!

**codes are applied in the shopping cart
Promo valid until Monday December 25, 2023

CYBER WEEK DISCOUNTS

CW23-MK

17%

all MikroTik OnLine courses

CW23-AX

30%

all Academy courses

CW23-LIB

25%

all MikroTik Books and Book Packs

Take advantage of the discount codes for Cyber ​​Week!!!

**codes are applied in the shopping cart
Promo valid until Sunday December 3, 2023

BLACK FRIDAY DISCOUNTS

BF23-MX

22%

all MikroTik OnLine courses

BF23-AX

35%

all Academy courses

BF23-LIB

30%

all MikroTik Books and Book Packs

Take advantage of the discount codes for Black Friday!!!

**Codes are applied in the shopping cart

codes are applied in the shopping cart
valid until Sunday November 26, 2023

Days
Hours
Minutes
Seconds

Sign up for this Free course

MAE-VPN-SET-231115

Halloween promo

Take advantage of discount codes for Halloween.

Codes are applied in the shopping cart

HW23-MK

11% discount on all MikroTik OnLine courses

11%

HW23-AX

30% discount on all Academy courses

30%

HW23-LIB

25% discount on all MikroTik Books and Book Packs

25%

Register and participate in the free course Introduction to Advanced Routing with MikroTik (MAE-RAV-ROS)

Today (Wednesday) October 11, 2023
7pm to 11pm (Colombia, Ecuador, Peru)

MAE-RAV-ROS-231011