Configuration of APC UPS in Ubuntu

Posted: March 20, 2011 in Computer, Linux, System Configuration, Ubuntu

Welcome back. Its been quite a while since I posted something here. Today I am gonna deal with configuration of APC Smart UPS (APC Back-UPS ES 650 in my case) in your Ubuntu machine.

This applies to all those “Smart UPS” of APC where your computer can monitor your UPS via a USB interface (which comes bundled along with the product). By default you get a Software CD namely PowerChute which is meant for Windows and OS X by MAC.

Let me point out that this works out well with even other Linux OSs. So you need not flip this post away. It is just that you might have to use the appropriate commands required by your Linux system which might or might not be different from Ubuntu commands.

So lets begin.

I hope all your items present in your Update Manager is up-to-date. Though I don’t find any reasons for this to cause any issues but it is always recommended you keep it updated as and when possible (this is my personal suggestion as well).

Open your Terminal window. (Applications > Accessories > Terminal)

Type in the following:

sudo apt-get install apcupsd

You might be prompted to enter your password. So enter it and hit return. (Never mind if those * characters do not appear while you are entering your password, its hidden for added security purpose).

Once the process is completed successfully, type in the following:

sudo gedit /etc/default/apcupsd

This must open the file in a gedit Text Editor window.

Find the following line:

ISCONFIGURED=no.
Now replace ‘no’ with ‘yes’ without quotes.

Save and close the file.

Now return back to your Terminal window.

Type in the following command:

sudo gedit /etc/apcupsd/apcupsd.conf

Now make the following changes in the text editor that has just opened:

Find the line:

UPSCABLE <some default value already exists here>

Replace that <default value> with usb.

So your line should now be read as:

UPSCABLE usb

Similarly make changes to all these lines so that they are read as follows:

UPSTYPE usb
DEVICE
BATTERYLEVEL 5
MINUTES 3
NETSERVER on
NISPORT 3551

Please note that some the parameters mentioned above could have the default values as I have mentioned above. So you need not make any changes to those parameters such as NETSERVER and NISPORT. And some the values such as BATTERYLEVEL and MINUTES can be set to the values of your convenience and your device specifications. However it is not suggested that you reduce the values to lesser than those that I have suggested above as the time and power remaining might not be sufficient for your system to complete the process of shutdown or hibernation. Hence you can always increase it, but not suggested to reduce it any further.

Once these changes are made, please save file and close the editor.
We will run a few more commands to verify the outputs.

Verify the Setup

Run the following in your terminal:

sudo apcupsd start
sudo apcaccess status

You could even restart your system and then run the commands to make sure that apcupsd is running.

Final Setup
Unplug the UPS and wait for the process to take place. In my case the system should initiate and complete the shutdown process when the battery level or the time remaining is 5% or 3 minutes.

If you are system is not able to complete the process before your battery runs out, you could increase the above set parameters to say 8% or 5 minutes suiting your UPS’s needs.

Monitoring your Power Management System the GUI way
Finally, to monitor your system the GUI way as in Windows you could install the gapcmon package. This even provides you with handy graphs as well.

Run the following command:

sudo apt-get install gapcmon

Restart your PC and then you can this application from Application > System Tools > APCUPSD Monitor.

Rest of the features in this application is self-explanatory.

So hope this helps you and you could be well prepared in cases of expected or unexpected power outages. Please drop in your comments/suggestions/doubts if any in the comment boxes below. I will do my best help you out in case of any issues.

Advertisements
Comments
  1. Thomas Mobley says:

    gapcmon no longer seems to be available unfortunately for those who wish the gui. Unsure what will work, this is the third post I’ve seen that recommends it.

  2. jinbatsu says:

    Thank you it work for Powerchute OS Ubuntu 10.04
    Great post!

  3. NT says:

    I tried this, but my Back UPS is a 650 with a serial cable on both ends. I keep getting the error that connection is refused, when I type “sudo apcaccess status”? I even changed the conf file to show a “simple” cable instead of a usb cable, but still nothing? Can you please help? Thanks

  4. The Bass Dude says:

    Excellent instructions, thank you. Do this, and your APC usb product *will* work under Ubuntu 10.04, first time.

Drop your thoughts here...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s