AlphaTroll
New Member
Sounds like you're baking a pie.
if($_GET[action] == disk) {
print "<table><tr>
<td border=1 width=\"90\" bgcolor=\"#efefef\" align=\"center\"><a href=\"status.php?system=$room&action=cpu\">CPU</a></td>
<td width=\"20\"></td>
<td border=1 width=\"90\" bgcolor=\"#efefef\" align=\"center\"><a href=\"status.php?system=$room&action=disk\">Disk</a></td>
<td width=\"20\"></td>
<td border=1 width=\"90\" bgcolor=\"#efefef\" align=\"center\"><a href=\"status.php?system=$room&action=users\">Users</a></td>
</tr>
<tr>
<td align=\"left\" colspan=\"5\" rowspan=\"10\">
<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"310\">
<tr>
<td><b>Mountpoint</b></td><td align=\"center\"><b>% Full</b></td><td><b>Filesystem</b></td>
</tr>";
$result = pg_exec($GLOBALS["conn"], "SELECT disk_date FROM disk_use ORDER BY disk_date DESC;");
$rows = pg_numrows($result);
if($rows > 0) {
$row = pg_fetch_row($result, 0);
$diskdate = $row[0];
}
if(isset($diskdate) {
$result = pg_exec($GLOBALS["conn"], "SELECT filesystem, total_blocks, used_blocks, avail_blocks, used_percent, mountpoint FROM disk_use WHERE disk_date='$diskdate' AND node='$room';");
$rows = pg_numrows($result);
if($rows > 0) {
for($i = 0; $i < $rows; $i++) {
$row = pg_fetch_row($result, $i);
if($row[4] > 90) {
$color = "#FF0000";
} else {
$color = "black";
}
print "<tr>";
print "<td width=\"33%\"><font color=\"$color\">$row[5]</font></td><td width=\"33%\" align=\"center\"><font color=\"$color\">$row[4]%</font></td><td
width=\"33%\"><font color=\"$color\">$row[0]</font></td>";
print "<tr>";
}
}
} else {
echo "Unable to obtain last rundate!<br>";
}
print "</table>
</td>
<tr>
</table>";
}