I am using the ups power monitor script that I found on the mikrotik wiki for RouterOS ver. 3.x, but when I try to run it on a RB433AH with RouterOS ver. 3.23 it gives me several syntax errors and in the notes of the script it tells me not to modify the section that is giving me the errors. If anyone can help me I would appreciate it!
Here is a copy of the script, I just removed the mail server and made up a mail from address to post here, but basically when it gets to {:set curonbatt $"on-battery"; :set curcharge $"battery-charge"} it then highlights all the c's and m's in the script that are after "$" and gives errors for each line some are syntax errors some are invalid entry errors.
:if (($curonbatt) && ($flagonbatt=0)) do={
:set flagonbatt 1
/tool e-mail send from=($mailfrom) to=($mailto) server=($mailserver) subject=($sysname . ": Power failure!") body=($sysname . " is on battery since " . $datetime)
:log info ("Power-Fail: EMail sent to " . $mailto)
}
:if ((!$curonbatt) && ($flagonbatt=1)) do={
:set flagonbatt 0
/tool e-mail send from=($mailfrom) to=($mailto) server=($mailserver) subject=($sysname . ": Power is back") body=($sysname . " is back on power since " . $datetime)
:log info ("Power-Restore: Email sent to " . $mailto)
}
:if (($curcharge <= $battalarm) && ($flagbattlow=0)) do={
:set flagbattlow 1
/tool e-mail send from=($mailfrom) to=($mailto) server=($mailserver) subject=($sysname . ": Low battery!") body=($sysname . " battery is at " . $curcharge . "%! " . $datetime)
:log info ("Batt-Low: Email sent to " . $mailto)
}
copy the files you can download onto your router via winbox ond then do an “Import” of that file on the local console
this keeps the syntax. we have seen problems when you just copy and paste the script into the script editor.
and dont forget to set the sceduler to start the ups script every few minutes or less.
our ups moduls from the Wiki also can regualte a cooling fan for outdoor cabinets and also monitors the temperature …
I got it working a while back just never posted to let you guys know. It works like a top and when you have equipment on grain elevators where power is on and off a lot in the spring and fall it is nice to know when it switches to battery power via txt message! Thanks for all the posts!