0 ? round(($load[0] / $cores) * 100, 1) : 0; if($cpu > 100) $cpu = 100; $memInfo = shell_exec('free -m | grep Mem'); preg_match_all('/\d+/', $memInfo, $m); $memTotal = (int)$m[0][0]; $memUsed = (int)$m[0][1]; $ram = $memTotal > 0 ? round(($memUsed / $memTotal) * 100, 1) : 0; $disk = (float)trim(shell_exec("df / | tail -1 | awk '{print $5}' | tr -d '%'")); echo json_encode(['cpu'=>$cpu,'ram'=>$ram,'storage'=>round($disk,1)]);