From b64c1ee44c9d2c59bb068c13de7a1cd7d368d9b4 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 23 Jan 2023 16:19:54 +0100 Subject: [PATCH 01/12] #9517 Custom sql - Agent safe mode not enable --- pandora_console/extras/mr/63.sql | 5 +++++ pandora_console/pandoradb_data.sql | 1 + 2 files changed, 6 insertions(+) create mode 100644 pandora_console/extras/mr/63.sql diff --git a/pandora_console/extras/mr/63.sql b/pandora_console/extras/mr/63.sql new file mode 100644 index 0000000000..2b7081cf1d --- /dev/null +++ b/pandora_console/extras/mr/63.sql @@ -0,0 +1,5 @@ +START TRANSACTION; + +INSERT INTO `pandora`.`treport_custom_sql` (`id`, `name`, `sql`) VALUES ('5', 'Agent safe mode not enable', 'select nombre from tagente where safe_mode_module = 0'); + +COMMIT; diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 9a0baba05e..6dd3000466 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -1165,6 +1165,7 @@ INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (1, 'Monitoring&#x INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (2, 'Monitoring Report Modules', 'select (select tagente.alias from tagente where tagente.id_agente = tagente_modulo.id_agente) as agent_nombre, nombre , (select tmodule_group.name from tmodule_group where tmodule_group.id_mg = tagente_modulo.id_module_group) as module_group, module_interval from tagente_modulo where delete_pending = 0 order by nombre;'); INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (3, 'Monitoring Report Alerts', 'select t1.alias as agent_name, t2.nombre as module_name, (select talert_templates.name from talert_templates where talert_templates.id = t3.id_alert_template) as template, (select group_concat(t02.name) from talert_template_module_actions as t01 inner join talert_actions as t02 on t01.id_alert_action = t02.id where t01.id_alert_template_module = t3.id group by t01.id_alert_template_module) as actions from tagente as t1 inner join tagente_modulo as t2 on t1.id_agente = t2.id_agente inner join talert_template_modules as t3 on t2.id_agente_modulo = t3.id_agent_module order by agent_name, module_name;'); INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (4, 'Group view', 'select t1.nombre, (select count(t3.id_agente) from tagente as t3 where t1.id_grupo = t3.id_grupo) as agents, (SELECT COUNT(t4.id_agente) FROM tagente as t4 WHERE t4.id_grupo = t1.id_grupo AND t4.disabled = 0 AND t4.ultimo_contacto < NOW() - (intervalo / (1/2))) as agent_unknown, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND utimestamp > 0 AND tagente_modulo.id_tipo_modulo NOT IN(21,22,23,24,100) AND (UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) >= (tagente_estado.current_interval / (1/2))) as monitor_unknow, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,24) AND utimestamp = 0) as monitor_no_init, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 0 AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval / (1/2)) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24)))) as monitor_ok, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 1 AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval / (1/2)) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND utimestamp > 0) as monitor_critical, (SELECT COUNT(talert_template_modules.id) FROM talert_template_modules, tagente_modulo, tagente_estado, tagente WHERE tagente.id_grupo = t1.id_grupo AND tagente_modulo.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente.disabled = 0 AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo AND times_fired > 0) as monitor_alert_fired from tgrupo as t1 where 0 < (select count(t2.id_agente) from tagente as t2 where t1.id_grupo = t2.id_grupo)'); +INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (5, 'Agent safe mode not enable', 'select nombre from tagente where safe_mode_module = 0'); -- trecon scripts INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (1, 'Discovery.Application.VMware', 'Discovery Application script to monitor VMware technologies (ESXi, VCenter, VSphere)', '/usr/share/pandora_server/util/recon_scripts/vmware-plugin.pl', '{"1":{"macro":"_field1_","desc":"Configuration file","help":"","value":"","hide":""}}'); From 01ed220e1f16e14f98b54b5aed0bcbfbd9f13998 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 24 Jan 2023 10:16:31 +0100 Subject: [PATCH 02/12] #9517 Custom sql - Agent safe mode not enable --- pandora_console/extras/mr/63.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/extras/mr/63.sql b/pandora_console/extras/mr/63.sql index 2b7081cf1d..fe2ebe095f 100644 --- a/pandora_console/extras/mr/63.sql +++ b/pandora_console/extras/mr/63.sql @@ -1,5 +1,5 @@ START TRANSACTION; -INSERT INTO `pandora`.`treport_custom_sql` (`id`, `name`, `sql`) VALUES ('5', 'Agent safe mode not enable', 'select nombre from tagente where safe_mode_module = 0'); +INSERT INTO `treport_custom_sql` (`name`, `sql`) VALUES ('Agent safe mode not enable', 'select nombre from tagente where safe_mode_module = 0'); COMMIT; From 1e7cbb552165a9992f7ba85166bdc97e4ddff964 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 24 Jan 2023 10:18:01 +0100 Subject: [PATCH 03/12] #9517 Custom sql - Agent safe mode not enable --- pandora_console/extras/mr/63.sql | 2 +- pandora_console/pandoradb_data.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/extras/mr/63.sql b/pandora_console/extras/mr/63.sql index fe2ebe095f..401d4a748c 100644 --- a/pandora_console/extras/mr/63.sql +++ b/pandora_console/extras/mr/63.sql @@ -1,5 +1,5 @@ START TRANSACTION; -INSERT INTO `treport_custom_sql` (`name`, `sql`) VALUES ('Agent safe mode not enable', 'select nombre from tagente where safe_mode_module = 0'); +INSERT INTO `treport_custom_sql` (`name`, `sql`) VALUES ('Agent safe mode not enable', 'select alias from tagente where safe_mode_module = 0'); COMMIT; diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 6dd3000466..3e0e32e449 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -1165,7 +1165,7 @@ INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (1, 'Monitoring&#x INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (2, 'Monitoring Report Modules', 'select (select tagente.alias from tagente where tagente.id_agente = tagente_modulo.id_agente) as agent_nombre, nombre , (select tmodule_group.name from tmodule_group where tmodule_group.id_mg = tagente_modulo.id_module_group) as module_group, module_interval from tagente_modulo where delete_pending = 0 order by nombre;'); INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (3, 'Monitoring Report Alerts', 'select t1.alias as agent_name, t2.nombre as module_name, (select talert_templates.name from talert_templates where talert_templates.id = t3.id_alert_template) as template, (select group_concat(t02.name) from talert_template_module_actions as t01 inner join talert_actions as t02 on t01.id_alert_action = t02.id where t01.id_alert_template_module = t3.id group by t01.id_alert_template_module) as actions from tagente as t1 inner join tagente_modulo as t2 on t1.id_agente = t2.id_agente inner join talert_template_modules as t3 on t2.id_agente_modulo = t3.id_agent_module order by agent_name, module_name;'); INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (4, 'Group view', 'select t1.nombre, (select count(t3.id_agente) from tagente as t3 where t1.id_grupo = t3.id_grupo) as agents, (SELECT COUNT(t4.id_agente) FROM tagente as t4 WHERE t4.id_grupo = t1.id_grupo AND t4.disabled = 0 AND t4.ultimo_contacto < NOW() - (intervalo / (1/2))) as agent_unknown, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND utimestamp > 0 AND tagente_modulo.id_tipo_modulo NOT IN(21,22,23,24,100) AND (UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) >= (tagente_estado.current_interval / (1/2))) as monitor_unknow, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,24) AND utimestamp = 0) as monitor_no_init, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 0 AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval / (1/2)) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24)))) as monitor_ok, (SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = t1.id_grupo AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 1 AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval / (1/2)) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100))) AND utimestamp > 0) as monitor_critical, (SELECT COUNT(talert_template_modules.id) FROM talert_template_modules, tagente_modulo, tagente_estado, tagente WHERE tagente.id_grupo = t1.id_grupo AND tagente_modulo.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente.disabled = 0 AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo AND times_fired > 0) as monitor_alert_fired from tgrupo as t1 where 0 < (select count(t2.id_agente) from tagente as t2 where t1.id_grupo = t2.id_grupo)'); -INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (5, 'Agent safe mode not enable', 'select nombre from tagente where safe_mode_module = 0'); +INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (5, 'Agent safe mode not enable', 'select alias from tagente where safe_mode_module = 0'); -- trecon scripts INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (1, 'Discovery.Application.VMware', 'Discovery Application script to monitor VMware technologies (ESXi, VCenter, VSphere)', '/usr/share/pandora_server/util/recon_scripts/vmware-plugin.pl', '{"1":{"macro":"_field1_","desc":"Configuration file","help":"","value":"","hide":""}}'); From 7111fd66e2fc23008fb7080dad788d9325d4f95f Mon Sep 17 00:00:00 2001 From: Calvo Date: Fri, 27 Jan 2023 13:43:23 +0100 Subject: [PATCH 04/12] Fix empty module data list view --- pandora_console/operation/agentes/status_monitor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 8da3b9b2ba..82ba6fcfee 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -1939,7 +1939,7 @@ if (!empty($result)) { } else { $sub_string = substr(io_safe_output($row['datos']), 0, 12); if ($module_value == $sub_string) { - if ($module_value == 0 && !$sub_string) { + if ((empty($module_value) === true || $module_value == 0) && !$sub_string) { $salida = 0; } else { $data_macro = modules_get_unit_macro($row['datos'], $row['unit']); From 8d3432e7f2f81f20b6a0cc989f3e48c808b56f80 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 3 Feb 2023 11:19:58 +0100 Subject: [PATCH 05/12] #9047 REVIEW LOGS styles --- .../include/class/AuditLog.class.php | 46 +++++++++++++------ 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/pandora_console/include/class/AuditLog.class.php b/pandora_console/include/class/AuditLog.class.php index 235652711c..4986cc399a 100644 --- a/pandora_console/include/class/AuditLog.class.php +++ b/pandora_console/include/class/AuditLog.class.php @@ -96,7 +96,10 @@ class AuditLog extends HTML // Datatables list. try { $columns = [ - 'id_usuario', + [ + 'text' => 'id_usuario', + 'class' => 'w50px', + ], 'accion', 'fecha', 'ip_origen', @@ -116,11 +119,11 @@ class AuditLog extends HTML $columns, [ 'text' => 'security', - 'class' => 'w80px action_buttons show_security_info', + 'class' => 'w50px action_buttons show_security_info', ], [ 'text' => 'action', - 'class' => 'w80px action_buttons show_extended_info', + 'class' => 'w50px action_buttons show_extended_info', ] ); @@ -199,16 +202,28 @@ class AuditLog extends HTML [ 'label' => __('Free search').ui_print_help_tip(__('Search filter by User, Action, Date, Source IP or Comments fields content'), true), 'type' => 'text', - 'class' => 'w200px', + 'class' => 'w150px', 'id' => 'filter_text', 'name' => 'filter_text', ], [ - 'label' => __('Max. hours old'), - 'type' => 'text', - 'class' => 'w100px', - 'id' => 'filter_period', - 'name' => 'filter_period', + 'label' => __('Max. hours old'), + 'type' => 'select', + 'class' => 'w20px', + 'select2_enable' => true, + 'sort' => false, + 'selected' => 168, + 'fields' => [ + 24 => __('1 day'), + 168 => __('7 days'), + 360 => __('15 days'), + 744 => __('1 month'), + 2160 => __('3 months'), + 4320 => __('6 months'), + 8760 => __('1 Year'), + ], + 'id' => 'filter_period', + 'name' => 'filter_period', ], [ 'label' => __('IP'), @@ -223,7 +238,7 @@ class AuditLog extends HTML 'nothing' => __('All'), 'nothing_value' => '-1', 'sql' => 'SELECT DISTINCT(accion), accion AS text FROM tsesion', - 'class' => 'mw250px', + 'class' => 'mw200px', 'id' => 'filter_type', 'name' => 'filter_type', ], @@ -235,7 +250,7 @@ class AuditLog extends HTML 'sql' => 'SELECT id_user, id_user AS text FROM tusuario UNION SELECT "SYSTEM" AS id_user, "SYSTEM" AS text UNION SELECT "N/A" AS id_user, "N/A" AS text', - 'class' => 'mw250px', + 'class' => 'mw200px', 'id' => 'filter_user', 'name' => 'filter_user', ], @@ -346,9 +361,12 @@ class AuditLog extends HTML ).ui_print_timestamp($tmp->utimestamp, true); if (enterprise_installed() === true) { - $tmp->security = enterprise_hook('cell1EntepriseAudit', [$tmp->id_sesion]); - $tmp->action = enterprise_hook('cell2EntepriseAudit', []); - $tmp->extendedInfo = enterprise_hook('rowEnterpriseAudit', [$tmp->id_sesion]); + $extendedInfo = enterprise_hook('rowEnterpriseAudit', [$tmp->id_sesion]); + if (empty($extendedInfo) === false) { + $tmp->security = enterprise_hook('cell1EntepriseAudit', [$tmp->id_sesion]); + $tmp->action = enterprise_hook('cell2EntepriseAudit', []); + $tmp->extendedInfo = $extendedInfo; + } } $carry[] = $tmp; From af6f5efdd8fdad42e1eb924c25a2c7e44bb42615 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Fri, 3 Feb 2023 14:12:49 +0100 Subject: [PATCH 06/12] #10253 Enforcement options in configuration --- pandora_console/godmode/setup/performance.php | 276 +++++++++++------- 1 file changed, 169 insertions(+), 107 deletions(-) diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index 969ff868c1..aa0f3d7c82 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -261,104 +261,140 @@ $table->data[1][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 99999, + 'max' => 45, 'name' => 'event_purge', 'value' => $config['event_purge'], 'return' => true, - 'min' => ((((bool) $config['history_event_enabled'] === true) && $config['history_event_days'] > 0) ? $config['history_event_days'] + 1 : null), + 'min' => 1, 'style' => 'width:43px', ] ); $table->data[2][0] = __('Max. days before delete traps'); -$table->data[2][1] = html_print_input_text( - 'trap_purge', - $config['trap_purge'], - '', - 5, - 5, - true +$table->data[2][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 45, + 'name' => 'trap_purge', + 'value' => $config['trap_purge'], + 'return' => true, + 'min' => 1, + 'style' => 'width:43px', + ] ); $table->data[3][0] = __('Max. days before delete audit events'); -$table->data[3][1] = html_print_input_text( - 'audit_purge', - $config['audit_purge'], - '', - 5, - 5, - true +$table->data[3][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 365, + 'name' => 'audit_purge', + 'value' => $config['audit_purge'], + 'return' => true, + 'min' => 7, + 'style' => 'width:43px', + ] ); $table->data[4][0] = __('Max. days before delete string data'); -$table->data[4][1] = html_print_input_text( - 'string_purge', - $config['string_purge'], - '', - 5, - 5, - true +$table->data[4][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 365, + 'name' => 'string_purge', + 'value' => $config['string_purge'], + 'return' => true, + 'min' => 7, + 'style' => 'width:43px', + ] ); $table->data[5][0] = __('Max. days before delete GIS data'); -$table->data[5][1] = html_print_input_text( - 'gis_purge', - $config['gis_purge'], - '', - 5, - 5, - true +$table->data[5][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 365, + 'name' => 'gis_purge', + 'value' => $config['gis_purge'], + 'return' => true, + 'min' => 7, + 'style' => 'width:43px', + ] ); $table->data[6][0] = __('Max. days before purge'); -$table->data[6][1] = html_print_input_text( - 'days_purge', - $config['days_purge'], - '', - 5, - 5, - true +$table->data[6][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 365, + 'name' => 'days_purge', + 'value' => $config['days_purge'], + 'return' => true, + 'min' => 7, + 'style' => 'width:43px', + ] ); $table->data[7][0] = __('Max. days before compact data'); -$table->data[7][1] = html_print_input_text( - 'days_compact', - $config['days_compact'], - '', - 5, - 5, - true +$table->data[7][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 365, + 'name' => 'days_compact', + 'value' => $config['days_compact'], + 'return' => true, + 'min' => 0, + 'style' => 'width:43px', + ] ); $table->data[8][0] = __('Max. days before delete unknown modules'); -$table->data[8][1] = html_print_input_text( - 'days_delete_unknown', - $config['days_delete_unknown'], - '', - 5, - 5, - true +$table->data[8][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 90, + 'name' => 'days_delete_unknown', + 'value' => $config['days_delete_unknown'], + 'return' => true, + 'min' => 0, + 'style' => 'width:43px', + ] ); $table->data[9][0] = __('Max. days before delete not initialized modules'); -$table->data[9][1] = html_print_input_text( - 'days_delete_not_initialized', - $config['days_delete_not_initialized'], - '', - 5, - 5, - true +$table->data[9][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 90, + 'name' => 'days_delete_not_initialized', + 'value' => $config['days_delete_not_initialized'], + 'return' => true, + 'min' => 0, + 'style' => 'width:43px', + ] ); $table->data[10][0] = __('Max. days before delete autodisabled agents'); -$table->data[10][1] = html_print_input_text( - 'days_autodisable_deletion', - $config['days_autodisable_deletion'], - '', - 5, - 5, - true +$table->data[10][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 90, + 'name' => 'days_autodisable_deletion', + 'value' => $config['days_autodisable_deletion'], + 'return' => true, + 'min' => 0, + 'style' => 'width:43px', + ] ); $table->data[11][0] = __('Retention period of past special days'); @@ -499,13 +535,17 @@ $table->data[] = [ $table->data[] = [ __('Max. days before delete old network matrix data'), - html_print_input_text( - 'delete_old_network_matrix', - $config['delete_old_network_matrix'], - '', - 5, - 5, - true + html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 30, + 'name' => 'delete_old_network_matrix', + 'value' => $config['delete_old_network_matrix'], + 'return' => true, + 'min' => 1, + 'style' => 'width:43px', + ] ), ]; @@ -519,13 +559,17 @@ $table_other->size[0] = '70%'; $table_other->size[1] = '30%'; $i = 0; $table_other->data[$i][0] = __('Item limit for realtime reports'); -$table_other->data[$i++][1] = html_print_input_text( - 'report_limit', - $config['report_limit'], - '', - 5, - 5, - true +$table_other->data[$i++][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 500, + 'name' => 'report_limit', + 'value' => $config['report_limit'], + 'return' => true, + 'min' => 1, + 'style' => 'width:43px', + ] ); $table_other->data[$i][0] = __('Compact interpolation in hours (1 Fine-20 bad)'); @@ -549,13 +593,17 @@ $intervals[SECONDS_2WEEK] = __('2 weeks'); $intervals[SECONDS_1MONTH] = __('Last month'); $table_other->data[$i][0] = __('Default hours for event view'); -$table_other->data[$i++][1] = html_print_input_text( - 'event_view_hr', - $config['event_view_hr'], - '', - 5, - 5, - true +$table_other->data[$i++][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 360, + 'name' => 'event_view_hr', + 'value' => $config['event_view_hr'], + 'return' => true, + 'min' => 1, + 'style' => 'width:43px', + ] ); $table_other->data[$i][0] = __('Use realtime statistics'); @@ -593,23 +641,33 @@ $table_other->data[$i][0] = __('Delete not init modules'); $table_other->data[$i++][1] = html_print_checkbox_switch('delete_notinit', 1, $config['delete_notinit'], true); $table_other->data[$i][0] = __('Big Operation Step to purge old data'); -$table_other->data[$i++][1] = html_print_input_text( - 'big_operation_step_datos_purge', - $config['big_operation_step_datos_purge'], - '', - 5, - 5, - true +$table_other->data[$i++][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 10000, + 'name' => 'big_operation_step_datos_purge', + 'value' => $config['big_operation_step_datos_purge'], + 'return' => true, + 'min' => 100, + 'style' => 'width:50px', + ] ); + + $table_other->data[$i][0] = __('Small Operation Step to purge old data'); -$table_other->data[$i++][1] = html_print_input_text( - 'small_operation_step_datos_purge', - $config['small_operation_step_datos_purge'], - '', - 5, - 5, - true +$table_other->data[$i++][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 10000, + 'name' => 'small_operation_step_datos_purge', + 'value' => $config['small_operation_step_datos_purge'], + 'return' => true, + 'min' => 100, + 'style' => 'width:50px', + ] ); $table_other->data[$i][0] = __('Graph container - Max. Items'); @@ -633,13 +691,17 @@ $table_other->data[$i++][1] = html_print_input_text( ); $table_other->data[$i][0] = __('Row limit in csv log'); -$table_other->data[$i++][1] = html_print_input_text( - 'row_limit_csv', - $config['row_limit_csv'], - '', - 5, - 10, - true +$table_other->data[$i++][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 100000, + 'name' => 'row_limit_csv', + 'value' => $config['row_limit_csv'], + 'return' => true, + 'min' => 1, + 'style' => 'width:63px', + ] ); $table_other->data[$i][0] = __('SNMP walk binary'); From 31acafc00feae644f72748fb9d355d67ad0ab724 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 6 Feb 2023 09:06:34 +0100 Subject: [PATCH 07/12] #10253 Enforcement options in setup visuals and general setup --- .../godmode/setup/setup_general.php | 18 +++--- .../godmode/setup/setup_visuals.php | 60 ++++++++++++------- 2 files changed, 50 insertions(+), 28 deletions(-) diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index fa889f3071..8e26dfee27 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -512,13 +512,17 @@ $table->data[$i++][1] = html_print_checkbox_switch( ); $table->data[$i][0] = __('Limit for bulk operations'); -$table->data[$i++][1] = html_print_input_text( - 'limit_parameters_massive', - $config['limit_parameters_massive'], - '', - 10, - 10, - true +$table->data[$i++][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 2000, + 'name' => 'limit_parameters_massive', + 'value' => $config['limit_parameters_massive'], + 'return' => true, + 'min' => 100, + 'style' => 'width:50px', + ] ); $table->data[$i][0] = __('Include agents manually disabled'); diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index afc79e3f01..918747a19f 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -64,7 +64,18 @@ $table_behaviour->size[0] = '50%'; $table_behaviour->data = []; $table_behaviour->data[$row][0] = __('Block size for pagination'); -$table_behaviour->data[$row][1] = html_print_input_text('block_size', $config['global_block_size'], '', 5, 5, true); +$table_behaviour->data[$row][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 200, + 'name' => 'block_size', + 'value' => $config['global_block_size'], + 'return' => true, + 'min' => 10, + 'style' => 'width:50px', + ] +); $row++; $values = []; @@ -823,16 +834,19 @@ if (enterprise_installed() === false) { } $table_chars->data[$row][0] = __('Data precision'); -$table_chars->data[$row][1] = html_print_input_text( - 'graph_precision', - $config['graph_precision'], - '', - 5, - 5, - true, - $disabled_graph_precision, - false, - 'onChange="change_precision()"' +$table_chars->data[$row][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 5, + 'name' => 'graph_precision', + 'value' => $config['graph_precision'], + 'return' => true, + 'min' => 1, + 'style' => 'width:50px', + ($disabled_graph_precision) ? 'readonly' : '' => 'readonly', + 'onchange' => 'change_precision()', + ] ); $row++; @@ -841,17 +855,21 @@ if (isset($config['short_module_graph_data']) === false) { } $table_chars->data[$row][0] = __('Data precision in graphs'); -$table_chars->data[$row][1] = html_print_input_text( - 'short_module_graph_data', - $config['short_module_graph_data'], - '', - 5, - 5, - true, - $disabled_graph_precision, - false, - 'onChange="change_precision()"' +$table_chars->data[$row][1] = html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => 20, + 'name' => 'short_module_graph_data', + 'value' => $config['short_module_graph_data'], + 'return' => true, + 'min' => 1, + 'style' => 'width:50px', + ($disabled_graph_precision) ? 'readonly' : '' => 'readonly', + 'onchange' => 'change_precision()', + ] ); + $row++; $table_chars->data[$row][0] = __( From aedf6986b3899d769a3e905f1320b62a0d4d160e Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 6 Feb 2023 15:22:39 +0100 Subject: [PATCH 08/12] #10253 added console alert for control variables performance --- pandora_console/godmode/setup/performance.php | 66 +++++++------- .../godmode/setup/setup_general.php | 6 +- .../godmode/setup/setup_visuals.php | 14 +-- .../include/class/ConsoleSupervisor.php | 80 +++++++++++++++++ pandora_console/include/functions_config.php | 90 +++++++++++++++++++ .../include/functions_notifications.php | 1 + 6 files changed, 217 insertions(+), 40 deletions(-) diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index aa0f3d7c82..f616460e6d 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -151,6 +151,8 @@ if ($update_config == 1 && $config['history_db_enabled'] == 1) { } } +$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control'])); + $table_status = new StdClass(); $table_status->width = '100%'; $table_status->class = 'databox filters'; @@ -261,11 +263,11 @@ $table->data[1][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 45, + 'max' => $performance_variables_control['event_purge']->max, 'name' => 'event_purge', 'value' => $config['event_purge'], 'return' => true, - 'min' => 1, + 'min' => $performance_variables_control['event_purge']->min, 'style' => 'width:43px', ] ); @@ -275,11 +277,11 @@ $table->data[2][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 45, + 'max' => $performance_variables_control['trap_purge']->max, 'name' => 'trap_purge', 'value' => $config['trap_purge'], 'return' => true, - 'min' => 1, + 'min' => $performance_variables_control['trap_purge']->min, 'style' => 'width:43px', ] ); @@ -289,11 +291,11 @@ $table->data[3][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 365, + 'max' => $performance_variables_control['audit_purge']->max, 'name' => 'audit_purge', 'value' => $config['audit_purge'], 'return' => true, - 'min' => 7, + 'min' => $performance_variables_control['audit_purge']->min, 'style' => 'width:43px', ] ); @@ -303,11 +305,11 @@ $table->data[4][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 365, + 'max' => $performance_variables_control['string_purge']->max, 'name' => 'string_purge', 'value' => $config['string_purge'], 'return' => true, - 'min' => 7, + 'min' => $performance_variables_control['string_purge']->min, 'style' => 'width:43px', ] ); @@ -317,11 +319,11 @@ $table->data[5][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 365, + 'max' => $performance_variables_control['gis_purge']->max, 'name' => 'gis_purge', 'value' => $config['gis_purge'], 'return' => true, - 'min' => 7, + 'min' => $performance_variables_control['gis_purge']->min, 'style' => 'width:43px', ] ); @@ -331,11 +333,11 @@ $table->data[6][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 365, + 'max' => $performance_variables_control['days_purge']->max, 'name' => 'days_purge', 'value' => $config['days_purge'], 'return' => true, - 'min' => 7, + 'min' => $performance_variables_control['days_purge']->min, 'style' => 'width:43px', ] ); @@ -345,11 +347,11 @@ $table->data[7][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 365, + 'max' => $performance_variables_control['days_compact']->max, 'name' => 'days_compact', 'value' => $config['days_compact'], 'return' => true, - 'min' => 0, + 'min' => $performance_variables_control['days_compact']->min, 'style' => 'width:43px', ] ); @@ -359,11 +361,11 @@ $table->data[8][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 90, + 'max' => $performance_variables_control['days_delete_unknown']->max, 'name' => 'days_delete_unknown', 'value' => $config['days_delete_unknown'], 'return' => true, - 'min' => 0, + 'min' => $performance_variables_control['days_delete_unknown']->min, 'style' => 'width:43px', ] ); @@ -374,11 +376,11 @@ $table->data[9][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 90, + 'max' => $performance_variables_control['days_delete_not_initialized']->max, 'name' => 'days_delete_not_initialized', 'value' => $config['days_delete_not_initialized'], 'return' => true, - 'min' => 0, + 'min' => $performance_variables_control['days_delete_not_initialized']->min, 'style' => 'width:43px', ] ); @@ -388,11 +390,11 @@ $table->data[10][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 90, + 'max' => $performance_variables_control['days_autodisable_deletion']->max, 'name' => 'days_autodisable_deletion', 'value' => $config['days_autodisable_deletion'], 'return' => true, - 'min' => 0, + 'min' => $performance_variables_control['days_autodisable_deletion']->min, 'style' => 'width:43px', ] ); @@ -539,11 +541,11 @@ $table->data[] = [ [ 'type' => 'number', 'size' => 5, - 'max' => 30, + 'max' => $performance_variables_control['delete_old_network_matrix']->max, 'name' => 'delete_old_network_matrix', 'value' => $config['delete_old_network_matrix'], 'return' => true, - 'min' => 1, + 'min' => $performance_variables_control['delete_old_network_matrix']->min, 'style' => 'width:43px', ] ), @@ -563,11 +565,11 @@ $table_other->data[$i++][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 500, + 'max' => $performance_variables_control['report_limit']->max, 'name' => 'report_limit', 'value' => $config['report_limit'], 'return' => true, - 'min' => 1, + 'min' => $performance_variables_control['report_limit']->min, 'style' => 'width:43px', ] ); @@ -597,11 +599,11 @@ $table_other->data[$i++][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 360, + 'max' => $performance_variables_control['event_view_hr']->max, 'name' => 'event_view_hr', 'value' => $config['event_view_hr'], 'return' => true, - 'min' => 1, + 'min' => $performance_variables_control['event_view_hr']->min, 'style' => 'width:43px', ] ); @@ -645,11 +647,11 @@ $table_other->data[$i++][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 10000, + 'max' => $performance_variables_control['big_operation_step_datos_purge']->max, 'name' => 'big_operation_step_datos_purge', 'value' => $config['big_operation_step_datos_purge'], 'return' => true, - 'min' => 100, + 'min' => $performance_variables_control['big_operation_step_datos_purge']->min, 'style' => 'width:50px', ] ); @@ -661,11 +663,11 @@ $table_other->data[$i++][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 10000, + 'max' => $performance_variables_control['small_operation_step_datos_purge']->max, 'name' => 'small_operation_step_datos_purge', 'value' => $config['small_operation_step_datos_purge'], 'return' => true, - 'min' => 100, + 'min' => $performance_variables_control['small_operation_step_datos_purge']->min, 'style' => 'width:50px', ] ); @@ -695,11 +697,11 @@ $table_other->data[$i++][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 100000, + 'max' => $performance_variables_control['row_limit_csv']->max, 'name' => 'row_limit_csv', 'value' => $config['row_limit_csv'], 'return' => true, - 'min' => 1, + 'min' => $performance_variables_control['row_limit_csv']->min, 'style' => 'width:63px', ] ); diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index 8e26dfee27..987294185d 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -47,6 +47,8 @@ if (is_ajax()) { exit(); } +$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control'])); + $table = new StdClass(); $table->class = 'databox filters'; $table->id = 'setup_general'; @@ -516,11 +518,11 @@ $table->data[$i++][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 2000, + 'max' => $performance_variables_control['limit_parameters_massive']->max, 'name' => 'limit_parameters_massive', 'value' => $config['limit_parameters_massive'], 'return' => true, - 'min' => 100, + 'min' => $performance_variables_control['limit_parameters_massive']->min, 'style' => 'width:50px', ] ); diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 918747a19f..e27e7b858d 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -53,6 +53,8 @@ $row = 0; echo '
'; html_print_input_hidden('update_config', 1); +$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control'])); + // ---------------------------------------------------------------------- // BEHAVIOUR CONFIGURATION // ---------------------------------------------------------------------- @@ -68,11 +70,11 @@ $table_behaviour->data[$row][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 200, + 'max' => $performance_variables_control['block_size']->max, 'name' => 'block_size', 'value' => $config['global_block_size'], 'return' => true, - 'min' => 10, + 'min' => $performance_variables_control['block_size']->min, 'style' => 'width:50px', ] ); @@ -838,11 +840,11 @@ $table_chars->data[$row][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 5, + 'max' => $performance_variables_control['graph_precision']->max, 'name' => 'graph_precision', 'value' => $config['graph_precision'], 'return' => true, - 'min' => 1, + 'min' => $performance_variables_control['graph_precision']->min, 'style' => 'width:50px', ($disabled_graph_precision) ? 'readonly' : '' => 'readonly', 'onchange' => 'change_precision()', @@ -859,11 +861,11 @@ $table_chars->data[$row][1] = html_print_input( [ 'type' => 'number', 'size' => 5, - 'max' => 20, + 'max' => $performance_variables_control['short_module_graph_data']->max, 'name' => 'short_module_graph_data', 'value' => $config['short_module_graph_data'], 'return' => true, - 'min' => 1, + 'min' => $performance_variables_control['short_module_graph_data']->min, 'style' => 'width:50px', ($disabled_graph_precision) ? 'readonly' : '' => 'readonly', 'onchange' => 'change_precision()', diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index b6a6d3df43..e426858e8a 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -248,6 +248,11 @@ class ConsoleSupervisor $this->checkAuditLogOldLocation(); + /* + * Check if performance variables are corrects + */ + $this->checkPerformanceVariables(); + /* * Checks if sync queue is longer than limits. * NOTIF.SYNCQUEUE.LENGTH @@ -509,6 +514,11 @@ class ConsoleSupervisor $this->checkAuditLogOldLocation(); + /* + * Check if performance variables are corrects + */ + $this->checkPerformanceVariables(); + /* * Checks if sync queue is longer than limits. * NOTIF.SYNCQUEUE.LENGTH @@ -521,6 +531,76 @@ class ConsoleSupervisor } + /** + * Check if performance variables are corrects + * + * @return void + */ + public function checkPerformanceVariables() + { + global $config; + + $names = [ + 'event_purge' => 'Max. days before events are deleted', + 'trap_purge' => 'Max. days before traps are deleted', + 'audit_purge' => 'Max. days before audited events are deleted', + 'string_purge' => 'Max. days before string data is deleted', + 'gis_purge' => 'Max. days before GIS data is deleted', + 'days_purge' => 'Max. days before purge', + 'days_compact' => 'Max. days before data is compacted', + 'days_delete_unknown' => 'Max. days before unknown modules are deleted', + 'days_delete_not_initialized' => 'Max. days before delete not initialized modules', + 'days_autodisable_deletion' => 'Max. days before autodisabled agents are deleted', + 'delete_old_network_matrix' => 'Max. days before delete old network matrix data', + 'report_limit' => 'Item limit for real-time reports', + 'event_view_hr' => 'Default hours for event view', + 'big_operation_step_datos_purge' => 'Big Operation Step to purge old data', + 'small_operation_step_datos_purge' => 'Small Operation Step to purge old data', + 'row_limit_csv' => 'Row limit in csv log', + 'limit_parameters_massive' => 'Limit for bulk operations', + 'block_size' => 'Block size for pagination', + 'short_module_graph_data' => 'Data precision', + 'graph_precision' => 'Data precision in graphs', + ]; + + $variables = (array) json_decode(io_safe_output($config['performance_variables_control'])); + + foreach ($variables as $variable => $values) { + if (empty($config[$variable]) === true || $config[$variable] === '') { + continue; + } + + $message = ''; + $limit_value = ''; + if ($config[$variable] > $values->max) { + $message = 'Check the setting of %s, a value greater than %s is not recommended'; + $limit_value = $values->max; + } + + if ($config[$variable] < $values->min) { + $message = 'Check the setting of %s, a value less than %s is not recommended'; + $limit_value = $values->min; + } + + if ($limit_value !== '' && $message !== '') { + $this->notify( + [ + 'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable, + 'title' => __('Incorrect config value'), + 'message' => __( + $message, + $names[$variable], + $limit_value + ), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup', + ] + ); + } + } + + } + + /** * Executes console maintenance operations. Executed ALWAYS through CRON. * diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index b0d15d5cef..ee42d68055 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -2293,6 +2293,96 @@ function config_process_config() config_update_value('2Fa_auth', ''); } + if (isset($config['performance_variables_control']) === false) { + config_update_value( + 'performance_variables_control', + json_encode( + [ + 'event_purge' => [ + 'max' => 45, + 'min' => 1, + ], + 'trap_purge' => [ + 'max' => 45, + 'min' => 1, + ], + 'audit_purge' => [ + 'max' => 365, + 'min' => 7, + ], + 'string_purge' => [ + 'max' => 365, + 'min' => 7, + ], + 'gis_purge' => [ + 'max' => 365, + 'min' => 7, + ], + 'days_purge' => [ + 'max' => 365, + 'min' => 7, + ], + 'days_compact' => [ + 'max' => 365, + 'min' => 0, + ], + 'days_delete_unknown' => [ + 'max' => 90, + 'min' => 0, + ], + 'days_delete_not_initialized' => [ + 'max' => 90, + 'min' => 0, + ], + 'days_autodisable_deletion' => [ + 'max' => 90, + 'min' => 0, + ], + 'delete_old_network_matrix' => [ + 'max' => 30, + 'min' => 1, + ], + 'report_limit' => [ + 'max' => 500, + 'min' => 1, + ], + 'event_view_hr' => [ + 'max' => 360, + 'min' => 1, + ], + 'big_operation_step_datos_purge' => [ + 'max' => 10000, + 'min' => 100, + ], + 'small_operation_step_datos_purge' => [ + 'max' => 10000, + 'min' => 100, + ], + 'row_limit_csv' => [ + 'max' => 1000000, + 'min' => 1, + ], + 'limit_parameters_massive' => [ + 'max' => 2000, + 'min' => 100, + ], + 'block_size' => [ + 'max' => 200, + 'min' => 10, + ], + 'short_module_graph_data' => [ + 'max' => 20, + 'min' => 1, + ], + 'graph_precision' => [ + 'max' => 5, + 'min' => 1, + ], + ] + ) + ); + } + if (isset($config['agent_wizard_defaults']) === false) { config_update_value( 'agent_wizard_defaults', diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php index 705d67ab3b..1a4167d8c3 100644 --- a/pandora_console/include/functions_notifications.php +++ b/pandora_console/include/functions_notifications.php @@ -159,6 +159,7 @@ function notifications_get_subtypes(?string $source=null) 'NOTIF.SERVER.STATUS', 'NOTIF.SERVER.QUEUE', 'NOTIF.SERVER.MASTER', + 'NOTIF.VARIABLES.PERFORMANCE', ], ]; From d1a3795acb1ae5d1072c6792b6935f09ada42db7 Mon Sep 17 00:00:00 2001 From: Calvo Date: Thu, 23 Feb 2023 12:58:33 +0100 Subject: [PATCH 09/12] Added new indexes to mr and pandoradb --- pandora_console/extras/mr/62.sql | 7 +++++++ pandora_console/pandoradb.sql | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 pandora_console/extras/mr/62.sql diff --git a/pandora_console/extras/mr/62.sql b/pandora_console/extras/mr/62.sql new file mode 100644 index 0000000000..b5358f6254 --- /dev/null +++ b/pandora_console/extras/mr/62.sql @@ -0,0 +1,7 @@ +-- Active: 1653046769261@@172.16.0.2@3306@pandora +START TRANSACTION; + +CREATE INDEX agente_modulo_estado ON tevento (estado, id_agentmodule); +CREATE INDEX idx_disabled ON talert_template_modules (disabled); + +COMMIT; diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index e43aaa7646..530a0049ac 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -557,7 +557,8 @@ CREATE TABLE IF NOT EXISTS `talert_template_modules` ( FOREIGN KEY (`id_alert_template`) REFERENCES talert_templates(`id`) ON DELETE CASCADE ON UPDATE CASCADE, UNIQUE (`id_agent_module`, `id_alert_template`, `id_policy_alerts`), - INDEX force_execution (`force_execution`) + INDEX force_execution (`force_execution`), + INDEX idx_disabled (disabled) ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; -- ----------------------------------------------------- @@ -719,7 +720,8 @@ CREATE TABLE IF NOT EXISTS `tevento` ( PRIMARY KEY (`id_evento`), KEY `idx_agente` (`id_agente`), KEY `idx_agentmodule` (`id_agentmodule`), - KEY `idx_utimestamp` USING BTREE (`utimestamp`) + KEY `idx_utimestamp` USING BTREE (`utimestamp`), + INDEX `agente_modulo_estado`(`estado`, `id_agentmodule`) ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; -- Criticity: 0 - Maintance (grey) -- Criticity: 1 - Informational (blue) From 5d4c61f8c4c28d04de67d1db95a9672adfbe41b9 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 27 Feb 2023 13:26:32 +0100 Subject: [PATCH 10/12] #10253 added notify enforcement in metaconsole --- .../include/class/ConsoleSupervisor.php | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index e426858e8a..4084d53cd2 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -583,18 +583,33 @@ class ConsoleSupervisor } if ($limit_value !== '' && $message !== '') { - $this->notify( - [ - 'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable, - 'title' => __('Incorrect config value'), - 'message' => __( - $message, - $names[$variable], - $limit_value - ), - 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup', - ] - ); + if (is_metaconsole() === true) { + $this->notify( + [ + 'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable, + 'title' => __('Incorrect config value'), + 'message' => __( + $message, + $names[$variable], + $limit_value + ), + 'url' => '__url__index.php?sec=advanced&sec2=advanced/metasetup', + ] + ); + } else { + $this->notify( + [ + 'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable, + 'title' => __('Incorrect config value'), + 'message' => __( + $message, + $names[$variable], + $limit_value + ), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup', + ] + ); + } } } From 3259795a0bf70969e4b476398e8dd6375850d629 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 27 Feb 2023 16:15:34 +0100 Subject: [PATCH 11/12] #10559 control delete task list if not exist id --- .../wizards/DiscoveryTaskList.class.php | 59 +++++++++++-------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index a1fa53ced3..44f8ebf868 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -955,29 +955,42 @@ class DiscoveryTaskList extends HTML ) ) { if ($ipam === true) { - $data[9] .= ''.html_print_image( - 'images/config.png', - true, - [ - 'title' => __('Edit task'), - 'class' => 'invert_filter', - ] - ).''; - $data[9] .= ''.html_print_image( - 'images/cross.png', - true, - [ - 'title' => __('Delete task'), - 'class' => 'invert_filter', - ] - ).''; + if (empty($tipam_task_id) === false) { + $data[9] .= ''.html_print_image( + 'images/config.png', + true, + [ + 'title' => __('Edit task'), + 'class' => 'invert_filter', + ] + ).''; + $data[9] .= ''.html_print_image( + 'images/cross.png', + true, + [ + 'title' => __('Delete task'), + 'class' => 'invert_filter', + ] + ).''; + } else { + $data[9] .= ''.html_print_image( + 'images/cross.png', + true, + [ + 'title' => __('Delete task'), + 'class' => 'invert_filter', + ] + ).''; + } } else { // Check if is a H&D, Cloud or Application or IPAM. $data[9] .= ' /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index a994aabc8b..4fa07035d2 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1023,7 +1023,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.769'; -use constant AGENT_BUILD => '230228'; +use constant AGENT_BUILD => '230301'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 1e35d4443c..f8ab9c7e41 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230228 +%define release 230301 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 3519ff8837..6a16d883fd 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230228 +%define release 230301 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index ec3075858c..46e66a8170 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230228" +PI_BUILD="230301" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 2f2c4f1324..79687a6d2e 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230228} +{230301} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 9d41d77811..8264d0e9c8 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.769 Build 230228") +#define PANDORA_VERSION ("7.0NG.769 Build 230301") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index ab42fb366e..ece56bd837 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.769(Build 230228))" + VALUE "ProductVersion", "(7.0NG.769(Build 230301))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 12ed651bf5..c9f3c45a17 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.769-230228 +Version: 7.0NG.769-230301 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 32b28e5e53..90ab3e8133 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.769-230228" +pandora_version="7.0NG.769-230301" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index a853e7eef5..e197b66be2 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC230228'; +$build_version = 'PC230301'; $pandora_version = 'v7.0NG.769'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 2a7bde9bb0..e76fce4a52 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -131,7 +131,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 8fbf6b3a47..8b319376d8 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_server %define version 7.0NG.769 -%define release 230228 +%define release 230301 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 2e8dbd979d..931745b212 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_server %define version 7.0NG.769 -%define release 230228 +%define release 230301 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index b4b9a39a65..f4c905a120 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230228" +PI_BUILD="230301" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 95573a89de..cad9bf5993 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.769 Build 230228"; +my $version = "7.0NG.769 Build 230301"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index ea984d2726..5fbf54b2e5 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.769 Build 230228"; +my $version = "7.0NG.769 Build 230301"; # save program name for logging my $progname = basename($0);