2012-01-13 Ramon Novoa <rnovoa@artica.es>
* include/functions_graph.php, include/functions_netflow.php, operation/netflow/nf_view.php: Aesthetic fixes. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5369 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
57d91d50c3
commit
9e77c38d5c
|
@ -1,3 +1,9 @@
|
||||||
|
2012-01-13 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* include/functions_graph.php,
|
||||||
|
include/functions_netflow.php,
|
||||||
|
operation/netflow/nf_view.php: Aesthetic fixes.
|
||||||
|
|
||||||
2012-01-13 Ramon Novoa <rnovoa@artica.es>
|
2012-01-13 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* include/functions_graph.php,
|
* include/functions_graph.php,
|
||||||
|
|
|
@ -1936,12 +1936,11 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
|
||||||
* Print an area graph with netflow aggregated
|
* Print an area graph with netflow aggregated
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function graph_netflow_aggregate_area ($data, $period, $width, $height, $title, $unit_name, $avg_only = 0, $pure=0, $date = 0, $only_image = false, $homeurl = '') {
|
function graph_netflow_aggregate_area ($data, $period, $width, $height, $only_image) {
|
||||||
global $config;
|
global $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
|
|
||||||
echo"<h4>".__('Area graph')."</h4>";
|
include_flash_chart_script($config['homeurl']);
|
||||||
include_flash_chart_script($homeurl);
|
|
||||||
|
|
||||||
if (empty ($data)) {
|
if (empty ($data)) {
|
||||||
echo fs_error_image ();
|
echo fs_error_image ();
|
||||||
|
@ -1991,8 +1990,14 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $title,
|
||||||
$flash_chart = false;
|
$flash_chart = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return stacked_area_graph($flash_chart, $chart, $width, $height, null, $sources,
|
if ($config['homeurl'] != '') {
|
||||||
null, "images/image_problem.opaque.png", "", "",
|
$homeurl = $config['homeurl'] . '/';
|
||||||
|
} else {
|
||||||
|
$homeurl = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return area_graph($flash_chart, $chart, $width, $height, array (), $sources,
|
||||||
|
null, "images/image_problem.opaque.png", "", "", $homeurl,
|
||||||
$config['homedir'] . "/images/logo_vertical_water.png",
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
$config['fontpath'], $config['font_size'], "");
|
$config['fontpath'], $config['font_size'], "");
|
||||||
}
|
}
|
||||||
|
@ -2002,12 +2007,11 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $title,
|
||||||
/**
|
/**
|
||||||
* Print an area graph with netflow total
|
* Print an area graph with netflow total
|
||||||
*/
|
*/
|
||||||
function graph_netflow_total_area ($data, $period, $width, $height, $title, $unit_name, $avg_only = 0, $pure=0, $date = 0, $only_image = false, $homeurl = '') {
|
function graph_netflow_total_area ($data, $period, $width, $height, $only_image) {
|
||||||
global $config;
|
global $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
|
|
||||||
echo"<h4>Gráfica de área</h4>";
|
include_flash_chart_script($config['homeurl']);
|
||||||
include_flash_chart_script($homeurl);
|
|
||||||
|
|
||||||
if (empty ($data)) {
|
if (empty ($data)) {
|
||||||
echo fs_error_image ();
|
echo fs_error_image ();
|
||||||
|
@ -2041,6 +2045,12 @@ function graph_netflow_total_area ($data, $period, $width, $height, $title, $uni
|
||||||
$flash_chart = false;
|
$flash_chart = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($config['homeurl'] != '') {
|
||||||
|
$homeurl = $config['homeurl'] . '/';
|
||||||
|
} else {
|
||||||
|
$homeurl = '';
|
||||||
|
}
|
||||||
|
|
||||||
return area_graph($flash_chart, $chart, $width, $height, array (), array (),
|
return area_graph($flash_chart, $chart, $width, $height, array (), array (),
|
||||||
array (), "images/image_problem.opaque.png", "", "", $homeurl,
|
array (), "images/image_problem.opaque.png", "", "", $homeurl,
|
||||||
$config['homedir'] . "/images/logo_vertical_water.png",
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
|
@ -2050,12 +2060,10 @@ function graph_netflow_total_area ($data, $period, $width, $height, $title, $uni
|
||||||
/**
|
/**
|
||||||
* Print a pie graph with netflow aggregated
|
* Print a pie graph with netflow aggregated
|
||||||
*/
|
*/
|
||||||
function graph_netflow_aggregate_pie ($data) {
|
function graph_netflow_aggregate_pie ($data, $aggregate) {
|
||||||
global $config;
|
global $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
|
|
||||||
echo"<h4>".__('Graphic totalized')."</h4>";
|
|
||||||
|
|
||||||
if (empty ($data)) {
|
if (empty ($data)) {
|
||||||
echo fs_error_image ();
|
echo fs_error_image ();
|
||||||
return;
|
return;
|
||||||
|
@ -2073,6 +2081,7 @@ function graph_netflow_aggregate_pie ($data) {
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pie3d_graph($config['flash_charts'], $values, 320, 200,
|
return pie3d_graph($config['flash_charts'], $values, 320, 200,
|
||||||
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
|
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
$config['fontpath'], $config['font_size']);
|
$config['fontpath'], $config['font_size']);
|
||||||
|
|
|
@ -184,7 +184,7 @@ function sort_netflow_data (&$netflow_data) {
|
||||||
usort($netflow_data, "compare_flows");
|
usort($netflow_data, "compare_flows");
|
||||||
}
|
}
|
||||||
|
|
||||||
function netflow_stat_table ($data, $start_date, $end_date, $show){
|
function netflow_stat_table ($data, $start_date, $end_date, $aggregate, $unit){
|
||||||
global $nfdump_date_format;
|
global $nfdump_date_format;
|
||||||
|
|
||||||
$start_date = date ($nfdump_date_format, $start_date);
|
$start_date = date ($nfdump_date_format, $start_date);
|
||||||
|
@ -193,28 +193,27 @@ function netflow_stat_table ($data, $start_date, $end_date, $show){
|
||||||
$table->width = '50%';
|
$table->width = '50%';
|
||||||
$table->class = 'databox';
|
$table->class = 'databox';
|
||||||
$table->data = array();
|
$table->data = array();
|
||||||
$title = __('From')." ".$start_date." ".__('to')." ".$end_date;
|
|
||||||
$j = 0;
|
$j = 0;
|
||||||
$x = 1;
|
$x = 1;
|
||||||
|
|
||||||
echo"<h4>".__('Amount per period')." (".$show.")</h4>";
|
$table->data[0][0] = '<b>' . __($aggregate) . '</b>';
|
||||||
$table->data[0][0] = '<b>'.__('Rank').'</b>';
|
$table->data[0][1] = '<b>' . __($unit) . '</b>';
|
||||||
$table->data[0][1] = '<b>'.$title.'</b>';
|
|
||||||
|
|
||||||
while (isset ($data[$j])) {
|
while (isset ($data[$j])) {
|
||||||
$agg = $data[$j]['agg'];
|
$agg = $data[$j]['agg'];
|
||||||
if (!isset($values[$agg])){
|
if (!isset($values[$agg])){
|
||||||
$values[$agg] = $data[$j]['data'];
|
$values[$agg] = $data[$j]['data'];
|
||||||
$table->data[$x][0] = $agg;
|
$table->data[$x][0] = $agg;
|
||||||
$table->data[$x][1] = format_numeric ($data[$j]['data']) .' '.$show;
|
$table->data[$x][1] = format_numeric ($data[$j]['data']);
|
||||||
} else {
|
} else {
|
||||||
$values[$agg] += $data[$j]['data'];
|
$values[$agg] += $data[$j]['data'];
|
||||||
$table->data[$x][0] = $agg;
|
$table->data[$x][0] = $agg;
|
||||||
$table->data[$x][1] = format_numeric ($data[$j]['data']) .' '.$show;
|
$table->data[$x][1] = format_numeric ($data[$j]['data']);
|
||||||
}
|
}
|
||||||
$j++;
|
$j++;
|
||||||
$x++;
|
$x++;
|
||||||
}
|
}
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,11 +223,11 @@ html_print_table($table);
|
||||||
* @param array data Statistic data.
|
* @param array data Statistic data.
|
||||||
* @param string start_date Start date.
|
* @param string start_date Start date.
|
||||||
* @param string end_date End date.
|
* @param string end_date End date.
|
||||||
* @param string unit Unit to display.
|
* @param string aggregate Aggregate field.
|
||||||
*
|
*
|
||||||
* @return The statistics table.
|
* @return The statistics table.
|
||||||
*/
|
*/
|
||||||
function netflow_data_table ($data, $start_date, $end_date, $unit){
|
function netflow_data_table ($data, $start_date, $end_date, $aggregate) {
|
||||||
global $nfdump_date_format;
|
global $nfdump_date_format;
|
||||||
|
|
||||||
$period = $end_date - $start_date;
|
$period = $end_date - $start_date;
|
||||||
|
@ -253,12 +252,11 @@ function netflow_data_table ($data, $start_date, $end_date, $unit){
|
||||||
}
|
}
|
||||||
|
|
||||||
$values = array();
|
$values = array();
|
||||||
//$table->size = array ('50%');
|
$table->size = array ('50%');
|
||||||
$table->class = 'databox';
|
$table->class = 'databox';
|
||||||
$table->data = array();
|
$table->data = array();
|
||||||
|
|
||||||
echo"<h4>".__('Table values'). " (".$unit.")</h4>";
|
$table->data[0][0] = '<b>'.__($aggregate).'</b>';
|
||||||
$table->data[0][0] = '<b>'.__('Rank').'</b>';
|
|
||||||
|
|
||||||
$j = 0;
|
$j = 0;
|
||||||
$source_index = array ();
|
$source_index = array ();
|
||||||
|
@ -326,6 +324,7 @@ function netflow_get_data ($start_date, $end_date, $command, $unique_id, $aggreg
|
||||||
$values['sources'] = array ();
|
$values['sources'] = array ();
|
||||||
$agg_command = $command . " -s $aggregate/$unit -n $max -t ".date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
|
$agg_command = $command . " -s $aggregate/$unit -n $max -t ".date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
|
||||||
exec($agg_command, $string);
|
exec($agg_command, $string);
|
||||||
|
|
||||||
foreach($string as $line){
|
foreach($string as $line){
|
||||||
if ($line=='') {
|
if ($line=='') {
|
||||||
continue;
|
continue;
|
||||||
|
@ -381,7 +380,7 @@ function netflow_get_data ($start_date, $end_date, $command, $unique_id, $aggreg
|
||||||
function netflow_get_stats ($start_date, $end_date, $command, $aggregate, $max, $unit){
|
function netflow_get_stats ($start_date, $end_date, $command, $aggregate, $max, $unit){
|
||||||
global $nfdump_date_format;
|
global $nfdump_date_format;
|
||||||
|
|
||||||
$command .= ' -s ' . $aggregate . ' -n ' . $max . ' -t '.date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
|
$command .= " -s $aggregate/$unit -n $max -t " .date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
|
||||||
exec($command, $string);
|
exec($command, $string);
|
||||||
|
|
||||||
if(! is_array($string)){
|
if(! is_array($string)){
|
||||||
|
|
|
@ -136,6 +136,7 @@ for ($x = 0; isset($all_rcs[$x]['id_rc']); $x++) {
|
||||||
// Get item filters
|
// Get item filters
|
||||||
$filter = db_get_row_sql("SELECT * FROM tnetflow_filter WHERE id_sg = '" . io_safe_input ($content_report['id_filter']) . "'", false, true);
|
$filter = db_get_row_sql("SELECT * FROM tnetflow_filter WHERE id_sg = '" . io_safe_input ($content_report['id_filter']) . "'", false, true);
|
||||||
$command = netflow_get_command ($filter);
|
$command = netflow_get_command ($filter);
|
||||||
|
$title = $filter['id_name'];
|
||||||
$aggregate = $filter['aggregate'];
|
$aggregate = $filter['aggregate'];
|
||||||
$unit = $filter['output'];
|
$unit = $filter['output'];
|
||||||
|
|
||||||
|
@ -145,23 +146,28 @@ for ($x = 0; isset($all_rcs[$x]['id_rc']); $x++) {
|
||||||
$unique_id = $report_id . '_' . $content_id . '_' . ($end_date - $start_date);
|
$unique_id = $report_id . '_' . $content_id . '_' . ($end_date - $start_date);
|
||||||
$data = netflow_get_data ($start_date, $end_date, $command, $unique_id, $aggregate, $max_aggregates, $unit);
|
$data = netflow_get_data ($start_date, $end_date, $command, $unique_id, $aggregate, $max_aggregates, $unit);
|
||||||
if ($aggregate != 'none') {
|
if ($aggregate != 'none') {
|
||||||
echo graph_netflow_aggregate_area($data, $interval, 660, 320, '', '', '', '', $end_date, $unit);
|
echo '<h4>' . $title . ' (' . __($aggregate) . '/' . __($unit) . ')</h4>';
|
||||||
|
echo graph_netflow_aggregate_area($data, $interval, 660, 320, 0);
|
||||||
} else {
|
} else {
|
||||||
echo graph_netflow_total_area($data, $interval, 660, 320, '', '','','',$date);
|
echo '<h4>' . $title . ' (' . __($unit) . ')</h4>';
|
||||||
|
echo graph_netflow_total_area($data, $interval, 660, 320, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '1':
|
case '1':
|
||||||
$result = 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 graph_netflow_aggregate_pie($result);
|
echo '<h4>' . $title . ' (' . __($aggregate) . '/' . __($unit) . ')</h4>';
|
||||||
|
echo graph_netflow_aggregate_pie($data, $aggregate, $unit, $title);
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
$unique_id = $report_id . '_' . $content_id . '_' . ($end_date - $start_date);
|
$unique_id = $report_id . '_' . $content_id . '_' . ($end_date - $start_date);
|
||||||
$data = netflow_get_data ($start_date, $end_date, $command, $unique_id, $aggregate, $max_aggregates, $unit);
|
$data = netflow_get_data ($start_date, $end_date, $command, $unique_id, $aggregate, $max_aggregates, $unit);
|
||||||
echo netflow_data_table ($data, $start_date, $end_date, $unit);
|
echo '<h4>' . $title . ' (' . __($aggregate) . '/' . __($unit) . ')</h4>';
|
||||||
|
echo netflow_data_table ($data, $start_date, $end_date, $aggregate);
|
||||||
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_stat_table ($data, $start_date, $end_date, $unit);
|
echo '<h4>' . $title . '</h4>';
|
||||||
|
echo netflow_stat_table ($data, $start_date, $end_date, $aggregate, $unit);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
echo fs_error_image();
|
echo fs_error_image();
|
||||||
|
|
Loading…
Reference in New Issue