2012-10-02 Ramon Novoa <rnovoa@artica.es>

* include/functions_api.php,
	  include/functions_netflow.php,
	  operation/netflow/nf_reporting.php,
	  operation/netflow/nf_view.php: Added XML netflow reports and many
	  changes to enable metaconsole integration.

	* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
	  extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
	  extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Updated
	  migration scripts.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7025 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2012-10-02 11:11:58 +00:00
parent f264bc1dfb
commit f545851b20
8 changed files with 345 additions and 61 deletions

View File

@ -1,3 +1,16 @@
2012-10-02 Ramon Novoa <rnovoa@artica.es>
* include/functions_api.php,
include/functions_netflow.php,
operation/netflow/nf_reporting.php,
operation/netflow/nf_view.php: Added XML netflow reports and many
changes to enable metaconsole integration.
* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Updated
migration scripts.
2012-10-02 Dario Rodriguez <dario.rodriguez@artica.es>
* godmode/setup/setup_visuals.php

View File

@ -148,8 +148,8 @@ ALTER TABLE `tagente_modulo` ADD COLUMN `quiet` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE `tagente_modulo` ADD COLUMN `critical_instructions` TEXT NOT NULL DEFAULT '';
ALTER TABLE `tagente_modulo` ADD COLUMN `warning_instructions` TEXT NOT NULL DEFAULT '';
ALTER TABLE `tagente_modulo` ADD COLUMN `unknown_instructions` TEXT NOT NULL DEFAULT '';
ALTER TABLE `tagente_modulo` ADD COLUMN `critical_inverse` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE `tagente_modulo` ADD COLUMN `warning_inverse` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE `tagente_modulo` ADD COLUMN `critical_inverse` tinyint(1) unsigned default '0';
ALTER TABLE `tagente_modulo` ADD COLUMN `warning_inverse` tinyint(1) unsigned default '0';
------------------------------------------------------------------------
-- Table `tnetwork_component`
@ -162,6 +162,8 @@ ALTER TABLE tnetwork_component ADD `macros` text;
ALTER TABLE tnetwork_component ADD `critical_instructions` TEXT NOT NULL default '';
ALTER TABLE tnetwork_component ADD `warning_instructions` TEXT NOT NULL default '';
ALTER TABLE tnetwork_component ADD `unknown_instructions` TEXT NOT NULL default '';
ALTER TABLE `tnetwork_component` ADD COLUMN `critical_inverse` tinyint(1) unsigned default '0';
ALTER TABLE `tnetwork_component` ADD COLUMN `warning_inverse` tinyint(1) unsigned default '0';
------------------------------------------------------------------------
-- Table `tgraph_source` Alter table to allow negative values in weight

View File

@ -322,6 +322,8 @@ ALTER TABLE tlayout_data ADD (enable_link NUMBER(5, 0) NOT NULL default 1);
ALTER TABLE tagente_modulo ADD (critical_instructions VARCHAR2(255) default '');
ALTER TABLE tagente_modulo ADD (warning_instructions VARCHAR2(255) default '');
ALTER TABLE tagente_modulo ADD (unknown_instructions VARCHAR2(255) default '');
ALTER TABLE tagente_modulo ADD (critical_inverse NUMBER(1, 0) default 0 NOT NULL);
ALTER TABLE tagente_modulo ADD (warning_inverse NUMBER(1, 0) default 0 NOT NULL);
-- -----------------------------------------------------
-- Table `tnetwork_component`
@ -329,6 +331,9 @@ ALTER TABLE tagente_modulo ADD (unknown_instructions VARCHAR2(255) default '');
ALTER TABLE tnetwork_component ADD (critical_instructions VARCHAR2(255) default '');
ALTER TABLE tnetwork_component ADD (warning_instructions VARCHAR2(255) default '');
ALTER TABLE tnetwork_component ADD (unknown_instructions VARCHAR2(255) default '');
ALTER TABLE tnetwork_component ADD (critical_inverse NUMBER(1, 0) default 0 NOT NULL);
ALTER TABLE tnetwork_component ADD (warning_inverse NUMBER(1, 0) default 0 NOT NULL);
evento
------------------------------------------------------------------------
-- Table `tnetwork_map`

View File

