Minor Tweeks

This commit is contained in:
GamerClassN7
2020-10-31 21:37:29 +01:00
parent f205df36ff
commit 8a00190850
7 changed files with 44 additions and 18 deletions

View File

@@ -12,16 +12,24 @@ class ServerApi extends ApiController {
return $meminfo;
}
private function getProcessorUsage(){
$loads=sys_getloadavg();
$core_nums=trim(shell_exec("grep -P '^physical id' /proc/cpuinfo|wc -l"));
$load = round($loads[0]/($core_nums + 1)*100, 2);
return $load;
}
public function default(){
//$this->requireAuth();
$response = [
"cpu_load" => sys_getloadavg()[0],
"cpu_load" => $this->getProcessorUsage(),
"uptime" => shell_exec('uptime -p'),
"ramFree" => $this->getSystemMemInfo()["MemFree"],
"ramTotal" => $this->getSystemMemInfo()["MemTotal"],
"diskFree" => disk_free_space("/"),
"diskTotal" => disk_total_space("/"),
"serverTime" => date('m. d. Y H:i:s - e'),
"serverTime" => date('m. d. Y H:i:s'),
"serverTimeZone" => date('e'),
];
$this->response($response);
}