After recently buying a UPS and learning about the possibilities with NUT, I quickly began going insane trying to configure the TNAS to run as either:
- The netserver, or;
- A netclient
If you're unsure how to set up the netserver, here's the guide I followed to set it up with multiple raspberry pis. Though in my case I used a raspberry pi as the netserver, and an OPNsense router as the netclient.
This would be much easier if there was a text editor in TNAS' linux install, but alas, nano and other text editors I know of are missing. So I copy the config files to a network share and then edit them from my laptop.
It would be easier again if Terra-Master provided these options in the web GUI UPS section.
I use PuTTY for SSH, and Notepad++ to edit the config files.
DO THIS AT YOUR OWN RISK
Prerequisites
- A device on the same network set up as a NUT netserver
- IP address of the netserver
- UPS name on the netserver
- Username and password for the netclient
1. Log in as admin via SSH
2. Elevate to super user
Code: Select all
sudo su
Code: Select all
cp /etc/nut.conf /mnt/md0/<NETWORK-SHARE>/
cp /etc/upsmon.conf /mnt/md0/<NETWORK-SHARE>/
Code: Select all
mv /etc/nut.conf /etc/nut-old.conf
mv /etc/upsmon.conf /etc/upsmon-old.conf
Code: Select all
chmod 777 /mnt/md0/<NETWORK-SHARE>/nut.conf
chmod 777 /mnt/md0/<NETWORK-SHARE>/upsmon.conf
7. Update nut.conf
The second last line needs to be set to the right value (netclient). Mine was line 32, ymmv
Before:
Code: Select all
MODE=netserver
Code: Select all
MODE=netclient
8. Update upsmon.conf
Here you'll set the UPS name, netserver address, netclient username and password, and role of the TNAS as a slave.
Mine was line 88, ymmv
Before:
Code: Select all
MONITOR ups@localhost 1 monuser secret master
Code: Select all
MONITOR <UPS-NAME>@<IP-ADDRESS-OF-NETSERVER> 1 <NETCLIENT-USERNAME> <NETCLIENT-PASSWORD> slave
Code: Select all
MONITOR myups@192.168.1.123 1 clientusername clientpassword slave
9. Copy the updated config files to /etc
Code: Select all
cp /mnt/md0/<NETWORK-SHARE>/nut.conf /etc/
cp /mnt/md0/<NETWORK-SHARE>/upsmon.conf /etc/
Code: Select all
chmod 644 /etc/nut.conf
chmod 644 /etc/upsmon.conf
Code: Select all
reboot
When I turn off power to the UPS at the wall socket, the TNAS goes into hibernation/safe mode within a few seconds.
When I turn power back on to the UPS, the TNAS boots up within a few seconds.
Amazingly, my TNAS now reports that a UPS is connected: And weirdly, the UPS web GUI page says it's configured as a TNAS UPS server: