BILLYSOFTACADEMY

Setting Up APC UPS Power Protection And Monitoring For Your Routerboard

image_2022-04-05_202441611
Mikrotik network equipment is fragile to power failure and when unexpected power failure occurs it can cause serious downtime The UPS monitor feature works with APC UPS units that support smart signalling over serial RS232 or USB connection and is not included in the default set of packages and needs to be downloaded and installed manually with ups.npk package. This enables you to monitor the UPS and set the router to ‘gracefully’ handle any power outage with no damage to the router.

REQUIREMENTS

In order to complete this tutorial successfully the following items are required. Please ensure to have these items available before taking implimentation action on this tutorial :

1) 1 x Mikrotik Routerboard with a USB or RS232 port.
2) 1 x USB or RS232 Cable.
3) 1 x APC UPS with a Powerchute USB port.
4) 1 x Laptop / Desktop Computer.
5) 1 x RJ45 Network Cable.

OVERVIEW

1)
2)
3)
4)
5)

The aim of this tutorial is to provide a simple and easy to follow guide on how to setup APC UPS Power protection and monitoring on your RouterBoard so as to protect it from damage that may be cause by power surges and outages. The UPS monitor addon on the MikroTik RouterOS supports 
1) Hibernate and safe reboot on power and battery failure
2) UPS battery test and run time calibration test
3) Monitoring of all “smart” mode status information supported by UPS
4) Logging of power changes

Step 1 : Configuring RouterOS APC UPS Protection

To sccessfully configure you RouterOS follow the steps as listed below :

1) Connect to your RouterBoard using your RJ45 network cables on ETHER2 and the ethernet port on your laptop / desktop
2) Connect a USB or RS232 cable from your RouterBoard to your APC UPS in this tutorial a USB cable was used.
3) Next go to SYSTEM > PACKAGES to check if the UPS package is installed. If you do not see it as show in the image on the left you have to download the EXTRAS package for your RouterBoard from www.mikrotik.com.

image_2022-04-05_203642871
3) Extract the downloaded extra packages archieve file, In Winbox go to FILES and click UPLOAD. Select the file named UPS-6.45.6-MIPSBE and after the file upload completes go to SYSTEM > REBOOT to install the UPS package
4) After successfull installation of the UPS package you should see it if you go to SYSTEM > UPS. You can check if the UPS package installation is okay by going to SYSTEM > PACKAGES and select the UPS PACKAGE and click on the CHECK INSTALLATION BUTTON(YOU SHOULD GET A INSTALLATION OK MESSAGE). Also ensure that your RouterOS version is on the latest stable version to ensure installation success.
image_2022-04-05_203621024
5) Next go to SYSTEM > UPS and click the add button. In the dialog that appears add a name for your UPS i.e “APCBACKUPS950” select the port where the UPS is connected to on the port dropdown and set the OFF LINE TIME and MIN RUN TIME values depending on UPS runtime capability. Finally set the ALARM SETTING TO IMMEDIATE( However you can choose any other alarm setting you would want for your UPS). You can also check the MODEL and STATUS tabs to get UPS information such as LOAD and RUNTIME LEFT metrics.
6) The OFFLINE TIME value is the duration that the RouterBooaurd will run whilst on battery. The RouterBoard waits for the amount of time configured and if this time lapse it goes into hibernation mode until the UPS reports that normal power has been restored. The MIN RUN TIME value is used by RouterOS such that when a power failure occurs RouterOS will monitor the runtime-left value and will go to hibernate mode when this time value is reached.

Step 2 : Configuring Power Monitoring

7) Here we are going to configure UPS power minitoring so that when a power fault occurs you will get an email notification informing you that UPS power is online or offline/ on battery. To do this follow these steps :

a) Connect and login to your Routerboard and go to SYSTEM > LOGGING and click on the ACTIONS tab…

b) Next click on the ADD button to add a new action (This will dictate what action should be taken by the log event).

c) Add any name you would like in the NAME input box, set the TYPE to email and add the email address you would like to send to the the EMAIL input box.

d) Click APPLY and OK.

image_2022-04-05_203551740

8) Next add a new RULE that will execute the ACTION you created in the prevous step. Select the RULES tab and click the ADD button.
a) In the NEW LOG RULE WINDOW select the TOPICS dropdwn menu and select UPS.

b) leave the PREFIX drop down empty and on the ACTION dropdown select the action that you created in the privious step, press APPLY and OK.

c) If you following these steps correctly you can go forward to test your setup. Results may vary depending on UPS use however if you swift the UPS off and back one again you should see UPS logs in the Log section in Winbox, also check your email account to see if RouterOS is sending logs. The images below illustrate this..

image_2022-04-05_203534022