Having an UPS is critical to protect your server from power related damage (brownouts, blackouts, etc) (we recommend it for all your office computers).  Having power suddenly shut off to your server can cause hard drives to crash and data to be lost.  With an UPS, like an APC Back-UPS which we provide with our Open Dental Installation packages, your server is protected from most issues arising from the building power.

Part of a good server installation is configuring the server to shutdown safely when the UPS reports an extended lack of power (typically 5-30 minutes depending on your location).  After charging the UPS overnight and connecting both the USB and power connectors to the server, the next step is to see if the CentOS server sees it.  The following display should be simular to the output you see from running the lsusb command.

Bus 001 Device 002: ID 051d:0002 American Power Conversion Uninterruptible Power Supply

Once you verify that the Operating System (OS) sees the UPS, you need to install the apcupsd daemon.  This package can be found in the EPEL repository.  If you need help installing this repo check out our post, Install EPEL repo.  Once you install and enable the EPEL repo, run the following to install apcupsd:

yum install apcupsd

For security, I typically disable the EPEL repo at this point to prevent other packages from being installed accidentally.  After this you need to edit the config file, /etc/apcupsd/apcupsd.conf and modify it to your situation.  Be sure to specific a name to easily identify the UPS in the log files.  The following lines might be useful for your config file:

UPSNAME MyOfficeUPS

UPSCABLE usb

USPTYPE usb

DEVICE

BATTERYLEVEL 50  # this sets the daemon to send the poweroff signal when the UPS reports a battery level of 50% or less

MINUTES 30  # This sets the daemon to send the poweroff signal when the UPS has 30 minutes or less remaining power

TIMEOUT 1080  # This sets the daemon to send the poweroff signal when the UPS has been ON battery power for 1080 seconds (18 mins)

SELFTEST 336  # This option sets the daemon to ask the UPS to perform a self test every 336 hours (2 weeks)

Once these setting are set I recommend restarting and enabling the daemon to start at boot with these three commands:

systemctl stop apcupsd

systemctl start apcupsd

systemctl enable apcupsd

After setting this up, you may want to test the safe shutdown of your server.  The most realistic way is to pull the plug for the UPS out of the wall outlet, and check the status after 1 minute with the following command:

apcaccess

Both the STATUS and LINEV information should change.  STATUS should show that it is on battery, and the LINEV should show no voltage on the line.  Plug the cord back in after this.  Or if you want to see the system actually shutdown, you can set the config file for a shorter TIMEOUT setting like 60 seconds and watch the shutdown process complete successfully.  Turn the server back on and check the status of the UPS with the apcaccess command.

That should wrap it up.  Please let me know if this worked for you, or if I missed something you think should be included in this post.  If you need assistance or want our technicians to come and configure things for you just contact us.