Exemplo n.º 1
0
$tblStorage->th(_('Free'), 'class=colheader');
$tblStorage->th(_('Used'), 'class=colheader');
$tblStorage->th(_('Total'), 'class=colheader');
$tblStorage->th(_('Usage %'), 'class=colheader');
$tblStorage->th(_('Services'), 'class=colheader');
//
// section body
$tblStorage->tbody();
// list configured devices
if (isset($cfgPtr['fsmounts'])) {
    foreach (array_keys($cfgPtr['fsmounts']) as $mntNode) {
        if (!is_array($cfgPtr['fsmounts'][$mntNode])) {
            continue;
        }
        //
        $fsInfo = getDevByUuid($disksInfo, $cfgPtr['fsmounts'][$mntNode]['uuid']);
        $devText = '';
        if ($fsInfo !== false) {
            $devText = basename("{$fsInfo[0]}{$fsInfo[1]}");
        }
        $tblStorage->tr();
        // device/partition
        $tblStorage->td($devText);
        // filesystem label
        $tblStorage->td($cfgPtr['fsmounts'][$mntNode]['label']);
        // mount point
        $tblStorage->td("{$cfgPtr['mountroot']}/{$mntNode}");
        // size/usage/...
        $fsFree = '';
        $fsUsed = '';
        $fsTotal = '';
Exemplo n.º 2
0
 $disksInfo = getBlockDevices(true);
 getDiskUsage($disksInfo);
 $storageReport = '';
 foreach (array_keys($config['system']['storage']['fsmounts']) as $mntNode) {
     if (!is_array($config['system']['storage']['fsmounts'][$mntNode])) {
         continue;
     }
     //
     if ($config['system']['storage']['fsmounts'][$mntNode]['active'] != 1) {
         // disabled entry, only report active devices status
         continue;
     }
     // TODO: also report alerts about disks autodisabled at boot time because of errors
     //
     $fsUuid = $config['system']['storage']['fsmounts'][$mntNode]['uuid'];
     $fsInfo = getDevByUuid($disksInfo, $fsUuid);
     $hwName = '';
     if (isset($disksInfo[$fsInfo[0]]['info']) && !empty($disksInfo[$fsInfo[0]]['info'])) {
         $hwName = "{$disksInfo[$fsInfo[0]]['info']} / ";
     }
     if ($fsInfo !== false) {
         if (isset($disksInfo[$fsInfo[0]]['parts'][$fsInfo[1]]['blocks-total'])) {
             $fsBlocksTotal = $disksInfo[$fsInfo[0]]['parts'][$fsInfo[1]]['blocks-total'];
             $fsBlocksUsed = $disksInfo[$fsInfo[0]]['parts'][$fsInfo[1]]['blocks-used'];
             //
             $storageReport .= basename("{$fsInfo[0]}{$fsInfo[1]}");
             $storageReport .= ' (' . $disksInfo[$fsInfo[0]]['info'] . ')<br>';
             // units of 1024 bytes blocks
             $storageReport .= _('Free') . ': ' . formatBytes($fsBlocksTotal * 1024 - $fsBlocksUsed * 1024) . ' ';
             $storageReport .= _('Used') . ': ' . formatBytes($fsBlocksUsed * 1024) . ' ';
             $storageReport .= _('Total') . ': ' . formatBytes($fsBlocksTotal * 1024);