Thursday, 31 October 2013

How Do I Configure APC UPS For My LINUX Box For Auto Shut Down

My Linux server is connected to APC SmartUPS using usb cable and I would like to detect a power failure. If power is not restored my server must shutdown when the battery is exhausted. How do I configure and use my APC SmartUPS under RHEL / CentOS / Fedora / Linux operating system for power management?

Linux comes with GPL licensed open source apcupsd server ( daemon ) that can be used for power mangement and controlling most of APC's UPS models on Linux, BSD, Unix and MS-Windows operating systems. Apcupsd works with most of APC's Smart-UPS models as well as most simple signalling models such a Back-UPS, and BackUPS-Office. During a power failure, apcupsd will inform the users about the power failure and that a shutdown may occur. If power is not restored, a system shutdown will follow when the battery is exhausted, a timeout (seconds) expires, or runtime expires based on internal APC calculations determined by power consumption rates.

Login as ROOT ( Superuser )
Using YUM repository 

# yum install apcupsd
SAMPLE Output :
Loaded plugins: product-id, protectbase, rhnplugin, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
0 packages excluded due to repository protections
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package apcupsd.x86_64 0:3.14.10-1.el6 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
====================================================================================================
 Package               Arch                 Version                        Repository          Size
====================================================================================================
Installing:
 apcupsd               x86_64               3.14.10-1.el6                  epel               299 k
 
Transaction Summary
====================================================================================================
Install       1 Package(s)
 
Total download size: 299 k
Installed size: 1.3 M
Is this ok [y/N]: y
Downloading Packages:
apcupsd-3.14.10-1.el6.x86_64.rpm                                             | 299 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : apcupsd-3.14.10-1.el6.x86_64                                                     1/1
Installed products updated.
  Verifying  : apcupsd-3.14.10-1.el6.x86_64                                                     1/1
 
Installed:
  apcupsd.x86_64 0:3.14.10-1.el6
 
Complete!
 
Connect UPS : You need to connect the UPS to your Server using cable. Your will see an entry in /var/log/messages which will tell you that the UPS is connected.
Configure the UPS : 
# vi /etc/apcupsd/pacupsd.conf
First give your UPS a name, this is particulary useful when you have multiple UPS installed in the office                                                   UPSNAME officeups1
Next, defines the type of cable connecting the UPS to your Linux BOX. In this example I am connecting my UPS using usb cable ...                            UPSCABLE usb
### Set UPS type to USB ###                                                   UPSTYPE usb                                                                   device
Configuration Parameters                                                      ONBATTERYDELAY 6 - This defines the time in seconds from when a power failure is detected until we react to it with a onbattery event.
BATTERYLEVEL 5 - If during a power failure the remaining battery percentage   *as reported by the UPS* is below or equal to MINUTES apcupsd will initiate a shutdown to the Linux BOX

No comments:

Post a Comment