Configure a single APC UPS for Proxmox VE server

You would like to show your appreciation for our help 8-o. Gladly. 🙏 We thank you for your donation!

In-house Apt-Repo: https://apt.iteas.at
GITLAB Enterprise:

Tested on Proxmox VE 8.x

Apcupsd is a system service for configuring a UPS (uninterruptible power supply) from the manufacturer APC and to shut down a connected server in an orderly manner in the event of a power failure. Apcupsd is available via apt.

apt update
apt install apcupsd

A few details are all that is needed to get started. In the following examples, an APC connected via USB is configured. On my GitHub project, I have a preconfigured example that can be used immediately for production:

wget -O /etc/apcupsd/apcupsd.conf https://github.com/ITEAS-IT-Services/iteas-proxmox-installer/raw/main/etc/apcupsd.conf

The most important configuration options:

#   Use this to give your UPS a name in log files and such. This
#   is particulary useful if you have multiple UPSes. This does not
#   set the EEPROM. It should be 8 characters or less.
UPSNAME usv01

# UPSTYPE apcsmart
# DEVICE /dev/ttyS0
UPSTYPE usb

# The ONBATTERYDELAY is the time in seconds from when a power failure
#   is detected until we react to it with an onbattery event.
#
#   This means that, apccontrol will be called with the powerout argument
#   immediately when a power failure is detected.  However, the
#   onbattery argument is passed to apccontrol only after the 
#   ONBATTERYDELAY time.  If you don't want to be annoyed by short
#   powerfailures, make sure that apccontrol powerout does nothing
#   i.e. comment out the wall.
ONBATTERYDELAY 6

# 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 20

# If during a power failure, the remaining runtime in minutes 
# (as calculated internally by the UPS) is below or equal to MINUTES,
# apcupsd, will initiate a system shutdown.
MINUTES 10

Finally, the configuration has to be activated in the /etc/default/apcupsd file.

ISCONFIGURED=yes

And restart the service with

systemctl restart apcupsd.service && systemctl status apcupsd.service

With the command apcaccess you get the actual status of your APC UPS. That's all there is to say.

The apctest program can be used to check the program settings. To do this, the apcupsd system service must first be stopped.

systemctl stop apcupsd.service 

Possible apctest options can be viewed with:

apctest --help

After the tests/debugging, the apcupsd system service can be restarted:

systemctl start apcupsd.service

For new Proxmox installations, you can use this additional project. This will already configure a USB APC UPS.