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.