search
数据采集 采集源配置 Docker 指标采集

Docker 指标采集

采集 docker 指标上报到 DataFlux 中

进入 DataKit 安装目录下的 conf.d/docker 目录,复制 docker.conf.sample 并命名为 docker.conf。示例如下:

设置:

# Read metrics about docker containers
[[inputs.docker]]
  ## Docker Endpoint
  ##   To use TCP, set endpoint = "tcp://[ip]:[port]"
  ##   To use environment variables (ie, docker-machine), set endpoint = "ENV"
  endpoint = "unix:///var/run/docker.sock"

  ## Set to true to collect Swarm metrics(desired_replicas, running_replicas)
  ## Note: configure this in one of the manager nodes in a Swarm cluster.
  ## configuring in multiple Swarm managers results in duplication of metrics.
  gather_services = false

  ## Only collect metrics for these containers. Values will be appended to
  ## container_name_include.
  ## Deprecated (1.4.0), use container_name_include
  container_names = []

  ## Set the source tag for the metrics to the container ID hostname, eg first 12 chars
  source_tag = false

  ## Containers to include and exclude. Collect all if empty. Globs accepted.
  container_name_include = []
  container_name_exclude = []

  ## Container states to include and exclude. Globs accepted.
  ## When empty only containers in the "running" state will be captured.
  ## example: container_state_include = ["created", "restarting", "running", "removing", "paused", "exited", "dead"]
  ## example: container_state_exclude = ["created", "restarting", "running", "removing", "paused", "exited", "dead"]
  # container_state_include = []
  # container_state_exclude = []

  ## Timeout for docker list, info, and stats commands
  timeout = "5s"

  ## Whether to report for each container per-device blkio (8:0, 8:1...) and
  ## network (eth0, eth1, ...) stats or not
  perdevice = true

  ## Whether to report for each container total blkio and network stats or not
  total = false

  ## docker labels to include and exclude as tags.  Globs accepted.
  ## Note that an empty array for both will include all labels as tags
  docker_label_include = []
  docker_label_exclude = []

  ## Which environment variables should we use as a tag
  tag_env = ["JAVA_HOME", "HEAP_SIZE"]

  ## Optional TLS Config
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = false

配置好后,重启 DataKit 即可生效

docker 指标

指标 描述 类型 单位 Tag
n_used_file_descriptors integer - unit,engine_host,server_version
n_cpus integer - unit,engine_host,server_version
n_containers integer - unit,engine_host,server_version
n_containers_running integer - unit,engine_host,server_version
n_containers_stopped integer - unit,engine_host,server_version
n_containers_paused integer - unit,engine_host,server_version
n_images integer - unit,engine_host,server_version
n_listener_events integer - unit,engine_host,server_version
memory_total integer - unit,engine_host,server_version

docker_data 指标

指标 描述 类型 单位 Tag
available - unit,engine_host,server_version
total - unit,engine_host,server_version
used - unit,engine_host,server_version

docker_metadata 指标

指标 描述 类型 单位 Tag
available - unit,engine_host,server_version
total - unit,engine_host,server_version
used - unit,engine_host,server_version

docker_devicemapper

指标 描述 类型 单位 Tag
pool_blocksize_bytes - engine_host,server_version,pool_name
data_space_used_bytes - engine_host,server_version,pool_name
data_space_total_bytes - engine_host,server_version,pool_name
data_space_available_bytes - engine_host,server_version,pool_name
metadata_space_used_bytes - engine_host,server_version,pool_name
metadata_space_total_bytes - engine_host,server_version,pool_name
metadata_space_available_bytes - engine_host,server_version,pool_name
thin_pool_minimum_free_space_bytes - engine_host,server_version,pool_name

docker_container_mem 指标

指标 描述 类型 单位 Tag
total_pgmajfault - engine_host,server_version,container_image,container_name,container_status,container_version
cache - engine_host,server_version,container_image,container_name,container_status,container_version
mapped_file - engine_host,server_version,container_image,container_name,container_status,container_version
total_mapped_file - engine_host,server_version,container_image,container_name,container_status,container_version
pgpgout - engine_host,server_version,container_image,container_name,container_status,container_version
rss - engine_host,server_version,container_image,container_name,container_status,container_version
total_mapped_file - engine_host,server_version,container_image,container_name,container_status,container_version
writeback - engine_host,server_version,container_image,container_name,container_status,container_version
unevictable - engine_host,server_version,container_image,container_name,container_status,container_version
pgpgin - engine_host,server_version,container_image,container_name,container_status,container_version
total_unevictable - engine_host,server_version,container_image,container_name,container_status,container_version
pgmajfault - engine_host,server_version,container_image,container_name,container_status,container_version
total_rss - engine_host,server_version,container_image,container_name,container_status,container_version
total_rss_huge - engine_host,server_version,container_image,container_name,container_status,container_version
total_writeback - engine_host,server_version,container_image,container_name,container_status,container_version
total_inactive_anon - engine_host,server_version,container_image,container_name,container_status,container_version
rss_huge - engine_host,server_version,container_image,container_name,container_status,container_version
hierarchical_memory_limit - engine_host,server_version,container_image,container_name,container_status,container_version
total_pgfault - engine_host,server_version,container_image,container_name,container_status,container_version
total_active_file - engine_host,server_version,container_image,container_name,container_status,container_version
active_anon - engine_host,server_version,container_image,container_name,container_status,container_version
total_active_anon - engine_host,server_version,container_image,container_name,container_status,container_version
total_pgpgout - engine_host,server_version,container_image,container_name,container_status,container_version
total_cache - engine_host,server_version,container_image,container_name,container_status,container_version
inactive_anon - engine_host,server_version,container_image,container_name,container_status,container_version
active_file - engine_host,server_version,container_image,container_name,container_status,container_version
pgfault - engine_host,server_version,container_image,container_name,container_status,container_version
inactive_file - engine_host,server_version,container_image,container_name,container_status,container_version
total_pgpgin - engine_host,server_version,container_image,container_name,container_status,container_version
max_usage - engine_host,server_version,container_image,container_name,container_status,container_version
usage - engine_host,server_version,container_image,container_name,container_status,container_version
failcnt - engine_host,server_version,container_image,container_name,container_status,container_version
limit - engine_host,server_version,container_image,container_name,container_status,container_version
container_id - engine_host,server_version,container_image,container_name,container_status,container_version

