From 01de338a65ed70e4e48422cc5e69e49568cfc643 Mon Sep 17 00:00:00 2001 From: MacRimi Date: Thu, 23 Oct 2025 09:59:27 +0200 Subject: [PATCH] Update AppImage --- AppImage/components/node-metrics-charts.tsx | 20 +++++++++-- AppImage/scripts/flask_server.py | 40 +++++++++++++++++---- 2 files changed, 51 insertions(+), 9 deletions(-) diff --git a/AppImage/components/node-metrics-charts.tsx b/AppImage/components/node-metrics-charts.tsx index 3ab89fe..50ef507 100644 --- a/AppImage/components/node-metrics-charts.tsx +++ b/AppImage/components/node-metrics-charts.tsx @@ -121,13 +121,29 @@ export function NodeMetricsCharts() { memoryZfsArc: item.zfsarc ? Number((item.zfsarc / 1024 / 1024 / 1024).toFixed(2)) : 0, } - if (index === 0) { - console.log("[v0] First transformed data point:", transformed) + if (index < 5 || index === result.data.length - 1) { + console.log(`[v0] Data point ${index}:`, { + rawCpu: item.cpu, + transformedCpu: transformed.cpu, + rawLoad: item.loadavg, + transformedLoad: transformed.load, + }) } return transformed }) + const cpuValues = transformedData.map((d) => d.cpu) + const minCpu = Math.min(...cpuValues) + const maxCpu = Math.max(...cpuValues) + const avgCpu = cpuValues.reduce((a, b) => a + b, 0) / cpuValues.length + console.log("[v0] CPU Statistics:", { + min: minCpu, + max: maxCpu, + avg: avgCpu.toFixed(2), + sampleSize: cpuValues.length, + }) + console.log("[v0] Total transformed data points:", transformedData.length) console.log("[v0] Setting data state with", transformedData.length, "points") diff --git a/AppImage/scripts/flask_server.py b/AppImage/scripts/flask_server.py index 05876ee..6e1e391 100644 --- a/AppImage/scripts/flask_server.py +++ b/AppImage/scripts/flask_server.py @@ -743,6 +743,11 @@ def get_storage_info(): 'critical_disks': 0 } +# Define get_disk_hardware_info (stub for now, will be replaced by lsblk parsing) +def get_disk_hardware_info(disk_name): + """Placeholder for disk hardware info - to be populated by lsblk later.""" + return {} + def get_smart_data(disk_name): """Get SMART data for a specific disk - Enhanced with multiple device type attempts""" smart_data = { @@ -3269,11 +3274,33 @@ def get_hardware_info(): except Exception as e: print(f"[v0] Error getting memory info: {e}") - storage_info = get_storage_info() - for device in storage_info.get('disks', []): - hw_info = get_disk_hardware_info(device['name']) - device.update(hw_info) - hardware_data['storage_devices'] = storage_info.get('disks', []) + # Commented out get_disk_hardware_info call as function doesn't exist + # storage_info = get_storage_info() + # for device in storage_info.get('disks', []): + # hw_info = get_disk_hardware_info(device['name']) + # device.update(hw_info) + # hardware_data['storage_devices'] = storage_info.get('disks', []) + + # Storage Devices - simplified version without hardware info + try: + result = subprocess.run(['lsblk', '-J', '-o', 'NAME,SIZE,TYPE,MOUNTPOINT,MODEL'], + capture_output=True, text=True, timeout=5) + if result.returncode == 0: + import json + lsblk_data = json.loads(result.stdout) + storage_devices = [] + for device in lsblk_data.get('blockdevices', []): + if device.get('type') == 'disk': + storage_devices.append({ + 'name': device.get('name', ''), + 'size': device.get('size', ''), + 'model': device.get('model', 'Unknown'), + 'type': device.get('type', 'disk') + }) + hardware_data['storage_devices'] = storage_devices + print(f"[v0] Storage devices: {len(storage_devices)} found") + except Exception as e: + print(f"[v0] Error getting storage info: {e}") # Graphics Cards (from lspci - will be duplicated by new PCI device listing, but kept for now) try: @@ -4078,8 +4105,7 @@ def api_notifications_download(): if result.returncode == 0: import tempfile with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.log') as f: - f.write(f"ProxMenux Log - Notification around: {timestamp}\n") - f.write(f"Time Window: {since_time} to {until_time}\n") + f.write(f"ProxMenux Log ({log_type}, since {since_days if since_days else f'{hours}h'}) - Generated: {datetime.now().isoformat()}\n") f.write("=" * 80 + "\n\n") f.write(result.stdout) temp_path = f.name