{"id":44018476,"url":"https://github.com/perun-engineering/ebpf-oom-watcher","last_synced_at":"2026-06-01T03:06:17.858Z","repository":{"id":309711720,"uuid":"1037121010","full_name":"Perun-Engineering/ebpf-oom-watcher","owner":"Perun-Engineering","description":"eBPF-based OOM watcher for Kubernetes with Prometheus integration","archived":false,"fork":false,"pushed_at":"2025-08-13T11:51:16.000Z","size":75,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-13T12:29:17.201Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/Perun-Engineering.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","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,"zenodo":null}},"created_at":"2025-08-13T05:18:33.000Z","updated_at":"2025-08-13T05:28:02.000Z","dependencies_parsed_at":"2025-08-13T12:29:21.261Z","dependency_job_id":"cdd424e6-8358-4d46-90df-fa3d3daad48a","html_url":"https://github.com/Perun-Engineering/ebpf-oom-watcher","commit_stats":null,"previous_names":["perun-engineering/ebpf-oom-watcher"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/Perun-Engineering/ebpf-oom-watcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perun-Engineering%2Febpf-oom-watcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perun-Engineering%2Febpf-oom-watcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perun-Engineering%2Febpf-oom-watcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perun-Engineering%2Febpf-oom-watcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Perun-Engineering","download_url":"https://codeload.github.com/Perun-Engineering/ebpf-oom-watcher/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perun-Engineering%2Febpf-oom-watcher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29199519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T14:35:27.868Z","status":"ssl_error","status_checked_at":"2026-02-07T14:25:51.081Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-02-07T16:04:33.618Z","updated_at":"2026-02-07T16:04:46.932Z","avatar_url":"https://github.com/Perun-Engineering.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eBPF OOM Watcher\n\nAn eBPF-based Out-of-Memory (OOM) event monitor for Kubernetes that captures OOM events with pod and container context, exposing detailed metrics via Prometheus.\n\n## Features\n\n- **eBPF-based OOM Detection**: Uses kernel tracepoints to capture OOM events in real-time\n- **Kubernetes Integration**: Automatically identifies pods and containers where OOMs occur\n- **Prometheus Metrics**: Comprehensive metrics for monitoring and alerting\n- **DaemonSet Deployment**: Runs on all nodes to provide cluster-wide OOM visibility\n- **Multi-Architecture**: Supports AMD64 and ARM64 platforms\n\n## Quick Start\n\n### Kubernetes Deployment\n\n```bash\n# Build and push image\ndocker build -f Dockerfile.production -t ghcr.io/perun-engineering/ebpf-oom-watcher:latest .\ndocker push ghcr.io/perun-engineering/ebpf-oom-watcher:latest\n\n# Deploy using kubectl\nkubectl apply -f k8s/daemonset.yaml\n\n# Or using Helm\nhelm install oom-watcher helm/oom-watcher \\\n  --set image.tag=latest \\\n  --set serviceMonitor.enabled=true\n```\n\n### Local Development\n\n```bash\n# Set up development environment\n./scripts/setup-dev.sh\n\n# Build and test\n./scripts/build-and-test.sh\n\n# Run locally (requires Linux and root privileges)\nsudo ./target/release/oom-watcher\n```\n\n## Metrics\n\nThe OOM Watcher exposes the following Prometheus metrics on port 8080:\n\n- `oom_kills_total{node, namespace, pod, container}` - Total number of OOM kills\n- `oom_kills_per_node_total{node}` - Total OOM kills per node\n- `oom_memory_usage_bytes{node, namespace, pod, container, memory_type}` - Memory usage at OOM time\n- `oom_last_timestamp{node, namespace, pod, container}` - Timestamp of last OOM event\n\n### Example Queries\n\n```promql\n# OOM rate across cluster\nrate(oom_kills_total[5m])\n\n# OOM kills by namespace\nsum by (namespace) (oom_kills_total)\n\n# Memory usage at OOM by type\noom_memory_usage_bytes{memory_type=\"anon_rss\"}\n```\n\n## Configuration\n\n### Environment Variables\n\n- `NODE_NAME`: Kubernetes node name (automatically set by DaemonSet)\n- `METRICS_PORT`: Port for Prometheus metrics (default: 8080)\n- `RUST_LOG`: Log level (default: info)\n\n### Helm Chart Values\n\nSee [helm/oom-watcher/values.yaml](helm/oom-watcher/values.yaml) for all configuration options.\n\n## Development\n\n### Prerequisites\n\n- Docker (recommended) or Linux with eBPF support\n- Rust 1.75+ with nightly toolchain\n- kubectl and Helm for Kubernetes deployment\n\n### Setup\n\n```bash\ngit clone https://github.com/Perun-Engineering/ebpf-oom-watcher.git\ncd ebpf-oom-watcher\n./scripts/setup-dev.sh\n```\n\n### Local Testing\n\n```bash\n# Run pre-commit hooks\npre-commit run --all-files\n\n# Build for multiple architectures\ncross build --target x86_64-unknown-linux-gnu --release\ncross build --target aarch64-unknown-linux-gnu --release\n\n# Test Helm chart\nhelm lint helm/oom-watcher\nhelm template helm/oom-watcher | kubectl apply --dry-run=client -f -\n\n# Trigger test OOM (use with caution)\npython3 scripts/trigger_oom.py\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for development workflow, commit conventions, and contribution guidelines.\n\n## Project Structure\n\n```\nebpf-oom-watcher/\n├── oom-watcher/           # Userland application\n├── oom-watcher-ebpf/      # eBPF kernel program\n├── oom-watcher-common/    # Shared data structures\n├── scripts/               # Utility scripts\n├── Dockerfile            # Docker build environment\n└── README.md             # This file\n```\n\n## Architecture\n\n- **eBPF Program**: Attaches to the `oom_kill_process` kernel function using a kprobe\n- **Userland Program**: Loads the eBPF program and reads OOM events via PerfEventArray\n- **Event Structure**: Captures process details including PID, memory usage, and process name\n- **Async Processing**: Handles events from multiple CPUs concurrently using Tokio\n\n## Troubleshooting\n\n### Common Issues\n\n1. **Permission denied**: eBPF programs require root privileges or appropriate capabilities\n2. **Kernel version**: Requires a recent Linux kernel with eBPF support (4.4+)\n3. **Memory constraints**: Large Rust builds may require sufficient memory/swap\n\n### Docker Issues\n\n- **SIGBUS errors**: Try increasing Docker's memory limits:\n  ```bash\n  docker run --memory=4g --memory-swap=8g ...\n  ```\n- **Build failures**: Ensure you're using the nightly toolchain with rust-src component\n\n## License\n\nThis project is licensed under the terms of the [MIT license].\n\n[MIT license]: LICENSE-MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperun-engineering%2Febpf-oom-watcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperun-engineering%2Febpf-oom-watcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperun-engineering%2Febpf-oom-watcher/lists"}