APCUPSD shows "On Battery" any time it's fully charged


Go to solution Solved by Vr2Io,

Recommended Posts

Whenever my UPS (APC BGM1500) gets to 100%, Unraid's UPC monitor shows my UPC as "On Battery" and sends out a power failure alert. Fortunately, this doesn't impact my actual protection, as I have shutdown of my server (and another connected PC) based off of battery percentage and runtime remaining. However, I want to get email notifications for actual power failures, but this issue is leading to many nuisance notifications and is preventing me from getting a notification when power is actually lost.

 

Here's all of the log entries from or mentioning apcupsd. Today, the 26th, there where actual power failures, though I don't know the exact timings.

Quote

Jul 22 23:17:38 BatRAID root: Starting apcupsd power management:  /sbin/apcupsd
Jul 22 23:17:38 BatRAID apcupsd[4292]: apcupsd 3.14.14 (31 May 2016) slackware startup succeeded
Jul 22 23:17:39 BatRAID apcupsd[4292]: NIS server startup succeeded
Jul 22 23:17:40 BatRAID apcupsd[4292]: Power failure.
Jul 22 23:17:46 BatRAID apcupsd[4292]: Running on UPS batteries.
Jul 24 04:40:01 BatRAID apcupsd[4292]: apcupsd exiting, signal 15
Jul 24 04:40:01 BatRAID apcupsd[4292]: apcupsd shutdown succeeded
Jul 24 04:40:03 BatRAID apcupsd[16478]: apcupsd 3.14.14 (31 May 2016) slackware startup succeeded
Jul 24 04:40:03 BatRAID apcupsd[16478]: NIS server startup succeeded
Jul 24 04:40:06 BatRAID apcupsd[16478]: Power failure.
Jul 24 04:40:12 BatRAID apcupsd[16478]: Running on UPS batteries.
Jul 26 06:59:24 BatRAID apcupsd[16478]: Mains returned. No longer on UPS batteries.
Jul 26 06:59:24 BatRAID apcupsd[16478]: Power is back. UPS running on mains.
Jul 26 06:59:28 BatRAID apcupsd[16478]: Power failure.
Jul 26 06:59:33 BatRAID apcupsd[16478]: Power is back. UPS running on mains.
Jul 26 07:00:03 BatRAID apcupsd[16478]: Power failure.
Jul 26 07:00:04 BatRAID apcupsd[16478]: Power is back. UPS running on mains.
Jul 26 07:00:18 BatRAID apcupsd[16478]: Power failure.
Jul 26 07:00:19 BatRAID apcupsd[16478]: Power is back. UPS running on mains.
Jul 26 07:00:21 BatRAID apcupsd[16478]: Power failure.
Jul 26 07:00:22 BatRAID apcupsd[16478]: Power is back. UPS running on mains.
Jul 26 07:12:32 BatRAID apcupsd[16478]: Power failure.
Jul 26 07:12:38 BatRAID apcupsd[16478]: Running on UPS batteries.
Jul 26 15:28:43 BatRAID apcupsd[16478]: Mains returned. No longer on UPS batteries.
Jul 26 15:28:43 BatRAID apcupsd[16478]: Power is back. UPS running on mains.
Jul 26 15:33:34 BatRAID apcupsd[16478]: Power failure.
Jul 26 15:33:40 BatRAID apcupsd[16478]: Running on UPS batteries.

 

Note that there are a couple "Power failure" entries prior to today; no actual power failure occurred during these times, and that the last entry is also for a power failure. For today's entries, I suspect all of the "Power is back" entries actually correspond to power returning, but the subsequent "Power failure" entries occurred whenever the UPS reached 100%. Currently, Unraid is displaying "On Battery" while the LCD on my UPS says it's online and the "On Battery" LED is not illuminated.

 

Is there any configuration I can do in Unraid to correct this behavior? I've searched both APCUPSD's and BGM1500's manuals and haven't been able to find something related I can change.

 

Edit: I only found one other reference to a similar issue online: https://forum.netgate.com/post/1032036. The link doesn't seem to always take you to the right spot, so it's the post from March 12 at 1:40 PM. It seems APCUPSD might be seeing the status as "unknown" once it reaches 100% for some reason.

Edited by Batman
Add link to relevant post on another forum.
  • Like 1
Link to comment

 Does you use official USB cable to connect UPS to Unraid USB port ?

 

It is abnormal if UPS run on battery and APCUPSD will exist.

 

Jul 22 23:17:46 BatRAID apcupsd[4292]: Running on UPS batteries.
Jul 24 04:40:01 BatRAID apcupsd[4292]: apcupsd exiting, signal 15

 

Pls check and provide screen dump when power failure occur, does battery voltage will drop, pls also try different USB port.

Edited by Vr2Io
Link to comment

Yes, I'm using the cable that came with the UPS.

 

When unplugging the USB cable from the server, this is all I got in the system log:

Quote

Jul 27 06:36:32 BatRAID kernel: usb 3-9: USB disconnect, device number 4

Jul 27 06:37:14 BatRAID apcupsd[16478]: Communications with UPS lost.

 

When reconnecting it to a different USB port, I got a flurry of entries:

Quote

Jul 27 06:39:42 BatRAID apcupsd[16478]: Communications with UPS restored.
Jul 27 06:39:43 BatRAID apcupsd[16478]: Mains returned. No longer on UPS batteries.
Jul 27 06:39:43 BatRAID apcupsd[16478]: Power is back. UPS running on mains.
Jul 27 06:39:43 BatRAID apcupsd[16478]: Power failure.
Jul 27 06:39:43 BatRAID apcupsd[16478]: Power is back. UPS running on mains.
Jul 27 06:39:44 BatRAID apcupsd[16478]: Power failure.
Jul 27 06:39:44 BatRAID apcupsd[16478]: Power is back. UPS running on mains.
Jul 27 06:39:45 BatRAID apcupsd[16478]: Power failure.
Jul 27 06:39:50 BatRAID apcupsd[16478]: Running on UPS batteries.

The end result is the same though--APCUPSD thinks the UPS is on batteries. I tried several USB ports, including both 3.0 and 2.0 ports, and APCUPSD showed on battery for all of them.
 

I simulated a power failure by unplugging the UPS from the wall outlet. For some reason, the server initiated a shutdown well before I would have expected it. My PC, which is monitoring my server's APCUPSD status, did not initiate a shutdown even though it's APCUPSD settings should shut it down sooner. I took a couple screenshots during the process; the first is when I disconnected the power, and the second is after I plugged it back in and the server had rebooted. The voltage did indeed drop, and the battery's display indicated it was disconnected from mains power and discharging.

power_lost.png

power_restored.png

Link to comment

You should check the AC mains, some counter indicate input voltage at low side ( less then 88v ) and trigger on-battery. Does any high power household drawing power cause low line voltage happen, i.e. hair dryer ?

 

NUMXFERS 10, transfer to battery in 10 times

LASTXFER, last transfer due to low line voltage

 

 

But there are also some abnormal figure show, anyway keep monitoring first.

 

BCHARGE in 89% but BATTV in 27.2v

BCHARGE in 93% but BATTV in 25.5v

Edited by Vr2Io
Link to comment

Other than the PC and server, there's not much on this circuit. There is a laser printer, so I printed a test page while watching the UPS's line in voltage display. During the warmup and printing, it dropped as low as 117V. Without the printer running, it reads 121 or 122. When I get a chance, I can get a multimeter out and measure the RMS voltage that way.

 

The battery shows fully charged now with a voltage of 27.9. The mode is "on battery". Is it possible that the 100W (or maybe a little more) load of the PC and server caused the battery voltage to read lower when the battery really was supplying power?

 

I don't think the problem is that my mains power is causing the UPS to be in battery mode. Ever since I set up the UPS, Unraid shows it as "on battery" whenever the UPS is fully charged, even though the display on the UPS itself indicates it's "online" and not using the battery. The link I referenced at the end of the first post seems to suggest APCUPSD has an issue reading the status of this UPS.

Link to comment
  • Solution
1 hour ago, Batman said:

APCUPSD has an issue reading the status of this UPS.

If that, you can use Nut in Unraid or APC PowerChute in Windows to verify.

 

1 hour ago, Batman said:

when the battery really was supplying power?

If battery supplying power instead charging, then you will found large voltage drop on battery.

Link to comment

I tried NUT, and it seems to do a better job of identifying the UPS's true status.

 

When the UPS is plugged in and at 100% battery, NUT reports ups.status is Online / Discharging. Not fully correct, but at least it says it's online, and it doesn't create a warning notification. When I simulated a power outage by unplugging the power, it switched to On Battery / Discharging. It set a warning notification and an email was generated per my notification settings.

 

The problem I then saw is that it seems to force a shutdown at 98% battery regardless of my NUT settings. When the battery level dropped to 98%, ups.status changed from On Battery / Discharging to "FSD On battery DISCHRG LB". This appears to be related to battery.charge.low being equal to 98.

 

After some searching through NUT documentation, it seems I need to set the "ignorelb" flags and manually override the bettery.charge.low and battery.runtime.low values. I did this by adding the following lines to ups.conf, beginning at line 7:

ignorelb
override.battery.charge.low = 25
override.battery.runtime.low = 900

I noticed that anything prior to line 7 was being cleared every time I applied NUT settings.

 

Once the battery is back at 100%, I'll simulate another power failure and verify that it behaves as expected.

  • Like 1
Link to comment

You're not alone. After working flawlessIy for months, I started get this error from time to time - there appears to be no rhyme or reason to it popping up. When it does appear it appears to hang around for weeks (the on battery message) - where I finally end up pulling out the cable. I have tried removing and reinstalling NUT drivers etc. Just this morning I popped the USB cable back in, and it now states that I'm 'online' rather than 'on battery'. I did try ignoring the on battery message, but my server randomly shut down (gracefully) a few times so I suspect the it was initiated as result of this on battery message.

Link to comment

I have 3 APC UPS ( old model ), all in different model and run normal with APCUPSD, Nut or powerchute. Never have such strange behaviour, as two person report same problem, so it should UPS model specific issue.

 

Or, for my understanding, APC likely have some changes in their proprietary and not well follow old communication protocol.

Edited by Vr2Io
Link to comment

I'm running the exact same model and getting the same issue with the Linux APC drivers, but under ProxMox.  I had no issues with it when it was connected to Powerchute in Windows and I can even pass the USB through to a virtual Windows machine running PowerChute and it will read correctly.  It is likely that APCs Linux drivers are outdated and need to be fixed.

  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.