QNAP recognizing NUT
-
@FrankZappa On pfSense NUT you need to add the following lines to:
Additional configuration lines for upsd.users:
[monuser]
password=enterpasswordhere
upsmon slaveYou then need to setup the same "monuser" with the same password in upsmon/nut on your QNAP.
Last but not least you need to create firewall rule on the interface where your QNAP exists, and allow access to "LAN Address" from QNAP with TCP port 3493
-
@FrankZappa See the Remote access to NUT thread.
-
@dennypage I got it to work, but not sure if I set my self up for a security hole in my system. I have both APCUPSD and NUT working side by side on my pfSense box. I set up a NAT entry as follows:
My pfSense box displays both APCUPSD and NUT info. QNAP seems to be fine connecting to APC UPS Box via pfSense:
Do I have the NAT entry set up correctly? I know it works, but I have opened up anything I shouldnt.? Thanks
-
@FrankZappa Looks Good To Me
Btw, forgot to mention, make sure that apcupsd is not configured to actually manage the UPS.
-
@dennypage Therin lies the great paradox!!!! Is it APCUPSD or NUT that manages the UPS on pfSense? I have both running.
-
@FrankZappa said in QNAP recognizing NUT:
Is it APCUPSD or NUT that manages the UPS on pfSense? I have both running.
Both will attempt to manage the UPS. You need to disable one or the other.
-
@dennypage Thanks denypage. However, here's my confusion; I have both running now and everything seems fine (QNAP recognizes NUT on pfSense). Also, I don't see any settings on NUT (in my configuration I have no arguments in advanced settings) where it would conflict with APCUPSD. From what I can see, NUT only displays data and the QNAP will send a shutdown command to itself based on the data it reads from NUT. APCUPSD, on the other hand, has some shutdown commands based on remaining power and time. But that appears to only affect the pfSense box (not the QNAP). If true, I'm ok with this setup and it's really what I wanted to happen. Am I missing something? Will they conflict?
-
@FrankZappa said in QNAP recognizing NUT:
From what I can see, NUT only displays data and the QNAP will send a shutdown command to itself based on the data it reads from NUT. APCUPSD, on the other hand, has some shutdown commands based on remaining power and time.
Things are a lot more complicated than that. NUT uses a hardware (UPS) centric approach. Left to its own devices, which is a good idea, NUT will initiate a shutdown when the UPS declares a low battery event. This is not based on time, but the UPS's view of battery exhaustion. When the LB event is declared, this is communicated to the NUT clients (including the client on the local host). The clients then initiate a shutdown of their respective OSs. The NUT server waits for all clients to disconnects before instructing the UPS to cut power after a delay. Cutting power is critical for recovery when mains return.
Apcupsd uses a software centric approach which is at odds with NUT's approach. If the time on battery determines that it's time to shutdown and initiates it, the NUT server will never know. Subsequently, neither will NUT clients. So from NUT's point of view, power will simply stop. Even if you try and coordinate the amount of time on battery for all the systems, you still have an issue because the systems poll at different times and have different shutdown durations.
If you want to use NUT for distributed shutdown, you have to disable apcupsd, or disable its ability to send shutdown instructions to both the OS and the UPS.
That said, I'm curious... why do you want to run both?
-
@dennypage said in QNAP recognizing NUT:
That said, I'm curious... why do you want to run both?
Ha! Great question. Dont laugh. I like the APC widget on my PFSense dashboard (I know, silly). Also, APCUPSD lets me configure shutdown conditions via their GUI. I don't see those options in NUT.
Thanks for the detailed explanation. Makes sense now and I'll probably disable APCUPSD and leave NUT running.
I do have a couple of questions.
- How do you adjust the shutdown parameters in NUT e.g. when the battery gets to say 8%, begin shutdown of clients.?
- If my QNAP is set to shut down 10 minutes after a power failure, and the APC unit still has another 40 minutes of runtime, does it matter if NUT will ever know APCUPSD shut down things?
Thanks
-
@FrankZappa said in QNAP recognizing NUT:
I do have a couple of questions.
- How do you adjust the shutdown parameters in NUT e.g. when the battery gets to say 8%, begin shutdown of clients.?
- If my QNAP is set to shut down 10 minutes after a power failure, and the APC unit still has another 40 minutes of runtime, does it matter if NUT will ever know APCUPSD shut down things?
- By default, NUT drives everything off of the UPS declaring LB (Low Battery). It's best to leave it this way. If your UPS has the capability, you can configure parameters in the UPS itself that determine LB based on % of battery or seconds of remaining runtime at current load. This would be done via the upsrw command. The default for most UPSs is 5% battery. Alternatively, you can also control things (depending upon the UPS) via overriding variables in the Extra Arguments to driver section. I do not generally recommend people to do this because it can be complicated and requires testing to ensure that everything works correctly.
- [I'm a little confused about what you are asking, because apcupsd isn't available on QNAP, but only on pfSense. If apcupsd on pfSense shuts everything down, apcupsd will issue a power off command to the UPS which would cut power for all hosts and the QNAP would have no warning.]
I'm assuming what you are asking about is NUT on the QNAP being configured to power off the system after N minutes on battery, and that this happens before LB. In that circumstance, if power returns before the UPS is exhausted, the QNAP will not recover, and remain "powered off" until manually reset. Generally undesirable.
For both apcupsd and NUT, in addition to the goal of safe automatic shutdown, there is the goal of safe automatic recovery when power is restored.
-
@dennypage Sorry, you are correct. I meant to say NUT on the QNAP being configured to power off the system. If QNAP (connected via NUT) is set to shut down after 10 minutes, and it does, why won't the QNAP restart itself when power is restored (if APCUPSD is also running) Will it (QNAP) turn itself back on if I only use NUT (disable APCUPSD)?
Thanks again.
-
@FrankZappa I think you're conflating two different issues.
Issue 1: Running both apcupsd and NUT on pfSense with apcupsd configured to shutdown after N minutes of being on battery. Consider the following scenario:
- T-0: Mains fail, and the UPS goes on battery.
- T-1a: The NUT server notices that the UPS is on battery during its next poll.
- T-1b: apcupsd notices that the UPS is on battery during its next poll.
... - T-2: Even though the UPS has not declared a low battery, apcupsd reaches the time on battery limit and initiates a shutdown of pfSense. The NUT server on pfSense is killed, and the QNAP NUT client looses its connection.
- T-3: apcupsd completes its pfSense shutdown proceedure and instructs the UPS to cut power after a brief delay.
- T-4: The UPS cuts power. The QNAP has no warning, and is unprepared for the power loss.
Issue 2: Running NUT on pfSense, with QNAP configured to shut down after N minutes of being on battery. Consider the following scenario:
- T-0: Mains fail, and the UPS goes on battery.
- T-1: NUT notices that the UPS is on battery during its next poll. This is communicated to all attached NUT clients.
... - T-2: Even though the UPS has not declared a low battery, the QNAP reaches the time on battery limit and initiates a shutdown of the QNAP.
- T-3: The QNAP completes its shutdown.
- T-4: Mains return. Because LB has not been seen, the NUT server does not initiate a shutdown of pfSense, nor does it instruct the UPS to cut power. It simply returns to monitoring the UPS as before T-0. There is nothing to cause the QNAP to restart, and it will remain powered off until physically reset.
For reference, this is what you expect to happen with NUT:
- T-0: Mains fail, and the UPS goes on battery.
- T-1: The NUT server notices that the UPS is on battery during its next poll. This is communicated to all attached NUT clients.
... - T-2: The NUT server notices that the UPS battery is low during polling. It communicates this to all attached NUT clients and instructs them to shutdown.
- T-3: The NUT clients initiate their shutdowns and disconnect from the NUT server.
- T-4: After the last client disconnects, the NUT server initiates a shutdown of pfSense.
- T-5: The NUT server completes its pfSense shutdown proceedure and instructs the UPS to cut power after a brief delay.
- T-6: The UPS cuts power.
... - T-4: Mains return. The UPS begins recharging the battery.
- T-5: After the battery charge exceeds the minimum amount (usually 5%), the UPS turns the power back on.
- pfSense and the QNAP boot back up.
I've simplified several things in the above descriptions, but they should still give you a good general idea of what the basic issues are.
-
@dennypage Thanks for the detailed explanation. I have turned off APCUPSD and only use NUT now. I understand 99% of what you told me. Here's where I don't understand what happens.
My QNAP has the following settings for UPS:
The 8-minute shutdown is random. My thinking is if the power is off for 5 minutes, it will likely be off for a while. I chose 8 minutes to give it plenty of time to shut down.Here's where I'm confused (the 1%): My QNAP is set to turn back on once power is restored:
On Issue 2 you you mentioned "There is nothing to cause the QNAP to restart, and it will remain powered off until physically reset"
If I only use NUT, and the QNAP shuts down after 8 minutes, yet there is plenty of battery left on UPS, and the power comes back on in say 20 minutes, will my QNAP restart or not? If not, is there a setting I can check in NUT or QNAP to have it restart?
Thanks Again, Again.
-
@FrankZappa said in QNAP recognizing NUT:
My QNAP has the following settings for UPS
I don't have a QNAP, so it's difficult for me to provide QNAP specific guidance. However, my speculation, based on what is shown in the GUI, is "auto-protection" mode shuts down most of the unit but leaves NUT running so it can perform a reboot if power returns before the UPS declares LB and power is cut. Assuming this my speculation is correct, this is the thing to choose.
FWIW, Synology attempts similar cuteness with NUT, although I wish they wouldn't. In the end it creates more problems than it solves.
@FrankZappa said in QNAP recognizing NUT:
Here's where I'm confused (the 1%): My QNAP is set to turn back on once power is restored
This appears to be a GUI setting for a common setting that you would historically find in the BIOS, which says what to do when power is newly supplied to the unit. Options usually are:
- Turn On
- Stay Off
- Last state
Last state means if turn on if the NAS was on when power was removed, and stay off if the NAS was off when power was removed.
You would want the "Turn on the NAS automatically" which means the NAS will always boot up when power is connected.
-
@dennypage Many thanks. I appreciate your knowledge and patience. I now only have NUT running on pfSense. It would be nice if pfSense made a nice-looking widget for NUT, but that's a discussion for another time. Again, thanks for the education.
-
-