Configuration of an APC UPS under Proxmox
This is how to configure an APC-UPS under Proxmox:
These instructions are based on (German Text): https://www.maffert.net/proxmox-debian-usv-ups-von-apc-installieren-und-konfigurieren/
0. Connect the UPS to the server and switch it on
- The UPS can be controlled with the software apcupsd. Installation of this program:
apt-get install apcupsd
2. Editing the configuration file:
The following options have to be changed in this file:
UPSNAME *Enter any device name* UPSCABLE usb UPSTYPE usb DEVICE *leave empty, the program will automatically detect the UPS* NETSERVER on NISIP 0.0.0.0
Furthermore, in this file the following settings can be changed:
- The time between power failure and triggering of the „ON BATTERY“ event in seconds. The standard is 6 seconds so that an action is not triggered directly in the event of a brief failure.
- This is the limit in percent of remaining battery capacity from when the server will shut down.
- If the remaining runtime (calculated by the UPS) is less than this value (in minutes), the server is shut down.
- The path to the log file
- Time in seconds how often the server queries the UPS for its status
3. „Tell“ the program that it is completely configured:
put in the file: nano /etc/default/apcupsd ISCONFIGURED=yes
4. Start the program and check function:
apcupsd start apcaccess status
5. Optional: Install web interface:
apt-get install apcupsd-cgi apache2 a2enmod cgi systemctl restart apache2
Call up the status page at:
Configuration of Slaves
If other servers are connected to the UPS, they can be configured in such a way that the MASTER server (which is connected to the UPS via USB) causes the SLAVES to shut down in the event of a power failure.
These steps can also be carried out in Proxmox VMs, which cannot be shut down via the Proxmox interface.
- Changes in the configuration of the master:
Enter the IP addresses of the servers that should work as SLAVES (these should be static IPs!):
# MONITOR <address> "<host description>" MONITOR 192.168.1.52 "Backup server" MONITOR 192.168.1.51 "Server 2"
systemctl restart apcupsd.service
2. Configuration of the SLAVE computers:
apt-get install apcupsd nano /etc/apcupsd/apcupsd.conf
Change in this file:
UPSCABLE ether UPSTYPE net POLLTIME 10 # IP of the MASTER COMPUTER (in my case 192.168.1.52), The standard port for apcupsd is 3551 DEVICE 192.168.1.52:3551
The rest of the configuration is as above.
Optional: Web interface for quick access to the UPS status pages
I have created a small web interface that enables quick access to the status page and the Proxmox web interface.
To use it, just execute the following commands:
- Create a file „index.html“ in the web server directory
2. Paste the following content into this file. The IP address to the Proxmox web interface has to be replaced by the IP address of the respective Proxmox server:
<title>Proxmox-USV</title> <body> <h3>USV Status</h3> <br> <a href="/cgi-bin/apcupsd/multimon.cgi"> apcupsd MultiMon </a><br> <a href="/cgi-bin/apcupsd/upsstats.cgi"> apcupsd Stats </a><br> <a href="/cgi-bin/apcupsd/upsfstats.cgi"> apcupsd fStats </a><br><br><br> <h3>Proxmox Webinterface</h3><br> <a href="https://192.168.1.12:8006"> <!-- enter IP here! --> Proxmox Webinterface </a> </body>
After that save the file. Now the interface can simply be called up under the server IP (http://–SERVER-IP–).