Merge branch 'revert-981273b2' into 'develop'

Revert "Merge branch '17-compatibilidad-ante-cambios-de-ip-en-el-agente-integria…

See merge request !33
This commit is contained in:
daniel 2017-01-17 09:09:23 +01:00
commit 2aba5dde02
6 changed files with 19 additions and 80 deletions

View File

@ -31,7 +31,6 @@ $ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent);
check_login ();
$ip_target = (string) get_parameter ('ip_target', $ipAgent);
$use_agent = get_parameter ('use_agent');
$snmp_community = (string) get_parameter ('snmp_community', 'public');
$snmp_version = get_parameter('snmp_version', '1');
$snmp3_auth_user = get_parameter('snmp3_auth_user');
@ -306,13 +305,7 @@ if ($create_modules) {
$common_values['tcp_port'] = $tcp_port;
}
$common_values['snmp_community'] = $snmp_community;
if($use_agent){
$common_values['ip_target'] = 'auto';
}
else{
$common_values['ip_target'] = $ip_target;
}
$common_values['tcp_send'] = $snmp_version;
if ($snmp_version == '3') {
@ -703,22 +696,18 @@ $table->data[0][1] = html_print_input_text ('ip_target', $ip_target, '', 15, 60,
$table->data[0][2] = '<b>' . __('Port') . '</b>';
$table->data[0][3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 20, true);
$table->data[1][0] = '<b>' . __('Use agent ip') . '</b>';
$table->data[1][1] = html_print_checkbox ('use_agent', 1, $use_agent, true);
$snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2';
$snmp_versions['2c'] = 'v. 2c';
$snmp_versions['3'] = 'v. 3';
$table->data[2][0] = '<b>' . __('SNMP community') . '</b>';
$table->data[2][1] = html_print_input_text ('snmp_community', $snmp_community, '', 15, 60, true);
$table->data[1][0] = '<b>' . __('SNMP community') . '</b>';
$table->data[1][1] = html_print_input_text ('snmp_community', $snmp_community, '', 15, 60, true);
$table->data[2][2] = '<b>' . __('SNMP version') . '</b>';
$table->data[2][3] = html_print_select ($snmp_versions, 'snmp_version', $snmp_version, '', '', '', true, false, false, '');
$table->data[2][3] .= '<div id="spinner_modules" style="float: left; display: none;">' . html_print_image("images/spinner.gif", true) . '</div>';
$table->data[1][2] = '<b>' . __('SNMP version') . '</b>';
$table->data[1][3] = html_print_select ($snmp_versions, 'snmp_version', $snmp_version, '', '', '', true, false, false, '');
$table->data[1][3] .= '<div id="spinner_modules" style="float: left; display: none;">' . html_print_image("images/spinner.gif", true) . '</div>';
html_print_input_hidden('snmpwalk', 1);
html_print_table($table);
@ -774,7 +763,6 @@ if (!$fail) {
html_print_input_hidden('create_modules', 1);
html_print_input_hidden('ip_target', $ip_target);
html_print_input_hidden('use_agent', $use_agent);
html_print_input_hidden('tcp_port', $tcp_port);
html_print_input_hidden('snmp_community', $snmp_community);
html_print_input_hidden('snmp_version', $snmp_version);

View File

@ -28,7 +28,6 @@ $ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent);
check_login ();
$ip_target = (string) get_parameter ('ip_target', $ipAgent);
$use_agent = get_parameter ('use_agent');
$snmp_community = (string) get_parameter ('snmp_community', 'public');
$snmp_version = get_parameter('snmp_version', '1');
$snmp3_auth_user = get_parameter('snmp3_auth_user');
@ -137,12 +136,7 @@ if ($create_modules) {
$values['tcp_port'] = $tcp_port;
}
$values['snmp_community'] = $snmp_community;
if($use_agent){
$values['ip_target'] = 'auto';
}
else{
$values['ip_target'] = $ip_target;
}
$values['tcp_send'] = $snmp_version;
if ($snmp_version == '3') {
@ -342,21 +336,18 @@ $table->data[0][1] = html_print_input_text ('ip_target', $ip_target, '', 15, 60,
$table->data[0][2] = '<b>' . __('Port') . '</b>';
$table->data[0][3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 20, true);
$table->data[1][0] = '<b>' . __('Use agent ip') . '</b>';
$table->data[1][1] = html_print_checkbox ('use_agent', 1, $use_agent, true);
$snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2';
$snmp_versions['2c'] = 'v. 2c';
$snmp_versions['3'] = 'v. 3';
$table->data[2][0] = '<b>' . __('SNMP community') . '</b>';
$table->data[2][1] = html_print_input_text ('snmp_community', $snmp_community, '', 15, 60, true);
$table->data[1][0] = '<b>' . __('SNMP community') . '</b>';
$table->data[1][1] = html_print_input_text ('snmp_community', $snmp_community, '', 15, 60, true);
$table->data[2][2] = '<b>' . __('SNMP version') . '</b>';
$table->data[2][3] = html_print_select ($snmp_versions, 'snmp_version', $snmp_version, '', '', '', true, false, false, '');
$table->data[1][2] = '<b>' . __('SNMP version') . '</b>';
$table->data[1][3] = html_print_select ($snmp_versions, 'snmp_version', $snmp_version, '', '', '', true, false, false, '');
$table->data[2][3] .= '<div id="spinner_modules" style="float: left; display: none;">' . html_print_image("images/spinner.gif", true) . '</div>';
$table->data[1][3] .= '<div id="spinner_modules" style="float: left; display: none;">' . html_print_image("images/spinner.gif", true) . '</div>';
html_print_input_hidden('snmpwalk', 1);
html_print_table($table);
@ -418,7 +409,6 @@ if (!empty($interfaces_list)) {
html_print_input_hidden('create_modules', 1);
html_print_input_hidden('ip_target', $ip_target);
html_print_input_hidden('use_agent', $use_agent);
html_print_input_hidden('tcp_port', $tcp_port);
html_print_input_hidden('snmp_community', $snmp_community);
html_print_input_hidden('snmp_version', $snmp_version);

View File

@ -974,9 +974,6 @@ if ($update_module || $create_module) {
$parent_module_id = (int) get_parameter('parent_module_id');
$ip_target = (string) get_parameter ('ip_target');
if($ip_target == ''){
$ip_target = 'auto';
}
$custom_id = (string) get_parameter ('custom_id');
$history_data = (int) get_parameter('history_data');
$dynamic_interval = (int) get_parameter('dynamic_interval');

View File

@ -65,25 +65,7 @@ $extra_title = __('Network server module');
$data = array ();
$data[0] = __('Target IP');
//show agent_for defect;
html_debug_print($ip_target);
if($ip_target == 'auto'){
$ip_target = agents_get_address ($id_agente);
}
if($page == 'enterprise/godmode/policies/policy_modules'){
$target_ip_values = array();
$target_ip_values['auto'] = __('Auto');
$target_ip_values['force_pri'] = __('Force primary key');
$target_ip_values['custom'] = __('Custom');
$data[1] = html_print_select ($target_ip_values, 'ip_target', '', '', '', '',
true, false, false, '', false, 'width:200px;');
//$table->data['edit35'][1] .= html_print_input_text ('custom_ip_target', '', '', 15, 60, true);
}
else{
$data[1] = html_print_input_text ('ip_target', $ip_target, '', 15, 60, true);
}
// In ICMP modules, port is not configurable
if ($id_module_type >= 6 && $id_module_type <= 7) {

View File

@ -480,17 +480,9 @@ $table->data['edit3'][2] = __('SMNP community');
$table->data['edit3'][3] = html_print_input_text ('snmp_community', '',
'', 10, 15, true);
$target_ip_values = array();
$target_ip_values['auto'] = __('Auto');
$target_ip_values['force_pri'] = __('Force primary key');
$target_ip_values['custom'] = __('Custom');
$table->data['edit35'][0] = __('Target IP');
$table->data['edit35'][1] = html_print_select ($target_ip_values,
'ip_target', '', '', __('No change'), '', true, false, false, '', false, 'width:200px;');
$table->data['edit35'][1] .= html_print_input_text ('custom_ip_target', '', '', 15, 60, true);
$table->data['edit35'][1] = html_print_input_text ('ip_target', '', '',
15, 60, true);
$table->data['edit35'][2] = __('SNMP version');
$table->data['edit35'][3] = html_print_select ($snmp_versions,
'tcp_send', '', '', __('No change'), '', true, false, false, '');

View File

@ -412,17 +412,7 @@ function modules_update_agent_module ($id, $values,
}
}
if(isset ($values['ip_target'])){
if($values['ip_target'] == 'force_pri'){
$sql_agent = "SELECT id_agente FROM tagente_modulo WHERE id_agente_modulo=" . $id;
$id_agente = mysql_db_process_sql($sql_agent);
$values['ip_target'] = agents_get_address ($id_agente);
}
elseif($values['ip_target'] == 'custom'){
$values['ip_target'] = $values['custom_ip_target'];
}
}
unset($values['custom_ip_target']);
$where = array();
$where['id_agente_modulo'] = $id;