cgroups v1的Prometheus导出器
项目描述
CGroups导出器
CGroups度量导出器,用于LXD/Docker/systemd。
收集主机上所有基于cgroups的容器或SystemD服务的度量,无需在每个容器内安装单独的导出器。
安装
pip install cgroups-exporter
示例
一个简单的示例收集了LXD容器所有可用的度量。
cgroups-exporter --cgroups-path "/sys/fs/cgroup/*/lxc.payload.*"
您可以通过传递多个路径模板,然后从每个人那里收集度量。
在下面的示例中,将收集以下度量:
- 所有LXD容器
- LXD容器内运行的所有SystemD服务
- LXD容器内的所有Docker容器。
- 所有用户切片(当通过ssh进入时,SystemD会根据模板
user-$UID
命名切片)
cgroups-exporter \
--cgroups-path \
"/sys/fs/cgroup/*/lxc.payload.*/" \
"/sys/fs/cgroup/unified/lxc.payload.*/**/*.service" \
"/sys/fs/cgroup/unified/lxc.payload.*/**/user-*" \
"/sys/fs/cgroup/cpu/lxc.payload.*/**/*.service" \
"/sys/fs/cgroup/unified/**/user.slice/user-*" \
"/sys/fs/cgroup/*/lxc.payload.*/docker/*"
用法
以--
开头的参数(例如-s)也可以在配置文件中设置(~/.cgroups-exporter.conf
或/etc/cgroups-exporter.conf
)。
配置文件语法允许:key=value
,flag=true
,stuff=[a,b,c]
(有关详细信息,请参阅此处的语法)。
如果在一个地方指定了多个参数,则命令行值覆盖环境变量,环境变量覆盖配置文件值,配置文件值覆盖默认值。
环境变量CGROUPS_EXPORTER_CONFIG
覆盖配置文件位置。
usage: cgroups-exporter [-h] [-s POOL_SIZE] [-u USER] [--log-level {critical,error,warning,info,debug,notset}] [--log-format {stream,color,json,syslog,plain,journald,rich,rich_tb}] [--metrics-address METRICS_ADDRESS]
[--metrics-port METRICS_PORT] [--metrics-disable-compression] --cgroups-path CGROUPS_PATH [CGROUPS_PATH ...] [--cgroups-root CGROUPS_ROOT] [--collector-interval COLLECTOR_INTERVAL]
[--collector-delay COLLECTOR_DELAY] [--collector-workers COLLECTOR_WORKERS] [--profiler-enable] [--profiler-top-results PROFILER_TOP_RESULTS] [--profiler-interval PROFILER_INTERVAL] [--memory-tracer-enable]
[--memory-tracer-top-results MEMORY_TRACER_TOP_RESULTS] [--memory-tracer-interval MEMORY_TRACER_INTERVAL]
croups exporter
options:
-h, --help show this help message and exit
-s POOL_SIZE Thread pool size (default: 4) [ENV: CGROUPS_EXPORTER_POOL_SIZE]
-u USER Change process UID [ENV: CGROUPS_EXPORTER_USER]
--log-level {critical,error,warning,info,debug,notset}
(default: info) [ENV: CGROUPS_EXPORTER_LOG_LEVEL]
--log-format {stream,color,json,syslog,plain,journald,rich,rich_tb}
(default: color) [ENV: CGROUPS_EXPORTER_LOG_FORMAT]
Metrics options:
--metrics-address METRICS_ADDRESS
(default: ::) [ENV: CGROUPS_EXPORTER_METRICS_ADDRESS]
--metrics-port METRICS_PORT
(default: 9753) [ENV: CGROUPS_EXPORTER_METRICS_PORT]
--metrics-disable-compression
[ENV: CGROUPS_EXPORTER_METRICS_DISABLE_COMPRESSION]
CGroups options:
--cgroups-path CGROUPS_PATH [CGROUPS_PATH ...]
[ENV: CGROUPS_EXPORTER_CGROUPS_PATH]
--cgroups-root CGROUPS_ROOT
(default: /sys/fs/cgroup) [ENV: CGROUPS_EXPORTER_CGROUPS_ROOT]
Collector options:
--collector-interval COLLECTOR_INTERVAL
(default: 15) [ENV: CGROUPS_EXPORTER_COLLECTOR_INTERVAL]
--collector-delay COLLECTOR_DELAY
(default: 4) [ENV: CGROUPS_EXPORTER_COLLECTOR_DELAY]
--collector-workers COLLECTOR_WORKERS
(default: 4) [ENV: CGROUPS_EXPORTER_COLLECTOR_WORKERS]
Profiler options:
--profiler-enable [ENV: CGROUPS_EXPORTER_PROFILER_ENABLE]
--profiler-top-results PROFILER_TOP_RESULTS
(default: 20) [ENV: CGROUPS_EXPORTER_PROFILER_TOP_RESULTS]
--profiler-interval PROFILER_INTERVAL
(default: 5) [ENV: CGROUPS_EXPORTER_PROFILER_INTERVAL]
Memory Tracer options:
--memory-tracer-enable
[ENV: CGROUPS_EXPORTER_MEMORY_TRACER_ENABLE]
--memory-tracer-top-results MEMORY_TRACER_TOP_RESULTS
(default: 20) [ENV: CGROUPS_EXPORTER_MEMORY_TRACER_TOP_RESULTS]
--memory-tracer-interval MEMORY_TRACER_INTERVAL
(default: 5) [ENV: CGROUPS_EXPORTER_MEMORY_TRACER_INTERVAL]
Default values will based on following configuration files ['cgroups-exporter.conf', '~/.cgroups-exporter.conf', '/etc/cgroups-exporter.conf']. The configuration files is INI-formatted files where configuration groups is INI
sections.See more https://pypi.ac.cn/project/argclass/#configs
容器使用
cgroups-exporter
也可用作容器镜像,可在 Docker、Kubernetes 或其他运行时中使用。它期望容器中挂载主机 /sys
目录(只读)。
Docker 使用示例
docker run -p 9753:9753 -v /sys/:/host_sys/ ghcr.io/mosquito/cgroups-exporter:latest cgroups-exporter --cgroups-path "/host_sys/fs/cgroup/*/docker/*"
指标
名称 | 描述 |
---|---|
cgroups_blkio_bfq_service_bytes_async |
BlockIO 服务字节数(来自 'blkio.bfq.io_service_bytes' 文件的 'async' 字段) |
cgroups_blkio_bfq_service_bytes_discard |
BlockIO 服务字节数(来自 'blkio.bfq.io_service_bytes' 文件的 'discard' 字段) |
cgroups_blkio_bfq_service_bytes_read |
BlockIO 服务字节数(来自 'blkio.bfq.io_service_bytes' 文件的 'read' 字段) |
cgroups_blkio_bfq_service_bytes_recursive_async |
BlockIO 递归服务字节数(来自 'blkio.bfq.io_service_bytes_recursive' 文件的 'async' 字段) |
cgroups_blkio_bfq_service_bytes_recursive_discard |
BlockIO 递归服务字节数(来自 'blkio.bfq.io_service_bytes_recursive' 文件的 'discard' 字段) |
cgroups_blkio_bfq_service_bytes_recursive_read |
BlockIO 递归服务字节数(来自 'blkio.bfq.io_service_bytes_recursive' 文件的 'read' 字段) |
cgroups_blkio_bfq_service_bytes_recursive_sync |
BlockIO 递归服务字节数(来自 'blkio.bfq.io_service_bytes_recursive' 文件的 'sync' 字段) |
cgroups_blkio_bfq_service_bytes_recursive_total |
BlockIO 递归服务字节数(来自 'blkio.bfq.io_service_bytes_recursive' 文件的 'total' 字段) |
cgroups_blkio_bfq_service_bytes_recursive_write |
BlockIO 递归服务字节数(来自 'blkio.bfq.io_service_bytes_recursive' 文件的 'write' 字段) |
cgroups_blkio_bfq_service_bytes_sync |
BlockIO 服务字节数(来自 'blkio.bfq.io_service_bytes' 文件的 'sync' 字段) |
cgroups_blkio_bfq_service_bytes_total |
BlockIO 服务字节数(来自 'blkio.bfq.io_service_bytes' 文件的 'total' 字段) |
cgroups_blkio_bfq_service_bytes_write |
BlockIO 服务字节数(来自 'blkio.bfq.io_service_bytes' 文件的 'write' 字段) |
cgroups_blkio_bfq_serviced_async |
BlockIO 服务字节数(来自 'blkio.bfq.io_serviced' 文件的 'async' 字段) |
cgroups_blkio_bfq_serviced_discard |
BlockIO 服务字节数(来自 'blkio.bfq.io_serviced' 文件的 'discard' 字段) |
cgroups_blkio_bfq_serviced_read |
BlockIO 服务字节数(来自 'blkio.bfq.io_serviced' 文件的 'read' 字段) |
cgroups_blkio_bfq_serviced_recursive_async |
BlockIO 递归服务字节数(来自 'blkio.bfq.io_serviced_recursive' 文件的 'async' 字段) |
cgroups_blkio_bfq_serviced_recursive_discard |
BlockIO 递归服务字节数(来自 'blkio.bfq.io_serviced_recursive' 文件的 'discard' 字段) |
cgroups_blkio_bfq_serviced_recursive_read |
BlockIO 递归服务字节数(来自 'blkio.bfq.io_serviced_recursive' 文件的 'read' 字段) |
cgroups_blkio_bfq_serviced_recursive_sync |
BlockIO 递归服务字节数(来自 'blkio.bfq.io_serviced_recursive' 文件的 'sync' 字段) |
cgroups_blkio_bfq_serviced_recursive_total |
BlockIO 递归服务字节数(来自 'blkio.bfq.io_serviced_recursive' 文件的 'total' 字段) |
cgroups_blkio_bfq_serviced_recursive_write |
BlockIO 递归服务字节数(来自 'blkio.bfq.io_serviced_recursive' 文件的 'write' 字段) |
cgroups_blkio_bfq_serviced_sync |
BlockIO 服务字节数(来自 'blkio.bfq.io_serviced' 文件的 'sync' 字段) |
cgroups_blkio_bfq_serviced_total |
BlockIO 服务字节数(来自 'blkio.bfq.io_serviced' 文件的 'total' 字段) |
cgroups_blkio_bfq_serviced_write |
BlockIO 服务字节数(来自 'blkio.bfq.io_serviced' 文件的 'write' 字段) |
cgroups_blkio_throttle_service_bytes_async |
BlockIO 服务字节数(来自 'blkio.throttle.io_service_bytes' 文件的 'async' 字段) |
cgroups_blkio_throttle_service_bytes_discard |
BlockIO 服务字节数(来自 'blkio.throttle.io_service_bytes' 文件的 'discard' 字段) |
cgroups_blkio_throttle_service_bytes_read |
BlockIO 服务字节数(来自 'blkio.throttle.io_service_bytes' 文件的 'read' 字段) |
cgroups_blkio_throttle_service_bytes_recursive_async |
BlockIO 节流服务字节数(来自 'blkio.throttle.io_service_bytes_recursive' 文件的 'async' 字段) |
cgroups_blkio_throttle_service_bytes_recursive_discard |
BlockIO 节流服务字节数(来自 'blkio.throttle.io_service_bytes_recursive' 文件的 'discard' 字段) |
cgroups_blkio_throttle_service_bytes_recursive_read |
BlockIO 节流服务字节数(来自 'blkio.throttle.io_service_bytes_recursive' 文件的 'read' 字段) |
cgroups_blkio_throttle_service_bytes_recursive_sync |
BlockIO 节流服务字节数(来自 'blkio.throttle.io_service_bytes_recursive' 文件的 'sync' 字段) |
cgroups_blkio_throttle_service_bytes_recursive_total |
BlockIO 节流服务字节数(来自 'blkio.throttle.io_service_bytes_recursive' 文件的 'total' 字段) |
cgroups_blkio_throttle_service_bytes_recursive_write |
BlockIO 节流服务字节数(来自 'blkio.throttle.io_service_bytes_recursive' 文件的 'write' 字段) |
控制组块IO节流服务字节数同步 |
块IO服务字节数(来自'blkio.throttle.io_service_bytes'文件的'sync'字段) |
控制组块IO节流服务字节数总计 |
块IO服务字节数(来自'blkio.throttle.io_service_bytes'文件的'total'字段) |
控制组块IO节流服务字节数写入 |
块IO服务字节数(来自'blkio.throttle.io_service_bytes'文件的'write'字段) |
控制组块IO节流服务异步 |
块IO已服务字节数(来自'blkio.throttle.io_serviced'文件的'async'字段) |
控制组块IO节流服务丢弃 |
块IO已服务字节数(来自'blkio.throttle.io_serviced'文件的'discard'字段) |
控制组块IO节流服务读取 |
块IO已服务字节数(来自'blkio.throttle.io_serviced'文件的'read'字段) |
控制组块IO节流服务递归异步 |
块IO递归已服务字节数(来自'blkio.throttle.io_serviced_recursive'文件的'async'字段) |
控制组块IO节流服务递归丢弃 |
块IO递归已服务字节数(来自'blkio.throttle.io_serviced_recursive'文件的'discard'字段) |
控制组块IO节流服务递归读取 |
块IO递归已服务字节数(来自'blkio.throttle.io_serviced_recursive'文件的'read'字段) |
控制组块IO节流服务递归同步 |
块IO递归已服务字节数(来自'blkio.throttle.io_serviced_recursive'文件的'sync'字段) |
控制组块IO节流服务递归总计 |
块IO递归已服务字节数(来自'blkio.throttle.io_serviced_recursive'文件的'total'字段) |
控制组块IO节流服务递归写入 |
块IO递归已服务字节数(来自'blkio.throttle.io_serviced_recursive'文件的'write'字段) |
控制组块IO节流服务同步 |
块IO已服务字节数(来自'blkio.throttle.io_serviced'文件的'sync'字段) |
控制组块IO节流服务总计 |
块IO已服务字节数(来自'blkio.throttle.io_serviced'文件的'total'字段) |
控制组块IO节流服务写入 |
块IO已服务字节数(来自'blkio.throttle.io_serviced'文件的'write'字段) |
控制组CPU-cpuacct-cfs周期微秒 |
允许的CPU周期(微秒) |
控制组CPU-cpuacct-cfs配额微秒 |
允许的CPU配额(微秒) |
控制组CPU-cpuacct份额 |
允许的CPU份额 |
控制组CPU-cpuacct统计nr_periods |
CPU统计(来自'cpu.stat'文件的'nr_periods'字段) |
控制组CPU-cpuacct统计nr_throttled |
CPU统计(来自'cpu.stat'文件的'nr_throttled'字段) |
控制组CPU-cpuacct统计系统 |
CPU会计统计(来自'cpuacct.stat'文件的'system'字段) |
控制组CPU-cpuacct统计节流时间 |
CPU统计(来自'cpu.stat'文件的'throttled_time'字段) |
控制组CPU-cpuacct统计用户 |
CPU会计统计(来自'cpuacct.stat'文件的'user'字段) |
控制组CPU压力某些平均10秒 |
CPU资源压力。每10秒平均 |
控制组CPU压力某些平均300秒 |
CPU资源压力。每300秒平均 |
控制组CPU压力某些平均60秒 |
CPU资源压力。每60秒平均 |
控制组CPU压力某些总计 |
CPU资源压力总计 |
控制组cpuset_count_cpu |
cgroup的CPU集 |
控制组exporter_calls_collector_created |
导出收集器运行计数器 |
控制组exporter_calls_collector_total |
导出收集器运行计数器 |
控制组exporter_collect_time_collector_created |
导出收集器执行时间 |
控制组exporter_collect_time_collector |
导出收集器执行时间 |
控制组io_pressure_full_avg10 |
IO资源压力。每10秒平均 |
控制组io_pressure_full_avg300 |
IO资源压力。每300秒平均 |
控制组io_pressure_full_avg60 |
IO资源压力。每60秒平均 |
控制组io_pressure_full_total |
IO资源压力总计 |
控制组io_pressure_some_avg10 |
IO资源压力。每10秒平均 |
控制组io_pressure_some_avg300 |
IO资源压力。每300秒平均 |
控制组io_pressure_some_avg60 |
IO资源压力。每60秒平均 |
控制组io_pressure_some_total |
IO资源压力总计 |
控制组内存限制kmem_tcp |
内核TCP内存限制 |
控制组内存限制kmem |
内存内核限制 |
控制组内存限制软 |
软限制 |
控制组内存限制交换 |
交换限制 |
控制组内存限制 |
内存限制 |
控制组内存压力_full_avg10 |
内存资源压力。每10秒平均 |
控制组内存压力_full_avg300 |
内存资源压力。每300秒平均 |
控制组内存压力_full_avg60 |
内存资源压力。每60秒平均 |
控制组内存压力_full_total |
内存资源压力总计 |
控制组内存压力_some_avg10 |
内存资源压力。每10秒平均 |
控制组内存压力_some_avg300 |
内存资源压力。每300秒平均 |
控制组内存压力_some_avg60 |
内存资源压力。每60秒平均 |
控制组内存压力_some_total |
内存资源压力总计 |
控制组内存统计_active_anon |
内存统计(来自'memory.stat'文件的'active_anon'字段) |
内存组统计:cgroups_memory_stat_active_file |
内存统计('memory.stat'文件中的'active_file'字段) |
内存组统计:cgroups_memory_stat_cache |
内存统计('memory.stat'文件中的'cache'字段) |
内存组统计:cgroups_memory_stat_dirty |
内存统计('memory.stat'文件中的'dirty'字段) |
内存组统计:cgroups_memory_stat_hierarchical_memory_limit |
内存统计('memory.stat'文件中的'hierarchical_memory_limit'字段) |
内存组统计:cgroups_memory_stat_hierarchical_memsw_limit |
内存统计('memory.stat'文件中的'hierarchical_memsw_limit'字段) |
内存组统计:cgroups_memory_stat_inactive_anon |
内存统计('memory.stat'文件中的'inactive_anon'字段) |
内存组统计:cgroups_memory_stat_inactive_file |
内存统计('memory.stat'文件中的'inactive_file'字段) |
内存组统计:cgroups_memory_stat_mapped_file |
内存统计('memory.stat'文件中的'mapped_file'字段) |
内存组统计:cgroups_memory_stat_pgfault |
内存统计('memory.stat'文件中的'pgfault'字段) |
内存组统计:cgroups_memory_stat_pgmajfault |
内存统计('memory.stat'文件中的'pgmajfault'字段) |
内存组统计:cgroups_memory_stat_pgpgin |
内存统计('memory.stat'文件中的'pgpgin'字段) |
内存组统计:cgroups_memory_stat_pgpgout |
内存统计('memory.stat'文件中的'pgpgout'字段) |
内存组统计:cgroups_memory_stat_rss_huge |
内存统计('memory.stat'文件中的'rss_huge'字段) |
内存组统计:cgroups_memory_stat_rss |
内存统计('memory.stat'文件中的'rss'字段) |
内存组统计:cgroups_memory_stat_shmem |
内存统计('memory.stat'文件中的'shmem'字段) |
内存组统计:cgroups_memory_stat_swap |
内存统计('memory.stat'文件中的'swap'字段) |
内存组统计:cgroups_memory_stat_total_active_anon |
内存统计('memory.stat'文件中的'total_active_anon'字段) |
内存组统计:cgroups_memory_stat_total_active_file |
内存统计('memory.stat'文件中的'total_active_file'字段) |
内存组统计:cgroups_memory_stat_total_cache |
内存统计('memory.stat'文件中的'total_cache'字段) |
内存组统计:cgroups_memory_stat_total_dirty |
内存统计('memory.stat'文件中的'total_dirty'字段) |
内存组统计:cgroups_memory_stat_total_inactive_anon |
内存统计('memory.stat'文件中的'total_inactive_anon'字段) |
内存组统计:cgroups_memory_stat_total_inactive_file |
内存统计('memory.stat'文件中的'total_inactive_file'字段) |
内存组统计:cgroups_memory_stat_total_mapped_file |
内存统计('memory.stat'文件中的'total_mapped_file'字段) |
内存组统计:cgroups_memory_stat_total_pgfault |
内存统计('memory.stat'文件中的'total_pgfault'字段) |
内存组统计:cgroups_memory_stat_total_pgmajfault |
内存统计('memory.stat'文件中的'total_pgmajfault'字段) |
内存组统计:cgroups_memory_stat_total_pgpgin |
内存统计('memory.stat'文件中的'total_pgpgin'字段) |
内存组统计:cgroups_memory_stat_total_pgpgout |
内存统计('memory.stat'文件中的'total_pgpgout'字段) |
内存组统计:cgroups_memory_stat_total_rss_huge |
内存统计('memory.stat'文件中的'total_rss_huge'字段) |
内存组统计:cgroups_memory_stat_total_rss |
内存统计('memory.stat'文件中的'total_rss'字段) |
内存组统计:cgroups_memory_stat_total_shmem |
内存统计('memory.stat'文件中的'total_shmem'字段) |
内存组统计:cgroups_memory_stat_total_swap |
内存统计('memory.stat'文件中的'total_swap'字段) |
内存组统计:cgroups_memory_stat_total_unevictable |
内存统计('memory.stat'文件中的'total_unevictable'字段) |
内存组统计:cgroups_memory_stat_total_writeback |
内存统计('memory.stat'文件中的'total_writeback'字段) |
内存组统计:cgroups_memory_stat_unevictable |
内存统计('memory.stat'文件中的'unevictable'字段) |
内存组统计:cgroups_memory_stat_writeback |
内存统计('memory.stat'文件中的'writeback'字段) |
内存组统计:cgroups_memory_usage_kmem_max |
最大内核内存使用量 |
内存组统计:cgroups_memory_usage_kmem_tcp |
内核TCP内存使用量 |
内存组统计:cgroups_memory_usage_kmem |
最大内核TCP最大内存使用量 |
内存组统计:cgroups_memory_usage_max |
最大内存使用量 |
内存组统计:cgroups_memory_usage_swap_max |
最大交换空间使用量 |
内存组统计:cgroups_memory_usage_swap |
交换空间使用量 |
内存组统计:cgroups_memory_usage |
内存使用量 |
内存组统计:cgroups_pids_count |
该命名空间下的进程ID数量 |
内存组统计:cgroups_pids_max |
该命名空间允许的最大进程ID数量 |
内存组统计:cgroups_unified_stat_system_usec |
CPU统计('cpu.stat'文件中的'system_usec'字段) |
内存组统计:cgroups_unified_stat_usage_usec |
CPU统计('cpu.stat'文件中的'usage_usec'字段) |
内存组统计:cgroups_unified_stat_user_usec |
CPU统计('cpu.stat'文件中的'user_usec'字段) |
内存组统计:cgroups_unified_uptime |
init.scope运行时间 |
项目详情
下载文件
下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。
源分布
cgroups_exporter-0.8.8.tar.gz (18.4 kB 查看哈希值)
构建分布
cgroups_exporter-0.8.8-py3-none-any.whl (21.1 kB 查看哈希值)
关闭
cgroups_exporter-0.8.8.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | b2dadd7afb7d4bb77aa70b30be7bbc810dd83a61ceabbc2f14b8b068600473f2 |
|
MD5 | 5c046198e5e40bf2ebffa900464a8adc |
|
BLAKE2b-256 | a2de14b2b0eae6f35cba5d6563410fdc70d68a16061169170135a12b20f7a805 |
关闭
cgroups_exporter-0.8.8-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 17ac6c7d3815d2218e8c6c2f1ccff4507f4413fcbf98bf3a6ac69b60ea7d5aa5 |
|
MD5 | 060a3047c3500a3b9adc90099f0eace6 |
|
BLAKE2b-256 | 7da7b9be66842d3f6f122afe9b2127d1df9d57f1890356ae9b6738ab401abc16 |