mirror of
https://github.com/m1ngsama/tracker.git
synced 2025-12-24 10:51:43 +00:00
Initial commit: project structure and basic tracker
This commit is contained in:
commit
b25998e57b
4 changed files with 115 additions and 0 deletions
25
.gitignore
vendored
Normal file
25
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
.DS_Store
|
||||
31
README.md
Normal file
31
README.md
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Tracker
|
||||
|
||||
A comprehensive system monitoring tool for tracking various machine health metrics and performance indicators.
|
||||
|
||||
## Features
|
||||
|
||||
- CPU usage monitoring
|
||||
- Memory utilization tracking
|
||||
- Disk I/O statistics
|
||||
- Network traffic analysis
|
||||
- Process monitoring
|
||||
- Temperature sensors
|
||||
- System uptime tracking
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
python tracker.py
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python 3.8+
|
||||
- psutil
|
||||
- GPUtil (for GPU monitoring)
|
||||
3
requirements.txt
Normal file
3
requirements.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
psutil>=5.9.0
|
||||
GPUtil>=1.4.0
|
||||
requests>=2.28.0
|
||||
56
tracker.py
Normal file
56
tracker.py
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
System Tracker - Monitor machine health and performance
|
||||
"""
|
||||
|
||||
import psutil
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class SystemTracker:
|
||||
def __init__(self):
|
||||
self.start_time = time.time()
|
||||
|
||||
def get_cpu_usage(self):
|
||||
"""Get current CPU usage percentage"""
|
||||
return psutil.cpu_percent(interval=1)
|
||||
|
||||
def get_memory_info(self):
|
||||
"""Get memory usage statistics"""
|
||||
mem = psutil.virtual_memory()
|
||||
return {
|
||||
'total': mem.total,
|
||||
'available': mem.available,
|
||||
'percent': mem.percent,
|
||||
'used': mem.used
|
||||
}
|
||||
|
||||
def get_disk_usage(self):
|
||||
"""Get disk usage statistics"""
|
||||
disk = psutil.disk_usage('/')
|
||||
return {
|
||||
'total': disk.total,
|
||||
'used': disk.used,
|
||||
'free': disk.free,
|
||||
'percent': disk.percent
|
||||
}
|
||||
|
||||
def display_stats(self):
|
||||
"""Display all system statistics"""
|
||||
print(f"\n{'='*50}")
|
||||
print(f"System Tracker - {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
||||
print(f"{'='*50}\n")
|
||||
|
||||
print(f"CPU Usage: {self.get_cpu_usage()}%")
|
||||
|
||||
mem = self.get_memory_info()
|
||||
print(f"Memory: {mem['percent']}% ({mem['used'] / (1024**3):.2f}GB / {mem['total'] / (1024**3):.2f}GB)")
|
||||
|
||||
disk = self.get_disk_usage()
|
||||
print(f"Disk: {disk['percent']}% ({disk['used'] / (1024**3):.2f}GB / {disk['total'] / (1024**3):.2f}GB)")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
tracker = SystemTracker()
|
||||
tracker.display_stats()
|
||||
Loading…
Reference in a new issue