2010-02-24 14:34:24 +00:00
|
|
|
<?php
|
|
|
|
|
2010-07-24 19:14:41 +00:00
|
|
|
$graph_type = "storage_usage";
|
|
|
|
|
2011-05-16 12:48:50 +00:00
|
|
|
$drives = dbFetchRows("SELECT * FROM `storage` WHERE device_id = ? ORDER BY `storage_descr` ASC", array($device['device_id']));
|
|
|
|
|
|
|
|
if (count($drives))
|
2011-03-16 23:10:10 +00:00
|
|
|
{
|
2010-02-24 14:34:24 +00:00
|
|
|
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
2011-03-25 14:18:04 +00:00
|
|
|
echo("<p style='padding: 0px 5px 5px;' class=sectionhead>");
|
|
|
|
echo('<a class="sectionhead" href="device/'.$device['device_id'].'/health/storage/">');
|
|
|
|
echo("<img align='absmiddle' src='".$config['base_url']."/images/icons/storage.png'> Storage</a></p>");
|
2010-02-24 14:34:24 +00:00
|
|
|
echo("<table width=100% cellspacing=0 cellpadding=5>");
|
|
|
|
$drive_rows = '0';
|
|
|
|
|
2011-05-16 12:48:50 +00:00
|
|
|
foreach ($drives as $drive)
|
2011-03-16 23:10:10 +00:00
|
|
|
{
|
2010-02-24 14:34:24 +00:00
|
|
|
$skipdrive = 0;
|
|
|
|
|
2011-03-16 23:10:10 +00:00
|
|
|
if ($device["os"] == "junos")
|
|
|
|
{
|
|
|
|
foreach ($config['ignore_junos_os_drives'] as $jdrive)
|
|
|
|
{
|
|
|
|
if (preg_match($jdrive, $drive["storage_descr"]))
|
|
|
|
{
|
|
|
|
$skipdrive = 1;
|
2010-02-24 14:34:24 +00:00
|
|
|
}
|
2011-03-16 23:10:10 +00:00
|
|
|
}
|
|
|
|
$drive["storage_descr"] = preg_replace("/.*mounted on: (.*)/", "\\1", $drive["storage_descr"]);
|
2010-02-24 14:34:24 +00:00
|
|
|
}
|
|
|
|
|
2011-03-16 23:10:10 +00:00
|
|
|
if ($device['os'] == "freebsd")
|
|
|
|
{
|
|
|
|
foreach ($config['ignore_bsd_os_drives'] as $jdrive)
|
|
|
|
{
|
|
|
|
if (preg_match($jdrive, $drive["storage_descr"]))
|
|
|
|
{
|
|
|
|
$skipdrive = 1;
|
2010-02-26 13:07:30 +00:00
|
|
|
}
|
2011-03-16 23:10:10 +00:00
|
|
|
}
|
2010-02-26 13:07:30 +00:00
|
|
|
}
|
|
|
|
|
2010-02-24 14:34:24 +00:00
|
|
|
if ($skipdrive) { continue; }
|
2011-03-16 23:10:10 +00:00
|
|
|
if (is_integer($drive_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
2011-09-19 11:46:45 +00:00
|
|
|
$percent = round($drive['storage_perc'], 0);
|
2010-02-24 15:44:55 +00:00
|
|
|
$total = formatStorage($drive['storage_size']);
|
|
|
|
$free = formatStorage($drive['storage_free']);
|
|
|
|
$used = formatStorage($drive['storage_used']);
|
2011-09-19 11:46:45 +00:00
|
|
|
$background = get_percentage_colours($percent);
|
2010-02-24 14:34:24 +00:00
|
|
|
|
2011-09-17 19:14:44 +00:00
|
|
|
$graph_array = array();
|
|
|
|
$graph_array['height'] = "100";
|
|
|
|
$graph_array['width'] = "210";
|
|
|
|
$graph_array['to'] = $now;
|
|
|
|
$graph_array['id'] = $drive['storage_id'];
|
|
|
|
$graph_array['type'] = $graph_type;
|
|
|
|
$graph_array['from'] = $day;
|
|
|
|
$graph_array['legend'] = "no";
|
2010-02-24 14:34:24 +00:00
|
|
|
|
2011-09-17 19:14:44 +00:00
|
|
|
$link_array = $graph_array;
|
|
|
|
$link_array['page'] = "graphs";
|
|
|
|
unset($link_array['height'], $link_array['width'], $link_array['legend']);
|
|
|
|
$link = generate_url($link_array);
|
2010-02-24 14:34:24 +00:00
|
|
|
|
2011-09-17 19:14:44 +00:00
|
|
|
$overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $text_descr);
|
2010-02-24 14:34:24 +00:00
|
|
|
|
2011-09-17 19:14:44 +00:00
|
|
|
$graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = $graph_colour;
|
|
|
|
|
|
|
|
$minigraph = generate_graph_tag($graph_array);
|
|
|
|
|
|
|
|
echo("<tr bgcolor=$row_colour>
|
2011-09-19 11:46:45 +00:00
|
|
|
<td class=tablehead>".overlib_link($link, $drive['storage_descr'], $overlib_content)."</td>
|
2011-09-17 19:14:44 +00:00
|
|
|
<td width=90>".overlib_link($link, $minigraph, $overlib_content)."</td>
|
|
|
|
<td width=200>".overlib_link($link, print_percentage_bar (200, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']), $overlib_content)."
|
|
|
|
</a></td>
|
|
|
|
</tr>");
|
2010-02-24 14:34:24 +00:00
|
|
|
|
|
|
|
$drive_rows++;
|
|
|
|
}
|
2011-03-17 00:09:20 +00:00
|
|
|
|
2010-02-24 14:34:24 +00:00
|
|
|
echo("</table>");
|
|
|
|
echo("</div>");
|
|
|
|
}
|
|
|
|
|
|
|
|
unset ($drive_rows);
|
|
|
|
|
2011-04-25 17:15:36 +00:00
|
|
|
?>
|