We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
ipmi_sensor plugin with metric version 2 does not parse negative values in the description field correctly:
# ipmitool sdr elist [...] DIMM Thrm Mrgn 1 | B0h | ok | 8.1 | -55 degrees C DIMM Thrm Mrgn 2 | B1h | ok | 8.2 | -55 degrees C DIMM Thrm Mrgn 3 | B2h | ok | 8.3 | -53 degrees C DIMM Thrm Mrgn 4 | B3h | ok | 8.4 | -57 degrees C [...]
[[inputs.ipmi_sensor]] interval = "120s" timeout = "20s" metric_version = 2
telegraf v1.14.2 Ubuntu 18.04 ipmitool 1.8.18-5ubuntu0.1
ipmi_sensor plugin should convert DIMM Thrm Mrgn 1 | B0h | ok | 8.1 | -55 degrees C to ipmi_sensor,entity_id=8.1,status_code=ok,unit=degrees_c dimm_thrm_mrgn_1=-55 1588753149000000000
DIMM Thrm Mrgn 1 | B0h | ok | 8.1 | -55 degrees C
ipmi_sensor,entity_id=8.1,status_code=ok,unit=degrees_c dimm_thrm_mrgn_1=-55 1588753149000000000
DIMM Thrm Mrgn 1 | B0h | ok | 8.1 | -55 degrees C gets converted to ipmi_sensor,entity_id=8.1,status_code=ok,status_desc=-55_degrees_c dimm_thrm_mrgn_1=0 1588753050000000000
ipmi_sensor,entity_id=8.1,status_code=ok,status_desc=-55_degrees_c dimm_thrm_mrgn_1=0 1588753050000000000
I found that patching re_v2_parse_description regexp in ipmi.go to allow an optional minus-sign before the analog value resolves the issue for me.
diff --git a/plugins/inputs/ipmi_sensor/ipmi.go b/plugins/inputs/ipmi_sensor/ipmi.go index 9ac842b8..fb53e1bc 100644 --- a/plugins/inputs/ipmi_sensor/ipmi.go +++ b/plugins/inputs/ipmi_sensor/ipmi.go @@ -21,7 +21,7 @@ var ( execCommand = exec.Command // execCommand is used to mock commands in tests. re_v1_parse_line = regexp.MustCompile(`^(?P<name>[^|]*)\|(?P<description>[^|]*)\|(?P<status_code>.*)`) re_v2_parse_line = regexp.MustCompile(`^(?P<name>[^|]*)\|[^|]+\|(?P<status_code>[^|]*)\|(?P<entity_id>[^|]*)\|(?:(?P<description>[^|]+))?`) - re_v2_parse_description = regexp.MustCompile(`^(?P<analogValue>[0-9.]+)\s(?P<analogUnit>.*)|(?P<status>.+)|^$`) + re_v2_parse_description = regexp.MustCompile(`^(?P<analogValue>-?[0-9.]+)\s(?P<analogUnit>.*)|(?P<status>.+)|^$`) re_v2_parse_unit = regexp.MustCompile(`^(?P<realAnalogUnit>[^,]+)(?:,\s*(?P<statusDesc>.*))?`) ) --
The text was updated successfully, but these errors were encountered:
danielnelson
Successfully merging a pull request may close this issue.
ipmi_sensor plugin with metric version 2 does not parse negative values in the description field correctly:
Relevant telegraf.conf:
System info:
telegraf v1.14.2
Ubuntu 18.04
ipmitool 1.8.18-5ubuntu0.1
Steps to reproduce:
Expected behavior:
ipmi_sensor plugin should convert
DIMM Thrm Mrgn 1 | B0h | ok | 8.1 | -55 degrees C
to
ipmi_sensor,entity_id=8.1,status_code=ok,unit=degrees_c dimm_thrm_mrgn_1=-55 1588753149000000000
Actual behavior:
DIMM Thrm Mrgn 1 | B0h | ok | 8.1 | -55 degrees C
gets converted to
ipmi_sensor,entity_id=8.1,status_code=ok,status_desc=-55_degrees_c dimm_thrm_mrgn_1=0 1588753050000000000
Additional info:
I found that patching re_v2_parse_description regexp in ipmi.go to allow an optional minus-sign before the analog value resolves the issue for me.
The text was updated successfully, but these errors were encountered: