diff --git a/pandora_console/extras/mr/26.sql b/pandora_console/extras/mr/26.sql
index 4361da07d4..0191b46c6e 100644
--- a/pandora_console/extras/mr/26.sql
+++ b/pandora_console/extras/mr/26.sql
@@ -11,6 +11,8 @@ CREATE TABLE IF NOT EXISTS `tnetwork_matrix` (
UNIQUE (`source`, `destination`, `utimestamp`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;
+UPDATE `treport_content` SET type="netflow_summary" WHERE type="netflow_pie" OR type="netflow_statistics";
+
-- ----------------------------------------------------------------------
-- Add column in table `tagent_custom_fields`
-- ----------------------------------------------------------------------
diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
index fcac6fb9b8..0ac1071058 100644
--- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
+++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
@@ -1376,6 +1376,7 @@ ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300';
ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0';
ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0';
ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL;
+UPDATE `treport_content` SET type="netflow_summary" WHERE type="netflow_pie" OR type="netflow_statistics";
-- ---------------------------------------------------------------------
-- Table `tmodule_relationship`
diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
index 174103f0bb..b5d189c56d 100755
--- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php
+++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
@@ -597,18 +597,16 @@ switch ($action) {
break;
case 'netflow_area':
- case 'netflow_pie':
case 'netflow_data':
- case 'netflow_statistics':
case 'netflow_summary':
$netflow_filter = $item['text'];
- // Filter
+ // Filter.
$period = $item['period'];
$description = $item['description'];
$resolution = $item['top_n'];
- // Interval resolution
+ // Interval resolution.
$max_values = $item['top_n_value'];
- // Max values
+ // Max values.
break;
case 'nt_top_n':
@@ -3667,16 +3665,6 @@ function chooseType() {
$("#row_historical_db_check").hide();
break;
- case 'netflow_pie':
- $("#row_netflow_filter").show();
- $("#row_description").show();
- $("#row_period").show();
- $("#row_max_values").show();
- $("#row_resolution").show();
- $("#row_servers").show();
- $("#row_historical_db_check").hide();
- break;
-
case 'netflow_data':
$("#row_netflow_filter").show();
$("#row_description").show();
@@ -3688,15 +3676,6 @@ function chooseType() {
break;
case 'netflow_summary':
- $("#row_netflow_filter").show();
- $("#row_description").show();
- $("#row_period").show();
- $("#row_resolution").show();
- $("#row_servers").show();
- $("#row_historical_db_check").hide();
- break;
-
- case 'netflow_statistics':
$("#row_netflow_filter").show();
$("#row_description").show();
$("#row_period").show();
diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php
index fc2de3d302..4708089693 100755
--- a/pandora_console/godmode/reporting/reporting_builder.php
+++ b/pandora_console/godmode/reporting/reporting_builder.php
@@ -1209,9 +1209,7 @@ switch ($action) {
break;
case 'netflow_area':
- case 'netflow_pie':
case 'netflow_data':
- case 'netflow_statistics':
case 'netflow_summary':
$values['text'] = get_parameter('netflow_filter');
$values['description'] = get_parameter('description');
@@ -1583,9 +1581,7 @@ switch ($action) {
break;
case 'netflow_area':
- case 'netflow_pie':
case 'netflow_data':
- case 'netflow_statistics':
case 'netflow_summary':
$values['text'] = get_parameter('netflow_filter');
$values['description'] = get_parameter('description');
diff --git a/pandora_console/include/functions_netflow.php b/pandora_console/include/functions_netflow.php
index 49a3a1dd44..4ff9420aba 100644
--- a/pandora_console/include/functions_netflow.php
+++ b/pandora_console/include/functions_netflow.php
@@ -196,6 +196,7 @@ function netflow_stat_table($data, $start_date, $end_date, $aggregate)
$start_date = date($nfdump_date_format, $start_date);
$end_date = date($nfdump_date_format, $end_date);
$values = [];
+ $table = new stdClass();
$table->width = '100%';
$table->cellspacing = 0;
$table->class = 'databox';
@@ -331,9 +332,10 @@ function netflow_summary_table($data)
global $nfdump_date_format;
$values = [];
- $table->size = ['50%'];
+ $table = new stdClass();
$table->cellspacing = 0;
$table->class = 'databox';
+ $table->styleTable = 'width: 100%';
$table->data = [];
$table->style[0] = 'font-weight: bold; padding: 6px';
@@ -1020,11 +1022,11 @@ function netflow_get_filter_arguments($filter)
function netflow_get_chart_types()
{
return [
- 'netflow_area' => __('Area graph'),
- 'netflow_pie_summatory' => __('Summary'),
- 'netflow_data' => __('Data table'),
- 'netflow_mesh' => __('Circular mesh'),
- 'netflow_host_treemap' => __('Host detailed traffic'),
+ 'netflow_area' => __('Area graph'),
+ 'netflow_summary' => __('Summary'),
+ 'netflow_data' => __('Data table'),
+ 'netflow_mesh' => __('Circular mesh'),
+ 'netflow_host_treemap' => __('Host detailed traffic'),
];
}
@@ -1068,7 +1070,6 @@ function netflow_draw_item(
// Process item.
switch ($type) {
- case '0':
case 'netflow_area':
$data = netflow_get_data(
$start_date,
@@ -1104,7 +1105,6 @@ function netflow_draw_item(
}
break;
- case '2':
case 'netflow_data':
$data = netflow_get_data(
$start_date,
@@ -1136,31 +1136,6 @@ function netflow_draw_item(
}
break;
- case '3':
- case 'netflow_statistics':
- $data = netflow_get_stats(
- $start_date,
- $end_date,
- $filter,
- $aggregate,
- $max_aggregates,
- true,
- $connection_name,
- $address_resolution
- );
- if (empty($data)) {
- break;
- }
-
- if ($output == 'HTML' || $output == 'PDF') {
- $html = netflow_stat_table($data, $start_date, $end_date, $aggregate);
- return $html;
- } else if ($output == 'XML') {
- return netflow_stat_xml($data);
- }
- break;
-
- case '4':
case 'netflow_summary':
$data_summary = netflow_get_summary(
$start_date,
@@ -1172,15 +1147,6 @@ function netflow_draw_item(
break;
}
- if ($output == 'HTML' || $output == 'PDF') {
- return netflow_summary_table($data_summary);
- } else if ($output == 'XML') {
- return netflow_summary_xml($data_summary);
- }
- break;
-
- case '1':
- case 'netflow_pie':
$data_pie = netflow_get_stats(
$start_date,
$end_date,
@@ -1195,62 +1161,31 @@ function netflow_draw_item(
break;
}
- if ($output == 'HTML') {
+ if ($output === 'HTML' || $output === 'PDF') {
+ $html = '
';
+ $html .= '';
+ $html .= '';
+ $html .= netflow_summary_table($data_summary);
+ $html .= ' | ';
+ $html .= '';
+ $html .= graph_netflow_aggregate_pie(
+ $data_pie,
+ netflow_format_aggregate($aggregate),
+ ($output === 'HTML') ? 1 : 2,
+ ($output === 'HTML')
+ );
+ $html .= ' | ';
+ $html .= '
';
+ $html .= '
';
+ $html .= netflow_stat_table(
+ $data_pie,
+ $start_date,
+ $end_date,
+ $aggregate
+ );
return $html;
- } else if ($output == 'PDF') {
- return $html;
- } else if ($output == 'XML') {
- return $xml;
- }
- break;
-
- case 'netflow_pie_summatory':
- $data_summary = netflow_get_summary(
- $start_date,
- $end_date,
- $filter,
- $connection_name
- );
- if (empty($data_summary)) {
- break;
- }
-
- $data_pie = netflow_get_stats(
- $start_date,
- $end_date,
- $filter,
- $aggregate,
- $max_aggregates,
- true,
- $connection_name,
- $address_resolution
- );
- if (empty($data_pie)) {
- break;
- }
-
- switch ($output) {
- case 'HTML':
- $html = '';
- $html .= '';
- $html .= '';
- $html .= netflow_summary_table($data_summary);
- $html .= ' | ';
- $html .= '';
- $html .= graph_netflow_aggregate_pie($data_pie, netflow_format_aggregate($aggregate));
- $html .= ' | ';
- $html .= '
';
- $html .= '
';
- $html .= '';
- $html .= netflow_stat_table($data_pie, $start_date, $end_date, $aggregate);
- return $html;
-
- case 'XML':
- return netflow_summary_xml($data_summary);
-
- default:
- // Nothing to do.
- break;
+ } else if ($output === 'XML') {
+ return netflow_summary_xml($data_summary, $data_pie);
}
break;
@@ -1409,7 +1344,7 @@ function netflow_aggregate_area_xml($data)
echo ' '.$timestamp."\n";
echo " \n";
foreach ($flow as $source => $data) {
- echo " $source\n";
+ echo ' '.$source."\n";
echo ' '.$data."\n";
}
@@ -1432,75 +1367,37 @@ function netflow_aggregate_area_xml($data)
}
-/**
- * Render a pie chart as an XML.
- *
- * @param array $data Netflow data.
- *
- * @return void XML is echoed.
- */
-function netflow_aggregate_pie_xml($data)
-{
- // Calculate total.
- $total = 0;
- foreach ($data as $flow) {
- $total += $flow['data'];
- }
-
- if ($total == 0) {
- return;
- }
-
- // Print percentages.
- echo "\n";
- foreach ($data as $flow) {
- echo ''.$flow['agg']."\n";
- echo ''.format_numeric((100 * $flow['data'] / $total), 2)."%\n";
- }
-
- echo "\n";
-}
-
-
-/**
- * Render a stats table as an XML.
- *
- * @param array $data Netflow data.
- *
- * @return string Wiht XML data.
- */
-function netflow_stat_xml($data)
-{
- // Print stats.
- $xml .= "\n";
- foreach ($data as $flow) {
- $xml .= ''.$flow['agg']."\n";
- $xml .= ''.$flow['data']."\n";
- }
-
- $xml .= "\n";
-
- return $xml;
-}
-
-
/**
* Render a summary table as an XML.
*
- * @param array $data Netflow data.
+ * @param array $data Netflow data.
+ * @param array $rows_data Table info (top N hosts).
*
* @return string Wiht XML data.
*/
-function netflow_summary_xml($data)
+function netflow_summary_xml($data, $rows_data)
{
- // Print summary
+ // Print summary.
$xml = "\n";
- $xml .= ' '.$data['totalflows']."\n";
- $xml .= ' '.$data['totalbytes']."\n";
- $xml .= ' '.$data['totalbytes']."\n";
- $xml .= ' '.$data['avgbps']."\n";
- $xml .= ' '.$data['avgpps']."\n";
- $xml .= ' '.$data['avgpps']."\n";
+ $xml = " \n";
+ $xml .= ' '.$data['totalflows']."\n";
+ $xml .= ' '.$data['totalbytes']."\n";
+ $xml .= ' '.$data['totalbytes']."\n";
+ $xml .= ' '.$data['avgbps']."\n";
+ $xml .= ' '.$data['avgpps']."\n";
+ $xml .= ' '.$data['avgpps']."\n";
+ $xml .= " \n";
+
+ // Add the data table.
+ $xml .= " \n";
+ foreach ($rows_data as $d) {
+ $xml .= "\n";
+ $xml .= ''.$d['agg']."\n";
+ $xml .= ''.$d['data']."\n";
+ $xml .= "\n";
+ }
+
+ $xml .= " \n";
$xml .= "\n";
return $xml;
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index e42a076015..3cc3df6dae 100755
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -517,16 +517,6 @@ function reporting_make_reporting_data(
);
break;
- case 'netflow_pie':
- $report['contents'][] = reporting_netflow(
- $report,
- $content,
- $type,
- $force_width_chart,
- $force_height_chart,
- 'netflow_pie',
- $pdf
- );
break;
case 'netflow_data':
@@ -541,18 +531,6 @@ function reporting_make_reporting_data(
);
break;
- case 'netflow_statistics':
- $report['contents'][] = reporting_netflow(
- $report,
- $content,
- $type,
- $force_width_chart,
- $force_height_chart,
- 'netflow_statistics',
- $pdf
- );
- break;
-
case 'netflow_summary':
$report['contents'][] = reporting_netflow(
$report,
@@ -3972,8 +3950,8 @@ function reporting_monitor_report($report, $content)
* @param string $type Report type (static, dynamic, data).
* @param integer $force_width_chart Fixed width chart.
* @param integer $force_height_chart Fixed height chart.
- * @param string $type_netflow One of netflow_area, netflow_pie,
- * netflow_data, netflow_statistics, netflow_summary.
+ * @param string $type_netflow One of netflow_area, netflow_data,
+ * netflow_summary.
* @param boolean $pdf True if a pdf report is generating.
*
* @return array Report item structure.
@@ -3994,18 +3972,10 @@ function reporting_netflow(
$return['type'] = 'netflow_area';
break;
- case 'netflow_pie':
- $return['type'] = 'netflow_pie';
- break;
-
case 'netflow_data':
$return['type'] = 'netflow_data';
break;
- case 'netflow_statistics':
- $return['type'] = 'netflow_statistics';
- break;
-
case 'netflow_summary':
$return['type'] = 'netflow_summary';
break;
@@ -4021,22 +3991,14 @@ function reporting_netflow(
$content['name'] = __('Netflow Area');
break;
- case 'netflow_pie':
- $content['name'] = __('Netflow Pie');
+ case 'netflow_summary':
+ $content['name'] = __('Netflow Summary');
break;
case 'netflow_data':
$content['name'] = __('Netflow Data');
break;
- case 'netflow_statistics':
- $content['name'] = __('Netflow Statistics');
- break;
-
- case 'netflow_summary':
- $content['name'] = __('Netflow Summary');
- break;
-
default:
$content['name'] = __('Unknown report');
break;
diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php
index 83a786052e..717ed003c4 100644
--- a/pandora_console/include/functions_reporting_html.php
+++ b/pandora_console/include/functions_reporting_html.php
@@ -271,21 +271,7 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
break;
case 'netflow_area':
- reporting_html_graph($table, $item);
- break;
-
- case 'netflow_pie':
- reporting_html_graph($table, $item);
- break;
-
case 'netflow_data':
- reporting_html_graph($table, $item);
- break;
-
- case 'netflow_statistics':
- reporting_html_graph($table, $item);
- break;
-
case 'netflow_summary':
reporting_html_graph($table, $item);
break;
diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php
index 9c2b05339b..0bf1f8fe70 100755
--- a/pandora_console/include/functions_reports.php
+++ b/pandora_console/include/functions_reports.php
@@ -867,18 +867,10 @@ function reports_get_report_types($template=false, $not_editor=false)
'optgroup' => __('Netflow'),
'name' => __('Netflow area chart'),
];
- $types['netflow_pie'] = [
- 'optgroup' => __('Netflow'),
- 'name' => __('Netflow pie chart'),
- ];
$types['netflow_data'] = [
'optgroup' => __('Netflow'),
'name' => __('Netflow data table'),
];
- $types['netflow_statistics'] = [
- 'optgroup' => __('Netflow'),
- 'name' => __('Netflow statistics table'),
- ];
$types['netflow_summary'] = [
'optgroup' => __('Netflow'),
'name' => __('Netflow summary table'),
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index c8905ea076..192d470dfa 100644
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -340,7 +340,7 @@ sub pandora_purgedb ($$) {
} else {
my @blacklist_types = ("'SLA_services'", "'custom_graph'", "'sql_graph_vbar'", "'sql_graph_hbar'",
"'sql_graph_pie'", "'database_serialized'", "'sql'", "'inventory'", "'inventory_changes'",
- "'netflow_area'", "'netflow_pie'", "'netflow_data'", "'netflow_statistics'", "'netflow_summary'");
+ "'netflow_area'", "'netflow_data'", "'netflow_summary'");
my $blacklist_types_str = join(',', @blacklist_types);
# Deleted modules