본문 바로가기

서버와 홈디바이스/NAS, VPN, 클라우드

Proxmox UPS 설정 가이드

반응형

아래 링크대로 진행하면 잘 된다.

 

https://www.kreaweb.be/diy-home-server-2021-software-proxmox-ups/

 

DIY HOME SERVER 2021 - Software - PROXMOX - NUT UPS Monitoring | KREAWEB

When building a home lab server, you’re almost always going to use some kind of Uninterruptible Power Supply (UPS). Let's install some tools to monitor the system.

www.kreaweb.be

 

 

usb 가 porxmox 장치에 연결되어 있는 환경에서

 

대충 요약하면

 

USB 포트에 맞게 연결되어 있는지 확인하고

lsusb
lsusb -v -s [bus]:[device]

 

NUT 를 설치해주고

apt install nut -y

NUT 디바이스를 확인한다. 

nut-scanner -U

 

 

기본 설정 파일 백업은 생략한다.

 

파일 수정

nano /etc/nut/nut.conf

아래 내용만 입력 

MODE=netserver

 

파일 수정

nano /etc/nut/ups.conf

 

pollinterval = 15
maxretry = 3

offdelay = 120
ondelay = 240

[ups] 
# APC Back-UPS BX1400U-FR
driver = usbhid-ups
port = auto
desc = "APC Back-UPS BX1400U-FR"
vendorid = 051D
productid = 0002
serial = secret

 

ups 드라이버 시작

upsdrvctl start

 

파일 수정

nano /etc/nut/upsd.conf
LISTEN 0.0.0.0 3493
LISTEN :: 3493

 

nano /etc/nut/upsd.users
[upsadmin]
# Administrative user
password = ********
# Allow changing values of certain variables in the UPS.
actions = SET
# Allow setting the "Forced Shutdown" flag in the UPS.
actions = FSD
# Allow all instant commands
instcmds = ALL
upsmon master

[monuser]
# Normal user
password = ********
upsmon slave

 

 

nano /etc/nut/upsmon.conf
RUN_AS_USER root
MONITOR ups@localhost 1 upsadmin ******* master

MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h"
NOTIFYCMD /usr/sbin/upssched
POLLFREQ 4
POLLFREQALERT 2
HOSTSYNC 15
DEADTIME 24
MAXAGE 24
POWERDOWNFLAG /etc/killpower

NOTIFYMSG ONLINE "UPS %s on line power"
NOTIFYMSG ONBATT "UPS %s on battery"
NOTIFYMSG LOWBATT "UPS %s battary is low"
NOTIFYMSG FSD "UPS %s: forced shutdown in progress"
NOTIFYMSG COMMOK "Communications with UPS %s established"
NOTIFYMSG COMMBAD "Communications with UPS %s lost"
NOTIFYMSG SHUTDOWN "Auto logout and shutdown proceeding"
NOTIFYMSG REPLBATT "UPS %s battery needs to be replaced"
NOTIFYMSG NOCOMM "UPS %s is unavailable"
NOTIFYMSG NOPARENT "upsmon parent process died - shutdown impossible"

NOTIFYFLAG ONLINE   SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT   SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT  SYSLOG+WALL+EXEC
NOTIFYFLAG FSD      SYSLOG+WALL+EXEC
NOTIFYFLAG COMMOK   SYSLOG+WALL+EXEC
NOTIFYFLAG COMMBAD  SYSLOG+WALL+EXEC
NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC
NOTIFYFLAG REPLBATT SYSLOG+WALL
NOTIFYFLAG NOCOMM   SYSLOG+WALL+EXEC
NOTIFYFLAG NOPARENT SYSLOG+WALL

RBWARNTIME 43200
NOCOMMWARNTIME 600

FINALDELAY 5

 

 

nano /etc/nut/upssched.conf
CMDSCRIPT /etc/nut/upssched-cmd
PIPEFN /etc/nut/upssched.pipe
LOCKFN /etc/nut/upssched.lock

AT ONBATT * START-TIMER onbatt 30
AT ONLINE * CANCEL-TIMER onbatt online
AT ONBATT * START-TIMER earlyshutdown 30
AT LOWBATT * EXECUTE onbatt
AT COMMBAD * START-TIMER commbad 30
AT COMMOK * CANCEL-TIMER commbad commok
AT NOCOMM * EXECUTE commbad
AT SHUTDOWN * EXECUTE powerdown
AT SHUTDOWN * EXECUTE powerdown

 

nano /etc/nut/upssched-cmd
#!/bin/sh
 case $1 in
       onbatt)
          logger -t upssched-cmd "UPS running on battery"
          ;;
       earlyshutdown)
          logger -t upssched-cmd "UPS on battery too long, early shutdown"
          /usr/sbin/upsmon -c fsd
          ;;
       shutdowncritical)
          logger -t upssched-cmd "UPS on battery critical, forced shutdown"
          /usr/sbin/upsmon -c fsd
          ;;
       upsgone)
          logger -t upssched-cmd "UPS has been gone too long, can't reach"
          ;;
       *)
          logger -t upssched-cmd "Unrecognized command: $1"
          ;;
 esac
chmod +x /etc/nut/upssched-cmd

 

아래 명령어로 이제 시작해주자.

service nut-server restart
service nut-client restart
systemctl restart nut-monitor
upsdrvctl stop
upsdrvctl start

 

ups 연결 확인 가능

upsc ups@localhost

 

 

이제 synology 에서도 ip 확인 가능...

 
반응형