Configure APC Multimon for Proxmox VE server
You would like to show your appreciation for our help . Gladly. 🙏 We thank you for your donation!
In-house Apt-Repo: https://apt.iteas.at
GITLAB Enterprise:
Switch to the German version of this Howto.
APCupsd can do much more than you realize. Not just serial or USB, or via SNMP ethernet cards. No, with the software it is possible to build active UPS clusters, clients (slaves) do not even have to use an APCusv. Any UPS is welcome. I will describe the following options in this HowTo:
- APC UPS connected via USB
- APC UPS is used as a power source, but is not connected to the client via USB or other cable
- Other brands of UPS
What is it not?
- It is not a central configuration or control interface.
What can I do with it?
- Central overview of all connected devices/UPSs and their power/battery status
- Shutdown of devices that do not have a data connection to their UPS or use a third-party UPS
- Control a single large central UPS
Requirements and information on the systems
In the test here, 4 APC UPSs were used, but 5 servers were connected. Whereby one extra server was configured on an APC's, where the USB interface of the UPS is already used by the other server and therefore has no data connection. The systems used here are Proxmox 6.3, Ubuntu 20.04 und Raspbian 10 Buster. APCupsd must be installed and configured on all devices.
Installation and basic configuration
The package is already included in all distributions and can be easily installed via the package management.
apt install apcupsd
The first step is to edit the file /etc/default/apcupsd
and set ISCONFIGURED=no
to ISCONFIGURED=yes
Next, go to the main configuration of APCupsd:
nano /etc/apcupsd/apcupsd.conf
These are the most important points:
UPSNAME myUSVname_which_I_would_like_to_assign UPSCABLE usb UPSTYPE usb ONBATTERYDELAY 6 #Time period in seconds from which the system service assumes a power failure. Useful to be able to ignore very short outages. BATTERYLEVEL 10 #Remaining capacity reported by the UPS in percent, from which the computer is shut down MINUTES 5 #Time buffer in minutes that is taken into account for the shutdown.
You will probably want to adjust the values to your circumstances. After restarting the APCupsd systemctl restart apcupsd.service
, you can immediately output the current values of the UPS on the CMD with the command apcaccess
. This completes the basic configuration of an APC UPS.
Advanced configuration APC cluster with central UPS server
Now we want to make one of our servers the UPS master server. You have to decide which one this may be. Ideally a server/PC/device with the longest battery life, as devices that do not have a data connection to an APC UPS cannot initiate a shutdown without this server. You also need to think about which devices should be shut down at which level when configuring the client. The level of the external usv cannot be measured, you set these values yourself on this client in apcupsd.conf. And without a connection to the master server, these are also logically ignored.
Configuration APC-Masterserver
nano /etc/apcupsd/apcupsd.conf
We will change the following values: (some are already set by default)
NETSERVER on NISIP <allowed subnet> #default value here is 0.0.0.0
Install the server components:
apt update apt install apache2-utils apcupsd-cgi apache2 a2enmod cgi systemctl restart apache2.service
Now adjust the default Index.html: /var/www/html/index.html
<html> <head> <meta http-equiv="refresh" content="0; URL=http://FQDN-of-your-server/cgi-bin/apcupsd/multimon.cgi"> </head> </html>
Your master server is now available on the network.
APC client configuration
An APC client itself has an APC UPS with a data connection and is able to control the shutdown itself. In this case, we let the client grow into the central overview. We edit the apcupsd.conf
on our client. The following parts of the config must be observed:
UPSNAME myUSVname_which_I_would_like_to_assign UPSCABLE usb UPSTYPE usb ONBATTERYDELAY 6 #Time period in seconds from which the system service assumes a power failure. Useful to be able to ignore very short outages. BATTERYLEVEL 10 #Remaining capacity reported by the UPS in percent, from which the computer is shut down MINUTES 5 #Time buffer in minutes that is taken into account for the shutdown. NETSERVER on NISIP #The IP of this client is entered here, e.g. 192.168.4.88 NISPORT 3551
systemctl restart apcupsd.service
activates the current config. This APC can now be accessed via the network and can be configured to the master server in the next step.
Configuration APC client (slave)
An APC client (slave) is of course connected to a UPS. This does not have to be an APC. The most important difference here is that this client has no data connection to the UPS to which it is connected. In other words, APCupsd does not know the status of the battery or the power supply. It is therefore not triggered even in the event of a power failure. In order to be able to shut down such a client in a controlled manner, we let it look at the master server. We edit the apcupsd.conf
on our client. The following parts of the config must be observed:
UPSNAME myUSVname_which_I_would_like_to_assign UPSCABLE usb UPSTYPE net DEVICE FQDN-MasterServer:3551 ONBATTERYDELAY 6 #Time period in seconds from which the system service assumes a power failure. Useful to be able to ignore very short outages. BATTERYLEVEL 10 #Remaining capacity reported by the UPS in percent, from which the computer is shut down MINUTES 5 #Time buffer in minutes that is taken into account for the shutdown. NETSERVER on NISIP #The IP of this client is entered here, e.g. 192.168.4.88 NISPORT 3551
systemctl restart apcupsd.service
activates the current config. This APC can now be accessed via the network and can be configured to the master server in the next step.
If the power „ONLY“ fails at this one UPS (APC client/slave), neither the master nor the client will notice. The shutdown only works here if the master also switches to battery power. If the master switches to battery power and the client has normal line power, the client is still shut down according to the values set in the config.
The basic idea here is definitely to use a large central UPS, and not to use lots of small UPSs scattered around, or even third-party APCs. But yes, as we have seen, this can work well too.
Add APC clients to the APC master server
This is done quickly and easily. nano /etc/apcupsd/hosts.conf
MONITOR benno.tux.lan "benno.tux.lan Proxmox" MONITOR backup.tux.lan "backup.tux.lan Proxmox" MONITOR pc-fredi.tux.lan "pc-fredi.tux.lan Ubuntu" MONITOR dns.tux.lan "dns.tux.lan raspberry pi" MONITOR nas.tux.lan "nas.tux.lan Datenspeicher"
All devices are now immediately visible in the central web interface: http://FQDN-from-your-master-server/cgi-bin/apcupsd/multimon.cgi Click on an image for a bigger view.