add target ip field to remote components

This commit is contained in:
alejandro.campos@artica.es 2023-04-27 09:40:32 +02:00
parent 3a318436a9
commit 9f9aed4d77
5 changed files with 82 additions and 51 deletions

View File

@ -0,0 +1,5 @@
START TRANSACTION;
ALTER TABLE `tnetwork_component` ADD COLUMN `target_ip` VARCHAR(255) NOT NULL DEFAULT '';
COMMIT;

View File

@ -77,6 +77,7 @@ $min = (int) get_parameter('min');
$tcp_send = (string) get_parameter('tcp_send');
$tcp_rcv = (string) get_parameter('tcp_rcv');
$tcp_port = (int) get_parameter('tcp_port');
$target_ip = (string) get_parameter('target_ip');
$snmp_oid = (string) get_parameter('snmp_oid');
$snmp_community = (string) get_parameter('snmp_community');
$id_module_group = (int) get_parameter('id_module_group');
@ -360,6 +361,7 @@ if ($is_management_allowed === true && $create_component) {
'tcp_send' => $tcp_send,
'tcp_rcv' => $tcp_rcv,
'tcp_port' => $tcp_port,
'target_ip' => $target_ip,
'snmp_oid' => $snmp_oid,
'snmp_community' => $snmp_community,
'id_module_group' => $id_module_group,
@ -465,6 +467,7 @@ if ($is_management_allowed === true && $update_component) {
'tcp_send' => $tcp_send,
'tcp_rcv' => $tcp_rcv,
'tcp_port' => $tcp_port,
'target_ip' => $target_ip,
'snmp_oid' => $snmp_oid,
'snmp_community' => $snmp_community,
'id_module_group' => $id_module_group,

View File

@ -50,8 +50,19 @@ $snmp_versions['2c'] = 'v. 2c';
$snmp_versions['3'] = 'v. 3';
$data = [];
$data[0] = __('Port');
$data[1] = html_print_input_text('tcp_port', $tcp_port, '', 5, 20, true);
$data[0] = __('Target IP');
$data[1] = html_print_input_text_extended(
'target_ip',
$target_ip,
'target_ip',
'',
30,
10000,
'',
'',
'',
true
);
$data[2] = __('SNMP version');
$data[3] = html_print_select(
$snmp_versions,
@ -66,19 +77,11 @@ $data[3] = html_print_select(
''
);
push_table_row($data, 'snmp_port');
push_table_row($data, 'row1');
$data = [];
$data[0] = __('SNMP Enterprise String');
$data[1] = html_print_input_text(
'snmp_oid',
$snmp_oid,
'',
30,
400,
true
);
$data[0] = __('Port');
$data[1] = html_print_input_text('tcp_port', $tcp_port, '', 5, 20, true);
$data[2] = __('SNMP community');
$data[3] = html_print_input_text(
'snmp_community',
@ -89,17 +92,16 @@ $data[3] = html_print_input_text(
true
);
push_table_row($data, 'snmp_2');
push_table_row($data, 'snmp_port');
$data = [];
$data[0] = __('Auth user');
$data[0] = __('SNMP Enterprise String');
$data[1] = html_print_input_text(
'snmp3_auth_user',
$snmp3_auth_user,
'snmp_oid',
$snmp_oid,
'',
15,
60,
30,
400,
true
);
$data[2] = __('Auth password');
@ -117,20 +119,18 @@ $data[3] .= html_print_input_hidden_extended(
'active_snmp_v3_mncfn',
true
);
push_table_row($data, 'field_snmpv3_row1');
push_table_row($data, 'snmp_2');
$data = [];
$data[0] = __('Privacy method');
$data[1] = html_print_select(
[
'DES' => __('DES'),
'AES' => __('AES'),
],
'snmp3_privacy_method',
$snmp3_privacy_method,
'',
'',
$data[0] = __('Auth user');
$data[1] = html_print_input_text(
'snmp3_auth_user',
$snmp3_auth_user,
'',
15,
60,
true
);
$data[2] = __('Privacy pass');
@ -142,17 +142,18 @@ $data[3] = html_print_input_password(
60,
true
);
push_table_row($data, 'field_snmpv3_row2');
push_table_row($data, 'field_snmpv3_row1');
$data = [];
$data[0] = __('Auth method');
$data[0] = __('Privacy method');
$data[1] = html_print_select(
[
'MD5' => __('MD5'),
'SHA' => __('SHA'),
'DES' => __('DES'),
'AES' => __('AES'),
],
'snmp3_auth_method',
$snmp3_auth_method,
'snmp3_privacy_method',
$snmp3_privacy_method,
'',
'',
'',
@ -172,6 +173,37 @@ $data[3] = html_print_select(
'',
true
);
push_table_row($data, 'field_snmpv3_row2');
$data = [];
$data[0] = __('Auth method');
$data[1] = html_print_select(
[
'MD5' => __('MD5'),
'SHA' => __('SHA'),
],
'snmp3_auth_method',
$snmp3_auth_method,
'',
'',
'',
true
);
$data[2] = __('Name OID').' '.ui_print_help_icon('xxx', true);
$data[3] = html_print_input_text_extended(
'name_oid',
$name_oid,
'name_oid',
'',
30,
10000,
'',
'',
'',
true
);
push_table_row($data, 'field_snmpv3_row3');
$data = [];
@ -188,20 +220,6 @@ $data[1] = html_print_extended_select_for_post_process(
true
);
$data[2] = __('Name OID').' '.ui_print_help_icon('xxx', true);
$data[3] = html_print_input_text_extended(
'name_oid',
$name_oid,
'name_oid',
'',
30,
10000,
'',
'',
'',
true
);
push_table_row($data, 'field_process');
// Advanced stuff.

View File

@ -377,6 +377,10 @@ function configure_modules_form() {
);
$("#textarea_tcp_send").html(js_html_entity_decode(data["tcp_send"]));
$("#textarea_tcp_rcv").html(js_html_entity_decode(data["tcp_rcv"]));
$("#text-ip_target").attr(
"value",
js_html_entity_decode(data["target_ip"])
);
$("#text-snmp_community").attr(
"value",
js_html_entity_decode(data["snmp_community"])

View File

@ -1008,6 +1008,7 @@ CREATE TABLE IF NOT EXISTS `tnetwork_component` (
`percentage_critical` TINYINT UNSIGNED DEFAULT 0,
`percentage_warning` TINYINT UNSIGNED DEFAULT 0,
`warning_time` INT UNSIGNED DEFAULT 0,
`target_ip` VARCHAR(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id_nc`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;