0%

QNAP NAS 添加 ups 后推送关机通知到其他设备

QNAP 设置

将 UPS 通过 USB 线连接到 QNAP,设置如图所示:

qnap-ups

PVE 设置

  1. 打开 PVE 的 shell,安装 NUT 客户端:

    1
    apt-get install nut -y
  2. 配置 NUT 客户端:

    配置 nut.conf 文件:

    1
    vim /etc/nut/nut.conf

    移动光标找到 MODE 参数项,将 MODE= 后面修改成如下参数:

    1
    MODE=netclient

    配置 upsmon.conf 文件:

    1
    vim /etc/nut/upsmon.conf

    找到 MONITOR 在下方增加一行:

    1
    MONITOR qnapups@<NAS IP> 1 admin 123456 slave

    这里坑出现了,大部分 ups 的服务器以 ups 开头(包括群晖),然而 qnap 不是,他是以 qnapups 开头。。。。😑

    用户名为 admin,密码默认为 123456

  3. 启动nut-client服务,并设置自动启动

    1
    systemctl restart nut-client && systemctl enable nut-client
  4. 测试是否成功连接UPS服务器

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    $ upsc qnapups@192.168.12.10
    Init SSL without certificate database
    battery.charge: 79
    battery.charge.low: 20
    battery.runtime: 1801
    battery.type: PbAc
    device.mfr: EATON
    device.model: SANTAK TG-BOX 850
    device.serial: Blank
    device.type: ups
    driver.name: usbhid-ups
    driver.parameter.pollfreq: 30
    driver.parameter.pollinterval: 2
    driver.parameter.port: /dev/ttyS1
    driver.parameter.synchronous: no
    driver.version: 2.7.4
    driver.version.data: MGE HID 1.39
    driver.version.internal: 0.41
    input.transfer.high: 264
    input.transfer.low: 184
    outlet.1.desc: PowerShare Outlet 1
    outlet.1.id: 1
    outlet.1.status: on
    outlet.1.switchable: no
    outlet.desc: Main Outlet
    outlet.id: 0
    outlet.switchable: yes
    output.frequency.nominal: 50
    output.voltage: 230.0
    output.voltage.nominal: 220
    ups.beeper.status: enabled
    ups.delay.shutdown: 20
    ups.delay.start: 30
    ups.firmware: 02.08.0010
    ups.load: 13
    ups.mfr: EATON
    ups.model: SANTAK TG-BOX 850
    ups.power.nominal: 850
    ups.productid: ffff
    ups.serial: Blank
    ups.status: OL
    ups.timer.shutdown: 0
    ups.timer.start: 0
    ups.type: offline / line interactive
    ups.vendorid: 0463

    or

    1
    2
    3
    4
    $ systemctl status nut-client
    ...
    ... Started Network UPS Tools - power device monitor and shutdown controller.
    ...

Reference

  1. https://www.purefish.cc/pve-synology-ups.html
  2. https://blog.cyida.com/posts/ZEK5W9/
  3. https://www.lxg2016.com/54516.html
  4. https://post.smzdm.com/p/av7o5r9n/
  5. https://blog.pengandfan.com/2021/09/10/qnap-nas添加ups后推送关机通知到其他设备
-------The end of this article  Thank you for your reading-------