Configuring apcupsd on Xenserver / CentOS

Start by enabling the appropriate repositories:

vi /etc/yum.repos.d/CentOS-Base.repo

Enable the repositories by changing:




Then install the epel-release and apcupsd packages:

yum install epel-release
yum install apcupsd

After installation, the configuration file for apcupsd will be located here: /etc/apcupsd/apcupsd.conf

If you need to configure apcupsd to listed on the network (i.e., if you’re using an APC ups with an APC Network Management Card), you must modify some iptables rules. To ensure that they do not get lost upon reboot, simply add them to /etc/sysconfig/iptables. Here are the rules you will need to add (assuming default network port 3052 for apcupsd — change if needed):

# apcupsd
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3052 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 3052 -j ACCEPT

… And:

-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

You will need to add them to separate locations; see the following screenshot:

Then restart iptables and apcupsd:

service iptables restart
service apcupsd restart

Make sure to configure apcupsd to start on boot:

chkconfig apcupsd on

Wait a second or two after restarting apcupsd and then run apcaccess. If you receive a status from the UPS, then you’re good to go:

Configuring FreeNAS 9.10 to communicate with an APC Network Management Card

These instructions should work for just about any APC Network Management card (NMC), but the one I’m using is the AP9631.

Step #1: Navigate to the UPS configuration options

There are two ways to get into the UPS configuration:

  1. Navigate to Services -> UPS in the sidebar, or …
  2. Click on Services at the top of the page, then click the wrench icon next to UPS

It makes no difference which one you choose.

There are two ways to open the UPS configuration options. The end result is the same no matter which you choose.

There are two ways to open the UPS configuration options. The end result is the same no matter which you choose.

Step #2: Configure the UPS

As stated earlier, I’m using an AP9631 so I’ll select the driver closest to that model. In this case, it is the APC ups 3 (various) AP9630 monitoring card (snmp-ups privProtocol=AES) driver:

Select the most appropriate driver

Select the most appropriate driver

… And then continue with the configuration.

UPS configuration options

UPS configuration options

  • Identifier is how FreeNAS will refer to your UPS.
  • Port is the IP address of the network management card
  • Shutdown mode can be one of the following (you’ll have to decide which one of these is appropriate for your environment):
    1. UPS reaches low battery
    2. UPS goes on battery
  • Monitor User is the username of the user that exists on the NMC that will be used to issue shutdown commands. The AP9631 ships with a user called “device”, but you need to change the password for this user when you configure your NMC.
  • Monitor Password is the corresponding password for the NMC user.
  • Remote Monitor this option allows other servers to monitor the UPS via the NAS. You may or may not need this functionality.
  • Send Email Status Updates and To email these should be self explanatory.

Once you’ve saved your configuration, start the service:

Start the UPS service

Start the UPS service

Step #3: Verify the UPS service is communicating with the NMC

Open a terminal and ssh to your NAS and run the following command (where APCNMC is the Identifier you entered in your UPS configuration):


You should see something like this:

ambient.1.humidity.alarm.high: 60.00
ambient.1.humidity.alarm.low: 30.00
ambient.1.temperature.alarm.high: 40.00
ambient.1.temperature.alarm.low: 10.00
ambient.humidity: 0.00
ambient.temperature: 34.0
battery.charge: 100.00 10/05/2014
battery.runtime: 2160.00
battery.runtime.low: 600
battery.voltage: 26.80
device.mfr: APC
device.model: Smart-UPS 1000
device.serial: AS1440225753
device.type: ups snmp-ups
driver.parameter.pollinterval: 2
driver.parameter.privProtocol: AES
driver.parameter.synchronous: no
driver.version: 2.7.3 apcc MIB 1.2
driver.version.internal: 0.72
input.frequency: 59.90
input.sensitivity: high
input.transfer.high: 127
input.transfer.low: 106
input.transfer.reason: noTransfer
input.voltage: 120.10
input.voltage.maximum: 120.10
input.voltage.minimum: 120.10
output.current: 2.70
output.frequency: 59.90
output.voltage: 120.10
output.voltage.nominal: 120
ups.delay.shutdown: 120
ups.delay.start: 10
ups.firmware: UPS 09.2 (ID18) APCUPS
ups.load: 43.50
ups.mfr: APC 10/05/2014
ups.model: Smart-UPS 1000
ups.serial: AS1440225753
ups.status: OL
ups.temperature: 34.10 Unknown
ups.test.result: Ok