Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/eshirazi/docker-stats-monitor

A program track the performance (cpu, memory footprint) of running docker containers on a server, and store them in an SQL database.
https://github.com/eshirazi/docker-stats-monitor

Last synced: 1 day ago
JSON representation

A program track the performance (cpu, memory footprint) of running docker containers on a server, and store them in an SQL database.

Awesome Lists containing this project

README

        

# docker-stats-monitor

## What is this?
A simple tool for capturing simple running statistics about running docker containers, and store them in an SQL database.

For now only memory usage and cpu usage are captured.

## Usage

### Using commandline

Simply run `python main.py`

The tool expects these environment variables to be set:
- `DOCKER_BASE_URL`: The url of the docker socket (in order to communicate with the docker daemon and use docker stats)
- `DATABASE_URL`: The url of the database to be used. The tool uses SQLAlchemy, so an [SQLAlchemy database URI syntax](https://docs.sqlalchemy.org/en/20/core/engines.html) is expected.
- `DATA_RETENTION` (Optional): Specifing the data retention in seconds (for how long data should be kept).
If omitted, the default is 7 days.

### Using Docker Compose

Here's a typical docker compose configuration snippet

```yaml
docker-stats-monitor:
build: ../docker-stats-monitor
restart: unless-stopped
container_name: "docker-stats-monitor"
environment:
- "DATABASE_URL="
- "DOCKER_BASE_URL=unix:///var/run/docker.sock"
- "PYTHONUNBUFFERED=1"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
extra_hosts:
- "host.docker.internal:host-gateway"
```