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 BATTDATE MM/DD/YYYY #6675

Closed
toby11 opened this issue Nov 18, 2019 · 6 comments · Fixed by #8444
Closed

apcupsd cannot parse BATTDATE MM/DD/YYYY #6675

toby11 opened this issue Nov 18, 2019 · 6 comments · Fixed by #8444
Labels
bug unexpected problem or unintended behavior

Comments

@toby11
Copy link

toby11 commented Nov 18, 2019

Relevant telegraf.conf:

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

System info:

Telegraf 1.12.4 / Proxmox 6 (Debian Buster)
apcupsd 3.14.14 (31 May 2016) debian

Steps to reproduce:

Using telegraf with apcupsd enabled

Expected behavior:

apcupsd stats to be correctly processed and no error messages

Actual behavior:

BATTDATE fails to be processed

Additional info:

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

Here is my apcaccess output (apologies for formatting - not sure why the newlines are not being shown)

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
Author

toby11 commented Nov 18, 2019

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

@danielnelson danielnelson added the bug unexpected problem or unintended behavior label Nov 18, 2019
@danielnelson
Copy link
Contributor

BTW, you can use triple backticks for the multiline code formatting:

```
10 PRINT "Hello World"
20 GOTO 10
```

@locus313
Copy link

locus313 commented Oct 3, 2020

I am also running into this issue. In researching it I found there has been a commit that might solve this issue:
mdlayher/apcupsd@149abe0

Looks like this commit was added since the last time the library has been updated. Are you able to update the library again to see if this resolves the issue?

@JacobWasFramed
Copy link

I am experiencing the same issue. From what I can gather it appears that the previous update may have fixed this issue when the string is mm/dd/yy, but the issue remains with the 4 digit year (mm/dd/yyyy).

Here is the BATTDATE string from the output of apcaccess status:
BATTDATE : 09/15/2020

Unfortunately, I am not very familiar with GO otherwise I would attempt to resolve and contribute. Perhaps if the BATTDATE issue is not quickly resolved, we could have an updated config that would allow for selection of fields to monitor for, allowing us the option to not monitor BATTDATE. That, or if the plugin would fail gracefully like others and just not record the one field instead of erring out completely.

Appreciate everyone that contributes to this project and do hope the issue is resolved soon.

@rlenferink
Copy link
Contributor

rlenferink commented Nov 20, 2020

I seem to have the exact same issue:

2020-11-20T14:06:51Z E! [inputs.apcupsd] Error in plugin: can't parse time: "02/19/2020"

Snipped apcaccess output:

MANDATE  : 02/19/2020
BATTDATE : 02/19/2020

I am using Telegraf 1.16.2

Pinging @glinton as you seem to have resolved the previous issue (#6394)

@rlenferink
Copy link
Contributor

Apparently updating the dependency and testing against the latest master branch was easier then expected. PR #8444 updates the dependency after which the apcupsd plugin works again with a BATTDATE of 02/19/2020.

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.

5 participants