Пример #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>";
}
Пример #2
0
function array_online(&$disk) {
  global $sum;
  if (is_numeric($disk['temp'])) {
    $sum['count']++;
    $sum['temp'] += $disk['temp'];
  }
  $sum['numReads'] += $disk['numReads'];
  $sum['numWrites'] += $disk['numWrites'];
  $sum['numErrors'] += $disk['numErrors'];
  if (isset($disk['fsFree'])) {
    $disk['fsUsed'] = $disk['fsSize']-$disk['fsFree'];
    $sum['fsSize'] += $disk['fsSize'];
    $sum['fsUsed'] += $disk['fsUsed'];
    $sum['fsFree'] += $disk['fsFree'];
  }
  echo "<tr>";
  switch ($disk['status']) {
  case 'DISK_NP':
//  Suppress empty slots to keep device list short (make this configurable?)
//  echo "<td>".device_info($disk)."</td>";
//  echo "<td colspan='9'>Not installed</td>";
//  echo "<td></td>";
    break;
  case 'DISK_OK_NP':
  case 'DISK_NP_DSBL':
    echo "<td>".device_info($disk)."</td>";
    echo "<td><em>Not installed</em></td>";
    echo "<td colspan='4'></td>";
    fs_info($disk);
    break;
  case 'DISK_DSBL':
  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>";
    fs_info($disk);
    break;
  }
  echo "</tr>";
}