NUT package (2.8.0 and below)
-
Complete noob to NUT. I have a supported UPS, have the package installed and configured with a base configuration. pfSense is returning information about my UPS.
My hardware configuration is as follows:
1x UPS
1x pfSense Machine configured with a Port Forward rule to allow NUT access.
1x File Server running Windows Server 2012 R2 with WinNUT installed.Both the pfSense machine and File Server are connected to the UPS.
I would like pfSense / NUT to send a shutdown command to my File Server if NUT detects that the UPS has dropped to 80% battery capacity. I would then like pfSense to remain online for as long as possible before shutting itself down.
Could someone help me accomplish this? I've read through some of the documentation and attempted a configuration, but I'm running into a few issues.
Specifically, I have a [user] entry with password and set to slave in upsd.users on pfSense, but WinNUT logs are returning a "Can't login to UPS [UPS-Name@192.168.1.1:3493]: Access denied" message.Edit: Solved my first issue of the "Access denied" thing. I guess installing the NUT package creates some hidden information inside of upsd.users that wasn't shown in the Advanced Settings of the pfSense NUT GUI. My NUT user I added was named [monuser] which is a default created when installing the package. Changed it to something else and now WinNUT can connect just fine.
Any tips on creating a configuration to do what I mentioned above though? Shut down File Server at 80% of battery life, then preserve pfSense as long as possible (10% battery remaining or so)?
-
@cortexian said in NUT package:
Any tips on creating a configuration to do what I mentioned above though? Shut down File Server at 80% of battery life, then preserve pfSense as long as possible (10% battery remaining or so)?
To my knowledge, NUT has no provision for initiating shutdown of slaves separate from the master.
-
I use pfsense 2.2.6-RELEASE (amd64) (it's need for asterisk). NUT v.2.1.2 . And I connected UPS Ippon Back comfo pro 800 via usb cable. Driver is set "Geneneric USB UPS (Blazer)", port "Auto".
In "System logs" error: "Data scale!"
What's it? How-to fix it? -
This thread covers the current NUT package which does not support 2.2. 2.3 is the first version supported by the package.
I strongly recommend you upgrade pfSense. 2.2.6 is quite old at this point. Many vulnerabilities have been addressed since then.
-
@dennypage said in NUT package:
This thread covers the current NUT package which does not support 2.2. 2.3 is the first version supported by the package.
I strongly recommend you upgrade pfSense. 2.2.6 is quite old at this point. Many vulnerabilities have been addressed since then.
It's true. But last pfsense not have asterisk package.
-
Hello Denny Page, You mentioned that the current version of Nut tries to shut down the UPS. I'm discovering that the UPS that I'm using (Cyberpower OR500LCD) seems to have a faulty implementation, and blips the power (turns off load and then immediately turns it back on). This seems to have the side effect of corrupting something on my SG-2220 devices, which puts them in a boot loop with a kernel panic.
I'm running 2.4.3 P1 with the latest Nut package available.
A reinstall is required to get the system running again after this event.
After further reading, I'm finding that it doesn't seem to possible to do a safe instant shutdown of a UPS in FreeBSD, because the filesystem doesn't finish syncing until after the shutdown scripts finish. And if the nut shutdown script turns off the UPS, then disk corruption can occur.
So would it be accurate to say that it is only safe to use nut to shutdown pfsense firewalls when the UPS supports a shutdown delay, to allow enough time for the system to fully halt before the load power is pulled?
Josh
-
@stompro said in NUT package:
You mentioned that the current version of Nut tries to shut down the UPS. I'm discovering that the UPS that I'm using (Cyberpower OR500LCD) seems to have a faulty implementation, and blips the power (turns off load and then immediately turns it back on).
I don't have a Cyberpower on hand to double check, but most all UPSs offer some form of shutdown delay. You can check this in the UPS by looking at the ups.delay.shutdown variable using the upsrw command.
-
@dennypage Hello, the ups does report ups.delay.shutdown = 20 by default, but 'upsdrvctrl -k' doesn't seem to make use of it at all. The ups immediately powers off at "Initiating UPS shutdown" and then turns back on immediately.
I tried setting ondelay and offdelay in the driver config and that had no effect.
This UPS also doesn't seem to store variables set by upsrw.
I'm testing by setting the lowbatt setting to 90%, so I don't need to wait so long... I wonder if that is causing problems? Maybe this UPS is hard coded to the 10% lowbatt, so it is immediately turning back on since when it shuts down it sees that the battery is over 10% and turns back on? I'll test that next.
The key thing though is that it doesn't seem to actually support the shutdown delay. The Cyberpower control software doesn't let me set any settings related to a shutdown delay/startup delay, so I think this device just doesn't support it, even though the UPS_HID interface has a variable for it.
Josh
-
It may not be persistent in the UPS. You might also try explicitly setting offdelay and ondelay in the extra arguments section.
-
@dennypage Ohh, I just figured out that CyberPower UPS's take shutdown delays in 60 second increments, and round down. So I was telling it 45 seconds, which was rounded down to 0, so instant shutoff.
I wonder if that is what "ups.timer.shutdown=-60" is supposed to tell me?
So setting "offdelay=60" in the extra driver arguments does seem to work.
Now I just need to figure out the ondelay, since it seems to start back up after that delay no matter if the power is restored or not.... Now I see that there is a note in the usbhid-ups man page about some UPS's starting back up even when mains power isn't present. It says I should set "ondelay=-1" so I'll give that a try.
Next time I'll purchase a model that supports waiting for a certain battery level before restart.
I've been trying to find out where the 60 second interval thing is documented but I haven't found it yet.
Josh
-
@stompro "ondelay=-1" sets the UPS to never restart after the power returns, "ondelay=0" seems to say return once power has returned.
I thought there may be a power race condition, but with "ondelay=0" it seems to work. If the power returns right after the system starts shutting down, the UPS will still turn off after the offdelay period, and then it will power back on shortly afterwards(10 seconds) so everything comes back up correctly.
Josh
-
Glad you got it to work. Interesting info on shutdown delay for the cyberpower. I didn’t know that. Thanks.
-
@dennypage It looks like there is movement to fix the defaults for cyberpower systems in the future, If the default values were 60 for offdelay and 0 for ondelay then the UPS would just work for most purposes. https://github.com/networkupstools/nut/issues/432 I added my 2 cents to that issue. If you own any other Cyberpower models I would be very curious of the ondelay issue is only with the OR models, or if that is the way they all work?
-
Do you fully recommend using the nut package instead of apcupsd for an APC BR1500GI UPS? If so, why?
Also, how do I reset the battery.date variable in nut to the correct date? Mine is set to 2001 which is obviously wrong. I guess I forgot to do a reset in PowerChute when I replaced my batteries 1.5 years ago.
-
If you are using an locally attached APC ups, I would say that the choice of NUT vs apcupsd is a matter of personal preference. Both packages are maintained. The apcupsd package offers a more "native" APC feel. The NUT package offers a dashboard widget. Either should work fine.
upsrw is used to set information in a UPS. See the man upsrw man page here.
-
@dennypage said in NUT package:
If you are using an locally attached APC ups, I would say that the choice of NUT vs apcupsd is a matter of personal preference. Both packages are maintained. The apcupsd package offers a more "native" APC feel. The NUT package offers a dashboard widget. Either should work fine.
upsrw is used to set information in a UPS. See the man upsrw man page here.
I see. What is your personal preference between the two? Are both updated in the pfsense package manager section? When I go to apcupsd's website, I see that the latest changelog there was from 2016, I believe. So I was under the assumption that it wasn't maintained. Can apcupsd also act a server to slave servers in the network?
-
When I referred to packages being maintained, I was referring to the pfSense packages. You can see the changelog for the apcupsd package here, and the changelog for the NUT package here.
apcupsd does offer some form of remote protocol support. I'm not overly familiar with it's capabilities other than knowing that NUT has a client for it (described here).
My personal preference? I'm the author/maintainer of the NUT package.
-
I use both, acpupsd to connect to the UPS, act as the NIS and shutdown pfSense when the batts are low. NUT is setup with "Remote apcupsd", simply to have the widget on the dashboard. Best of both worlds IMHO.
-
@dennypage said in NUT package:
When I referred to packages being maintained, I was referring to the pfSense packages. You can see the changelog for the apcupsd package here, and the changelog for the NUT package here.
apcupsd does offer some form of remote protocol support. I'm not overly familiar with it's capabilities other than knowing that NUT has a client for it (described here).
My personal preference? I'm the author/maintainer of the NUT package.
I see. I knew you were going to say that :)
@grimson said in NUT package:
I use both, acpupsd to connect to the UPS, act as the NIS and shutdown pfSense when the batts are low. NUT is setup with "Remote apcupsd", simply to have the widget on the dashboard. Best of both worlds IMHO.
Sorry, I'm new to including the UPS in the network so I'd have to ask some questions about this. So you're using apcupsd to actually interface with the UPS locally and it controls only pfsense? And then NUT does the signalling to remote clients?
What does "remote apcupsd" mean?
-
@grimson said in NUT package:
I use both, acpupsd to connect to the UPS, act as the NIS and shutdown pfSense when the batts are low. NUT is setup with "Remote apcupsd", simply to have the widget on the dashboard. Best of both worlds IMHO.
I understand that this works... but if you are going to use NUT anyway I think using apcupsd to manage the UPS is a little excessive...