[ 'timeout' => 10, 'header' => 'Accept: application/json' ] ]); $json_data = @file_get_contents($api_url, false, $context); $data = json_decode($json_data, true); } if (!$data || !isset($data['success']) || !$data['success']) { die('
Error: Unable to fetch server statistics

API URL attempted: ' . htmlspecialchars($api_url) . '
'); } // Extract key metrics $overview = $data['overview'] ?? []; $health = $data['health'] ?? []; $server = $data['server'] ?? []; $cpu = $data['cpu'] ?? []; $memory = $data['memory'] ?? []; $disk = $data['disk'] ?? []; $network = $data['network'] ?? []; $services = $data['services'] ?? []; $maintenance = $data['maintenance'] ?? []; $load = $data['load'] ?? []; // Format values $cpu_percent = round($overview['cpu_percent'] ?? 0, 1); $ram_percent = round($overview['ram_percent'] ?? 0, 1); $disk_percent = round($overview['disk_percent'] ?? 0, 1); $health_score = $health['score'] ?? 0; $health_status = $health['status'] ?? 'unknown'; $uptime = $overview['uptime'] ?? 'N/A'; $download_speed = $overview['download'] ?? '0 B/s'; $upload_speed = $overview['upload'] ?? '0 B/s'; $services_running = $overview['services_running'] ?? 0; $services_failed = $overview['services_failed'] ?? 0; $reboot_required = $overview['reboot_required'] ?? false; $updates_available = $overview['updates_available'] ?? 0; // Memory breakdown $total_mem = $memory['total_human'] ?? '0 GB'; $used_mem = $memory['used_human'] ?? '0 GB'; $free_mem = $memory['free_human'] ?? '0 GB'; $cached_mem = $memory['cached_human'] ?? '0 GB'; $buffers_mem = $memory['buffers_human'] ?? '0 MB'; // Disk info $root_disk = $disk['root'] ?? []; $disk_total = $root_disk['total_human'] ?? '0 GB'; $disk_used = $root_disk['used_human'] ?? '0 GB'; $disk_free = $root_disk['free_human'] ?? '0 GB'; // CPU cores $cpu_cores = $cpu['cores'] ?? 4; $per_core = $cpu['per_core'] ?? []; $core_count = count($per_core); // Network traffic $net_download_bps = $network['live']['download_bytes_per_second'] ?? 0; $net_upload_bps = $network['live']['upload_bytes_per_second'] ?? 0; // Load averages $load_1 = $load['1_min'] ?? 0; $load_5 = $load['5_min'] ?? 0; $load_15 = $load['15_min'] ?? 0; // Failed services $failed_services = $maintenance['failed_service_list'] ?? []; // Generate core usage array for chart $core_usage_values = []; foreach ($per_core as $core_id => $core_data) { $core_usage_values[] = round($core_data['usage_percent'] ?? 0, 1); } // Calculate memory composition percentages $total_mem_bytes = $memory['total_bytes'] ?? 1; $used_pct = round(($memory['used_bytes'] ?? 0) / $total_mem_bytes * 100, 1); $cached_pct = round(($memory['cached_bytes'] ?? 0) / $total_mem_bytes * 100, 1); $buffers_pct = round(($memory['buffers_bytes'] ?? 0) / $total_mem_bytes * 100, 1); $free_pct = round(($memory['free_bytes'] ?? 0) / $total_mem_bytes * 100, 1); // Helper function to generate historical data function generateHistory($base, $variance, $points=40) { $data = []; for($i=0; $i<$points; $i++) { $data[] = max(0, min(100, $base + ((rand() / getrandmax()) - 0.5) * $variance)); } return $data; } ?>
Dashboard/
Live
Admin
Super Administrator
Network Traffic
Download
Upload
Total Received
Total Transmitted
Avg Download
Avg Upload
Disk Space Usage
%Used
Used Space
%
Free Space
%
Total Space
Filesystem Breakdown
%
CPU Load
Average Load%
Cores
Model
Memory Usage
Used Memory
Total Memory
Usage%