@ -171,6 +171,8 @@ ALTER TABLE "tagente_modulo" ADD COLUMN "macros" TEXT default '';
ALTER TABLE "tagente_modulo" ADD COLUMN "critical_instructions" text default '';
ALTER TABLE "tagente_modulo" ADD COLUMN "warning_instructions" text default '';
ALTER TABLE "tagente_modulo" ADD COLUMN "unknown_instructions" text default '';
ALTER TABLE "tagente_modulo" ADD COLUMN "critical_inverse" SMALLINT NOT NULL default 0;
ALTER TABLE "tagente_modulo" ADD COLUMN "warning_inverse" SMALLINT NOT NULL default 0;
-- -----------------------------------------------------
-- Table `tevent_filter`
@ -321,6 +323,8 @@ ALTER TABLE "tlayout_data" ADD COLUMN "enable_link" SMALLINT NOT NULL default 1;
ALTER TABLE "tnetwork_component" ADD COLUMN "critical_instructions" text default '';
ALTER TABLE "tnetwork_component" ADD COLUMN "warning_instructions" text default '';
ALTER TABLE "tnetwork_component" ADD COLUMN "unknown_instructions" text default '';
ALTER TABLE "tnetwork_component" ADD COLUMN "critical_inverse" SMALLINT NOT NULL default 0;
ALTER TABLE "tnetwork_component" ADD COLUMN "warning_inverse" SMALLINT NOT NULL default 0;
------------------------------------------------------------------------
-- Table `tnetwork_map`

View File

