{"id":13716436,"url":"https://github.com/phpHavok/cgroups_exporter","last_synced_at":"2025-05-07T05:33:08.121Z","repository":{"id":57581210,"uuid":"360925126","full_name":"phpHavok/cgroups_exporter","owner":"phpHavok","description":"A Prometheus exporter for cgroup-level metrics.","archived":false,"fork":false,"pushed_at":"2021-07-02T15:05:49.000Z","size":38,"stargazers_count":4,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-04T00:12:11.056Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phpHavok.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-23T15:16:47.000Z","updated_at":"2023-10-12T14:56:09.000Z","dependencies_parsed_at":"2022-09-26T17:00:46.643Z","dependency_job_id":null,"html_url":"https://github.com/phpHavok/cgroups_exporter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpHavok%2Fcgroups_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpHavok%2Fcgroups_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpHavok%2Fcgroups_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpHavok%2Fcgroups_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpHavok","download_url":"https://codeload.github.com/phpHavok/cgroups_exporter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224567551,"owners_count":17332828,"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.473Z","updated_at":"2024-11-14T04:31:36.059Z","avatar_url":"https://github.com/phpHavok.png","language":"Go","funding_links":[],"categories":["Monitoring"],"sub_categories":["Prometheus Based"],"readme":"# cgroups_exporter\nA Prometheus exporter for cgroup-level metrics.\n\n## Compiling from Source\n\nThis project is written primarily in Go and requires Go v1.16 or later to\ncompile.\n\nTo build, you can just type `go build`, and Go will handle everything.\nAlternatively, if you have Make installed, you can just type `make`. Both of\nthese methods produce an executable binary called `cgroups_exporter`.\n\n## Usage\n\nTo view help, run `./cgroups_exporter -help`.\n\n```\n$ ./cgroups_exporter -help\nUsage of ./cgroups_exporter:\n  -cgroups-root string\n        path to the root of the cgroupsv1 hierarchy (default \"/sys/fs/cgroup\")\n  -file string\n        path to the cgroup specification file to use if method is file, ignored otherwise (default \"/proc/1/cgroup\")\n  -help\n        print usage\n  -method string\n        one of: file, slurm (default \"slurm\")\n  -port string\n        the port to listen on (default \"9821\")\n```\n\nThe `-cgroups-root` option allows you to change the default location of the\ncgroupsv1 hierarchy if it happens to be mounted somewhere unusual. This can also\nbe handy when using a container in case you want to mount the hierarchy in a\ndifferent location for the sake of the container.\n\nThe `-method` option specifies which cgroup hierarchies will be monitored.\nValid options are `file` and `slurm`. If set to `file`, the cgroups\nspecification file specified by the addtional `-file` option will be read and\nused to determine which cgroups to monitor. If set to `slurm`, the program\nwill monitor the node for any jobs running under the Slurm scheduler and\noutput labeled stastics for each job over time.\n\nThe `-file` option is only used if the `-method` is set to `file` and\nspecifies the path to the cgroups specification file which indiciates which\ncgroups will be used. These cgroup specification files have a structured\nformat and they're commonly found at `/proc/$$/cgroup` for some process ID\n`$$`. The cgroups specified in the specification file will be tracked by this\nexporter while all other cgroups will be ignored. If you want to track\ncgroups for two or more different processes, you should run two or more\ncopies of this exporter on different ports.\n\nThe `-port` option allows you to change the port that the Prometheus HTTP\nserver will listen on for requests. The default port is recommended unless\nyou need to run two or more copies of this exporter.\n\n## Docker\n\nA Docker container is provided for systems where that is more convenient (such\nas a Kubernetes cluster). You can build it manually using the provided\n`Dockerfile`, or just pull the pre-built copy from Docker Hub. Example usage\nfollows:\n\n```\ndocker run -t --rm \\\n    --mount type=bind,src=/sys/fs/cgroup,dst=/sys/fs/cgroup,readonly \\\n    phphavok/cgroups_exporter -method file -file /proc/31337/cgroup\n```\n\nWe specify `-t` so that we're allocated a pseudo-terminal which makes the\nlogging output look nice and formatted. The `--rm` option automatically\ncleans up the container on exit. The first mount command passes through the\ncgroupv1 hierarchy (/sys/fs/cgroup) on the parent system to the same location\nwithin the container. By default, Docker will often have some of the cgroup\nhierarchy present within the container, but not all of it. This application\nwill need to see the full hierarchy, so this read-only bind mount takes care\nof that. If you run into issues with mounting over the existing hierarchy\nwithin the container, you can change the target to some other location and\nthen pass the `-cgroup-root` option to the program to accommodate that\nchange. The entrypoint to the container is the program itself, so you can\njust pass its parameters to the run command.\n\n## Singularity\n\nYou can use Singularity (e.g., on an HPC cluster) to run the above Docker\ncontainer from Docker Hub. If using the `slurm` method, make sure **not** to\nhave Singularity create a PID namespace for the job (i.e., leave off the `-p`\noption), otherwise the container will be unable to properly detect Slurm jobs\nrunning outside the container.\n\n```\nsingularity run \\\n    -B /sys/fs/cgroup:/sys/fs/cgroup \\\n    -B `pwd`:/data \\\n    docker://phphavok/cgroups_exporter -method file -file /proc/31337/cgroup\n```\n\n## Grafana Dashboard\n\nA convenient Grafana dashboard is available [in this\nrepository](grafana/slurm_cgroups_dashboard.json), and is also published as\n[public dashboard 14587](https://grafana.com/grafana/dashboards/14587) for quick\ninstallation. The provided dashboard works for invocations of the\ncgroups\\_exporter that operate in `-method slurm` mode.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FphpHavok%2Fcgroups_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FphpHavok%2Fcgroups_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FphpHavok%2Fcgroups_exporter/lists"}