Merge branch 'remastering' of https://gitea.steelants.cz/SH/PHP_SMART_HOME_V3 into remastering
This commit is contained in:
commit
38cc436f4d
@ -16,6 +16,13 @@ class Server extends Template
|
|||||||
return $meminfo;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$userManager = new UserManager();
|
$userManager = new UserManager();
|
||||||
@ -37,7 +44,7 @@ class Server extends Template
|
|||||||
$template->prepare('ip', $_SERVER['SERVER_ADDR']);
|
$template->prepare('ip', $_SERVER['SERVER_ADDR']);
|
||||||
$template->prepare('name', $_SERVER['SERVER_NAME']);
|
$template->prepare('name', $_SERVER['SERVER_NAME']);
|
||||||
|
|
||||||
$template->prepare('CPU', sys_getloadavg()[0]);
|
$template->prepare('CPU', $this->getProcessorUsage());
|
||||||
$template->prepare('ramFree', $this->getSystemMemInfo()["MemFree"]);
|
$template->prepare('ramFree', $this->getSystemMemInfo()["MemFree"]);
|
||||||
$template->prepare('ramTotal', $this->getSystemMemInfo()["MemTotal"]);
|
$template->prepare('ramTotal', $this->getSystemMemInfo()["MemTotal"]);
|
||||||
$template->prepare('diskFree', disk_free_space("/"));
|
$template->prepare('diskFree', disk_free_space("/"));
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
<label>SERVER ADDRESS: <?php echo $IP;?></label></br>
|
<label>SERVER ADDRESS: <?php echo $IP;?></label></br>
|
||||||
<hr>
|
<hr>
|
||||||
<label>CPU: <?php echo $CPU;?></label></br>
|
<label>CPU: <?php echo $CPU;?></label></br>
|
||||||
<label>CPU Usage: </label><progress value="<?php echo $CPU;?>" max="1"> <?php echo $RAMFREE;?> </progress></br>
|
<label>CPU Usage: </label><progress value="<?php echo $CPU;?>" max="100"> <?php echo $RAMFREE;?> </progress></br>
|
||||||
<hr>
|
<hr>
|
||||||
<label>RAM TOTAL: <?php echo $RAMTOTAL;?></label></br>
|
<label>RAM TOTAL: <?php echo $RAMTOTAL;?></label></br>
|
||||||
<label>RAM FREE: <?php echo $RAMFREE;?></label></br>
|
<label>RAM FREE: <?php echo $RAMFREE;?></label></br>
|
||||||
@ -49,5 +49,6 @@
|
|||||||
$partial->render();
|
$partial->render();
|
||||||
//TODO js do main.js
|
//TODO js do main.js
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user