diff --git a/pandora_console/extras/mr/30.sql b/pandora_console/extras/mr/30.sql new file mode 100644 index 0000000000..eeb3b8d797 --- /dev/null +++ b/pandora_console/extras/mr/30.sql @@ -0,0 +1,13 @@ +START TRANSACTION; + +ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_failover` int(10) unsigned NOT NULL; + +ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0'; +ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0'; + +ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1'; + +ALTER TABLE `tmodule_relationship` ADD COLUMN `type` ENUM('direct', 'failover') DEFAULT 'direct'; + +COMMIT; \ No newline at end of file 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 4bad7b3652..60e19998e8 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 @@ -796,6 +796,8 @@ ALTER TABLE `treport_content_template` ADD COLUMN `unknown_checks` TINYINT(1) DE ALTER TABLE `treport_content_template` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1'; -- ----------------------------------------------------- -- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template) @@ -1239,13 +1241,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned; INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); -INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 29); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 30); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'); UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; -INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '736'); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '737'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'); -- --------------------------------------------------------------------- @@ -1442,11 +1444,14 @@ ALTER TABLE `treport_content` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1' ALTER TABLE `treport_content` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0'; +ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0'; -- --------------------------------------------------------------------- -- Table `tmodule_relationship` -- --------------------------------------------------------------------- ALTER TABLE tmodule_relationship ADD COLUMN `id_server` varchar(100) NOT NULL DEFAULT ''; +ALTER TABLE `tmodule_relationship` ADD COLUMN `type` ENUM('direct', 'failover') DEFAULT 'direct'; -- --------------------------------------------------------------------- -- Table `tpolicy_module` @@ -2209,3 +2214,8 @@ CREATE TABLE IF NOT EXISTS `tcredential_store` ( `extra_2` text, PRIMARY KEY (`identifier`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `treport_content_sla_combined` +-- --------------------------------------------------------------------- +ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_failover` int(10) unsigned NOT NULL; diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index fbdd620f77..f34013944b 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -1101,9 +1101,8 @@ $macro_count++; html_print_input_hidden('module_macro_count', $macro_count); -/* - Advanced form part */ -// Add relationships +// Advanced form part. +// Add relationships. $table_new_relations = new stdClass(); $table_new_relations->id = 'module_new_relations'; $table_new_relations->width = '100%'; @@ -1114,7 +1113,8 @@ $table_new_relations->style[0] = 'width: 10%; font-weight: bold;'; $table_new_relations->style[1] = 'width: 25%; text-align: center;'; $table_new_relations->style[2] = 'width: 10%; font-weight: bold;'; $table_new_relations->style[3] = 'width: 25%; text-align: center;'; -$table_new_relations->style[4] = 'width: 30%; text-align: center;'; +$table_new_relations->style[4] = 'width: 10%; font-weight: bold;'; +$table_new_relations->style[5] = 'width: 25%; text-align: center;'; $table_new_relations->data[0][0] = __('Agent'); $params = []; @@ -1128,10 +1128,35 @@ $params['javascript_function_action_after_select_js_call'] = 'change_modules_aut $table_new_relations->data[0][1] = ui_print_agent_autocomplete_input($params); $table_new_relations->data[0][2] = __('Module'); $table_new_relations->data[0][3] = "
"; -$table_new_relations->data[0][4] = html_print_button(__('Add relationship'), 'add_relation', false, 'javascript: add_new_relation();', 'class="sub add"', true); -$table_new_relations->data[0][4] .= "  
"; -// Relationship list +$array_rel_type = []; +$array_rel_type['direct'] = __('Direct'); +$array_rel_type['failover'] = __('Failover'); +$table_new_relations->data[0][4] = __('Rel. type'); +$table_new_relations->data[0][5] = html_print_select( + $array_rel_type, + 'relation_type', + '', + '', + '', + 0, + true, + false, + true, + '' +); + +$table_new_relations->data[0][6] = html_print_button( + __('Add relationship'), + 'add_relation', + false, + 'javascript: add_new_relation();', + 'class="sub add"', + true +); +$table_new_relations->data[0][6] .= "  
"; + +// Relationship list. $table_relations = new stdClass(); $table_relations->id = 'module_relations'; $table_relations->width = '100%'; @@ -1141,19 +1166,26 @@ $table_relations->data = []; $table_relations->rowstyle = []; $table_relations->rowstyle[-1] = 'display: none;'; $table_relations->style = []; -$table_relations->style[2] = 'width: 10%; text-align: center;'; $table_relations->style[3] = 'width: 10%; text-align: center;'; +$table_relations->style[4] = 'width: 10%; text-align: center;'; $table_relations->head[0] = __('Agent'); $table_relations->head[1] = __('Module'); -$table_relations->head[2] = __('Changes').ui_print_help_tip(__('Activate this to prevent the relation from being updated or deleted'), true); -$table_relations->head[3] = __('Delete'); +$table_relations->head[2] = __('Type'); +$table_relations->head[3] = __('Changes').ui_print_help_tip( + __('Activate this to prevent the relation from being updated or deleted'), + true +); +$table_relations->head[4] = __('Delete'); -// Create an invisible row to use their html to add new rows +// Create an invisible row to use their html to add new rows. $table_relations->data[-1][0] = ''; $table_relations->data[-1][1] = ''; -$table_relations->data[-1][2] = ''.html_print_image('images/lock.png', true).''; -$table_relations->data[-1][3] = ''.html_print_image('images/cross.png', true).''; +$table_relations->data[-1][2] = ''; +$table_relations->data[-1][3] = ''; +$table_relations->data[-1][3] .= html_print_image('images/lock.png', true).''; +$table_relations->data[-1][4] = ''; +$table_relations->data[-1][4] .= html_print_image('images/cross.png', true).''; $module_relations = modules_get_relations(['id_module' => $id_agent_module]); if (!$module_relations) { @@ -1164,10 +1196,14 @@ $relations_count = 0; foreach ($module_relations as $key => $module_relation) { if ($module_relation['module_a'] == $id_agent_module) { $module_id = $module_relation['module_b']; - $agent_id = modules_give_agent_id_from_module_id($module_relation['module_b']); + $agent_id = modules_give_agent_id_from_module_id( + $module_relation['module_b'] + ); } else { $module_id = $module_relation['module_a']; - $agent_id = modules_give_agent_id_from_module_id($module_relation['module_a']); + $agent_id = modules_give_agent_id_from_module_id( + $module_relation['module_a'] + ); } $agent_name = ui_print_agent_name($agent_id, true); @@ -1183,14 +1219,16 @@ foreach ($module_relations as $key => $module_relation) { $disabled_update_class = 'alpha50'; } - // Agent name + // Agent name. $table_relations->data[$relations_count][0] = $agent_name; - // Module name + // Module name. $table_relations->data[$relations_count][1] = "".ui_print_truncate_text($module_name, 'module_medium', true, true, true, '[…]').''; - // Lock relationship updates - $table_relations->data[$relations_count][2] = ''.html_print_image('images/lock.png', true).''; - // Delete relationship - $table_relations->data[$relations_count][3] = ''.html_print_image('images/cross.png', true).''; + // Type. + $table_relations->data[$relations_count][2] = ($module_relation['type'] === 'direct') ? __('Direct') : __('Failover'); + // Lock relationship updates. + $table_relations->data[$relations_count][3] = ''.html_print_image('images/lock.png', true).''; + // Delete relationship. + $table_relations->data[$relations_count][4] = ''.html_print_image('images/cross.png', true).''; $relations_count++; } @@ -1198,7 +1236,6 @@ html_print_input_hidden('module_relations_count', $relations_count); ui_require_jquery_file('json'); - ?>