influxdata / influxdata/telegraf

internet-speed reports negative packetloss

Open
#16,279 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
17.8k
Forks
5.8k
Avg merge
1d 20h
Merged PRs (30d)
161

Description

Relevant telegraf.conf
# Monitors internet speed using speedtest.net service
[[inputs.internet_speed]]
  ## This plugin downloads many MB of data each time it is run. As such
  ## consider setting a higher interval for this plugin to reduce the
  ## demand on your internet connection.
   interval = "480m"

  ## Enable to reduce memory usage
  # memory_saving_mode = false

  ## Caches the closest server location
  # cache = false

  ## Number of concurrent connections
  ## By default or set to zero, the number of CPU cores is used. Use this to
  ## reduce the impact on system performance or to increase the connections on
  ## faster connections to ensure the fastest speed.
  # connections = 0

  ## Test mode
  ## By default, a single sever is used for testing. This may work for most,
  ## however, setting to "multi" will reach out to multiple servers in an
  ## attempt to get closer to ideal internet speeds.
   test_mode = "multi"

  ## Server ID exclude filter
  ## Allows the user to exclude or include specific server IDs received by
  ## speedtest-go. Values in the exclude option will be skipped over. Values in
  ## the include option are the only options that will be picked from.
  ##
  ## See the list of servers speedtest-go will return at:
  ##     https://www.speedtest.net/api/js/servers?engine=js&limit=10
  ##
  # server_id_exclude = []
   server_id_include = [ "2073" ]
Logs from Telegraf
2024-12-09T21:21:12Z I! Loading config: /etc/telegraf/telegraf.conf
2024-12-09T21:21:12Z I! Loading config: /etc/telegraf/telegraf.d/in_speedtest.conf
2024-12-09T21:21:12Z I! Loading config: /etc/telegraf/telegraf.d/out_influxv2.conf
2024-12-09T21:21:12Z W! Agent setting "logtarget" is deprecated, please just set "logfile" and remove this setting! The setting will be removed in v1.40.0.
2024-12-09T21:21:12Z I! Starting Telegraf 1.32.3 brought to you by InfluxData the makers of InfluxDB
2024-12-09T21:21:12Z I! Available plugins: 235 inputs, 9 aggregators, 32 processors, 26 parsers, 62 outputs, 6 secret-stores
2024-12-09T21:21:12Z I! Loaded inputs: internet_speed
2024-12-09T21:21:12Z I! Loaded aggregators:
2024-12-09T21:21:12Z I! Loaded processors:
2024-12-09T21:21:12Z I! Loaded secretstores:
2024-12-09T21:21:12Z I! Loaded outputs: influxdb_v2
2024-12-09T21:21:12Z I! Tags enabled:
2024-12-09T21:21:12Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"", Flush Interval:10s
2024-12-09T21:21:12Z D! [agent] Initializing plugins
2024-12-09T21:21:12Z D! [agent] Connecting outputs
2024-12-09T21:21:12Z D! [agent] Attempting connection to [outputs.influxdb_v2]
2024-12-09T21:21:12Z D! [agent] Successfully connected to outputs.influxdb_v2
2024-12-09T21:21:12Z D! [agent] Starting service inputs
2024-12-09T21:21:22Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2024-12-09T21:21:32Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2024-12-09T21:21:42Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2024-12-09T21:21:52Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
System info

Ubuntu 24.04.1 LTS, docker 27.3.1, telegraf 1.32.3 in docker

Docker
name: 'telegraf-speedtest'

services:
  telegraf-speedtest:
    image: 'telegraf'
    container_name: telegraf-speedtest
    restart: unless-stopped
    volumes:
      - /docker-data/telegraf-speedtest/config/telegraf.conf:/etc/telegraf/telegraf.conf
      - /docker-data/telegraf-speedtest/config/telegraf.d/:/etc/telegraf/telegraf.d/
    environment:
      - TZ=Europe/Amsterdam
Steps to reproduce
  1. configure telegraf docker with speedtest input and influxv2 output
  2. have telegraf run for a while
  3. observe negative packet loss values in influx
Expected behavior

Packetloss displays realistic values. My environment is stable, rarely experiencing any packetloss.

Actual behavior

Consistently seeing negative values for packetloss in influx. Not able to reproduce any packetloss with speedtest-cli.

image
Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the Go implementation of the internet_speed input and the packet-loss calculation, then reproduce the reported configuration with the provided Docker setup. Verify how packet loss is derived from the speedtest result and confirm that the reported metric remains realistic and non-negative.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability-sre
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.