Skip to content

ntp plugin crash #1634

@gmr

Description

@gmr

A parse error in the ntp plugin caused a telegraf agent to crash.

Relevant telegraf.conf:

[[inputs.ntpq]]
#   ## If false, set the -n ntpq flag. Can reduce metric gather time.
#   dns_lookup = true

System info:

Telegraf - version 0.13.1
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"

Steps to reproduce:

I'm guessing an unexpected response from the call the agent makes to grab NTP info causes the crash to happen.

Expected behavior:

Agent doesn't crash

Actual behavior:

Agent Crashes

Additional info:

2016/08/15 09:46:00 ERROR ntpq: parsing int: 77.759
panic: runtime error: index out of range

goroutine 2202595 [running]:
panic(0x107ebc0, 0xc820010080)
    /usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/influxdata/telegraf/plugins/inputs/ntpq.(*NTPQ).Gather(0xc8204da660, 0x7f5ecebaa368, 0xc82078c000, 0x0, 0x0)
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/ntpq/ntpq.go:175 +0xc90
github.com/influxdata/telegraf/agent.gatherWithTimeout.func1(0xc820558120, 0xc8201d0c60, 0xc82078c000)
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:174 +0x73
created by github.com/influxdata/telegraf/agent.gatherWithTimeout
    /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:175 +0xe0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugunexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions