[Nut-upsuser] Panic timeout?

Roger Price roger at rogerprice.org
Wed Sep 7 15:48:23 UTC 2016


On Wed, 7 Sep 2016, Dark Penguin wrote:

> First of all, please forgive me is this question has already been 
> covered in these mailing lists; the "Search mailing list" link is dead, 
> and I've only read the most recent monthly archives.
>
> I often have a situation where, for one of many possible reasons, the 
> UPS always thinks that its battery is critical. And I'm even fine with a 
> situation when it's an emergency shutdown right from the beginning.
>
> However, every once in a while my UPS (APC SU1000) likes to do short 
> self-tests, and sometimes my AC power blinks for a split second. Neither 
> of those are of any concern, but they make the UPS go into "OB LB" state 
> for a few seconds. And just because of something insignificant like 
> this, my whole system goes down.

A familiar problem.  I use openSUSE and the UPS is an MGE/Eaton Ellipse 
1500.  I see wierd transient statuses such as "OL DISCHRG CHRG LB" which 
were bringing my box down.

> Is there a way to set a timeout for "how long to wait after seeing "OB 
> LB" before raising the FSD flag"? I want NUT to be a bit less hasty, and 
> only shut down if it sees "OB LB" for at lest ten or even twenty 
> seconds. I can easily spare ten more seconds of the critical state, but 
> I want to avoid everything going down because of one second in the 
> critical state. (That would also allow me to "train" the UPS much easier 
> by cutting the power and knowing that I have a few seconds to turn it 
> back on once the UPS goes to emergency beeping.)

After a lot of trial and error, I use the upssched timers as defined in 
the configuration file upssched.conf

  # Defective UPS shows low battery for no reason
  AT LOWBATT * EXECUTE ups-low-battery
  AT LOWBATT * START-TIMER check-low-battery-timer 5
  AT LOWBATT * START-TIMER low-battery-shutdown-timer 65

In script upssched-cmd, the event ups-low-battery logs a message 
suggesting a possible problem. At the timeout of check-low-battery-timer, 
I check the UPS status and charge.  It's usually OL and 100% charged.  So 
I send an e-mail to the sysadmin and then turn off the 
low-battery-shutdown-timer.

Turning off the timer is the delicate part.  This is not a native NUT 
operation.  I patched NUT 2.7.4 to add the facility of sending SIGUSR1 and 
SIGUSR2 to the upsd daemon. These signals create new NUT events, and allow 
me to add the lines

  NOTIFYMSG  SIGUSR1  "SIGUSR1 received"
  NOTIFYFLAG SIGUSR1  SYSLOG+WALL+EXEC

to upsmon.conf, and

  AT SIGUSR1 * CANCEL-TIMER low-battery-shutdown-timer

to upssched.conf.

About once a month, when the UPS gives me a false LB, I get some warnings 
on-screen and a summary e-mail, but the server carries on. I submitted the 
patches to the NUT development mailing list 
https://lists.alioth.debian.org/pipermail/nut-upsdev/2016-July/007202.html

Roger



More information about the Nut-upsuser mailing list