Connect your Linux system via a NUT client to the Synology NAS running NUT to shutdown your Linux system when a power failure occurs.
Prerequisites
- Make sure you have rights to connect to the Synology NAS
Synology NAS:
control panel, Hardware & Power,UPS
Select Enable Network UPS Server, Permitted Disk Station Devices.
Select the devices who are allowed to connect.
Installation NUT client CentOS 6.9:
- Download the binary package of Feodora EPEL6, nut-client
- Install on Linux machine with rpm command:
for example: rpm -ivh nut-client-2.6.5-2.el6.x86_64.rpm
- make a user nutmon and add to group nut:
adduser nutmon
passwd nutmon
usermod -a -G nut nutmon
groups nut
The configuration files :
/etc/ups/
check nut group read rights upsmon.conf
upsmon.conf:
RUN_AS_USER nutmon
MONITOR <name ups, see synology ups.conf>@<ip address> 1 <user, see synology upsd.users> <password, see synology upsd.users> slave
MINSUPPLIES 1
SHUTDOWNCMD “/sbin/shutdown -h +0”
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
To run upsmon at startup:
chkconfig –list ups
chkconfig ups on
to check upsmon running:
service ups status
ps -ef |grep upsmon:
root 2271 1 0 Jul08 ? 00:00:00 /usr/sbin/upsmon
nutmon 2273 2271 0 Jul08 ? 00:00:09 /usr/sbin/upsmon
To start en stop upsmon:
service ups start
service ups stop
The nut client on Ubuntu 20.04 :
Terminal:
- Sudo apt install nut-client
- Check permission on Synology NAS to connect to network UPS server:
sudo upsc <user>@<synology server>
for example upsc ups@192.168.1.10
- sudo adduser nutmon
- sudo usermod -a -G nut nutmon
- cd /etc/nut
sudo vi upsmon.conf:
RUN_AS_USER nutmon
MONITOR <name UPS>@<synology nas server> 1 <user> <password> slave
“slave” means this system shuts down immediately when power goes critical.
<powervalue> is an integer – the number of power supplies that this UPS
# feeds on this system. Most computers only have one power supply, so this
# is normally set to 1. You need a pretty big or special box to have any
# other value here.
For example:
MONITOR ups@192.168.1.10 1 monuser password slave
MINSUPPLIES 1
SHUTDOWNCMD “/sbin/shutdown -h +0”
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
- sudo vi nut.conf
MODE=netclient
- sudo systemctl enable nut-client
- sudo systemctl start nut-client
- sudo systemctl status nut-client