APC SmartUPS is a line of uninterruptible power supply (UPS) devices that can provide backup power to a system during a power failure. On a Linux system, you can use the apcupsd
daemon to monitor and control an APC SmartUPS.
To configure and control an APC SmartUPS on a Linux system, follow these steps:
apcupsd
package:On a Debian-based system, you can use the following command to install apcupsd
:
sudo apt-get update sudo apt-get install apcupsdSource:www.lautturi.com
On an RPM-based system (like Fedora or CentOS), you can use the following command:
sudo yum install apcupsd
On a SUSE-based system (like openSUSE), you can use the following command:
sudo zypper install apcupsd
apcupsd
daemon:The apcupsd
daemon is configured through the /etc/apcupsd/apcupsd.conf
file. You can edit this file to specify the UPS device and configure various options. Here's an example configuration file:
UPSCABLE smart UPSTYPE apcsmart DEVICE /dev/ttyS0 BATTERYLEVEL 15 MINUTES 3 ONBATTERYDELAY 6 NETSERVER on NISIP 0.0.0.0 NISPORT 3551 EVENTSFILE /var/log/apcupsd.events EVENTSFILEMAX 10 UPSCLASS standalone UPSMODE disable
This configuration specifies a Smart UPS connected through a serial port (/dev/ttyS0
), with a battery level threshold of 15% and a shutdown delay of 3 minutes. It also enables the apcupsd
daemon to listen for network connections and sends notifications to the specified IP address and port.
apcupsd
daemon:To start the apcupsd
daemon, use the following command:
sudo systemctl start apcupsd
To start apcupsd
automatically on boot, use the following command:
sudo systemctl enable apcupsd
You can use the apcaccess
command to view the status of the UPS. For example:
apcaccess status
This will show the current battery level, load, and other status information for the UPS.
You can configure the apcupsd
daemon to perform various actions during a power failure, such as shutting down the system or running a script. To do this, you can edit the ONBATTERY
and LOWBATT
options in the apcupsd.conf
file. For example:
ONBATTERY powerfail LOWBATT shutdown
This will cause the system to initiate a powerfail shutdown when the UPS switches to battery power, and to initiate a shutdown when the battery level reaches the low battery threshold.