{"id":21479317,"url":"https://github.com/rycus86/container-metrics","last_synced_at":"2025-07-15T11:31:41.404Z","repository":{"id":57572168,"uuid":"128100404","full_name":"rycus86/container-metrics","owner":"rycus86","description":"Docker container statistics exporter","archived":false,"fork":false,"pushed_at":"2018-06-20T18:00:59.000Z","size":1101,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T03:24:03.277Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rycus86.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-04T17:58:37.000Z","updated_at":"2021-03-05T00:14:05.000Z","dependencies_parsed_at":"2022-08-24T03:11:11.565Z","dependency_job_id":null,"html_url":"https://github.com/rycus86/container-metrics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rycus86/container-metrics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rycus86%2Fcontainer-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rycus86%2Fcontainer-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rycus86%2Fcontainer-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rycus86%2Fcontainer-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rycus86","download_url":"https://codeload.github.com/rycus86/container-metrics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rycus86%2Fcontainer-metrics/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265431653,"owners_count":23764031,"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-11-23T11:24:36.766Z","updated_at":"2025-07-15T11:31:40.502Z","avatar_url":"https://github.com/rycus86.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple container metrics in Go\n\nCollect [Docker](https://www.docker.com/) container and daemon statistics with [Prometheus](https://prometheus.io/).\n\n## Motivation\n\nI'm running a [Home Lab](https://blog.viktoradam.net/tag/home-lab/) on resource constrained devices, and wanted a simple metrics collector with low CPU, memory and disk requirements as an alternative to (the otherwise fantastic) [Telegraf](https://github.com/influxdata/telegraf) collector.\n\nThe end result is a small static binary, packaged as a [Docker image](https://hub.docker.com/r/rycus86/container-metrics/), weighing only 3 MB (compressed).\n\n## Usage\n\nThe easiest way to get started is to use the Docker image available.\n\n```shell\n$ docker run -d --name container-metrics \\\n\t-p 8080:8080 \\\n\t-v /var/run/docker.sock:/var/run/docker.sock:ro \\\n\trycus86/container-metrics #[flags]\n```\n\nThe application accepts the following flags:\n\n- __-p__ or __-port__: HTTP port to listen on *(default: 8080)*\n- __-i__ or __-interval__: Interval for reading metrics from the engine *(default: 5s)*\n- __-t__ or __-timeout__: Timeout for calling endpoints on the engine *(default: 30s)*\n- __-l__ or __-labels__: Labels to keep (comma separated, accepts regex)\n- __-d__ or __-debug__: Enable debug messages\n- __-v__ or __-verbose__: Enable verbose messages - assumes debug\n\nYou can also build the application with Go, currently tested with version 1.10, then simply run it on the host:\n\n```shell\n$ ./container-metrics -p 8080 -i 15s -l com.docker.compose.service,com.mycompany.custom\n```\n\n## Metrics collected\n\nCurrently, the following *Gauge* metrics are exported.\n\n### Engine metrics\n\n- __cntm_engine_num_images__: Number of images\n- __cntm_engine_num_containers__: Number of containers\n- __cntm_engine_num_containers_running__: Number of running containers\n- __cntm_engine_num_containers_stopped__: Number of stopped containers\n- __cntm_engine_num_containers_paused__: Number of paused containers\n\n### Container CPU metrics\n\n- __cntm_cpu_usage_total_seconds__: Total CPU usage\n- __cntm_cpu_usage_system_seconds__: CPU usage in system mode\n- __cntm_cpu_usage_user_seconds__: CPU usage in user mode\n- __cntm_cpu_usage_percent__: Total CPU usage in percent\n\n### Container memory metrics\n\n- __cntm_memory_total_bytes__: Total memory available\n- __cntm_memory_usage_bytes__: Memory usage\n- __cntm_memory_usage_percent__: Memory usage in percent\n\n### Container I/O metrics\n\n- __cntm_io_read_bytes__: I/O bytes read\n- __cntm_io_write_bytes__: I/O bytes written\n\n### Container network metrics\n\n- __cntm_net_rx_bytes__: Network receive bytes\n- __cntm_net_rx_packets__: Network receive packets\n- __cntm_net_rx_dropped__: Network receive packets dropped\n- __cntm_net_rx_errors__: Network receive errors\n- __cntm_net_tx_bytes__: Network transmit bytes\n- __cntm_net_tx_packets__: Network transmit packets\n- __cntm_net_tx_dropped__: Network transmit packets dropped\n- __cntm_net_tx_errors__: Network transmit errors\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frycus86%2Fcontainer-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frycus86%2Fcontainer-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frycus86%2Fcontainer-metrics/lists"}