Telegraf prevents a hard drive from going to sleep

I am running telegran 1.20.4 in docker (with grafana, influxdb) in a system with OpenMediaVault 6 (Debian).

I have installed hd-idle to manage when my disks should spin down when they are not in use.

I had one disk that was unable to spin down and after a lot of try and failure I found out that was telegraf container who prevented to spin down. As soon I as I stop the container, the disk goes to sleep.

This is my telegraf docker-compose:

  container_name: telegraf
  restart: unless-stopped
   - /docker/telegraf:/etc/telegraf:ro
   - /proc:/host/proc:ro
   - /:/hostfs:ro
   - /var/run/docker.sock:/var/run/docker.sock
   - TZ=Europe/Madrid
   - HOST_MOUNT_PREFIX=/hostfs
   - HOST_PROC=/host/proc
  network_mode: host


I tried to remove HOST_MOUNT_PREFIX and HOST_PROC with no success.

This is my telegraf config file:

  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  hostname = ""
  omit_hostname = false
  urls = 
  token =
  bucket = 
    percpu = true
    totalcpu = true
    collect_cpu_time = false
    report_active = false
    ignore_fs = ["tmpfs", "devtmpfs", "devfs"]

  endpoint = "unix:///var/run/docker.sock"
  gather_services = false
  container_name_include = []
  container_name_exclude = []
  timeout = "30s"
  docker_label_include = []
  docker_label_exclude = []
  perdevice = true
  total = false

I tried to remove [[inputs.disk]] and [[]] with no success.

If the disk is sleeping and I start the container, nothing happens. But, if the disk start spinning when the container is running, then it won’t stop spinning again.

I have four disks and only happens in one of them. No idea what to try more. Any help?

Per your config Telegraf itself is scheduled to run the agent every 10 seconds. This means every 10 seconds it is going to go and attempt to read from the docker socket as well as all those other inputs you have. As a result, it it entirely possible that one, some, or all of these inputs require the disk to be read from and cannot be put to sleep.

Also, where is your InfluxDB hosted? Is it also local? If so, if telegraf is sending metrics to a local InfluxDB those are also going to require writing to a disk.


Influx, telegraf and other docker data, config and mount points are in the same hdd as the SO, so the never go to sleep.

What I do not understand is…why is just one HDD that can not go to sleep if telegraf is running? I have other disks without this issue. I have had the same configuration in the past without that issue…but I guess there must be something else I do not know.

If you want to dig in further, then try to determine what changed: version of telegraf? the version of docker? new config for telegraf? etc.