mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
2012-01-11 Ramon Novoa <rnovoa@artica.es>
* include/functions_netflow.php, operation/netflow/nf_view.php: Fixed netflow raw data tables. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
adb9a8b750
commit
85f43f1dc4
@ -1,3 +1,8 @@
|
|||||||
|
2012-01-11 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* include/functions_netflow.php,
|
||||||
|
operation/netflow/nf_view.php: Fixed netflow raw data tables.
|
||||||
|
|
||||||
2012-01-11 Vanessa Gil <vanessa.gil@artica.es>
|
2012-01-11 Vanessa Gil <vanessa.gil@artica.es>
|
||||||
godmode/netflow/nf_edit_form.php
|
godmode/netflow/nf_edit_form.php
|
||||||
godmode/netflow/nf_report.php
|
godmode/netflow/nf_report.php
|
||||||
|
@ -194,7 +194,7 @@ function sort_netflow_data ($netflow_data) {
|
|||||||
usort($netflow_data, "compare_flows");
|
usort($netflow_data, "compare_flows");
|
||||||
}
|
}
|
||||||
|
|
||||||
function netflow_show_total_period($data, $start_date, $end_date, $show){
|
function netflow_stat_table ($data, $start_date, $end_date, $show){
|
||||||
global $nfdump_date_format;
|
global $nfdump_date_format;
|
||||||
|
|
||||||
$start_date = date ($nfdump_date_format, $start_date);
|
$start_date = date ($nfdump_date_format, $start_date);
|
||||||
@ -238,76 +238,59 @@ html_print_table($table);
|
|||||||
*
|
*
|
||||||
* @return The statistics table.
|
* @return The statistics table.
|
||||||
*/
|
*/
|
||||||
function netflow_stat_table ($data, $start_date, $end_date, $unit){
|
function netflow_data_table ($data, $start_date, $end_date, $unit){
|
||||||
global $nfdump_date_format;
|
global $nfdump_date_format;
|
||||||
|
|
||||||
|
$period = $end_date - $start_date;
|
||||||
$start_date = date ($nfdump_date_format, $start_date);
|
$start_date = date ($nfdump_date_format, $start_date);
|
||||||
$end_date = date ($nfdump_date_format, $end_date);
|
$end_date = date ($nfdump_date_format, $end_date);
|
||||||
|
|
||||||
|
// Set the format
|
||||||
|
if ($period <= 21600) {
|
||||||
|
$time_format = 'H:i:s';
|
||||||
|
}
|
||||||
|
elseif ($period < 86400) {
|
||||||
|
$time_format = 'H:i';
|
||||||
|
}
|
||||||
|
elseif ($period < 1296000) {
|
||||||
|
$time_format = 'M d H:i';
|
||||||
|
}
|
||||||
|
elseif ($period < 2592000) {
|
||||||
|
$time_format = 'M d H\h';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$time_format = 'M d H\h';
|
||||||
|
}
|
||||||
|
|
||||||
$values = array();
|
$values = array();
|
||||||
$table->width = '50%';
|
//$table->size = array ('50%');
|
||||||
$table->class = 'databox';
|
$table->class = 'databox';
|
||||||
$table->data = array();
|
$table->data = array();
|
||||||
|
|
||||||
$j = 0;
|
|
||||||
$x = 1;
|
|
||||||
$y = 1;
|
|
||||||
|
|
||||||
echo"<h4>Tabla de valores ($unit)</h4>";
|
echo"<h4>Tabla de valores ($unit)</h4>";
|
||||||
$table->data[0][0] = '<b>'.__('Rango').'</b>';
|
$table->data[0][0] = '<b>'.__('Rango').'</b>';
|
||||||
|
|
||||||
$coordx = array();
|
$j = 0;
|
||||||
$coordy = array();
|
$source_index = array ();
|
||||||
|
$source_count = 0;
|
||||||
while (isset ($data[$j])) {
|
foreach ($data['sources'] as $source => $null) {
|
||||||
$date = $data[$j]['date'];
|
$table->data[0][$j+1] = $source;
|
||||||
$time = $data[$j]['time'];
|
$source_index[$j] = $source;
|
||||||
$agg = $data[$j]['agg'];
|
$source_count++;
|
||||||
|
|
||||||
if (!isset($values[$agg])){
|
|
||||||
$values['data'] = $data[$j]['data'];
|
|
||||||
} else {
|
|
||||||
$values['data'] += $data[$j]['data'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$values['agg'] = $agg;
|
|
||||||
$values['datetime'] = $date.'.'.$time;
|
|
||||||
|
|
||||||
if(isset($coordy[$agg])) {
|
|
||||||
$cy = $coordy[$agg];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$cy = $y;
|
|
||||||
$coordy[$agg] = $cy;
|
|
||||||
$y++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($coordx[$date.'.'.$time])) {
|
|
||||||
$cx = $coordx[$date.'.'.$time];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$cx = $x;
|
|
||||||
$coordx[$date.'.'.$time] = $cx;
|
|
||||||
$x++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->data[0][$cy] = $agg;
|
|
||||||
$table->data[$cx][0] = $date.'.'.$time;
|
|
||||||
$table->data[$cx][$cy] = $values['data'];
|
|
||||||
|
|
||||||
$j++;
|
$j++;
|
||||||
}
|
}
|
||||||
//si la coordenada no tiene valor, se rellena con 0
|
|
||||||
foreach($coordx as $x) {
|
$i = 1;
|
||||||
foreach($coordy as $y) {
|
foreach ($data['data'] as $timestamp => $values) {
|
||||||
if(!isset($table->data[$x][$y])) {
|
$table->data[$i][0] = date ($time_format, $timestamp);
|
||||||
$table->data[$x][$y] = 0;
|
for ($j = 0; $j < $source_count; $j++) {
|
||||||
|
if (isset ($values[$source_index[$j]])) {
|
||||||
|
$table->data[$i][$j+1] = format_numeric ($values[$source_index[$j]]);
|
||||||
|
} else {
|
||||||
|
$table->data[$i][$j+1] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
$i++;
|
||||||
//ordenar los indices
|
|
||||||
foreach($coordx as $x) {
|
|
||||||
ksort($table->data[$x]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
@ -152,12 +152,12 @@ for ($x = 0; isset($all_rcs[$x]['id_rc']); $x++) {
|
|||||||
echo graph_netflow_aggregate_pie($result);
|
echo graph_netflow_aggregate_pie($result);
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
$data = netflow_get_stats ($start_date, $end_date, $command, $aggregate, $max_aggregates, $unit);
|
$data = netflow_get_data ($start_date, $end_date, $command, $aggregate, $max_aggregates, $unit);
|
||||||
echo netflow_stat_table ($data, $start_date, $end_date, $unit);
|
echo netflow_data_table ($data, $start_date, $end_date, $unit);
|
||||||
break;
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
$data = netflow_get_stats ($start_date, $end_date, $command, $aggregate, $max_aggregates, $unit);
|
$data = netflow_get_stats ($start_date, $end_date, $command, $aggregate, $max_aggregates, $unit);
|
||||||
echo netflow_show_total_period($data, $start_date, $end_date, $unit);
|
echo netflow_stat_table ($data, $start_date, $end_date, $unit);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
echo fs_error_image();
|
echo fs_error_image();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user