mirror of
https://github.com/ShaYmez/ezservermonitor-web.git
synced 2024-12-24 02:36:32 -05:00
3f6a49bae3
- Services : fix on service names with accent - Services : ability to specify a host for each service - Network usage : fix to retrieve the name of the network interfaces - Memory : the cached and buffers memory are added to free memory now - Load Average : taking into account the number of cores - Disk usage : new option to hide tmpfs mountpoints - General : remove all PHP short tags
30 lines
610 B
PHP
30 lines
610 B
PHP
<?php
|
|
require 'Utils/Misc.class.php';
|
|
|
|
// Free
|
|
if (!($free = shell_exec('/usr/bin/free -to | grep Mem: | awk \'{print $4+$6+$7}\'')))
|
|
{
|
|
$free = 0;
|
|
}
|
|
|
|
// Total
|
|
if (!($total = shell_exec('/usr/bin/free -to | grep Mem: | awk \'{print $2}\'')))
|
|
{
|
|
$total = 0;
|
|
}
|
|
|
|
// Used
|
|
$used = $total - $free;
|
|
|
|
// Percent used
|
|
$percent_used = 100 - (round($free / $total * 100));
|
|
|
|
|
|
$datas = array(
|
|
'used' => Misc::getSize($used * 1024),
|
|
'free' => Misc::getSize($free * 1024),
|
|
'total' => Misc::getSize($total * 1024),
|
|
'percent_used' => $percent_used,
|
|
);
|
|
|
|
echo json_encode($datas); |