opnsense / plugins

OPNsense plugin collection
https://opnsense.org/
BSD 2-Clause "Simplified" License
845 stars 641 forks source link

apcupsd doesn't report Back-UPS ES 600M1 status correctly #3300

Closed kg333 closed 1 year ago

kg333 commented 1 year ago

Important notices Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug Version 1.1 of apcupsd doesn't report status correctly for USB UPS models such as the APC BE600M1. For example, MODEL and STATUS are missing, while others such as LOTRANS, HITRANS, and LOADPCT are incorrect:

root@smitingOfElves:/usr/local/etc/apcupsd  # apcaccess status 192.168.0.1:3551
APC      : 001,033,0759
DATE     : 2023-02-06 22:48:50 -0500
HOSTNAME : <snip>
VERSION  : 3.14.14 (31 May 2016) freebsd
UPSNAME  : Back-UPS ES 600M1
CABLE    : USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2023-02-06 22:27:28 -0500
MODEL    :
STATUS   :
LINEV    : 0.0 Volts
LOADPCT  : 0.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 65.9 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
SENSE    : Unknown
LOTRANS  : -1.0 Volts
HITRANS  : -1.0 Volts
ALARMDEL : Always
BATTV    : 0.0 Volts
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x05000000
SERIALNO :
BATTDATE :
NOMINV   : 0 Volts
NOMBATTV : 0.0 Volts
END APC  : 2023-02-06 22:48:58 -0500

Per the install log, this is a known bug in apcupsd that requires an additional option in make config:

If connected via USB and apcaccess reports incomplete data consider enabling
the USB_REPORTING options via 'make config'.  This contains an experimental
patch that may fix some USB attach APC UPS. PR #249041

To Reproduce Steps to reproduce the behavior:

  1. Install apcupd via the plugin manager
  2. Start a shell via ssh
  3. Run apcaccess
  4. Note missing fields from USB UPS
  5. 2-3 alternative - access the Services->Apcupsd->Status page

Expected behavior Expected status should include all status fields:

root@smitingOfElves:/usr/local/etc/apcupsd # apcaccess
APC      : 001,036,0899
DATE     : 2023-02-06 23:17:54 -0500
HOSTNAME : <snip>
VERSION  : 3.14.14 (31 May 2016) freebsd
UPSNAME  : Back-UPS ES 600M1
CABLE    : USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2023-02-06 23:17:52 -0500
MODEL    : Back-UPS ES 600M1
STATUS   : ONLINE
LINEV    : 121.0 Volts
LOADPCT  : 10.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 65.9 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
SENSE    : Medium
LOTRANS  : 92.0 Volts
HITRANS  : 139.0 Volts
ALARMDEL : 30 Seconds
BATTV    : 13.6 Volts
LASTXFER : Low line voltage
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x05000008
SERIALNO : 4B2006P25428
BATTDATE : 2020-02-06
NOMINV   : 120 Volts
NOMBATTV : 12.0 Volts
NOMPOWER : 330 Watts
FIRMWARE : 928.a8 .D USB FW:a8
END APC  : 2023-02-06 23:17:55 -0500

Screenshots N/A

Relevant log files N/A

Additional context A rebuild of apcupsd with USB_REPORTING enabled from this FreeBSD port commit fixed the issue in my instance.

Environment

OPNsense 22.7.11_1-amd64FreeBSD 13.1-RELEASE-p5OpenSSL 1.1.1s 1 Nov 2022 AMD GX-420CA SOC with Radeon(tm) HD Graphics (4 cores, 4 threads) UPS model APC BE600M1

kg333 commented 1 year ago

Looks like it's still not quite right even with USB_REPORTING on; it loses STATUS within a few hours. This might be a problem with the upstream FreeBSD port rather than the plug-in though:

APC      : 001,037,0945
DATE     : 2023-02-11 13:43:00 -0500  
HOSTNAME : smitingOfElves.private1.kyengineer.com
VERSION  : 3.14.14 (31 May 2016) freebsd
UPSNAME  : BE600M1
CABLE    : USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2023-02-07 20:52:40 -0500  
MODEL    : Back-UPS ES 600M1 
STATUS   : 
LINEV    : 119.0 Volts
LOADPCT  : 11.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 62.3 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
SENSE    : Medium
LOTRANS  : 92.0 Volts
HITRANS  : 139.0 Volts
ALARMDEL : 30 Seconds
BATTV    : 13.6 Volts
LASTXFER : Low line voltage
NUMXFERS : 2
XONBATT  : 2023-02-09 06:17:47 -0500  
TONBATT  : 0 Seconds
CUMONBATT: 6 Seconds
XOFFBATT : 2023-02-09 06:17:52 -0500  
xbb commented 1 year ago

This might be a problem with the upstream FreeBSD port rather than the plug-in though

Yes, I read reports that on Linux it works fine.

Did you build the package specifically for OPNsense or FreeBSD?

Otherwise, I think you should try with NUT instead.

kg333 commented 1 year ago

I built on OPNsense. I've considered NUT, but would need to rearchitect a few other machines pulling status using apcupsd's remote features. I'll likely just move it back to a Linux host.

OPNsense-bot commented 1 year ago

This issue has been automatically timed-out (after 180 days of inactivity).

For more information about the policies for this repository, please read https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md for further details.

If someone wants to step up and work on this issue, just let us know, so we can reopen the issue and assign an owner to it.