Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic in docker input if endpoint is misconfigured #5225

Closed
russorat opened this issue Jan 3, 2019 · 0 comments
Closed

Panic in docker input if endpoint is misconfigured #5225

russorat opened this issue Jan 3, 2019 · 0 comments
Assignees
Labels
area/docker panic issue that results in panics from Telegraf
Milestone

Comments

@russorat
Copy link
Contributor

russorat commented Jan 3, 2019

Relevant telegraf.conf:

[[inputs.docker]]	
  ## Docker Endpoint
  ##   To use TCP, set endpoint = "tcp://[ip]:[port]"
  ##   To use environment variables (ie, docker-machine), set endpoint = "ENV"
  ##   exp: unix:///var/run/docker.sock
  endpoint = "localhost"

  ## Set to true to collect Swarm metrics(desired_replicas, running_replicas)
  gather_services = false

  ## Only collect metrics for these containers, collect all if empty
  container_names = []

  ## Containers to include and exclude. Globs accepted.
  ## Note that an empty array for both will include all containers
  container_name_include = []
  container_name_exclude = []

  ## Container states to include and exclude. Globs accepted.
  ## When empty only containers in the "running" state will be captured.
  # container_state_include = []
  # container_state_exclude = []

  ## Timeout for docker list, info, and stats commands
  timeout = "5s"

  ## Whether to report for each container per-device blkio (8:0, 8:1...) and
  ## network (eth0, eth1, ...) stats or not
  perdevice = true

  ## Whether to report for each container total blkio and network stats or not
  total = false
  
  ## Which environment variables should we use as a tag
  ##tag_env = ["JAVA_HOME", "HEAP_SIZE"]
  ## docker labels to include and exclude as tags.  Globs accepted.
  ## Note that an empty array for both will include all labels as tags
  docker_label_include = []
  docker_label_exclude = []

System info:

Telegraf version: master 3c4e737
operating system name: Mac OS 10.14.2
and other relevant details: Docker isn't running

Steps to reproduce:

  1. add config for docker
  2. ensure docker isn't running (but the address is invalid so it wouldn't matter)
  3. see panic

Expected behavior:

telegraf doesn't panic

Actual behavior:

telegraf panics

2019-01-03T20:27:06Z I! Starting Telegraf
2019-01-03T20:27:06Z I! Loaded inputs: inputs.docker inputs.mem inputs.diskio inputs.disk inputs.kernel inputs.processes inputs.swap inputs.system inputs.cpu
2019-01-03T20:27:06Z I! Loaded aggregators:
2019-01-03T20:27:06Z I! Loaded processors:
2019-01-03T20:27:06Z I! Loaded outputs: influxdb_v2
2019-01-03T20:27:06Z I! Tags enabled: host=prod1-rsavage.local
2019-01-03T20:27:06Z I! [agent] Config: Interval:15ms, Quiet:false, Hostname:"prod1-rsavage.local", Flush Interval:10s
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x48e517f]

goroutine 37 [running]:
github.com/influxdata/telegraf/plugins/inputs/docker.(*Docker).gatherInfo(0xc0002e03c0, 0x6108900, 0xc0003aa9e0, 0x0, 0x0)
	/Users/rsavage/go/src/github.com/influxdata/telegraf/plugins/inputs/docker/docker.go:298 +0x12f
github.com/influxdata/telegraf/plugins/inputs/docker.(*Docker).Gather(0xc0002e03c0, 0x6108900, 0xc0003aa9e0, 0x0, 0x0)
	/Users/rsavage/go/src/github.com/influxdata/telegraf/plugins/inputs/docker/docker.go:168 +0x86
github.com/influxdata/telegraf/internal/models.(*RunningInput).Gather(0xc0000bd140, 0x6108900, 0xc0003aa9e0, 0x60faa80, 0xc0000bcc40)
	/Users/rsavage/go/src/github.com/influxdata/telegraf/internal/models/running_input.go:86 +0x6d
github.com/influxdata/telegraf/agent.(*Agent).gatherOnce.func1(0xc00004a240, 0xc0000bd140, 0x6108900, 0xc0003aa9e0)
	/Users/rsavage/go/src/github.com/influxdata/telegraf/agent/agent.go:305 +0x3f
created by github.com/influxdata/telegraf/agent.(*Agent).gatherOnce
	/Users/rsavage/go/src/github.com/influxdata/telegraf/agent/agent.go:304 +0xdc

Additional info:

[Include gist of relevant config, logs, etc.]

@russorat russorat added panic issue that results in panics from Telegraf area/docker labels Jan 3, 2019
@danielnelson danielnelson added this to the 1.9.2 milestone Jan 3, 2019
@glinton glinton self-assigned this Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docker panic issue that results in panics from Telegraf
Projects
None yet
Development

No branches or pull requests

3 participants