rss logo

Comment configurer apcupsd pour les onduleurs Eaton UPS sur Debian Linux

Eaton logo

Nous allons voir comment configurer le service apcupsd sur Debian afin de gérer un onduleur branché via un câble USB.

Installation du service apcupsd

  • Installer le paquet apcupsd :
root@debian:~# apt update && apt install apcupsd
  • Vérifier que l'UPS est 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

  • Éditer le fichier de configuration /etc/apcupsd/apcupsd.conf :
UPSCABLE usb
UPSTYPE usb
#supprimer /dev/ttyS0 lorsque connecté en 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
  • Redémarrer le service apcupsd :
root@debian:~# systemctl restart apcupsd.service
  • Exécuter la commande apcaccess afin de récupérer les informations d'état de l'UPS :
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

Journaux

  • Consulter les journaux apcusd avec la commande journactl:
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.