STEP1.
Install the software
apt-get update
apt-get install apcupsd apcupsd-doc apcupsd-cgi
STEP2.
Edit the configured file.
nano /etc/apcupsd/apcupsd.conf
STEP3.
If you lost this file or open the file with a blank page. This is the original config file to download (v.1.1)
Edit the following arguments
You should change the values inside the “@“ quote (delete @ marks too.)
▽ Edit a random name that less than 8 words in the quote
UPSNAME @NAME@
▽ Type USB in the quote if your UPS are connected via USB cable
UPSCABLE @CABLE@
▽ Type USB in the quote if your UPS are connected via USB cable. Leave a blank to let system auto detected the device.
UPSTYPE @TYPE@ DEVICE @DEVICE@
▽ Delete the # before POLLTIME value
POLLTIME 60
▽ Scroll down and check is the values same with below.
LOCKFILE /var/lock SCRIPTDIR /etc/apcupsd PWRFAILDIR /etc/apcupsd NOLOGINDIR /etc EVENTSFILE /var/log/apcupsd.events STATFILE /var/log/apcupsd.status
You can set this value to customize auto shutdown for your server
▽ The ONBATTERYDELAY is the time in seconds from when a power failure is detected until we react to it with an onbattery event.
ONBATTERYDELAY (default 6)
▽ BATTERYLEVEL LEFT to auto shutdown
BATTERYLEVEL (default 5)
▽ BATTERY MINUTES LEFT to auto shutdown
MINUTES (default 3)
Notes: BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so the first that occurs will cause the initiation of a shutdown.
ctrl+o and Yes to save
ctrl+q to quit
STEP4.
Edit the configured file.
nano /etc/default/apcupsd
▽ Change “no” to “yes”
ISCONFIGURED= yes
ctrl+o and Yes to save
ctrl+q to quit
STEP5.
Change the privilege to 664.
chmod 644 /etc/apcupsd/apcupsd.conf
STEP6.
Do UPS test to check the configured is successful or not.
Stop apcupsd service before check you UPS.
systemctl stop apcupsd
Do UPS test by entering “apctest”.
apctest
If you are able to see the following menu, than continue setting, if not review two configured file we had set and check is there any error.
STEP7.
Start apcupsd service first.
systemctl start apcupsd
To check the status by using following command.
systemctl status apcupsd.service
STEP8.
After you start your apcupsd service again. Do a quick check to see if the system had connect to UPS
/sbin/apcaccess
If there is no error occurred and appear with the UPS information message. You configured are done.
Try to plug off the power of your UPS to test if self power-off mode work or not.
Software Version/Hardware Model:
Proxmox: v5.3-8
Apcupsd: v3.14.14
UPS: Back-UPS CS 1100U
Ref:
- 使用 apcupsd 实现 UPS 断电自动关机
http://www.xuxiaobo.com/?p=1366 - Debian apcupsd
https://wiki.debian.org/apcupsd - APC UPS monitoring on Proxmox with automatic shutdown
http://proxmoxve.blogspot.com/2015/06/apc-ups-monitoring-on-proxmox.html - [Apcupsd-users] Lock file read error: ERR=Is a directory
https://sourceforge.net/p/apcupsd/mailman/message/31936425/ - 安裝apcupsd-cgi
https://www.est.idv.tw/安裝apcupsd-cgi/
1 則留言
谢谢 很有帮助
Broadcast message from root@PVE (somewhere) (Sun Feb 2 20:50:27 2020):
Power failure on UPS apc. Running on batteries.
Broadcast message from root@PVE (somewhere) (Sun Feb 2 20:50:46 2020):
Power has returned on UPS apc…