@ -27,6 +27,7 @@ include_once($config['homedir'] . "/include/functions_graph.php");
include_once($config['homedir'] . "/include/functions_events.php");
include_once($config['homedir'] . "/include/functions_groups.php");
include_once($config['homedir'] . "/include/functions_network_components.php");
include_once($config['homedir'] . "/include/functions_netflow.php");
enterprise_include_once ('include/functions_local_components.php');
/**
@ -141,6 +142,9 @@ function returnData($returnType, $data, $separator = ';') {
break;
}
break;
case 'json':
echo json_encode ($data);
break;
}
}
@ -5540,4 +5544,57 @@ function api_get_tactical_view($trash1, $trash2, $trash3, $returnType) {
return;
}
// http://localhost/pandora_console/include/api.php?op=get&op2=netflow_get_data&other=1348562410|1348648810|base64_encode(json_encode($filter))|_1_1234|none|50|bytes&other_mode=url_encode_separator_|&apipass=pandora&user=pandora&pass=pandora'
function api_get_netflow_get_data ($discard_1, $discard_2, $params) {
// Parse function parameters
$start_date = $params['data'][0];
$end_date = $params['data'][1];
$filter = json_decode (base64_decode ($params['data'][2]), true);
$unique_id = $params['data'][3];
$aggregate = $params['data'][4];
$max = $params['data'][5];
$unit = $params['data'][6];
// Get netflow data
$data = netflow_get_data ($start_date, $end_date, $filter, $unique_id, $aggregate, $max, $unit);
returnData('json', $data);
return;
}
// http://localhost/pandora_console/include/api.php?op=get&op2=netflow_get_stats&other=1348562410|1348648810|base64_encode(json_encode($filter))|none|50|bytes&other_mode=url_encode_separator_|&apipass=pandora&user=pandora&pass=pandora'
function api_get_netflow_get_stats ($discard_1, $discard_2, $params) {
// Parse function parameters
$start_date = $params['data'][0];
$end_date = $params['data'][1];
$filter = json_decode (base64_decode ($params['data'][2]), true);
$aggregate = $params['data'][3];
$max = $params['data'][4];
$unit = $params['data'][5];
// Get netflow data
$data = netflow_get_stats ($start_date, $end_date, $filter, $aggregate, $max_aggregates, $unit);
returnData('json', $data);
return;
}
// http://localhost/pandora_console/include/api.php?op=get&op2=netflow_get_summary&other=1348562410|1348648810|_base64_encode(json_encode($filter))|_1_1234&other_mode=url_encode_separator_|&apipass=pandora&user=pandora&pass=pandora'
function api_get_netflow_get_summary ($discard_1, $discard_2, $params) {
// Parse function parameters
$start_date = $params['data'][0];
$end_date = $params['data'][1];
$filter = json_decode (base64_decode ($params['data'][2]), true);
$unique_id = $params['data'][3];
// Get netflow data
$data = netflow_get_summary ($start_date, $end_date, $filter, $unique_id);
returnData('json', $data);
return;
}
?>

View File

@ -15,8 +15,8 @@
// GNU General Public License for more details.
include_once("include/functions_users.php");
include_once("include/functions_io.php");
include_once($config['homedir'] . "/include/functions_users.php");
include_once($config['homedir'] . "/include/functions_io.php");
// Date format for nfdump
$nfdump_date_format = 'Y/m/d.H:i:s';
@ -355,7 +355,7 @@ function netflow_is_net ($address) {
*
* @param string start_date Period start date.
* @param string end_date Period end date.
* @param string command Command used to retrieve netflow data.
* @param string filter Netflow filter.
* @param string unique_id A unique number that is used to generate a cache file.
* @param string aggregate Aggregate field.
* @param int max Maximum number of aggregates.
@ -364,10 +364,13 @@ function netflow_is_net ($address) {
* @return An array with netflow stats.
*
*/
function netflow_get_data ($start_date, $end_date, $command, $unique_id, $aggregate, $max, $unit) {
function netflow_get_data ($start_date, $end_date, $filter, $unique_id, $aggregate, $max, $unit) {
global $nfdump_date_format;
global $config;
// Get the command to call nfdump
$command = netflow_get_command ($filter);
// Suppress the header line and the statistics at the bottom
$command .= ' -q';
@ -424,16 +427,20 @@ function netflow_get_data ($start_date, $end_date, $command, $unique_id, $aggreg
*
* @param string start_date Period start date.
* @param string end_date Period end date.
* @param string command Command used to retrieve netflow data.
* @param string filter Netflow filter.
* @param string aggregate Aggregate field.
* @param int max Maximum number of aggregates.
* @param string unit Unit to show.
*
* @return An array with netflow stats.
*/
function netflow_get_stats ($start_date, $end_date, $command, $aggregate, $max, $unit) {
function netflow_get_stats ($start_date, $end_date, $filter, $aggregate, $max, $unit) {
global $nfdump_date_format;
// Get the command to call nfdump
$command = netflow_get_command ($filter);
// Execute nfdump
$command .= " -q -s $aggregate/$unit -n $max -t " .date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
exec($command, $string);
@ -486,15 +493,18 @@ function netflow_get_stats ($start_date, $end_date, $command, $aggregate, $max,
*
* @param string start_date Period start date.
* @param string end_date Period end date.
* @param string command Command used to retrieve netflow data.
* @param string filter Netflow filter.
* @param string unique_id A unique number that is used to generate a cache file.
*
* @return An array with netflow stats.
*/
function netflow_get_summary ($start_date, $end_date, $command, $unique_id) {
function netflow_get_summary ($start_date, $end_date, $filter, $unique_id) {
global $nfdump_date_format;
global $config;
// Get the command to call nfdump
$command = netflow_get_command ($filter);
// Execute nfdump and save its output in a temporary file
$temp_file = $config['attachment_store'] . '/netflow_' . $unique_id . '.tmp';
$command .= " -o \"fmt: \" -t " .date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
@ -842,7 +852,7 @@ function netflow_parse_file ($start_date, $end_date, $file, &$values, $aggregate
*/
function netflow_save_cache ($data, $cache_file) {
@file_put_contents ($cache_file, serialize ($data));
//@file_put_contents ($cache_file, serialize ($data));
return;
}
@ -969,48 +979,216 @@ function netflow_get_valid_intervals () {
* @param string start_date Period start date.
* @param string end_date Period end date.
* @param string type Chart type.
* @param string command Command used to retrieve netflow data.
* @param array filter Netflow filter.
* @param int max_aggregates Maximum number of aggregates.
* @param string unique_id A unique number that is used to generate a cache file.
* @param string output Output format. Only HTML and XML are supported.
*
*/
function netflow_draw_item ($start_date, $end_date, $type, $filter, $command, $filter, $max_aggregates, $unique_id) {
function netflow_draw_item ($start_date, $end_date, $type, $filter, $max_aggregates, $unique_id, $output = 'HTML') {
$aggregate = $filter['aggregate'];
$unit = $filter['output'];
$interval = $end_date - $start_date;
// Process item
switch ($type) {
case '0':
$data = netflow_get_data ($start_date, $end_date, $command, $unique_id, $aggregate, $max_aggregates, $unit);
$data = netflow_get_data ($start_date, $end_date, $filter, $unique_id, $aggregate, $max_aggregates, $unit);
if ($aggregate != 'none') {
echo graph_netflow_aggregate_area($data, $interval, 660, 320, 0);
if ($output == 'HTML') {
echo graph_netflow_aggregate_area($data, $interval, 660, 320, 0);
} else if ($output == 'XML') {
netflow_aggregate_area_xml ($data);
}
}
else {
echo graph_netflow_total_area($data, $interval, 660, 320, 0);
if ($output == 'HTML') {
echo graph_netflow_total_area($data, $interval, 660, 320, 0);
} else if ($output == 'XML') {
netflow_total_area_xml ($data);
}
}
break;
case '1':
$data = netflow_get_stats ($start_date, $end_date, $command, $aggregate, $max_aggregates, $unit);
echo graph_netflow_aggregate_pie($data, $aggregate);
$data = netflow_get_stats ($start_date, $end_date, $filter, $aggregate, $max_aggregates, $unit);
if ($output == 'HTML') {
echo graph_netflow_aggregate_pie($data, $aggregate);
} else if ($output == 'XML') {
netflow_aggregate_pie_xml ($data);
}
break;
case '2':
$data = netflow_get_data ($start_date, $end_date, $command, $unique_id, $aggregate, $max_aggregates, $unit);
echo netflow_data_table ($data, $start_date, $end_date, $aggregate);
$data = netflow_get_data ($start_date, $end_date, $filter, $unique_id, $aggregate, $max_aggregates, $unit);
if ($output == 'HTML') {
echo netflow_data_table ($data, $start_date, $end_date, $aggregate);
} else if ($output == 'XML') {
// Same as netflow_aggregate_area_xml
netflow_aggregate_area_xml ($data);
}
break;
case '3':
$data = netflow_get_stats ($start_date, $end_date, $command, $aggregate, $max_aggregates, $unit);
echo netflow_stat_table ($data, $start_date, $end_date, $aggregate, $unit);
$data = netflow_get_stats ($start_date, $end_date, $filter, $aggregate, $max_aggregates, $unit);
if ($output == 'HTML') {
echo netflow_stat_table ($data, $start_date, $end_date, $aggregate, $unit);
} else if ($output == 'XML') {
netflow_stat_xml ($data);
}
break;
case '4':
$data = netflow_get_summary ($start_date, $end_date, $command, $unique_id);
netflow_summary_table ($data);
$data = netflow_get_summary ($start_date, $end_date, $filter, $unique_id);
if ($output == 'HTML') {
netflow_summary_table ($data);
} else {
netflow_summary_xml ($data);
}
break;
default:
echo fs_error_image();
break;
}
}
?>
function netflow_xml_report ($id, $start_date, $end_date) {
// Get report data
$report = db_get_row_sql ('SELECT * FROM tnetflow_report WHERE id_report =' . (int) $id);
if ($report === FALSE) {
echo "<report>" . __('Error generating report') . "</report>\n";
return;
}
// Print report header
$time = get_system_time ();
echo '<?xml version="1.0" encoding="UTF-8" ?>';
echo "<report>\n";
echo " <generated>\n";
echo " <unix>" . $time . "</unix>\n";
echo " <rfc2822>" . date ("r", $time) . "</rfc2822>\n";
echo " </generated>\n";
echo " <name>" . io_safe_output ($report['id_name']) . "</name>\n";
echo " <description>" . io_safe_output ($report['description']) . "</description>\n";
echo " <start_date>" . date ("r", $start_date) . "</start_date>\n";
echo " <end_date>" . date ("r", $end_date) . "</end_date>\n";
// Get netflow item types
$item_types = netflow_get_chart_types ();
// Print report items
$report_contents = db_get_all_rows_sql ("SELECT * FROM tnetflow_report_content WHERE id_report='" . $report['id_report'] . "' ORDER BY `order`");
foreach ($report_contents as $content) {
// Get item filters
$filter = db_get_row_sql("SELECT * FROM tnetflow_filter WHERE id_sg = '" . io_safe_input ($content['id_filter']) . "'", false, true);
if ($filter === FALSE) {
continue;
}
echo " <report_item>\n";
echo " <type>" . io_safe_output ($item_types[$content['show_graph']]) . "</type>\n";
echo " <max_aggregates>" . $content['max'] . "</max_aggregates>\n";
echo " <filter>\n";
echo " <name>" . io_safe_output ($filter['id_name']) . "</name>\n";
echo " <src_ip>" . io_safe_output ($filter['ip_src']) . "</src_ip>\n";
echo " <dst_ip>" . io_safe_output ($filter['ip_dst']) . "</dst_ip>\n";
echo " <src_port>" . io_safe_output ($filter['src_port']) . "</src_port>\n";
echo " <dst_port>" . io_safe_output ($filter['src_port']) . "</dst_port>\n";
echo " <advanced>" . io_safe_output ($filter['advanced_filter']) . "</advanced>\n";
echo " <aggregate>" . io_safe_output ($filter['aggregate']) . "</aggregate>\n";
echo " <unit>" . io_safe_output ($filter['output']) . "</unit>\n";
echo " </filter>\n";
// Build a unique id for the cache
$unique_id = $report['id_report'] . '_' . $content['id_rc'] . '_' . ($end_date - $start_date);
netflow_draw_item ($start_date, $end_date, $content['show_graph'], $filter, $content['max'], $unique_id, 'XML');
echo " </report_item>\n";
}
echo "</report>\n";
}
function netflow_aggregate_area_xml ($data) {
// Print source information
echo "<aggregates>\n";
foreach ($data['sources'] as $source => $discard) {
echo "<aggregate>$source</aggregate>\n";
}
echo "</aggregates>\n";
// Print flow information
echo "<flows>\n";
foreach ($data['data'] as $timestamp => $flow) {
echo "<flow>\n";
echo " <timestamp>" . $timestamp . "</timestamp>\n";
echo " <aggregates>\n";
foreach ($flow as $source => $data) {
echo " <aggregate>$source</aggregate>\n";
echo " <data>" . $data . "</data>\n";
}
echo " </aggregates>\n";
echo "</flow>\n";
}
echo "</flows>\n";
}
function netflow_total_area_xml ($data) {
// Print flow information
echo "<flows>\n";
foreach ($data as $timestamp => $flow) {
echo "<flow>\n";
echo " <timestamp>" . $timestamp . "</timestamp>\n";
echo " <data>" . $flow['data'] . "</data>\n";
echo "</flow>\n";
}
echo "</flows>\n";
}
function netflow_aggregate_pie_xml ($data) {
// Calculate total
$total = 0;
foreach ($data as $flow) {
$total += $flow['data'];
}
if ($total == 0) {
return;
}
// Print percentages
echo "<pie>\n";
foreach ($data as $flow) {
echo "<aggregate>" . $flow['agg'] . "</aggregate>\n";
echo "<data>" . format_numeric (100 * $flow['data'] / $total, 2) . "%</data>\n";
}
echo "</pie>\n";
}
function netflow_stat_xml ($data) {
// Print stats
echo "<stats>\n";
foreach ($data as $flow) {
echo "<aggregate>" . $flow['agg'] . "</aggregate>\n";
echo "<data>" . $flow['data'] . "</data>\n";
}
echo "</stats>\n";
}
function netflow_summary_xml ($data) {
// Print summary
echo "<summary>\n";
echo " <total_flows>" . $data['totalflows'] . "</total_flows>\n";
echo " <total_bytes>" . $data['totalbytes'] . "</total_bytes>\n";
echo " <total_packets>" . $data['totalbytes'] . "</total_packets>\n";
echo " <average_bps>" . $data['avgbps'] . "</average_bps>\n";
echo " <average_pps>" . $data['avgpps'] . "</average_pps>\n";
echo " <average_bpp>" . $data['avgpps'] . "</average_bpp>\n";
echo "</summary>\n";
}
?>

View File

@ -16,10 +16,10 @@
global $config;
include_once("include/functions_ui.php");
include_once("include/functions_db.php");
include_once("include/functions_netflow.php");
include_once("include/functions_html.php");
include_once($config['homedir'] . "/include/functions_ui.php");
include_once($config['homedir'] . "/include/functions_db.php");
include_once($config['homedir'] . "/include/functions_netflow.php");
include_once($config['homedir'] . "/include/functions_html.php");
check_login ();
@ -81,12 +81,8 @@ foreach ($reports as $report) {
$data[0] = '<a href="index.php?sec=netf&sec2=operation/netflow/nf_view&id='.$report['id_report'].'">'.$report['id_name'].'</a>';
$data[1] = $report['description'];
$group = db_get_value('nombre','tgrupo', 'id_grupo', $report['id_group']);
if ($group == '')
$group = 'All';
$data[2] = $group;
$data[2] = ui_print_group_icon($report['id_group'], true);
array_push ($table->data, $data);
}

View File

@ -16,10 +16,39 @@
global $config;
include_once("include/functions_graph.php");
include_once("include/functions_ui.php");
include_once("include/functions_netflow.php");
ui_require_javascript_file ('calendar');
// Login check
if (isset ($_GET["direct"])) {
require_once ("../../include/config.php");
require_once ("../../include/auth/mysql.php");
require_once("../../include/functions_netflow.php");
$nick = get_parameter ("nick");
$pass = get_parameter ("pass");
if (isset ($nick) && isset ($pass)) {
$nick = process_user_login ($nick, $pass);
if ($nick !== false) {
unset ($_GET["sec2"]);
$_GET["sec"] = "general/logon_ok";
db_logon ($nick, $_SERVER['REMOTE_ADDR']);
$_SESSION['id_usuario'] = $nick;
$config['id_user'] = $nick;
//Remove everything that might have to do with people's passwords or logins
unset ($_GET['pass'], $pass, $_POST['pass'], $_REQUEST['pass'], $login_good);
}
else {
// User not known
$login_failed = true;
require_once ('general/login_page.php');
db_pandora_audit("Logon Failed", "Invalid login: ".$nick, $nick);
exit;
}
}
} else {
include_once($config['homedir'] . "/include/functions_graph.php");
include_once($config['homedir'] . "/include/functions_ui.php");
include_once($config['homedir'] . "/include/functions_netflow.php");
ui_require_javascript_file ('calendar');
}
check_login ();
@ -41,19 +70,18 @@ if ($id) {
}
$period = get_parameter('period', '86400');
$update_date = get_parameter('update_date', 0);
if ($update_date) {
$date = get_parameter_post ('date');
$time = get_parameter_post ('time');
$interval = get_parameter('period','86400');
}
else {
$date = date ("Y/m/d", get_system_time ());
$time = date ("H:i:s", get_system_time ());
$interval ='86400';
}
$date = get_parameter_post ('date', date ("Y/m/d", get_system_time ()));
$time = get_parameter_post ('time', date ("H:i:s", get_system_time ()));
$end_date = strtotime ($date . " " . $time);
$start_date = $end_date - $interval;
$start_date = $end_date - $period;
// Generate an XML report
if (isset ($_GET["xml"])) {
header ('Content-type: application/xml; charset="utf-8"', true);
netflow_xml_report ($id, $start_date, $end_date);
return;
}
$buttons['report_list'] = '<a href="index.php?sec=netf&sec2=operation/netflow/nf_reporting">'
. html_print_image ("images/edit.png", true, array ("title" => __('Report list')))
@ -83,11 +111,15 @@ echo '<form method="post" action="index.php?sec=netf&sec2=operation/netflow/nf_v
$table->data[1][0] = '<b>'.__('Interval').'</b>';
$table->data[1][1] = html_print_select (netflow_get_valid_intervals (), 'period', $period, '', '', 0, true, false, false);
$table->data[2][0] = '<b>'.__('Export').'</b>';
$table->data[2][1] = '<a title="XML" href="' . $config['homeurl'] . 'ajax.php?page=' . $config['homedir'] . '/operation/netflow/nf_view&id='.$id."&date=$date&time=$time&period=$period&xml=1\">" . html_print_image("images/database_lightning.png", true) . '</a>';
html_print_table ($table);
echo '<div class="action-buttons" style="width:60%;">';
html_print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"');
html_print_input_hidden ('update_date', 1);
echo '</div>';
echo'</form>';
@ -109,7 +141,7 @@ if (empty ($report_contents)) {
foreach ($report_contents as $content_report) {
// Get report item
$report_id = $all_rcs[$x]['id_rc'];
$report_id = $content_report['id_report'];
$content_id = $content_report['id_rc'];
$max_aggregates= $content_report['max'];
$type = $content_report['show_graph'];
@ -117,9 +149,6 @@ foreach ($report_contents as $content_report) {
// Get item filters
$filter = db_get_row_sql("SELECT * FROM tnetflow_filter WHERE id_sg = '" . io_safe_input ($content_report['id_filter']) . "'", false, true);
// Get the command to call nfdump
$command = netflow_get_command ($filter);
if ($filter['aggregate'] != 'none') {
echo '<h4>' . $filter['id_name'] . ' (' . __($filter['aggregate']) . '/' . __($filter['output']) . ')</h4>';
}
@ -131,6 +160,6 @@ foreach ($report_contents as $content_report) {
$unique_id = $report_id . '_' . $content_id . '_' . ($end_date - $start_date);
// Draw
netflow_draw_item ($start_date, $end_date, $type, $filter, $command, $filter, $max_aggregates, $unique_id);
netflow_draw_item ($start_date, $end_date, $type, $filter, $max_aggregates, $unique_id);
}
?>