-
-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wishlist: add a configurable timeout between seeing "OB LB" and actual shutdown #321
Comments
For the first case, the I'm not sure I follow the second part. If you can't trust the UPS to get through a self-test without signaling low battery, how can you be sure that there is enough power left to shut down properly in a real power failure? I don't think many UPSes reliably report that a test is in progress, so I doubt we could add generic logic to "ignore LB during a test". In the current driver architecture, the only state that is carried over between polling cycles is the connection information (to reconnect to USB devices) and whether or not the previous poll worked (for data-stale notification). Adding a timeout, while it sounds simple, would require adding an extra history layer to drivers to keep track of when the LB flag was last seen, and to handle all of the possible transitions. As someone who expects the UPS to provide a working LB signal, I would prefer that any such changes happen outside of the driver and upsmon. There has been talk of integrating a Lua interpreter into drivers - maybe there is room for another upsmon/upssched hybrid which uses a scripting language to capture the intricacies of situations like these. |
OK, I understand that it would be hard to implement due to the current driver architecture. More thoughts about this later; first, let me explain other things so that everything else is clear. For the first case of "periodical training": yes, adding "ignorelb" manually every time would help, but it would be even easier to just stop the driver for the training time or disconnect the interface cable. That's what I'm trying to avoid; if I could just add a 10-second timeout, I wouldn't have to do anything at all - 10 seconds is enough for me to flip the power switch back on. I don't suggest that we go to extreme complications to implement this, but it would be a very useful feature to have in general; I'll explain with more examples. And I'm not talking about trying to find out whether it's "just a self-test" or something like that. What I'm talking about is:
So, consider these examples:
For some cases, it's indeed possible to add the "ignorelb" option, and configure other options and overrides to have NUT set the LB itself. But that's more complex, and in some cases, that wouldn't help. And anyway, shutting down without waiting even for a moment does seem like a hasty decision to me. So, the question is, how to implement it. I'm not very familiar with the inner details of NUT, but based on what I see... We have FINALDELAY and HOSTSYNC. What I expected when I read the manual was:
So, when the UPS goes into "OB LB" state, slaves see it, but don't react without a command from the master (unless the command never arrives). The master tells everyone to get ready for shutdown, then waits a little to see if the power comes back a few seconds later, and only then sends the "OK, shutdown now!" command. Then the master waits for the slaves to shut down, and starts its own shutdown procedure. This way, after the shutdown command has been sent, there is no way back; but before the command is sent, after waiting for FINALDELAY - it's still not too late to cancel the shutdown! Would this be possible to implement somehow? If it changes too much in the established shutdown order, this may very well be optional, toggled by a special parameter in nut.conf or something. (POWEROFF_WAIT: In case you've missed the Debian bug report, here is it: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=835634 ) |
I've finally got to reading through this thread and referenced Debian bugs. Some of this seems still relevant, but not all (after the years of changes). Regarding POWEROFF_WAIT and systemd, this should have got fixed by Checking the concerns about A timer for "OB LB" delay might indeed be an option - I suppose for short-lived glitches we could use a similar mechanism to what was recently introduced to avoid shutdowns during calibrations etc. when the UPS reports cycling different states - sometimes hovering in bogus limbo for a few seconds. This would probably also be tied to the number of POLLFREQ(ALERT) cycles - e.g. "ignore the state for X cycles in a row, issue FSD if not cleared by then". Now there's precedent for something like this in NUT v2.8.2 (maybe 2.8.1 already); need to check if this particular use-case was not actually addressed by now, e.g.:
CC @desertwitch for a "second opinion" :) |
…kupstools#321] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…OWERDOWNFLAG must be configured (no compiled-in default in upsmon) [networkupstools#321] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…LAG setting [networkupstools#321] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…lue or absence of explicit POWERDOWNFLAG setting [networkupstools#321] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…imal functional content of upsmon.conf [networkupstools#321] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…t lookups into POWERDOWNFLAG file; note recommended locations [networkupstools#321] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ols#321] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
For a practical pointer, in the Lines 1111 to 1136 in 60f76bf
|
Thanks for the CC, commits look good and reasonable. I will read more and report back tomorrow, my (mental) bandwidth is a bit limited at the weekends. 😉 |
So I've just given this some thought and I think the only thing that hasn't been addressed yet is the OB LB switch to ignore the condition for a configurable time and only trigger FSD when that time has elapsed. I do for the most part agree with Charles about OB LB being a bit of a critical status to ignore, but given the recent anomalies with some UPS reporting it as part of calibration cycles I think it would be fair to offer it as a non-default option for cases where "ignorelb" would be too much. I'd keep default behavior to instant FSD upon encountering the status OB LB just to be safe, but allow users to modify this behavior accordingly with a similar setting as we've implemented for the intermittent OFF states we've seen (OFFDURATION). Either a configurable time or amount of encounters of the status, although I think a configurable time would be easier to approximate when facturing in the individual battery condition, seeing as most people probably know about how much load their batteries can still hold in minutes. So probably easier to think in time here rather than cycles - would also match better with OFFDURATION. Perhaps LBDURATION? Anyhow, the place recommended by Jim seems perfect for this. |
…upstools#321] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Posted the remaining PR for the "payload" of this wish - testing/review would be welcome :) |
…DOWNFLAG setting [networkupstools#321] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
In many cases, it would be very convenient to have the system not react immediately to an "OB LB" status, but wait a little to make sure it doesn't go away in a couple of seconds. For example:
See this thread in the mailing lists for more info and extremely complicated workarounds that could be solved easily:
http://lists.alioth.debian.org/pipermail/nut-upsuser/2016-September/010260.html
The text was updated successfully, but these errors were encountered: