Shutting down a Win7 PC using a UPS trigger from a Synology NAS

So I have a Synology DS216se NAS on my LAN, which I have just bought a UPS for. I bought a CyberPower Value SOHO 800 based on the reported compatible UPS systems. As hoped the NAS recognised the UPS perfectly.UPS

Next the tricky Part.

I will be running a Windows PC from the same UPS, so I want the PC to talk to the UPS and shut down accordingly.

To be brief:

  1. Get this program for Windows.
    (The latest version WinNUT- comes up clean on Virustotal – using a quick hash scan.)
  2. Click the edit button for the config file, and you will need to add the settings for your UPS master device (the Synology NAS). You can simply use:
    MONITOR ups@192.168.x.x 1 monuser secret slave

    I put this line under the MONITOR examples (obviously not with a # in front of my version, commenting it out)
    Go to part 3.
    I spent a while trying to figure this out. Initially finding a graphical program that worked with windows was proving tricky, so I was trying to use the Windows build of NUT, which was all commandline and the instructions were for linux..
    I was able to get the settings for connecting to the NAS over SSH as described here, I could read out the uspmon.conf file using vi only while logged into the SSH as root. Anyway the config line above is correct for connecting to a Synology NAS device. The highly configurable style of the Synology NAS and their use of NUT is really impressive.

  3. You will need to allow WinNUT to connect to the NAS using the UPS settings on the NAS, just allow your PCs IP address in those settings.
  4. From here I clicked Apply and Start WinNUT and the status changed to Running as Application. That was all. I checked the logs and nothing too interesting, so I went to powered off my UPS at the wall.. Success!!
    Got a couple new lines on my WinNUT Log file.

    Level   NOTICE    03/18/2016 16:04:26    UPS ups@ on battery
    Level   NOTICE    03/18/2016 16:05:27    UPS ups@ on line power

  5. In order to get popup messages to work you need to modify the config. Under the NOTIFYCMD section, the directory needs to be set correctly:
    NOTIFYCMD "\"C:\\Program Files (x86)\\WinNUT\\alertPopup.exe\"

    You can also set custom pop up messages in the config. As mentioned in the Quick Update here, services can’t create popups, which that page has a solution for. In Win 7 Home, this may be useful.

  6. I set a forced shut down after 120 seconds, set the program to run as a service with Auto Startup, applied those settings then clicked OK. Now its running in the background. I reset my computer to test the auto start of the service and tested the shutdown.
  7. It Works!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.