Some mikrotik routers have voltage monitoring. If you use battery backup to power it you need to have mains power supply monitor. This script offers this and sends email to a list of recipients. In order to work correctly you have to setup the email account.
/tool e-mail
set address=74.125.136.108 from="<Mikrotik QTH>" last-status=succeeded \
password=xxxxxx port=587 start-tls=yes user=This email address is being protected from spambots. You need JavaScript enabled to view it.
The address in the 6.7 which I use does not resolved to IP so I use the IP address.
I think in newest MT versions it can be resolved.
You need also a scheduled task.
/system scheduler
add interval=10m name=LowVoltage on-event=\
"/system script run LowVoltage\r\
\n" policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
start-date=apr/05/2015 start-time=04:38:40
You have to change the VoltageLimitLow & VoltageLimitHigh parameters according to your power supply.
The VoltageLimitLow is the Voltage which if is dropped below this number it is problem for you.
The VoltageLimitHigh is the Voltage that if is more the power is come back.
The voltages in the example are 20 & 21 Volts.
You change the myemail according to the destinations that you want to send.
Also you change the SMTPserver if it is different.
You do not have to change nothing below the # define Variables.
And now the script (save it as LowVoltage)
# Low Voltage script
:global VoltageStatus
:local VoltageLimitLow 200
:local VoltageLimitHigh 210
:local myemail "This email address is being protected from spambots. You need JavaScript enabled to view it.,This email address is being protected from spambots. You need JavaScript enabled to view it."
:local SMTPserver "smtp.gmail.com"
# define Variables
:local VoltageNow
:local mysubject
:local s
:set VoltageNow (:tonum [/system health get voltage])
#:log info $VoltageNow
:if ([:typeof $VoltageStatus] = "nothing") do={
:if ($VoltageNow < $VoltageLimitLow) do={
:set VoltageStatus "BAD"
:set mysubject ([/system identity get name]." Voltage is ".$VoltageNow)
/tool e-mail set address=[:resolve $SMTPserver]
:foreach s in=[:toarray $myemail] do={
/tool e-mail send to=$s subject=$mysubject}
} else={
:if ($VoltageNow > $VoltageLimitHigh) do={
:set VoltageStatus "OK"}
}
} else={
:if ($VoltageNow < $VoltageLimitLow and $VoltageStatus="OK") do={
:set VoltageStatus "BAD"
:set mysubject ([/system identity get name]." Voltage is ".$VoltageNow)
/tool e-mail set address=[:resolve $SMTPserver]
:foreach s in=[:toarray $myemail] do={
/tool e-mail send to=$s subject=$mysubject }}
:if ($VoltageNow > $VoltageLimitHigh and $VoltageStatus="BAD") do={
:set VoltageStatus "OK"
:set mysubject ([/system identity get name]." Voltage is ".$VoltageNow)
/tool e-mail set address=[:resolve $SMTPserver]
:foreach s in=[:toarray $myemail] do={
/tool e-mail send to=$s subject=$mysubject }}
}
#:log info "end"
Possible improvemts are to send SMS via the SMS gateway that exists.