2010-04-11 13:45:19 +00:00
|
|
|
<?php
|
|
|
|
|
2010-07-24 19:14:41 +00:00
|
|
|
$graph_type = "storage_usage";
|
2010-04-11 13:45:19 +00:00
|
|
|
|
|
|
|
echo("<div style='padding: 5px;'>
|
2011-03-19 01:43:13 +00:00
|
|
|
<table width=100% cellspacing=0 cellpadding=6 class='sortable'>");
|
2010-04-11 13:45:19 +00:00
|
|
|
|
|
|
|
echo("<tr class=tablehead>
|
|
|
|
<th width=280>Device</th>
|
|
|
|
<th>Storage</th>
|
|
|
|
<th width=100></th>
|
|
|
|
<th width=280>Usage</th>
|
|
|
|
<th width=50>Used</th>
|
|
|
|
</tr>");
|
|
|
|
|
|
|
|
$row = 1;
|
|
|
|
|
2011-05-16 09:55:27 +00:00
|
|
|
foreach (dbFetchRows("SELECT * FROM `storage` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY D.hostname, S.storage_descr") as $drive)
|
2011-03-17 00:09:20 +00:00
|
|
|
{
|
|
|
|
if (device_permitted($drive['device_id']))
|
|
|
|
{
|
2010-04-11 13:45:19 +00:00
|
|
|
$skipdrive = 0;
|
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
if ($drive["os"] == "junos")
|
|
|
|
{
|
|
|
|
foreach ($config['ignore_junos_os_drives'] as $jdrive)
|
|
|
|
{
|
|
|
|
if (preg_match($jdrive, $drive["storage_descr"]))
|
|
|
|
{
|
|
|
|
$skipdrive = 1;
|
2010-04-11 13:45:19 +00:00
|
|
|
}
|
2011-03-17 00:09:20 +00:00
|
|
|
}
|
|
|
|
$drive["storage_descr"] = preg_replace("/.*mounted on: (.*)/", "\\1", $drive["storage_descr"]);
|
2010-04-11 13:45:19 +00:00
|
|
|
}
|
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
if ($drive['os'] == "freebsd")
|
|
|
|
{
|
|
|
|
foreach ($config['ignore_bsd_os_drives'] as $jdrive)
|
|
|
|
{
|
|
|
|
if (preg_match($jdrive, $drive["storage_descr"]))
|
|
|
|
{
|
|
|
|
$skipdrive = 1;
|
2010-04-11 13:45:19 +00:00
|
|
|
}
|
2011-03-17 00:09:20 +00:00
|
|
|
}
|
2010-04-11 13:45:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($skipdrive) { continue; }
|
2011-03-17 00:09:20 +00:00
|
|
|
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
2010-04-11 13:45:19 +00:00
|
|
|
|
|
|
|
$perc = round($drive['storage_perc'], 0);
|
|
|
|
$total = formatStorage($drive['storage_size']);
|
|
|
|
$free = formatStorage($drive['storage_free']);
|
|
|
|
$used = formatStorage($drive['storage_used']);
|
|
|
|
|
2011-05-17 19:21:20 +00:00
|
|
|
$graph_array['type'] = $graph_type;
|
|
|
|
$graph_array['id'] = $drive['storage_id'];
|
|
|
|
$graph_array['from'] = $config['time']['day'];
|
|
|
|
$graph_array['to'] = $config['time']['now'];
|
|
|
|
$graph_array['height'] = "20";
|
|
|
|
$graph_array['width'] = "80";
|
|
|
|
$graph_array_zoom = $graph_array;
|
|
|
|
$graph_array_zoom['height'] = "150";
|
|
|
|
$graph_array_zoom['width'] = "400";
|
|
|
|
$link = "graphs/" . $graph_array['id'] . "/" . $graph_array['type'] . "/" . $graph_array['from'] . "/" . $graph_array['to'] . "/";
|
|
|
|
$mini_graph = overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
|
2010-04-11 13:45:19 +00:00
|
|
|
|
2011-04-25 17:15:36 +00:00
|
|
|
$background = get_percentage_colours($perc);
|
2010-04-11 13:45:19 +00:00
|
|
|
|
2010-08-02 22:09:52 +00:00
|
|
|
echo("<tr bgcolor='$row_colour'><td>" . generate_device_link($drive) . "</td><td class=tablehead>" . $drive['storage_descr'] . "</td>
|
2011-05-17 19:21:20 +00:00
|
|
|
<td>$mini_graph</td>
|
2010-04-11 13:45:19 +00:00
|
|
|
<td>
|
2011-04-25 17:15:36 +00:00
|
|
|
<a href='#' $store_popup>".print_percentage_bar (400, 20, $perc, "$used / $total", "ffffff", $background['left'], $free, "ffffff", $background['right'])."</a>
|
2010-04-11 13:45:19 +00:00
|
|
|
</td><td>$perc"."%</td></tr>");
|
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
if ($_GET['optb'] == "graphs")
|
|
|
|
{
|
2010-04-11 13:45:19 +00:00
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
echo("<tr bgcolor='$row_colour'><td colspan=5>");
|
2010-06-12 13:37:39 +00:00
|
|
|
|
2011-05-17 19:21:20 +00:00
|
|
|
$graph_array['height'] = "100";
|
|
|
|
$graph_array['width'] = "216";
|
|
|
|
$graph_array['to'] = $config['time']['now'];
|
|
|
|
$graph_array['id'] = $drive['storage_id'];
|
|
|
|
$graph_array['type'] = $graph_type;
|
2010-06-12 13:37:39 +00:00
|
|
|
|
2011-05-17 19:21:20 +00:00
|
|
|
include("includes/print-quadgraphs.inc.php");
|
2010-06-12 13:37:39 +00:00
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
echo("</td></tr>");
|
2010-06-12 13:37:39 +00:00
|
|
|
|
|
|
|
} # endif graphs
|
|
|
|
|
2010-04-11 13:45:19 +00:00
|
|
|
$row++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo("</table></div>");
|
|
|
|
|
2011-03-19 01:43:13 +00:00
|
|
|
?>
|