MikroTik RouterOS UPS Monitor

Document revision 26-Mar-2002
This document applies to the MikroTik RouterOS v2.4 and v2.5

Overview

The UPS monitor feature works with APC UPS units that support “smart” signaling. This feature enables the network administrator to monitor the UPS and set the router to ‘gracefully’ handle any power outage with no corruption or damage to the router. The basic purpose of this feature is to ensure that the router will come back online after an extended power failure. To do this, the router will monitor the UPS and set itself to hibernate mode when the ‘utility’ power is down and the UPS battery is has less than 10% of its battery power left. The router will then continue to monitor the UPS (while in hibernate mode) and then restart itself after when the ‘utility’ power returns. If the UPS battery is drained and the router loses all power, the router will power back to full operation when the ‘utility’ power returns.

The UPS monitor feature on the MikroTik RouterOS supports:

Contents of the Manual

The following topics are covered in this manual:

Installation

The 'ups-2.5x.npk' (less than 100KB) package for v2.5x is required. The package can be downloaded from MikroTik’s web page www.mikrotik.com. To install the package, please upload it to the router with ftp and reboot. You may check to see if the SNMP package is installed with the command:

[MikroTik] > system package print
Flags I - invalid                                            
  # NAME                   VERSION               BUILD-TIME           UNINSTALL
  0 ppp                    2.5rc11               mar/20/2002 14:55:36 no       
  1 pptp                   2.5rc11               mar/20/2002 14:56:36 no       
  2 pppoe                  2.5rc11               mar/20/2002 14:57:36 no       
  3 ssh                    2.5rc11               mar/20/2002 14:58:36 no       
  4 ups                    2.5rc11               mar/20/2002 14:59:36 no       
  5 system                 2.5rc11               mar/20/2002 15:02:36 no       
  6 routing                2.5rc11               mar/20/2002 15:08:36 no       
  7 snmp                   2.5rc11               mar/20/2002 15:09:36 no       
[MikroTik] >                                                                   

Line 4 shows that the UPS package is installed.

Hardware Resource Usage

There is no significant resource usage.

UPS Monitor Setup

Check the port menu to find a free serial port:

[MikroTik] > port print detail
  0 name=serial0 used-by=Serial Console baud-rate=9600 data-bits=8 
    parity=none stop-bits=1 flow-control=none 

  1 name=serial1 used-by="" baud-rate=9600 data-bits=8 parity=none 
    stop-bits=1 flow-control=none 

[MikroTik] >  

The proprietary APC UPS smart-mode cable should be connected to the free port. To configure the ups monitoring in MikroTik RouterOS, go to the /system ups menu:

[MikroTik] system ups> print                                                   
                    enabled: no
                       port: (unknown)
              off-line-time: 5m
               min-run-time: 5m
              alarm-setting: immediate
          rtc-alarm-setting: none
[MikroTik] system ups>  

Argument description:

enabled - ( yes / no ) Status of the monitoring is disabled by default
port - A communication port of the router
off-line-time - How long to work on batteries
When set to a number >0, the router waits x hours/minutes/seconds and then goes into hibernate mode until the UPS reports that the ‘utility’ power is back. When set to 0, the router will go into hibernate mode according the “min-run-time” setting and 10% of battery power event. The default is set to 0. In this case, the router will wait until the UPS reports that the battery power is below 10%. The number setting should be followed by “h” for hours, “m” for minutes, and “s” for seconds.
min-run-time - Minimal run time remaining
After a ‘utility’ failure, the router will monitor the run-time-left value. When the value reaches the min-run-time value, the router will go to hibernate mode. If the min-run-time value is set to 0, then the router will go to hibernate mode when the “battery low” signal is sent indicating that the battery power is below 10%.
alarm-setting - UPS sound alarm setting
rtc-alarm-setting - UPS sound alarm setting during run time calibration

To enable the UPS monitor for port 'serial1', use the set command:

[MikroTik] system ups> set port=serial1 enabled=yes                            
[MikroTik] system ups> print                                                   
                    enabled: yes
                       port: serial1
              off-line-time: 5m
               min-run-time: 5m
              alarm-setting: immediate-alarm
          rtc-alarm-setting: immediate-alarm
                      model: QS0030311640
                    version: 60.11.I
                     serial: 
           manufacture-date: 07/18/00
    nominal-battery-voltage: 24
[MikroTik] system ups>

Argument description:

model - Less than 32 ASCII character string consisting of the UPS model name (the words on the front of the UPS itself).
version - The first field is an SKU number. The second field is a variable length decimal number indicating the firmware revision. The third field is one of the following country codes:
I = 220/230/240 Vac
D = 115/120 Vac
A = 100 Vac
M = 208 Vac
J = 200 Vac
Examples:
11.12.D
1.4.A
102.56.J
serial - A string of at least 8 characters directly representing the UPS's serial number as set at the factory. Newer SmartUPS models have 12-character serial numbers.
manufacture-date - represents the UPS's date of manufacture in the format " mm/dd/yy" (month, day, year).
nominal-battery-voltage - a three-digit number representing the UPS's nominal battery voltage rating. This is not the UPS's actual battery voltage, for example, the UPS returns "024" for a 24 Volt battery system, "018" for a 18 Volt battery system, and "048" for a 48 Volt battery system.

Runtime Calibration

To start the runtime calibration of the UPS monitor, run the /system ups run-time-calibration command:

[MikroTik] system ups> run-time-calibration

The run-time-calibration command causes the UPS to start a run time calibration until less than 25% of full battery capacity is reached. This command calibrates the returned run time value. The test begins only if battery capacity is 100%.

UPS Monitoring

The monitor command displays changing information:

[MikroTik] system ups> monitor                                             
                      read-state: reading remaining run time
                         on-line: yes
                      on-battery: no
                   run-time-left: 16m
                  battery-charge: 100
                 battery-voltage: 27
                    line-voltage: 228
                  output-voltage: 227
                            load: 67
                     temperature: 31
                   line-fequency: 50
                   alarm-setting: immediate-alarm

[MikroTik] system ups>  

Explanation of the output and possible output:

read-state - status of the UPS:
low-battery - appears when a low-battery event occurs
on-line - displayed when power is being provided by the external utility (power company)
on-battery - displayed when displayed when UPS battery is supplying power
transfer cause - Only shown when the unit is on-battery. Displays the reason for the most recent transfer to on-battery operation, which may be:
- unacceptable utility voltage rate of change.
- detection of high utility voltage.
- detection of low utility voltage.
- detection of a line voltage notch or spike.
- transfer in response to battery-test or run-time-calibration
replace battery - Only shown when the UPS report this status
overloaded-output - Only shown when the UPS report this status
smart-boost-mode - Only shown when the UPS report this status
smart-ssdd-mode - Only shown when the UPS report this status
run-time-calibration-running - Only shown when the UPS report this status
run-time-left - the UPS's estimated remaining run time in minutes. You can query the UPS when it is operating in the on-line, bypass, or on-battery modes of operation. The UPS's remaining run time reply is based on available battery capacity and output load.
battery-charge - the UPS's remaining battery capacity as a percent of the fully charged condition.
battery-voltage - the UPS's present battery voltage. The typical accuracy of this measurement is ±5% of the maximum value of 24 Vdc, 34 Vdc or 68 Vdc (depending upon the UPS's nominal battery voltage).
load-power - the UPS's output load as a percentage of full rated load in Watts. The typical accuracy of this measurement is ±3% of the maximum of 105%.
load-current - the true rms load current drawn from UPS. The typical accuracy of this measurement is ±7.5% of the load rating of UPS.
apparent-load-power - representing the UPS's output load as a percentage of the full rated load in Volt-Amps. The typical accuracy of this measurement is ±5% of the maximum of 105%.
temperature - the UPS's present internal operating temperature in degrees Celsius. The typical accuracy of this measurement is ±5% of the full scale value of 100°C.
line-frequency - When operating on-line, the UPS's internal operating frequency is synchronized to the line within variations within 3 Hz of the nominal 50 or 60 Hz. The typical accuracy of this measurement is ±1% of the full scale value of 63 Hz.

UPS Cable Pin-Out

The APC UPS (BackUPS Pro or SmartUPS) requires a special serial cable. If no cable came with the UPS, a cable may be ordered from APC or one can be made "in-house". Use the following diagram:

Router side             UPS side
(DB9 Female)            (DB9 Male)
2 (TD)          ->      2
3 (RD)          ->      1
5 (GND)         ->      4
7 (CTS)         ->      6

The cable for the ACP SMART-UPS and APC BACK-UPS:

Female 9-pin router side               Male 9-pin UPS side
1--------------------------------------------------------5
3--------------------------------------------------------1
2--------------------------------------------------------2
5--------------------------------------------------------4
8--------------------------------------------------------6

Additional Resources

http://www.linuxdoc.org/HOWTO/UPS-HOWTO.html


© Copyright 1999-2002, MikroTik