Skip to content
Snippets Groups Projects
Unverified Commit 19c102cf authored by Daniel Nelson's avatar Daniel Nelson Committed by GitHub
Browse files

Fix parsing of dos line endings in smart input (#3960)

parent 109c1a43
No related branches found
No related tags found
No related merge requests found
package smart
import (
"bufio"
"fmt"
"os/exec"
"path"
......@@ -202,7 +203,10 @@ func gatherDisk(acc telegraf.Accumulator, usesudo, attributes bool, smartctl, no
device_fields := make(map[string]interface{})
device_fields["exit_status"] = exitStatus
for _, line := range strings.Split(outStr, "\n") {
scanner := bufio.NewScanner(strings.NewReader(outStr))
for scanner.Scan() {
line := scanner.Text()
model := modelInInfo.FindStringSubmatch(line)
if len(model) > 1 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment