MMDVMHost-Dashboard/include/disk.php

63 lines
2.4 KiB
PHP
Raw Normal View History

2016-06-28 16:30:19 +02:00
<div class="panel panel-default">
<!-- Standard-Panel-Inhalt -->
2017-03-02 16:56:46 +01:00
<div class="panel-heading">Disk Use<span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i></span></div>
<div class="panel-body">
2017-01-10 15:04:51 +01:00
<!-- Tabelle -->
<div class="table-responsive">
<table id="diskuse" class="table diskuse table-condensed table-striped table-hover">
2017-01-10 15:04:51 +01:00
<thead>
<tr>
<th class="w10p filesystem">File System</th>
<th class="w20p">Mount Point</th>
<th>Use</th>
<th class="w15p">Free</th>
<th class="w15p">Used</th>
<th class="w15p">Total</th>
</tr>
</thead>
<tbody>
2016-06-28 16:30:19 +02:00
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//include "./functions.php";
2016-09-15 20:30:41 +02:00
try{
2017-01-10 15:04:51 +01:00
$datas = array();
if (!(exec('/bin/df -T | awk -v c=`/bin/df -T | grep -bo "Type" | awk -F: \'{print $2}\'` \'{print substr($0,c);}\' | tail -n +2 | awk \'{print $1","$2","$3","$4","$5","$6","$7}\'', $df))) {
$datas[] = array(
'total' => 'N.A',
'used' => 'N.A',
'free' => 'N.A',
'percent_used' => 0,
'mount' => 'N.A',
'filesystem' => 'N.A',
);
} else {
$mounted_points = array();
$key = 0;
foreach ($df as $mounted) {
list($filesystem, $type, $total, $used, $free, $percent, $mount) = explode(',', $mounted);
if ((strpos($type, 'tmpfs') !== false) && (strpos($mount, '/mnt/ramdisk') === false))
continue;
?>
<tr>
<td><?php echo $filesystem ?></td>
<td><?php echo $mount ?></td>
<td><div class="progress"><div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?php echo trim($percent, '%') ?>" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo trim($percent, '%') ?>%;"><?php echo trim($percent, '%') ?>%</div></div></td>
<td><?php echo getSize($free * 1024) ?></td>
<td><?php echo getSize($used * 1024) ?></td>
<td><?php echo getSize($total * 1024) ?></td>
</tr>
<?php
$key++;
}
}
2016-06-28 16:30:19 +02:00
} catch (Exception $e) {
2017-01-10 15:04:51 +01:00
return false;
2016-06-28 16:30:19 +02:00
}
2016-10-26 09:46:15 +02:00
?>
2017-01-10 15:04:51 +01:00
</tbody>
</table>
</div>
2017-03-02 16:56:46 +01:00
</div>
2016-06-28 16:30:19 +02:00
</div>