A real-time terminal dashboard for monitoring system processes and resource usage. Provides a live, updating view of CPU, memory, disk, network, and running processes—all within your terminal.
Key features:
./scripts/main.py dashboard
./scripts/main.py dashboard --interval 3
./scripts/main.py snapshot
./scripts/main.py top --by cpu --limit 10
./scripts/main.py top --by memory --limit 10
./scripts/main.py monitor --pid 1234
./scripts/main.py help
dashboard: Start interactive real‑time dashboard--interval: Refresh interval in seconds (default: 2)--simple: Simplified view (no per‑core/disk details)--log: Also write metrics to a log filesnapshot: Print a one‑time system snapshot--json: Output as JSON for scriptingtop: Show top processes--by: Sort by cpu, memory, disk, name (default: cpu)--limit: Number of processes to show (default: 10)--user: Filter by username--json: Output as JSONmonitor: Monitor a specific process--pid: Process ID to monitor (required)--interval: Refresh interval (default: 2)--watch: Watch for process creation/terminationstats: Show system‑wide statistics--cpu: CPU details only--memory: Memory details only--disk: Disk details only--network: Network details only--json: Output as JSONalert: Check for resource alerts--threshold-cpu: CPU alert threshold % (default: 90)--threshold-memory: Memory alert threshold % (default: 85)--threshold-disk: Disk alert threshold % (default: 90)─────────────────────────────────────────────────────
System Monitor | Refresh: 2s | 2026‑03‑16 10:30:00 UTC
─────────────────────────────────────────────────────
CPU: ███████░░░ 72% Memory: █████████░ 92% (8.2/12 GB)
Core 0: 65% Core 1: 78% Core 2: 70% Core 3: 75%
Top Processes (by CPU):
PID USER CPU% MEM% COMMAND
1234 alice 45.2 12.3 python3 /app/server.py
5678 bob 22.1 5.8 /usr/bin/node index.js
9101 root 10.5 0.3 systemd-journal
Disk: / █████░░░░ 52% free Network: ▲ 1.2 MB/s ▼ 4.5 MB/s
─────────────────────────────────────────────────────
--json):{
"timestamp": "2026-03-16T10:30:00Z",
"cpu": {
"total_percent": 72.5,
"per_core": [65.2, 78.1, 70.3, 75.0],
"load_average": [1.2, 1.5, 1.8]
},
"memory": {
"total_gb": 12.0,
"used_gb": 8.2,
"percent": 68.3,
"swap_used_gb": 0.5
},
"processes": [
{"pid": 1234, "name": "python3", "cpu_percent": 45.2, "memory_percent": 12.3}
]
}
Requires Python 3.6+ and psutil library. Install with:
pip install psutil
On most systems, psutil is available via package managers:
# Debian/Ubuntu
sudo apt install python3-psutil
# RHEL/CentOS
sudo yum install python3-psutil
# macOS
brew install psutil
ps/top)./scripts/main.py dashboard
./scripts/main.py dashboard --simple --interval 3
./scripts/main.py snapshot --json > system.json
./scripts/main.py top --by memory --limit 5
./scripts/main.py monitor --pid $(pgrep -f "nginx") --interval 5
./scripts/main.py alert --threshold-cpu 95 --threshold-memory 90
共 1 个版本