Closed ilosaurus closed 4 years ago
What's the output of cat /etc/debian_version
? I suspect you're running Jessie, which has an old version of apcupsd that exposes BATTDATE in a different format to the one this exporter is expecting.
Hello gebn, tq for reply, my enviroment using ubuntu 16.04 with debian version strech
root@prometheus:/home/prometheus# cat /etc/debian_version
stretch/sid
root@prometheus:/home/prometheus# apcaccess | grep BATT
: Warning: old configuration file found.
: Expected: "## apcupsd.conf v1.1 ##"
: Found: "UPSNAME APC MGE Galaxy 3500
"
: Please check new file format and
: modify accordingly the first line
: of config file.
: Processing config file anyway.
MBATTCHG : 5 Percent
DLOWBATT : 2 Minutes
BATTV : 210.8 Volts
TONBATT : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
BATTDATE : 04/01/01
EXTBATTS : 16
BADBATTS : 0
root@prometheus:/home/prometheus#
output in BATTDATE is 04/01/01, how to change this value?
Ah ok, so Xenial is also constrained to 3.14.12. Is it possible for you to update to Bionic?
I’m slightly confused as, on the surface, the underlying library used by this exporter has handling for several date formats internally, but it appears they are not in play here. Perhaps @mdlayher can shed some light.
Regardless, it would be worth fixing that legacy config warning.
Apologies for the late reply here. I'm actually not even sure how to interpret "01/01/04" as a date, because of the ambiguity between American and European style dates, and I'm starting to think it isn't even worth parsing these dates since we don't use them for metrics anyway.
A patch needs to be applied in https://github.com/mdlayher/apcupsd. I'm out of town for a couple of days, but PRs welcome.
2019/09/04 19:20:31 [ERROR] failed collecting UPS metric Desc{fqName: "apcupsd_battery_volts", help: "Current UPS battery voltage.", constLabels: {}, variableLabels: [hostname ups_name model]}: can't parse time: "08/04/2018"
how fix this? How should I do with https://github.com/mdlayher/apcupsd ? Can anyone help me? I should merge this repos in one folder or what? :(
The code that parses battery dates or whichever date is being treated as invalid should be updated in https://github.com/mdlayher/apcupsd to return the date as a string instead. Once that is merged, the library should be bumped in the go.mod here and all should work at that point.
The BATTDATE parameter was changed in apcupsd version 3.14.15-5 again. Right now it's look like this:
REG3 : 0x00
MANDATE : 11/14/2019
SERIALNO : AS1943175
BATTDATE : 11/14/2019
NOMOUTV : 230 Volts
And, of course, I got a follow error message:
apcupsd-exporter[59274]: 2020/01/28 05:43:31 [ERROR] failed collecting UPS metric Desc{fqName: "apcupsd_battery_volts", help: "Current UPS battery voltage.", constLabels: {}, variableLabels: [hostname ups_name model]}: invalid time duration
It's need to fix with compatibility to both versions of this parameters. Old: MM/DD/YY New: MM/DD/YYYY
Tech info:
rpm -qa | grep apc
apcupsd-3.14.14-5.el7.x86_64
# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
I created the Pull Request https://github.com/mdlayher/apcupsd/pull/9#issue-376837352
Also I have a the one question: can you to create a Release here (https://github.com/mdlayher/apcupsd_exporter/releases)? After pulling, of course.
This has been fixed.
Hello mdlayher, thanks to create exporter for apcupsd, now i try this exporter in my enviroment. I get some error after running apcupsd exporter, this error like this.
An error has occurred:
error collecting metric Desc{fqName: "apcupsd_battery_volts", help: "Current UPS battery voltage.", constLabels: {}, variableLabels: [hostname ups_name model]}: parsing time "04/01/01" as "2006-01-02": cannot parse "1/01" as "2006"
Hope you have free time to check the issue. Previously I was very grateful for the creation of apcupsd_exporter, hopefully it can be useful for many people.
Thanks mdlayher.