Skip to content

[inputs.turbostat] Interval cannot be less than 1s #17957

@NiccoloTosato

Description

@NiccoloTosato

Relevant telegraf.conf

[[inputs.turbostat]]
  interval = "500ms"

Logs from Telegraf

# ./telegraf --debug  --config ../telegraf.conf
2025-11-06T16:00:38Z I! Loading config: ../telegraf.conf
2025-11-06T16:00:38Z I! Starting Telegraf 1.36.3 brought to you by InfluxData the makers of InfluxDB
2025-11-06T16:00:38Z I! Available plugins: 239 inputs, 9 aggregators, 35 processors, 26 parsers, 65 outputs, 6 secret-stores
2025-11-06T16:00:38Z I! Loaded inputs: cpu diskio exec infiniband linux_cpu mem net turbostat
2025-11-06T16:00:38Z I! Loaded aggregators:
2025-11-06T16:00:38Z I! Loaded processors:
2025-11-06T16:00:38Z I! Loaded secretstores:
2025-11-06T16:00:38Z I! Loaded outputs: http
2025-11-06T16:00:38Z I! Tags enabled: host=compute001
2025-11-06T16:00:38Z I! [agent] Config: Interval:1s, Quiet:false, Hostname:"compute001", Flush Interval:10s
2025-11-06T16:00:38Z W! [agent] The default value of 'skip_processors_after_aggregators' will change to 'true' with Telegraf v1.40.0! If you need the current default behavior, please explicitly set the option to 'false'!
2025-11-06T16:00:38Z D! [agent] Initializing plugins
2025-11-06T16:00:38Z D! [agent] Connecting outputs
2025-11-06T16:00:38Z D! [agent] Attempting connection to [outputs.http]
2025-11-06T16:00:38Z D! [agent] Successfully connected to outputs.http
2025-11-06T16:00:38Z D! [agent] Starting service inputs
2025-11-06T16:00:38Z I! [inputs.turbostat] Starting process: turbostat [--quiet --interval 0 --show all]
2025-11-06T16:00:38Z E! [inputs.turbostat] Error in plugin: interval 0.000000 seconds is too small
2025-11-06T16:00:38Z E! [inputs.turbostat] Process /usr/bin/turbostat exited: exit status 2
2025-11-06T16:00:38Z I! [inputs.turbostat] Restarting in 5s...
2025-11-06T16:00:43Z I! [inputs.turbostat] Starting process: turbostat [--quiet --interval 0 --show all]
2025-11-06T16:00:43Z E! [inputs.turbostat] Error in plugin: interval 0.000000 seconds is too small
2025-11-06T16:00:43Z E! [inputs.turbostat] Process /usr/bin/turbostat exited: exit status 2
2025-11-06T16:00:43Z I! [inputs.turbostat] Restarting in 5s...
^C2025-11-06T16:00:43Z D! [agent] Stopping service inputs

System info

Telegraf 1.36.3, Fedora Linux 42 (Adams), turbostat version 2025.02.02

Docker

No response

Steps to reproduce

  1. Set interval = "500ms" in place of interval = 1s
  2. Run telegraf

Expected behavior

I expect that interval is ignored since the documentation reports The global or plugin specific interval setting may not apply. If the interval is not ignored, I expect it to be honored.

Actual behavior

While setting 500ms as an interval, the turbostat process receives an interval of 0.

2025-11-06T16:00:38Z I! [inputs.turbostat] Starting process: turbostat [--quiet --interval 0 --show all]
2025-11-06T16:00:38Z E! [inputs.turbostat] Error in plugin: interval 0.000000 seconds is too small

Additional info

What happens is that in the code, the interval is rounded as an Integer, then 500ms is passed to turbostat as zero.

s := int(time.Duration(t.Interval).Seconds())
t.command = append(t.command, t.Path, "--quiet", "--interval", strconv.Itoa(s), "--show", "all")

turbostat accepts the following interval format: -i, --interval sec.subsec. This means that it is possible to adopt non-integer values (e.g float).

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