APC社 (現シュナイダーエレクトリック社)製 UPS を制御する為のソフトウェア
このサイトが本家
プログラムの入手は、SourceForge.orgからダウンロードすることが出来ます。
最新のバージョンは、3.14.10 ですが、リリースされてからかなりの時間が経過しています。 (2011/11/04)
しかも、CentOS 6.x 対応版の RPM は存在しません。
RPM Forge のリポジトリ登録用 RPM をインストールすることにより簡単にインストールすることが出来ます。
32bit 版
rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
64bit 版
rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
インストール
すでに、RPM Forge のリポジトリが登録されているため、下記のコマンドでインストールできるようになります。
yum install apcupsd
APC製 RS-232C ケーブルで接続している場合、設定を特にする必要がありません。
様々な設定を自動で行ってくれるテストプログラムがあります。
※このコマンドは、apcupsd デーモンを起動していると実行できません。
2014-11-06 15:42:21 apctest 3.14.10 (13 September 2011) redhat
Checking configuration ...
Attached to driver: apcsmart
sharenet.type = Network & ShareUPS Disabled
cable.type = Custom Cable Smart
mode.type = APC Smart UPS (any)
Setting up the port ...
apctest FATAL ERROR in device.c at line 71
Unable to create UPS lock file.
If apcupsd or apctest is already running,
please stop it and run this program again.
apctest error termination completed
/sbin/apctest
Checking configuration ...
Attached to driver: apcsmart
sharenet.type = Network & ShareUPS Disabled
cable.type = Custom Cable Smart
mode.type = APC Smart UPS (any)
Setting up the port ...
apctest FATAL ERROR in device.c at line 71
Unable to create UPS lock file.
If apcupsd or apctest is already running,
please stop it and run this program again.
apctest error termination completed
もし、上記メッセージが表示された場合、既にapcupsd デーモンが稼働していますので、一度デーモンを停止する必要があります。
/etc/rc.d/init.d/apcupsd stop
改めて
/sbin/apctest
2013-09-09 14:18:38 apctest 3.14.10 (13 September 2011) redhat
Checking configuration ...
Attached to driver: apcsmart
sharenet.type = Network & ShareUPS Disabled
cable.type = Custom Cable Smart
mode.type = APC Smart UPS (any)
Setting up the port ...
Doing prep_device() ...
You are using a SMART cable type, so I'm entering SMART test mode
Hello, this is the apcupsd Cable Test program.
This part of apctest is for testing Smart UPSes.
Please select the function you want to perform.
1) Query the UPS for all known values
2) Perform a Battery Runtime Calibration
3) Abort Battery Calibration
4) Monitor Battery Calibration progress
5) Program EEPROM
6) Enter TTY mode communicating with UPS
Q) Quit
1) Query the UPS for all known values
I am going to run through the series of queries of the UPS
that are used in initializing apcupsd.
Simulating UPSlinkCheck ...
Wrote: Y Got: SM
Attempting to use smart_poll() ...
Sent: Y Got: SM Good -- smart_poll() works!.
Going to ask for valid commands...
Wrote: a Got: 3.?=...')-89>@ABCDEFGKLMNOPQRSUVWXYZabcefgjklmnopqrsuxyz~
Protocol version is: 3
Alert characters are: ?=
Command characters are: ^A^N^Z')-89>@ABCDEFGKLMNOPQRSUVWXYZabcefgjklmnopqrsuxyz~
Now running through apcupsd get_UPS capabilities().
NA indicates that the feature is Not Available
UPS Status: 08
Line quality: FF
Reason for last transfer to batteries: S
Self-Test Status: NO
Line Voltage: 100.8
Line Voltage Max: 101.5
Line Voltage Min: 100.8
Output Voltage: 100.8
Batt level percent: 100.0
Batt voltage: 27.27
UPS Load: 000.0
Line freq: 60.00
Runtime left: 0383
UPS Internal temp: 034.2
Dip switch settings: NA
Register 1: 00
Register 2: 00
Register 3: 00
Sensitivity: M
Wakeup delay: 000
Sleep delay: 180
Low transfer voltage: 088
High transfer voltage: 112
Batt charge for return: 15
Alarm status: 0
Low battery shutdown level: 02
UPS Name: UPS_IDEN
UPS Self test interval: 336
UPS manufacture date: 12/04/06
UPS serial number: AS0649245142
Date battery replaced: 09/08/11
Output voltage when on batteries: 100
Nominal battery voltage: 024
Percent humidity: NA
Ambient temperature: NA
Firmware revision: 650.13.A
Number of external batteries installed: 000
Number of bad batteries installed: NA
UPS model as defined by UPS: Smart-UPS 500
UPS EPROM capabilities string: uD43127130133136uA43108110112114uI43253257261265uM43225229233237lD43106103100097lA43092090088086lI43208204200196lM43182178174170e47200153045607590oD13120oA13100oI33230240220oM13208s431HMLq4820205081114172023p483090180270360450540630000k4310TNr483000060120180240300360420E443336168ON OFF
The EPROM string is 286 characters long!
Hours since last self test: NA
That is all for now.
2) Perform a Battery Runtime Calibration
First ensure that we have a good link and
that the UPS is functionning normally.
Simulating UPSlinkCheck ...
Wrote: Y Got: SM
Attempting to use smart_poll() ...
Sent: Y Got: SM Good -- smart_poll() works!.
Checking estimated runtime ...
Current runtime is 383 minutes
Checking for battery level ...
Battery level is 100.0 -- OK
The battery calibration should automatically end
when the battery level drops below about 25, depending
on your UPS.
I can also optionally monitor the progress
and stop the calibration if it goes below 10. However,
in the case of a new battery this may prematurely end the
calibration loosing the effect.
Do you want me to stop the calibration
if the battery level goes too low? (y/n): y
Sending Battery Calibration command. ...
UPS has initiated battery calibration.
Monitoring the calibration progress ...
To stop the calibration, enter a return.
Battery charge 100
Remaining runtime is 383 minutes
.....
Battery charge 87
Remaining runtime is 332 minutes
User input. Terminating calibration ...
Attempting to abort calibration ...
Response to abort request: OK
On battery 81 sec or 1m21s.
3) Abort Battery Calibration
CAUTION! Don't use this command unless the UPS
is already doing a calibration.
Are you sure? (yes/no): yes
Attempting to abort calibration ...
Battery Runtime Calibration terminated.
Checking estimated runtime ...
Updated runtime is 332
4) Monitor Battery Calibration progress
Monitoring the calibration progress ...
To stop the calibration, enter a return.
Battery charge 87
Remaining runtime is 332 minutes
.....
Battery charge 87
Remaining runtime is 332 minutes
...
User input. Terminating calibration ...
Attempting to abort calibration ...
Battery Runtime Calibration terminated.
Checking estimated runtime ...
Updated runtime is 337
5) Program EEPROM
This is the EEPROM programming section of apctest.
Please select the function you want to perform.
1) Print EEPROM values
2) Change Battery date
3) Change UPS name
4) Change sensitivity
5) Change alarm delay
6) Change low battery warning delay
7) Change wakeup delay
8) Change shutdown delay
9) Change low transfer voltage
10) Change high transfer voltage
11) Change battery return threshold percent
12) Change output voltage when on batteries
13) Change the self test interval
14) Set EEPROM with conf file values
Q) Quit
apcupsd の設定ファイルを編集します。
vi /etc/apcupsd/apcupsd.conf
UPSの状態を確認するコマンドとして、apcaccess コマンドがあります。
APC : 001,050,1218
DATE : 2014-11-06 15:39:38 +0900
HOSTNAME : proxysv
VERSION : 3.14.10 (13 September 2011) redhat
UPSNAME : UPS_IDEN
CABLE : Custom Cable Smart
DRIVER : APC Smart UPS (any)
UPSMODE : Stand Alone
STARTTIME: 2014-11-06 14:54:18 +0900
MODEL : Smart-UPS 750 RM
STATUS : ONLINE
LINEV : 093.6 Volts
LOADPCT : 0.0 Percent Load Capacity
BCHARGE : 099.0 Percent
TIMELEFT : 300.0 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
MAXLINEV : 095.0 Volts
MINLINEV : 092.1 Volts
OUTPUTV : 093.6 Volts
SENSE : High
DWAKE : 000 Seconds
DSHUTD : 090 Seconds
DLOWBATT : 02 Minutes
LOTRANS : 092.0 Volts
HITRANS : 108.0 Volts
RETPCT : 000.0 Percent
ITEMP : 23.8 C Internal
ALARMDEL : 5 seconds
BATTV : 27.7 Volts
LINEFREQ : 60.0 Hz
LASTXFER : Automatic or explicit self test
NUMXFERS : 0
TONBATT : 0 seconds
CUMONBATT: 0 seconds
XOFFBATT : N/A
SELFTEST : NO
STESTI : 336
STATFLAG : 0x07000008 Status Flag
REG1 : 0x00 Register 1
REG2 : 0x00 Register 2
REG3 : 0x00 Register 3
MANDATE : 06/30/14
SERIALNO : AS1427231190
BATTDATE : 06/30/14
NOMOUTV : 100 Volts
NOMBATTV : 24.0 Volts
EXTBATTS : 0
FIRMWARE : 615.3.A
END APC : 2014-11-06 15:40:38 +0900
ここでは、標準のApache を用いた設定方法の説明を行います。
RPM でインストールすると、CGI ファイルが、 /var/apcupsd/cgi/ に作成されます。
cp /var/apcupsd/*.cgi /var/www/cgi-bin
複数台のUPS 情報のサマリーを表示します。
http://127.0.0.1/cgi-bin/multimonitor.cgi
1台のUPS の詳細情報を表示します。
http://127.0.0.1/cgi-bin/upsstats.cgi
パラメータの詳細を表示します。
http://127.0.0.1/cgi-bin/upsfstats.cgi