telegraf icon indicating copy to clipboard operation
telegraf copied to clipboard

docker plugin docker_container_blkio only has container_id not measurement

Open ywang412 opened this issue 8 years ago • 5 comments

Bug report

On windows 10 enterprise, I can use docker stats to see blk io which is not zero. It looks like 9.13mb / 140mb. However, the telegraf cannot get the blkio. Other metrics like CPU%, NET io and memory are correct. Only blkio is not working. docker_container_blkio in influxdb only has container_id not measurement.

Relevant telegraf.conf:

I tried true/true, false/false, true/false, false/true for perdevice/total. All choices are not working for blkio

[[inputs.docker]]

endpoint = "tcp://127.0.0.1:2375"

gather_services = false

container_names = []

container_name_include = [] container_name_exclude = []

timeout = "5s"

perdevice = true

total = true

docker_label_include = [] docker_label_exclude = []

System info:

win10 enterprise, telegraf 1.5

[Include Telegraf version, operating system name, and other relevant details]

Steps to reproduce:

  1. ... telegraf --config telegraf.conf
  2. ...

Expected behavior:

Actual behavior:

Additional info:

[Include gist of relevant config, logs, etc.]

ywang412 avatar Feb 13 '18 19:02 ywang412

Can you add the output of this command or similar?:

curl http://127.0.0.1:2375/containers/<some-container-you-have>/stats

danielnelson avatar Feb 16 '18 05:02 danielnelson

{"read":"2018-02-16T17:33:08.6050714Z","preread":"0001-01-01T00:00:00Z","pids_stats":{},"blkio_stats":{"io_service_bytes_recursive":null,"io_serviced_recursive":null,"io_queue_recursive":null,"io_service_time_recursive":null,"io_wait_time_recursive":null,"io_merged_recursive":null,"io_time_recursive":null,"sectors_recursive":null},"num_procs":8,"storage_stats":{"read_count_normalized":27287,"read_size_bytes":197374976,"write_count_normalized":162553,"write_size_bytes":905820160},"cpu_stats":{"cpu_usage":{"total_usage":120087827528,"usage_in_kernelmode":0,"usage_in_usermode":0},"throttling_data":{"periods":0,"throttled_periods":0,"throttled_time":0}},"precpu_stats":{"cpu_usage":{"total_usage":0,"usage_in_kernelmode":0,"usage_in_usermode":0},"throttling_data":{"periods":0,"throttled_periods":0,"throttled_time":0}},"memory_stats":{"commitbytes":1088184320,"commitpeakbytes":1088700416,"privateworkingset":673415168},"name":"/rmq","id":"3f4930d8cf3c03ad2a49a2a72a731a6aa8fa04e7e0bf670e6fcad7c6335006e1","networks":{"a59cc8d1-ae78-451d-ba71-dc813f100071":{"rx_bytes":0,"rx_packets":0,"rx_errors":0,"rx_dropped":0,"tx_bytes":0,"tx_packets":0,"tx_errors":0,"tx_dropped":0}}}

Here is the response. Thank you!

ywang412 avatar Feb 16 '18 17:02 ywang412

This must be why we can't read the blkio:

    "blkio_stats": {
        "io_merged_recursive": null,
        "io_queue_recursive": null,
        "io_service_bytes_recursive": null,
        "io_service_time_recursive": null,
        "io_serviced_recursive": null,
        "io_time_recursive": null,
        "io_wait_time_recursive": null,
        "sectors_recursive": null
    },

It looks that the cli uses this data to construct the values on Windows[1]:

    "storage_stats": {
        "read_count_normalized": 27287,
        "read_size_bytes": 197374976,
        "write_count_normalized": 162553,
        "write_size_bytes": 905820160
    }

So I think what we should do is add read_bytes and write_bytes fields for these values, on Windows we just use the storage stats, and on linux we sum the values as in calculateBlockIO [2].

[1] https://github.com/docker/cli/blob/1401d5daf2f49a97791487dd5c5a8598907f0bf1/cli/command/container/stats_helpers.go#L113 [2] https://github.com/docker/cli/blob/1401d5daf2f49a97791487dd5c5a8598907f0bf1/cli/command/container/stats_helpers.go#L203

danielnelson avatar Feb 16 '18 21:02 danielnelson

@ywang412 does that issue still exists on the latest version of Telegraf?

srebhan avatar Jul 12 '23 15:07 srebhan

Hello! I am closing this issue due to inactivity. I hope you were able to resolve your problem, if not please try posting this question in our Community Slack or Community Forums or provide additional details in this issue and reqeust that it be re-opened. Thank you!

telegraf-tiger[bot] avatar Jul 26 '23 18:07 telegraf-tiger[bot]