Ent 6850 quitar nta

This commit is contained in:
Daniel Maya 2021-03-24 15:16:13 +00:00 committed by Daniel Rodriguez
parent 9f22c061f5
commit 79914082e9
14 changed files with 50 additions and 454 deletions

View File

@ -74,3 +74,4 @@ enterprise/extensions/ipam
enterprise/extensions/disabled/visual_console_manager.php
enterprise/extensions/visual_console_manager.php
pandora_console/extensions/net_tools.php
operation/network/network_explorer.php

View File

@ -770,12 +770,6 @@ switch ($action) {
// Max values.
break;
case 'nt_top_n':
$period = $item['period'];
$description = $item['description'];
$top_n_value = $item['top_n_value'];
break;
case 'permissions_report':
$description = $item['description'];
$es = json_decode($item['external_source'], true);
@ -818,7 +812,6 @@ switch ($action) {
case 'simple_baseline_graph':
case 'event_report_log':
case 'increment':
case 'nt_top_n':
$label = (isset($style['label'])) ? $style['label'] : '';
break;
@ -5908,12 +5901,6 @@ function chooseType() {
$("#row_historical_db_check").hide();
break;
case 'nt_top_n':
$("#row_description").show();
$("#row_period").show();
$("#row_quantity").show();
break;
case 'permissions_report':
$("#row_description").show();
$("#row_users").show();

View File

@ -1718,14 +1718,6 @@ switch ($action) {
$good_format = true;
break;
case 'nt_top_n':
$values['period'] = get_parameter('period');
$values['top_n_value'] = get_parameter(
'quantity'
);
$good_format = true;
break;
default:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter(
@ -2093,7 +2085,6 @@ switch ($action) {
case 'projection_graph':
case 'prediction_date':
case 'simple_baseline_graph':
case 'nt_top_n':
if ($label != '') {
$style['label'] = $label;
} else {
@ -2379,14 +2370,6 @@ switch ($action) {
$good_format = true;
break;
case 'nt_top_n':
$values['top_n_value'] = get_parameter(
'quantity'
);
$values['period'] = get_parameter('period');
$good_format = true;
break;
default:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter(
@ -2727,7 +2710,6 @@ switch ($action) {
case 'projection_graph':
case 'prediction_date':
case 'simple_baseline_graph':
case 'nt_top_n':
if ($label != '') {
$style['label'] = $label;
} else {

View File

@ -242,14 +242,6 @@ $table->data[$i++][1] = html_print_checkbox_switch_extended(
true
);
$table->data[$i][0] = __('Enable Network Traffic Analyzer');
$table->data[$i++][1] = html_print_switch(
[
'name' => 'activate_nta',
'value' => $config['activate_nta'],
]
);
$zone_name = [
'Africa' => __('Africa'),

View File

@ -225,10 +225,6 @@ function config_update_config()
$error_update[] = __('Enable Netflow');
}
if (!config_update_value('activate_nta', (bool) get_parameter_switch('activate_nta'))) {
$error_update[] = __('Enable Network Traffic Analyzer');
}
$timezone = (string) get_parameter('timezone');
if ($timezone != '') {
if (!config_update_value('timezone', $timezone)) {
@ -2369,10 +2365,6 @@ function config_process_config()
config_update_value('activate_netflow', 0);
}
if (!isset($config['activate_nta'])) {
config_update_value('activate_nta', 0);
}
if (!isset($config['netflow_path'])) {
if ($is_windows) {
$default = 'C:\PandoraFMS\Pandora_Server\data_in\netflow';

View File

@ -21,70 +21,6 @@
// Write here requires and definitions.
/**
* Get the tnetwok_matrix summatory data.
*
* @param integer $top Number of hosts to show.
* @param boolean $talker Talker (true) or listetener (false).
* @param integer $start Utimestamp of start time.
* @param integer $end Utimestamp of end time.
* @param string $ip_filter Ip to filter.
* @param boolean $order_by_bytes True by top by bytes. False by packets.
* @param array $host_filter Host filter array.
*
* @return array With requested data.
*/
function network_matrix_get_top(
$top,
$talker,
$start,
$end,
$ip_filter='',
$order_by_bytes=true,
$host_filter=[]
) {
$field_to_group = ($talker === true) ? 'source' : 'destination';
$field_to_order = ($order_by_bytes === true) ? 'sum_bytes' : 'sum_pkts';
$filter_sql = '';
if (!empty($ip_filter)) {
$filter_field = ($talker === true) ? 'destination' : 'source';
$filter_sql = sprintf('AND %s="%s"', $filter_field, $ip_filter);
}
$host_filter_sql = '';
if (!empty($host_filter)) {
$host_filter_sql = sprintf(
' AND %s IN ("%s")',
$field_to_group,
implode('","', $host_filter)
);
}
$sql = sprintf(
'SELECT SUM(bytes) sum_bytes, SUM(pkts) sum_pkts, %s host
FROM tnetwork_matrix
WHERE utimestamp > %d AND utimestamp < %d
%s
%s
GROUP BY %s
ORDER BY %s DESC
LIMIT %d',
$field_to_group,
$start,
$end,
$filter_sql,
$host_filter_sql,
$field_to_group,
$field_to_order,
$top
);
$data = db_get_all_rows_sql($sql);
return ($data !== false) ? $data : [];
}
/**
* Get the possible actions on networking.
*
@ -169,84 +105,6 @@ function network_format_bytes($value)
}
/**
* Build netflow data structure to network map.
*
* @param integer $start Time in timestamp format.
* @param integer $end Time in timestamp format.
* @param integer $top Max data to show.
* @param boolean $talker True to get top tolkers. False for listeners.
*
* @return array With map structure.
*/
function network_build_map_data($start, $end, $top, $talker)
{
$data = network_matrix_get_top($top, $talker, $start, $end);
$hosts = array_map(
function ($elem) {
return $elem['host'];
},
$data
);
$inverse_hosts = array_flip($hosts);
$nodes = array_map(
function ($elem) {
return network_init_node_map($elem);
},
$hosts
);
$relations = [];
$orphan_relations = [];
foreach ($hosts as $host) {
$host_top = network_matrix_get_top(
$top,
!$talker,
$start,
$end,
$host,
true,
$hosts
);
foreach ($host_top as $sd) {
$src_index = $inverse_hosts[$host];
$dst_index = $inverse_hosts[$sd['host']];
if (isset($src_index) === false || isset($dst_index) === false) {
continue;
}
network_init_relation_map(
$relations,
$src_index,
$dst_index,
network_format_bytes($sd['sum_bytes'])
);
}
// Put the orphans on Other node.
if (empty($host_top)) {
$other_id = (end($inverse_hosts) + 1);
// TODOS: Add the data.
network_init_relation_map(
$orphan_relations,
$other_id,
$inverse_hosts[$host]
);
}
}
// Put the Others node and their relations.
if (empty($orphan_relations) === false) {
$nodes[] = network_init_node_map(__('Others'));
$relations = array_merge($relations, $orphan_relations);
}
return network_general_map_configuration($nodes, $relations);
}
/**
* Return the array to pass to constructor to NetworkMap.
*

View File

@ -851,14 +851,6 @@ function reporting_make_reporting_data(
);
break;
case 'nt_top_n':
$report['contents'][] = reporting_nt_top_n_report(
$report,
$content,
$pdf
);
break;
default:
// Default.
break;
@ -13580,43 +13572,6 @@ function reporting_header_table_for_pdf($title='', $description='')
}
/**
* Build the required data to build network traffic top N report
*
* @param int Period (time window).
* @param array Information about the item of report.
* @param bool Pdf or not
*
* @return array With report presentation info and report data.
*/
function reporting_nt_top_n_report($period, $content, $pdf)
{
$return = [];
$return['type'] = 'nt_top_n';
$return['title'] = $content['name'];
$return['landscape'] = $content['landscape'];
$return['pagebreak'] = $content['pagebreak'];
$return['description'] = $content['description'];
// Get the data sent and received
$return['data'] = [];
$start_time = ($period['datetime'] - (int) $content['period']);
$return['data']['send'] = network_matrix_get_top(
$content['top_n_value'],
true,
$start_time,
$period['datetime']
);
$return['data']['recv'] = network_matrix_get_top(
$content['top_n_value'],
false,
$start_time,
$period['datetime']
);
return $return;
}
/**
* Will display an hourly analysis of the selected period.
*

View File

@ -403,10 +403,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
reporting_enterprise_html_SLA_monthly($table, $item, $mini);
break;
case 'nt_top_n':
reporting_html_nt_top_n($table, $item, $mini);
break;
case 'SLA_weekly':
reporting_enterprise_html_SLA_weekly($table, $item, $mini);
break;
@ -5591,65 +5587,6 @@ function reporting_get_event_histogram_meta($width)
}
/**
* Print network traffic data into top n tables
* (one for received data and another for sent)
*
* @param stdClass Table class to paint the report
* @param array Associative array with info about
* @param bool Unused
*/
function reporting_html_nt_top_n($table, $item, $mini)
{
// Prepare the table
$table_top = new stdClass();
$table_top->cellpadding = 0;
$table_top->cellspacing = 0;
$table_top->width = '100%';
$table_top->class = 'databox data';
$table_top->cellpadding = 0;
$table_top->cellspacing = 0;
$table_top->width = '100%';
$table_top->class = 'databox data';
$table_top->head['host'] = __('Agent');
$table_top->head['bytes'] = __('Kilobytes');
$table_top->head['pkts'] = __('Packages');
// Build the table for sent packages
if (empty($item['data']['send'])) {
$table->data['send_title'] = '<h3>'.__('No network traffic sent data').'</h3>';
} else {
foreach ($item['data']['send'] as $s_item) {
$table_top->data[] = [
'host' => $s_item['host'],
'bytes' => remove_right_zeros(number_format(($s_item['sum_bytes'] / 1024), $config['graph_precision'])),
'pkts' => remove_right_zeros(number_format($s_item['sum_pkts'], $config['graph_precision'])),
];
}
$table->data['send_title'] = '<h3>'.__('Network traffic sent').'</h3>';
$table->data['send'] = html_print_table($table_top, true);
}
// Reset the table and build the table for received packages
$table_top->data = [];
if (empty($item['data']['send'])) {
$table->data['recv_title'] = '<h3>'.__('No network traffic received data').'</h3>';
} else {
foreach ($item['data']['recv'] as $s_item) {
$table_top->data[] = [
'host' => $s_item['host'],
'bytes' => remove_right_zeros(number_format(($s_item['sum_bytes'] / 1024), $config['graph_precision'])),
'pkts' => remove_right_zeros(number_format($s_item['sum_pkts'], $config['graph_precision'])),
];
}
$table->data['recv_title'] = '<h3>'.__('Network traffic received').'</h3>';
$table->data['recv'] = html_print_table($table_top, true);
}
}
function reporting_html_planned_downtimes_table($planned_downtimes)
{
global $config;

View File

@ -891,13 +891,6 @@ function reports_get_report_types($template=false, $not_editor=false)
];
}
if (!is_metaconsole()) {
$types['nt_top_n'] = [
'optgroup' => __('Network traffic'),
'name' => __('Network Traffic Top N'),
];
}
if ($template === false) {
$types['permissions_report'] = [
'optgroup' => __('Permissions report'),

View File

@ -67,7 +67,7 @@ if (check_acl($config['id_user'], 0, 'AR')) {
enterprise_hook('inventory_menu');
if ($config['activate_netflow'] || $config['activate_nta']) {
if ($config['activate_netflow']) {
$sub['network_traffic'] = [
'text' => __('Network'),
'id' => 'Network',
@ -79,7 +79,6 @@ if (check_acl($config['id_user'], 0, 'AR')) {
// Initialize the submenu.
$netflow_sub = [];
if ($config['activate_netflow']) {
$netflow_sub = array_merge(
$netflow_sub,
[
@ -93,21 +92,7 @@ if (check_acl($config['id_user'], 0, 'AR')) {
],
]
);
}
if ($config['activate_nta']) {
$netflow_sub = array_merge(
$netflow_sub,
[
'operation/network/network_explorer' => [
'text' => __('Network explorer'),
'id' => 'Network explorer',
],
]
);
}
if ($config['activate_nta'] || $config['activate_netflow']) {
$netflow_sub = array_merge(
$netflow_sub,
[
@ -117,7 +102,6 @@ if (check_acl($config['id_user'], 0, 'AR')) {
],
]
);
}
$sub['network_traffic']['sub2'] = $netflow_sub;
}

View File

@ -33,7 +33,6 @@ if (! check_acl($config['id_user'], 0, 'AR')) {
}
$action = get_parameter('action', 'listeners');
$is_network = false;
ui_print_page_header(__('Netflow explorer'));

View File

@ -1,40 +0,0 @@
<?php
/**
* Network explorer
*
* @package Operations.
* @subpackage Network explorer view.
*
* Pandora FMS - http://pandorafms.com
* ==================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
global $config;
check_login();
// ACL Check.
if (! check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Network explorer'
);
include 'general/noaccess.php';
exit;
}
$action = get_parameter('action', 'listeners');
$is_network = true;
ui_print_page_header(__('Network explorer'));
require $config['homedir'].'/operation/network/network_report.php';

View File

@ -66,7 +66,7 @@ $table->class = 'databox filters';
$table->styleTable = 'width: 100%';
$table->data['0']['0'] = __('Data to show').'&nbsp;&nbsp;';
$table->data['0']['0'] .= html_print_select(
network_get_report_actions($is_network),
network_get_report_actions(false),
'action',
$action,
'',
@ -155,16 +155,6 @@ echo '</form>';
// Print the data.
$data = [];
if ($is_network) {
$data = network_matrix_get_top(
$top,
$action === 'talkers',
$utimestamp_lower,
$utimestamp_greater,
$main_value,
$order_by !== 'pkts'
);
} else {
$data = netflow_get_top_summary(
$top,
$action,
@ -173,7 +163,6 @@ if ($is_network) {
$main_value,
$order_by
);
}
// Get the params to return the builder.
$hidden_main_link = [
@ -193,7 +182,6 @@ $table->styleTable = 'width: 60%';
// Print the header.
$table->head = [];
$table->head['main'] = __('IP');
if (!$is_network) {
$table->head['flows'] = network_print_explorer_header(
__('Flows'),
'flows',
@ -203,7 +191,7 @@ if (!$is_network) {
['main_value' => $main_value]
)
);
}
$table->head['pkts'] = network_print_explorer_header(
__('Packets'),
@ -242,9 +230,7 @@ if (get_parameter('export_csv')) {
// Print the header.
echo reset($table->head).$div;
if (!$is_network) {
echo __('Flows').$div;
}
echo __('Packets').$div;
echo __('Bytes').$div;
@ -295,20 +281,14 @@ foreach ($data as $item) {
}
$row['main'] .= '</div>';
if (!$is_network) {
$row['flows'] = format_for_graph($item['sum_flows'], 2);
$row['flows'] .= ' ('.$item['pct_flows'].'%)';
}
$row['pkts'] = format_for_graph($item['sum_pkts'], 2);
if (!$is_network) {
$row['pkts'] .= ' ('.$item['pct_pkts'].'%)';
}
$row['bytes'] = network_format_bytes($item['sum_bytes']);
if (!$is_network) {
$row['bytes'] .= ' ('.$item['pct_bytes'].'%)';
}
$table->data[] = $row;

View File

@ -121,7 +121,6 @@ $table->data['0']['2'] .= html_print_select(
true
);
$table->data['1']['0'] = __('Data to show').'&nbsp;&nbsp;';
$table->data['1']['0'] .= html_print_select(
network_get_report_actions(),
@ -145,23 +144,9 @@ if ((bool) $config['activate_netflow'] === true) {
);
}
$nta_button = '';
if ((bool) $config['activate_nta'] === true) {
$nta_button = html_print_submit_button(
__('Show NTA map'),
'update_nta',
false,
'class="sub upd"',
true
);
}
$table->data['1']['2'] .= implode(
'&nbsp;&nbsp;',
[
$netflow_button,
$nta_button,
]
[$netflow_button]
);
echo '<form method="post">';
@ -181,15 +166,6 @@ if ((bool) get_parameter('update_netflow') === true) {
);
$has_data = !empty($map_data['nodes']);
$first_load = false;
} else if ((bool) get_parameter('update_nta') === true) {
$map_data = network_build_map_data(
$utimestamp_lower,
$utimestamp_greater,
$top,
$action === 'talkers'
);
$has_data = !empty($map_data['nodes']);
$first_load = false;
}
if ($has_data === true) {