トップ «前の日記(2007-05-08(Tue)) 最新 次の日記(2007-05-11(Fri))» 編集

ぽっぺん日記@karashi.org


2007-05-10(Thu) [長年日記]

雨時々曇 最高気温:26℃

_ sysutils/apcupsdを3.14.0に更新

久しぶりにsysutils/apcupsdをportupgradeしたところ、3.14.0になっていた。

Relese Notesによると、

  • Unreliable MASTER/SLAVE networking mode is removed

ということなので、今まで使っていたMASTER/SLAVEモードは捨てて、NISモードを使うように設定変更。

設定方法はマニュアルを読めば、全然難しくないんだけども、備忘録を兼ねてメモ。

まずはportsのmakeから。

マニュアルによると、

NIS clients and servers require that apcupsd be compiled with the Net Driver --enable-net.

と言うことなので、sysutils/apcupsdをmakeする場合は、

-DWITH_CLIENT_ONLY

付きにしなければならないぽい。これからは、このknob名は適切ではないかな。もう、直接、CONFIGURE_ARGSに入れちゃってもいいのかも知れない。

サーバ側の設定は下記の通り。

--- apcupsd.conf.sample        Wed May  9 14:16:15 2007
+++ apcupsd.conf       Wed May  9 11:31:57 2007
@@ -73,7 +73,7 @@
 #                            configured.
 #
 UPSTYPE apcsmart
-DEVICE /dev/usv
+DEVICE /dev/cuad0


 # LOCKFILE <path to lockfile>
@@ -120,12 +120,12 @@
 # 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
+BATTERYLEVEL 10

 # 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.
-MINUTES 3
+MINUTES 6

 # If during a power failure, the UPS has run on batteries for TIMEOUT
 # many seconds or longer, apcupsd will initiate a system shutdown.

基本的にstandaloneの時と全く変わらない。BATTERYLEVELとMINUTESはお好みで。

それからクライアントからの問い合わせに答えられるよう、pf.confにも下記の設定を書いた。

table <apcupsd_clients> { xxx.xxx.xxx }
(中略)
pass in  on $ext_if inet proto tcp from <apcupsd_clients> to ($ext_if) port 3551 flags S/SA modulate state

今回はNISモードの標準ポート、3551を使った。

次にクライアントの設定。

 --- apcupsd.conf.sample        Wed May  9 11:28:14 2007
+++ apcupsd.conf       Wed May  9 11:40:49 2007
@@ -26,7 +26,7 @@
 #     940-1524C, 940-0024G, 940-0095A, 940-0095B,
 #     940-0095C, M-04-02-2000
 #
-UPSCABLE smart
+UPSCABLE ether

 # To get apcupsd to work, in addition to defining the cable
 # above, you must also define a UPSTYPE, which corresponds to
@@ -72,8 +72,8 @@
 #                            credentials for which the card has been
 #                            configured.
 #
-UPSTYPE apcsmart
-DEVICE /dev/usv
+UPSTYPE net
+DEVICE xxx.xxx.xxx:3551


 # LOCKFILE <path to lockfile>
@@ -120,12 +120,12 @@
 # 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
+BATTERYLEVEL 15

 # 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.
-MINUTES 3
+MINUTES 9

 # If during a power failure, the UPS has run on batteries for TIMEOUT
 # many seconds or longer, apcupsd will initiate a system shutdown.
@@ -208,7 +208,7 @@
 # NETTIME <int>
 #   Interval (in seconds) at which the NIS client polls the server.
 #   Used only when this apcupsd is a network client (UPSTYPE net).
-#NETTIME 60
+NETTIME 10

 #
 # Remaining items are for ShareUPS (APC expansion card) ONLY

基本的にUPSTYPEとDEVICEを変更しただけ。BATTERYLEVELとMINUTESは、サーバより早めにshutdownするようにした。NETTIMEはマニュアルに合わせて短めに変更。

あとは、サーバ、クライアントで

# /usr/local/etc/rc.d/apcupsd start

してapcupsdを起動してあげてから、UPSの商用電源コンセントを抜いてみて、/var/log/apcupsd.eventsにログされているか確認する。

今まで、これといった理由がなく、MASTER/SLAVEモードを使っていたんだけど、NISモードはホストが増えても、特にサーバ側をいじる必要がない(ファイアウォールをいじる必要はあるかもしれないけど)ので、運用もかなり楽になるのではないかと思った。

参考:

Tags: sysadmin FreeBSD | | | | | | | Permalink
[]
本日のPingbacks(全0件)

トップ «前の日記(2007-05-08(Tue)) 最新 次の日記(2007-05-11(Fri))» 編集