#topicpath
-----

&color(red){補足お願いします。A/Iも。 > 田中先生};~
host	cable	software	script	落とす対象 onbattery doshutdown
のような表があると分かり易くてありがたいです。

#contents

* hardware [#ga41caad]
** 方針 [#vb41e2f3]
- ラインインタラクティブ方式(APC smart UPS が該当)で妥協(常時インバータ方式は高いので。。)。ただし、APC UPSは回路とバッテリーの双方で故障が多いのでオムロン製品への置き換え等を要検討。
- 極力USBケーブル

** cable [#v5abb5b6]
- serial
-- powerchute 付属の特別なケーブル(1ピン多いらしい)
- USB
-- 通常の USB ケーブルが使える(UPS側は四角いコネクタ)
-- たとえば、 [[この画像>http://www.atmarkit.co.jp/fpc/cableconnecter/images/usb1394_02_l.jpg]]

** UPSバッテリ、本体の故障関係 [#g8a8cdb3]
*** 事象 [#va7f78a0]
- NANTEN2 や PolarBear の情報とも合わせると、UPS の種類に限らず
長期止めた場合(特に今回は、2012/9-2013/5 の8ヶ月)の被害が大きいようだ。

*** バッテリについての調査まとめ [#c613d10d]
- 一般のUPS用のバッテリーは下記のように満充電でも6ヶ月しかもたず、
さらに、APCの(噂)だと、過放電のバッテリーで電源を入れると回路すら故障するようだ。
長期止める場合は、山麓オフィスを完全にはシャットダウンせずに
山麓で電源につないでおくのが良さそう。
(定期的に誰かに見てもらえれば安心。)
- 一方で、電研精機のはなぜ長持ちするのか?
資料(&ref(バッテリカタログ抜粋.pdf);)のようにバッテリーに2年以上保存可能のものを使用している。
(3kVA 用のバッテリーが 25万円だが。。)
この資料にも比較として他の一般的な製品は6ヶ月しかもたないとある。

*** 考えられる対処方法 [#p1e457c8]
- 長期止める場合は、過放電防止のため、山麓オフィスを完全にはシャットダウンせずに山麓で電源につないでおく。(定期的に誰かに見てもらえれば安心。)
- クリティカルな部分は電研精機のUPSを使う。
- 消耗費と割り切り、長期シャットダウンに合わせて随時調達。

*** 調達関係 [#q4273c58]
- チリで APC でも調達できると輸送費がかからず安価。入出力100Vが入手できるかが課題。せめてチリ業者に米国から調達してもらえれば日本から送るよりは安そう。
- バッテリが危険品に該当するので輸出の際には輸送費の値が張る。ただし、電研精機のバッテリーはこの限りではなかった。

*** 参考資料 [#daa61794]
- APC UPSの使い方について
 http://akiba-pc.watch.impress.co.jp/hotline/20111217/sp_fline.html
 Q. 利用頻度が低い場合は、温度が低いほうがバッテリ自体はある程度長持ちするということですね。バッテリを一度使用して、コンセントにつながない状態で 放置するとどうなるのでしょうか。
 A. 一度使用したバッテリを保管する場合は、満充電にしておくのをお勧めします。一度残量がゼロになってしまうと、バッテリが回復しなくなるため、バッテリ残量がゼロになる前に充電をしてください。これも温度の影響が大きいのですが、鉛蓄電池でバッテリ満充電の場合は温度環境が25℃の場合は6カ月ほど持ちます。40℃の場合は3カ月くらいで補充電を行なうことをお勧めします。

--[[マニュアル:ftp://ftp.apc.co.jp/spec/SUA1500J_SPECver2B.pdf]]にも、長期保管時の補充電の期間が温度に応じて定められている。

- APC UPS の故障への道
 ローバッテリーだと回路が故障へまっしぐらという噂がある。
 http://blog.livedoor.jp/ese_admin/archives/51857007.html

- オムロン情報(比較として)
 http://www.omron.co.jp/ese/ups/support/faq/hard/a_upshard_030512g.html
 内蔵されているバッテリの保管期間は、完全充電状態から保管温度25℃以下の場合6ヶ月、保管温度40℃以下の場合、2ヶ月以内に開封してUPSを電源につないでフル充電を行ってください。

- ASTE の UPS 事情
-- APC: Smart-UPS 1500 (SUA1500JB) など。故障が多い。基板まで故障するようだ。
-- 電研精機: ノイズカットUPS。巨大、高価だが故障したことがない。計算機シャットダウンには使えない。

- NANTEN2 の UPS 事情
-- 富士電機: M-UPS010J11W-L など。機能は限定的。バッテリ故障はあった。
-- APC: 使用できる周波数が範囲が狭いため給電事情から使用していなかった。

- PolarBear の UPS 事情
-- 下記機種を米国で調達して使っている。長期シャットダウンを経験していないためか壊れたことはない。
--- TRIPP LITE: SU1500RTXL2UA
--- APC: BR1000G



* software [#sebe1665]
** 方針 [#bd83d4c9]
- 管理の手間を減らすため、全てのサイトで共通の設定を使う

** powerchute (solaris系) [#ka04a3aa]
- install directory: /usr/lib/powerchute
-- access is limited only to root
-- should allow access by asteobs account for convenience
- event log: /usr/lib/powerchute/powerchute.log
- log data:  /usr/lib/powerchute/powerchute.dat

- ref: http://sturgeon.apcc.com/kbase.nsf/ForExternal/943C6B37D699385B492572C20007C048?OpenDocument
- エージェント (個々のUPS監視機能)
-- UPSステータス監視機能、および電源障害時にコンピュータのシステムシャットダウン機能を提供。エージェントは、UPSシステムに直接接続されている各コンピュータ上にインストールする必要がある。
- サーバ (エージェントの情報集約機能)
-- 最大25台までのエージェントの情報が集約される。エージェントから情報を収集して、イベントの追跡やイベント通知を行ったり、コンソールと通信を行う。 
- コンソール (集約サーバのインターフェイス、エージェントの管理機能)
-- 集約サーバにアクセス、PowerChute Business Editionのインターフェイスとして、各エージェントの設定、監視、管理機能を提供。

- サーバ、コンソールは対応Windowsにのみインストール可能。Linux、Solarisにはエージェントのみインストール可能。エージェントの設定、監視には対応Windowsマシンが必要。

** apcupsd (linux系) [#u39f3ac9]

- linux系 は apcupsd で統一。~
- solarisも 8 以降は対応しているようだが。 http://www.apcupsd.com/manual/manual.html#supported-operating-systems

*** installation [#efa95ac7]
 wget http://sourceforge.net/projects/apcupsd/files/rpms%20-%20Stable/3.14.8/apcupsd-3.14.8-1.el5.i386.rpm/download
 rpm -ivh apcupsd-3.14.8-1.el5.i386.rpm

*** setup [#s4dbc5d6]
- 設定ファイルはこのページに添付(apcupsd_YYYYMMDD.tar.gz)

- aste-wx2 でテストは行った。

- /etc/apcupsd/apcupsd.conf
 # UPSCABLE <cable>
 #   Defines the type of cable connecting the UPS to your computer.
 UPSTYPE usb
 
 # The ONBATTERYDELAY is the time in seconds from when a power failure
 #   is detected until we react to it with an onbattery event.
 #
 #   This means that, apccontrol will be called with the powerout argument
 #   immediately when a power failure is detected.  However, the
 #   onbattery argument is passed to apccontrol only after the
 #   ONBATTERYDELAY time.  If you don't want to be annoyed by short
 #   powerfailures, make sure that apccontrol powerout does nothing
 #   i.e. comment out the wall.
 ## バッテリー駆動に切り替わってから無視する秒数
 ## alert がうるさいので長め(60sec)に設定
 ONBATTERYDELAY 60
 
 # Note: BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so
 # the first that occurs will cause the initation of a shutdown.
 
 # If during a power failure, the remaining battery percentage
 # (as reported by the UPS) is below or equal to BATTERYLEVEL,
 # apcupsd will initiate a system shutdown.
 BATTERYLEVEL 5 <= default
 
 # If during a power failure, the remaining runtime in minutes
 # (as calculated internally by the UPS) is below or equal to MINUTES,
 # apcupsd, will initiate a system shutdown.
 ## /etc/init.d/apcupsd status で TIMELEFT が計算されて出るもののみ有効
 MINUTES 3 <= default

 # EVENTSFILEMAX <kilobytes>
 #  By default, the size of the EVENTSFILE will be not be allowed to exceed
 #  10 kilobytes.  When the file grows beyond this limit, older EVENTS will
 #  be removed from the beginning of the file (first in first out).  The
 #  parameter EVENTSFILEMAX can be set to a different kilobyte value, or set
 #  to zero to allow the EVENTSFILE to grow without limit.
 EVENTSFILEMAX 100 <= けちってもしょうがないので 100kB にしておく


-/etc/apcupsd/apccontrol
--アラームに対する処理は apccontrol 内に書きこむ。
-- shutdown script は、doshutdown の項目に書く

-/etc/apcupsd/onbattery
--バッテリー駆動になった際にアラートメールを出す設定
--aste-comp 宛

-/etc/apcupsd/offbattery
--電源ライン駆動に戻った際にお知らせメールを出す設定
--aste-comp 宛

-/etc/apcupsd/changme
--要バッテリー交換のアラートメールを出す設定
--aste-comp 宛

-/etc/apcupsd/ssh_shutdown (ASTE独自のもの)
-- ファイルサーバを最後に落とす必要があるので、以下の順序とする
+++ ファイルサーバ(master)が UPS のアラームを感知(aste-mx2, wx2, ax2)
+++ shutdown process start を aste-comp 宛に通知
+++ sshで他マシン(slave)を落とす
+++ masterマシンのシャットダウンまでの sleep 20 sec で nfs umountの時間を稼ぐ
+++ 自分自身をシャットダウンする(ssh_shutdownの中では行わない)
-- slave に ssh で入れるように root の sshkey の設定が必要
-- ssh timeout 設定
 sshtimeout=5
 ssh="/usr/bin/ssh -o ConnectionTimeout=$sshtimeout"

-sendmail
--起動(alert mail を出すのに使う)
 root> /etc/init.d/sendmail start
 Starting sendmail: [ OK ]
 Starting sm-client: [ OK ]
--起動設定変更
 rc[2345].dの *80sendmail を S80sendmail に rename

- 注意点
 計算機(UPS signalを受ける)シャットダウンの最後に UPS off のコマンドが送られ、
 それから 180sec 後に UPS が sleep 状態に入る。
 (それまでに計算機を再起動すると、当然落ちる。)
 一旦、手動で UPS の電源 off をして、再度 on にする。


* シャットダウン方針 [#fbc7a26d]
** UPS 管理ツールが入っているマシン [#ya83bcd7]
- powerchute: aste-1s
- apcupsd:    aste-mx2, aste-www, aste-wx2, aste-ax2, aste-1x

** ssh shutdown chain [#n6e20dd7]
 "aste-1s" )  linux="aste-1x aste-r1c"
              solaris="aste-3c aste-2c aste-c1c aste-v1c aste-1c"
 "aste-1x" )  linux="aste-r1c"
              solaris="";;
 "aste-ax2" ) linux="aste-ax1 aste-ax3"
              solaris="aste-at3";;
 "aste-mx2" ) linux="aste-mx1 aste-mz2"
              solaris="aste-mt2";;
 "aste-www" ) linux=""
              solaris="";;
 "aste-wx2" ) linux="aste-wx1 aste-wz1"
              solaris="aste-w";;

** ASTE site [#ld130b93]
- 手動で落とせる場合は極力手動で落とす。~
- しかし、手動が無理な場合は、
-- 気象情報は判断材料として最後までモニターしておきたい
-- ==> サイトの計算機は発電機停止を受けて止まるようにする
-- lantap は操作せず通常の shutdown だけにとどめる。
理由は、
--- APC UPS は常時インバーターであることが確認できた http://cyber.apc.co.jp/smartups1500-p-48.html
--- OS shutdown の完了を確認するすべがない
--- そもそもハングしたときに強制的に off/on するようなツールである

- aste-1s
-- serial cable
-- powerchute
-- onbattery 後 2min で aste-1s から全てをシャットダウン
-- onbattery 後 3min で自分のシャットダウン
--%%&color(red){ 問題点: 外部から入れない ==> tslinux の外部接続を復旧。(A/I)};%% ネットワーク更新時に復活
--&color(red){ 1x を master にする。(A/I)};

- aste-1x
-- apcupsd
-- r1c を落とす。
--&color(red){まずはUSBケーブルをつながないと始まらない(A/I)};
--- ==> &color(red,white){1x 用 UPS に USB ポート無し。シリアルはあり。(1s UPS とスワップする?)};


** SPdA [#r4f762a3]
- aste-ax2(file server)
-- apcupsd
-- ax1, ax3, at3 を落とす。
--%%&color(red){sshkey の設定状況は不明。。(A/I)};%% OK

** MTK [#p993adb0]
- aste-mt1
-- powerchute 入っているらしいが設定不明
-- 起動していない

- aste-mx2(file server)
-- apcupsd
-- mx1, mz1, mz2, mt2 を落とす ==> %%&color(red){mz1 はもはや存在しない(A/I)};%% OK
-- %%&color(red){mz2 は、sshkey の設定が必要。。(A/I)};%% OK

- aste-www
-- 以下の理由により aste-www は単体で落ちてもらう。
--- DMZ にあるため、他と連動するのは security 的にも設定的にも面倒
--- sendmail の起動はsecurity 的に。。。~
ポートは外向きに開いていないので許してもらいましょう。
-- 設定内容
 - apcupsd の install と サービス起動
 - wx2, mx2 と同じ /etc/apcupsd を rsync
 - sendmail 起動。rc[2-5].d の sendmail 起動設定変更
   (rc5.d> mv K30sendmail S80sendmail)

** NRO [#l0024cbd]
- aste-wx2
-- apcupsd
-- mgz3m を nfs mount しているので本館系が落ちるとハングする可能性あり。
-- wx1, wz1, w を落とす。
-- %%&color(red){wz1 は、sshkey の設定が必要。。(A/I)};%%

- aste-w
-- serial cable
-- powerchute で落ちるはず。
-- 設定詳細は不明。。。なので aste-wx2 からも落とすようにする。~
AdminShutdownDelay = 900 で、shutdown が 15min で始まるようだが。。
-- mgz3m を nfs mount しているので本館系が落ちるとハングする可能性あり。
-- -> umount -l で強制的に unmount するべし

* A/I [#bd41f770]
- shutdown script(apcupsd)
--%%もはや mz1 は存在しない%% OK

- aste-1x
-- UPS と USB ケーブルでつなぐ
--- ==> &color(red,white){1x 用 UPS に USB ポート無し。シリアルはあり。(1s UPS とスワップする?)};
-- %%apcupsd を入れて設定、sendmail 設定&起動%% done
-- 電圧をモニターし、webenvmon に表示する

- aste-1s
-- powerchute の設定で、AVR trim などの sensitivity を "低" に下げる
-- 2011/11/16 の発電機切替時の AVR trim によって生じた onbattery を受けての shutdown で linux系が落ちていなかった。
 /usr/lib/powerchute/ssh_shutdown
 のlinux系用のコマンドの
 /usr/sbin/shutdown -h -y now
 のところは、
 /sbin/shutdown -h now
 とするべき
-- いずれにせよ、aste-1x は残しておきたいので、山頂では linux と solaris を分ける

-- その時のログは以下の通り。約3min on battery で、その間に shutdown が開始した。
 /usr/lib/powerchute/powerchute.log
 200001 11/16/11 17:00:59 UPS on battery: High input line voltage 123.8 V
 100300 11/16/11 17:03:58 Normal power restored: UPS on line
 
 /usr/lib/powerchute/powerchute.dat
 date,    time,    Vmin, Vmax, Vout, Vbat, freq, load%, temp,
 11/16/11,16:57:08,101.5,105.1,104.4,27.27,60.00,039.0,036.4,     ,
 11/16/11,17:07:08,101.5,118.0,098.6,26.19,59.50,040.9,031.9,     ,
 11/16/11,17:17:09,105.8,109.4,098.6,27.54,59.50,041.6,028.8,     ,

- aste-w*
-- mgz3m を umount -l で強制的に unmount するべし

* reference [#ccf855c1]
- apcupsd setting  http://www.scn.rain.com/~neighorn/docs/apcupsd/testing.html
- APC smart UPS (ラインインタラクティブ方式)
http://cyber.apc.co.jp/smartups1500-p-48.html
 通常運転時はサージ抑制器、フィルタ、インバータを介して負荷にAC電源を供給。
 電源障害時およびフィルタにて除去出来ない電圧波形が進入した場合に
 バッテリ運転に切り替えAC電源を供給。
 通常運転時にインバータを利用してバッテリ充電を実施するため、 充電器が必要ないシンプルな回路。
- Smart-UPSの前面パネルのLED概要  http://sturgeon.apcc.com/Kbase.nsf/0/6547B3675B66794D49257073000EA6BB?OpenDocument
- AVR trim & 感度の変更方法 & 閾値の変更方法
http://sturgeon.apcc.com/kbase.nsf/ForExternal/16A7031F2D3BE72549256EA3005F7836?OpenDocument
- UPS 感度の変更方法
http://sturgeon.apcc.com/Kbase.nsf/ForExternal/381FC0C1EA9C73B7C92566130009A4BC?OpenDocument
- powerchute manual
ftp://ftp.apc.co.jp/manual/pcp4xall/pcp42com.zip

* logs [#k29a4777]
- 日々の voltage, frequency の logは山頂aste-1sで保存され、aste-wx2 に送られている。詳細は[[webenvmon>../webenvmon]]を参照。

- 2010/04/25 genset switch #7001->#7002
 200001 04/25/10 18:45:59 UPS on battery: High input line voltage 125.2 V
 101600 04/25/10 18:49:59 Shutdown started
 100300 04/25/10 18:50:04 Normal power restored: UPS on line
 200100 04/25/10 18:50:30 System shutdown
 100100 04/25/10 18:50:36 *** PowerChute PLUS Stopped ***

- 2010/08/04 genset switch #7001->#7002
 200001 08/04/10 15:30:48 UPS on battery: High input line voltage 124.5 V
 101600 08/04/10 15:34:48 Shutdown started
 200100 08/04/10 15:35:18 System shutdown
 100100 08/04/10 15:35:24 *** PowerChute PLUS Stopped ***

- 2010/08/16 genset switch #7001->#7002
 200001 08/16/10 16:37:11 UPS on battery: High input line voltage 121.6 V
 101600 08/16/10 16:41:11 Shutdown started
 100300 08/16/10 16:41:25 Normal power restored: UPS on line
 200100 08/16/10 16:41:41 System shutdown
 100100 08/16/10 16:41:47 *** PowerChute PLUS Stopped ***

- 2011/04/20 genset switch #7001->#7002
 200001 04/20/11 16:17:34 UPS on battery: High input line voltage 121.6 V
 100300 04/20/11 16:17:34 Normal power restored: UPS on line
 200003 04/21/11 16:27:26 UPS on battery: Blackout 000.0 V
 101600 04/21/11 16:31:26 Shutdown started
 200100 04/21/11 16:31:56 System shutdown
 100100 04/21/11 16:32:03 *** PowerChute PLUS Stopped ***

- 2011/09/15 genset switch #7001->#7002
 200001 09/15/11 15:34:21 UPS on battery: High input line voltage 124.5 V
 101600 09/15/11 15:39:21 Shutdown started
 200100 09/15/11 15:39:52 System shutdown
 100100 09/15/11 15:39:58 *** PowerChute PLUS Stopped ***

- 2011/11/16 genset switch #7001->#7002
 200001 11/16/11 17:00:59 UPS on battery: High input line voltage 123.8 V
 100300 11/16/11 17:03:58 Normal power restored: UPS on line
 
 date,    time,    Vmin, Vmax, Vout, Vbat, freq, load%, temp,
 11/16/11,16:57:08,101.5,105.1,104.4,27.27,60.00,039.0,036.4,     ,
 11/16/11,17:07:08,101.5,118.0,098.6,26.19,59.50,040.9,031.9,     ,
 11/16/11,17:17:09,105.8,109.4,098.6,27.54,59.50,041.6,028.8,     ,

- 2011/12/05 genset switch #7001->#7002
 200001 12/05/11 14:40:18 UPS on battery: High input line voltage 123.8 V
 200301 12/05/11 14:42:59 Low battery condition: 063.0
 101600 12/05/11 14:43:29 Shutdown started
 200100 12/05/11 14:43:59 System shutdown
 100100 12/05/11 14:44:05 *** PowerChute PLUS Stopped ***
 100000 12/05/11 15:38:45 *** PowerChute PLUS Version 4.2.3 Started ***
 100200 12/05/11 15:38:59 Communication established
 300301 12/05/11 15:38:59 UPS battery is discharged: 050.0
 100701 12/05/11 15:50:24 UPS returned from low battery condition: 058.0
 
 date,    hh:mm:ss,Vin_min,max,Vout, Vbatt,Freq, load, Temp(degC)
 12/05/11,14:34:01,105.1,108.7,098.6,27.27,59.75,044.8,036.9,     ,
 12/05/11,14:39:00,105.8,108.7,098.6,27.27,59.75,039.6,036.9,     ,
 12/05/11,15:44:00,108.0,111.6,100.8,27.54,59.50,044.8,029.2,     ,
 12/05/11,15:48:59,108.0,111.6,100.8,27.40,59.50,045.5,031.5,     ,


Front page   Edit Diff History Attach Copy Rename Reload   New Page list Search Recent changes   Help   RSS of recent changes