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

Update mdlayher/apcupsd dependency #8444

Merged
merged 1 commit into from
Nov 20, 2020

Conversation

rlenferink
Copy link
Contributor

This updates the mdlayher/apcupsd dependency to the latest commit. This contains a fix for the apcupsd input plugin. The problem that otherwise occurred is (in Telegraf v1.16.2):

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

Updating the dependency results in a working input plugin again:

[root@monitoring-vm1 ~]# ./telegraf -config telegraf-test.conf -test
2020-11-20T15:54:13Z I! Starting Telegraf
> apcupsd,host=monitoring-vm1.loc,model=Smart-UPS\ 3000,serial=AS2008161454,status=ONLINE,ups_name=APCUPS battery_charge_percent=100,battery_date="02/19/2020",battery_voltage=54,firmware="UPS 09.3 (ID18)",input_frequency=50,input_voltage=226,internal_temp=18,load_percent=10,nominal_battery_voltage=0,nominal_input_voltage=0,nominal_power=0i,output_voltage=228,status_flags=83886088i,time_left_ns=6480000000000i,time_on_battery_ns=0i 1605887653000000000

Fixes #6675

Pinging @danielnelson for review and merge.

My output when executing apcaccess:

[root@monitoring-vm1 ~]# apcaccess
APC      : 001,042,1001
DATE     : 2020-11-20 16:52:41 +0100
HOSTNAME : monitoring-vm1.loc
VERSION  : 3.14.14 (31 May 2016) redhat
UPSNAME  : APCUPS
CABLE    : Ethernet Link
DRIVER   : SNMP UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2020-11-20 14:36:21 +0100
MODEL    : Smart-UPS 3000
STATUS   : ONLINE
LINEV    : 226.0 Volts
LOADPCT  : 9.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 103.0 Minutes
MBATTCHG : 30 Percent
MINTIMEL : 30 Minutes
MAXTIME  : 0 Seconds
MAXLINEV : 227.0 Volts
MINLINEV : 226.0 Volts
OUTPUTV  : 228.0 Volts
SENSE    : High
DLOWBATT : 15 Minutes
LOTRANS  : 207.0 Volts
HITRANS  : 253.0 Volts
ITEMP    : 18.0 C
ALARMDEL : 30 Seconds
BATTV    : 55.0 Volts
LINEFREQ : 50.0 Hz
LASTXFER : Automatic or explicit self test
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : OK
STESTI   : OFF
STATFLAG : 0x05000008
MANDATE  : 02/19/2020
SERIALNO : AS2008161454
BATTDATE : 02/19/2020
NOMOUTV  : 230 Volts
FIRMWARE : UPS 09.3 (ID18)
END APC  : 2020-11-20 16:53:06 +0100

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

@srebhan
Copy link
Member

srebhan commented Nov 20, 2020

This probably requires a go mod tidy as revealed by make check. Could you please fix the CI problems and update this PR!?

@rlenferink
Copy link
Contributor Author

Thanks for the suggestion @srebhan ! I think I just beat you to it with the force push I did ;)

Used by apcupsd input plugin. The problem that occured was:
2020-11-20T14:06:51Z E! [inputs.apcupsd] Error in plugin: can't parse time: "02/19/2020"
@rlenferink
Copy link
Contributor Author

rlenferink commented Nov 20, 2020

The unit tests for the plugin were failing (forgot to update). I just updated the unit test to match with the behavior of the used library. Instead of parsing it as a time.Time object it is now returned as a string where input == output. See the following commit for further insights: mdlayher/apcupsd@149abe0

@ssoroka ssoroka merged commit 521caf3 into influxdata:master Nov 20, 2020
@rlenferink rlenferink deleted the update-apcupsd branch November 20, 2020 19:35
ssoroka pushed a commit that referenced this pull request Dec 1, 2020
arstercz pushed a commit to arstercz/telegraf that referenced this pull request Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

apcupsd cannot parse BATTDATE MM/DD/YYYY
3 participants