Skip to content

ntpq input plugin should use the -w parameter to get entire IPv6 address of remote #4746

@jbro

Description

@jbro

Relevant telegraf.conf:

[[inputs.ntpq]]
  dns_lookup = false

System info:

Telegraf v1.6.4 (git: release-1.6 b24e8648)
Linux monitor 4.4.0-130-generic #156-Ubuntu SMP Thu Jun 14 08:53:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.4 LTS"

Steps to reproduce:

  1. $ sudo telegraf --test --input-filter ntpq
  2. $ ntpq -p -n
  3. $ ntpq -p -n -w

Expected behavior:

$ sudo telegraf --test --input-filter ntpq
2018/09/25 10:44:04 I! Using config file: /etc/telegraf/telegraf.conf
* Plugin: inputs.ntpq, Collection 1
> ntpq,host=monitor.nordu.net,refid=192.36.143.130,remote=2001:948:96::132,state_prefix=*,stratum=2,type=u reach=377i,when=22i,jitter=0.065,delay=12.424,offset=0.398,poll=32i 1537872245000000000
> ntpq,host=monitor.nordu.net,refid=192.36.143.130,remote=2001:948:96::133,state_prefix=+,stratum=2,type=u reach=377i,when=1i,poll=32i,delay=0.17,offset=-0.564,jitter=0.045 1537872245000000000
> ntpq,host=monitor.nordu.net,refid=83.168.200.199,remote=2001:948:96::134,state_prefix=-,stratum=3,type=u when=5i,poll=32i,delay=11.915,offset=-3.049,jitter=0.07,reach=377i 1537872245000000000
> ntpq,host=monitor.nordu.net,refid=192.36.143.130,remote=2001:948:96::135,state_prefix=+,stratum=2,type=u reach=377i,when=29i,jitter=0.045,delay=0.696,offset=-0.503,poll=32i 1537872245000000000

Actual behavior:

$ sudo telegraf --test --input-filter ntpq
2018/09/25 10:44:04 I! Using config file: /etc/telegraf/telegraf.conf
* Plugin: inputs.ntpq, Collection 1
> ntpq,host=monitor.nordu.net,refid=192.36.143.130,remote=2001:948:96::13,state_prefix=*,stratum=2,type=u reach=377i,when=22i,jitter=0.065,delay=12.424,offset=0.398,poll=32i 1537872245000000000
> ntpq,host=monitor.nordu.net,refid=192.36.143.130,remote=2001:948:96::13,state_prefix=+,stratum=2,type=u reach=377i,when=1i,poll=32i,delay=0.17,offset=-0.564,jitter=0.045 1537872245000000000
> ntpq,host=monitor.nordu.net,refid=83.168.200.199,remote=2001:948:96::13,state_prefix=-,stratum=3,type=u when=5i,poll=32i,delay=11.915,offset=-3.049,jitter=0.07,reach=377i 1537872245000000000
> ntpq,host=monitor.nordu.net,refid=192.36.143.130,remote=2001:948:96::13,state_prefix=+,stratum=2,type=u reach=377i,when=29i,jitter=0.045,delay=0.696,offset=-0.503,poll=32i 1537872245000000000

Additional info:

$ ntpq -p -n
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*2001:948:96::13 192.36.143.130   2 u   20   32  377   12.495    0.505   0.055
+2001:948:96::13 192.36.143.130   2 u   32   32  377    0.164   -0.301   0.106
-2001:948:96::13 83.168.200.199   3 u    8   32  377   11.953   -2.932   0.073
+2001:948:96::13 192.36.143.130   2 u   30   32  377    0.722   -0.426   0.074
$ ntpq -p -n -w
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*2001:948:96::132
                 192.36.143.130   2 u    1   32  377   12.495    0.505   0.057
+2001:948:96::133
                 192.36.143.130   2 u   13   32  377    0.164   -0.301   0.083
-2001:948:96::134
                 83.168.200.199   3 u   22   32  377   11.953   -2.932   0.073
+2001:948:96::135
                 192.36.143.130   2 u   11   32  377    0.722   -0.426   0.076

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestRequests for new plugin and for new features to existing pluginshelp wantedRequest for community participation, code, contributionsize/m2-4 day effort

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions