Beispiel #1
0
function array_online($disk) {
  global $display, $temps, $counts, $tot_size, $tot_used, $tot_free, $reads, $writes, $errors;
  if (is_numeric($disk['temp'])) {
    $temps += $disk['temp'];
    $counts++;
  }
  $reads += $disk['numReads'];
  $writes += $disk['numWrites'];
  $errors += $disk['numErrors'];
  if (isset($disk['fsFree']) && $disk['name']!='parity') {
    $disk['fsUsed'] = $disk['fsSize'] - $disk['fsFree'];
    $tot_size += $disk['fsSize'];
    $tot_free += $disk['fsFree'];
    $tot_used += $disk['fsUsed'];
  }
  echo "<tr>";
  switch ($disk['status']) {
  case "DISK_NP":
//  Suppress empty slots to keep device list short
//  this actually should be configurable
//  echo "<td>".device_info($disk)."</td>";
//  echo "<td colspan='9'>Not installed</td>";
//  echo "<td></td>";
    break;
  case "DISK_OK_NP":
    echo "<td>".device_info($disk)."</td>";
    echo "<td>Not Installed</td>";
    echo "<td colspan='4'></td>";
    render_used_and_free($disk);
    echo "<td>".device_browse($disk)."</td>";
    break;
  case "DISK_NP_DSBL":
    echo "<td>".device_info($disk)."</td>";
    if ($disk['name']=="parity") {
      echo "<td>Not installed</td>";
      echo "<td colspan='9'></td>";
    } else {
      echo "<td><em>Not installed</em></td>";
      echo "<td colspan='4'></td>";
      render_used_and_free($disk);
      echo "<td>".device_browse($disk)."</td>";
    }
    break;
  case "DISK_DSBL":
    echo "<td>".device_info($disk)."</td>";
    echo "<td>".device_desc($disk)."</td>";
    echo "<td>".my_temp($disk['temp'])."</td>";
    echo "<td>".my_number($disk['numReads'])."</td>";
    echo "<td>".my_number($disk['numWrites'])."</td>";
    echo "<td>".my_number($disk['numErrors'])."</td>";
    if ($disk['name']=="parity") {
      echo "<td colspan='5'></td>";
    } else {
      render_used_and_free($disk);
      echo "<td>".device_browse($disk)."</td>";
    }
    break;
  default:
    echo "<td>".device_info($disk)."</td>";
    echo "<td>".device_desc($disk)."</td>";
    echo "<td>".my_temp($disk['temp'])."</td>";
    echo "<td>".my_number($disk['numReads'])."</td>";
    echo "<td>".my_number($disk['numWrites'])."</td>";
    echo "<td>".my_number($disk['numErrors'])."</td>";
    render_used_and_free($disk);
    echo "<td>".device_browse($disk)."</td>";
    break;
  }
  echo "</tr>";
}
Beispiel #2
0
function fs_info(&$disk) {
  global $display;
  if ($disk['name']=='parity' || $disk['fsStatus']=='-') {
    echo "<td colspan='5'></td>";
    return;
  } else if ($disk['fsStatus']=='Mounted') {
    echo "<td>{$disk['fsType']}</td>";
    echo "<td>".my_scale($disk['fsSize']*1024,$unit)." $unit</td>";
    if ($display['text']%10==0) {
      echo "<td>".my_scale($disk['fsUsed']*1024,$unit)." $unit</td>";
    } else {
      $used = $disk['fsSize'] ? 100-round(100*$disk['fsFree']/$disk['fsSize']) : 0;
      echo "<td><div class='usage-disk'><span style='margin:0;width:$used%' class='".usage_color($disk,$used,false)."'><span>".my_scale($disk['fsUsed']*1024,$unit)." $unit</span></span></div></td>";
    }
    if ($display['text']<10 ? $display['text']%10==0 : $display['text']%10!=0) {
      echo "<td>".my_scale($disk['fsFree']*1024,$unit)." $unit</td>";
    } else {
      $free = $disk['fsSize'] ? round(100*$disk['fsFree']/$disk['fsSize']) : 0;
      echo "<td><div class='usage-disk'><span style='margin:0;width:$free%' class='".usage_color($disk,$free,true)."'><span>".my_scale($disk['fsFree']*1024,$unit)." $unit</span></span></div></td>";
    }
  } else
    echo "<td colspan='2'></td><td>{$disk['fsStatus']}</td><td></td>";
  echo "<td>".device_browse($disk)."</td>";
}