Skip to content

Telegraf returns divide by zero with uneven CPU core count. #17225

@Duedot43

Description

@Duedot43

Relevant telegraf.conf

[global_tags]

[agent]
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  debug = true
  quiet = false
  omit_hostname = false










[[inputs.cpu]]
  percpu = true
  totalcpu = true
  collect_cpu_time = false

[[inputs.disk]]

[[inputs.diskio]]


[[inputs.mem]]

[[inputs.processes]]


[[inputs.system]]

[[inputs.net]]


[[inputs.ping]]
  method = "exec"
  binary = "ping"
  urls = ['1.1.1.1']
  arguments = ["-4", "-c", "4"]





[[inputs.tail]]
  data_format = "json"
  files = ["/var/log/suricata/eve.json"]
  name_override = "suricata"
  tag_keys = ["event_type","src_ip","src_port","dest_ip","dest_port"]
  json_string_fields = ["*"]

Logs from Telegraf

panic: runtime error: integer divide by zero

goroutine 1 [running]:
github.com/klauspost/cpuid/v2.physicalCores()
        github.com/klauspost/cpuid/v2@v2.2.10/cpuid.go:881 +0xef
github.com/klauspost/cpuid/v2.addInfo(0x11247c40, 0x42?)
        github.com/klauspost/cpuid/v2@v2.2.10/detect_x86.go:33 +0x1e5
github.com/klauspost/cpuid/v2.Detect()
        github.com/klauspost/cpuid/v2@v2.2.10/cpuid.go:376 +0x85
github.com/klauspost/cpuid/v2.init.0()
        github.com/klauspost/cpuid/v2@v2.2.10/cpuid.go:355 +0x9f

System info

Proxmox, 8 core xeon, 5 cores attatched to the VM which caused the bug), using OPNsense

Docker

No response

Steps to reproduce

  1. Make a VM with uneven ammount of CPU cores.
  2. Start Telegraf.

Expected behavior

Telegraf starts without errors.

Actual behavior

Telegraf crashes with logs indicating a divide by zero error.

Additional info

Telegraf version 1.34.4_1

Metadata

Metadata

Assignees

Labels

bugunexpected problem or unintended behaviorwaiting for responsewaiting for response from contributor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions