ntpq input: ignore lines that are '-'

closes #1223
This commit is contained in:
Cameron Sparr 2016-05-18 21:22:10 +01:00
parent 1dbe3b8231
commit debf7bf149
1 changed files with 6 additions and 0 deletions

View File

@ -122,6 +122,9 @@ func (n *NTPQ) Gather(acc telegraf.Accumulator) error {
if index == -1 { if index == -1 {
continue continue
} }
if fields[index] == "-" {
continue
}
if key == "when" { if key == "when" {
when := fields[index] when := fields[index]
@ -169,6 +172,9 @@ func (n *NTPQ) Gather(acc telegraf.Accumulator) error {
if index == -1 { if index == -1 {
continue continue
} }
if fields[index] == "-" {
continue
}
m, err := strconv.ParseFloat(fields[index], 64) m, err := strconv.ParseFloat(fields[index], 64)
if err != nil { if err != nil {