improve some graphing stuff. sexypants.

git-svn-id: http://www.observium.org/svn/observer/trunk@1024 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong 2010-03-14 01:38:43 +00:00
parent c127dffa80
commit 8fe2b89c5e
2 changed files with 34 additions and 33 deletions

View File

@ -6,43 +6,18 @@
if(!$device) { $device['device_id'] = getifhost($interface['interface_id']); }
# $daily_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=215&height=100";
# $daily_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150";
# $weekly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=215&height=100";
# $weekly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150";
# $monthly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=215&height=100";
# $monthly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150";
# $yearly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
# $yearly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150";
$graph_array['height'] = "100";
$graph_array['width'] = "215";
$graph_array['to'] = $now;
$graph_array['port'] = $interface['interface_id'];
$graph_array['type'] = $graph_type;
$graph_array['from'] = $day;
print_graph_tag($graph_array);
$graph_array['from'] = $week;
print_graph_tag($graph_array);
$graph_array['from'] = $month;
print_graph_tag($graph_array);
$graph_array['from'] = $year;
print_graph_tag($graph_array);
$periods = array('day', 'week', 'month', 'year');
# echo("<a href='".$daily_url."' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
# <img src='$daily_traffic' border=0></a> ");
# echo("<a href='".$weekly_url."' onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
# <img src='$weekly_traffic' border=0></a> ");
# echo("<a href='".$monthly_url."' onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\">
# <img src='$monthly_traffic' border=0></a> ");
# echo("<a href='".$yearly_url."' onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\">
# <img src='$yearly_traffic' border=0></a>");
foreach($periods as $period) {
$graph_array['from'] = $$period;
$graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400";
echo(overlib_link("#", generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL));
}
?>

View File

@ -1,8 +1,34 @@
<?php
if($ports['total']) {
echo('<div style="background-color: #eeeeee; margin: 5px; padding: 5px;">
' . device_traffic_image($device['device_id'], 490, 100, $day, '-300s'));
echo('<div style="background-color: #eeeeee; margin: 5px; padding: 5px;">');
# ' . device_traffic_image($device['device_id'], 490, 100, $day, '-300s'));
$graph_array['height'] = "100";
$graph_array['width'] = "490";
$graph_array['to'] = $now;
$graph_array['device'] = $device['device_id'];
$graph_array['type'] = "device_bits";
$graph_array['from'] = $day;
$graph = generate_graph_tag($graph_array);
$content = "<div class=list-large>".$device['hostname']." - Device Traffic</div>";
$content .= "<div style=\'width: 850px\'>";
$graph_array['width'] = "340";
$graph_array['from'] = $day;
$content .= generate_graph_tag($graph_array);
$graph_array['from'] = $week;
$content .= generate_graph_tag($graph_array);
$graph_array['from'] = $month;
$content .= generate_graph_tag($graph_array);
$graph_array['from'] = $year;
$content .= generate_graph_tag($graph_array);
$content .= "</div>";
echo(overlib_link("#", $graph, $content, NULL));
echo(' <div style="height: 5px;"></div>');
echo(' <table class="tablehead" cellpadding="2" cellspacing="0" width="100%">