Skip to main content

A system monitoring API with real-time process tracking and resource usage

Project description

Taman - System Monitoring API

Taman is a FastAPI-based system monitoring tool that provides real-time process tracking and resource usage information through RESTful endpoints and Server-Sent Events (SSE).

Features

  • Real-time system monitoring: CPU usage, memory consumption, and process information
  • Process management: Kill processes by PID
  • Streaming data: Real-time updates via Server-Sent Events
  • Cross-platform: Works on Windows, macOS, and Linux
  • REST API: Clean and simple API endpoints
  • CORS support: Ready for web frontend integration

Installation

Install from PyPI:

pip install taman

Or install from source:

git clone https://github.com/yourusername/taman
cd taman
pip install -e .

Quick Start

Running the API server

# Start the server
taman

# Or run directly with Python
python -m taman.main

The API will be available at http://localhost:8000

API Endpoints

  • GET /process - Get current processes list
  • GET /process/stream - Stream real-time system data (SSE)
  • GET /kill/{pid} - Terminate a process by PID

Example Usage

import requests

# Get current processes
response = requests.get("http://localhost:8000/process")
processes = response.json()

# Kill a process
response = requests.get("http://localhost:8000/kill/1234")

Streaming Data Example

// JavaScript example for consuming SSE stream
const eventSource = new EventSource('http://localhost:8000/process/stream');

eventSource.onmessage = function(event) {
    const data = JSON.parse(event.data);
    console.log('System Stats:', data.system_stats);
    console.log('Processes:', data.processes);
};

Development

Setup Development Environment

# Clone the repository
git clone https://github.com/yourusername/taman
cd taman

# Install with development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black taman/

# Lint code
flake8 taman/

Running in Development Mode

# Run with auto-reload
uvicorn taman.main:app --reload --host 0.0.0.0 --port 8000

Data Format

System Stats Response

{
  "system_stats": {
    "cpu_usage": 15.2,
    "cores_usage": [12.1, 18.3, 14.7, 16.8],
    "memory_usage": {
      "total_gb": 16.0,
      "used_gb": 8.5,
      "percent": 53.1
    }
  },
  "processes": [
    {
      "name": "python.exe",
      "pid": 1234,
      "runtime_seconds": 3600.5,
      "ram_bytes": 52428800,
      "threads": 8
    }
  ]
}

Requirements

  • Python 3.8+
  • FastAPI
  • psutil
  • uvicorn
  • wmi (Windows only)

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any issues, please file a bug report on the GitHub Issues page.

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

taman-0.1.0.tar.gz (3.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

taman-0.1.0-py3-none-any.whl (4.1 MB view details)

Uploaded Python 3

File details

Details for the file taman-0.1.0.tar.gz.

File metadata

  • Download URL: taman-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.6

File hashes

Hashes for taman-0.1.0.tar.gz
Algorithm Hash digest
SHA256 943e5f6a179677e84ff143b5eeb51e1fde240bd2436cad08bc932917a92b4c5a
MD5 585a0f970a54e66855c3baa8f7b48950
BLAKE2b-256 8119fd8de64a2313bfa60e611b2170b23316ea91ac6fa050a7d3750e8cdce76e

See more details on using hashes here.

File details

Details for the file taman-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: taman-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.6

File hashes

Hashes for taman-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca8a5b8c71ab57894a81f5c541843a837ee2fa115c1a105ab3bc1226c9a28e4e
MD5 d2b25cc61a7c714ec6d00c10efb26248
BLAKE2b-256 93dc3f034ee07cd980517776fb83d78ea59de2068de067bddbef8f4f973b203c

See more details on using hashes here.

Supported by

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