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

containerd 指标采集

简介

采集 containerd 数据指标上报到 DataFlux 中。

前置条件

配置

containerd 是 docker 的基本组件之一,安装 docker 并运行容器,同样可以采集该容器的指标数据。

注意,如果 docker 版本太低(比如 v1.13),没有使用 containerd 组件,因此也无法使用 containerd 采集指标数据。

注:需要使用 sudo 权限

进入 DataKit 安装目录下的 conf.d/containerd 目录,复制 containerd.conf.sample 并命名为 containerd.conf。示例配置及说明如下:

[inputs.containerd]
    # containerd 在本机的 sock 地址
    # 当此配置为空时,使用默认值 "/run/containerd/containerd.sock"
    location = "/run/containerd/containerd.sock"
    
    # 需要采集的 containerd namespace
    # 可以使 'ps -ef | grep containerd | grep containerd-shim' 查看详情
    # 必填
    namespace = "moby"
    
    # 需要采集的 containerd ID 列表,ID 是一串长度为 64 的字符串
    # 如果该值是 "*" ,会默认采集所有
    # 必填
    ID_list = ["*"]
    
    # 采集间隔时长,数字+单位,有效单位 "ns", "us" (or "µs"), "ms", "s", "m", "h"
    # 其值不可小于等于 0
    # 必填
    interval = "10s"
    
    # 自定义 tags
    # [inputs.containerd.tags]
    # tags1 = "value1"

指标说明:

tags 以用户配置为第一优先

采集器会补充 namespace 字段为当前指标所在的命名空间,id 字段为当前指标的 container ID。

采集指标

指标 类型 单位
id tags string
namespace tags string
pids_current fields int
pids_limit fields int
cpu_throttling_periods fields int
cpu_throttling_throttledperiods fields int
cpu_throttling_throttledtime fields int
cpu_usage_kernel fields int
cpu_usage_total fields int
cpu_usage_user fields int
memory_activeanon fields int
memory_activefile fields int
memory_cache fields int
memory_dirty fields int
memory_hierarchicalmemorylimit fields int
memory_hierarchicalswaplimit fields int
memory_inactiveanon fields int
memory_inactivefile fields int
memory_kernel_failcnt fields int
memory_kernel_limit fields int
memory_kernel_max fields int
memory_kernel_usage fields int
memory_kerneltcp_failcnt fields int
memory_kerneltcp_limit fields int
memory_kerneltcp_max fields int
memory_kerneltcp_usage fields int
memory_mappedfile fields int
memory_pgfault fields int
memory_pgmajfault fields int
memory_pgpgin fields int
memory_pgpgout fields int
memory_rss fields int
memory_rsshuge fields int
memory_swap_failcnt fields int
memory_swap_limit fields int
memory_swap_max fields int
memory_swap_usage fields int
memory_totalactiveanon fields int
memory_totalactivefile fields int
memory_totalcache fields int
memory_totaldirty fields int
memory_totalinactiveanon fields int
memory_totalinactivefile fields int
memory_totalmappedfile fields int
memory_totalpgfault fields int
memory_totalpgmajfault fields int
memory_totalpgpgin fields int
memory_totalpgpgout fields int
memory_totalrss fields int
memory_totalrsshuge fields int
memory_totalunevictable fields int
memory_totalwriteback fields int
memory_unevictable fields int
memory_usage_failcnt fields int
memory_usage_limit fields int
memory_usage_max fields int
memory_usage_usage fields int
memory_writeback fields int

示例输出

containerd,id=920497a63e5124c7bfd282728f6070850b7fdcb8c2f2a6c484ff2cb318da5a9c,namespace=moby cpu_throttling_periods=0i,cpu_throttling_throttledperiods=0i,\
cpu_throttling_throttledtime=0i,cpu_usage_kernel=6020000000i,cpu_usage_total=29420222174i,cpu_usage_user=6420000000i,memory_activeanon=3637248i,\
memory_activefile=2072576i,memory_cache=25595904i,memory_dirty=0i,memory_hierarchicalmemorylimit=9223372036854771712i,memory_hierarchicalswaplimit=0i,\
memory_inactiveanon=3801088i,memory_inactivefile=29597696i,memory_kernel_failcnt=0i,memory_kernel_limit=0i,memory_kernel_max=0i,memory_kernel_usage=0i,\
memory_kerneltcp_failcnt=0i,memory_kerneltcp_limit=0i,memory_kerneltcp_max=0i,memory_kerneltcp_usage=0i,memory_mappedfile=21770240i,memory_pgfault=6790i,\
memory_pgmajfault=206i,memory_pgpgin=11440i,memory_pgpgout=2403i,memory_rss=13512704i,memory_rsshuge=0i,memory_swap_failcnt=0i,memory_swap_limit=0i,\
memory_swap_max=0i,memory_swap_usage=0i,memory_totalactiveanon=3637248i,memory_totalactivefile=2072576i,memory_totalcache=25595904i,memory_totaldirty=0i,\
memory_totalinactiveanon=3801088i,memory_totalinactivefile=29597696i,memory_totalmappedfile=21770240i,memory_totalpgfault=6790i,memory_totalpgmajfault=206i,\
memory_totalpgpgin=11440i,memory_totalpgpgout=2403i,memory_totalrss=13512704i,memory_totalrsshuge=0i,memory_totalunevictable=0i,memory_totalwriteback=0i,\
memory_unevictable=0i,memory_usage_failcnt=0i,memory_usage_limit=9223372036854771712i,memory_usage_max=42217472i,memory_usage_usage=41902080i,\
memory_writeback=0i,pids_current=21i,pids_limit=0i 1595577320998998486