Skip to content

Negative collection_offset Causes Multiple Executions #18175

@network-monitoring

Description

@network-monitoring

Relevant telegraf.conf

/etc/telegraf# cat telegraf.conf
[[inputs.exec]]
  interval = "30s"
  commands = ["python3 /etc/telegraf/test.py"]
  timeout = "3s"
  collection_offset = "-15s"
  data_format = "influx"

[[outputs.file]]
  files = ["stdout", "/etc/telegraf/test_output.txt"]


/etc/telegraf# cat test.py 
print("metric,tag1=1,tag2=2 value=1")

Logs from Telegraf

2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped
2025-12-31T13:07:48Z D! [inputs.exec] Previous collection has not completed; scheduled collection skipped

System info

Ubuntu 24.04.3 , Telegraf 1.37.0

Docker

When running with a negative offset Telegraf is executing the python script multiple times, when running with a positive offset there are no issues.

Steps to reproduce

  1. Copy telegraf.conf config above to /etc/telegraf folder.
  2. Copy python script to /etc/telegraf folder and make executable.
  3. Run /usr/bin/telegraf --config telegraf.conf with the config of collection_offset = "-15s" to see the problem, run the same command again with collection_offset = "5s" and the issue no longer happens.
    ...

Expected behavior

I would expect telegraf to run the command / script once at 15s before the set interval rate.

Actual behavior

I appears to be running it multiple times and printing the results multiple times.

Additional info

No response

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