From debf7bf149a50a317c626a1743803bd83475fa6f Mon Sep 17 00:00:00 2001
From: Cameron Sparr <cameronsparr@gmail.com>
Date: Wed, 18 May 2016 21:22:10 +0100
Subject: [PATCH] ntpq input: ignore lines that are '-'

closes #1223
---
 plugins/inputs/ntpq/ntpq.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/plugins/inputs/ntpq/ntpq.go b/plugins/inputs/ntpq/ntpq.go
index edcdac3d..e9dc1cc1 100644
--- a/plugins/inputs/ntpq/ntpq.go
+++ b/plugins/inputs/ntpq/ntpq.go
@@ -122,6 +122,9 @@ func (n *NTPQ) Gather(acc telegraf.Accumulator) error {
 				if index == -1 {
 					continue
 				}
+				if fields[index] == "-" {
+					continue
+				}
 
 				if key == "when" {
 					when := fields[index]
@@ -169,6 +172,9 @@ func (n *NTPQ) Gather(acc telegraf.Accumulator) error {
 				if index == -1 {
 					continue
 				}
+				if fields[index] == "-" {
+					continue
+				}
 
 				m, err := strconv.ParseFloat(fields[index], 64)
 				if err != nil {
-- 
GitLab