2014-06-18 04:11:11 -04:00
|
|
|
<?php
|
|
|
|
require 'Utils/Misc.class.php';
|
2014-06-18 04:15:18 -04:00
|
|
|
require 'Utils/Config.class.php';
|
|
|
|
$Config = new Config();
|
2014-06-18 04:11:11 -04:00
|
|
|
|
|
|
|
$datas = array();
|
|
|
|
|
2014-10-20 18:08:49 -04:00
|
|
|
if (!(exec('/bin/df -T | awk -v c=`/bin/df -T | grep -bo "Type" | awk -F: \'{print $1}\'` \'{print substr($0,c);}\' | tail -n +2 | awk \'{print $1","$2","$3","$4","$5","$6}\'', $df)))
|
2014-06-18 04:11:11 -04:00
|
|
|
{
|
|
|
|
$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)
|
|
|
|
{
|
2014-06-18 04:15:18 -04:00
|
|
|
list($type, $total, $used, $free, $percent, $mount) = explode(',', $mounted);
|
2014-06-18 04:11:11 -04:00
|
|
|
|
2014-06-18 04:15:18 -04:00
|
|
|
if (strpos($type, 'tmpfs') !== false && $Config->get('disk:show_tmpfs') === false)
|
|
|
|
continue;
|
2014-06-18 04:11:11 -04:00
|
|
|
|
|
|
|
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);
|