Package: cgroups-exporter
CGroups exporterExporter for CGroups metrics, for LXD/Docker/systemd.Collects metrics for all cgroups based containers or SystemD services
on the host machine, without the need to install separate exporters
inside each container.Installationpipinstallcgroups-exporterExampleA simple example collects all available metrics for LXD containers.cgroups-exporter--cgroups-path"/sys/fs/cgroup/*/lxc.payload.*"You can pass several path templates, then metrics will be collected from everyone.In the example below, metrics will be collected for:All LXD containersAll SystemD services running inside the LXD containersAll Docker containers inside the LXD containers.All user slices (when used entering through the ssh the
SystemD creates the slice named by templateuser-$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/*"UsageArgs that start with--(eg. -s) can also be set in a config file
(~/.cgroups-exporter.confor/etc/cgroups-exporter.conf).Config file syntax allows:key=value,flag=true,stuff=[a,b,c](for details, see syntaxhere).If an arg is specified in more than one place, then commandline values
override environment variables which override config file values
which override defaults.Environment variableCGROUPS_EXPORTER_CONFIGoverwrites config file location.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.org/project/argclass/#configsContainer Usagecgroups-exporteris also available as a container image to be used in Docker, Kubernetes or other runtimes. It expects the host/sysdirectory to be mounted in the container (read only).Docker usage example:dockerrun-p9753:9753-v/sys/:/host_sys/ghcr.io/mosquito/cgroups-exporter:latestcgroups-exporter--cgroups-path"/host_sys/fs/cgroup/*/docker/*"MetricsNameDescriptioncgroups_blkio_bfq_service_bytes_asyncBlockIO service bytes ('async' field from 'blkio.bfq.io_service_bytes' file)cgroups_blkio_bfq_service_bytes_discardBlockIO service bytes ('discard' field from 'blkio.bfq.io_service_bytes' file)cgroups_blkio_bfq_service_bytes_readBlockIO service bytes ('read' field from 'blkio.bfq.io_service_bytes' file)cgroups_blkio_bfq_service_bytes_recursive_asyncBlockIO service bytes recursive ('async' field from 'blkio.bfq.io_service_bytes_recursive' file)cgroups_blkio_bfq_service_bytes_recursive_discardBlockIO service bytes recursive ('discard' field from 'blkio.bfq.io_service_bytes_recursive' file)cgroups_blkio_bfq_service_bytes_recursive_readBlockIO service bytes recursive ('read' field from 'blkio.bfq.io_service_bytes_recursive' file)cgroups_blkio_bfq_service_bytes_recursive_syncBlockIO service bytes recursive ('sync' field from 'blkio.bfq.io_service_bytes_recursive' file)cgroups_blkio_bfq_service_bytes_recursive_totalBlockIO service bytes recursive ('total' field from 'blkio.bfq.io_service_bytes_recursive' file)cgroups_blkio_bfq_service_bytes_recursive_writeBlockIO service bytes recursive ('write' field from 'blkio.bfq.io_service_bytes_recursive' file)cgroups_blkio_bfq_service_bytes_syncBlockIO service bytes ('sync' field from 'blkio.bfq.io_service_bytes' file)cgroups_blkio_bfq_service_bytes_totalBlockIO service bytes ('total' field from 'blkio.bfq.io_service_bytes' file)cgroups_blkio_bfq_service_bytes_writeBlockIO service bytes ('write' field from 'blkio.bfq.io_service_bytes' file)cgroups_blkio_bfq_serviced_asyncBlockIO serviced bytes ('async' field from 'blkio.bfq.io_serviced' file)cgroups_blkio_bfq_serviced_discardBlockIO serviced bytes ('discard' field from 'blkio.bfq.io_serviced' file)cgroups_blkio_bfq_serviced_readBlockIO serviced bytes ('read' field from 'blkio.bfq.io_serviced' file)cgroups_blkio_bfq_serviced_recursive_asyncBlockIO serviced bytes recursive ('async' field from 'blkio.bfq.io_serviced_recursive' file)cgroups_blkio_bfq_serviced_recursive_discardBlockIO serviced bytes recursive ('discard' field from 'blkio.bfq.io_serviced_recursive' file)cgroups_blkio_bfq_serviced_recursive_readBlockIO serviced bytes recursive ('read' field from 'blkio.bfq.io_serviced_recursive' file)cgroups_blkio_bfq_serviced_recursive_syncBlockIO serviced bytes recursive ('sync' field from 'blkio.bfq.io_serviced_recursive' file)cgroups_blkio_bfq_serviced_recursive_totalBlockIO serviced bytes recursive ('total' field from 'blkio.bfq.io_serviced_recursive' file)cgroups_blkio_bfq_serviced_recursive_writeBlockIO serviced bytes recursive ('write' field from 'blkio.bfq.io_serviced_recursive' file)cgroups_blkio_bfq_serviced_syncBlockIO serviced bytes ('sync' field from 'blkio.bfq.io_serviced' file)cgroups_blkio_bfq_serviced_totalBlockIO serviced bytes ('total' field from 'blkio.bfq.io_serviced' file)cgroups_blkio_bfq_serviced_writeBlockIO serviced bytes ('write' field from 'blkio.bfq.io_serviced' file)cgroups_blkio_throttle_service_bytes_asyncBlockIO service bytes ('async' field from 'blkio.throttle.io_service_bytes' file)cgroups_blkio_throttle_service_bytes_discardBlockIO service bytes ('discard' field from 'blkio.throttle.io_service_bytes' file)cgroups_blkio_throttle_service_bytes_readBlockIO service bytes ('read' field from 'blkio.throttle.io_service_bytes' file)cgroups_blkio_throttle_service_bytes_recursive_asyncBlockIO throttle serviced bytes ('async' field from 'blkio.throttle.io_service_bytes_recursive' file)cgroups_blkio_throttle_service_bytes_recursive_discardBlockIO throttle serviced bytes ('discard' field from 'blkio.throttle.io_service_bytes_recursive' file)cgroups_blkio_throttle_service_bytes_recursive_readBlockIO throttle serviced bytes ('read' field from 'blkio.throttle.io_service_bytes_recursive' file)cgroups_blkio_throttle_service_bytes_recursive_syncBlockIO throttle serviced bytes ('sync' field from 'blkio.throttle.io_service_bytes_recursive' file)cgroups_blkio_throttle_service_bytes_recursive_totalBlockIO throttle serviced bytes ('total' field from 'blkio.throttle.io_service_bytes_recursive' file)cgroups_blkio_throttle_service_bytes_recursive_writeBlockIO throttle serviced bytes ('write' field from 'blkio.throttle.io_service_bytes_recursive' file)cgroups_blkio_throttle_service_bytes_syncBlockIO service bytes ('sync' field from 'blkio.throttle.io_service_bytes' file)cgroups_blkio_throttle_service_bytes_totalBlockIO service bytes ('total' field from 'blkio.throttle.io_service_bytes' file)cgroups_blkio_throttle_service_bytes_writeBlockIO service bytes ('write' field from 'blkio.throttle.io_service_bytes' file)cgroups_blkio_throttle_serviced_asyncBlockIO serviced bytes ('async' field from 'blkio.throttle.io_serviced' file)cgroups_blkio_throttle_serviced_discardBlockIO serviced bytes ('discard' field from 'blkio.throttle.io_serviced' file)cgroups_blkio_throttle_serviced_readBlockIO serviced bytes ('read' field from 'blkio.throttle.io_serviced' file)cgroups_blkio_throttle_serviced_recursive_asyncBlockIO serviced bytes recursive ('async' field from 'blkio.throttle.io_serviced_recursive' file)cgroups_blkio_throttle_serviced_recursive_discardBlockIO serviced bytes recursive ('discard' field from 'blkio.throttle.io_serviced_recursive' file)cgroups_blkio_throttle_serviced_recursive_readBlockIO serviced bytes recursive ('read' field from 'blkio.throttle.io_serviced_recursive' file)cgroups_blkio_throttle_serviced_recursive_syncBlockIO serviced bytes recursive ('sync' field from 'blkio.throttle.io_serviced_recursive' file)cgroups_blkio_throttle_serviced_recursive_totalBlockIO serviced bytes recursive ('total' field from 'blkio.throttle.io_serviced_recursive' file)cgroups_blkio_throttle_serviced_recursive_writeBlockIO serviced bytes recursive ('write' field from 'blkio.throttle.io_serviced_recursive' file)cgroups_blkio_throttle_serviced_syncBlockIO serviced bytes ('sync' field from 'blkio.throttle.io_serviced' file)cgroups_blkio_throttle_serviced_totalBlockIO serviced bytes ('total' field from 'blkio.throttle.io_serviced' file)cgroups_blkio_throttle_serviced_writeBlockIO serviced bytes ('write' field from 'blkio.throttle.io_serviced' file)cgroups_cpu_cpuacct_cfs_period_usAllowed CPU periods in microsecondscgroups_cpu_cpuacct_cfs_quota_usAllowed CPU quota in microsecondscgroups_cpu_cpuacct_sharesAllowed CPU sharescgroups_cpu_cpuacct_stat_nr_periodsCPU statistic ('nr_periods' field from 'cpu.stat' file)cgroups_cpu_cpuacct_stat_nr_throttledCPU statistic ('nr_throttled' field from 'cpu.stat' file)cgroups_cpu_cpuacct_stat_systemCPU accounting statistic ('system' field from 'cpuacct.stat' file)cgroups_cpu_cpuacct_stat_throttled_timeCPU statistic ('throttled_time' field from 'cpu.stat' file)cgroups_cpu_cpuacct_stat_userCPU accounting statistic ('user' field from 'cpuacct.stat' file)cgroups_cpu_pressure_some_avg10CPU resource pressure. Average by 10 secondscgroups_cpu_pressure_some_avg300CPU resource pressure. Average by 300 secondscgroups_cpu_pressure_some_avg60CPU resource pressure. Average by 60 secondscgroups_cpu_pressure_some_totalCPU resource pressure totalcgroups_cpuset_count_cpuCPU set for the cgroupcgroups_exporter_calls_collector_createdExporter collector run countercgroups_exporter_calls_collector_totalExporter collector run countercgroups_exporter_collect_time_collector_createdExporter collector execution timecgroups_exporter_collect_time_collectorExporter collector execution timecgroups_io_pressure_full_avg10IO resource pressure. Average by 10 secondscgroups_io_pressure_full_avg300IO resource pressure. Average by 300 secondscgroups_io_pressure_full_avg60IO resource pressure. Average by 60 secondscgroups_io_pressure_full_totalIO resource pressure totalcgroups_io_pressure_some_avg10IO resource pressure. Average by 10 secondscgroups_io_pressure_some_avg300IO resource pressure. Average by 300 secondscgroups_io_pressure_some_avg60IO resource pressure. Average by 60 secondscgroups_io_pressure_some_totalIO resource pressure totalcgroups_memory_limit_kmem_tcpKernel TCP memory limitcgroups_memory_limit_kmemMemory kernel limitcgroups_memory_limit_softSoft limitcgroups_memory_limit_swapSwap limitcgroups_memory_limitMemory limitcgroups_memory_pressure_full_avg10Memory resource pressure. Average by 10 secondscgroups_memory_pressure_full_avg300Memory resource pressure. Average by 300 secondscgroups_memory_pressure_full_avg60Memory resource pressure. Average by 60 secondscgroups_memory_pressure_full_totalMemory resource pressure totalcgroups_memory_pressure_some_avg10Memory resource pressure. Average by 10 secondscgroups_memory_pressure_some_avg300Memory resource pressure. Average by 300 secondscgroups_memory_pressure_some_avg60Memory resource pressure. Average by 60 secondscgroups_memory_pressure_some_totalMemory resource pressure totalcgroups_memory_stat_active_anonmemory statistic ('active_anon' field from 'memory.stat' file)cgroups_memory_stat_active_filememory statistic ('active_file' field from 'memory.stat' file)cgroups_memory_stat_cachememory statistic ('cache' field from 'memory.stat' file)cgroups_memory_stat_dirtymemory statistic ('dirty' field from 'memory.stat' file)cgroups_memory_stat_hierarchical_memory_limitmemory statistic ('hierarchical_memory_limit' field from 'memory.stat' file)cgroups_memory_stat_hierarchical_memsw_limitmemory statistic ('hierarchical_memsw_limit' field from 'memory.stat' file)cgroups_memory_stat_inactive_anonmemory statistic ('inactive_anon' field from 'memory.stat' file)cgroups_memory_stat_inactive_filememory statistic ('inactive_file' field from 'memory.stat' file)cgroups_memory_stat_mapped_filememory statistic ('mapped_file' field from 'memory.stat' file)cgroups_memory_stat_pgfaultmemory statistic ('pgfault' field from 'memory.stat' file)cgroups_memory_stat_pgmajfaultmemory statistic ('pgmajfault' field from 'memory.stat' file)cgroups_memory_stat_pgpginmemory statistic ('pgpgin' field from 'memory.stat' file)cgroups_memory_stat_pgpgoutmemory statistic ('pgpgout' field from 'memory.stat' file)cgroups_memory_stat_rss_hugememory statistic ('rss_huge' field from 'memory.stat' file)cgroups_memory_stat_rssmemory statistic ('rss' field from 'memory.stat' file)cgroups_memory_stat_shmemmemory statistic ('shmem' field from 'memory.stat' file)cgroups_memory_stat_swapmemory statistic ('swap' field from 'memory.stat' file)cgroups_memory_stat_total_active_anonmemory statistic ('total_active_anon' field from 'memory.stat' file)cgroups_memory_stat_total_active_filememory statistic ('total_active_file' field from 'memory.stat' file)cgroups_memory_stat_total_cachememory statistic ('total_cache' field from 'memory.stat' file)cgroups_memory_stat_total_dirtymemory statistic ('total_dirty' field from 'memory.stat' file)cgroups_memory_stat_total_inactive_anonmemory statistic ('total_inactive_anon' field from 'memory.stat' file)cgroups_memory_stat_total_inactive_filememory statistic ('total_inactive_file' field from 'memory.stat' file)cgroups_memory_stat_total_mapped_filememory statistic ('total_mapped_file' field from 'memory.stat' file)cgroups_memory_stat_total_pgfaultmemory statistic ('total_pgfault' field from 'memory.stat' file)cgroups_memory_stat_total_pgmajfaultmemory statistic ('total_pgmajfault' field from 'memory.stat' file)cgroups_memory_stat_total_pgpginmemory statistic ('total_pgpgin' field from 'memory.stat' file)cgroups_memory_stat_total_pgpgoutmemory statistic ('total_pgpgout' field from 'memory.stat' file)cgroups_memory_stat_total_rss_hugememory statistic ('total_rss_huge' field from 'memory.stat' file)cgroups_memory_stat_total_rssmemory statistic ('total_rss' field from 'memory.stat' file)cgroups_memory_stat_total_shmemmemory statistic ('total_shmem' field from 'memory.stat' file)cgroups_memory_stat_total_swapmemory statistic ('total_swap' field from 'memory.stat' file)cgroups_memory_stat_total_unevictablememory statistic ('total_unevictable' field from 'memory.stat' file)cgroups_memory_stat_total_writebackmemory statistic ('total_writeback' field from 'memory.stat' file)cgroups_memory_stat_unevictablememory statistic ('unevictable' field from 'memory.stat' file)cgroups_memory_stat_writebackmemory statistic ('writeback' field from 'memory.stat' file)cgroups_memory_usage_kmem_maxMaximum kernel memory usagecgroups_memory_usage_kmem_tcpKernel TCP memory usagecgroups_memory_usage_kmemMaximum kernel TCP maximum memory usagecgroups_memory_usage_maxMaximum memory usagecgroups_memory_usage_swap_maxMaximum swap usagecgroups_memory_usage_swapSwap usagecgroups_memory_usageMemory usagecgroups_pids_countProcess IDs count for this namespacecgroups_pids_maxMaximum Process IDs allowed for this namespacecgroups_unified_stat_system_usecCPU statistic ('system_usec' field from 'cpu.stat' file)cgroups_unified_stat_usage_usecCPU statistic ('usage_usec' field from 'cpu.stat' file)cgroups_unified_stat_user_usecCPU statistic ('user_usec' field from 'cpu.stat' file)cgroups_unified_uptimeinit.scope uptime