syinfo


Namesyinfo JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryA comprehensive Python package for hardware, network, and software information gathering with advanced monitoring capabilities
upload_time2025-09-13 22:56:58
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords analytics devops hardware information linux monitoring network performance system
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SyInfo - Simple System Information Library
<p align="center">
  <img src="docs/images/logo.png" alt="SyInfo logo - textual art" width="420" />
</p>

[![PyPI version](https://badge.fury.io/py/syinfo.svg)](https://badge.fury.io/py/syinfo)
[![Python versions](https://img.shields.io/pypi/pyversions/syinfo.svg)](https://pypi.org/project/syinfo/)

A simple, well-designed Python library for gathering system information including hardware specifications, network configuration, and real-time system monitoring.

## Key Features

### Device Information
- **CPU Details**: Model, cores, frequency, usage statistics
- **Memory Analysis**: RAM, swap, detailed memory mapping
- **Storage Info**: Disk usage, I/O statistics, filesystem details
- **GPU Detection**: NVIDIA, AMD, Intel graphics cards
- **Device Identification**: Manufacturer, model, serial numbers

### Network Capabilities  
- **Interface Detection**: All network adapters with detailed info
- **Connectivity Analysis**: Public/private IP, DNS, gateways
- **Device Discovery**: Scan and identify devices on local network
- **Network I/O Statistics**: Real-time and historical data
- **WiFi Information**: SSID, signal strength, encryption

### System Monitoring (New!)
- **Real-time Monitoring**: CPU, memory, disk, and network tracking
- **Customizable Intervals**: 1 second to hours, configurable duration
- **JSON Export**: Perfect for scripting and automation with jq
- **Performance Analytics**: Averages, peaks, and trend analysis
- **Non-blocking**: Background monitoring with graceful interruption

### Powerful CLI Interface
- **Flag-based Commands**: Easy scripting (`syinfo -npj -t 10 | jq '.summary'`)
- **JSON Output**: Native jq compatibility for data processing
- **Monitoring Support**: Real-time system performance tracking
- **Flexible Options**: Combine flags for exactly what you need

## Installation

```bash
# Basic installation
pip install syinfo

# With network discovery features
pip install syinfo[network]

# Full installation (all features)
pip install syinfo[full]
```

## Quick Start

### Basic Usage

```python
import syinfo

# Get comprehensive system information
info = syinfo.get_system_info()
print(f"System: {info['system_name']}")
print(f"CPU: {info['cpu_model']} ({info['cpu_cores']} cores)")
print(f"Memory: {info['total_memory']} ({info['memory_usage_percent']:.1f}% used)")
```

### Hardware Information

```python
# Get detailed hardware info
hardware = syinfo.get_hardware_info()

print("CPU Information:")
print(f"  Model: {hardware['cpu']['model']}")
print(f"  Cores: {hardware['cpu']['cores_physical']} physical")
print(f"  Usage: {hardware['cpu']['usage_percent']:.1f}%")

print("Memory Information:")  
print(f"  Total: {hardware['memory']['total']}")
print(f"  Available: {hardware['memory']['available']}")
print(f"  Usage: {hardware['memory']['usage_percent']:.1f}%")
```

### Network Discovery

```python
# Discover devices on network
devices = syinfo.discover_network_devices(timeout=10)
print(f"Found {len(devices)} devices:")

for device in devices:
    print(f"  {device['ip']:15} - {device['hostname']} ({device['vendor']})")
```

### System Monitoring (New!)

```python
# Create a simple system monitor  
monitor = syinfo.create_simple_monitor(interval=5)

# Start monitoring for 60 seconds
monitor.start(duration=60)
import time
time.sleep(61)
results = monitor.stop()

print(f"Average CPU Usage: {results['summary']['cpu_avg']:.1f}%")
print(f"Peak Memory Usage: {results['summary']['memory_peak']:.1f}%")
print(f"Data Points Collected: {results['total_points']}")
```

## CLI Interface - Flag-Based Commands

### Device Information
```bash
# Device/hardware information
syinfo -d

# With JSON output
syinfo -dj | jq '.cpu_info.model'
```

### Network Operations
```bash
# Network information
syinfo -n -t 10          # Scan network for 10 seconds

# Network with device info
syinfo -s -t 15          # Combined system info, 15-second network scan

# JSON output for parsing
syinfo -nj -t 5 | jq '.network_devices | length'
```

### System Monitoring (New!)
```bash
# Monitor system for 30 seconds, 5-second intervals
syinfo -m -t 30 -i 5

# JSON monitoring data
syinfo -mpj -t 60 -i 10 | tail -1 | jq '.summary'

# Extract specific metrics
syinfo -mpj -t 120 -i 15 | tail -1 | jq -r '.summary.cpu_avg'

# Continuous monitoring to file
syinfo -mpj -t 300 -i 30 | tail -1 > performance.json
```

### Advanced CLI Usage
```bash
# Disable output, just get JSON
syinfo -dpj > device_info.json

# Network scan without vendor lookup (faster)
syinfo -noj -t 5

# Monitor and process with jq
syinfo -mpj -t 60 -i 10 | tail -1 | jq '.data_points[].cpu_percent | max'

# Complex monitoring workflows
CPU_AVG=$(syinfo -mpj -t 30 -i 5 | tail -1 | jq -r '.summary.cpu_avg')
if (( $(echo "$CPU_AVG > 80" | bc -l) )); then
  echo "High CPU usage detected: $CPU_AVG%"
fi
```

## CLI Flag Reference

| Flag | Long Flag | Description |
|------|-----------|-------------|
| `-d` | `--device` | Show device/hardware information |
| `-n` | `--network` | Show network information and scan devices |
| `-s` | `--system` | Show combined device and network information |
| `-m` | `--monitor` | **Start system monitoring** |
| `-t` | `--time` | Duration in seconds (network scan or monitoring) |
| `-i` | `--interval` | **Monitoring interval in seconds (default: 5)** |
| `-p` | `--disable-print` | Suppress formatted output |
| `-j` | `--return-json` | Output as JSON |
| `-o` | `--disable-vendor-search` | Skip vendor lookup (faster network scans) |

## System Monitoring Features

### Real-time Performance Tracking
- **CPU Usage**: Per-core and overall utilization
- **Memory Statistics**: Usage, available, swap information
- **Disk I/O**: Read/write operations and usage percentages
- **Network Activity**: Bytes and packets sent/received

### JSON Data Structure
```json
{
  "total_points": 12,
  "data_points": [
    {
      "timestamp": "2025-09-14T02:20:42.029017",
      "cpu_percent": 7.8,
      "memory_percent": 68.2,
      "disk_percent": 82.8,
      "network_io": {
        "bytes_sent": 3301001170,
        "bytes_recv": 4409283972,
        "packets_sent": 3556700,
        "packets_recv": 5418377
      }
    }
  ],
  "summary": {
    "duration_seconds": 60,
    "cpu_avg": 5.3,
    "cpu_max": 8.3,
    "memory_avg": 68.2,
    "memory_peak": 68.4,
    "disk_avg": 82.8,
    "start_time": "2025-09-14T02:20:42.029017",
    "end_time": "2025-09-14T02:21:42.029017"
  }
}
```

### Monitoring Use Cases
```bash
# Server performance monitoring
syinfo -mpj -t 3600 -i 60 | tail -1 > hourly_stats.json

# Quick system check
syinfo -m -t 10 -i 2

# CPU spike detection
syinfo -mpj -t 300 -i 5 | tail -1 | jq '.data_points[] | select(.cpu_percent > 90)'

# Network throughput analysis
syinfo -mpj -t 120 -i 10 | tail -1 | jq '.data_points | [.[0], .[-1]] | .[1].network_io.bytes_sent - .[0].network_io.bytes_sent'
```

## Error Handling

```python
from syinfo.exceptions import SystemAccessError, DataCollectionError

try:
    info = syinfo.get_system_info()
except SystemAccessError as e:
    print(f"Permission error: {e}")
except DataCollectionError as e:
    print(f"Data collection failed: {e}")
```

## Performance & Reliability

### Benchmarks
- **Data Collection**: < 2 seconds for complete system scan
- **Memory Usage**: < 50MB peak memory consumption  
- **Network Scan**: < 15 seconds for typical home network
- **Monitoring Overhead**: < 1% CPU during continuous monitoring

## Development

### Setup
```bash
git clone https://github.com/MR901/syinfo.git
cd syinfo
python -m venv venv
source venv/bin/activate  # or `venv\Scripts\activate` on Windows
pip install -e .[dev,full]
```

### Testing
```bash
# Run tests
pytest

# Run with coverage
pytest --cov=syinfo --cov-report=html

# Test monitoring functionality
python -c "import syinfo; m=syinfo.create_simple_monitor(1); m.start(5); import time; time.sleep(6); print(m.stop())"
```

## Examples

Check out the [examples/](examples/) directory for comprehensive usage examples:
- [API Usage](examples/api_example.py) - Python API examples
- [CLI Examples](examples/cli_examples.py) - Command line usage
- [Monitoring Examples](examples/monitoring_example.py) - System monitoring

## Contributing

We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

## License

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

## Support

- **Issues**: [GitHub Issues](https://github.com/MR901/syinfo/issues)  
- **Email**: mohitrajput901@gmail.com
- **GitHub**: [https://github.com/MR901/syinfo](https://github.com/MR901/syinfo)
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "syinfo",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Mohit Rajput <mohitrajput901@gmail.com>",
    "keywords": "analytics, devops, hardware, information, linux, monitoring, network, performance, system",
    "author": null,
    "author_email": "Mohit Rajput <mohitrajput901@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/c7/96/5e6074a72b370b304da7b8365446597bec1b7743b37ccd7cf9a10c4fb4da/syinfo-0.2.0.tar.gz",
    "platform": null,
    "description": "# SyInfo - Simple System Information Library\n<p align=\"center\">\n  <img src=\"docs/images/logo.png\" alt=\"SyInfo logo - textual art\" width=\"420\" />\n</p>\n\n[![PyPI version](https://badge.fury.io/py/syinfo.svg)](https://badge.fury.io/py/syinfo)\n[![Python versions](https://img.shields.io/pypi/pyversions/syinfo.svg)](https://pypi.org/project/syinfo/)\n\nA simple, well-designed Python library for gathering system information including hardware specifications, network configuration, and real-time system monitoring.\n\n## Key Features\n\n### Device Information\n- **CPU Details**: Model, cores, frequency, usage statistics\n- **Memory Analysis**: RAM, swap, detailed memory mapping\n- **Storage Info**: Disk usage, I/O statistics, filesystem details\n- **GPU Detection**: NVIDIA, AMD, Intel graphics cards\n- **Device Identification**: Manufacturer, model, serial numbers\n\n### Network Capabilities  \n- **Interface Detection**: All network adapters with detailed info\n- **Connectivity Analysis**: Public/private IP, DNS, gateways\n- **Device Discovery**: Scan and identify devices on local network\n- **Network I/O Statistics**: Real-time and historical data\n- **WiFi Information**: SSID, signal strength, encryption\n\n### System Monitoring (New!)\n- **Real-time Monitoring**: CPU, memory, disk, and network tracking\n- **Customizable Intervals**: 1 second to hours, configurable duration\n- **JSON Export**: Perfect for scripting and automation with jq\n- **Performance Analytics**: Averages, peaks, and trend analysis\n- **Non-blocking**: Background monitoring with graceful interruption\n\n### Powerful CLI Interface\n- **Flag-based Commands**: Easy scripting (`syinfo -npj -t 10 | jq '.summary'`)\n- **JSON Output**: Native jq compatibility for data processing\n- **Monitoring Support**: Real-time system performance tracking\n- **Flexible Options**: Combine flags for exactly what you need\n\n## Installation\n\n```bash\n# Basic installation\npip install syinfo\n\n# With network discovery features\npip install syinfo[network]\n\n# Full installation (all features)\npip install syinfo[full]\n```\n\n## Quick Start\n\n### Basic Usage\n\n```python\nimport syinfo\n\n# Get comprehensive system information\ninfo = syinfo.get_system_info()\nprint(f\"System: {info['system_name']}\")\nprint(f\"CPU: {info['cpu_model']} ({info['cpu_cores']} cores)\")\nprint(f\"Memory: {info['total_memory']} ({info['memory_usage_percent']:.1f}% used)\")\n```\n\n### Hardware Information\n\n```python\n# Get detailed hardware info\nhardware = syinfo.get_hardware_info()\n\nprint(\"CPU Information:\")\nprint(f\"  Model: {hardware['cpu']['model']}\")\nprint(f\"  Cores: {hardware['cpu']['cores_physical']} physical\")\nprint(f\"  Usage: {hardware['cpu']['usage_percent']:.1f}%\")\n\nprint(\"Memory Information:\")  \nprint(f\"  Total: {hardware['memory']['total']}\")\nprint(f\"  Available: {hardware['memory']['available']}\")\nprint(f\"  Usage: {hardware['memory']['usage_percent']:.1f}%\")\n```\n\n### Network Discovery\n\n```python\n# Discover devices on network\ndevices = syinfo.discover_network_devices(timeout=10)\nprint(f\"Found {len(devices)} devices:\")\n\nfor device in devices:\n    print(f\"  {device['ip']:15} - {device['hostname']} ({device['vendor']})\")\n```\n\n### System Monitoring (New!)\n\n```python\n# Create a simple system monitor  \nmonitor = syinfo.create_simple_monitor(interval=5)\n\n# Start monitoring for 60 seconds\nmonitor.start(duration=60)\nimport time\ntime.sleep(61)\nresults = monitor.stop()\n\nprint(f\"Average CPU Usage: {results['summary']['cpu_avg']:.1f}%\")\nprint(f\"Peak Memory Usage: {results['summary']['memory_peak']:.1f}%\")\nprint(f\"Data Points Collected: {results['total_points']}\")\n```\n\n## CLI Interface - Flag-Based Commands\n\n### Device Information\n```bash\n# Device/hardware information\nsyinfo -d\n\n# With JSON output\nsyinfo -dj | jq '.cpu_info.model'\n```\n\n### Network Operations\n```bash\n# Network information\nsyinfo -n -t 10          # Scan network for 10 seconds\n\n# Network with device info\nsyinfo -s -t 15          # Combined system info, 15-second network scan\n\n# JSON output for parsing\nsyinfo -nj -t 5 | jq '.network_devices | length'\n```\n\n### System Monitoring (New!)\n```bash\n# Monitor system for 30 seconds, 5-second intervals\nsyinfo -m -t 30 -i 5\n\n# JSON monitoring data\nsyinfo -mpj -t 60 -i 10 | tail -1 | jq '.summary'\n\n# Extract specific metrics\nsyinfo -mpj -t 120 -i 15 | tail -1 | jq -r '.summary.cpu_avg'\n\n# Continuous monitoring to file\nsyinfo -mpj -t 300 -i 30 | tail -1 > performance.json\n```\n\n### Advanced CLI Usage\n```bash\n# Disable output, just get JSON\nsyinfo -dpj > device_info.json\n\n# Network scan without vendor lookup (faster)\nsyinfo -noj -t 5\n\n# Monitor and process with jq\nsyinfo -mpj -t 60 -i 10 | tail -1 | jq '.data_points[].cpu_percent | max'\n\n# Complex monitoring workflows\nCPU_AVG=$(syinfo -mpj -t 30 -i 5 | tail -1 | jq -r '.summary.cpu_avg')\nif (( $(echo \"$CPU_AVG > 80\" | bc -l) )); then\n  echo \"High CPU usage detected: $CPU_AVG%\"\nfi\n```\n\n## CLI Flag Reference\n\n| Flag | Long Flag | Description |\n|------|-----------|-------------|\n| `-d` | `--device` | Show device/hardware information |\n| `-n` | `--network` | Show network information and scan devices |\n| `-s` | `--system` | Show combined device and network information |\n| `-m` | `--monitor` | **Start system monitoring** |\n| `-t` | `--time` | Duration in seconds (network scan or monitoring) |\n| `-i` | `--interval` | **Monitoring interval in seconds (default: 5)** |\n| `-p` | `--disable-print` | Suppress formatted output |\n| `-j` | `--return-json` | Output as JSON |\n| `-o` | `--disable-vendor-search` | Skip vendor lookup (faster network scans) |\n\n## System Monitoring Features\n\n### Real-time Performance Tracking\n- **CPU Usage**: Per-core and overall utilization\n- **Memory Statistics**: Usage, available, swap information\n- **Disk I/O**: Read/write operations and usage percentages\n- **Network Activity**: Bytes and packets sent/received\n\n### JSON Data Structure\n```json\n{\n  \"total_points\": 12,\n  \"data_points\": [\n    {\n      \"timestamp\": \"2025-09-14T02:20:42.029017\",\n      \"cpu_percent\": 7.8,\n      \"memory_percent\": 68.2,\n      \"disk_percent\": 82.8,\n      \"network_io\": {\n        \"bytes_sent\": 3301001170,\n        \"bytes_recv\": 4409283972,\n        \"packets_sent\": 3556700,\n        \"packets_recv\": 5418377\n      }\n    }\n  ],\n  \"summary\": {\n    \"duration_seconds\": 60,\n    \"cpu_avg\": 5.3,\n    \"cpu_max\": 8.3,\n    \"memory_avg\": 68.2,\n    \"memory_peak\": 68.4,\n    \"disk_avg\": 82.8,\n    \"start_time\": \"2025-09-14T02:20:42.029017\",\n    \"end_time\": \"2025-09-14T02:21:42.029017\"\n  }\n}\n```\n\n### Monitoring Use Cases\n```bash\n# Server performance monitoring\nsyinfo -mpj -t 3600 -i 60 | tail -1 > hourly_stats.json\n\n# Quick system check\nsyinfo -m -t 10 -i 2\n\n# CPU spike detection\nsyinfo -mpj -t 300 -i 5 | tail -1 | jq '.data_points[] | select(.cpu_percent > 90)'\n\n# Network throughput analysis\nsyinfo -mpj -t 120 -i 10 | tail -1 | jq '.data_points | [.[0], .[-1]] | .[1].network_io.bytes_sent - .[0].network_io.bytes_sent'\n```\n\n## Error Handling\n\n```python\nfrom syinfo.exceptions import SystemAccessError, DataCollectionError\n\ntry:\n    info = syinfo.get_system_info()\nexcept SystemAccessError as e:\n    print(f\"Permission error: {e}\")\nexcept DataCollectionError as e:\n    print(f\"Data collection failed: {e}\")\n```\n\n## Performance & Reliability\n\n### Benchmarks\n- **Data Collection**: < 2 seconds for complete system scan\n- **Memory Usage**: < 50MB peak memory consumption  \n- **Network Scan**: < 15 seconds for typical home network\n- **Monitoring Overhead**: < 1% CPU during continuous monitoring\n\n## Development\n\n### Setup\n```bash\ngit clone https://github.com/MR901/syinfo.git\ncd syinfo\npython -m venv venv\nsource venv/bin/activate  # or `venv\\Scripts\\activate` on Windows\npip install -e .[dev,full]\n```\n\n### Testing\n```bash\n# Run tests\npytest\n\n# Run with coverage\npytest --cov=syinfo --cov-report=html\n\n# Test monitoring functionality\npython -c \"import syinfo; m=syinfo.create_simple_monitor(1); m.start(5); import time; time.sleep(6); print(m.stop())\"\n```\n\n## Examples\n\nCheck out the [examples/](examples/) directory for comprehensive usage examples:\n- [API Usage](examples/api_example.py) - Python API examples\n- [CLI Examples](examples/cli_examples.py) - Command line usage\n- [Monitoring Examples](examples/monitoring_example.py) - System monitoring\n\n## Contributing\n\nWe welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.\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/MR901/syinfo/issues)  \n- **Email**: mohitrajput901@gmail.com\n- **GitHub**: [https://github.com/MR901/syinfo](https://github.com/MR901/syinfo)",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A comprehensive Python package for hardware, network, and software information gathering with advanced monitoring capabilities",
    "version": "0.2.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/MR901/syinfo/issues",
        "Changelog": "https://github.com/MR901/syinfo/blob/main/CHANGELOG.md",
        "Documentation": "https://syinfo.readthedocs.io",
        "Homepage": "https://github.com/MR901/syinfo",
        "Repository": "https://github.com/MR901/syinfo"
    },
    "split_keywords": [
        "analytics",
        " devops",
        " hardware",
        " information",
        " linux",
        " monitoring",
        " network",
        " performance",
        " system"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0d20c9d66ff2a8d62a30b6b1c0f8898a03eb9a816f01ba8abe6579ad12ac8b20",
                "md5": "7c7f3d3dc6f1f173a95410f8ee334ca6",
                "sha256": "d0bc9a0b02bb4f9968101fbc55e9b008e8b8c5547bcecc78782a4a1323a02d43"
            },
            "downloads": -1,
            "filename": "syinfo-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7c7f3d3dc6f1f173a95410f8ee334ca6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 30627,
            "upload_time": "2025-09-13T22:56:54",
            "upload_time_iso_8601": "2025-09-13T22:56:54.219499Z",
            "url": "https://files.pythonhosted.org/packages/0d/20/c9d66ff2a8d62a30b6b1c0f8898a03eb9a816f01ba8abe6579ad12ac8b20/syinfo-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c7965e6074a72b370b304da7b8365446597bec1b7743b37ccd7cf9a10c4fb4da",
                "md5": "b1d837237f9f47b54e28254ba7ba1f5f",
                "sha256": "5e82fa508d13abb8e157f81a534509a22ff65b406d824736a651625879f1db55"
            },
            "downloads": -1,
            "filename": "syinfo-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b1d837237f9f47b54e28254ba7ba1f5f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 950093,
            "upload_time": "2025-09-13T22:56:58",
            "upload_time_iso_8601": "2025-09-13T22:56:58.289360Z",
            "url": "https://files.pythonhosted.org/packages/c7/96/5e6074a72b370b304da7b8365446597bec1b7743b37ccd7cf9a10c4fb4da/syinfo-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-13 22:56:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MR901",
    "github_project": "syinfo",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "syinfo"
}
        
Elapsed time: 2.81757s