Mike Lee
2016-Mar-06 06:40 UTC
[Nut-upsuser] Incorrect battery.runtime.low being reported?
Hi folks, I have a curious issue I'm trying to understand. I'll give my problem description first, then suggested metadata below. My setup is as shown in http://networkupstools.org/docs/user-manual.chunked/images/advanced.png, where my UPS is connected to my NAS via USB, and other computers as well as the NAS are powered by the UPS. As a test, I configured the NAS to enter safe mode, direct the other machines to shut down, then shut down the UPS, after one minute on battery. The test worked fine, and everything shut down in the correct order and came back up when power returned. My normal configuration is intended to maximize uptime so I want the above sequence to happen when the UPS reports "OB LB" instead of after one minute OB. As part of the desired second configuration, I reset the UPS to report low battery when it had 10 minutes (600s) of estimated battery left. However, battery.runtime.low as reported to NUT is still the default of 120. Ideally, I'd like to fix any possible configuration/administration mistakes so that upsc correctly reports the 600 value as set on the UPS itself. However, I'd also like to keep using the software as provided by my NAS manufacturer to make upgrades easier. If this miscommunication between the UPS and NUT can't be fixed, I want to confirm that it won't cause the entire infrastructure to wait until there are only 120 seconds left before powering down. In other words, I want to ensure that the 600-second value configured on the UPS will be honored. I read the docs and am not using override.battery.runtime.low. I just want to sanity check/confirm that the 120 value given by upsc will not override the the 600 value on the UPS itself. Thank you! --Mike> OS name and version,Synology DSM 5.2-5644 Update 5 `uname -a` gives: Linux nas 3.10.35 #5644 SMP Fri Jan 22 13:39:32 CST 2016 x86_64 GNU/Linux synology_avoton_1815+> exact NUT version,Not exactly sure how to query DSM for package versions, but `upsc` reports: Network UPS Tools upsc SDS5-2-2015Q1branch-5619-150904> NUT installation method: from source tarball, package or Subversion,Included with default DSM v5.2 distribution (specific version above)> exact device name and related information (manufacturing date, web pointers, ?),APC SMT1000, `upsc` reports: battery.charge: 100 battery.charge.low: 10 battery.charge.warning: 50 battery.runtime: 5460 battery.runtime.low: 120 battery.type: PbAc battery.voltage: 27.1 battery.voltage.nominal: 24.0 device.mfr: American Power Conversion device.model: Smart-UPS 1000 device.serial: XXXXXXXXXXX device.type: ups driver.name: usbhid-ups driver.parameter.pollfreq: 30 driver.parameter.pollinterval: 5 driver.parameter.port: auto driver.version: SDS5-2-2015Q1branch-5619-150904 driver.version.data: APC HID 0.95 driver.version.internal: 0.38 ups.beeper.status: enabled ups.delay.shutdown: 20 ups.firmware: COM 02.1 / UPS.05.D ups.mfr: American Power Conversion ups.mfr.date: 2010/11/26 ups.model: Smart-UPS 1000 ups.productid: 0003 ups.serial: XXXXXXXXXXXX ups.status: OL ups.timer.reboot: -1 ups.timer.shutdown: -1 ups.vendorid: 051d
Charles Lepple
2016-Mar-08 04:00 UTC
[Nut-upsuser] Incorrect battery.runtime.low being reported?
On Mar 6, 2016, at 1:40 AM, Mike Lee <curby+forums at cur.by> wrote:> > As part of the desired second configuration, I reset the UPS to report > low battery when it had 10 minutes (600s) of estimated battery left. > However, battery.runtime.low as reported to NUT is still the default > of 120."There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors." -- https://twitter.com/secretGeek/status/7269997868 It seems like the NUT usbhid-ups driver is a little overzealous when it comes to caching UPS values associated with NUT variables: it is not refreshing certain variables unless they were changed through NUT. This is due to the HU_FLAG_SEMI_STATIC flag here (so other similarly-marked variables would be affected as well): https://github.com/networkupstools/nut/blob/master/drivers/apc-hid.c#L309 If you stop and start the driver, it should refresh. I created an issue on Github so we don't forget: https://github.com/networkupstools/nut/issues/268 -- Charles Lepple clepple at gmail
Mike Lee
2016-Mar-08 17:54 UTC
[Nut-upsuser] Incorrect battery.runtime.low being reported?
On Mon, Mar 7, 2016 at 9:00 PM, Charles Lepple <clepple at gmail.com> wrote:> If you stop and start the driver, it should refresh.Hi Charles, thanks for the reply! Pardon the dead horse beating, but I just want to clarify/confirm two things: 1) I did my full power down test (including powering down UPS and NAS, and restarting them) after the change to 600s on the UPS. Shouldn't this pass for restarting the driver, or do you mean that the driver has to be separately restarted after every boot (or perhaps after every on-UPS change)? 2) If I don't refresh NUT's cached value, so the UPS thinks 600 and NUT thinks 120, which value will be honored if the power goes out? My understanding is that the UPS self-reports its low battery status, so it will report "OB LB" to NUT when it thinks there's 600s left. In other words, the UPS value of 600s should "win." Thanks again! --Mike