Skip to content
Snippets Groups Projects
Commit debf7bf1 authored by Cameron Sparr's avatar Cameron Sparr
Browse files

ntpq input: ignore lines that are '-'

closes #1223
parent 1dbe3b82
No related branches found
No related tags found
No related merge requests found
...@@ -122,6 +122,9 @@ func (n *NTPQ) Gather(acc telegraf.Accumulator) error { ...@@ -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 { ...@@ -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 {
......
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