Skip to content

Conversation

@DhanashreePetare
Copy link

Cgroup v1/v2 Monitoring Support

Overview

Adds comprehensive cgroup (container) resource monitoring to prmon with automatic detection of cgroup v1, v2, and hybrid environments.

Changes

  • New monitor: cgroupmon with 17 metrics across CPU, memory, I/O, and process counts
  • Auto-detection: Detects cgroup version at runtime and adapts accordingly
  • Parser: Handles cpu.stat, memory.stat, io.stat for both v1 and v2
  • Tests: Python integration test + GTest skeleton with precooked fixtures
  • Docs: README section, ADDING_MONITORS example, CONTRIBUTING Windows guide
  • Disable flag: --disable cgroupmon if needed

Benefits

  • Better container/Kubernetes workload monitoring
  • More accurate I/O stats in containerized environments
  • Backward compatible with existing prmon deployments
  • Graceful degradation if cgroups unavailable

Testing

Python linting passes. CI will verify build and tests in Linux environments.

DhanashreePetare added 2 commits December 26, 2025 16:48
- Implement cgroupmon monitor with 17 metrics across CPU, memory, I/O, and process counts
- Support automatic detection of cgroup v1, v2, and hybrid environments
- Parse cgroup controllers: cpu.stat, memory.stat, io.stat for both versions
- Integrate with prmon build system and test infrastructure
- Add Python and GTest test harnesses with precooked cgroup v2 fixtures
- Update documentation: README, ADDING_MONITORS, CONTRIBUTING with usage and Windows dev notes
- Enable container resource tracking with --disable cgroupmon flag
- Provide more accurate I/O statistics for containerized workloads
…ead counting

- Remove unused cgroup_stat_update variable in update_stats()
- Fix read_single_value() to count lines for cgroup.procs and cgroup.threads
  instead of reading first value, since these are multi-line PID lists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant