influxdata / telegraf

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

Input plugin apcupsd not serving any metrics #8521

Closed freaknils closed 3 years ago

freaknils commented 3 years ago

Hi,

i have installed a new APC UPS for my homeserver, after the last has broken a few weeks ago. Since then I do not get any metrics served from apcupsd.

Relevant telegraf.conf:

[[inputs.apcupsd]]
  # A list of running apcupsd server to connect to.
  # If not provided will default to tcp://127.0.0.1:3551
  servers = ["tcp://127.0.0.1:3551"]

  ## Timeout for dialing server.
  timeout = "5s"

System info:

root@yggdrasil ~ # uname -a
Linux yggdrasil 5.9.12-arch1-1 #1 SMP PREEMPT Wed, 02 Dec 2020 16:14:56 +0000 x86_64 GNU/Linux
root@yggdrasil ~ # telegraf --version
Telegraf 1.16.3 (git: HEAD c7f21728)

Steps to reproduce:

Activate apcupsd with APC Smart UPS 1000.

Expected behavior:

Should output data from APC UPS, but no ups data is provided

apcaccess output is:

130 root@yggdrasil ~ # apcaccess
APC      : 001,051,1172
DATE     : 2020-12-07 18:21:33 +0100  
HOSTNAME : yggdrasil.cznetz.de
VERSION  : 3.14.14 (31 May 2016) unknown
UPSNAME  : aps-smartups-1000
CABLE    : Custom Cable Smart
DRIVER   : APC Smart UPS (any)
UPSMODE  : Stand Alone
STARTTIME: 2020-12-07 14:13:31 +0100  
MODEL    : SMART-UPS 1000
STATUS   : ONLINE 
LINEV    : 232.7 Volts
LOADPCT  : 5.2 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 75.0 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
MAXLINEV : 235.3 Volts
MINLINEV : 231.4 Volts
OUTPUTV  : 232.7 Volts
SENSE    : High
DWAKE    : 0 Seconds
DSHUTD   : 20 Seconds
DLOWBATT : 2 Minutes
LOTRANS  : 208.0 Volts
HITRANS  : 253.0 Volts
RETPCT   : 0.0 Percent
ITEMP    : 18.9 C
ALARMDEL : Low Battery
BATTV    : 27.6 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   : 336
STATFLAG : 0x05000008
DIPSW    : 0x00
REG1     : 0x00
REG2     : 0x00
REG3     : 0x00
MANDATE  : 08/27/98
SERIALNO : GS9835306819
BATTDATE : 01/01/20
NOMOUTV  : 230 Volts
NOMBATTV : 24.0 Volts
EXTBATTS : 0
FIRMWARE : 60.11.I
END APC  : 2020-12-07 18:21:57 +0100 

Actual behavior:

Any other metric is provided fine but apcupsd. Output shows

Dez 07 18:09:40 <hostname> telegraf[704]: 2020-12-07T17:09:40Z E! [inputs.apcupsd] Error in plugin: time: invalid duration "LowBattery"

Already found this: https://community.influxdata.com/t/inputs-apcupsd-error-in-plugin-invalid-time-duration/16870/6

ivorybilled commented 3 years ago

Thanks for the issue, the ALARMDEL value is being parsed incorrectly and looking into a way to fix it.

freaknils commented 3 years ago

Error in 1.17 still present

ivorybilled commented 3 years ago

@freaknils If it's of any use, having the ALARMDEL be any value of 'No Alarm', '5 seconds' or '30 seconds' will work. 'Always' and 'Low Battery' don't currently work right now because of the way the library we use parses the data. We're working to fix the issue.

sjwang90 commented 3 years ago

Pending upstream issue required for fix: https://github.com/mdlayher/apcupsd/issues/10

ivorybilled commented 3 years ago

Hi, we've just merged a fix for this issue on the telegraf side. Let us know if there are any concerns.

freaknils commented 3 years ago

Thanks! Current master works fine!