Using QNAP UPS server to signal other devices

Dennis Wood

Senior Member
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:

HotFix

Occasional Visitor
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!
 

Dennis Wood

Senior Member
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.
 

flowrider

Regular Contributor
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!
 

JoeJoe

Regular Contributor
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.
 

flowrider

Regular Contributor
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.
 

cj4848

New Around Here
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
 

cj4848

New Around Here
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!!
 

JoeJoe

Regular Contributor
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:

stevech

Part of the Furniture
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.

Perhaps because the time-left-in-battery estimate from the UPS is kind of inaccurate. And maybe some UPSes lack that reporting.
 

JoeJoe

Regular Contributor
Naa, I would guess that most UPS devices report the battery life.

This is what the QNAP shows.
 

Attachments

  • nasups.png
    nasups.png
    55.4 KB · Views: 2,043

stevech

Part of the Furniture
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.
 

JoeJoe

Regular Contributor
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.
 

stevech

Part of the Furniture
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.

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.
 

stevech

Part of the Furniture
Haha yeah the beeping sure is annoying, at least you're alerted to the issue though ;) I recently set up my NAS to power down on UPS battery with the tips posted here and some info in http://www.rootusers.com/setting-qnap-nas-to-shutdown-on-ups-battery-power/ much easier than I thought it would have been, just wanted to say thanks now my data are hopefully a bit safer. :)
Protects the NAS - importantly. But we'd like a simple way that works, to also signal the PCs on the LAN.
 

JoeJoe

Regular Contributor
Haha yeah the beeping sure is annoying, at least you're alerted to the issue though ;) I recently set up my NAS to power down on UPS battery with the tips posted here and some info in http://www.rootusers.com/setting-qnap-nas-to-shutdown-on-ups-battery-power/ much easier than I thought it would have been, just wanted to say thanks now my data are hopefully a bit safer. :)

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.
 
Similar threads
Thread starter Title Forum Replies Date
P QNAP NAS Hacked QNAP 70
dosborne Another round of attacks on QNAP QNAP 3
D Strange Firewall Behavior on QNAP TS-230 QNAP 11
nick002 How to set up VPN QNAP NAS? QNAP 6

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top