1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

Using QNAP UPS server to signal other devices

Discussion in 'QNAP' started by Dennis Wood, May 26, 2014.

  1. Dennis Wood

    Dennis Wood Senior Member

    Joined:
    Aug 15, 2008
    Messages:
    408
    Setup for APC UPS where QNAP box is MASTER, Pfsense box is SLAVE.

    Just posting this for reference. If you are using for example a Pfsense based router, QNAP NAS, and an APC UPS, then you can take advantage of QNAP's UPS "server" to signal a router shutdown in case of power failure. You normally can only plug one device into a USB signaling UPS, so the ability for one device to act as a UPS server is very useful. QNAP uses the NUT package to manage UPS which means you can interface with it from Linux, Windows etc. QNAP in this case is running QTS 4.1, and Pfsense 2.3

    Here's how you do it:

    1. Make sure your NAS, network switch, router etc. are connected to the UPS(s) you want to control. If power goes out and the switch immediately powers off, the process below won't work!

    1. Make sure your NAS is connected to the APC UPS using USB cable. On the NAS, enable UPS server (System Settings -> External Device -> UPS), and add the IP address of your router, or workstation that you want to signal. You can use this same function to signal other NAS units as well..just add them to the IP list. If all is working, the UPS model and battery capacity should appear in the NAS GUI.

    2. In my example, Pfsense, download and install NUT using the Pfsense package manager. Under Pfsense services, fire up NUT and click the setup tab. Make sure NUT is set under "UPS Monitoring" to "Remote Nut UPS". At the bottom of the NUT settings page, in the "Remote Nut UPS Settings" area, enter the following:

    Remote Nut UPS Name: qnapups (this is the trick...don't change this name!)
    Remote NUT UPS Address: Your_NAS_IP_Address
    Remote NUT UPS User: Your_NAS_admin_userID
    Remote NUT UPS Password: Your_NAS_admin_password

    From the pfsense dashboard, start the NUT service. That's it. The NUT status page should now display the UPS information provided by the QNAP NAS...and can respond to orderly shutdown requests in case of power outages.




    Setup for Pfsense as MASTER, and QNAP UPS as SLAVE:

    If you want to use the pfsense box as MASTER, and QNAP UPS as slave, this is how you do it:

    Again, for reference, if you want the the pfsense box to be plugged into the UPS, and use the pfsense box as a master (so APC USB cable is attached to pfsense), to shutdown QNAP UPS or others, then here is process.

    1. Download and install NUT on pfsense using the package manager. Plug the APC USB cable into your pfsense router box. Configure NUT for your local UPS, and make sure it is working.

    Under NUT's "Local UPS settings":

    Local UPS Name: qnapups (this is important!)
    Local UPS Model: APC Back-UPS ES USB (for my UPS)
    Local UPS Port: auto (USB only) (for my UPS)

    Don't bother with the Remote Access settings as they don't matter.

    You must set up a NAT rule to allow remote access to NUT on your pfsense box, even from your local network. Under Firewall - NAT, add a rule like this:

    If: LAN
    Proto: TCP
    Scr. addr/Ports: * / *
    Dest Addr/Ports: 192.168.2.1/3493 (change to match your LAN IP)
    NAT IP/Ports: 127.0.0.1/3493

    Now set your QNAP UPS to "Network UPS Slave" mode and you should see the UPS information/runtime etc.

    Cheers,
    Dennis.
     
    Last edited: Nov 18, 2015
    Brady likes this.
  2. HotFix

    HotFix Occasional Visitor

    Joined:
    May 6, 2014
    Messages:
    25
    Location:
    Silver Spring, MD
    That is AWESOME and will certainly help me when I build out my Hyper-V lab. Right now my large APC UPS is terminated into the USB port of my one Hyper-V server, and I was struggling with how leverage this across multiple systems.

    Thank you for sharing this!
     
  3. Dennis Wood

    Dennis Wood Senior Member

    Joined:
    Aug 15, 2008
    Messages:
    408
    You're welcome. We have two UPS in the closet, one attached to a 10GbE server, the other to the TS-870. The rest of the network gear is load balanced across the two UPS units so a brief power blip does not bring the network down. Because the pfsense box does all internet access logging etc, on a small SSD, it's important it gets shut down correctly to avoid file corruption. This setup means fewer UPS required. We had our first extended power outage on Sunday at noon..and all powered up just fine when power was restored.
     
  4. flowrider

    flowrider Regular Contributor

    Joined:
    Apr 7, 2014
    Messages:
    94
    Sorry to resurrect and old thread but I'm using your guide to setup my pfSense box to work with a Synology NAS. I've followed your guide but in the NUT status I'm getting, "Data stale!"

    I'm a bit stuck! Any help is appreciated!
     
  5. JoeJoe

    JoeJoe Regular Contributor

    Joined:
    Jan 7, 2011
    Messages:
    143
    flowrider, how do you have your devices connected?

    On mine I have the pfsense router connected to the APC UPS via the USB cable and the NAS devices listening to commands from the pfsense router.
     
  6. flowrider

    flowrider Regular Contributor

    Joined:
    Apr 7, 2014
    Messages:
    94
    Thanks I got it all working. I have the USB hooked up to my Nas and it broadcasts from there. Now to figure out how to install nut on my Mac.
     
  7. cj4848

    cj4848 New Around Here

    Joined:
    Jan 27, 2015
    Messages:
    2
    Windows 7?

    Hi Guys,

    Do you have any idea on how to get the QNAP to shutdown a Window 7 machine? My Qnap detects my UPS (USB Connection), and I enabled the "network UPS master", and put in the IP of the Windows 7 machine.

    But I have spent days trying to figure out how to configure the Windows 7 machine to detect it.

    Any advice you guys might be able to share would be a HUGE help.

    Thanks!!

    CJ
     
  8. JoeJoe

    JoeJoe Regular Contributor

    Joined:
    Jan 7, 2011
    Messages:
    143
  9. stevech

    stevech Part of the Furniture

    Joined:
    Mar 13, 2010
    Messages:
    7,007
    Location:
    San Diego
  10. cj4848

    cj4848 New Around Here

    Joined:
    Jan 27, 2015
    Messages:
    2
    Thanks guys. I tried installing it before, but at first glance it didn't seem to work... so I moved on. I will give it another shot :) Thanks again!!
     
  11. JoeJoe

    JoeJoe Regular Contributor

    Joined:
    Jan 7, 2011
    Messages:
    143
    Maybe this one is an update to that one?
    https://code.google.com/p/winnut/

    Because the Qnap implementation isn't great, I wouldn't have the NAS run for very long when it sends or receives the power outage signal.
    I put mine as 2 minutes running on battery, go into safe mode.

    Qnap should have an option to 'go into safe mode when x minutes of battery left', but they don't.
     
    Last edited: Feb 2, 2015
  12. stevech

    stevech Part of the Furniture

    Joined:
    Mar 13, 2010
    Messages:
    7,007
    Location:
    San Diego
    Perhaps because the time-left-in-battery estimate from the UPS is kind of inaccurate. And maybe some UPSes lack that reporting.
     
  13. JoeJoe

    JoeJoe Regular Contributor

    Joined:
    Jan 7, 2011
    Messages:
    143
    Naa, I would guess that most UPS devices report the battery life.

    This is what the QNAP shows.
     

    Attached Files:

  14. stevech

    stevech Part of the Furniture

    Joined:
    Mar 13, 2010
    Messages:
    7,007
    Location:
    San Diego
    Right.. the UPS reports loss of power to the NAS via USB.
    NAS generates LAN notices.
    2 minutes later, NAS shuts down.

    I didn't see where the NAS gets or asks for "remaining run time" based on battery discharge, from the UPS.

    Admittedly a few years ago, but I had some under $100 UPSes that reported loss and restoration of power but not battery condition.
     
  15. JoeJoe

    JoeJoe Regular Contributor

    Joined:
    Jan 7, 2011
    Messages:
    143
    It reports the 'estimated protection time' along the bottom.
     
  16. JoeJoe

    JoeJoe Regular Contributor

    Joined:
    Jan 7, 2011
    Messages:
    143
    I wish I could buy a UPS with a physical button that disables the beeping, oh how I hate the beeping. With the APC UPS I have to connect them to a laptop running their app to attempt to disable the beeping, but on the latest UPS, that setting isn't saved.

    I may see if I can take the UPS apart and baffle or remove the beeper.
     
  17. stevech

    stevech Part of the Furniture

    Joined:
    Mar 13, 2010
    Messages:
    7,007
    Location:
    San Diego
    Yes, I've read of people doing that. In a residence, lordy-me do they want the beeper far away to awake us if the power fails? Daytime and awake, we surely know the power's off.
     
  18. EricS

    EricS New Around Here

    Joined:
    Feb 7, 2015
    Messages:
    1
  19. stevech

    stevech Part of the Furniture

    Joined:
    Mar 13, 2010
    Messages:
    7,007
    Location:
    San Diego
    Protects the NAS - importantly. But we'd like a simple way that works, to also signal the PCs on the LAN.
     
  20. JoeJoe

    JoeJoe Regular Contributor

    Joined:
    Jan 7, 2011
    Messages:
    143
    In your QNAP settings, if you want the NAS to power backup when power returns, select the next option down that reads 'auto protection'.

    I have mine set to 2 mins.

    If you end up using the UPS NUT, remember to plug the network switch in the battery backed power port.