diff --git a/routes_system.py b/routes_system.py index 5d67b97..1738a2b 100644 --- a/routes_system.py +++ b/routes_system.py @@ -6,7 +6,7 @@ import os import subprocess import time -from flask import jsonify +from datetime import datetime from utils import log_message, get_cpu_temperatures, load_alert_config try: @@ -82,10 +82,15 @@ def register_system_routes(app): return jsonify({ 'available': True, + 'system': { + 'uptime': uptime_str, + 'boot_time': datetime.fromtimestamp(boot_time).strftime('%Y-%m-%d %H:%M:%S'), + 'process_count': process_count + }, 'cpu': { 'percent': cpu_percent, - 'count_physical': cpu_count, - 'count_logical': cpu_count_logical, + 'count': cpu_count, + 'logical': cpu_count_logical, 'temp_package_0': cpu_temps.get('package_0'), 'temp_package_1': cpu_temps.get('package_1') }, @@ -98,14 +103,15 @@ def register_system_routes(app): 'disk': { 'total_gb': disk_total_gb, 'used_gb': disk_used_gb, + 'free_gb': round(disk.free / (1024**3), 2), 'percent': disk_percent }, 'network': { - 'upload_speed_kb': round(upload_speed, 2), - 'download_speed_kb': round(download_speed, 2) - }, - 'process_count': process_count, - 'uptime': uptime_str + 'sent_mb': round(net.bytes_sent / (1024**2), 2), + 'recv_mb': round(net.bytes_recv / (1024**2), 2), + 'sent_speed': round(upload_speed, 2), + 'recv_speed': round(download_speed, 2) + } }) except Exception as e: return jsonify({'error': str(e)}), 500