Ejemplo n.º 1
0
				<td><div id="bar6"></div></td>
				<td class="right" id="percent_swap_free"></td>
			</tr>
			<tr>
				<td colspan="4" class="darkbackground">&nbsp;</td>
			</tr>
		</table>
		<table id="tblDiskSpace" width="800" align="left">
			<tr>
				<td colspan="4" class="head center">Disk Usage</td>
			</tr>
<?php 
for ($i = 1; $i < $count; $i++) {
    $total = NumberWithCommas(intval(preg_replace("/[^0-9]/", "", trim($size[$i])))) . " MB";
    $usedspace = NumberWithCommas(intval(preg_replace("/[^0-9]/", "", trim($used[$i])))) . " MB";
    $freespace = NumberWithCommas(intval(preg_replace("/[^0-9]/", "", trim($avail[$i])))) . " MB";
    echo "\n\t\t\t<tr>";
    echo "\n\t\t\t\t<td class=\"head\" colspan=\"4\">" . $mount[$i] . " (" . $typex[$i] . ")</td>";
    echo "\n\t\t\t</tr>";
    echo "\n\t\t\t<tr>";
    echo "\n\t\t\t\t<td>&nbsp;</td>";
    echo "\n\t\t\t\t<td>Total Size</td>";
    echo "\n\t\t\t\t<td class=\"right\">" . $total . "</td>";
    echo "\n\t\t\t\t<td class=\"right\">&nbsp;</td>";
    echo "\n\t\t\t</tr>";
    echo "\n\t\t\t<tr>";
    echo "\n\t\t\t\t<td>&nbsp;</td>";
    echo "\n\t\t\t\t<td>Used</td>";
    echo "\n\t\t\t\t<td class=\"right\">" . $usedspace . "</td>";
    echo "\n\t\t\t\t<td class=\"right\">" . $percent[$i] . "</td>";
    echo "\n\t\t\t</tr>";
Ejemplo n.º 2
0
$used_mem = $total_mem - $free_mem;
$used_swap = $total_swap - $free_swap;
$percent_free = round($free_mem / $total_mem * 100);
$percent_used = round($used_mem / $total_mem * 100);
$percent_swap = round(($total_swap - $free_swap) / $total_swap * 100);
$percent_swap_free = round($free_swap / $total_swap * 100);
$percent_buff = round($buffer_mem / $total_mem * 100);
$percent_cach = round($cache_mem / $total_mem * 100);
$used_mem = NumberWithCommas($used_mem);
$used_swap = NumberWithCommas($used_swap);
$total_mem = NumberWithCommas($total_mem);
$free_mem = NumberWithCommas($free_mem);
$total_swap = NumberWithCommas($total_swap);
$free_swap = NumberWithCommas($free_swap);
$buffer_mem = NumberWithCommas($buffer_mem);
$cache_mem = NumberWithCommas($cache_mem);
//Disk space check
$lines = file("/proc/mounts");
foreach ($lines as $line) {
    if (preg_match('/tmpfs|devtmpfs|devpts|rootfs|proc|sysfs/', $line) == false) {
        list($drive[], $mount[], $typex[]) = explode(" ", $line);
    }
}
foreach ($mount as $dir) {
    $avail[] = disk_free_space($dir) / 1048576;
    $size[] = disk_total_space($dir) / 1048576;
    $used[] = (disk_total_space($dir) - disk_free_space($dir)) / 1048576;
    $percent[] = round((1 - disk_free_space($dir) / disk_total_space($dir)) * 100);
}
$info = new stdClass();
$info->host = $host;