I'm currently running a DS923+ NAS, with a router PC and several network equipments.
And, I recently purchased a UPS from APC for extra safety, and connected to the NAS. (I checked the energy consumption and confirmed that the UPS can sustain all connected electronics)
However, I was wondering if there's a way to also inform my router PC for safe shutdown, since I also have some Proxmox containers running on it.
So, what I want is:
-
The UPS must be connected to the Synology NAS via USB, for extra safety
-
If the NAS shutdowns, the Proxmox server should also shutdown. Maximum time delay is 5 min. (If the NAS shutdowns after 5 mins of power outage, the Proxmox should shutdown within 10 mins (5+5) from the initial power outage)
-
When the power is restored, the NAS automatically turns on. If so, the Proxmox server should also start within 5 mins
Can anyone suggest a way to make this working?
What I'm currently thinking of is using a cron job for step 2, and the NAS sending WOL packets when the NAS starts, making the Proxmox server to start with it.
Thanks in advance!
Videos
Hi everyone,
I know there's information on using our Synology NAS' as UPS servers to power down other Synology devices, but it took me some time to piece together how to use Synology to safely power down my Mac Mini server in the event of a power outage so I figured I'd put it into a writeup here to maybe help some others.
WHY: Most UPS' only have one USB port to control a single device in the event power outage and the battery running low. If you're like me, I have my Synology NAS and other devices (i.e. Mac server) that I want all powered down safely.
My setup: These steps are not specific to my hardware/OS/UPS, but figured I'd provide for context.
-
APC 600VA UPS
-
Synology DS918+
-
Mac mini (running Ubuntu server 20.04, not Mac OS X) - this is not specific to Linux, it will work for Mac, Windows servers/computers
-
Your router needs to be also attached to the UPS otherwise your NAS and computers/servers won't be able to communicate.
Synology Setup
-
Connect NAS to UPS via USB cable.
-
Open up DSM and go to Control Panel > Hardware & Power > UPS (tab)
-
Enable UPS Support and check "Enable network UPS server"
4. Click "Permitted DiskStation Devices" and input the IP addresses of your servers/computers you would like to power down. In my case, I input the IP of my Mac Mini.
5. Apply settings. If you click, "Device Information" you should see your UPS info. (May require a restart of the NAS, I can't remember)
Server/Computer Setup
Linux
Synology is running a NUT Server (http://networkupstools.org) and in this part we have to install the Nut-client to monitor the NAS. I am walking through setup of the Nut-client on Linux, but the same basic steps apply for Mac/Windows. The NUT website has download/install instructions specific to Windows/Mac.
1.Install NUT
sudo apt-get install nut
2.Modify /etc/nut/nut.conf file to specify your computer/server as a client instead of server. Edit this specific line:
MODE=netclient
3.Add Synology address and credentials to /etc/nut/upsmon.conf
MONITOR ups@192.168.0.102 1 monuser secret slave
*Note: these credentials can be changed or you can add a user by SSHing into the NAS and modifying /usr/syno/etc/ups/upsd.users.
4. Lastly, start the nut-client service.
service nut-client restart
Now if I unplug my UPS (to simulate power outage), my Mac will update with the status of the UPS and also will safely shutdown when Synology triggers. I left my Synology settings to trigger shutdown when the UPS battery runs low, but you can check "Time before DiskStation enters Safe Mode" in step 3 above and put a specific time to shutdown.
Windows (Thanks to u/xnaas for providing Windows instructions)
-
Download and install the latest binary https://github.com/networkupstools/nut-package-archive/tree/master/windows
During install, uncheck the box for Install libUSB driver
2. Go to the etc folder of your NUT installation folder
Default: C:\Program Files (x86)\NUT\etc
3. Rename or copy nut.conf.sample to nut.conf
4. Rename or copy upsmon.conf.sample to upsmon.conf
5. Edit MODE inside nut.conf
MODE=netclient
6. Edit upsmon.conf
Find the SHUTDOWNCMD section
Default: SHUTDOWNCMD "/sbin/shutdown -h +0"
Change the default to something like SHUTDOWNCMD
SHUTDOWNCMD "C:\\WINDOWS\\system32\\shutdown.exe -s -t 0"
Customize the time (-t 0) to your liking. Optionally add -f to force the shutdown. If you want to hibernate, replace -s with -h.
Find the MONITOR section and add the following
MONITOR ups@192.168.1.150 1 monuser secret slave
Make sure to update the IP to your Synology IP
7. Copy libgcc_s_dw2-1.dll from the bin subfolder to the sbin subfolder
8. Download OpenSSL library https://indy.fulgan.com/SSL/
9. Copy libeay32.dll and ssleay32.dll to the sbin subfolder
10. Launch services.msc from Run (WIN+R)
11. Find the service called Network UPS Tools and Start it
Mac
To be added later. In the meantime, this wiki should be a good guide: https://github.com/networkupstools/nut/wiki/NUT-on-Mac-OS-X
Hope this helps someone!
So I hooked my UPS to my DS218+ and it's detected, it shows the battery left in details and all that.
But now that it's no longer hooked to my PC, the monitoring software is obviously useless. I expected that.
However there is this option in the UPS options on the NAS "enable network ups server" which make me believe there is a way to somehow monitor the UPS through the NAS via SNMP or some other way?
does anyone have some experience with this and can point me into the right direction? thx.
ok, so how do I tell my PC to shutdown?
I don't know the answer to your question, but I've had a few power outages recently and am about to purchase. I was looking at this CyberPower UPS at Costco but was wondering what you got. I am going to use it to keep my modem, router and NAS powered up or to shut down gracefully. I have a 216j