2009-12-28 12:00:57 +00:00
|
|
|
<?php
|
2008-03-09 23:22:34 +00:00
|
|
|
|
|
|
|
if($_SESSION['userlevel'] >= '5') {
|
|
|
|
$sql = "SELECT * FROM `storage` AS S, `devices` AS D WHERE S.host_id = D.device_id ORDER BY D.hostname, S.hrStorageDescr";
|
|
|
|
} else {
|
|
|
|
$sql = "SELECT * FROM `storage` AS S, `devices` AS D, devices_perms as P WHERE D.host_id = D.device_id AND ";
|
|
|
|
$sql .= "D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, S.hrStorageDescr";
|
|
|
|
}
|
|
|
|
|
|
|
|
$query = mysql_query($sql);
|
|
|
|
|
2008-03-23 21:32:54 +00:00
|
|
|
echo("<div style='padding: 5px;'>
|
|
|
|
<table width=100% cellspacing=0 cellpadding=2>");
|
2008-03-09 23:22:34 +00:00
|
|
|
|
|
|
|
echo("<tr class=tablehead>
|
|
|
|
<th width=280>Device</th>
|
2010-02-21 01:35:13 +00:00
|
|
|
<th>Storage</th>
|
|
|
|
<th width=420>Usage</th>
|
|
|
|
<th width=100>Free</th>
|
2008-03-09 23:22:34 +00:00
|
|
|
</tr>");
|
|
|
|
|
|
|
|
$row = 1;
|
|
|
|
|
|
|
|
while($drive = mysql_fetch_array($query)) {
|
|
|
|
|
2010-02-21 00:29:47 +00:00
|
|
|
$skipdrive = 0;
|
|
|
|
|
|
|
|
if ($drive["os"] == "junos") {
|
|
|
|
foreach ($config['ignore_junos_os_drives'] as $jdrive) {
|
|
|
|
if (preg_match($jdrive, $drive["hrStorageDescr"])) {
|
|
|
|
$skipdrive = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($skipdrive) { continue; }
|
|
|
|
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
2008-03-09 23:22:34 +00:00
|
|
|
|
|
|
|
$total = $drive['hrStorageSize'] * $drive['hrStorageAllocationUnits'];
|
|
|
|
$used = $drive['hrStorageUsed'] * $drive['hrStorageAllocationUnits'];
|
2010-02-21 01:35:13 +00:00
|
|
|
$free = $total - $used;
|
2008-03-09 23:22:34 +00:00
|
|
|
$perc = round($drive['storage_perc'], 0);
|
|
|
|
$total = formatStorage($total);
|
|
|
|
$used = formatStorage($used);
|
|
|
|
|
2009-11-07 02:30:38 +00:00
|
|
|
$store_url = "graph.php?id=" . $drive['storage_id'] . "&type=hrstorage&from=$month&to=$now&width=400&height=125";
|
2008-03-09 23:22:34 +00:00
|
|
|
$store_popup = "onmouseover=\"return overlib('<img src=\'$store_url\'>', LEFT);\" onmouseout=\"return nd();\"";
|
|
|
|
|
2010-02-21 01:35:13 +00:00
|
|
|
if($perc > '90') { $left_background='c4323f'; $right_background='C96A73';
|
|
|
|
} elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392';
|
|
|
|
} elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92';
|
|
|
|
} elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3';
|
|
|
|
} else { $left_background='9abf5b'; $right_background='bbd392'; }
|
|
|
|
|
2008-03-09 23:22:34 +00:00
|
|
|
|
2010-01-30 12:39:04 +00:00
|
|
|
echo("<tr bgcolor='$row_colour'><td>" . generatedevicelink($drive) . "</td><td class=tablehead>" . $drive['hrStorageDescr'] . "</td><td>
|
2010-02-21 01:35:13 +00:00
|
|
|
<a href='#' $store_popup>".print_percentage_bar (400, 20, $perc, "$used / $total", "ffffff", $left_background, $perc . "%", "ffffff", $right_background)."</a>
|
|
|
|
</td><td>" . formatStorage($free) . "</td></tr>");
|
2008-03-09 23:22:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
$row++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-03-23 21:32:54 +00:00
|
|
|
echo("</table></div>");
|
2008-03-09 23:22:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|