fix(inputs.ntpq): Handle pools with "-" when (#11827)

This commit is contained in:
Sven Rebhan 2022-09-19 19:43:22 +02:00 committed by GitHub
parent e5b6e629c4
commit 6236059817
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 0 deletions

View File

@ -223,6 +223,10 @@ func (n *NTPQ) gatherServer(acc telegraf.Accumulator, server string) {
}
fields[col.name] = value
case FieldDuration:
// Ignore fields only containing a minus
if raw == "-" {
continue
}
factor := int64(1)
suffix := raw[len(raw)-1:]
switch suffix {

View File

@ -0,0 +1,2 @@
ntpq,remote=0.eu.pool.ntp.o,refid=.POOL.,stratum=16,type=p poll=64i,reach=0i,delay=0.0,offset=0.0,jitter=0.0 0
ntpq,remote=195.201.19.162,refid=187.182.182.166,stratum=3,type=u poll=64i,reach=1i,delay=12.692,offset=1.283,jitter=0.0 0

View File

@ -0,0 +1,4 @@
remote refid st t when poll reach delay offset jitter
==============================================================================
0.eu.pool.ntp.o .POOL. 16 p - 64 0 0.000 +0.000 0.000
195.201.19.162 187.182.182.166 3 u - 64 1 12.692 +1.283 0.000

View File

@ -0,0 +1 @@
[[inputs.ntpq]]