system-metrics-easy


Namesystem-metrics-easy JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/hamzaig/system-metrics-easy
SummaryA comprehensive server monitoring tool that collects and sends system metrics to a Socket.IO server
upload_time2025-10-21 14:43:49
maintainerNone
docs_urlNone
authorYour Name
requires_python>=3.8
licenseMIT
keywords server monitoring metrics system stats cpu memory disk network gpu socketio
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # System Metrics Easy

[![PyPI version](https://badge.fury.io/py/system-metrics-easy.svg)](https://badge.fury.io/py/system-metrics-easy)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![GitHub Actions](<https://github.com/hamzaig/system-metrics-easy/workflows/Build%20&%20Publish%20to%20(Test)PyPI/badge.svg>)](https://github.com/hamzaig/system-metrics-easy/actions)

A comprehensive server monitoring tool that collects and sends system metrics to a Socket.IO server. This tool provides real-time monitoring of CPU, memory, disk, network, and GPU usage across different platforms.

## Features

- **Real-time Metrics Collection**: CPU, memory, disk, network, and GPU statistics
- **Multi-Platform Support**: Works on Linux, macOS, and Windows
- **GPU Support**: NVIDIA, Apple Silicon, AMD, and Intel GPUs
- **Socket.IO Integration**: Real-time data transmission to your monitoring server
- **Robust Error Handling**: Graceful handling of system errors and missing dependencies
- **Easy Configuration**: Interactive configuration setup
- **Command Line Interface**: Simple command-line options
- **Background Process Management**: Built-in background running with PID management

## Installation

### From PyPI (Recommended)

```bash
# Install the package
pip install system-metrics-easy
```

### From TestPyPI (Latest Development)

```bash
# Install from TestPyPI (latest development version)
pip install -i https://test.pypi.org/simple/ system-metrics-easy

# If you have dependencies from regular PyPI
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ system-metrics-easy
```

### From Source (Development)

```bash
# Clone the repository
git clone https://github.com/hamzaig/system-metrics-easy.git
cd system-metrics-easy

# Install the package
pip install -e .
```

**Note**: Make sure you're in the `package` directory when running `pip install -e .` if you're working with the source code directly.

## Current Status

✅ **What Works Now:**

- Install from PyPI: `pip install system-metrics-easy`
- Install from TestPyPI: Latest development versions
- Install from source: `git clone` + `pip install -e .`
- Run the tool: `system-metrics-easy`
- All monitoring features work perfectly
- Background process management works
- **Automated deployment**: Push to main → TestPyPI, Tag releases → PyPI

🚀 **Automated Deployment:**

- **Push to `main` branch** → Automatically publishes to TestPyPI
- **Create version tag** (e.g., `v1.0.0`) → Automatically publishes to PyPI

## Quick Start (Super Simple!)

### Install and Run

```bash
# Install from PyPI (recommended)
pip install system-metrics-easy

# Run it - it will ask you for configuration and start in background!
system-metrics-easy
```

That's it! The script will:

1. **Ask you for configuration** (interval, server URL, server name)
2. **Start monitoring** in background automatically
3. **Save logs** to `system-metrics-easy.log`
4. **Handle all process management** for you

### Simple Commands

```bash
# Start monitoring (asks for config)
system-metrics-easy

# Check if it's running
system-metrics-easy --status

# Stop it
system-metrics-easy --stop
```

**That's it! Just simple commands: `system-metrics-easy`, `--status`, `--stop`**

## Metrics Collected

### System Information

- Hostname, OS, architecture
- Python version, uptime, boot time

### CPU Metrics

- Total CPU usage percentage
- Per-core CPU usage
- Load average (1min, 5min, 15min)
- Core count

### Memory Metrics

- Total, used, free, and available memory (GB)
- Memory usage percentage
- Swap memory statistics

### Disk Metrics

- Disk usage for all mounted filesystems
- Total, used, and free space (GB)
- Usage percentage per partition

### Network Metrics

- Network throughput per second
- Bytes sent/received per second
- Total bytes sent/received (GB)
- Per-interface statistics

### GPU Metrics

- **NVIDIA**: Utilization, memory usage, temperature
- **Apple Silicon**: Basic GPU information
- **AMD**: ROCm-based monitoring
- **Intel**: Basic GPU detection

## Socket.IO Integration

The tool connects to your Socket.IO server and emits metrics data in the following format:

```json
{
  "timestamp": 1640995200.0,
  "formatted_time": "2022-01-01 12:00:00",
  "server_id": "my-server-001",
  "system_info": { ... },
  "cpu": { ... },
  "memory": { ... },
  "disk": [ ... ],
  "network": [ ... ],
  "gpu": [ ... ],
  "cuda_processes": { ... }
}
```

## Requirements

- Python 3.8 or higher
- psutil (for system metrics)
- python-socketio (for real-time communication)
- python-dotenv (for configuration)

### Optional Dependencies

- **supervisor** (for advanced background process management)
  - Install with: `pip install system-metrics-easy[supervisor]`

## Platform Support

- **Linux**: Full support for all metrics
- **macOS**: Full support including Apple Silicon GPU detection
- **Windows**: Full support with Windows-specific optimizations

## GPU Support

- **NVIDIA**: Requires nvidia-smi (usually included with NVIDIA drivers)
- **Apple Silicon**: Native macOS support
- **AMD**: Requires ROCm tools (rocm-smi)
- **Intel**: Basic detection support

## Error Handling

The tool includes robust error handling:

- Graceful degradation when tools are unavailable
- Retry logic for transient failures
- Comprehensive logging and error messages
- Safe fallbacks for missing data

## Background Running (Super Simple!)

### Easy Background Running

```bash
# Start in background (one command!)
system-metrics-easy

# Check if running
system-metrics-easy --status

# Stop it
system-metrics-easy --stop

# View logs
tail -f system-metrics-easy.log
```

### Advanced Options (Optional)

If you need more control, you can also use:

```bash
# Using nohup
nohup system-metrics-easy > metrics.log 2>&1 &

# Using screen
screen -S metrics
system-metrics-easy
# Press Ctrl+A, D to detach

# Using tmux
tmux new-session -s metrics
system-metrics-easy
# Press Ctrl+B, D to detach
```

## Configuration

### Environment Variables

You can set these environment variables for automatic configuration:

```bash
export TIME_INTERVAL=10
export SOCKET_SERVER_URL=http://localhost:8000
export SERVER_ID=my-server-001
```

### Interactive Configuration

If no environment variables are set, the tool will ask you for:

1. **Time Interval**: How often to collect metrics (seconds)
2. **Server URL**: Your Socket.IO server URL
3. **Server ID**: Unique identifier for this server

## Development

### Setup Development Environment

```bash
git clone https://github.com/hamzaig/system-metrics-easy.git
cd system-metrics-easy
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -e .[supervisor]  # Include supervisor for testing
```

### Running Tests

```bash
python -m pytest tests/
```

### Building Package

```bash
python -m build
```

### Automated Deployment

This package uses **GitHub Actions** for automated deployment:

#### **Development Releases (TestPyPI)**

- **Trigger**: Push to `main` branch
- **Result**: Automatically publishes to TestPyPI
- **Install**: `pip install -i https://test.pypi.org/simple/ system-metrics-easy`

#### **Production Releases (PyPI)**

- **Trigger**: Create and push a version tag (e.g., `v1.0.0`)
- **Result**: Automatically publishes to PyPI
- **Install**: `pip install system-metrics-easy`

#### **Creating a New Release**

**Option 1: Using the release script (Recommended)**

```bash
# Make the script executable (first time only)
chmod +x scripts/release.py

# Create a new release (automatically updates versions and creates tag)
python scripts/release.py 1.0.0
```

**Option 2: Manual process**

```bash
# Update version in pyproject.toml and setup.py
# Commit changes
git add .
git commit -m "chore: bump version to 1.0.0"

# Create and push tag
git tag v1.0.0
git push origin main --tags
```

The GitHub Actions workflow will automatically:

1. Build the package
2. Run quality checks
3. Publish to the appropriate PyPI instance

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Support

- **Issues**: [GitHub Issues](https://github.com/hamzaig/system-metrics-easy/issues)
- **Documentation**: [GitHub Wiki](https://github.com/hamzaig/system-metrics-easy/wiki)
- **Discussions**: [GitHub Discussions](https://github.com/hamzaig/system-metrics-easy/discussions)

## Changelog

### Version 1.0.0

- Initial release
- Support for CPU, memory, disk, network, and GPU metrics
- Socket.IO integration
- Multi-platform support
- Command-line interface
- Interactive configuration
- Built-in background process management

## About

System Metrics Easy is a simple yet powerful tool for monitoring server performance. It's designed to be easy to use while providing comprehensive system metrics collection and real-time data transmission to your monitoring infrastructure.

### Resources

- **Repository**: [https://github.com/hamzaig/system-metrics-easy](https://github.com/hamzaig/system-metrics-easy)
- **Documentation**: [GitHub Wiki](https://github.com/hamzaig/system-metrics-easy/wiki)
- **Issues**: [GitHub Issues](https://github.com/hamzaig/system-metrics-easy/issues)

### License

MIT License - see [LICENSE](LICENSE) file for details.

---

**Made with ❤️ by [Moonsys](https://github.com/hamzaig)**

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hamzaig/system-metrics-easy",
    "name": "system-metrics-easy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "server, monitoring, metrics, system, stats, cpu, memory, disk, network, gpu, socketio",
    "author": "Your Name",
    "author_email": "Your Name <your.email@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/c0/a0/c570304b192713617afb4e98eacd5ef3601a4d31320e227ea082f16482ed/system_metrics_easy-1.0.1.tar.gz",
    "platform": null,
    "description": "# System Metrics Easy\n\n[![PyPI version](https://badge.fury.io/py/system-metrics-easy.svg)](https://badge.fury.io/py/system-metrics-easy)\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![GitHub Actions](<https://github.com/hamzaig/system-metrics-easy/workflows/Build%20&%20Publish%20to%20(Test)PyPI/badge.svg>)](https://github.com/hamzaig/system-metrics-easy/actions)\n\nA comprehensive server monitoring tool that collects and sends system metrics to a Socket.IO server. This tool provides real-time monitoring of CPU, memory, disk, network, and GPU usage across different platforms.\n\n## Features\n\n- **Real-time Metrics Collection**: CPU, memory, disk, network, and GPU statistics\n- **Multi-Platform Support**: Works on Linux, macOS, and Windows\n- **GPU Support**: NVIDIA, Apple Silicon, AMD, and Intel GPUs\n- **Socket.IO Integration**: Real-time data transmission to your monitoring server\n- **Robust Error Handling**: Graceful handling of system errors and missing dependencies\n- **Easy Configuration**: Interactive configuration setup\n- **Command Line Interface**: Simple command-line options\n- **Background Process Management**: Built-in background running with PID management\n\n## Installation\n\n### From PyPI (Recommended)\n\n```bash\n# Install the package\npip install system-metrics-easy\n```\n\n### From TestPyPI (Latest Development)\n\n```bash\n# Install from TestPyPI (latest development version)\npip install -i https://test.pypi.org/simple/ system-metrics-easy\n\n# If you have dependencies from regular PyPI\npip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ system-metrics-easy\n```\n\n### From Source (Development)\n\n```bash\n# Clone the repository\ngit clone https://github.com/hamzaig/system-metrics-easy.git\ncd system-metrics-easy\n\n# Install the package\npip install -e .\n```\n\n**Note**: Make sure you're in the `package` directory when running `pip install -e .` if you're working with the source code directly.\n\n## Current Status\n\n\u2705 **What Works Now:**\n\n- Install from PyPI: `pip install system-metrics-easy`\n- Install from TestPyPI: Latest development versions\n- Install from source: `git clone` + `pip install -e .`\n- Run the tool: `system-metrics-easy`\n- All monitoring features work perfectly\n- Background process management works\n- **Automated deployment**: Push to main \u2192 TestPyPI, Tag releases \u2192 PyPI\n\n\ud83d\ude80 **Automated Deployment:**\n\n- **Push to `main` branch** \u2192 Automatically publishes to TestPyPI\n- **Create version tag** (e.g., `v1.0.0`) \u2192 Automatically publishes to PyPI\n\n## Quick Start (Super Simple!)\n\n### Install and Run\n\n```bash\n# Install from PyPI (recommended)\npip install system-metrics-easy\n\n# Run it - it will ask you for configuration and start in background!\nsystem-metrics-easy\n```\n\nThat's it! The script will:\n\n1. **Ask you for configuration** (interval, server URL, server name)\n2. **Start monitoring** in background automatically\n3. **Save logs** to `system-metrics-easy.log`\n4. **Handle all process management** for you\n\n### Simple Commands\n\n```bash\n# Start monitoring (asks for config)\nsystem-metrics-easy\n\n# Check if it's running\nsystem-metrics-easy --status\n\n# Stop it\nsystem-metrics-easy --stop\n```\n\n**That's it! Just simple commands: `system-metrics-easy`, `--status`, `--stop`**\n\n## Metrics Collected\n\n### System Information\n\n- Hostname, OS, architecture\n- Python version, uptime, boot time\n\n### CPU Metrics\n\n- Total CPU usage percentage\n- Per-core CPU usage\n- Load average (1min, 5min, 15min)\n- Core count\n\n### Memory Metrics\n\n- Total, used, free, and available memory (GB)\n- Memory usage percentage\n- Swap memory statistics\n\n### Disk Metrics\n\n- Disk usage for all mounted filesystems\n- Total, used, and free space (GB)\n- Usage percentage per partition\n\n### Network Metrics\n\n- Network throughput per second\n- Bytes sent/received per second\n- Total bytes sent/received (GB)\n- Per-interface statistics\n\n### GPU Metrics\n\n- **NVIDIA**: Utilization, memory usage, temperature\n- **Apple Silicon**: Basic GPU information\n- **AMD**: ROCm-based monitoring\n- **Intel**: Basic GPU detection\n\n## Socket.IO Integration\n\nThe tool connects to your Socket.IO server and emits metrics data in the following format:\n\n```json\n{\n  \"timestamp\": 1640995200.0,\n  \"formatted_time\": \"2022-01-01 12:00:00\",\n  \"server_id\": \"my-server-001\",\n  \"system_info\": { ... },\n  \"cpu\": { ... },\n  \"memory\": { ... },\n  \"disk\": [ ... ],\n  \"network\": [ ... ],\n  \"gpu\": [ ... ],\n  \"cuda_processes\": { ... }\n}\n```\n\n## Requirements\n\n- Python 3.8 or higher\n- psutil (for system metrics)\n- python-socketio (for real-time communication)\n- python-dotenv (for configuration)\n\n### Optional Dependencies\n\n- **supervisor** (for advanced background process management)\n  - Install with: `pip install system-metrics-easy[supervisor]`\n\n## Platform Support\n\n- **Linux**: Full support for all metrics\n- **macOS**: Full support including Apple Silicon GPU detection\n- **Windows**: Full support with Windows-specific optimizations\n\n## GPU Support\n\n- **NVIDIA**: Requires nvidia-smi (usually included with NVIDIA drivers)\n- **Apple Silicon**: Native macOS support\n- **AMD**: Requires ROCm tools (rocm-smi)\n- **Intel**: Basic detection support\n\n## Error Handling\n\nThe tool includes robust error handling:\n\n- Graceful degradation when tools are unavailable\n- Retry logic for transient failures\n- Comprehensive logging and error messages\n- Safe fallbacks for missing data\n\n## Background Running (Super Simple!)\n\n### Easy Background Running\n\n```bash\n# Start in background (one command!)\nsystem-metrics-easy\n\n# Check if running\nsystem-metrics-easy --status\n\n# Stop it\nsystem-metrics-easy --stop\n\n# View logs\ntail -f system-metrics-easy.log\n```\n\n### Advanced Options (Optional)\n\nIf you need more control, you can also use:\n\n```bash\n# Using nohup\nnohup system-metrics-easy > metrics.log 2>&1 &\n\n# Using screen\nscreen -S metrics\nsystem-metrics-easy\n# Press Ctrl+A, D to detach\n\n# Using tmux\ntmux new-session -s metrics\nsystem-metrics-easy\n# Press Ctrl+B, D to detach\n```\n\n## Configuration\n\n### Environment Variables\n\nYou can set these environment variables for automatic configuration:\n\n```bash\nexport TIME_INTERVAL=10\nexport SOCKET_SERVER_URL=http://localhost:8000\nexport SERVER_ID=my-server-001\n```\n\n### Interactive Configuration\n\nIf no environment variables are set, the tool will ask you for:\n\n1. **Time Interval**: How often to collect metrics (seconds)\n2. **Server URL**: Your Socket.IO server URL\n3. **Server ID**: Unique identifier for this server\n\n## Development\n\n### Setup Development Environment\n\n```bash\ngit clone https://github.com/hamzaig/system-metrics-easy.git\ncd system-metrics-easy\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\npip install -e .[supervisor]  # Include supervisor for testing\n```\n\n### Running Tests\n\n```bash\npython -m pytest tests/\n```\n\n### Building Package\n\n```bash\npython -m build\n```\n\n### Automated Deployment\n\nThis package uses **GitHub Actions** for automated deployment:\n\n#### **Development Releases (TestPyPI)**\n\n- **Trigger**: Push to `main` branch\n- **Result**: Automatically publishes to TestPyPI\n- **Install**: `pip install -i https://test.pypi.org/simple/ system-metrics-easy`\n\n#### **Production Releases (PyPI)**\n\n- **Trigger**: Create and push a version tag (e.g., `v1.0.0`)\n- **Result**: Automatically publishes to PyPI\n- **Install**: `pip install system-metrics-easy`\n\n#### **Creating a New Release**\n\n**Option 1: Using the release script (Recommended)**\n\n```bash\n# Make the script executable (first time only)\nchmod +x scripts/release.py\n\n# Create a new release (automatically updates versions and creates tag)\npython scripts/release.py 1.0.0\n```\n\n**Option 2: Manual process**\n\n```bash\n# Update version in pyproject.toml and setup.py\n# Commit changes\ngit add .\ngit commit -m \"chore: bump version to 1.0.0\"\n\n# Create and push tag\ngit tag v1.0.0\ngit push origin main --tags\n```\n\nThe GitHub Actions workflow will automatically:\n\n1. Build the package\n2. Run quality checks\n3. Publish to the appropriate PyPI instance\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Submit a pull request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Support\n\n- **Issues**: [GitHub Issues](https://github.com/hamzaig/system-metrics-easy/issues)\n- **Documentation**: [GitHub Wiki](https://github.com/hamzaig/system-metrics-easy/wiki)\n- **Discussions**: [GitHub Discussions](https://github.com/hamzaig/system-metrics-easy/discussions)\n\n## Changelog\n\n### Version 1.0.0\n\n- Initial release\n- Support for CPU, memory, disk, network, and GPU metrics\n- Socket.IO integration\n- Multi-platform support\n- Command-line interface\n- Interactive configuration\n- Built-in background process management\n\n## About\n\nSystem Metrics Easy is a simple yet powerful tool for monitoring server performance. It's designed to be easy to use while providing comprehensive system metrics collection and real-time data transmission to your monitoring infrastructure.\n\n### Resources\n\n- **Repository**: [https://github.com/hamzaig/system-metrics-easy](https://github.com/hamzaig/system-metrics-easy)\n- **Documentation**: [GitHub Wiki](https://github.com/hamzaig/system-metrics-easy/wiki)\n- **Issues**: [GitHub Issues](https://github.com/hamzaig/system-metrics-easy/issues)\n\n### License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n---\n\n**Made with \u2764\ufe0f by [Moonsys](https://github.com/hamzaig)**\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A comprehensive server monitoring tool that collects and sends system metrics to a Socket.IO server",
    "version": "1.0.1",
    "project_urls": {
        "Documentation": "https://github.com/hamzaig/system-metrics-easy#readme",
        "Homepage": "https://github.com/hamzaig/system-metrics-easy",
        "Issues": "https://github.com/hamzaig/system-metrics-easy/issues",
        "Repository": "https://github.com/hamzaig/system-metrics-easy"
    },
    "split_keywords": [
        "server",
        " monitoring",
        " metrics",
        " system",
        " stats",
        " cpu",
        " memory",
        " disk",
        " network",
        " gpu",
        " socketio"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "364457d864ff5a4ae09a1d44c574aaaa72b9f9c87ac79d21f5150eeb603e3054",
                "md5": "636f3645322900496a09c240c54c7389",
                "sha256": "ebb2873b60ccd732dba259c5291204d4d870de8eb541844f308aef3091a3448a"
            },
            "downloads": -1,
            "filename": "system_metrics_easy-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "636f3645322900496a09c240c54c7389",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 17583,
            "upload_time": "2025-10-21T14:43:48",
            "upload_time_iso_8601": "2025-10-21T14:43:48.475277Z",
            "url": "https://files.pythonhosted.org/packages/36/44/57d864ff5a4ae09a1d44c574aaaa72b9f9c87ac79d21f5150eeb603e3054/system_metrics_easy-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c0a0c570304b192713617afb4e98eacd5ef3601a4d31320e227ea082f16482ed",
                "md5": "39e8b4fb9bbaabf573cf4b0ce5183510",
                "sha256": "fb2f55316420ebd93202bc7652b375b3efa0e21016048e3baf958d10f66c3c97"
            },
            "downloads": -1,
            "filename": "system_metrics_easy-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "39e8b4fb9bbaabf573cf4b0ce5183510",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 22391,
            "upload_time": "2025-10-21T14:43:49",
            "upload_time_iso_8601": "2025-10-21T14:43:49.515901Z",
            "url": "https://files.pythonhosted.org/packages/c0/a0/c570304b192713617afb4e98eacd5ef3601a4d31320e227ea082f16482ed/system_metrics_easy-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-21 14:43:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hamzaig",
    "github_project": "system-metrics-easy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "system-metrics-easy"
}
        
Elapsed time: 2.12034s