APCUPSD User Manual Adam Kropelin Kern Sibbald Apcupsd is a UPS control system that permits orderly shutdown of your computer in the event of a power failure. February 2, 2015 21:31:45 This manual documents apcupsd version 3.14.x Copyright © 2004-2015 Adam Kropelin Copyright © 1999-2005 Kern Sibbald Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the name Apcupsd, the copyright notice, and this notice are preserved.
Device Nodes 18 Windows USB Configuration 18 Platforms and Versions 18 USB Driver Installation 18 Verifying Device Detection and Driver 18 Solaris USB Configuration 18 Platforms and Versions 18 Building Apcupsd with USB 18 Verifying Device Detection and Driver 19 Device Nodes 19 Mac OS X (Darwin) USB Configuration 19 Platforms and Versions 19 Building Apcupsd with USB 19 Verifying Device Detection and Driver 20 Building and Installing apcupsd Installation from Binary Packages 20
Arranging for Reboot on Power-Up 30 Making sure apcupsd Is Running 31 Configuration Examples 32 A Simple USB Configuration 32 A Simple Configuration for a Serial SmartUPS 32 A Simple Configuration for a Simple Signaling or Dumb 32 NIS Server/Client Configuration Using the Net Driver 33 Differences between NIS Client/Server and the old (now removed) Master/Slave modes 34 PowerChute Network Shutdown Driver (PCNET) 34 MODBUS Driver 35 Testing Apcupsd 36 Process-Status Test 36 Logging Te
Battery Life 49 Flashing Battery Charge Graph LEDs 50 Battery Replacement 50 Battery Installation 51 "Soft" Runtime Calibration 51 "Manual" Runtime Calibration 52 Resetting the UPS Battery Constant 53 Frequently-Asked Questions 55 Customizing Event Handling 57 apccontrol Command Line Options Controlling Multiple UPSes on one Machine 57 59 Multiple UPS Example 59 Support for SNMP UPSes 62 Planning and Setup for SNMP Wiring 62 Planning and Setup for SNMP Configuration 62 Assign SNM
Email Notification of Events 71 Killpower under Windows 71 Power Down During Shutdown 71 Command Line Options Specific to the Windows Version 72 Installation: Serial-Line UPSes 72 Overview of Serial-Interface UPSes 72 Connecting a Serial-Line UPS to a USB Port 72 Testing Serial-Line UPSes 73 Establishing Serial Port Connection 73 Once you have established serial communications 74 Troubleshooting Serial Line communications 74 Bizarre Intermittent Behavior: Cables 74 75 Smart-Custom Ca
Configuration Directives used to Control System Logging 91 Configuration Directives for Sharing a UPS 91 Configuration Directives Used to Set the UPS EEPROM 91 apcupsd Status Logging 93 Status report format 93 Status Report Example 93 Status Report Fields 94 Logging the STATUS Information 97 The Shutdown Sequence and its Discontents 97 Shutdown Sequence 97 Shutdown Problems 99 Master/Slave Shutdown 99 Startup 99 Windows Considerations 100 APC smart protocol 100 Description 100
No person should rely on the contents of the APCUPSD Manual ("the manual") without first obtaining advice from APC Technical Support. The manual is provided on the terms and understanding that: 1. the authors, contributors and editors are not responsible for the results of any actions taken on the basis of information in the manual, nor for any error in or omission from the manual; and 2. the authors, contributors and editors are not engaged in rendering technical or other advice or services.
subsystem is working (see USB Configuration); if so, you can go to the build and install step. 5. If you have a UPS designed to communicate via SNMP over Ethernet, that is also a relatively easy installation. Details are provided in Support for SNMP UPSes. 6. If you have a UPS that communicates via an RS232C serial interface and it is a SmartUPS, then things are relatively simple, otherwise, your life is about to get interesting. 1.
• Gentoo 3 WINDOWS • Windows NT 4 2 4 • Windows 98/ME/2000 2 4 • Windows XP/Vista (including 64 bit) 1 2 • Windows Server 2003/2008 (including 64 bit) 2 • Windows 7 2 OTHERS • Mac OS X Darwin 1 2 • Solaris 8/9 4 • Solaris 10 • NetBSD • FreeBSD • OpenBSD • HPUX 3 4 • Unifix 3 4 • QNX 4 Supported UPSes and Cables apcupsd supports nearly every APC brand UPS model in existence and enough different cable types to connect to all of them.
This is the keyword to specify if you are using your UPS in Slave mode (i.e. the machine is not directly connected to the UPS, but to another machine which is), and it is connected to the Master via an ethernet connection. You must have apcupsd's Network Information Services NIS turned on for this mode to work. snmp SNMP UPSes communicate via an Ethernet NIC and firmware that speaks Simple Network Management Protocol.
If you decide to set up one of these more complex configurations, see the dedicated section on that particular configuration. USB Configuration Apcupsd supports USB connections on all major operating systems: Linux, FreeBSD, OpenBSD, NetBSD, Windows, Solaris, and Mac OS X Darwin. If you plan to use a USB connection, please read the appropriate subsection in its entirety.
Verifying Device Detection and Driver To make sure that your USB subsystem can see the UPS, just do this from a shell prompt: cat /proc/bus/usb/devices This information is updated by the kernel whenever a device is plugged in or unplugged, irrespective of whether apcupsd is running or not. It contains details on all the USB devices in your system including hubs (internal and external), input devices, and UPSes.
usbdevfs hub 96-111: hiddev hid On Linux-2.6.x, make sure the sysfs filesystem is mounted on /sys and do: ls -l /sys/bus/usb/drivers/ ...where you should get: total 0 drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x 2 2 2 2 2 root root root root root root root root root root 0 0 0 0 0 May May May May May 1 1 1 1 1 18:55 18:55 18:55 18:55 18:55 hid hiddev hub usb usbfs ...
Modern Linux distributions using the 2.6 kernel create device nodes dynamically on the fly as they are needed. It is basically a hotplug system, giving a lot more power to the user to determine what happens when a device is probed or opened. It is also a lot more complicated. Some early 2.6 distributions (Fedora Core 3, for one) do not include hiddev rules in their default udev rule set.
533 ? S 0:00 devfsd /dev What complicates the situation much more on Mandrake kernels is their security level since CONFIG_DYNAMIC_USB_MINORS is turned on, but on higher security levels devfs is turned off. The net result, is that in those situations hiddev is completely unusable so apcupsd will not work. So, in these cases, the choices are: 1. Reduce the security level setting of the system (not sure if this is possible after the initial install). 2.
Enable: ugen This is the default configuration for a GENERIC kernel on many platforms so you most likely will not need to recompile. NetBSD (v3.x and below) (you will lose use of USB keyboard and mouse) Disable: uhidev, ums, wsmouse, ukbd, wskbd, uhid Enable: ugen NetBSD (v4.0 and above) You can use apcupsd on single USB port without disabling the USB keyboard and mouse on other ports, though all other devices will be disabled on the port you pick for your UPS.
# usbdevs -d addr 1: UHCI root hub, VIA uhub0 addr 2: Back-UPS RS 1500 FW:8.g6 .D USB FW:g6, American Power Conversion ugen0 Device Nodes Apcupsd communicates with the UPS through the USB generic device, ugen. You may or may not need to manually make ugen device nodes in /dev, depending on what OS you are using. FreeBSD No manual intervention needed. FreeBSD automatically creates the ugen nodes on demand. NetBSD By default, NetBSD only creates nodes for the first ugen device, ugen0.
You also should build using the gcc compiler and ccs make, not Sun's compiler. The appropriate make utility can be found in /usr/ccs/bin. gcc can be installed from packages included on the Solaris installation CDROMs. Configure and build Apcupsd normally, as described in Building and Installing Apcupsd. Be sure to include the --enable-usb flag to configure. After building, install Apcupsd as root using 'make install', then perform a reconfigure boot ('reboot -- -r').
After building, install Apcupsd as root using 'make install' and then reboot. During installation, Apcupsd will automatically install a simple dummy kext driver designed to prevent Apple's monitoring software from taking over the UPS. It is necessary to reboot in order to activate the kext. Note that this kext will be automatically removed if you uninstall Apcupsd using 'make uninstall', allowing Apple's monitoring tool to once again access the UPS.
apcupsd requires gcc and g++ compilers as well as GNU make. Other compilers or BSD make will not work. GNU make is sometimes installed as gmake. The configure script will check for this and will inform you of what command to use to invoke GNU make. The basic installation from a tar source file is rather simple: 1. Unpack the source code from its tar archive. 2. Go into the directory containing the source code. 3. Run './configure' (with appropriate options as described below) 4.
Verifying a Source Installation There are a number of things that you can do to check if the installation (make install) went well. The fist is to check where the system has installed apcupsd using 'which' and 'whereis'. On my Red Hat system, you should get the following (lines preceded with a $ indicate what you type): $ which apcupsd /sbin/apcupsd $ whereis apcupsd apcupsd: /sbin/apcupsd /etc/apcupsd /etc/apcupsd.conf /etc/apcupsd.status /usr/man/man8/apcupsd.8.gz /usr/man/man8/apcupsd.
varies from system to system. Other systems such as Solaris require you the make the changes manually, which has the advantage that you won't have any unpleasant surprises in your halt script should things go wrong. Please consult the specific system dependent README files for more details. Please note that if you install from RPMs for a slave machine, you will need to remove the changes that the RPM install script made (similar to what is noted above) to the halt script.
--enable-snmp --enable-net-snmp --enable-pcnet --enable-modbus Turns on generation of the SNMP driver. This driver accesses the UPS over the network using SNMP. This is compatible only with UPSes equipped with an SNMP or Web/SNMP management card. By default this is enabled. Turns on generation of the obsolete NET-SNMP driver. This driver was the precursor to the current snmp driver and is now obsolete. It is available as a fallback if the new driver cannot be used for some reason.
--with-pwrfail-dir=path --with-serial-dev=device-name --with-nis-port=port --with-nisip=ip-address --with-net-port=port --with-upstype=type --with-upscable=cable --disable-install-distdir This option allows you to specify where apcupsd will create the powerfail file when a power failure occurs. The default is system dependent but usually /etc. This option allows you to specify where apcupsd will look for the serial device that talks to the UPS. The default is system dependent, but often /dev/ttyS0.
For most systems, we recommend the following options: ./configure --prefix=/usr --sbindir=/sbin --enable-usb and you can optionally build and install the CGI programs as follows: ./configure --prefix=/usr --sbindir=/sbin --enable-usb \ --enable-cgi --with-cgi-bin=/home/httpd/cgi-bin Compilers and Options Some systems require unusual options for compilation or linking that the './configure' script does not know about. You can specify initial values for variables by setting them in the environment.
• SUSE (see SUSE) • Solaris (see Sun Solaris) • unknown (see Unknown System) • Win32 (see Windows Systems) Debian This port is complete and is being used by several users. Since Debian build and install procedures are somewhat particular, we have put the extra Debian information into the following two subdirectories: platforms/debian/examples and platforms/debian/packageinfo You can also find the official Debian packages on the Debian site at: • https://packages.debian.org/stable/apcupsd • https://packages.
Slackware Slackware systems are fully supported, and by following the standard installation instructions given above, you should experience few or no problems. SUSE SUSE systems are fully supported, and by following the standard installation instructions given above, you should experience few or no problems. Sun Solaris Please read this before attempting to compile or install the beta software. It contains important information that will make your efforts easier. Before running '.
At the very end of the /sbin/rc0 script, you should find lines just like the following: # unmount file systems. /usr, /var and /var/adm are not unmounted by umountall # because they are mounted by rcS (for single user mode) rather than # mountall. # If this is changed, mountall, umountall and rcS should also change. /sbin/umountall /sbin/umount /var/adm >/dev/null 2>\&1 /sbin/umount /var >/dev/null 2>\&1 /sbin/umount /usr >/dev/null 2>\&1 echo 'The system is down.
depending on which com port your UPS is attached to. Then sync and shutdown the system normally, reattach the UPS, and reboot. This should solve the problem. However, we have some reports that recent versions of Solaris (7 & 8) appear to have removed this eeprom option and there seems to be no way to suppress the serial port probing during boot. At this point, you should have a complete installation. The daemon will load automatically at the next boot.
This is not the normal behavior of most computers as shipped from the factory. Normally after the power is cut and restored, you must explicitly press a button for the power to actually be turned on. You can test your computer by powering it down; shutting off the power (pull the plug); then plugging the cord back in. If your computer immediately starts up, good. There is nothing more to do.
To stop apcupsd you can do the following: On Red Hat systems: /etc/rc.d/init.d/apcupsd stop On SUSE systems: /etc/rc.d/apcupsd stop Please see the Testing Apcupsd chapter for more details on insuring that apcupsd is running properly. Configuration Examples A Simple USB Configuration If you have a USB UPS, the essential elements of your apcupsd.conf file should look like the following: ## apcupsd.conf v1.
computer will be immediately shutdown. This is an unfortunate consequence of the dumb signaling mode. To avoid this, first replace /etc/apcupsd/apccontrol with safe.apccontrol found in the examples directory, then test until everything works correctly. Once you have the correct cable, be sure to remember to reinstall the correct apccontrol file and test that your computer is correctly shutdown during a power failure. ## apcupsd.conf v1.
server decides to shutdown and the time it no longer responds. Your slave must poll during this interval. Any client run using the Net driver will shutdown when its own timers expire or when the NIS server shuts down, whichever occurs first. This means that if you want the slave to shutdown before the server, you need only set BATTERYLEVEL, MINUTES or TIMEOUT on the client for a faster shutdown than the values defined on the NIS server.
behavior. You may need to take steps to ensure networking stays active during your OS's shutdown sequence in order for the PCNET driver to power off the UPS (the so-called "killpower" operation). On a Linux distro, you can use commands such as... chkconfig --level 0 network on chkconfig --level 0 iptables on ...to make sure networking stays up. MODBUS Driver MODBUS is APC's replacement for the aging 'apcsmart' (aka UPS-Link) protocol. It is recommended for modern (ex: SMT series) Smart-UPS models. As of 3.
Testing Apcupsd The following testing procedures apply for the most part to SmartUPSes, whether USB or serial. If you have a dumb voltage-signalling UPS, your testing procedures will be somewhat different, and you should see the section on Testing Serial UPSes (see Testing Serial-Line UPSes). Process-Status Test After you start apcupsd, execute the following command: ps fax or the equivalent for your system. You should see something similar to the following output.
apcaccess status Depending on the type of UPS you have, you will get slightly different output, but an example For a Smart-UPS is as follows: APC DATE HOSTNAME RELEASE CABLE MODEL UPSMODE UPSNAME LINEV MAXLINEV MINLINEV LINEFREQ OUTPUTV LOADPCT BATTV BCHARGE MBATTCHG TIMELEFT MINTIMEL SENSE DWAKE DSHUTD LOTRANS HITRANS RETPCT STATFLAG STATUS ITEMP ALARMDEL LASTXFER SELFTEST STESTI DLOWBATT DIPSW REG1 REG2 REG3 MANDATE SERIALNO BATTDATE NOMOUTV NOMBATTV HUMIDITY AMBTEMP EXTBATTS BADBATTS FIRMWARE APCMODEL EN
APC : DATE : RELEASE : UPSNAME : CABLE : MODEL : UPSMODE : STARTTIME: LINEFAIL : BATTSTAT : STATFLAG : END APC : 001,012,0319 Mon Feb 18 09:11:50 CST 2002 3.8.5 UPS_IDEN APC Cable 940-0128A BackUPS Stand Alone Mon Feb 18 09:11:45 CST 2002 OK OK 0x008 Status Flag Mon Feb 18 09:15:01 CST 2002 If you see the above output, it is a good sign that apcupsd is working.
Plug the serial port plug back into your computer, and within about 12 seconds, apcupsd should reestablish communications and broadcast and log the following message: Communications with UPS restored. If these messages are logged but not broadcast, either you have your mesg permission set to no (see 'man wall' or 'man mesg'), or there is a problem with apccontrol. If you are running a window manager such as GNOME and don't have a console window open, you may not receive the wall messages.
If you do not observe the above messages, please correct the situation before proceeding. The most likely cause of problems are: • apcupsd doesn't recognize the power failure because the configuration directives are not correct. E.g. wrong cable. • The file /etc/apcupsd/apccontrol doesn't exist or is not marked as executable. System Shutdown Test This is an intermediate test that you can do, for all UPS models before doing the Full Power Down Test.
apctest apctest is a program that allows you to talk directly to your UPS and run certain low-level tests, adjust various settings such as the battery installation date and alarm behavior, and perform a battery runtime calibration. Here we describe how to use it for a SmartUPS utilizing the apcsmart driver and RS232 serial connection. The menus and options for USB, MODBUS, and simple signaling UPSes are different but mostly self-explanatory. Shutdown apcupsd if it is running. This is important.
Item 5 is used to program the EEPROM. Please see the Configuration Directives Used to Set the UPS EEPROM chapter of this manual for the details. Item 6 will initiate a direct communication between your terminal and the UPS, at which point you can enter raw UPS commands. Please be aware that you should be careful what commands you enter because you can cause your UPS to suddenly shutdown, or you can modify the EEPROM in a way to disable your UPS.
DATE HOSTNAME RELEASE CABLE MODEL UPSMODE UPSNAME LINEV MAXLINEV MINLINEV LINEFREQ OUTPUTV LOADPCT BATTV BCHARGE MBATTCHG TIMELEFT MINTIMEL SENSE DWAKE DSHUTD LOTRANS HITRANS RETPCT STATFLAG STATUS ITEMP ALARMDEL LASTXFER SELFTEST STESTI DLOWBATT DIPSW REG1 REG2 REG3 MANDATE SERIALNO BATTDATE NOMOUTV NOMBATTV HUMIDITY AMBTEMP EXTBATTS BADBATTS FIRMWARE APCMODEL END APC : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Fri Dec 03 12:34:26 CET 1999 matou 3.7.
When a major event is generated within apcupsd, control is passed to the script apccontrol normally found in /etc/apcupsd/apccontrol. The event name, and a number of other important parameters are passed to the script. The major function of the apccontrol script is to perform a shutdown of the system (as well as the killpower operation). In addition, another major task for this script is to notify you by email when certain events such as powerfail occur.
./multimon.cgi If everything is set up correctly, it will print a bunch of HTML with the values of the machines that you have put in the hosts.conf file. It should look something like the following (note, only a small portion of the output is reproduced here): Content-type: text/html PAGE 46
to relocate hosts.conf and apcupsd.css \apcupsd\etc\apcupsd on the appropriate drive. from the apcupsd install location to multimon.cgi This program monitors multiple UPSes at the same time. A typical output of multimon.cgi as displayed in your Web browser might look like the following: The machines monitored as well as the values and their column headings are all configurable (see /etc/apcupsd/hosts.conf and /etc/apcupsd/multimon.conf) upsstats.cgi By clicking on the system name in the multimon.
LINEFREQ OUTPUTV LOADPCT BATTV BCHARGE MBATTCHG TIMELEFT MINTIMEL SENSE DWAKE DSHUTD LOTRANS HITRANS RETPCT STATFLAG STATUS ITEMP ALARMDEL LASTXFER SELFTEST STESTI DLOWBATT DIPSW REG1 REG2 REG3 MANDATE SERIALNO BATTDATE NOMOUTV NOMBATTV HUMIDITY AMBTEMP EXTBATTS BADBATTS FIRMWARE APCMODEL END APC : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 50.0 Hz 223.6 Volts 6.2 Percent Load Capacity 27.9 Volts 100.0 Percent 5 Percent 167.
Security Issues: • apcupsd runs as root. • If you have NETSERVER ON in your apcupsd.conf file (which is the default), be aware that anyone on the network can read the status of your UPS. This may or may not pose a problem. If you don't consider this information privileged, as is the case for many, there is little risk. In addition, if you have a perimeter firewall or NATting router with typical settings only users on your local network access to your UPS information.
appropriate. AGM has became the preferred VRLA technology for use in standby or float applications and is used in UPSes in the telecommunications, power, and many other mission critical industries where the power supply must not be interrupted. APC UPSes use VRLA batteries. VRLA batteries are designed to recombine hydrogen and oxygen and emit only extremely small amounts of hydrogen under normal operating conditions.
In the event of a RMS voltage-out-of-tolerance disturbances(High/Low/No) in the line voltage, the UPS will transfer to battery power and watch the AC line until it can transfer back to line. In this mode the transfer times are longer but still within acceptable limits to insure the continuity of a computer's operation. To change the sensitivity of the UPS, press the small, white "sensitivity" button on the rear of the UPS. Use a pointed object (such as a pen) to do so.
• Use of a third party battery may void UL, CSA, VDE, and other safety certifications (according to APC) If you do decide to use third party replacement batteries, please do not choose the cheapest available generic SLA batteries. These batteries will, almost without exception, not last as long as brand name batteries and will need replacing within 12-18 months instead of 3-5 years.
4. Matrix-UPS and Smart-UPS recalculate the runtime-related parameters every time the UPS goes on battery. When doing a runtime calibration with "older" batteries, APC Technical Support recommend doing a complete discharge and recharge first. If you have "dumb" UPS (aka simple signalling) like a Back-UPS, then your only option is to do a manual runtime calibration. "Manual" Runtime Calibration Most of the information in this section is taken from APC's website.
The unit will then go to battery power until the capacity is 25%. After this run time has been completed, the original Estimated Run Time is compared with the actual run time. It will then increase or decrease this value to correspond to the new run time achieved. If, at any time during the discharge, one of the following rules is violated the calibration will be aborted or corrupted: 1. Battery capacity must be 100% at start of calibration (all packs must indicated as float). 2.
SU1400RM SU1400R2IBX135 SU1400RMXLI3U SU1400RMXLI3U SU2200I SU2200XL,3000 SU3000RMXLI3Ublk SU5000I white SU1400XL,XLI,RM SU420I SU420SI SU620I BP420SI BP650SI Power Stack 250 Power Stack 450 SC250RMI1U SC420I SC620I SC1000I SC1500I SU1000XL MATRIX 3000,5000 SU700RMI2U SU1000RMI2U SU1400RMI2U SUA1000I SUA1000XLI SUA750XLI SUA750I SUA750RMI2U SUA1500I SUA1500RMI2U SUA2200I SUA2200RMI2U SUA2200XLI SUA3000RMI2U SUA3000RMXLI3U SUOL1000I SUOL2000XL SURT1000XLI SURT3000XLI SURT5000XLI SURT7500XLI SURT10000XLI SUM1
5. Enter 1 (one, not el; wait 4 seconds); 6. Enter 1 (one, not el; UPS should respond PROG); 7. Enter 0 (zero, not oh; UPS should respond with current constant); 8. Write down the existing value so that if something goes wrong, you can at least put it back to that value; 9. Enter + (plus) or - (minus) to increment/decrement the value; 10. Enter R to reprogram constant value (UPS should respond Bye); 11. Enter Y (UPS should respond SM); 12.
Question: Answer: Question: What language is apcupsd written in? It is written in C and C++. To test apcupsd, I unplugged the UPS to simulate a power outage. After the machine went into the shutdown process I plugged the UPS back into the commercial power source. This caused the shutdown process to hang after the daemon tried to shut-off the ups.
Customizing Event Handling When apcupsd detects anomalies from your UPS device, it will make some decisions that usually result in one or more calls to the script located in /etc/apcupsd/apccontrol. The apccontrol file is a shell script that acts on the first argument that apcupsd passes to it. These actions are set up by default to sane behavior for all situations apcupsd is likely to detect from the UPS. However, you can change the apccontrol behavior for every single action.
changeme When apcupsd detects that the mains are on, but the battery is not functioning correctly, this event is generated. It is repeated every x hours. Default: wall a message commfailure This event is generated each time the communications line with the computer is severed. This event is not detected on dumb signaling UPSes. Default: wall a message commok After a commfailure event is issued, when the communications to the computer is re-established, this event will be generated.
This event is generated on a slave machine when it detects either that the master has shutdown, or that a onbattery situation exists and the communications line has been severed. Default: wall a message runlimit This event is generated when the MINUTES value defined in the apcupsd.conf file expires while in a power fail condition. The MINUTES is the remaining runtime as internally calculated by the UPS and monitored by apcupsd.
I have two apcupsd.conf files (this is for a 2 UPS setup, easily expandable to N): [adk0212@mail apcupsd]$ ls -l /etc/apcupsd/*.conf -rw-r--r-- 1 root root 11799 Aug 3 08:39 /etc/apcupsd/apcupsd.ups0.conf -rw-r--r-- 1 root root 11822 Aug 25 14:31 /etc/apcupsd/apcupsd.ups1.conf In my case, ups0 is the UPS powering the UPS server running the multiple apcupsd instances, so only ups0 should initiate a shutdown of the local machine.
generate status email from NISPORT 3552 instead of 3551. I also have a custom init.d start/stop script to manage multiple instances. The start, stop, and status handlers are modified to iterate over all /etc/apcupsd/apcupsd.*.conf files. This is derived from the standard apcupsd redhat rc script: #! /bin/sh # # apcupsd This shell script takes care of starting and stopping # the apcupsd UPS monitoring daemon.
sleep 15 $0 start ;; reload) echo "$0: reload not implemented" exit 3 ;; status) for conf in /etc/apcupsd/apcupsd.*.conf ; do inst=`basename $conf` status -p /var/run/apcupsd-$inst.pid apcupsd-$inst RETVAL=$? if [ $RETVAL -eq 0 ] then NISPORT=`grep ^NISPORT < $conf | sed -e "s/NISPORT *\([0-9]\)/\1/"` /sbin/apcaccess status localhost:$NISPORT | egrep "(STATUS)|(UPSNAME)" fi done ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 ;; esac exit 0 That's about all there is to it.
The Network Management Card (AP9617, AP9618, AP9619) must be configured with network settings before it can communicate on the network. Once the cards have been configured with an IP address, Subnet Mask, and Default Gateway the cards can be access, managed, and controlled from other computers on the network. There are two ways to configure the Network Management Card (NMC) with its initial settings: the (windows) Wizard and Address Resolution Protocol (ARP). 1.
------- Control Console ------------------------------------------------------1234- Device Manager Network System Logout - Main Menu, - Refresh, - Event Log > ******************************************************************************* Select Option 2 for Network. Next select Option 1 for TCP/IP settings. At this point the following settings will be to be specified: • Verify System IP: • Specify Subnet Mask: i.e. "225.225.225.
By default, APCUPSD will poll the SNMP UPS card once per minute. In this case, server notification of UPS alarms could potentially be delayed one minute. Event trap catching mitigates this shortcoming. Any UPS alarms are instantly sent to prescribe servers connected SNMP UPS. These servers are referred to as Event Trap Receivers. The SNMP UPS card can be configure to send event traps to a maximum of four receivers that will "catch" these events.
SNMP Trap Catching apcupsd-3.11.14 introduces support for SNMP trap catching. Previous versions polled the UPS status once per minute, leading to significant delays before UPS state changes were recognized. With SNMP trap handling, apcupsd monitors the SNMP trap port and will re-poll the UPS whenever a trap is received. This happens, for example, when the UPS switches on or off battery. In order for this feature to work, you must configure your UPS to deliver traps to the server running apcupsd.
4. EVENTS Debug logging consists of debug messages. Normally these are turned on only by developers, and currently there exist very few of these debug messages. Data Logging This feature is somewhat outdated and not often used. Data logging consists of periodically logging important data concerning the operation of the UPS. For the definitive definition of the format, see log_data() in apcreports.c. The format varies according to the UPS model and the information available from the UPS.
The default Facility for syslog() logging is DAEMON, although this can be changed with the FACILITY directive in apcupsd.conf. In the following example, we should the facility as local0. More work needs to be done to the code to ensure that it corresponds to the above levels. As a practical example of how to setup your syslog() to use the new logging feature, suppose you wish to direct all DATA logging to a file named /var/log/apcupsd.
(apcsmart, dumb, net, snmp, pcnet) and can be used simply by editing the configuration file UPSCABLE, UPSTYPE, and DEVICE settings as described elsewhere in this manual. Note that on Windows, serial ports are specified using COM1, COM2, etc. notation instead of the UNIX-style /dev/tty* notation. Note also if you are using WinNT or Win2000, the operating system may probe the serial port attempting to attach a serial mouse. This will cause apcupsd to be unable to communicate with the serial port.
Starting with version 3.14.2, the tray icon is provided by a separate program called 'apctray'. This cleanly separates the user interface from the daemon (service) and is required for tray icon support on Windows Vista. Note that if you close or disable the tray icon this does not stop or disable the apcupsd service which will continue to monitor the UPS and shutdown the computer when appropriate. To stop or disable the service, use the service control panel.
Regardless of which Windows system you are running, apcupsd logs most error messages to c:\apcupsd\etc\apcupsd\apcupsd.events. This type error messages such as configuration file not found, etc are written to this file. Note that on some systems (WinXP, possibly others) Apcupsd is unable to write to this file when running as a service.
advantage that in a power fail situation, if the killpower function described above does not work, the computer will continue to draw down the batteries and the UPS will hopefully shutoff before the power is restore thus permitting an automatic reboot. Nevertheless some people prefer to do a full power down. To do so, you might want to get a copy of PsShutdown, which does have a power down option. You can find it and a lot more useful software at: http://technet.microsoft.com/en-us/sysinternals/bb897541.
pointing this out to me.) The device that Joe Acosta and Kern are using is IOgear GUC232A USB 2 serial adapter. Bill Marr informs us that it also works with a Back-UPS Pro 650 and the 940-0095B cable. At Kern's site, running Red Hat 7.1 with /etc/apcupsd/apcupsd.conf configuration line to be: kernel 2.4.9-12, he simply changed his DEVICE /dev/ttyUSB0 Depending on whether or not you have hotplug working, you may need to explicitly load the kernel modules usbserial and pl2303.
• Make sure you are doing your testing as root otherwise, you may have permissions problems accessing the serial port. • You may have cabling problems, either with an incorrect cable, or the incorrect cable specification directive in the configuration file. • You may have a problem with the /etc/apcupsd/acpupsd.conf file. For example, check that you have specified the correct type of UPS and the correct networking directives. For more details, see the After Installation section.
In one case, a user reported that he received random incorrect values from the UPS in the status output. It turned out that gpm, the mouse control program for command windows, was using the serial port without using the standard Unix locking mechanism. As a consequence, both apcupsd and gpm were reading the serial port. Please ensure that if you are running gpm that it is not configured with a serial port mouse on the same serial port.
CTS GND DCD RTS 8 5 1 7 ----------*------------------------------------------------------------------ 5 4 2 1 Low Battery Ground On Battery Kill UPS Power List of components one needs to make the Simple cable: 1. One (1) male DB9 connector, use solder type connector only. 2. One (1) female DB9/25F connector, use solder type connector only. 3. One (1) 4.7K ohm 1/4 watt 5% resistor. 4. rosin core solder. 5. three (3) to five (5) feet of 22AWG multi-stranded four or more conductor cable.
APCUPSD SIMPLE-CUSTOM CABLE Computer Side DB9f | DB25f 4 | 20 8 | 5 2 | 3 5 | 7 1 | 8 7 | 4 n/c | 1 | | | | | | | | | Description of Cable DTR (5vcc) *below CTS (low battery) *below RxD (no line voltage) *below Ground (Signal) CD (on battery from UPS) RTS (kill UPS power) Frame/Case Gnd (optional) | | | | | | | | | UPS DB9m n/c <- 5 <- 3 4 <- 2 -> 1 9 Side | DB25m | | 7 | 2 | 20 | 3 | 8 | 22 Note: the <- and -> indicate the signal direction.
| . . . . . . . . . . | | | ----------------------|____| For the serial port DB9F connector, the pin numbers are stamped in the plastic near each pin. In addition, there is a diagram near the end of this chapter. Note, one user, Martin, has found that if the shield is not connected to the Frame Ground in the above diagram (not in our original schematic), the UPS (a BackUPS CS 500 EI) will be unstable and likely to rapidly switch from power to batteries (i.e. chatter).
Apparently, all APC voltage-signalling UPSes with DB9 serial ports have the same signals on the output pins of the UPS. The difference at the computer end is due to different cable configurations. Thus, by measuring the connectivity of a cable, one can determine how to program the UPS. The signals presented or accepted by the UPS on its DB9 connector using the numbering scheme listed above is: UPS Pin 1 <2 -> 3 5 6 7 -> -> -> <- Signal meaning Shutdown when set by computer for 1-5 seconds.
Contributed by: Lazar M. Fleysher Although we do not know what the black box semiconductor contains, we believe that we understand its operation (many thanks to Lazar M. Fleysher for working this out). This cable can only be used on voltage-signalling UPSes, and provides the On Battery signal as well as kill UPS power. Most recent evidence (Lazar's analysis) indicates that this cable under the right conditions may provide the Low Battery signal. This is yet to be confirmed.
following diagram is correct. This diagram is for informational purposes and may not be complete. We don't recommend that use it to build you build one yourself. APC Part# - 940-0023A Signal Computer UPS DB9F DB9M DCD 1 -------------------- 2 On Battery TxD 3 DTR GND 4 5 3.
47k 47k BATTERY-LOW (5) >----R1----*----R2----*----< DTR,DSR,CTS (4,6,8) | | | | | / E | |/ | B | *-------| 2N3906 PNP | |\ \ C | | *----< DCD (1) Low Batt | | R 4.7k 3 | 4.7k | SHUTDOWN (1) >----------*----R4----*----< TxD (3) | | 1N4148 *----K|---------< RTS (7) Shutdown POWER-FAIL (2) >--------------------------< RxD,RI (2,9) On Batt GROUND (4,9) >--------------------------< GND (5) Operation: • DTR is "cable power" and must be held at SPACE.
This diagram is for informational purposes and may not be complete. We don't recommend that use it to build you build one yourself. APC Part# - 940-0095B Signal Computer UPS DB9F DB9M DTR 4 ----* CTS 8 ----| DSR 6 ----| DCD 1 ----* GND 5 ---------------*---- 4 | *---- 9 RI 9 ----* | RxD 2 ----*--------------- 2 TxD 3 ----------[####]---- 1 4.
6 DTR -> 6 --+---->|----/\/\/\---o kill power 1 DCD <- 2 RxD <- 7 RTS -> 8 RI <- 9 CTS <- 1 --+ | 2 --+----------------+--o low battery | 7 --------+--/\/\/\--+ | +--/\/\/\--+ | 8 --+----------------+--o on battery | 9 --+ 5 GND --- 5 ----------------------o ground 3 TxD 3 nc 940-0128A Cable Wiring Supported Models: Contributed by: Older USB BackUPS ES and CS Many, thanks to all for your help! Though these UPSes are USB UPSes, APC supplies a serial cable (typically with a green
| +--/\/\/\--+ | | | | 8 RI <-|----+----------------+--o on battery | | | | 9 CTS <-|----+ | | signal | 5 GND --|-----------------------o ground | | | 3 TxD | | | chassis | Chassis/GND |-----------------------o ground | | | | Not connected | -------------------------------------- 2 Black 7 Red 4 Black 1, 5, 6, 9, 10 The RJ45 pins are: looking at the end of the connector: 10 9 8 7 6 5 4 3 2 1 _______________________ | . . . . . . . . . .
+---vvvv---+--[>|------<(3)LowBatt | | +--- C | \|___| /| B DCD(1)<------- E 2N2222(NPN) DTR(4)>-------------------------->(8)KillPwr GND(5)----------------------------(7)Signal GND (Shield)--------------------------(4)Chassis GND 940-0127B Cable Wiring Supported Models: Contributed by: BackUPS XS1000(BX-1000), Possibly other USB models Jan Babinski jbabinsk at pulsarbeacon dot com Standard USB cable for USB-capable models with 10-pin RJ45 connector.
If you wish to have the UPS recalibrate the remaining runtime calculations, you can do so manually as the current version of apcupsd does not support this feature. To do so, • Shutdown apcupsd • contact your UPS directly using some terminal program such as minicom, tip, or cu with the settings 2400 8N1 (2400 baud, 8 bits, no parity, 1 stop bit). Be extremely careful what you send to your UPS as certain characters may cause it to power down or may even cause damage to the UPS.
Specify which device is used for UPS communications. For serial ports, it is usually something like /dev/ttyS0. For USB ports, you may leave the name of the device blank (no specification) and apcupsd will automatically search the standard locations for the UPS. Normally, the configure program will set an appropriate default value. You may also specify the --with-serial-dev= option of the configure program to set this directive at build time.
apcevents.c and changing the appropriate defines. Be aware that if you set these values to very large numbers, apcupsd may make excessive memory demands on the system during the data access and file truncation operations. This filename may also be specified at build time by using the --with-log-dir= option of the configure program. Configuration Directives used during Power Failures In general, none of these directives are required.
is reset when the power returns. The default is 60 seconds. Thus, the first warning to log off the system occurs after 60 seconds on batteries, assuming that NOLOGON is not set to disable. NOLOGON disable | timeout | percent | minutes | always Specifies when apcupsd should prevent user logins The type specified allows you define the point when apcupsd will create the 'nologin' file and thus when user logins are prohibited. Once the 'nologin' file is created, normal users are prevented from logging in.
When apcupsd shuts down your system, it creates a temporary "flag file" which is used by the operating system halt scripts to know if this shutdown is due to a power failure. This directive configures which directory the flag file will be written into. The chosen directory must be writable by the user apcupsd is running as (normally root) and must not be cleared or unmounted early in the shutdown sequence.
BATTDATE [ mm/dd/yy | dd/mm/yy ] Last battery replacement date. Maximum of 8 characters. SENSITIVITY [ H | M | L ] H : High (most sensitive setting) M : Medium L : Low (least sensitive setting) WAKEUP [ 000 | 060 | 180 | 300 ] The time delay in seconds that the UPS waits after the return of utility power before "waking up" and restoring power to the connected equipment.
UPS nominal output voltage when running on battery. Allowable values depend on the last letter of the firmware or APCMODEL. Typical values are: D M A I 115 208 100 230 240 220 225 where D = domestic (USA), M = Canada, A = Asia and I = International. SELFTEST [ 336 | 168 | ON | OFF ] Self test interval in hours (336 = 2 weeks, 168 = 1 week, ON = at power on, OFF = never). apcupsd Status Logging There is a good deal of information available about the UPS and apcupsd's status.
VERSION : UPSNAME : CABLE : MODEL : UPSMODE : STARTTIME: STATUS : LINEV : LOADPCT : BCHARGE : TIMELEFT : MBATTCHG : MINTIMEL : MAXTIME : SENSE : LOTRANS : HITRANS : ALARMDEL : BATTV : LASTXFER : NUMXFERS : TONBATT : CUMONBATT: XOFFBATT : SELFTEST : STATFLAG : MANDATE : SERIALNO : BATTDATE : NOMINV : NOMBATTV : FIRMWARE : APCMODEL : END APC : 3.14.2 (10 September 2007) redhat ups0 USB Cable Back-UPS RS 1500 Stand Alone Sun Apr 26 10:22:46 EDT 2009 ONLINE 123.0 Volts 24.0 Percent Load Capacity 100.
The UPS model as derived from information from the UPS. UPSMODE The mode in which apcupsd is operating as specified in the configuration file (UPSMODE) STARTTIME The time/date that apcupsd was started. STATUS The current status of the UPS (ONLINE, ONBATT, etc.) LINEV The current line voltage as returned by the UPS. LOADPCT The percentage of load capacity as estimated by the UPS. BCHARGE The percentage charge on the batteries. TIMELEFT The remaining runtime left on batteries as estimated by the UPS.
RETPCT The percentage charge that the batteries must have after a power off condition before the UPS will restore power to your equipment. ITEMP Internal UPS temperature as supplied by the UPS. ALARMDEL The delay period for the UPS alarm. BATTV Battery voltage as supplied by the UPS. LINEFREQ Line frequency in hertz as given by the UPS. LASTXFER The reason for the last transfer to batteries. NUMXFERS The number of transfers to batteries since apcupsd startup.
The UPS serial number. BATTDATE The date that batteries were last replaced. NOMOUTV The output voltage that the UPS will attempt to supply when on battery power. NOMINV The input voltage that the UPS is configured to expect. NOMBATTV The nominal battery voltage. NOMPOWER The maximum power in Watts that the UPS is designed to supply. HUMIDITY The humidity as measured by the UPS. AMBTEMP The ambient temperature as measured by the UPS. EXTBATTS The number of external batteries as defined by the user.
The shutdown sequence is as follows: • apcupsd detects that there is a power problem and it calls /etc/apcupsd/apccontrol powerout. By default this event does nothing, but it can be overridden to notify users, etc. • After the configured ONBATTERYDELAY, apcupsd calls /etc/apcupsd/apccontrol onbattery, which normally sends a message to all users informing them that the UPS is on batteries.
The above code must be inserted as late as possible in the halt script. On many systems, such as Red Hat, all the disk drives were unmounted, then remounted read-only, thus permitting access to the /etc files and the apcupsd executable. If your system does not explicitly remount the disks, you must remount them in read-only mode in the code that you add. Examples of code fragments that do this can be found in the distributions/suse subdirectory of the source.
Windows Considerations Please see the Killpower under Windows chapter of this manual for considerations pertaining to shutdown and killpower on Windows. APC smart protocol The APC UPS protocol was originally analyzed by Pavel Korensky with additions from Andre H. Hendrick beginning in 1995, and we want to give credit for good, hard work, where credit is due. After having said that, you will see that Steven Freed built much of the original apcupsd information file.
C Internal Temperature 036.0 Units are degrees C D Runtime calibration !, then $ Runs until battery is below 25% (35% for Matrix) Updates the 'j' values. Only works at 100% battery charge. Can be aborted with a second "D" E Automatic self test interval 336 Writable variable. Possible values: • "336" (14 days) • "168" (7 days) • "ON " (at power on) note extra space F Line frequency 60.00 • "OFF" (never) Units are Hz. Value varies based on locality, usually 50/60.
R Turn dumb BYE Only on 3rd gen SmartUPS, SmartUPS v/s, BackUPS Pro. Must send enter smart mode command to resume comms. S Soft shutdown OK Command executes after grace period. UPS goes online when power returns. Only works when on battery. U Simulate power failure !, then $ See Alert messages section for info on ! and $. V Old firmware revision "GWD" or "IWI" See Interpretation of the Old Firmware Revision W Self test OK Tests battery, like pushing button on the front panel.
f Battery level % 099.0 Percentage of battery charge remaining g Nominal battery voltage 024 The battery voltage that's expected to be present in the UPS normally. This is a constant based on the type, number, and wiring of batteries in the UPS. Typically "012", "024" or "048". h Measure-UPS ambient humidity (%) 042.4 Percentage. Only works on models with Measure-UPS SmartSlot card. i Measure-UPS dry contacts 00 Bitmapped hex variable.
t Measure-UPS ambient temperature 80.5 Degrees C. Only works on models with the Measure-UPS SmartSlot card. u Upper transfer voltage 132 Writable variable. UPS goes on battery when voltage rises above this point. v Measure-UPS firmware 4Kx Firmware information for Measure-UPS board x Last battery change date 11/29/96 Writable variable. Holds whatever the user set in it. Eight characters.
[ Measure-UPS Upper temp limit NO,NO Degrees C. Writable Variable. Possible values: 55, 50, 45, ..., 05. Use +/- to change values. ] Measure-UPS lower temp limit NO,NO Degrees C. Writable Variable. Possible values: 55, 50, 45, ..., 05. Use +/- to change values. { Measure-UPS Upper humidity limit NO,NO Percentage. Writable Variable. Possible values: 90, 80, 70, ..., 10. Use +/- to change values. } Measure-UPS lower humidity limit NO,NO Percentage. Writable Variable.
Dip switch info Bit Switch Option when bit=1 0 4 Low battery alarm changed from 2 to 5 mins. Autostartup disabled on SU370ci and 400 1 3 Audible alarm delayed 30 seconds 2 2 Output transfer set to 115 VAC (from 120 VAC) or to 240 VAC (from 230 VAC) 3 1 UPS desensitized - input voltage range expanded 4-7 Unused at this time Status bits This is probably the most important register of the UPS, which indicates the overall UPS status.
= Return from abnormal condition Sent when the UPS returns from an abnormal condition where ? was sent, but not a turn-on. Not implemented on SmartUPS v/s or BackUPS Pro models. * About to turn off Sent when the UPS is about to switch off the load. No commands are processed after this character is sent. Not implemented on SmartUPS v/s, BackUPS Pro, or 3rd generation SmartUPS models. # Replace battery Sent when the UPS detects that the battery needs to be replaced.
Register 3 All bits are valid on the Matrix UPS and 3rd generation SmartUPS models. SmartUPS v/s and BackUPS Pro models report bits 0-5. All others report 0-4. State change of bits 1,2,5,6,7 are reported asynchronously with ? and = messages.
Interpretation of the New Firmware Revision New Firmware revision and model ID String in NN.M.L is the format where NN == UPS ID Code. 12 == Back-UPS Pro 650 13 == Back-UPS Pro 1000 52 == Smart-UPS 700 60 == SmartUPS 1000 72 == Smart-UPS 1400 where NN now Nn has possible meanings.
CMD u u u u l l l l e o o o o s q p k r E DFO D M A I D M A I 4 D J I M 4 4 4 4 4 4 RSP 4 4 4 4 4 4 4 4 4 1 1 1 1 4 4 4 4 4 4 FSZ 3 3 3 3 3 3 3 3 2 3 3 3 3 1 2 3 1 3 3 FVL 127 229 108 253 106 177 092 208 00 115 100 230 208 H 02 020 0 000 336 130 234 110 257 103 172 090 204 15 133 239 112 261 100 168 088 200 50 136 224 114 265 097 182 086 196 90 240 220 225 M L L 05 07 10 180 300 600 T L N 060 180 300 168 ON OFF CMD == UPSlink Command.
p The Shutdown Grace Delay q The Low Battery Warning Delay k The Alarm Delay r The Wakeup Delay E The Automatic Self Test Interval The first two cases (Ident and Batt date) are somewhat special in that you tell the UPS you want to change the value, then you supply 8 characters that are saved in the EEPROM. The last ten item are programmed by telling the UPS that you want it to cycle to the next permitted value.
package find the line in the spec file which reads %define rh7 0 and edit it to read %define rh7 1 Alternately you may pass the define on the command line when calling rpmbuild: rpmbuild -ba --define "build_rh7 1" apcupsd.spec rpmbuild --rebuild --define build_rh7 1" apcupsd-x.x.x-x.src.rpm How do I control whether usb support gets built? Up through version 3.12, by default standard serial port support was built and the apcupsd-std package was produced.
Yes, there are tools provided for contributors to supply rpm packages for platforms for which support is provided in the spec file but for which the development team chooses not to release binary packages, usually due to lack of interest or lack of an available platform. Please see platforms/contrib/README in the source package. I'm getting errors about not having permission when I try to build the packages.
Serial Communications Andre Hedrick (andre@linux-ide.org) 2.0 User's Manual Eric S. Raymond (esr@thyrsus.com) Alpha Port Kern Sibbald (kern@sibbald.com) J. Rochate (jrochate@ualg.pt) testing and machine loan Caldera John Pinner (john@clocksoft.com) HP-UX Port Carl Erhorn (Carl_Erhorn@hyperion.com) Robert K Nelson (rnelson@airflowsciences.com) SOLARIS Port Carl Erhorn (Carl_Erhorn@hyperion.com) OpenBSD Port Devin Reade (gdr@gno.org) NetBSD Port Neil Darlow (neil@darlow.co.
modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.