Metadata-Version: 2.4
Name: monitor-bt
Version: 0.1.0
Summary: A lightweight server monitoring CLI tool
Author-email: "M.Bashar Sheikh" <bashartc13@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/bashartech/System-Monitor-Cli-Tool
Project-URL: Repository, https://github.com/bashartech/System-Monitor-Cli-Tool
Project-URL: Issues, https://github.com/bashartech/System-Monitor-Cli-Tool
Keywords: monitoring,server,cli,cpu,memory,devops
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: System :: Monitoring
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: psutil>=5.9
Requires-Dist: rich>=13.0
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"

# monitor-bt

A lightweight server monitoring CLI tool built with Python. Monitor CPU, memory, disk, network, processes, and more — all from your terminal.

## Installation

```bash
pip install monitor-bt
```

## Usage

### System Overview

```bash
monitor-bt status
```

```
                 Server Status
+---------------------------------------------+
| Metric       | Value                        |
|--------------+------------------------------|
| CPU Usage    | 23.4%                        |
| CPU Cores    | 8                            |
| RAM Usage    | 61.2%                        |
| RAM Total    | 15.9 GB                      |
| RAM Used     | 9.7 GB                       |
| RAM Free     | 6.2 GB                       |
| Disk (C:\)   | 54.3%  [121.0 GB / 223.0 GB]|
| Network Down | 1.2 MB/s                     |
| Network Up   | 256.0 KB/s                   |
| Uptime       | 3d 14h 22m                   |
| Processes    | 214                          |
+---------------------------------------------+
```

### CPU Details

```bash
monitor-bt cpu
```

Shows overall usage, per-core breakdown, core count, and frequency.

### Memory Details

```bash
monitor-bt memory
```

Shows total, used, free, available RAM, and swap usage.

### Disk Details

```bash
monitor-bt disk
```

Lists all disk partitions with total, used, free, and usage percentage.

Check a specific path:

```bash
monitor-bt disk --path /home
```

### Network Statistics

```bash
monitor-bt network
```

Shows total data transferred, current download/upload speed, packet counts, and IP addresses per interface.

### Top Processes

```bash
monitor-bt processes
monitor-bt processes --top 20
```

Lists processes sorted by memory usage, similar to Task Manager.

### Kill a Process

```bash
monitor-bt kill 3425
```

Kills the process with the given PID.

### System Uptime

```bash
monitor-bt uptime
```

### System Information

```bash
monitor-bt sysinfo
```

Shows OS, hostname, Python version, CPU model, core count, and temperature sensors.

### Live Dashboard

```bash
monitor-bt watch
monitor-bt watch --interval 1
```

Real-time refreshing dashboard showing CPU, RAM, disk, and network. Press `Ctrl+C` to stop.

### Docker Containers

```bash
monitor-bt docker
```

Lists all Docker containers with their status and image.

### View Logs

```bash
monitor-bt logs
monitor-bt logs --lines 50
```

Reads recent entries from today's monitoring log.

### Export Metrics

```bash
monitor-bt export report.json
monitor-bt export report.csv
```

Exports current system metrics to a JSON or CSV file.

## Project Structure

```
monitor-bt/
├── app/
│   ├── __init__.py
│   ├── main.py                  # CLI entry point (typer app)
│   ├── commands/                # One file per CLI command
│   │   ├── status.py
│   │   ├── cpu.py
│   │   ├── memory.py
│   │   ├── disk.py
│   │   ├── network.py
│   │   ├── processes.py
│   │   ├── kill.py
│   │   ├── uptime.py
│   │   ├── watch.py
│   │   ├── docker_cmd.py
│   │   ├── logs.py
│   │   └── export_cmd.py
│   ├── collectors/              # Data collection (psutil wrappers)
│   │   ├── cpu.py
│   │   ├── memory.py
│   │   ├── disk.py
│   │   ├── network.py
│   │   ├── process.py
│   │   └── system.py
│   ├── services/                # Business logic
│   │   ├── monitoring.py        # Parallel collection with ThreadPoolExecutor
│   │   ├── alerts.py            # Threshold-based alerts
│   │   └── logger.py            # File-based metric logging
│   └── utils/
│       ├── display.py           # Rich tables, progress bars, panels
│       └── config.py            # Default thresholds and paths
├── logs/                        # Auto-generated daily log files
├── tests/                       # Unit tests with mocked psutil
├── pyproject.toml
└── README.md
```

## Architecture

```
CLI Commands (typer)
       │
       ▼
  Services Layer
  ├── monitoring.py   ← ThreadPoolExecutor runs collectors in parallel
  ├── alerts.py       ← Checks metrics against thresholds
  └── logger.py       ← Writes metrics to daily log files
       │
       ▼
  Collectors (psutil)
  ├── cpu.py
  ├── memory.py
  ├── disk.py
  ├── network.py
  ├── process.py
  └── system.py
```

## Development

### Install in editable mode

```bash
git clone https://github.com/yourusername/monitor-bt.git
cd monitor-bt
pip install -e ".[dev]"
```

### Run tests

```bash
pytest tests/ -v
```

### Run with coverage

```bash
pytest tests/ --cov=app
```

## Dependencies

| Library   | Purpose                              |
|-----------|--------------------------------------|
| psutil    | System metrics (CPU, RAM, disk, etc) |
| rich      | Terminal UI (tables, panels, colors) |
| typer     | CLI framework                        |

## License

MIT
