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

@@ -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))
}