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

* operation/netflow/nf_view.php
	  include/functions_graph.php
	  include/functions_netflow.php: changed the way to collect netflow
	parameters.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5311 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2012-01-02 14:36:55 +00:00
parent db8920e8e1
commit 66ba4f3cbc
4 changed files with 17 additions and 114 deletions

View File

@ -1,3 +1,9 @@
2012-01-02 Vanessa Gil <vanessa.gil@artica.es>
* operation/netflow/nf_view.php
include/functions_graph.php
include/functions_netflow.php: changed the way to collect netflow
parameters.
2011-12-30 Vanessa Gil <vanessa.gil@artica.es>
* godmode/netflow/nf_report_item.php
godmode/netflow/nf_item_list.php

View File

@ -1957,12 +1957,6 @@ echo"<h4>Gráfica de área</h4>";
$time_format = 'M d H\h';
}
$timestamp_short = date($time_format, $date);
/*
$long_index[$timestamp_short] = date(
html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp);
$timestamp = $timestamp_short;
*/
/////////////////////////////////////////////////////////////////
@ -1992,10 +1986,6 @@ echo"<h4>Gráfica de área</h4>";
$datetime = strtotime ($date." ".$time);
if ($datetime >= $timestamp && $datetime <= ($timestamp + $interval)){
if ($data[$j]['unit'] == 'G'){
$data[$j]['data'] *= 1024;
}
if(!isset($chart[$timestamp_short][$ag])) {
$chart[$timestamp_short][$ag] = $data[$j]['data'];
$count++;
@ -2097,22 +2087,6 @@ function grafico_netflow_total_area ($data, $period,$width, $height , $title, $u
$datetime = strtotime ($date." ".$time);
if ($datetime >= $timestamp && $datetime <= ($timestamp + $interval)){
if (isset($data[$j]['unit'])){
if ($data[$j]['unit'] == 'G'){
$data[$j]['data'] *= 1024;
}
}
/*
if(!isset($chart[$timestamp_short][$ip])) {
$chart[$timestamp_short][$ip] = $data[$j]['data'];
$count++;
} else {
$chart[$timestamp_short][$ip] += $data[$j]['data'];
$count++;
}
*/
if(!isset($chart[$timestamp_short]['data'])) {
$chart[$timestamp_short]['data'] = $data[$j]['data'];
$count++;
@ -2125,15 +2099,6 @@ function grafico_netflow_total_area ($data, $period,$width, $height , $title, $u
}
$j++;
}
// Average
/*
if ($count > 0) {
$chart[$timestamp_short][$ip] = $chart[$timestamp_short][$ip]/$count;
} else {
$chart[$timestamp_short][$ip] = 0;
}
*/
if ($count > 0) {
$chart[$timestamp_short]['data'] = $chart[$timestamp_short]['data']/$count;
@ -2141,17 +2106,6 @@ function grafico_netflow_total_area ($data, $period,$width, $height , $title, $u
$chart[$timestamp_short]['data'] = 0;
}
}
/*
foreach($chart as $key => $value) {
foreach($ips as $ip) {
if(!isset($chart[$key][$ip])) {
$chart[$key][$ip] = 0;
}
}
}
*/
//////////FIN COMBINED
$flash_chart = $config['flash_charts'];
@ -2181,11 +2135,6 @@ function grafico_netflow_aggregate_pie ($data) {
$agg = '';
while (isset ($data[$i])) {
$agg = $data[$i]['agg'];
if (isset($data[$i]['unit'])){
if ($data[$i]['unit'] == 'G') {
$data[$i]['data'] = $data[$i]['data'] * 1024;
}
}
if (!isset($values[$agg])){
$values[$agg] = $data[$i]['data'];
} else {

View File

@ -222,11 +222,11 @@ function netflow_show_total_period($data, $date_limit, $date_time){
if (!isset($values[$agg])){
$values[$agg] = $data[$j]['data'];
$table->data[$x][0] = $agg;
$table->data[$x][1] = $data[$j]['data'].' '.$data[$j]['unit'];
$table->data[$x][1] = $data[$j]['data'];
} else {
$values[$agg] += $data[$j]['data'];
$table->data[$x][0] = $agg;
$table->data[$x][1] = $data[$j]['data'].' '.$data[$j]['unit'];
$table->data[$x][1] = $data[$j]['data'];
}
$j++;
$x++;
@ -249,38 +249,12 @@ function netflow_show_table_values($data, $date_limit, $date_time){
$coordx = array();
$coordy = array();
//añadido
/*
$max_values = 10;
if(count($data) > $max_values) {
$chart_data_trunc = array();
$n = 1;
foreach($chart_data as $key => $value) {
if($n < $max_values) {
$chart_data_trunc[$key] = $value;
}
else {
if (!isset($chart_data_trunc[$others_str])) {
$chart_data_trunc[$others_str] = 0;
}
$chart_data_trunc[$others_str] += $value;
}
$n++;
}
$chart_data = $chart_data_trunc;
}
*/
//fin añadido
while (isset ($data[$j])) {
$date = $data[$j]['date'];
$time = $data[$j]['time'];
$agg = $data[$j]['agg'];
if ($data[$j]['unit'] == 'G'){
$data[$j]['data'] *= 1024;
}
if (!isset($values[$agg])){
$values['data'] = $data[$j]['data'];
} else {

View File

@ -31,7 +31,7 @@ if (! check_acl ($config["id_user"], 0, "AR")) {
}
function exec_command ($start_date, $end_date, $command, $show){
$command .= ' -t '.$start_date.'-'.$end_date;
$command .= ' -t '.$start_date.'-'.$end_date.' -N';
$values = array();
exec($command, $string);
@ -61,16 +61,12 @@ function exec_command ($start_date, $end_date, $command, $show){
switch ($show){
case "packets":
$values[$i]['data'] = $val[7];
$values[$i]['unit'] = $val[8];
break;
case "bytes":
$values[$i]['data'] = $val[9];
if (isset($val[10])){
$values[$i]['unit'] = $val[10];
}
$values[$i]['data'] = $val[8];
break;
case "flows":
$values[$i]['data'] = $val[11];
$values[$i]['data'] = $val[9];
break;
}
$i++;
@ -80,7 +76,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;
$command .= ' -t '.$start_date.'-'.$end_date.' -N';
$values = array();
exec($command, $string);
@ -115,34 +111,12 @@ function exec_command_aggregate ($start_date, $end_date, $command, $show){
case "bytes":
$val[9]= str_replace('(','',$val[9]);
$values[$i]['data'] = $val[9];
$val[10]= str_replace('(','',$val[10]);
$values[$i]['unit'] = $val[10];
if (($values[$i]['unit']!='M') && ($values[$i]['unit']!='G')) {
$values[$i]['unit'] = '';
}
if ($values[$i]['unit']=='M'){
$values[$i]['data'] = $values[$i]['data'] * 1024;
}
break;
case "bps":
$val[10]= str_replace('(','',$val[10]);
$values[$i]['unit'] = $val[10];
if (($values[$i]['unit']=='M') || ($values[$i]['unit']=='G')) {
$values[$i]['data'] = $val[13];
} else {
$values[$i]['data'] = $val[12];
}
$values[$i]['unit'] = '';
$values[$i]['data'] = $val[12];
break;
case "bpp":
$val[10]= str_replace('(','',$val[10]);
$values[$i]['unit'] = $val[10];
if (($values[$i]['unit']=='M') || ($values[$i]['unit']=='G')) {
$values[$i]['data'] = $val[14];
} else {
$values[$i]['data'] = $val[13];
}
$values[$i]['unit'] = '';
$values[$i]['data'] = $val[13];
break;
}
$i++;
@ -416,9 +390,9 @@ if ($id!=''){
else if ($interval > 86400 && $interval < 604800) //1296000)
$inter = 150;
else if ($interval >= 604800 && $interval <= 1296000)
$inter = 600;
$inter = 800;
else
$inter = 1600;
$inter = 2800;
if ($aggregate!='none')
$inter = 1;