-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo_phase6.py
More file actions
66 lines (57 loc) · 1.7 KB
/
Copy pathdemo_phase6.py
File metadata and controls
66 lines (57 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"""
Quick demo of Phase 6 diagnostic functions.
Run with: python demo_phase6.py
"""
from tools.diagnostics_tools import (
get_cpu_usage,
get_ram_usage,
get_disk_usage,
get_system_health,
check_health_alerts,
scan_cleanup_files,
)
print("="*60)
print("PHASE 6 DIAGNOSTICS DEMO")
print("="*60)
# 1. CPU Usage
print("\n1. CPU Usage:")
cpu = get_cpu_usage()
print(f" CPU: {cpu['cpu_percent']}%")
print(f" Cores: {cpu['cpu_count']}")
# 2. RAM Usage
print("\n2. RAM Usage:")
ram = get_ram_usage()
print(f" Used: {ram['used_gb']}GB / {ram['total_gb']}GB")
print(f" Usage: {ram['percent']}%")
# 3. Disk Usage
print("\n3. Disk Usage:")
disk = get_disk_usage("C:")
print(f" Used: {disk['used_gb']}GB / {disk['total_gb']}GB")
print(f" Usage: {disk['percent']}%")
# 4. System Health
print("\n4. System Health Check:")
health = get_system_health()
print(f" Timestamp: {health['timestamp']}")
print(f" CPU: {health['cpu']['cpu_percent']}%")
print(f" RAM: {health['ram']['percent']}%")
print(f" Disk: {health['disk']['percent']}%")
# 5. Health Alerts
print("\n5. Health Alerts:")
alerts = check_health_alerts()
print(f" Status: {alerts['overall_status'].upper()}")
if alerts['alerts']:
for alert in alerts['alerts']:
print(f" - [{alert['severity']}] {alert['message']}")
else:
print(" ✅ System is healthy!")
# 6. Cleanup Scan (Safe)
print("\n6. Cleanup Scan (Test Folder):")
cleanup = scan_cleanup_files("test_cleanup")
if "error" not in cleanup:
print(f" Files found: {cleanup['file_count']}")
print(f" Total size: {cleanup['total_size_mb']}MB")
else:
print(f" {cleanup['error']}")
print("\n" + "="*60)
print("✅ All diagnostic functions working!")
print("="*60)