Shutdown Windows computer and Synology NAS using WinNut
Previously, my Windows PC happily send a command to my Synology NAS to shutdown when the UPS (connected to my PC) was running low on battery power. (See my post, “Shutdown Windows computer and Synology NAS using CyberPower UPS“) Things came to a grinding halt when DSM 6 was released and eliminated remote access by the root user…probably a good thing security-wise, of course.
After much research, I discovered the Network UPS Tools (NUT) project. Included in its goals is uniform control and management of UPSs and it seems manufacturers, including Synology, have embraced the “standard”. It’s a server-client model where you connect the UPS to the Synology NAS, the server (aka master), and run a monitoring program on your PC, the client (aka slave), to shut it down when the UPS battery power gets low.
Setup on the NAS side, is as easy as checking a couple option boxes. It’s not so straight forward on the client side of things. I found at least three different Windows client applications, all with less than clear configuration instructions. I settled on WinNUT, but lost patience trying to figure out how to configure the new version and opted for the older one which still seems to work under Windows 10.
Here’s the steps to set everything up. (Note that I have a CyberPower 1500PFCLCD UPS connected via USB to a Synology DS212j NAS currently running DSM 6.2-23739 Update 2.)
1. First, navigate to the WinNUT download page. Download WinNUT-184.108.40.206a-Installer.exe and install it.
2. Next, open your Diskstation Control Panel and choose Hardware & Power. Click on the UPS tab.
3. Enable the options Enable UPS support and Enable network UPS server.
4. Click Permitted DiskStation devices and enter your PC’s IP address in the dialog that appears. Click OK to close the dialog and then click Apply.
5. Run WinNUT Configuration Tool on your PC and click the Edit button.
6. Notepad will open with the config file. Add the following line: MONITOR [email protected]192.168.1.3 1 monuser secret slave
Be sure to substitute your own NAS’s IP address. Note that monuser and secret are the default username and password for the ups device user.
(I won’t go into detail here, but if you want to change the default username and/or password, the UPS config files are in the /usr/syno/etc/ups on the NAS and you need to edit the upsd.users file)
7. Save the file and close Notepad
8. Click the Apply and Start WinNUT button.
9. Click the View button. Scan the log and make sure there are no errors.
If you get a connection error, make sure the IP you entered in the WinNUT config file is your NAS’s correct IP address. Also, make sure you entered your PC’s correct IP address in DiskStation’s Permitted DiskStation devices dialog and applied it.
This should go without saying, but your router/hub needs to be connected to a UPS as well, or your NAS and PC can’t communicate when the power goes off.
10. Click OK to close the WinNUT window.
Now, you can either put the Start WinNUT Ups Monitor shortcut in your Startup folder (start and stop shortcuts are created by the install) or enable the Install As A Service option on the WinNUT window.
I really like the NUT method better than the one it replaced. However, currently, DSM is triggering a low battery event not long after the power goes off, even though my UPS has plenty of battery power. Based on this thread, I’m hoping it’s just a bug that will be fixed at some point.