This commit is contained in:
Rene Zbinden 2016-09-12 11:30:35 +02:00 committed by Cameron Sparr
parent 811567a2f4
commit b2ea39077e
3 changed files with 57 additions and 3 deletions

View File

@ -25,6 +25,7 @@
- [#1628](https://github.com/influxdata/telegraf/issues/1628): Fix mongodb input panic on version 2.2.
- [#1738](https://github.com/influxdata/telegraf/issues/1738): Fix unmarshal of influxdb metrics with null tags
- [#1733](https://github.com/influxdata/telegraf/issues/1733): Fix statsd scientific notation parsing
- [#1716](https://github.com/influxdata/telegraf/issues/1716): Sensors plugin strconv.ParseFloat: parsing "": invalid syntax
## v1.0 [2016-09-08]

View File

@ -73,7 +73,7 @@ func (s *Sensors) parse(acc telegraf.Accumulator) error {
tags["chip"] = chip
continue
}
if !strings.HasPrefix(line, " ") {
if !strings.HasPrefix(line, " ") {
if len(tags) > 1 {
acc.AddFields("sensors", fields, tags)
}
@ -114,5 +114,5 @@ func init() {
// snake converts string to snake case
func snake(input string) string {
return strings.ToLower(strings.Replace(input, " ", "_", -1))
return strings.ToLower(strings.Replace(strings.TrimSpace(input), " ", "_", -1))
}

View File

@ -122,6 +122,28 @@ func TestGatherDefault(t *testing.T) {
"temp_crit_alarm": 0.0,
},
},
{
map[string]string{
"chip": "atk0110-acpi-0",
"feature": "vcore_voltage",
},
map[string]interface{}{
"in_input": 1.136,
"in_min": 0.800,
"in_max": 1.600,
},
},
{
map[string]string{
"chip": "atk0110-acpi-0",
"feature": "+3.3_voltage",
},
map[string]interface{}{
"in_input": 3.360,
"in_min": 2.970,
"in_max": 3.630,
},
},
}
for _, test := range tests {
@ -240,8 +262,29 @@ func TestGatherNotRemoveNumbers(t *testing.T) {
"temp3_crit_alarm": 0.0,
},
},
{
map[string]string{
"chip": "atk0110-acpi-0",
"feature": "vcore_voltage",
},
map[string]interface{}{
"in0_input": 1.136,
"in0_min": 0.800,
"in0_max": 1.600,
},
},
{
map[string]string{
"chip": "atk0110-acpi-0",
"feature": "+3.3_voltage",
},
map[string]interface{}{
"in1_input": 3.360,
"in1_min": 2.970,
"in1_max": 3.630,
},
},
}
for _, test := range tests {
acc.AssertContainsTaggedFields(t, "sensors", test.fields, test.tags)
}
@ -309,6 +352,16 @@ Core 1:
temp3_max: 82.000
temp3_crit: 92.000
temp3_crit_alarm: 0.000
atk0110-acpi-0
Vcore Voltage:
in0_input: 1.136
in0_min: 0.800
in0_max: 1.600
+3.3 Voltage:
in1_input: 3.360
in1_min: 2.970
in1_max: 3.630
`
args := os.Args