Skip to content
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

apcupsd cannot parse old BATTDATE #6394

Closed
sgofferj opened this issue Sep 15, 2019 · 5 comments · Fixed by #6401
Closed

apcupsd cannot parse old BATTDATE #6394

sgofferj opened this issue Sep 15, 2019 · 5 comments · Fixed by #6401
Labels
bug unexpected problem or unintended behavior
Milestone

Comments

@sgofferj
Copy link

Relevant telegraf.conf:

[[inputs.apcupsd]]
servers = ["tcp://192.168.10.201:3551"]
timeout = "5s"

System info:

Telegraf docker latest on Ubuntu server 16.04 LTS

Steps to reproduce:

Connect to apcupsd with old serial UPS connected

Expected behavior:

Work correctly

Actual behavior:

Fails to work, cannot parse BATTDATE and terminates

Additional info:

In older APC UPS, BATTDATE is saved as MM/DD/YY and apcupsd does output it accordingly. The plugin apparently expects only YYYY-MM-DD format and fails.

Log

2019-09-15T16:52:20Z E! [inputs.apcupsd] Error in plugin: parsing time "09/20/17" as "2006-01-02": cannot parse "0/17" as "2006"

apcupsd output

APC      : 001,051,1152
DATE     : 2019-09-15 19:53:35 +0300
HOSTNAME : nostromo
VERSION  : 3.14.12 (29 March 2014) debian
UPSNAME  : Nostromo
CABLE    : Custom Cable Smart
DRIVER   : APC Smart UPS (any)
UPSMODE  : Stand Alone
STARTTIME: 2019-09-15 19:36:55 +0300
MODEL    : SMART-UPS 700
STATUS   : ONLINE
LINEV    : 224.9 Volts
LOADPCT  : 47.3 Percent
BCHARGE  : 97.0 Percent
TIMELEFT : 22.0 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
MAXLINEV : 226.2 Volts
MINLINEV : 223.6 Volts
OUTPUTV  : 224.9 Volts
SENSE    : High
DWAKE    : 0 Seconds
DSHUTD   : 180 Seconds
DLOWBATT : 2 Minutes
LOTRANS  : 196.0 Volts
HITRANS  : 253.0 Volts
RETPCT   : 15.0 Percent
ITEMP    : 27.4 C
ALARMDEL : 5 Seconds
BATTV    : 27.2 Volts
LINEFREQ : 50.0 Hz
LASTXFER : Automatic or explicit self test
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STESTI   : 168
STATFLAG : 0x05000008
DIPSW    : 0x00
REG1     : 0x00
REG2     : 0x00
REG3     : 0x00
MANDATE  : 09/30/01
SERIALNO : NS0139247433
BATTDATE : 09/20/17
NOMOUTV  : 230 Volts
NOMBATTV : 24.0 Volts
EXTBATTS : 0
FIRMWARE : 50.14.I
END APC  : 2019-09-15 19:54:34 +0300
@glinton
Copy link
Contributor

glinton commented Sep 16, 2019

Looks like we just need to update the library we are using, this issue has already been solved upstream: mdlayher/apcupsd#6

@glinton glinton added the bug unexpected problem or unintended behavior label Sep 16, 2019
@glinton glinton added this to the 1.12.2 milestone Sep 16, 2019
@toby11
Copy link

toby11 commented Nov 16, 2019

I apparently also have this issue using Telegraf 1.12.4 which should contain the fix (it was added in v1.12.2)

I notice my date format is different again - MM/DD/YYYY

[inputs.apcupsd] Error in plugin: can't parse time: "12/28/2013"

Here is the full apcaccess output

APC : 001,044,1024 DATE : 2019-11-16 18:04:54 +0000 HOSTNAME : pve VERSION : 3.14.14 (31 May 2016) debian UPSNAME : APCUPS CABLE : Ethernet Link DRIVER : SNMP UPS Driver UPSMODE : Stand Alone STARTTIME: 2019-11-16 17:48:50 +0000 MODEL : Smart-UPS 750 STATUS : ONLINE LINEV : 230.0 Volts LOADPCT : 44.0 Percent BCHARGE : 100.0 Percent TIMELEFT : 23.0 Minutes MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 0 Seconds MAXLINEV : 237.0 Volts MINLINEV : 230.0 Volts OUTPUTV : 230.0 Volts SENSE : High DWAKE : 1000 Seconds DSHUTD : 20 Seconds DLOWBATT : 2 Minutes LOTRANS : 207.0 Volts HITRANS : 253.0 Volts ITEMP : 21.0 C ALARMDEL : 30 Seconds BATTV : 27.0 Volts LINEFREQ : 50.0 Hz LASTXFER : Line voltage notch or spike NUMXFERS : 0 TONBATT : 0 Seconds CUMONBATT: 0 Seconds XOFFBATT : N/A SELFTEST : OK STESTI : OFF STATFLAG : 0x05000008 MANDATE : 12/28/2013 SERIALNO : AS1352131956 BATTDATE : 12/28/2013 NOMOUTV : 230 Volts FIRMWARE : UPS 08.8 (ID18) END APC : 2019-11-16 18:04:58 +0000

@toby11
Copy link

toby11 commented Nov 16, 2019

I have raised this against the upstream issue as well mdlayher/apcupsd#6

@danielnelson
Copy link
Contributor

Thank you @toby11, could you open this as a new issue?

@toby11
Copy link

toby11 commented Nov 18, 2019

@danielnelson new issue here, thanks

#6675

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants