mirror of
https://github.com/ShaYmez/ezservermonitor-web.git
synced 2024-11-16 05:11:55 -05:00
9970343fe5
General : responsive design General : reload button now spins when you reload block General : update jQuery plugin Knob to 1.2.11 General : optimizing security (config file esm.config.json is now in the conf/ folder with an htaccess) CPU : retrieves correctly CPU frequency for Raspberry Pi CPU : add CPU temperature (+ option to enable/disable) System : little correction for getting distro name Swap : fix if swap is disabled Services status : adds protocol TCP or UDP for checking service status Services status : new option to hide port number (see show_port in services section)
30 lines
560 B
PHP
30 lines
560 B
PHP
<?php
|
|
require '../autoload.php';
|
|
|
|
if (!($load_tmp = shell_exec('cat /proc/loadavg | awk \'{print $1","$2","$3}\'')))
|
|
{
|
|
$load = array(0, 0, 0);
|
|
}
|
|
else
|
|
{
|
|
// Number of cores
|
|
$cores = Misc::getCpuCoresNumber();
|
|
|
|
$load_exp = explode(',', $load_tmp);
|
|
|
|
$load = array_map(
|
|
function ($value, $cores) {
|
|
$v = (int)($value * 100 / $cores);
|
|
if ($v > 100)
|
|
$v = 100;
|
|
return $v;
|
|
},
|
|
$load_exp,
|
|
array_fill(0, 3, $cores)
|
|
);
|
|
}
|
|
|
|
|
|
$datas = $load;
|
|
|
|
echo json_encode($datas); |