1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

upscを使って2台のUPSと2重化電源の環境で電源制御する

Last updated at Posted at 2018-10-07

目的

電源が冗長化されたサーバで電源ごとに異なるUPSを接続している場合に以下のような制御をさせたい。とりあえず電源2、UPS 2の環境とする。

電源供給 挙動
正常 通常
片系ダウン シャットダウンしない
両系統ダウン 一定時間後シャットダウンする

APCのUPS + UPS Network Management Card 2 (AP9630)を利用するのでapcupsdを使いたかったが上記のようなことは出来ないようなのでupscを利用することにした。

仮想化ホストのサーバに導入しているが、電源制御するのはホストサーバ自身だけにし、仮想化ゲストはlibvirtdの機能を使ってホストサーバのシャットダウン時にゲストサーバのシャットダウンを自動的に行うよう設定しているため、他サーバから参照するようにしていない。

導入方法

インストール

# yum install nut

設定

設定ファイルを書き換える。

# cat /etc/ups/ups.conf
[ups01]
        driver = snmp-ups
        port   = 192.168.1.201
        community = public
        snmp_version = v2c
        notransferoids
        desc = "SNMP-UPS01"

[ups02]
        driver = snmp-ups
        port   = 192.168.1.202
        community = public
        snmp_version = v2c
        notransferoids
        desc = "SNMP-UPS02"
# cat /etc/ups/upsd.conf
LISTEN 127.0.0.1  3493
# cat /etc/ups/upsd.users
[upsmon]
        password = upspass
        upsmon master
[upssvc]
        password = upspass
        upsmon slave

以下のupsmon.confの掲載部分はSNMP UPS監視部のみで、電源制御について別途設定を記述する必要がある。
MINSUPPLIESで最低限稼働している必要があるUPSの数を設定している。

# cat /etc/ups/upsmon.conf
MONITOR ups01@localhost 1 upsmon upspass master
MONITOR ups02@localhost 1 upsmon upspass master
MINSUPPLIES 1

以下は変更しない
/etc/ups/upssched.conf
/etc/ups/nut.conf

設定確認

# upsdrvctl start
# upsd
Network UPS Tools upsd 2.7.2
fopen /var/run/nut/upsd.pid: No such file or directory
not listening on 127.0.0.1 port 3493
no listening interface available

# upsc -L
ups01
ups02

# upsc ups01@localhost
# upsc ups02@localhost

動作確認

# systemctl start nut-server
# systemctl enable nut-server
# reboot
# upsc ups01@localhost
# upsc ups02@localhost
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?