Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


apcupsd

This is an old revision of the document!


~~TOC~~

APCUSPd CentOS 6.5

This guide will let you configure apcupsd using PCNET broadcasts from the UPS network management card. Prerequisites

  • EPEL repo
  • APC UPS with network management card 2

Configure APC network management card to allow PCNET connection

PCNET is UDP broadcast communication over port 3052. If you use a firewall, open communication for this port.

  • Goto UPS → Shutdown, enter 16 character shutdown phrase, hit apply.
  • PowerChute clients → add client IP address.

Install and configure apcupsd

  • Install apcupsd.
    yum install apcupsd
  • Autostart apcupsd after boot.
    chkconfig apcupsd on
  • Configure apcupsd. Edit /etc/apcupsd/apcupsd.conf.
    UPSNAME SMART750
    UPSCABLE ether
    UPSTYPE pcnet
    DEVICE 1.2.3.4:apc:1234567890123456       # Your 16 char shutdown phrase.
    BATTERYLEVEL 10                           # Issue shutdown at or below 10% battery.
    MINUTES 10                                # If runtime left is 10 minutes or below, shutdown.
  • Open UDP 3052 from UPS to server. Edit /etc/sysconfig/iptables
    -A INPUT -m state --state NEW -m udp -p udp --dport 3052 -j ACCEPT
  • Restart iptables.
    service iptables restart
  • SELinux: Allow bind to port 3052. This should be fixed in newer versions of CentOS.
    yum -y install policycoreutils-python
    setenforce 0
    
    # clear the audit log
    cd /var/log/audit
    echo > audit.log
    
    service apcupsd start
    service apcupsd stop
    
    setenforce 1
    
    cp audit.log /var/tmp
    cd /var/tmp
    
    audit2allow -M myapcupsd < audit.log
    
    semodule -i myapcupsd.pp
  • Start apcupsd.
    service apcupsd start

Test

  • Wait 30 seconds for the PCNET broadcast and test access.
    apcaccess
apcupsd.1402431778.txt.gz · Last modified: 2014/06/10 20:22 by admin