Added new netflow server filters form
This commit is contained in:
parent
27beea7319
commit
6950624cc9
|
@ -164,4 +164,11 @@ CREATE TABLE IF NOT EXISTS `tfavmenu_user` (
|
||||||
`section` VARCHAR(255) NOT NULL,
|
`section` VARCHAR(255) NOT NULL,
|
||||||
PRIMARY KEY (`id`));
|
PRIMARY KEY (`id`));
|
||||||
|
|
||||||
|
ALTER TABLE `tnetflow_filter` ADD COLUMN `netflow_monitoring` TINYINT UNSIGNED NOT NULL default 0;
|
||||||
|
ALTER TABLE `tnetflow_filter` ADD COLUMN `traffic_max` float(20,2) NOT NULL default 0;
|
||||||
|
ALTER TABLE `tnetflow_filter` ADD COLUMN `traffic_critical` float(20,2) NOT NULL default 0;
|
||||||
|
ALTER TABLE `tnetflow_filter` ADD COLUMN `traffic_warning` float(20,2) NOT NULL default 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
|
@ -91,6 +91,10 @@ if ($id) {
|
||||||
$src_port = $filter['src_port'];
|
$src_port = $filter['src_port'];
|
||||||
$aggregate = $filter['aggregate'];
|
$aggregate = $filter['aggregate'];
|
||||||
$advanced_filter = $filter['advanced_filter'];
|
$advanced_filter = $filter['advanced_filter'];
|
||||||
|
$netflow_monitoring = $filter['netflow_monitoring'];
|
||||||
|
$traffic_max = $filter['traffic_max'];
|
||||||
|
$traffic_critical = $filter['traffic_critical'];
|
||||||
|
$traffic_warning = $filter['traffic_warning'];
|
||||||
} else {
|
} else {
|
||||||
$name = '';
|
$name = '';
|
||||||
$assign_group = '';
|
$assign_group = '';
|
||||||
|
@ -100,6 +104,10 @@ if ($id) {
|
||||||
$src_port = '';
|
$src_port = '';
|
||||||
$aggregate = 'dstip';
|
$aggregate = 'dstip';
|
||||||
$advanced_filter = '';
|
$advanced_filter = '';
|
||||||
|
$netflow_monitoring = 0;
|
||||||
|
$traffic_max = 0;
|
||||||
|
$traffic_critical = 0;
|
||||||
|
$traffic_warning = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($update) {
|
if ($update) {
|
||||||
|
@ -111,6 +119,10 @@ if ($update) {
|
||||||
$dst_port = get_parameter('dst_port', '');
|
$dst_port = get_parameter('dst_port', '');
|
||||||
$src_port = get_parameter('src_port', '');
|
$src_port = get_parameter('src_port', '');
|
||||||
$advanced_filter = get_parameter('advanced_filter', '');
|
$advanced_filter = get_parameter('advanced_filter', '');
|
||||||
|
$netflow_monitoring = (bool) get_parameter('netflow_monitoring', false);
|
||||||
|
$traffic_max = get_parameter('traffic_max', 0);
|
||||||
|
$traffic_critical = get_parameter('traffic_critical', 0);
|
||||||
|
$traffic_warning = get_parameter('traffic_warning', 0);
|
||||||
|
|
||||||
if ($name == '') {
|
if ($name == '') {
|
||||||
ui_print_error_message(__('Not updated. Blank name'));
|
ui_print_error_message(__('Not updated. Blank name'));
|
||||||
|
@ -125,6 +137,10 @@ if ($update) {
|
||||||
'dst_port' => $dst_port,
|
'dst_port' => $dst_port,
|
||||||
'src_port' => $src_port,
|
'src_port' => $src_port,
|
||||||
'advanced_filter' => $advanced_filter,
|
'advanced_filter' => $advanced_filter,
|
||||||
|
'netflow_monitoring' => $netflow_monitoring,
|
||||||
|
'traffic_max' => $traffic_max,
|
||||||
|
'traffic_critical' => $traffic_critical,
|
||||||
|
'traffic_warning' => $traffic_warning,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Save filter args
|
// Save filter args
|
||||||
|
@ -149,6 +165,10 @@ if ($create) {
|
||||||
$dst_port = get_parameter('dst_port', '');
|
$dst_port = get_parameter('dst_port', '');
|
||||||
$src_port = get_parameter('src_port', '');
|
$src_port = get_parameter('src_port', '');
|
||||||
$advanced_filter = (string) get_parameter('advanced_filter', '');
|
$advanced_filter = (string) get_parameter('advanced_filter', '');
|
||||||
|
$netflow_monitoring = (bool) get_parameter('netflow_monitoring', false);
|
||||||
|
$traffic_max = get_parameter('traffic_max', 0);
|
||||||
|
$traffic_critical = get_parameter('traffic_critical', 0);
|
||||||
|
$traffic_warning = get_parameter('traffic_warning', 0);
|
||||||
|
|
||||||
$values = [
|
$values = [
|
||||||
'id_name' => $name,
|
'id_name' => $name,
|
||||||
|
@ -159,6 +179,10 @@ if ($create) {
|
||||||
'src_port' => $src_port,
|
'src_port' => $src_port,
|
||||||
'aggregate' => $aggregate,
|
'aggregate' => $aggregate,
|
||||||
'advanced_filter' => $advanced_filter,
|
'advanced_filter' => $advanced_filter,
|
||||||
|
'netflow_monitoring' => $netflow_monitoring,
|
||||||
|
'traffic_max' => $traffic_max,
|
||||||
|
'traffic_critical' => $traffic_critical,
|
||||||
|
'traffic_warning' => $traffic_warning,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Save filter args
|
// Save filter args
|
||||||
|
@ -258,16 +282,73 @@ $aggregate_list = [
|
||||||
|
|
||||||
$table->data[8][1] = html_print_select($aggregate_list, 'aggregate', $aggregate, '', '', 0, true, false, true, '', false);
|
$table->data[8][1] = html_print_select($aggregate_list, 'aggregate', $aggregate, '', '', 0, true, false, true, '', false);
|
||||||
|
|
||||||
|
// Netflow server options.
|
||||||
|
$table->data[9][0] = __('Enable Netflow monitoring').ui_print_help_tip(__('Allows you to create an agent that monitors the traffic volume of this filter. It also creates a module that measures if the traffic of any IP of this filter exceeds a certain threshold. A text type module will be created with the traffic rate for each IP within this filter every five minutes (the 10 IP\'s with the most traffic). Only available for Enterprise version.'), true);
|
||||||
|
$table->data[9][1] = html_print_checkbox_switch(
|
||||||
|
'netflow_monitoring',
|
||||||
|
1,
|
||||||
|
(bool) $netflow_monitoring,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data[10][0] = __('Maximum traffic value of the filter').ui_print_help_tip(__('Specifies the maximum rate (in bytes/sec) of traffic in the filter. It is then used to calculate the % of maximum traffic per IP.'), true);
|
||||||
|
$table->data[10][1] = html_print_input_number(
|
||||||
|
[
|
||||||
|
'step' => 1,
|
||||||
|
'name' => 'traffic_max',
|
||||||
|
'id' => 'traffic_max',
|
||||||
|
'value' => $traffic_max,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data[11][0] = __('CRITICAL threshold for the maximum % of traffic for an IP.').ui_print_help_tip(__('If this % is exceeded by any IP within the filter, a CRITICAL status will be generated.'), true);
|
||||||
|
$table->data[11][1] = html_print_input_number(
|
||||||
|
[
|
||||||
|
'step' => 1,
|
||||||
|
'name' => 'traffic_critical',
|
||||||
|
'id' => 'traffic_critical',
|
||||||
|
'value' => $traffic_critical,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data[12][0] = __('WARNING threshold for the maximum % of traffic of an IP.').ui_print_help_tip(__('If this % is exceeded by any IP within the filter, a WARNING status will be generated.'), true);
|
||||||
|
$table->data[12][1] = html_print_input_number(
|
||||||
|
[
|
||||||
|
'step' => 1,
|
||||||
|
'name' => 'traffic_warning',
|
||||||
|
'id' => 'traffic_warning',
|
||||||
|
'value' => $traffic_warning,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
echo '<form method="post" action="'.$config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_edit_form&pure='.$pure.'">';
|
echo '<form method="post" action="'.$config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_edit_form&pure='.$pure.'">';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
if ($id) {
|
if ($id) {
|
||||||
html_print_input_hidden('update', 1);
|
html_print_input_hidden('update', 1);
|
||||||
html_print_input_hidden('id', $id);
|
html_print_input_hidden('id', $id);
|
||||||
html_print_submit_button(__('Update'), 'crt', false, 'class="sub upd"');
|
html_print_action_buttons(
|
||||||
|
html_print_submit_button(
|
||||||
|
__('Update'),
|
||||||
|
'crt',
|
||||||
|
false,
|
||||||
|
['icon' => 'update'],
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
html_print_input_hidden('create', 1);
|
html_print_input_hidden('create', 1);
|
||||||
html_print_submit_button(__('Create'), 'crt', false, 'class="sub wand"');
|
html_print_action_buttons(
|
||||||
|
html_print_submit_button(
|
||||||
|
__('Create'),
|
||||||
|
'crt',
|
||||||
|
false,
|
||||||
|
['icon' => 'update'],
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
|
@ -93,7 +93,11 @@ $filter['ip_src'] = get_parameter('ip_src', '');
|
||||||
$filter['dst_port'] = get_parameter('dst_port', '');
|
$filter['dst_port'] = get_parameter('dst_port', '');
|
||||||
$filter['src_port'] = get_parameter('src_port', '');
|
$filter['src_port'] = get_parameter('src_port', '');
|
||||||
$filter['advanced_filter'] = get_parameter('advanced_filter', '');
|
$filter['advanced_filter'] = get_parameter('advanced_filter', '');
|
||||||
$filter['router_ip'] = get_parameter('router_ip');
|
$filter['netflow_monitoring'] = (bool) get_parameter('netflow_monitoring');
|
||||||
|
$filter['traffic_max'] = get_parameter('traffic_max', 0);
|
||||||
|
$filter['traffic_critical'] = get_parameter('traffic_critical', 0);
|
||||||
|
$filter['traffic_warning'] = get_parameter('traffic_warning', 0);
|
||||||
|
|
||||||
|
|
||||||
// Read chart configuration.
|
// Read chart configuration.
|
||||||
$chart_type = get_parameter('chart_type', 'netflow_area');
|
$chart_type = get_parameter('chart_type', 'netflow_area');
|
||||||
|
@ -377,6 +381,55 @@ $advanced_toggle .= '<td colspan="2">'.$radio_buttons.'</td>';
|
||||||
$advanced_toggle .= '<td><b>'.__('Source ip').'</b></td>';
|
$advanced_toggle .= '<td><b>'.__('Source ip').'</b></td>';
|
||||||
$advanced_toggle .= '<td colspan="2">'.html_print_input_text('router_ip', $filter['router_ip'], false, 40, 80, true).'</td>';
|
$advanced_toggle .= '<td colspan="2">'.html_print_input_text('router_ip', $filter['router_ip'], false, 40, 80, true).'</td>';
|
||||||
|
|
||||||
|
$advanced_toggle .= '</tr>';
|
||||||
|
|
||||||
|
// Netflow server options.
|
||||||
|
$advanced_toggle .= '<tr>';
|
||||||
|
|
||||||
|
$advanced_toggle .= "<td style='font-weight:bold;'>".__('Enable Netflow monitoring').ui_print_help_tip(__('Allows you to create an agent that monitors the traffic volume of this filter. It also creates a module that measures if the traffic of any IP of this filter exceeds a certain threshold. A text type module will be created with the traffic rate for each IP within this filter every five minutes (the 10 IP\'s with the most traffic). Only available for Enterprise version.'), true).'</td>';
|
||||||
|
$advanced_toggle .= '<td colspan="2">'.html_print_checkbox_switch(
|
||||||
|
'netflow_monitoring',
|
||||||
|
1,
|
||||||
|
(bool) $netflow_monitoring,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
).'</td>';
|
||||||
|
|
||||||
|
$advanced_toggle .= "<td style='font-weight:bold;'>".__('Maximum traffic value of the filter').ui_print_help_tip(__('Specifies the maximum rate (in bytes/sec) of traffic in the filter. It is then used to calculate the % of maximum traffic per IP.'), true).'</td>';
|
||||||
|
$advanced_toggle .= '<td colspan="2">'.html_print_input_number(
|
||||||
|
[
|
||||||
|
'step' => 1,
|
||||||
|
'name' => 'traffic_max',
|
||||||
|
'id' => 'traffic_max',
|
||||||
|
'value' => $filter['traffic_max'],
|
||||||
|
]
|
||||||
|
).'</td>';
|
||||||
|
|
||||||
|
|
||||||
|
$advanced_toggle .= '</tr>';
|
||||||
|
$advanced_toggle .= '<tr>';
|
||||||
|
|
||||||
|
$advanced_toggle .= "<td style='font-weight:bold;'>".__('CRITICAL threshold for the maximum % of traffic for an IP.').ui_print_help_tip(__('If this % is exceeded by any IP within the filter, a CRITICAL status will be generated.'), true).'</td>';
|
||||||
|
$advanced_toggle .= '<td colspan="2">'.html_print_input_number(
|
||||||
|
[
|
||||||
|
'step' => 1,
|
||||||
|
'name' => 'traffic_critical',
|
||||||
|
'id' => 'traffic_critical',
|
||||||
|
'value' => $filter['traffic_critical'],
|
||||||
|
]
|
||||||
|
).'</td>';
|
||||||
|
|
||||||
|
$advanced_toggle .= "<td style='font-weight:bold;'>".__('WARNING threshold for the maximum % of traffic of an IP.').ui_print_help_tip(__('If this % is exceeded by any IP within the filter, a WARNING status will be generated.'), true).'</td>';
|
||||||
|
$advanced_toggle .= '<td colspan="2">'.html_print_input_number(
|
||||||
|
[
|
||||||
|
'step' => 1,
|
||||||
|
'name' => 'traffic_warning',
|
||||||
|
'id' => 'traffic_warning',
|
||||||
|
'value' => $filter['traffic_warning'],
|
||||||
|
]
|
||||||
|
).'</td>';
|
||||||
|
|
||||||
|
|
||||||
$advanced_toggle .= '</tr>';
|
$advanced_toggle .= '</tr>';
|
||||||
|
|
||||||
$advanced_toggle .= '</table>';
|
$advanced_toggle .= '</table>';
|
||||||
|
@ -768,6 +821,11 @@ ui_include_time_picker();
|
||||||
$("#text-router_ip").val('');
|
$("#text-router_ip").val('');
|
||||||
$("#textarea_advanced_filter").val('');
|
$("#textarea_advanced_filter").val('');
|
||||||
$("#aggregate").val('');
|
$("#aggregate").val('');
|
||||||
|
$("#traffic_max").val('');
|
||||||
|
$("#traffic_critical").val('');
|
||||||
|
$("#traffic_warning").val('');
|
||||||
|
$('#checkbox-netflow_monitoring').prop('checked', false);
|
||||||
|
|
||||||
|
|
||||||
// Hide update filter button
|
// Hide update filter button
|
||||||
$("#submit-update_button").hide();
|
$("#submit-update_button").hide();
|
||||||
|
@ -837,6 +895,15 @@ ui_include_time_picker();
|
||||||
$("#textarea_advanced_filter").val(val);
|
$("#textarea_advanced_filter").val(val);
|
||||||
if (i == 'aggregate')
|
if (i == 'aggregate')
|
||||||
$("#aggregate").val(val);
|
$("#aggregate").val(val);
|
||||||
|
if (i == 'netflow_monitoring')
|
||||||
|
$("#checkbox-netflow_monitoring").prop('checked', val == "0" ? false : true);
|
||||||
|
if (i == 'traffic_max')
|
||||||
|
$("#traffic_max").val(val);
|
||||||
|
if (i == 'traffic_critical')
|
||||||
|
$("#traffic_critical").val(val);
|
||||||
|
if (i == 'traffic_warning')
|
||||||
|
$("#traffic_warning").val(val);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
<?php echo ', "json");'; ?>
|
<?php echo ', "json");'; ?>
|
||||||
|
|
|
@ -2185,6 +2185,10 @@ CREATE TABLE IF NOT EXISTS `tnetflow_filter` (
|
||||||
`advanced_filter` TEXT,
|
`advanced_filter` TEXT,
|
||||||
`filter_args` TEXT,
|
`filter_args` TEXT,
|
||||||
`aggregate` VARCHAR(60),
|
`aggregate` VARCHAR(60),
|
||||||
|
`netflow_monitoring` TINYINT UNSIGNED NOT NULL default 0,
|
||||||
|
`traffic_max` FLOAT(20,3) NOT NULL default 0,
|
||||||
|
`traffic_critical` FLOAT(20,2) NOT NULL default 0,
|
||||||
|
`traffic_warning` FLOAT(20,2) NOT NULL default 0,
|
||||||
PRIMARY KEY (`id_sg`)
|
PRIMARY KEY (`id_sg`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue