APC

Updated 4 July 2019

APC

Introduction

American Power Conversion (APC) is a manufacturer of uninterruptible power supplies. APC products are among the most used all around the world nowadays. Many APC UPS users need to be sure that the computers shut down correctly when the power is off and the UPS battery is subsequently discharged, as well as when the UPS starts when power is supplied.

Installation

Install sys-power/apcupsd:

emerge apcupsd

Configuring a computer to be used with a APC UPS device

Connect the UPS device to your computer with a USB cable.

For configuration, please run the following:

/etc/apcupsd/apcupsd.conf

# If during a power failure, the remaining battery percentage
# (as reported by the UPS) is below or equal to BATTERYLEVEL, 
# apcupsd will initiate a system shutdown.
BATTERYLEVEL 10 

# If KILLDELAY is non-zero, apcupsd will continue running after a
# shutdown has been requested, and after the specified time in
# seconds attempt to kill the power. This is for use on systems
# where apcupsd cannot regain control after a shutdown.
# KILLDELAY <seconds>  0 disables
KILLDELAY 60

where:

  • BATTERYLEVEL is the percentage of battery charge that triggers the computer shutdown.
  • KILLDELAY is to be set in seconds. A specified time ( 60 sec. in the configuration above) after sending a shutdown signal, the UPS will turn off. You should set this parameter in order, first, to save some battery, and second, to make the computer start when the power supply is reestablished.

Important

Check that your BIOS has been configured so as to enable automatic start at power supply.

With this configuration, the UPS will initiate shutting down the computer connected via USB when the battery level is 10% .

The BATTERYLEVEL and MINUTES parameters operate together. It means that a shutdown signal will be sent by the computer when the battery charge reaches a level defined in these parameters.

Start the apcupsd service and add it to autostart.

/etc/init.d/apcupsd restart

rc-config add apcupsd

To get the UPS status, run the following command:

apcacess status
APC      : 001,043,1003
DATE     : 2018-04-28 17:07:30 +0300  
HOSTNAME : pc284
VERSION  : 3.14.14 (31 May 2016) gentoo
UPSNAME  : pc284
CABLE    : USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2018-04-28 16:48:42 +0300  
MODEL    : Smart-UPS 750 
STATUS   : ONLINE 
LINEV    : 223.2 Volts
LOADPCT  : 9.1 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 106.0 Minutes
MBATTCHG : 0 Percent
MINTIMEL : 0 Minutes
MAXTIME  : 40 Seconds
OUTPUTV  : 223.2 Volts
SENSE    : High
DWAKE    : -1 Seconds
DSHUTD   : 90 Seconds
LOTRANS  : 208.0 Volts
HITRANS  : 253.0 Volts
RETPCT   : 0.0 Percent
ITEMP    : 34.6 C
ALARMDEL : 30 Seconds
BATTV    : 27.3 Volts
LINEFREQ : 50.0 Hz
LASTXFER : No transfers since turnon
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STESTI   : 14 days
STATFLAG : 0x05000008
MANDATE  : 2007-07-20
SERIALNO : AS0729143376
BATTDATE : 2007-07-20
NOMOUTV  : 230 Volts
NOMBATTV : 24.0 Volts
FIRMWARE : 651.13.I USB FW:7.3
END APC  : 2018-04-28 17:07:34 +0300

Configuring multiple computers to operate with a APC UPS

Multiple machines connected to the UPS are operated via the network. One of those computers, connected to the UPS via USB acts as a server. Whenever the server gets a shutdown signal, it makes the clients to shut down.

Apply the following parameters on the server:

/etc/apcupsd/apcupsd.conf

# NISIP <dotted notation ip address>
#  IP address on which NIS server will listen for incoming connections.
#  This is useful if your server is multi-homed (has more than one
#  network interface and IP address). Default value is 0.0.0.0 which
#  means any incoming request will be serviced. Alternatively, you can
#  configure this setting to any specific IP address of your server and 
#  NIS will listen for connections only on that interface. Use the
#  loopback address (127.0.0.1) to accept connections only from the
#  local machine.
NISIP 192.168.0.1 

Specify the server IP in the NISIP option, In the example above, this would be 192.168.0.1.

Restart apcupsd to apply the modifications:

/etc/init.d/apcupsd restart

Edit the configuration file on the client, as follows:

/etc/apcupsd/apcupsd.conf

# UPSCABLE <cable>
#   Defines the type of cable connecting the UPS to your computer.
#
#   Possible generic choices for <cable> are:
#     simple, smart, ether, usb
#
#   Or a specific cable model number may be used:
#     940-0119A, 940-0127A, 940-0128A, 940-0020B,
#     940-0020C, 940-0023A, 940-0024B, 940-0024C,
#     940-1524C, 940-0024G, 940-0095A, 940-0095B,
#     940-0095C, M-04-02-2000
#
UPSCABLE ether

# To get apcupsd to work, in addition to defining the cable
# above, you must also define a UPSTYPE, which corresponds to
# the type of UPS you have (see the Description for more details).
# You must also specify a DEVICE, sometimes referred to as a port.
# For USB UPSes, please leave the DEVICE directive blank. For
# other UPS types, you must specify an appropriate port or address.
UPSTYPE net
DEVICE 192.168.0.1:3551
  • To connect via Ethernet, specify ether in the UPSCABLE parameter.
  • To connect to a network, specify net in the UPSTYPE parameter.
  • In the DEVICE parameter, specify the IP address of the server with port 3551 : in the example above, 192.168.0.1: 3551 .

Important

Make sure that port 3551 is open on the server.

Start the apcupsd service and add it to autostart.

/etc/init.d/apcupsd restart

rc-config add apcupsd