Skip to main content

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

PyPi Documentation Status License Downloads

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cgroup-monitor-0.1.2.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

cgroup_monitor-0.1.2-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page