2012-01-03 Vanessa Gil <vanessa.gil@artica.es>

* include/functions_graph.php
	  operation/netflow/nf_view.php: Graph changes.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5316 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2012-01-03 15:36:36 +00:00
parent 9287abce07
commit de44df1d15
3 changed files with 19 additions and 49 deletions

View File

@ -1,3 +1,7 @@
2012-01-03 Vanessa Gil <vanessa.gil@artica.es>
* include/functions_graph.php
operation/netflow/nf_view.php: Graph changes.
2012-01-03 Sergio Martin <sergio.martin@artica.es>
* include/functions_users.php

View File

@ -2073,41 +2073,17 @@ function grafico_netflow_total_area ($data, $period,$width, $height , $title, $u
$aggs = array();
// Calculate data for each agg
$j = 0;
for ($i = 0; $i < $resolution; $i++) {
$count = 0;
$timestamp = $datelimit + ($interval * $i);
$timestamp_short = date($time_format, $timestamp);
$long_index[$timestamp_short] = date(
html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp);
// Read data that falls in the current interval
while (isset ($data[$j])) {
$date = $data[$j]['date'];
$time = $data[$j]['time'];
$datetime = strtotime ($date." ".$time);
if ($datetime >= $timestamp && $datetime <= ($timestamp + $interval)){
if(!isset($chart[$timestamp_short]['data'])) {
$chart[$timestamp_short]['data'] = $data[$j]['data'];
$count++;
} else {
$chart[$timestamp_short]['data'] += $data[$j]['data'];
$count++;
}
} else {
break;
}
$j++;
}
if ($count > 0) {
$chart[$timestamp_short]['data'] = $chart[$timestamp_short]['data']/$count;
} else {
$chart[$timestamp_short]['data'] = 0;
}
}
//////////FIN COMBINED
$chart = array();
$long_index = array();
while (isset ($data[$j])) {
$date = $data[$j]['date'];
$time = $data[$j]['time'];
$datetime = strtotime ($date." ".$time);
$timestamp_short = date($time_format, $datetime);
$chart[$timestamp_short]['data'] = $data[$j]['data'];
$j++;
}
$flash_chart = $config['flash_charts'];
if ($only_image) {
$flash_chart = false;

View File

@ -77,7 +77,7 @@ function exec_command ($start_date, $end_date, $command, $show){
function exec_command_aggregate ($start_date, $end_date, $command, $show){
$command .= ' -t '.$start_date.'-'.$end_date.' -N';
$values = array();
exec($command, $string);
@ -98,7 +98,6 @@ function exec_command_aggregate ($start_date, $end_date, $command, $show){
$date_time = strtotime ($date." ".$time);
$values[$i]['datetime'] = $date_time;
///
$values[$i]['duration'] = $val[2];
$values[$i]['proto'] = $val[3];
$values[$i]['agg'] = $val[4];
@ -106,10 +105,12 @@ function exec_command_aggregate ($start_date, $end_date, $command, $show){
switch ($show){
case "packets":
$val[7]= str_replace('(','',$val[7]);
$val[7]= str_replace(')','',$val[7]);
$values[$i]['data'] = $val[7];
break;
case "bytes":
$val[9]= str_replace('(','',$val[9]);
$val[9]= str_replace(')','',$val[9]);
$values[$i]['data'] = $val[9];
break;
case "bps":
@ -125,7 +126,6 @@ function exec_command_aggregate ($start_date, $end_date, $command, $show){
}
}
$id = get_parameter('id');
$period = get_parameter('period', '86400');
$date_= get_parameter('date', date ("Y/m/d", get_system_time ()));
@ -382,18 +382,8 @@ if ($id!=''){
if ($show_bpp)
$show = 'bpp';
//create interval to divide command execution
if ($interval<43200)
$inter = 1;
else if (($interval>=43200)&&($interval<=86400))
$inter = 25;
else if ($interval > 86400 && $interval < 604800) //1296000)
$inter = 150;
else if ($interval >= 604800 && $interval <= 1296000)
$inter = 800;
else
$inter = 2800;
//create interval to divide command execution
$inter = $config['graph_res'] * 100;
if ($aggregate!='none')
$inter = 1;