ネット上で検索した文書だとうまく設定出来なかったのでメモ。
LAN経由のコントロールでも NETPORT や MASTER 、 SLAVE などの設定項目は無かった。
バージョンの違い?
- 1台のUPSで3台のマシンに電源を供給。
- 3台のマシンのうち1台をマスターとし、残り2台をスレーブとする。
- UPSへの接続はマスターがUSBでスレーブはEthernet(LAN)とする。
環境:CentOS 5.3 x1台+CentOS4.8 x2台
UPS:APC UPS-1500
apcupsdインストール
yum install apcupsd
インストールされたバージョンは
apcupsd release 3.14.3 (20 January 2008) – redhat
マスター設定(/etc/apcupsd/apcupsd.conf)
# UPSNAME xxx
# Use this to give your UPS a name in log files and such. This
# is particulary useful if you have multiple UPSes. This does not
# set the EEPROM. It should be 8 characters or less.
UPSNAME APC_UPS_1500 ←修正(好きな名前に)
# UPSCABLE
# Defines the type of cable connecting the UPS to your computer.
#
# Possible generic choices for are:
# simple, smart, ether, usb
#
# Or a specific cable model number may be used:
# 940-0119A, 940-0127A, 940-0128A, 940-0020B,
# 940-0020C, 940-0023A, 940-0024B, 940-0024C,
# 940-1524C, 940-0024G, 940-0095A, 940-0095B,
# 940-0095C, M-04-02-2000
#
UPSCABLE usb ←修正# To get apcupsd to work, in addition to defining the cable
# above, you must also define a UPSTYPE, which corresponds to
# the type of UPS you have (see the Description for more details).
# You must also specify a DEVICE, sometimes referred to as a port.
# For USB UPSes, please leave the DEVICE directive blank. For
# other UPS types, you must specify an appropriate port or address.
#
# UPSTYPE DEVICE Description
# apcsmart /dev/tty** Newer serial character device,
# appropriate for SmartUPS models using
# a serial cable (not USB).
#
# usb Most new UPSes are USB. A blank DEVICE
# setting enables autodetection, which is
# the best choice for most installations.
#
# net hostname:port Network link to a master apcupsd
# through apcupsd’s Network Information
# Server. This is used if you don’t have
# a UPS directly connected to your computer.
#
# snmp hostname:port:vendor:community
# SNMP Network link to an SNMP-enabled
# UPS device. Vendor is the MIB used by
# the UPS device: can be “APC”, “APC_NOTRAP”
# or “RFC” where APC is the powernet MIB,
# “APC_NOTRAP” is powernet with SNMP trap
# catching disabled, and RFC is the IETF’s
# rfc1628 UPS-MIB. You usually want “APC”.
# Port is usually 161. Community is usually
# “private”.
#
# dumb /dev/tty** Old serial character device for use
# with simple-signaling UPSes.
#
# pcnet ipaddr:username:passphrase
# PowerChute Network Shutdown protocol
# which can be used as an alternative to SNMP
# with AP9617 family of smart slot cards.
# ipaddr is the IP address of the UPS mgmt
# card. username and passphrase are the
# credentials for which the card has been
# configured.
#
UPSTYPE usb ←修正
DEVICE ←修正# NETTIME
# Interval (in seconds) at which the NIS client polls the server.
# Used only when this apcupsd is a network client (UPSTYPE net).
NETTIME 60 ←コメント削除# UPSCLASS [ standalone | shareslave | sharemaster ]
# Normally standalone unless you share an UPS using an APC ShareUPS
# card.
UPSCLASS sharemaster ←修正# UPSMODE [ disable | share ]
# Normally disable unless you share an UPS using an APC ShareUPS card.
UPSMODE share ←修正
起動:
/etc/rc.d/init.d/apcupsd start
ステータス確認:
/sbin/apcaccess status
自動起動設定:
chkconfig apcupsd on
スレーブ側:
# UPSCABLE
# Defines the type of cable connecting the UPS to your computer.
#
# Possible generic choices for are:
# simple, smart, ether, usb
#
# Or a specific cable model number may be used:
# 940-0119A, 940-0127A, 940-0128A, 940-0020B,
# 940-0020C, 940-0023A, 940-0024B, 940-0024C,
# 940-1524C, 940-0024G, 940-0095A, 940-0095B,
# 940-0095C, M-04-02-2000
#
UPSCABLE ether ←修正
# To get apcupsd to work, in addition to defining the cable
# above, you must also define a UPSTYPE, which corresponds to
# the type of UPS you have (see the Description for more details).
# You must also specify a DEVICE, sometimes referred to as a port.
# For USB UPSes, please leave the DEVICE directive blank. For
# other UPS types, you must specify an appropriate port or address.
#
# UPSTYPE DEVICE Description
# apcsmart /dev/tty** Newer serial character device,
# appropriate for SmartUPS models using
# a serial cable (not USB).
#
# usb Most new UPSes are USB. A blank DEVICE
# setting enables autodetection, which is
# the best choice for most installations.
#
# net hostname:port Network link to a master apcupsd
# through apcupsd’s Network Information
# Server. This is used if you don’t have
# a UPS directly connected to your computer.
#
# snmp hostname:port:vendor:community
# SNMP Network link to an SNMP-enabled
# UPS device. Vendor is the MIB used by
# the UPS device: can be “APC”, “APC_NOTRAP”
# or “RFC” where APC is the powernet MIB,
# “APC_NOTRAP” is powernet with SNMP trap
# catching disabled, and RFC is the IETF’s
# rfc1628 UPS-MIB. You usually want “APC”.
# Port is usually 161. Community is usually
# “private”.
#
# dumb /dev/tty** Old serial character device for use
# with simple-signaling UPSes.
#
# pcnet ipaddr:username:passphrase
# PowerChute Network Shutdown protocol
# which can be used as an alternative to SNMP
# with AP9617 family of smart slot cards.
# ipaddr is the IP address of the UPS mgmt
# card. username and passphrase are the
# credentials for which the card has been
# configured.
#
UPSTYPE net ←修正
DEVICE 192.168.1.xxx ←マスターのIPアドレス# NETTIME
# Interval (in seconds) at which the NIS client polls the server.
# Used only when this apcupsd is a network client (UPSTYPE net).
NETTIME 60 ←コメント削除#
# Remaining items are for ShareUPS (APC expansion card) ONLY
## UPSCLASS [ standalone | shareslave | sharemaster ]
# Normally standalone unless you share an UPS using an APC ShareUPS
# card.
UPSCLASS shareslave ←修正# UPSMODE [ disable | share ]
# Normally disable unless you share an UPS using an APC ShareUPS card.
UPSMODE share ←修正
起動:
/etc/rc.d/init.d/apcupsd start
ステータス確認:
/sbin/apcaccess status
ステータスが表示されればOK?
動作確認
apcupsdはいずれかの条件が一つでも当てはまればシャットダウンを実行する。
- BATTERYLEVEL … バッテリー残が設定したパーセント以下になったら
- MINUTES … バッテリー残が設定した分以下になったら
- TIMEOUT … 商用電源からの供給が切れた時からの経過秒を過ぎたら
マスターの設定を TIMEOUT 600(秒)に設定し、動作確認を行う。
マスターの設定はTIMEOUT のみ変更して、他はデフォルトのまま。
結果は5分超後、全てのサーバがシャットダウンされた。
カテゴリー: サーバ管理 - Trackback Uri

