A simple library to monitor CPU and Memory usage only using cgroups. Mainly created to monitor the resources inside the container.
Project description
cgroup-monitor
Description
cgroup-monitor is a Python package that provides a simple interface to monitor cgroup metrics. It is designed to be used in a containerized environment to monitor the resource usage of the containers. It can be used to monitor the CPU, and memory, of the containers.
The current version is only compatible with cgroup v1 (Ubuntu 20.04 and lower)
Installation
pip install cgroup-monitor
Usage
from cgroup_monitor import CgroupMonitor
monitor = CgroupMonitor()
monitor.start_monitor()
# run task here
cpu, mem = monitor.stop_monitor()
print(f"CPU Usage: {cpu}%, Memory Usage: {mem}%")
Features
- Monitor CPU and Memory usage of the containers
- Simple interface to start and stop monitoring
- Lightweight and easy to use
Documentation
The official documentation is hosted on Read the Docs: https://cgroup-monitor.readthedocs.io/en/latest/
License
This project is licensed under the terms of the MIT license, see LICENSE.
Contributing
Contributions are welcome, and they are greatly appreciated! Every little bit helps.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cgroup-monitor-0.1.2.tar.gz
.
File metadata
- Download URL: cgroup-monitor-0.1.2.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2ba7ea6952490a3b2365f369127953816c3f0dd237553ac042e32b9e5f699ff |
|
MD5 | 7964d861bcde71354266a1a7b7aa61e9 |
|
BLAKE2b-256 | a5237aef7d0e03be395332d68db79d332a68e77fec910b61c6b99c90d28cf3be |
File details
Details for the file cgroup_monitor-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: cgroup_monitor-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da75a6e4becfa0827c6643a59f093d24b3fb9caf3e20765839a918eb77631123 |
|
MD5 | f597bc0ec0e41ed02f43e1208b60319f |
|
BLAKE2b-256 | 774e9f237a2b0868e6464331f887afc8cbaed94af68e306abc3acb9ccc0edede |