refactor events meta pandora_enterprise#9086
This commit is contained in:
parent
6a614847a2
commit
58f5f4e9f1
|
@ -43,6 +43,14 @@ ALTER TABLE `tdashboard` MODIFY `name` TEXT NOT NULL DEFAULT '';
|
|||
|
||||
ALTER TABLE `tagente` ADD COLUMN `satellite_server` INT NOT NULL default 0;
|
||||
ALTER TABLE `tmetaconsole_agent` ADD COLUMN `satellite_server` INT NOT NULL default 0;
|
||||
|
||||
ALTER TABLE `tmetaconsole_setup` DROP COLUMN `last_event_replication`;
|
||||
DELETE FROM `tconfig` WHERE `token` LIKE 'event_replication';
|
||||
DELETE FROM `tconfig` WHERE `token` LIKE 'replication_interval';
|
||||
DELETE FROM `tconfig` WHERE `token` LIKE 'replication_limit';
|
||||
DELETE FROM `tconfig` WHERE `token` LIKE 'replication_mode';
|
||||
DELETE FROM `tconfig` WHERE `token` LIKE 'show_events_in_local';
|
||||
|
||||
SET @st_oum763 = (SELECT IF(
|
||||
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tautoconfig' AND table_schema = DATABASE() AND column_name = 'disabled') > 0,
|
||||
"SELECT 1",
|
||||
|
|
|
@ -412,8 +412,7 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
|
|||
`auth_token` text default '',
|
||||
`id_group` int(10) unsigned NOT NULL default 0,
|
||||
`api_password` text NOT NULL,
|
||||
`disabled` tinyint(1) unsigned NOT NULL default '0',
|
||||
`last_event_replication` bigint(20) default '0'
|
||||
`disabled` tinyint(1) unsigned NOT NULL default '0'
|
||||
) ENGINE=InnoDB
|
||||
COMMENT = 'Table to store metaconsole sources'
|
||||
DEFAULT CHARSET=utf8;
|
||||
|
|
|
@ -388,23 +388,6 @@ function api_get_test_agent_cache()
|
|||
}
|
||||
|
||||
|
||||
// Returs the string OK if a connection to the event replication DB can be established.
|
||||
function api_get_test_event_replication_db()
|
||||
{
|
||||
if (defined('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$status = enterprise_hook('events_test_replication_db', []);
|
||||
if ($status === ENTERPRISE_NOT_HOOK) {
|
||||
echo 'ERR';
|
||||
return;
|
||||
}
|
||||
|
||||
echo $status;
|
||||
}
|
||||
|
||||
|
||||
// -------------------------DEFINED OPERATIONS FUNCTIONS-----------------
|
||||
|
||||
|
||||
|
|
|
@ -409,32 +409,6 @@ function config_update_config()
|
|||
$error_update[] = __('Size of collection');
|
||||
}
|
||||
|
||||
if (config_update_value('event_replication', (int) get_parameter('event_replication'), true) === false) {
|
||||
$error_update[] = __('Events replication');
|
||||
}
|
||||
|
||||
if ((int) get_parameter('event_replication') === 1) {
|
||||
if (config_update_value('replication_interval', (int) get_parameter('replication_interval'), true) === false) {
|
||||
$error_update[] = __('Replication interval');
|
||||
}
|
||||
|
||||
if (config_update_value('replication_limit', (int) get_parameter('replication_limit'), true) === false) {
|
||||
$error_update[] = __('Replication limit');
|
||||
}
|
||||
|
||||
if (config_update_value('replication_mode', (string) get_parameter('replication_mode'), true) === false) {
|
||||
$error_update[] = __('Replication mode');
|
||||
}
|
||||
|
||||
if (config_update_value('show_events_in_local', (string) get_parameter('show_events_in_local'), true) === false) {
|
||||
$error_update[] = __('Show events list in local console (read only)');
|
||||
}
|
||||
}
|
||||
|
||||
if (config_update_value('replication_dbengine', (string) get_parameter('replication_dbengine'), true) === false) {
|
||||
$error_update[] = __('Replication DB engine');
|
||||
}
|
||||
|
||||
if (config_update_value('replication_dbhost', (string) get_parameter('replication_dbhost'), true) === false) {
|
||||
$error_update[] = __('Replication DB host');
|
||||
}
|
||||
|
@ -2135,22 +2109,6 @@ function config_process_config()
|
|||
config_update_value('policy_add_max_agents', 200);
|
||||
}
|
||||
|
||||
if (!isset($config['event_replication'])) {
|
||||
config_update_value('event_replication', 0);
|
||||
}
|
||||
|
||||
if (!isset($config['replication_interval'])) {
|
||||
config_update_value('replication_interval', 10);
|
||||
}
|
||||
|
||||
if (!isset($config['replication_limit'])) {
|
||||
config_update_value('replication_limit', 50);
|
||||
}
|
||||
|
||||
if (!isset($config['replication_dbengine'])) {
|
||||
config_update_value('replication_dbengine', 'mysql');
|
||||
}
|
||||
|
||||
if (!isset($config['replication_dbhost'])) {
|
||||
config_update_value('replication_dbhost', '');
|
||||
}
|
||||
|
@ -2171,18 +2129,10 @@ function config_process_config()
|
|||
config_update_value('replication_dbport', '');
|
||||
}
|
||||
|
||||
if (!isset($config['replication_mode'])) {
|
||||
config_update_value('replication_mode', 'only_validated');
|
||||
}
|
||||
|
||||
if (!isset($config['metaconsole_agent_cache'])) {
|
||||
config_update_value('metaconsole_agent_cache', 0);
|
||||
}
|
||||
|
||||
if (!isset($config['show_events_in_local'])) {
|
||||
config_update_value('show_events_in_local', 0);
|
||||
}
|
||||
|
||||
if (!isset($config['log_collector'])) {
|
||||
config_update_value('log_collector', 0);
|
||||
}
|
||||
|
|
|
@ -4841,7 +4841,7 @@ function events_page_comments($event, $ajax=false, $groupedComments=[])
|
|||
'EW',
|
||||
(isset($event['clean_tags']) === true) ? $event['clean_tags'] : [],
|
||||
[]
|
||||
))) && $config['show_events_in_local'] == false || $config['event_replication'] == false
|
||||
)))
|
||||
) {
|
||||
$event['evento'] = io_safe_output($event['evento']);
|
||||
$comments_form = '<br><div id="comments_form" style="width:98%;">';
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
Include package help/en
|
||||
*/
|
||||
?>
|
||||
|
||||
<p> If the event replication is activated, all the events will be copied to the remote metaconsole's database.
|
||||
<br><br>
|
||||
It is necessary to configure the credentials of the metaconsole's database, the replication mode (all events or only validated events) and the replication interval, specified in seconds.
|
||||
<br><br>
|
||||
<b>NOTES:</b>
|
||||
<br><br>
|
||||
The event viewer will be disabled if this option is enabled.
|
||||
<br><br>
|
||||
To apply the changes made on the event replication setup, it is necessary to restart the server.
|
||||
<br><br>
|
||||
The token "event_replication" must be set to 1 in the server's configuration file.
|
||||
</p>
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
Include package help/es
|
||||
*/
|
||||
?>
|
||||
|
||||
<p> Cuando la replicación de eventos está activada, los eventos recibidos se copiarán a la base de datos remota de una metaconsola.
|
||||
<br><br>
|
||||
Es necesario configurar las credenciales de la base de datos de la metaconsola, así como el modo de replicación (todos los eventos o solo los validados) y el intervalo de replicación en segundos.
|
||||
<br><br>
|
||||
<b>NOTAS:</b>
|
||||
<br><br>
|
||||
El visor de eventos se deshabilita cuando se activa esta opción.
|
||||
<br><br>
|
||||
Para que los cambios en la configuración de replicación de eventos se hagan efectivos será necesario reiniciar el servidor.
|
||||
<br><br>
|
||||
El fichero de configuración del servidor deberá tener el token:
|
||||
|
||||
<i>event_replication 1</i>
|
||||
|
||||
</p>
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
Include package help/ja
|
||||
*/
|
||||
?>
|
||||
|
||||
<p> イベントの複製が有効の場合、受け取ったイベントは、メタコンソールのリモートデータベースにコピーされます。
|
||||
<br><br>
|
||||
メタコンソールのデータベースへのアクセス権、複製モード(全イベントまたは承諾済のみ)、複製間隔(秒)を設定する必要があります。
|
||||
<br><br>
|
||||
<b>注意:</b>
|
||||
<br><br>
|
||||
このオプションが有効の場合は、イベントビューワは無効になります。
|
||||
<br><br>
|
||||
イベントの複製の設定変更を反映させるには、サーバを再起動する必要があります。
|
||||
<br><br>
|
||||
サーバの設定ファイルに、次の設定を行う必要があります。
|
||||
|
||||
<i>event_replication 1</i>
|
||||
|
||||
</p>
|
|
@ -277,13 +277,6 @@ ui_print_message_dialog(
|
|||
|
||||
$table->data[0][2] = __('Show events');
|
||||
$disabled = false;
|
||||
if (isset($config['event_replication']) === true) {
|
||||
if ($config['event_replication']
|
||||
&& !$config['show_events_in_local']
|
||||
) {
|
||||
$disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[0][3] = html_print_checkbox_switch(
|
||||
'draw_events',
|
||||
|
@ -292,12 +285,6 @@ ui_print_message_dialog(
|
|||
true,
|
||||
$disabled
|
||||
);
|
||||
if ($disabled) {
|
||||
$table->data[1] .= ui_print_help_tip(
|
||||
__("'Show events' is disabled because this %s node is set to event replication.", get_product_name()),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$table->data[1][0] = __('Begin date');
|
||||
$table->data[1][1] = html_print_input_text(
|
||||
|
|
|
@ -69,16 +69,7 @@ if ($event_a === false
|
|||
|
||||
$access = ($event_a === true) ? 'ER' : (($event_w === true) ? 'EW' : (($event_m === true) ? 'EM' : 'ER'));
|
||||
|
||||
|
||||
$readonly = false;
|
||||
if (is_metaconsole() === false
|
||||
&& isset($config['event_replication']) === true
|
||||
&& (int) $config['event_replication'] === 1
|
||||
&& (int) $config['show_events_in_local'] === 1
|
||||
) {
|
||||
$readonly = true;
|
||||
}
|
||||
|
||||
// Load specific stylesheet.
|
||||
ui_require_css_file('events');
|
||||
ui_require_css_file('tables');
|
||||
|
@ -1529,31 +1520,6 @@ html_print_div(
|
|||
]
|
||||
);
|
||||
|
||||
// Controls.
|
||||
if (is_metaconsole() !== true) {
|
||||
if (isset($config['event_replication']) === true
|
||||
&& $config['event_replication'] == 1
|
||||
) {
|
||||
if ($config['show_events_in_local'] == 0) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access event viewer. View disabled due event replication.'
|
||||
);
|
||||
ui_print_info_message(
|
||||
[
|
||||
'message' => __(
|
||||
'Event viewer is disabled due event replication. For more information, please contact with the administrator'
|
||||
),
|
||||
'no_close' => true,
|
||||
]
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
$readonly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (enterprise_hook(
|
||||
'enterprise_acl',
|
||||
[
|
||||
|
@ -2317,18 +2283,6 @@ if (is_user_admin($config['id_user'])) {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
if ($config['event_replication'] != 1) {
|
||||
if ($event_w && !$readonly) {
|
||||
$array_events_actions['in_progress_selected'] = __('In progress selected');
|
||||
$array_events_actions['validate_selected'] = __('Validate selected');
|
||||
}
|
||||
|
||||
if ($event_m == 1 && !$readonly) {
|
||||
$array_events_actions['delete_selected'] = __('Delete selected');
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($event_responses as $val) {
|
||||
$array_events_actions[$val['id']] = $val['name'];
|
||||
}
|
||||
|
|
|
@ -2766,7 +2766,6 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
|
|||
`api_password` TEXT,
|
||||
`disabled` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`unified` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`last_event_replication` BIGINT DEFAULT 0,
|
||||
`server_uid` TEXT ,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB
|
||||
|
|
Loading…
Reference in New Issue