load=sys_getloadavg(); else $info->load=array(rand(0, 4), rand(0, 4), rand(0, 4)); $data=explode("\n", trim(file_get_contents("/proc/meminfo"))); $memInfo=array(); foreach ($data as $line) { list($key, $val)=explode(":", $line); $memInfo[$key]=explode(" ", trim($val))[0]; } $info->memFree=$memInfo['MemFree']; $info->memTotal=$memInfo['MemTotal']; $info->memUsage=(($memInfo['MemTotal']-$memInfo['MemFree'])/$memInfo['MemTotal'])*100; $cpuTemp=(int)file_get_contents("/sys/class/thermal/thermal_zone0/temp"); $info->cpuTemp=$cpuTemp/1000; return json_encode($info); } public function GetProcesses() { $lines=array(); exec("ps aux", $lines); if (count($lines)==0) { $output=file_get_contents("/ps.txt"); $output=htmlspecialchars($output); $lines=explode("\n", $output); } $header=preg_split('/\s+/', $lines[0]); for ($i=0; $idays=$matches[1]; $obj->hours=$matches[2]; $obj->minutes=$matches[3]; return json_encode($obj); } }