After the recent battery replacement of my UPS (APC Back-UPS 1400VA 230V), I have investigated more about the operation of NUT, a tool that allows the control of a UPS connected to our OpenMediaVault (OMV).
Before I expand on this, I would like to share some useful links that have helped me to customise my configuration and to understand NUT a little better.
- Uninterruptible Power Supply
- DIY HOME SERVER 2021 - PROXMOX - NUT UPS Monitoring
- PowerWalker UPS, NUT, and Home Assistant
- Understanding the Network UPS Tools (NUT)
- nut – testing the shutdown mechanism
In the forum there are several threads related to NUT that I found worth referencing.
- [How-to] Use the openmediavault-nut plugin
- [SOLVED] UPS-Nut Plugin - AutoRestart after Safe Shutdown
- openmediavault-nut - shutdown the server, but keep the UPS running
After replacing the battery in my APC, I would like to go through what I think is the best way to do this:
- Modify the value of the battery.mfr.date variable
- Perform a battery test
With the NUT tool and the driver I'm using (usbhid-ups) I haven't seen a way to do it. However, the manufacturer of my unit provides an application (PowerChute Personal Edition or PowerChute Serial Shutdown) for Windows to control the UPS. With this tool I was able to update the battery date and perform a battery test.
From the command line we can check if the actions performed from PowerChute are reflected in NUT. Launch the command upsc apc. The following output is returned:
Note that the value of the ups.test.result variable is not persistent. In subsequent checks it might be set to ‘No test initiated’.
Before I move on to the next points I would like to share my current configuration.
I have OMV installed on an HP Proliant Gen 8. I have the UPS connected to it both via USB (to monitor it from the NUT) and via power. In addition, I have other devices connected such as a router. The only device connected to the UPS that is configured to shut down safely is the server with OMV installed.
I have configured NUT in OMV with the shutdown mode as ‘UPS is using battery’. This way we can set a shutdown timer so that after that time the system is safely shut down. This means that once the OMV shutdown is initiated, it sends a signal so that the UPS shuts down after a delay (by default I think it is 20 seconds). When the UPS shuts down the rest of the connected devices lose power.
This is not the ideal scenario, since I would like to keep the rest of the devices powered by the battery of the UPS. The server with OMV shuts down after several minutes with the UPS on battery because it is the device with the highest consumption and the only one that I consider relevant to have a safe shutdown. In other words, the ideal scenario would be to set a timer for OMV shutdown and to set that after reaching a percentage of battery discharge defined by the user, the UPS would shut down regardless of whether there are connected devices running or not.
I have not found the way to implement this customised configuration, in which we granularly configure the shutdown of different devices. However, checking the reference links I have shared, it is possible to delay the shutdown of the UPS once the monitoring server has triggered the shutdown process. To do so just add offdelay = seconds_to_delay in driver configuration directives.
The NUT developers seem to have thought that it is important to provide the ability to delay the shutdown of the UPS. Why? As explained in this document (section 2.6 on page 15), sometimes the shutdown of a device may not be completed before the UPS shuts down. So this shutdown delay time is designed for these situations.
The usual process after a power failure is to recover the power supply within a short period of time. There is a risk that the UPS may start up the machines with a low battery and then a power cut occurs again without enough charge in the UPS batteries to allow the safe shutdown of the devices connected to it.
To avoid this, it would be useful setting the UPS to turn on (or at least send the power signal to the devices connected to it) when a user-defined minimum battery charge is reached. It seems that there are enterprise UPS models that can allow this more advanced configuration. In fact, in this page of NUT we can see that they talk about Return treshold. A writable variable that allows to set the battery percentage to turn on the UPS after the power is restored.
For users who do not have such advanced models, there is another option available. Set a delay on UPS start up. In order to apply it in OMV it is necessary to set the value ondelay = seconds_to_delay. Note that the delay is from the moment the OMV shutdown is initiated.
I would like to know what UPS and NUT settings you have on your systems