rss logo

How to Set Up apcupsd for Eaton UPS on Debian Linux

Eaton logo

In this article, we'll look at how to configure the apcupsd service on Debian to manage a UPS connected via USB cable.

Install and Configure

  • Install the apcupsd package:
root@debian:~# apt update && apt install apcupsd
  • Check that the UPS is visible:
root@debian:~# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 1604:10c0 Tascam Dell Integrated Hub
Bus 001 Device 004: ID 1604:10c0 Tascam Dell Integrated Hub
Bus 001 Device 003: ID 1604:10c0 Tascam Dell Integrated Hub
Bus 001 Device 002: ID 0463:ffff MGE UPS Systems UPS
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Configuration

  • Edit the configuration file /etc/apcupsd/apcupsd.conf:
UPSCABLE usb
UPSTYPE usb
#remove /dev/ttyS0 when connected via USB :
#DEVICE /dev/ttyS0
DEVICE
LOCKFILE /var/lock
SCRIPTDIR /etc/apcupsd
PWRFAILDIR /etc/apcupsd
NOLOGINDIR /etc
ONBATTERYDELAY 6
BATTERYLEVEL 5
MINUTES 3
TIMEOUT 0
ANNOY 300
ANNOYDELAY 60
NOLOGON disable
KILLDELAY 0
NETSERVER on
NISIP 127.0.0.1
NISPORT 3551
EVENTSFILE /var/log/apcupsd.events
EVENTSFILEMAX 10
UPSCLASS standalone
UPSMODE disable
STATTIME 0
STATFILE /var/log/apcupsd.status
LOGSTATS off
DATATIME 0
  • Restart the apcupsd service:
root@debian:~# systemctl restart apcupsd.service
  • Run the apcaccess command to retrieve UPS status information:
root@debian:~# apcaccess status

APC      : 001,029,0694
DATE     : 2023-03-19 15:59:08 +0100
HOSTNAME : debian
VERSION  : 3.14.14 (31 May 2016) debian
UPSNAME  : std
CABLE    : USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2023-02-27 16:36:50 +0100
MODEL    : Eaton 5P
STATUS   : ONLINE
LOADPCT  : 15.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 49.9 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
OUTPUTV  : 236.2 Volts
DWAKE    : -1 Seconds
ALARMDEL : 30 Seconds
LINEFREQ : 49.9 Hz
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : OK
STATFLAG : 0x05000008
SERIALNO : G117N70614
NOMPOWER : 1100 Watts
END APC  : 2023-03-19 15:59:51 +0100

Logs

  • View apcusd logs with the journalctl command:
root@debian:~# journalctl -u apcupsd --since "120 min ago"
oct. 10 13:13:07 debian-server systemd[1]: Starting apcupsd.service - UPS power management daemon...
oct. 10 13:13:07 debian-server systemd[1]: apcupsd.service: Can't open PID file /run/apcupsd.pid (yet?) after start: No such file or directory
oct. 10 13:13:07 debian-server apcupsd[1714]: apcupsd 3.14.14 (31 May 2016) debian startup succeeded
oct. 10 13:13:07 debian-server apcupsd[1714]: NIS server startup succeeded
oct. 10 13:13:07 debian-server systemd[1]: Started apcupsd.service - UPS power management daemon.