This small script for Mikrotik will check is host/hosts online or offline and sends messages to email if host is down.
# Comment in log that script starts
:log info ("Script started");
# Define how many ping attempts try to do
:local pingcount 3;
# List of IP addresses to check
:local host1 192.168.88.3;
# Function that check first host in list
:log info ("host 1 CHECK");
:local pingresult1 [/ping $host1 count=$pingcount];
:if (pingresult1 > 0) do={:log info ("$pingresult1 of $pingcount PING Requests PASS");
:log info ("$host1 ONLINE");} \
else={ /tool e-mail send \
to=your@email.com \
subject="$pingresult1 of $pingcount PING Requests PASS Can't ping $host1";\
:log info ("$host1 OFFLINE");
}
:delay 1;
:log info ("Delay 1 sec");
hosts can be more than one, simply add :local host2, copy function in bottom and change $host1 to host2
This small script for Mikrotik will check is host/hosts online or offline and sends messages to email if host is down.
hosts can be more than one, simply add :local host2, copy function in bottom and change $host1 to host2
user13