Apcupsd STATUS LoggingThere is a good deal of information available about the UPS and apcupsd's status. This document describes the format of that information.
STATUS formatThe STATUS output is in ASCII format with a single data value or piece of information on each line output. Because not all UPSes supply the same information, the output varies based on the type of UPS that you are using. In general, if the information is not available for your UPS, the data portion of the output record will contain an N/A indicating that the information is not available.
Status logging consists of periodically logging ALL available information concerning the UPS. Since the volume of data is rather large (over 1000 bytes per status), the STATUS data is not automatically sent to the system log file, instead, it is written as a series of data records to a specific file (normally /etc/apcupsd/apcupsd.status).
After each write, the file is rewound so that the size of the file remains constant. At the current time, this file is 1135 bytes. The format of this file is very similar to the old apcupsd procfs file. The STATUS file is kept for backwards compatibility and will be eliminated in a future version of apcupsd. The preferred method for obtaining this information is from apcaccess status or by using the apcupsd network information server.
SmartUpsFrom the following models:
UPSTYPE Descriptive Name =========== ================= newbackupspro Smarter BackUPS Pro backupspropnp Smarter BackUPS Pro smartups SmartUPS matrixups MatrixUPS sharesmart ShareUPS Advanced Port
To make reading the status data reliable via a named pipe, the first record written contains a version number, the number of records that follow the first record, and the total number of bytes in those subsequent records. An actual example of such a status file (/etc/apcupsd/apcupsd.status) is:
Consequently, the first record always consists of 24 bytes (23 characters followed by a newline). This record starts with APC and as indicated in the example above is followed by 28 records consisting of 675 bytes. The last record begins with END APC and contains the date and time matching the DATE record.
Documentation of each record needs to be written. In the coming weeks, I plan to add additional records and possibly change the names of some of the fields.
When this data is written to a file, it is written as two records, the first record, and all the other records together. In reading the file, it can be either be read a record at a time, or in one big read.
When this data is written to syslog(), it is written a record at a time. The first record is the first 24 bytes. By having the number of records and the size in the first record, the complete status can be reliably reassembled.
An example of output from an international SmartUPS 1000 follows:
DATE : Wed Sep 27 17:30:23 CEST 2000 HOSTNAME : polymatou.sibbald.com RELEASE : 3.7.3-20000925 CABLE : Custom Cable Smart MODEL : SMART-UPS 1000 UPSMODE : Stand Alone STARTTIME: Wed Sep 27 10:39:23 CEST 2000 UPSNAME : UPS_IDEN STATUS : ONLINE LINEV : 235.3 Volts LOADPCT : 9.3 Percent Load Capacity BCHARGE : 100.0 Percent TIMELEFT : 130.0 Minutes MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 0 Seconds MAXLINEV : 239.2 Volts MINLINEV : 234.0 Volts OUTPUTV : 236.6 Volts SENSE : High DWAKE : 000 Seconds DSHUTD : 020 Seconds DLOWBATT : 02 Minutes LOTRANS : 196.0 Volts HITRANS : 253.0 Volts RETPCT : 000.0 Percent ITEMP : 32.8 C Internal ALARMDEL : 5 seconds BATTV : 27.9 Volts LINEFREQ : 50.0 Hz LASTXFER : Line voltage notch or spike NUMXFERS : 0 XONBATT : N/A TONBATT : 0 seconds CUMONBATT: 0 seconds XOFFBATT : N/A SELFTEST : NO STESTI : 336 STATFLAG : 0x08 Status Flag DIPSW : 0x00 Dip Switch REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : 07/31/99 SERIALNO : QS9931125245 BATTDATE : 07/31/99 NOMOUTV : 230 NOMBATTV : 24.0 HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : 0 BADBATTS : N/A FIRMWARE : 60.11.I APCMODEL : IWI END APC : Wed Sep 27 17:30:31 CEST 2000
The meaning of the above variables are:
BackUPS Pro and SmartUPS v/s Smart Signals
LINEFAIL : OnlineStatus BATTSTAT : BatteryStatus LINEVOLT : LineVoltageState LASTEVNT : LastEventObserved
BackUPS and NetUPS Simple Signals
LINEFAIL : OnlineStatus BATTSTAT : BatteryStatus
BackUPS Pro and SmartUPS v/s Smart SignalsOnlineStatus BatteryStatus LineVoltageState LastEventObserved
BackUPS and NetUPS Simple SignalsOnlineStatus BatteryStatus
Logging the STATUS InformationIf specified in the configuration file, the STATUS data will also be written to the system log file. Please note, that it would not normally be wise to write this data to a normal system log file as there is no mechanism in syslog() to rewind the file and hence the log file would quickly become enormous. However, in two cases, it can be very useful to use syslog() to write this information.
The first case is to setup your syslog.conf file so that the data is written to a named pipe. In this case, normally not more than about 8192 bytes of data will be kept before it is discarded by the system.
The second case is to setup your syslog.conf file so that the status data is sent to another machine, which presumably then writes it to a named pipe. Consequently, with this mechanism, provides a simple means of networking apcupsd STATUS information.
Although we mention system logging of STATUS information, we strongly recommend that you use the apcupsd network information server to network this information. Also, see the system logging section of this manual.