{"id":13716416,"url":"https://github.com/treydock/cgroup_exporter","last_synced_at":"2025-06-17T07:38:52.610Z","repository":{"id":43464797,"uuid":"240054093","full_name":"treydock/cgroup_exporter","owner":"treydock","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-30T14:09:32.000Z","size":181,"stargazers_count":23,"open_issues_count":1,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-23T03:04:17.845Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/treydock.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-12T16:00:14.000Z","updated_at":"2025-03-06T16:19:30.000Z","dependencies_parsed_at":"2024-05-17T14:30:32.090Z","dependency_job_id":"92ec11e0-e128-4c7f-8dc9-17b4c7bda544","html_url":"https://github.com/treydock/cgroup_exporter","commit_stats":{"total_commits":59,"total_committers":2,"mean_commits":29.5,"dds":0.03389830508474578,"last_synced_commit":"826c161de6bc86eb8279c59fde3c17ffdef2072c"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treydock%2Fcgroup_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treydock%2Fcgroup_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treydock%2Fcgroup_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treydock%2Fcgroup_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/treydock","download_url":"https://codeload.github.com/treydock/cgroup_exporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250360479,"owners_count":21417721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T00:01:10.291Z","updated_at":"2025-04-23T03:04:45.463Z","avatar_url":"https://github.com/treydock.png","language":"Go","funding_links":[],"categories":["Monitoring"],"sub_categories":["Prometheus Based"],"readme":"# cgroup Prometheus exporter\n\n[![Build Status](https://circleci.com/gh/treydock/cgroup_exporter/tree/master.svg?style=shield)](https://circleci.com/gh/treydock/cgroup_exporter)\n[![GitHub release](https://img.shields.io/github/v/release/treydock/cgroup_exporter?include_prereleases\u0026sort=semver)](https://github.com/treydock/cgroup_exporter/releases/latest)\n![GitHub All Releases](https://img.shields.io/github/downloads/treydock/cgroup_exporter/total)\n[![codecov](https://codecov.io/gh/treydock/cgroup_exporter/branch/master/graph/badge.svg)](https://codecov.io/gh/treydock/cgroup_exporter)\n\n# cgroup Prometheus exporter\n\nThe `cgroup_exporter` produces metrics from cgroups.\n\nThis exporter by default listens on port `9306` and all metrics are exposed via the `/metrics` endpoint.\n\n# Usage\n\nThe `--config.paths` flag is required and must point to paths of cgroups to monitor. If there is `/sys/fs/cgroup/cpuacct/user.slice` then the value for `--config.paths` would be `/user.slice`.\n\nThe path `/slurm` will work for both cgroupv1 and cgroupv2.  For cgroupv2 the `/slurm` path is turned into `/system.slice/slurmstepd.scope`.\n\nIf Slurm is compiled ot support multiple slurmd instances and you have paths that are `/sys/fs/cgroup/system.slice/\u003cnodename\u003e_slurmstepd.scope` then you must pass `--config.paths=/system.slice/\u003cnodename\u003e_slurmstepd.scope` and replace `\u003cnodename\u003e` with the host's slurmd NodeName.\n\n## Docker\n\nExample of running the Docker container\n\n```\ndocker run -d -p 9306:9306 -v \"/:/host:ro,rslave\" treydock/cgroup_exporter --path.cgroup.root=/host/sys/fs/cgroup\n```\n\n## Install\n\nDownload the [latest release](https://github.com/treydock/cgroup_exporter/releases)\n\n## Build from source\n\nTo produce the `cgroup_exporter` binaries:\n\n```\nmake build\n```\n\nOr\n\n```\ngo get github.com/treydock/cgroup_exporter\n```\n\n## Process metrics\n\nIf you wish to collect process information for a cgroup pass the `--collect.proc` flag. If this exporter is not running as root then it's required to set capabilities to ensure the user running this exporter can read everything under procfs:\n\n```\nsetcap cap_sys_ptrace=eip /usr/bin/cgroup_exporter\n```\n\n## Metrics\n\nExample of metrics exposed by this exporter when looking at `/user.slice` paths:\n\n```\ncgroup_cpu_system_seconds{cgroup=\"/user.slice/user-20821.slice\"} 1.96\ncgroup_cpu_total_seconds{cgroup=\"/user.slice/user-20821.slice\"} 3.817500568\ncgroup_cpu_user_seconds{cgroup=\"/user.slice/user-20821.slice\"} 1.61\ncgroup_cpus{cgroup=\"/user.slice/user-20821.slice\"} 0\ncgroup_cpu_info{cgroup=\"/user.slice/user-20821.slice\",cpus=\"\"} 1\ncgroup_info{cgroup=\"/user.slice/user-20821.slice\",uid=\"20821\",username=\"tdockendorf\",jobid=\"\"} 1\ncgroup_memory_cache_bytes{cgroup=\"/user.slice/user-20821.slice\"} 2.322432e+06\ncgroup_memory_fail_count{cgroup=\"/user.slice/user-20821.slice\"} 0\ncgroup_memory_rss_bytes{cgroup=\"/user.slice/user-20821.slice\"} 5.378048e+06\ncgroup_memory_total_bytes{cgroup=\"/user.slice/user-20821.slice\"} 6.8719476736e+10\ncgroup_memory_used_bytes{cgroup=\"/user.slice/user-20821.slice\"} 6.90176e+06\ncgroup_memsw_fail_count{cgroup=\"/user.slice/user-20821.slice\"} 0\ncgroup_memsw_total_bytes{cgroup=\"/user.slice/user-20821.slice\"} 9.223371968135295e+18\ncgroup_memsw_used_bytes{cgroup=\"/user.slice/user-20821.slice\"} 0\n```\n\nExample of metrics exposed by this exporter when looking at `/slurm` paths:\n\n```\ncgroup_cpu_system_seconds{cgroup=\"/slurm/uid_20821/job_12\"} 0\ncgroup_cpu_total_seconds{cgroup=\"/slurm/uid_20821/job_12\"} 0.007840451\ncgroup_cpu_user_seconds{cgroup=\"/slurm/uid_20821/job_12\"} 0\ncgroup_cpus{cgroup=\"/slurm/uid_20821/job_12\"} 2\ncgroup_cpu_info{cgroup=\"/slurm/uid_20821/job_12\",cpus=\"0,1\"} 1\ncgroup_info{cgroup=\"/slurm/uid_20821/job_12\",jobid=\"12\",uid=\"20821\",username=\"tdockendorf\"} 1\ncgroup_memory_cache_bytes{cgroup=\"/slurm/uid_20821/job_12\"} 4.096e+03\ncgroup_memory_fail_count{cgroup=\"/slurm/uid_20821/job_12\"} 0\ncgroup_memory_rss_bytes{cgroup=\"/slurm/uid_20821/job_12\"} 3.11296e+05\ncgroup_memory_total_bytes{cgroup=\"/slurm/uid_20821/job_12\"} 2.147483648e+09\ncgroup_memory_used_bytes{cgroup=\"/slurm/uid_20821/job_12\"} 315392\ncgroup_memsw_fail_count{cgroup=\"/slurm/uid_20821/job_12\"} 0\ncgroup_memsw_total_bytes{cgroup=\"/slurm/uid_20821/job_12\"} 2.147483648e+09\ncgroup_memsw_used_bytes{cgroup=\"/slurm/uid_20821/job_12\"} 315392\n```\n\nExample of metrics exposed by this exporter when looking at `/torque` paths:\n\n```\ncgroup_cpu_system_seconds{cgroup=\"/torque/1182958.batch.example.com\"} 26.35\ncgroup_cpu_total_seconds{cgroup=\"/torque/1182958.batch.example.com\"} 939.568245515\ncgroup_cpu_user_seconds{cgroup=\"/torque/1182958.batch.example.com\"} 915.61\ncgroup_cpus{cgroup=\"/torque/1182958.batch.example.com\"} 8\ncgroup_cpu_info{cgroup=\"/torque/1182958.batch.example.com\",cpus=\"0,1,2,3,4,5,6,7,8\"} 1\ncgroup_info{cgroup=\"/torque/1182958.batch.example.com\",jobid=\"1182958\",uid=\"\",username=\"\"} 1\ncgroup_memory_cache_bytes{cgroup=\"/torque/1182958.batch.example.com\"} 1.09678592e+08\ncgroup_memory_fail_count{cgroup=\"/torque/1182958.batch.example.com\"} 0\ncgroup_memory_rss_bytes{cgroup=\"/torque/1182958.batch.example.com\"} 8.2444320768e+10\ncgroup_memory_total_bytes{cgroup=\"/torque/1182958.batch.example.com\"} 1.96755132416e+11\ncgroup_memory_used_bytes{cgroup=\"/torque/1182958.batch.example.com\"} 5.3434466304e+10\ncgroup_memsw_fail_count{cgroup=\"/torque/1182958.batch.example.com\"} 0\ncgroup_memsw_total_bytes{cgroup=\"/torque/1182958.batch.example.com\"} 1.96755132416e+11\ncgroup_memsw_used_bytes{cgroup=\"/torque/1182958.batch.example.com\"} 5.3434466304e+10\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreydock%2Fcgroup_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftreydock%2Fcgroup_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreydock%2Fcgroup_exporter/lists"}