influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.51k stars 5.55k forks source link

apcupsd cannot parse BATTDATE MM/DD/YYYY #6675

Closed toby11 closed 3 years ago

toby11 commented 4 years ago

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 commented 4 years ago

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

danielnelson commented 4 years ago

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

10 PRINT "Hello World" 20 GOTO 10

locus313 commented 3 years ago

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

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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.