mirror of
https://github.com/ShaYmez/ezservermonitor-web.git
synced 2024-12-20 08:31:08 -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
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
require 'Utils/Misc.class.php';
|
|
require 'Utils/Config.class.php';
|
|
$Config = new Config();
|
|
|
|
$datas = array();
|
|
|
|
if (!(exec('/bin/df -T | tail -n +2 | awk \'{print $2","$3","$4","$5","$6","$7}\'', $df)))
|
|
{
|
|
$datas[] = array(
|
|
'total' => 'N.A',
|
|
'used' => 'N.A',
|
|
'free' => 'N.A',
|
|
'percent_used' => 0,
|
|
'mount' => 'N.A',
|
|
);
|
|
}
|
|
else
|
|
{
|
|
$mounted_points = array();
|
|
|
|
foreach ($df as $mounted)
|
|
{
|
|
list($type, $total, $used, $free, $percent, $mount) = explode(',', $mounted);
|
|
|
|
if (strpos($type, 'tmpfs') !== false && $Config->get('disk:show_tmpfs') === false)
|
|
continue;
|
|
|
|
if (!in_array($mount, $mounted_points))
|
|
{
|
|
$mounted_points[] = trim($mount);
|
|
|
|
$datas[] = array(
|
|
'total' => Misc::getSize($total * 1024),
|
|
'used' => Misc::getSize($used * 1024),
|
|
'free' => Misc::getSize($free * 1024),
|
|
'percent_used' => trim($percent, '%'),
|
|
'mount' => $mount,
|
|
);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
echo json_encode($datas); |