echo "<table class='usb_disks'><thead><tr><td>Device</td><td>Identification</td><td></td><td>Temp</td><td>FS</td><td>Size</td><td>Used</td><td>Free</td><td>Open files</td><td>Auto mount</td><td>Script</td></tr></thead>";
 echo "<tbody>";
 if (count($disks)) {
     $odd = "odd";
     foreach ($disks as $disk) {
         echo "<tr class='{$odd}'>";
         printf("<td><img src='/webGui/images/%s'> %s</td>", is_disk_running($disk['device']) ? "green-on.png" : "green-blink.png", basename($disk['device']));
         $disk_mounted = false;
         foreach ($disk['partitions'] as $p) {
             if (is_mounted($p['device'])) {
                 $disk_mounted = TRUE;
             }
         }
         $m_button = "<td><span style='width:auto;text-align:right;'>" . ($disk_mounted ? "<button type='button' style='padding:2px 7px 2px 7px;' onclick=\"usb_mount('/usr/local/sbin/usb_umount {$disk[device]}');\"><i class='glyphicon glyphicon-export'></i> Unmount</button>" : "<button type='button' style='padding:2px 7px 2px 7px;' onclick=\"usb_mount('/usr/local/sbin/usb_mount {$disk[device]}');\"><i class='glyphicon glyphicon-import'></i>  Mount</button>") . "</span></td>";
         echo "<td><i class='glyphicon glyphicon-hdd hdd'></i>" . $disk['partitions'][0]['serial'] . $m_button . "</td>";
         $temp = my_temp($disk['temperature']);
         echo "<td >{$temp}</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td>";
         echo "<td><input type='checkbox' class='automount' serial='" . $disk['partitions'][0]['serial'] . "' " . ($disk['partitions'][0]['automount'] ? 'checked' : '') . "></td><td>-</td></tr>";
         foreach ($disk['partitions'] as $partition) {
             $mounted = is_mounted($partition['device']);
             echo "<tr class='{$odd}'><td></td><td><div>";
             $fscheck = sprintf(get_fsck_commands($partition['fstype'])['ro'], $partition['device']);
             $icon = "<i class='glyphicon glyphicon-th-large partition'></i>";
             $fscheck = !$mounted ? "<a class='exec' onclick='openWindow(\"{$fscheck}\",\"Check filesystem\",600,900);'>{$icon}{$partition[part]}</a>" : "{$icon}{$partition[part]}";
             echo "{$fscheck}<i class='glyphicon glyphicon-arrow-right'></i>";
             if ($mounted) {
                 echo $partition['mountpoint'];
             } else {
                 echo "<form method='POST' action='/plugins/{$plugin}/USBDevicesList.php?action=change_mountpoint&serial={$partition[serial]}&partition={$partition[part]}' target='progressFrame' style='display:inline;margin:0;padding:0;'>";
                 echo "<span class='text exec'><a>{$partition[mountpoint]}</a></span><input class='input' type='text' name='mountpoint' value='{$partition[mountpoint]}' hidden />";
                 echo "</form>";
示例#2
0
function show_totals($text) {
  global $var, $display, $temps, $counts, $tot_size, $tot_used, $tot_free, $reads, $writes, $errors;
  echo "<tr class='tr_last'>";
  echo "<td><img src='/webGui/images/sum.png' class='icon'>Total</td>";
  echo "<td>$text</td>";
  echo "<td>".($counts>0?my_temp(round($temps/$counts, 1)):'*')."</td>";
  echo "<td>".my_number($reads)."</td>";
  echo "<td>".my_number($writes)."</td>";
  echo "<td>".my_number($errors)."</td>";
  echo "<td></td>";
  if (strstr($text,"Array") && ($var['startMode'] == "Normal")) {
    echo "<td>".my_scale($tot_size*1024, $unit)." $unit</td>";
    switch ($display['text']) {
    case 0:
      $text1 = true; $text2 = true; break;
    case 1: case 2:
      $text1 = false; $text2 = false; break;
    case 10: case 20:
      $text1 = true; $text2 = false; break;
    case 11: case 21:
      $text1 = false; $text2 = true; break;
    }
    if ($text1) {
      echo "<td>".my_scale($tot_used*1024, $unit)." $unit</td>";
    } else {
      $used = $tot_size ? 100 - round(100*$tot_free/$tot_size) : 0;
      echo "<td><div class='usage-disk'><span style='margin:0;width:{$used}%' class='".usage_color($used,false)."'><span>".my_scale($tot_used*1024, $unit)." $unit</span></span></div></td>";
    }
    if ($text2) {
      echo "<td>".my_scale($tot_free*1024, $unit)." $unit</td>";
    } else {
      $free = $tot_size ? round(100*$tot_free/$tot_size) : 0;
      echo "<td><div class='usage-disk'><span style='margin:0;width:{$free}%' class='".usage_color($free,true)."'><span>".my_scale($tot_free*1024, $unit)." $unit</span></span></div></td>";
    }
    echo "<td></td>";
  }
  else
    echo "<td colspan=4></td>";
  echo "</tr>";
}
示例#3
0
<?php

require_once '/usr/local/emhttp/plugins/ipmitool-plugin/include/ipmitool_helpers.php';
function my_temp($reading, $unit, $dot)
{
    return ($reading > 0 ? $unit == 'F' ? round(9 / 5 * $reading + 32) : str_replace('.', $dot, $reading) : '##') . "&thinsp;{$unit}";
}
$sensors_array = [];
if ($ipmitool_cpu) {
    $ipmitool_cpu_temp = ipmi_get_reading($ipmitool_cpu, $ipmitool_options);
    if ($ipmitool_cpu_temp) {
        $sensors_array[] = "<img src='/plugins/{$plugin}/icons/cpu.png' title='{$ipmitool_cpu}' class='icon'>" . my_temp($ipmitool_cpu_temp, $_GET['unit'], $_GET['dot']);
    }
}
if ($ipmitool_mb) {
    $ipmitool_mb_temp = ipmi_get_reading($ipmitool_mb, $ipmitool_options);
    if ($ipmitool_mb_temp) {
        $sensors_array[] = "<img src='/plugins/{$plugin}/icons/mb.png' title='{$ipmitool_mb}' class='icon'>" . my_temp($ipmitool_mb_temp, $_GET['unit'], $_GET['dot']);
    }
}
if ($ipmitool_fan) {
    $ipmitool_fan_rpm = ipmi_get_reading($ipmitool_fan, $ipmitool_options);
    if ($ipmitool_fan_rpm) {
        $sensors_array[] = "<img src='/plugins/{$plugin}/icons/fan.png' title='{$ipmitool_fan}' class='icon'>" . $ipmitool_fan_rpm . "&thinsp;rpm";
    }
}
if ($sensors_array) {
    echo "<span id='temps' style='margin-right:16px'>" . implode('&nbsp;', $sensors_array) . "</span>";
}
示例#4
0
function show_totals($text) {
  global $var, $display, $sum;
  echo "<tr class='tr_last'>";
  echo "<td><img src='/webGui/images/sum.png' class='icon'>Total</td>";
  echo "<td>$text</td>";
  echo "<td>".($sum['count']>0 ? my_temp(round($sum['temp']/$sum['count'],1)) : '*')."</td>";
  echo "<td>".my_number($sum['numReads'])."</td>";
  echo "<td>".my_number($sum['numWrites'])."</td>";
  echo "<td>".my_number($sum['numErrors'])."</td>";
  echo "<td></td>";
  if (strstr($text,'Array') && ($var['startMode']=='Normal')) {
    echo "<td>".my_scale($sum['fsSize']*1024,$unit)." $unit</td>";
    if ($display['text']%10==0) {
      echo "<td>".my_scale($sum['fsUsed']*1024,$unit)." $unit</td>";
    } else {
      $used = $sum['fsSize'] ? 100-round(100*$sum['fsFree']/$sum['fsSize']) : 0;
      echo "<td><div class='usage-disk'><span style='margin:0;width:$used%' class='".usage_color($display,$used,false)."'><span>".my_scale($sum['fsUsed']*1024,$unit)." $unit</span></span></div></td>";
    }
    if ($display['text']<10 ? $display['text']%10==0 : $display['text']%10!=0) {
      echo "<td>".my_scale($sum['fsFree']*1024,$unit)." $unit</td>";
    } else {
      $free = $sum['fsSize'] ? round(100*$sum['fsFree']/$sum['fsSize']) : 0;
      echo "<td><div class='usage-disk'><span style='margin:0;width:$free%' class='".usage_color($display,$free,true)."'><span>".my_scale($sum['fsFree']*1024,$unit)." $unit</span></span></div></td>";
    }
    echo "<td></td>";
  } else
    echo "<td colspan=4></td>";
  echo "</tr>";
}
示例#5
0
      break; //ignore
      case 'green-on':
        my_insert($row1[$n],"<img src=$path/$state.png>");
      break;
      case 'green-blink':
        my_insert($row2[$n],"<img src=$path/$state.png>");
      break;
      case 'blue-on':
      case 'blue-blink':
        my_insert($row3[$n],"<img src=$path/$state.png>");
      break;
      default:
        my_insert($row4[$n],"<img src=$path/$state.png>");
      break;}
      $temp = $disk['temp'];
      if ($temp>=$_POST['hot']) my_insert($row5[$n],"<span class='heat-img'><img src='$path/".($temp>=$_POST['max']?'max':'hot').".png'></span><span class='heat-text' style='display:none'>".my_temp($temp,$_POST['unit'])."</span>");
      if ($disk['device'] && !strpos($state,'blink')) my_smart($row6[$n],$disk['name']);
      my_usage($row7[$n],($n>1 && $disk['fsStatus']=='Mounted')?(round((1-$disk['fsFree']/$disk['sizeSb'])*100).'%'):'');
    }
  }
  foreach ($devs as $dev) my_insert($row3[$i++],"<img src=$path/blue-on.png>");
  echo "<tr>".implode('',$row1)."</tr>";
  echo "<tr>".implode('',$row2)."</tr>";
  echo "<tr>".implode('',$row3)."</tr>";
  echo "<tr>".implode('',$row4)."</tr>";
  echo "<tr>".implode('',$row5)."</tr>";
  echo "<tr>".implode('',$row6)."</tr>";
  echo "<tr>".implode('',$row7)."</tr>";
break;
case 'sys':
  exec("grep -Po '^Mem(Total|Available):\s+\K\d+' /proc/meminfo",$memory);
示例#6
0
     break;
     case 'green-blink':
       my_insert($row2[$n],"<img src=$path/$state.png>");
     break;
     case 'blue-on':
     case 'blue-blink':
       my_insert($row3[$n],"<img src=$path/$state.png>");
     break;
     default:
       my_insert($row4[$n],"<img src=$path/$state.png>");
     break;}
     $temp = $disk['temp'];
     $hot  = strlen($disk['hotTemp']) ? $disk['hotTemp'] : $_POST['hot'];
     $max  = strlen($disk['maxTemp']) ? $disk['maxTemp'] : $_POST['max'];
     $beep = $temp>=$max && $max>0 ? 'max' : ($temp>=$hot && $hot>0 ? 'hot' : '');
     if ($beep) my_insert($row5[$n],"<span class='heat-img'><img src='$path/$beep.png'></span><span class='heat-text' style='display:none'>".my_temp($temp,$_POST['unit'])."</span>");
     if ($disk['device'] && !strpos($state,'blink')) my_smart($row6[$n],$disk['name'],'Device');
     my_usage($row7[$n],($n>1 && $disk['fsStatus']=='Mounted')?(round((1-$disk['fsFree']/$disk['fsSize'])*100).'%'):'');
   }
 }
 foreach ($devs as $dev) {
   $device = $dev['device'];
   $state = exec("hdparm -C /dev/$device|grep -Po active") ? 'blue-on' : 'blue-blink';
   if ($state=='blue-on') my_smart($row6[$i],$device,'New');
   my_insert($row3[$i++],"<img src=$path/$state.png>");
 }
 echo "<tr>".implode('',$row1)."</tr>";
 echo "<tr>".implode('',$row2)."</tr>";
 echo "<tr>".implode('',$row3)."</tr>";
 echo "<tr>".implode('',$row4)."</tr>";
 echo "<tr>".implode('',$row5)."</tr>";