Configuring apcupsd on Xenserver / CentOS

Start by enabling the appropriate repositories:

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

Enable the repositories by changing:

enabled=0

to:

enabled=1

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

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:

Leave a Reply