docker_container_cpu 指标

指标 描述 类型 单位 Tag
throttling_periods - engine_host,server_version,container_image,container_name,container_status,container_version,cpu
throttling_throttled_periods - engine_host,server_version,container_image,container_name,container_status,container_version,cpu
throttling_throttled_time - engine_host,server_version,container_image,container_name,container_status,container_version,cpu
usage_in_kernelmode - engine_host,server_version,container_image,container_name,container_status,container_version,cpu
usage_in_usermode - engine_host,server_version,container_image,container_name,container_status,container_version,cpu
usage_system - engine_host,server_version,container_image,container_name,container_status,container_version,cpu
usage_total - engine_host,server_version,container_image,container_name,container_status,container_version,cpu
usage_percent - engine_host,server_version,container_image,container_name,container_status,container_version,cpu
container_id - engine_host,server_version,container_image,container_name,container_status,container_version,cpu

docker_container_net 指标

指标 描述 类型 单位 Tag
rx_dropped - engine_host,server_version,container_image,container_name,container_status,container_version,network
rx_bytes - engine_host,server_version,container_image,container_name,container_status,container_version,network
rx_errors - engine_host,server_version,container_image,container_name,container_status,container_version,network
tx_packets - engine_host,server_version,container_image,container_name,container_status,container_version,network
tx_dropped - engine_host,server_version,container_image,container_name,container_status,container_version,network
rx_packets - engine_host,server_version,container_image,container_name,container_status,container_version,network
tx_errors - engine_host,server_version,container_image,container_name,container_status,container_version,network
tx_bytes - engine_host,server_version,container_image,container_name,container_status,container_version,network
container_id - engine_host,server_version,container_image,container_name,container_status,container_version,network

docker_container_blkio 指标

指标 描述 类型 单位 Tag
io_service_bytes_recursive_async - engine_host,server_version,container_image,container_name,container_status,container_version,device
io_service_bytes_recursive_read - engine_host,server_version,container_image,container_name,container_status,container_version,device
io_service_bytes_recursive_sync - engine_host,server_version,container_image,container_name,container_status,container_version,device
io_service_bytes_recursive_total - engine_host,server_version,container_image,container_name,container_status,container_version,device
io_service_bytes_recursive_write - engine_host,server_version,container_image,container_name,container_status,container_version,device
io_serviced_recursive_async - engine_host,server_version,container_image,container_name,container_status,container_version,device
io_serviced_recursive_read - engine_host,server_version,container_image,container_name,container_status,container_version,device
io_serviced_recursive_sync - engine_host,server_version,container_image,container_name,container_status,container_version,device
io_serviced_recursive_total - engine_host,server_version,container_image,container_name,container_status,container_version,device
io_serviced_recursive_write - engine_host,server_version,container_image,container_name,container_status,container_version,device
container_id - engine_host,server_version,container_image,container_name,container_status,container_version,device

docker_container_health 指标 (容器必须开启 HEALTHCHECK)

指标 描述 类型 单位 Tag
health_status string - engine_host,server_version,container_image,container_name,container_status,container_version
failing_streak integer - engine_host,server_version,container_image,container_name,container_status,container_version

docker_container_status 指标

指标 描述 类型 单位 Tag
container_id - engine_host,server_version,container_image,container_name,container_status,container_version
oomkilled boolean - engine_host,server_version,container_image,container_name,container_status,container_version
pid integer - engine_host,server_version,container_image,container_name,container_status,container_version
exitcode integer - engine_host,server_version,container_image,container_name,container_status,container_version
started_at integer - engine_host,server_version,container_image,container_name,container_status,container_version
finished_at integer - engine_host,server_version,container_image,container_name,container_status,container_version
uptime_ns integer - engine_host,server_version,container_image,container_name,container_status,container_version

docker_swam 指标

指标 描述 类型 单位 Tag
tasks_desired - service_id,service_name,service_mode
tasks_running - service_id,service_name,service_mode