[inputs.apcupsd] Error in plugin: invalid time duration


I have had to rebuild my monitoring server (backups hit with same corruption) and Im having issues with the APC UPSD monitoring with Telegraf.
The APC agent is running on my monitoring server and can query the UPS, telegraf is installed and other instances are working fine, but for some reason it errors every time I try and monitor the APCUPS daemon.
I have tried moving the APC daemon to another computer and running telegraf from another also, but each time I receive this error and cannot find what is wrong as the telefraf.conf file is very simple and minimal for APCUPSD.
IT basically has this for the output plugins. (default for apcupsd)

“# A list of running apcupsd server to connect to.”
“# If not provided will default to tcp://”
servers = [“tcp://”]

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

I have tried adding the timeout and various duration,but this error always remains. Has anyone see this before or know how to debug telegraf?
Ubuntu 20.05
Telegraf 1.14.5 & 1.16.2
apcupsd 3.14.4

Can you post your whole input configuration? (or even better the whole configuration)

Prefixed ’ in front of # to stop it being bold.

'# Global tags can be specified here in key=“value” format.

'# Configuration for telegraf agent
’ ## Default data collection interval for all inputs
interval = “10s”
round_interval = true

metric_batch_size = 1000
metric_buffer_limit = 10000

’ ## Collection jitter is used to jitter the collection by a random amount.
collection_jitter = “0s”

’ ## Default flushing interval for all outputs. Maximum flush_interval will be
’ ## flush_interval + flush_jitter
flush_interval = “10s”
flush_jitter = “0s”

’ ## By default or when set to “0s”, precision will be set to the same
precision = “”

’ ## Logging configuration:
’ ## Run telegraf with debug log messages.
debug = false
’ ## Run telegraf in quiet mode (error log messages only).
quiet = false
’ ## Specify the log file name. The empty string means to log to stderr.
logfile = “”

’ ## Override default hostname, if empty use os.Hostname()
hostname = “”
omit_hostname = false

'# Configuration for sending metrics to InfluxDB
urls = [“http://netmon:8086”]

database = “apcups”

’ ## Timeout for HTTP messages.
’ # timeout = “5s”

’ ## HTTP Basic Auth
username = “telegraf”
password = “Passwordhere”

’ ## HTTP User-Agent
’ # user_agent = “telegraf”

’ # A list of running apcupsd server to connect to.
’ # If not provided will default to tcp://
servers = [“tcp://”]

’ ## Timeout for dialing server.
#timeout = “5s”

this is the debug output
C:\telegraf>telegraf --config telegraf-apc.conf --debug
2020-11-23T20:15:39Z I! Starting Telegraf 1.14.5
2020-11-23T20:15:39Z I! Loaded inputs: apcupsd
2020-11-23T20:15:39Z I! Loaded aggregators:
2020-11-23T20:15:39Z I! Loaded processors:
2020-11-23T20:15:39Z I! Loaded outputs: influxdb
2020-11-23T20:15:39Z I! Tags enabled: host=Nitrogen
2020-11-23T20:15:39Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:“Nitrogen”, Flush Interval:10s
2020-11-23T20:15:39Z D! [agent] Initializing plugins
2020-11-23T20:15:39Z D! [agent] Connecting outputs
2020-11-23T20:15:39Z D! [agent] Attempting connection to [outputs.influxdb]
2020-11-23T20:15:39Z D! [agent] Successfully connected to outputs.influxdb
2020-11-23T20:15:39Z D! [agent] Starting service inputs
2020-11-23T20:15:40Z E! [inputs.apcupsd] Error in plugin: invalid time duration
2020-11-23T20:15:50Z D! [outputs.influxdb] Buffer fullness: 0 / 10000 metrics
2020-11-23T20:15:50Z E! [inputs.apcupsd] Error in plugin: invalid time duration

output from apcupsd
monkeh@netmon:/etc/telegraf$ sudo apcaccess
APC : 001,044,1007
DATE : 2020-11-23 22:06:13 +0000
HOSTNAME : netmon
VERSION : 3.14.14 (31 May 2016) debian
CABLE : Ethernet Link
UPSMODE : Stand Alone
STARTTIME: 2020-11-23 21:59:35 +0000
MODEL : Smart-UPS1500
LINEV : 244.8 Volts
LOADPCT : 19.5 Percent
BCHARGE : 100.0 Percent
TIMELEFT : 42.0 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
MAXLINEV : 244.8 Volts
MINLINEV : 244.8 Volts
OUTPUTV : 244.8 Volts
DWAKE : 10 Seconds
DSHUTD : 540 Seconds
DLOWBATT : 2 Minutes
ITEMP : 9.4 C
BATTV : 27.2 Volts
LINEFREQ : 50.0 Hz
LASTXFER : No transfers since turnon
TONBATT : 0 Seconds
CUMONBATT: 0 Seconds
STESTI : 336
STATFLAG : 0x05000008
REG1 : 0x00
REG2 : 0x00
REG3 : 0x00
MANDATE : 08/14/2016
SERIALNO : AS1632344211
BATTDATE : 01/15/2018
NOMOUTV : 230 Volts
FIRMWARE : UPS 09.3 (ID18)
END APC : 2020-11-23 22:06:13 +0000

config file apcupsd.conf (defaults apart from)

I have tried running it with all inputs commented out and the same error, both locally and via a remove server.

This should be simple but for some reason will not work on this new server. :frowning: frustrating… Only difference is this is Ubuntu 20 and the old server was 16.04

Seems like this is a bug in the upstream package used for parsing this. Perhaps it thinks some field is a time duration “10 Seconds” type of response, but that’s not what it’s reading from the field value.

Could you open an issue for this? It’s not user error.