diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 961430ed2d..3c97c6e154 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.774-231129 +Version: 7.0NG.774-231201 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index afccdacf6e..ca4c9222aa 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/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.774-231129" +pandora_version="7.0NG.774-231201" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 717ea04435..e3f19fa5f7 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1039,7 +1039,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.774'; -use constant AGENT_BUILD => '231129'; +use constant AGENT_BUILD => '231201'; # 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 89a42e7053..856bf29aae 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.774 -%define release 231129 +%define release 231201 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec index 22f398cc58..1166df20f9 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231129 +%define release 231201 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec index 9b3432f0e8..0ee91358de 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231129 +%define release 231201 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.spec b/pandora_agents/unix/pandora_agent.redhat_bin.spec index f36d3ee5ef..d30857834b 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231129 +%define release 231201 Summary: Pandora FMS Linux agent, binary version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 7509428246..088ad4eba0 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.774 -%define release 231129 +%define release 231201 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 cf837d8d18..beab7ebf7e 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.774" -PI_BUILD="231129" +PI_BUILD="231201" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 2da734487d..8af046be0c 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{231129} +{231201} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 11dd5631d0..99b210ee5b 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.774 Build 231129") +#define PANDORA_VERSION ("7.0NG.774 Build 231201") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 07e506116e..9195fac0d2 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Pandora FMS" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.774(Build 231129))" + VALUE "ProductVersion", "(7.0NG.774(Build 231201))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index c6182f77f3..a02531535c 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.774-231129 +Version: 7.0NG.774-231201 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 9a519e7218..6ae0812782 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.774-231129" +pandora_version="7.0NG.774-231201" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/mr/67.sql b/pandora_console/extras/mr/67.sql index a0e13a2ab5..fe022e45e3 100644 --- a/pandora_console/extras/mr/67.sql +++ b/pandora_console/extras/mr/67.sql @@ -1,10 +1,25 @@ START TRANSACTION; +ALTER TABLE `tevento` +ADD COLUMN `event_custom_id` TEXT NULL AFTER `module_status`; + +-- Telegram and vonage default alerts +UPDATE talert_actions + SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' + WHERE id=9; +UPDATE talert_actions + SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' + WHERE id=11; -- Delete table tagent_access DROP TABLE tagent_access; +ALTER TABLE `tevent_rule` DROP COLUMN `user_comment`; +ALTER TABLE `tevent_rule` DROP COLUMN `operator_user_comment`; + ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL; +ALTER TABLE `tevent_filter` +ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`; -- Update macros for plugin oracle UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle'; @@ -17,5 +32,19 @@ INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, ` INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT id_rt, '_clientPath_', 'custom', '', 0 FROM `trecon_task` WHERE `id_app` = @id_app; UPDATE `trecon_task` SET `setup_complete` = 1 WHERE `id_app` = @id_app; +-- Update lts updates +UPDATE tconfig SET value='1' WHERE token='lts_updates'; + +ALTER TABLE `tdashboard` +ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`, +ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`, +ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`; + +SELECT @generic_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_data"; +SELECT @generic_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_proc"; +SELECT @async_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_data"; +SELECT @async_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_proc"; +UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_data WHERE `tagente_modulo`.`id_tipo_modulo` = @async_data; +UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_proc WHERE `tagente_modulo`.`id_tipo_modulo` = @async_proc; COMMIT; diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index 5c21fa71a0..c3772c00d3 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -38,6 +38,7 @@ $isFunctionPolicies = enterprise_include_once('include/functions_policies.php'); require_once $config['homedir'].'/include/functions_modules.php'; require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_servers.php'; +require_once $config['homedir'].'/include/functions_macros.php'; $search_string = get_parameter('search_string'); @@ -949,7 +950,23 @@ if ($modules !== false) { ); if (strlen($module['ip_target']) !== 0) { - $title .= '
IP: '.$module['ip_target']; + // Check if value is custom field. + if ($module['ip_target'][0] == '_' && $module['ip_target'][(strlen($module['ip_target']) - 1)] == '_') { + $custom_field_name = substr($module['ip_target'], 1, -1); + $custom_value = agents_get_agent_custom_field($id_agente, $custom_field_name); + if (isset($custom_value) && $custom_value !== false) { + $title .= '
IP: '.$custom_value; + } else { + $array_macros = return_agent_macros($id_agente); + if (isset($array_macros[$module['ip_target']])) { + $title .= '
IP: '.$array_macros[$module['ip_target']]; + } else { + $title .= '
IP: '.$module['ip_target']; + } + } + } else { + $title .= '
IP: '.$module['ip_target']; + } } // This module is initialized ? (has real data). diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index f987292126..c396634f67 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -2003,23 +2003,14 @@ ui_require_jquery_file('json'); var type_names = jQuery.parseJSON(Base64.decode($('#hidden-type_names').val())); var type_name_selected = type_names[type_selected]; - if ($('#radius-percentage_warning').prop('checked') === true || $('#radius-percentage_critical').prop('checked') === true || type_name_selected == 'generic_data_string') { + if (($('#radius-percentage_warning').prop('checked') === true && $('#radius-percentage_critical').prop('checked') === true) || type_name_selected == 'generic_data_string') { + paint_graph_values(); $("#svg_dinamic").hide(); } else { paint_graph_values(); $("#svg_dinamic").show(); } - if ($('#radius-percentage_warning').prop('checked') === true) { - $('#radius-warning_inverse').hide(); - $('#label-radius-warning_inverse').hide(); - } - - if ($('#radius-warning_inverse').prop('checked') === true) { - $('#radius-percentage_warning').hide(); - $('#label-radius-percentage_warning').hide(); - } - if ($('#radius-normal_warning').prop('checked') === true) { $('#radius-warning_inverse').show(); $('#label-radius-warning_inverse').show(); @@ -2027,17 +2018,6 @@ ui_require_jquery_file('json'); $('#label-radius-percentage_warning').show(); } - - if ($('#radius-percentage_critical').prop('checked') === true) { - $('#radius-critical_inverse').hide(); - $('#label-radius-critical_inverse').hide(); - } - - if ($('#radius-critical_inverse').prop('checked') === true) { - $('#radius-percentage_critical').hide(); - $('#label-radius-percentage_critical').hide(); - } - if ($('#radius-normal_critical').prop('checked') === true) { $('#radius-critical_inverse').show(); $('#label-radius-critical_inverse').show(); @@ -2354,30 +2334,48 @@ ui_require_jquery_file('json'); var message_error_percentage = ''; //if haven't error - if (max_w == 0 || max_w > min_w) { - if (max_c == 0 || max_c > min_c) { - paint_graph_status( - min_w, max_w, min_c, max_c, inverse_w, - inverse_c, error_w, error_c, - legend_normal, legend_warning, legend_critical, - message_error_warning, message_error_critical - ); + if (max_w == 0 || max_w > min_w || $('#radius-percentage_warning').is(':checked') === true) { + if (max_c == 0 || max_c > min_c || $('#radius-percentage_critical').is(':checked') === true) { + error_c = 0; + error_w = 0; } else { error_c = 1; - paint_graph_status( - 0, 0, 0, 0, 0, 0, error_w, error_c, - legend_normal, legend_warning, legend_critical, - message_error_warning, message_error_critical - ); + min_w = 0; + max_w = 0; + min_c = 0; + max_c = 0; + inverse_w = 0; + inverse_c = 0; } } else { + if (max_c !== 0 && max_c < min_c && $('#radius-percentage_critical').is(':checked') === false) { + error_c = 2; + } error_w = 1; - paint_graph_status( - 0, 0, 0, 0, 0, 0, error_w, error_c, - legend_normal, legend_warning, legend_critical, - message_error_warning, message_error_critical - ); + min_w = 0; + max_w = 0; + min_c = 0; + max_c = 0; + inverse_w = 0; + inverse_c = 0; } + + if ($('#radius-percentage_warning').is(':checked') === true){ + min_w = 0; + max_w = 0; + } + + if ($('#radius-percentage_critical').is(':checked') === true){ + min_c = 0; + max_c = 0; + } + + paint_graph_status( + min_w, max_w, min_c, max_c, inverse_w, + inverse_c, error_w, error_c, + legend_normal, legend_warning, legend_critical, + message_error_warning, message_error_critical + ); } /* ]]> */ diff --git a/pandora_console/godmode/alerts/alert_view.php b/pandora_console/godmode/alerts/alert_view.php index 8d4d07e578..7809742221 100644 --- a/pandora_console/godmode/alerts/alert_view.php +++ b/pandora_console/godmode/alerts/alert_view.php @@ -256,7 +256,7 @@ $schedule = io_safe_output( $data[0] = ''; $data[0] .= html_print_input_hidden('schedule', $schedule, true); -$data[0] .= '
'; +$data[0] .= '
'; $data[1] = ''; $table_conditions->data[] = $data; diff --git a/pandora_console/godmode/events/custom_events.php b/pandora_console/godmode/events/custom_events.php index c91a2df8fe..4ab84fa76b 100644 --- a/pandora_console/godmode/events/custom_events.php +++ b/pandora_console/godmode/events/custom_events.php @@ -115,6 +115,7 @@ $fields_available['module_status'] = __('Module Status'); $fields_available['mini_severity'] = __('Severity mini'); $fields_available['module_custom_id'] = __('Module custom ID'); $fields_available['custom_data'] = __('Custom data'); +$fields_available['event_custom_id'] = __('Event Custom ID'); // Remove fields already selected. diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index 694a2a6ea3..bcfb6f99c9 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -163,7 +163,10 @@ switch ($activeTab) { $background_color = (string) get_parameter('background_color'); $width = (int) get_parameter('width'); $height = (int) get_parameter('height'); - $visualConsoleName = (string) io_safe_input(get_parameter('name')); + $visualConsoleName = (string) get_parameter('name'); + $visualConsoleName = str_replace('<', '', $visualConsoleName); + $visualConsoleName = str_replace('>', '', $visualConsoleName); + $visualConsoleName = (string) io_safe_input($visualConsoleName); $is_favourite = (int) get_parameter('is_favourite_sent'); $auto_adjust = (int) get_parameter('auto_adjust_sent'); diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index 315702528e..39acc45c21 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.php @@ -860,8 +860,10 @@ if (empty($create) === false || empty($view) === false) { if ($management_allowed === false) { ui_print_warning_message( __( - 'This console is not manager of this environment, - please manage this feature from centralized manager console (Metaconsole).' + 'This console is not manager of this environment, please manage this feature from feature from %s.', + ''.__('metaconsole').'' ) ); } diff --git a/pandora_console/godmode/servers/servers.build_table.php b/pandora_console/godmode/servers/servers.build_table.php index 76964a7afa..516a62ea82 100644 --- a/pandora_console/godmode/servers/servers.build_table.php +++ b/pandora_console/godmode/servers/servers.build_table.php @@ -179,7 +179,7 @@ foreach ($servers as $server) { } $data[7] = ''; - if ($server['queued_modules'] > 500) { + if ($server['queued_modules'] >= $config['number_modules_queue']) { $data[7] .= '
'.html_print_image( 'images/info-warning.svg', true, diff --git a/pandora_console/godmode/setup/setup_ITSM.php b/pandora_console/godmode/setup/setup_ITSM.php index 3196ef677c..012d80f849 100644 --- a/pandora_console/godmode/setup/setup_ITSM.php +++ b/pandora_console/godmode/setup/setup_ITSM.php @@ -187,7 +187,8 @@ $button_test .= ' '; $row['control'] = html_print_label_input_block( __('Test connection pandora to ITSM'), - $button_test + $button_test, + ['div_class' => 'ITSM-remote-setup-ITSM_token'] ); $table_remote->data['ITSM_test'] = $row; diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index 2732568208..56596af445 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -405,19 +405,6 @@ $table->data[$i++][] = html_print_label_input_block( $table->data[$i][] = html_print_label_input_block( - __('Enable Sflow'), - html_print_checkbox_switch_extended( - 'activate_sflow', - 1, - $config['activate_sflow'], - $rbt_disabled, - '', - '', - true - ), -); - -$table->data[$i++][] = html_print_label_input_block( __('General network path'), html_print_input_text( 'general_network_path', @@ -733,7 +720,7 @@ $table->data[$i++][] = html_print_label_input_block( ); $help_tip = ui_print_help_tip( - __('If there are any "In process" events with a specific Extra ID and a New event with that Extra ID is received, it will be created as "In process" instead.'), + __('If there are any "In process" events with a specific Extra ID and a New event with that Extra ID is received, it will be created as "In process" instead. The new events also inherit Event Custom ID'), true ); @@ -766,6 +753,16 @@ $table->data[$i][] = html_print_label_input_block( true ) ); +$table->data[$i++][] = html_print_label_input_block( + __('Number of modules in queue'), + html_print_input_number( + [ + 'name' => 'number_modules_queue', + 'min' => 0, + 'value' => $config['number_modules_queue'], + ] + ) +); echo '
'; diff --git a/pandora_console/godmode/setup/setup_netflow.php b/pandora_console/godmode/setup/setup_netflow.php index b939a01825..9e6f6ee180 100644 --- a/pandora_console/godmode/setup/setup_netflow.php +++ b/pandora_console/godmode/setup/setup_netflow.php @@ -83,6 +83,19 @@ $table->data[3][] = html_print_label_input_block( html_print_checkbox_switch_extended('netflow_get_ip_hostname', 1, $config['netflow_get_ip_hostname'], false, $onclick, '', true) ); +$table->data[4][] = html_print_label_input_block( + __('Enable Sflow'), + html_print_checkbox_switch_extended( + 'activate_sflow', + 1, + $config['activate_sflow'], + $rbt_disabled, + '', + '', + true + ), +); + echo ''; html_print_table($table); html_print_input_hidden('update_config', 1); diff --git a/pandora_console/godmode/um_client/index.php b/pandora_console/godmode/um_client/index.php index c79502626a..1a78e39b5f 100644 --- a/pandora_console/godmode/um_client/index.php +++ b/pandora_console/godmode/um_client/index.php @@ -61,7 +61,7 @@ $license = db_get_value( ); if (isset($config['lts_updates']) === false) { - $config['lts_updates'] = false; + $config['lts_updates'] = true; } if (empty($license) === true) { diff --git a/pandora_console/godmode/update_manager/modal_lts_update.php b/pandora_console/godmode/update_manager/modal_lts_update.php new file mode 100644 index 0000000000..fc744b3b57 --- /dev/null +++ b/pandora_console/godmode/update_manager/modal_lts_update.php @@ -0,0 +1,111 @@ + + + + + + \ No newline at end of file diff --git a/pandora_console/godmode/update_manager/update_manager.php b/pandora_console/godmode/update_manager/update_manager.php index e201bc14dd..3cb774c4d5 100644 --- a/pandora_console/godmode/update_manager/update_manager.php +++ b/pandora_console/godmode/update_manager/update_manager.php @@ -119,11 +119,13 @@ switch ($tab) { case 'setup': include $config['homedir'].'/godmode/update_manager/update_manager.setup.php'; + include $config['homedir'].'/godmode/update_manager/modal_lts_update.php'; break; case 'offline': $mode = \UpdateManager\UI\Manager::MODE_OFFLINE; include $config['homedir'].'/godmode/um_client/index.php'; + include $config['homedir'].'/godmode/update_manager/modal_lts_update.php'; break; case 'online': @@ -163,5 +165,6 @@ switch ($tab) { $mode = \UpdateManager\UI\Manager::MODE_ONLINE; include $config['homedir'].'/godmode/um_client/index.php'; + include $config['homedir'].'/godmode/update_manager/modal_lts_update.php'; break; } diff --git a/pandora_console/godmode/update_manager/update_manager.setup.php b/pandora_console/godmode/update_manager/update_manager.setup.php index ac5471f96a..6fb56aed15 100644 --- a/pandora_console/godmode/update_manager/update_manager.setup.php +++ b/pandora_console/godmode/update_manager/update_manager.setup.php @@ -63,6 +63,10 @@ if (users_is_admin()) { } } +if (isset($config['lts_updates']) === false) { + config_update_value('lts_updates', 1); +} + if (!$action_update_url_update_manager) { $url_update_manager = get_parameter( 'url_update_manager', diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 7da3069e5a..83e54f24c5 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -424,8 +424,10 @@ if ($create_user === true) { $values['data_section'] = $dashboard; } else if (io_safe_output($values['section']) === HOME_SCREEN_VISUAL_CONSOLE) { $values['data_section'] = $visual_console; - } else if ($values['section'] === HOME_SCREEN_OTHER || io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) { - $values['data_section'] = get_parameter('data_section'); + } else if ($values['section'] === HOME_SCREEN_OTHER) { + $values['data_section'] = get_parameter('data_section_other'); + } else if (io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) { + $values['data_section'] = get_parameter('data_section_external'); } // $values['section'] = $homeScreenValues[$values['section']]; @@ -722,8 +724,10 @@ if ($update_user) { $values['data_section'] = $dashboard; } else if (io_safe_output($values['section']) === HOME_SCREEN_VISUAL_CONSOLE) { $values['data_section'] = $visual_console; - } else if ($values['section'] === HOME_SCREEN_OTHER || io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) { - $values['data_section'] = get_parameter('data_section'); + } else if ($values['section'] === HOME_SCREEN_OTHER) { + $values['data_section'] = get_parameter('data_section_other'); + } else if (io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) { + $values['data_section'] = get_parameter('data_section_external'); } // $values['section'] = $homeScreenValues[$values['section']]; diff --git a/pandora_console/godmode/users/user_management.php b/pandora_console/godmode/users/user_management.php index 4e90c2d06f..b1212c11ec 100644 --- a/pandora_console/godmode/users/user_management.php +++ b/pandora_console/godmode/users/user_management.php @@ -81,6 +81,11 @@ $customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select( false, 'width: 100%' ); +// Home screen. Visual consoles. +$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%'); +// Home screen. External link and Other. +$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section_external', $user_info['data_section'], '', 60, 255, true); +$customHomeScreenAddition[HOME_SCREEN_OTHER] = html_print_input_text('data_section_other', $user_info['data_section'], '', 60, 255, true); $layouts = visual_map_get_user_layouts($config['id_user'], true); $layouts_aux = []; diff --git a/pandora_console/images/desacoplar-ventana.svg b/pandora_console/images/desacoplar-ventana.svg new file mode 100644 index 0000000000..0b3cbca31d --- /dev/null +++ b/pandora_console/images/desacoplar-ventana.svg @@ -0,0 +1,14 @@ + + + Icons/Dark/20/desacoplar-ventana + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/images/minimizar.svg b/pandora_console/images/minimizar.svg new file mode 100644 index 0000000000..957268b4ea --- /dev/null +++ b/pandora_console/images/minimizar.svg @@ -0,0 +1,7 @@ + + + Icons/Dark/20/minimizar + + + + \ No newline at end of file diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 881ef22f39..0aea4cf37f 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -92,6 +92,7 @@ $get_id_source_event = get_parameter('get_id_source_event'); $node_id = (int) get_parameter('node_id', 0); $settings_modal = get_parameter('settings', 0); $parameters_modal = get_parameter('parameters', 0); +$update_event_custom_id = get_parameter('update_event_custom_id', 0); $draw_events_graph = get_parameter('drawEventsGraph', false); // User private filter. @@ -313,6 +314,7 @@ if ($save_event_filter) { $values['severity'] = implode(',', get_parameter('severity', -1)); $values['status'] = get_parameter('status'); $values['search'] = get_parameter('search'); + $values['regex'] = get_parameter('regex'); $values['not_search'] = get_parameter('not_search'); $values['text_agent'] = get_parameter('text_agent'); $values['id_agent'] = get_parameter('id_agent'); @@ -381,6 +383,7 @@ if ($update_event_filter) { $values['severity'] = implode(',', get_parameter('severity', -1)); $values['status'] = get_parameter('status'); $values['search'] = get_parameter('search'); + $values['regex'] = get_parameter('regex'); $values['not_search'] = get_parameter('not_search'); $values['text_agent'] = get_parameter('text_agent'); $values['id_agent'] = get_parameter('id_agent'); @@ -640,6 +643,8 @@ function load_form_filter() { $("#status").val(val); if (i == 'search') $('#text-search').val(val); + if (i == 'regex') + $('#text-regex').val(val); if (i == 'not_search') $('#checkbox-not_search').val(val); if (i == 'text_agent') @@ -970,6 +975,7 @@ function save_new_filter() { "severity" : $("#severity").val(), "status" : $("#status").val(), "search" : $("#text-search").val(), + "regex" : $('#text-regex').val(), "not_search" : $("#checkbox-not_search").val(), "text_agent" : $("#text_id_agent").val(), "id_agent" : $('input:hidden[name=id_agent]').val(), @@ -1050,6 +1056,7 @@ function save_update_filter() { "severity" : $("#severity").val(), "status" : $("#status").val(), "search" : $("#text-search").val(), + "regex" : $('#text-regex').val(), "not_search" : $("#checkbox-not_search").val(), "text_agent" : $("#text_id_agent").val(), "id_agent" : $('input:hidden[name=id_agent]').val(), @@ -2644,6 +2651,8 @@ if ($get_events_fired) { $filter['date_to'] = date('Y-m-d', $end); $filter['time_from'] = date('H:i:s', $start); $filter['time_to'] = date('H:i:s', $end); + $filter['severity'] = explode(',', $filter['severity']); + $data = events_get_all( ['te.*'], $filter @@ -2754,6 +2763,52 @@ if ($draw_row_response_info === true) { return; } +if ($update_event_custom_id) { + $event_custom_id = get_parameter('event_custom_id'); + $event_id = get_parameter('event_id'); + $server_id = 0; + if (is_metaconsole() === true) { + $server_id = (int) get_parameter('server_id'); + } + + // Safe custom fields for hacks. + if (preg_match('/script/i', io_safe_output($event_custom_id))) { + $return = false; + } else { + try { + if (is_metaconsole() === true + && $server_id > 0 + ) { + $node = new Node($server_id); + $node->connect(); + } + + $return = events_event_custom_id( + $event_id, + $event_custom_id + ); + } catch (\Exception $e) { + // Unexistent agent. + if (is_metaconsole() === true + && $server_id > 0 + ) { + $node->disconnect(); + } + + $return = false; + } finally { + if (is_metaconsole() === true + && $server_id > 0 + ) { + $node->disconnect(); + } + } + } + + echo ($return === true) ? 'update_ok' : 'update_error'; + return; +} + if ((bool) $draw_events_graph === true) { $filter = get_parameter('filter'); $output = event_print_graph($filter); diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index f3e6627388..e4eba79858 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -35,6 +35,7 @@ if (check_login()) { include_once $config['homedir'].'/include/functions_agents.php'; include_once $config['homedir'].'/include/functions_modules.php'; include_once $config['homedir'].'/include/functions_ui.php'; + include_once $config['homedir'].'/include/functions_macros.php'; enterprise_include_once('include/functions_metaconsole.php'); $get_plugin_macros = get_parameter('get_plugin_macros'); @@ -1206,7 +1207,23 @@ if (check_login()) { ); if (strlen($module['ip_target']) !== 0) { - $title .= '
IP: '.$module['ip_target']; + // Check if value is custom field. + if ($module['ip_target'][0] == '_' && $module['ip_target'][(strlen($module['ip_target']) - 1)] == '_') { + $custom_field_name = substr($module['ip_target'], 1, -1); + $custom_value = agents_get_agent_custom_field($id_agente, $custom_field_name); + if (isset($custom_value) && $custom_value !== false) { + $title .= '
IP: '.$custom_value; + } else { + $array_macros = return_agent_macros($id_agente); + if (isset($array_macros[$module['ip_target']])) { + $title .= '
IP: '.$array_macros[$module['ip_target']]; + } else { + $title .= '
IP: '.$module['ip_target']; + } + } + } else { + $title .= '
IP: '.$module['ip_target']; + } } $last_status_change_text = __('Time elapsed since last status change: '); diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 154d611bb8..31098225e7 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -2404,13 +2404,17 @@ class ConsoleSupervisor { global $config; include_once $config['homedir'].'/include/functions_update_manager.php'; - + $server_name = db_get_value_filter( + 'name', + 'tserver', + [ 'server_type' => '1' ] + ); if (update_manager_verify_api() === false) { $this->notify( [ 'type' => 'NOTIF.API.ACCESS', 'title' => __('Cannot access the Pandora FMS API '), - 'message' => __('Please check the configuration, some components may fail due to this misconfiguration.'), + 'message' => __('Please check the configuration, some components may fail due to this misconfiguration in '.$server_name.' ('.$config['public_url'].')'), ] ); } else { diff --git a/pandora_console/include/class/Diagnostics.class.php b/pandora_console/include/class/Diagnostics.class.php index aa5d5995af..ea3caaf276 100644 --- a/pandora_console/include/class/Diagnostics.class.php +++ b/pandora_console/include/class/Diagnostics.class.php @@ -737,7 +737,7 @@ class Diagnostics extends Wizard $cpuModelName = 'cat /proc/cpuinfo | grep "model name" | tail -1 | cut -f 2 -d ":"'; $cpuProcessor = 'cat /proc/cpuinfo | grep "processor" | wc -l'; $ramMemTotal = 'cat /proc/meminfo | grep "MemTotal"'; - + $distroInfo = 'cat /etc/os-release | grep "PRETTY_NAME" | cut -f 2 -d "="'; exec( "ifconfig | awk '{ print $2}' | grep -E -o '([0-9]{1,3}[\.]){3}[0-9]{1,3}'", $output @@ -756,6 +756,10 @@ class Diagnostics extends Wizard 'name' => __('RAM'), 'value' => exec($ramMemTotal), ], + 'distroInfo' => [ + 'name' => __('Distro'), + 'value' => str_replace('"', '', exec($distroInfo)), + ], 'osInfo' => [ 'name' => __('Os'), 'value' => exec('uname -a'), diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 317a84b39f..5c60ea7ced 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 = 'PC231129'; +$build_version = 'PC231201'; $pandora_version = 'v7.0NG.774'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 3d67118346..1ad9a39995 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1006,6 +1006,70 @@ function get_parameter($name, $default='') } +function get_parameter_date($name, $default='', $date_format='Y/m/d') +{ + $date_end = get_parameter('date_end', 0); + $time_end = get_parameter('time_end'); + $datetime_end = strtotime($date_end.' '.$time_end); + + $custom_date = get_parameter('custom_date', 0); + $range = get_parameter('range', SECONDS_1DAY); + $date_text = get_parameter('range_text', SECONDS_1DAY); + $date_init_less = (strtotime(date('Y/m/d')) - SECONDS_1DAY); + $date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less)); + $time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less)); + $datetime_init = strtotime($date_init.' '.$time_init); + if ($custom_date === '1') { + if ($datetime_init >= $datetime_end) { + $datetime_init = $date_init_less; + } + + $date_init = date('Y/m/d H:i:s', $datetime_init); + $date_end = date('Y/m/d H:i:s', $datetime_end); + $period = ($datetime_end - $datetime_init); + } else if ($custom_date === '2') { + $date_units = get_parameter('range_units'); + $date_end = date('Y/m/d H:i:s'); + $date_init = date('Y/m/d H:i:s', (strtotime($date_end) - ((int) $date_text * (int) $date_units))); + $period = (strtotime($date_end) - strtotime($date_init)); + } else if (in_array($range, ['this_week', 'this_month', 'past_week', 'past_month'])) { + if ($range === 'this_week') { + $monday = date('Y/m/d', strtotime('last monday')); + + $sunday = date('Y/m/d', strtotime($monday.' +6 days')); + $period = (strtotime($sunday) - strtotime($monday)); + $date_init = $monday; + $date_end = $sunday; + } else if ($range === 'this_month') { + $date_end = date('Y/m/d', strtotime('last day of this month')); + $first_of_month = date('Y/m/d', strtotime('first day of this month')); + $date_init = $first_of_month; + $period = (strtotime($date_end) - strtotime($first_of_month)); + } else if ($range === 'past_month') { + $date_end = date('Y/m/d', strtotime('last day of previous month')); + $first_of_month = date('Y/m/d', strtotime('first day of previous month')); + $date_init = $first_of_month; + $period = (strtotime($date_end) - strtotime($first_of_month)); + } else if ($range === 'past_week') { + $date_end = date('Y/m/d', strtotime('sunday', strtotime('last week'))); + $first_of_week = date('Y/m/d', strtotime('monday', strtotime('last week'))); + $date_init = $first_of_week; + $period = (strtotime($date_end) - strtotime($first_of_week)); + } + } else { + $date_end = date('Y/m/d H:i:s'); + $date_init = date('Y/m/d H:i:s', (strtotime($date_end) - $range)); + $period = (strtotime($date_end) - strtotime($date_init)); + } + + return [ + 'date_init' => date($date_format, strtotime($date_init)), + 'date_end' => date($date_format, strtotime($date_end)), + 'period' => $period, + ]; +} + + /** * Get a parameter from a get request. * diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 195b509106..2d6803ccd4 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -4752,7 +4752,7 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent) $secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]); $secondaryLinks = []; if (empty($secondary_groups['for_select']) === true) { - $secondaryLinks[] = ''.__('N/A').''; + $secondaryLinks = []; } else { foreach ($secondary_groups['for_select'] as $id => $name) { $secondaryLinks[] = html_print_anchor( @@ -4811,22 +4811,22 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent) 'content' => groups_get_name($agent['id_grupo']), ], true - ); + ).' '.ui_print_group_icon($agent['id_grupo'], true, '', 'margin-left: 2%;', true, false, false, '', true); $table_contact->data[] = $data; // Secondary groups. $data = []; - $data[0] = ''.__('Secondary groups').''; - $data[1] = implode(', ', $secondaryLinks); - $table_contact->data[] = $data; + if (!empty($secondaryLinks) === true) { + $data[0] = ''.__('Secondary groups').''; + $data[1] = implode(', ', $secondaryLinks); + $table_contact->data[] = $data; + } // Parent agent line. if (enterprise_installed() === true) { - $data = []; - $data[0] = ''.__('Parent').''; - if ((int) $agent['id_parent'] === 0) { - $data[1] = ''.__('N/A').''; - } else { + if ((int) $agent['id_parent'] !== 0) { + $data = []; + $data[0] = ''.__('Parent').''; $data[1] = html_print_anchor( [ 'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_parent'], @@ -4834,9 +4834,9 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent) ], true ); - } - $table_contact->data[] = $data; + $table_contact->data[] = $data; + } } // Last status change line. @@ -4845,6 +4845,44 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent) $data[1] = $time_elapsed; $table_contact->data[] = $data; + $has_remote_conf = enterprise_hook( + 'config_agents_has_remote_configuration', + [$agent['id_agente']] + ); + + if ((bool) $has_remote_conf) { + $data = []; + $data[0] = __('Remote configuration'); + $data[1] = ''.__('Enabled').''; + $data[1] .= html_print_menu_button( + [ + 'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$agent['id_agente'].'&disk_conf=1'), + 'image' => 'images/remote-configuration@svg.svg', + 'title' => __('Edit remote config'), + ], + true + ); + + $satellite_server = (int) db_get_value_filter( + 'satellite_server', + 'tagente', + ['id_agente' => $id_agente] + ); + + if (empty($satellite_server) === false) { + $satellite_name = db_get_value_filter( + 'name', + 'tserver', + ['id_server' => $satellite_server] + ); + + $data[0] = __('Satellite server'); + $data[1] = $satellite_name; + } + + $table_contact->data[] = $data; + } + if (enterprise_installed() === true) { // SecurityMon line. $id_module_group = db_get_value('id_mg', 'tmodule_group', 'name', 'Security'); @@ -4887,6 +4925,43 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent) } } + // Optional data + // Position Information. + if ((bool) $config['activate_gis'] === true) { + $data = []; + + $dataPositionAgent = gis_get_data_last_position_agent( + $agent['id_agente'] + ); + if (is_array($dataPositionAgent) === true && $dataPositionAgent['stored_longitude'] !== '' && $dataPositionAgent['stored_latitude'] !== '') { + $data[0] = __('Position (Long, Lat)'); + + $dataOptionalOutput = html_print_anchor( + [ + 'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente='.$id_agente, + 'content' => $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude'], + ], + true + ); + + if (empty($dataPositionAgent['description']) === false) { + $dataOptionalOutput .= ' ('.$dataPositionAgent['description'].')'; + } + + $data[1] = $dataOptionalOutput; + } + + $table_contact->data[] = $data; + } + + // Timezone Offset. + if ((int) $agent['timezone_offset'] !== 0) { + $data = []; + $data[0] = __('Timezone Offset'); + $data[1] = $agent['timezone_offset']; + $table_contact->data[] = $data; + } + $agent_contact = html_print_div( [ 'class' => 'agent_details_header', diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 210b933328..2381d51ad6 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -13132,7 +13132,7 @@ function api_set_create_event($id, $trash1, $other, $returnType) if ($other['data'][18] != '') { $values['id_extra'] = $other['data'][18]; - $sql_validation = 'SELECT id_evento,estado,ack_utimestamp,id_usuario + $sql_validation = 'SELECT id_evento,estado,ack_utimestamp,id_usuario,event_custom_id FROM tevento WHERE estado IN (0,2) AND id_extra ="'.$other['data'][18].'";'; @@ -13147,6 +13147,7 @@ function api_set_create_event($id, $trash1, $other, $returnType) $values['status'] = 2; $ack_utimestamp = $val['ack_utimestamp']; $values['id_usuario'] = $val['id_usuario']; + $values['event_custom_id'] = $val['event_custom_id']; } api_set_validate_event_by_id($val['id_evento']); @@ -13177,7 +13178,8 @@ function api_set_create_event($id, $trash1, $other, $returnType) $custom_data, $values['server_id'], $values['id_extra'], - $ack_utimestamp + $ack_utimestamp, + $values['event_custom_id'] ?? null ); if ($other['data'][12] != '') { @@ -17787,6 +17789,48 @@ function api_token_check(string $token) } +/** + * Set custom field value in tevento + * + * @param mixed $id_event Event id. + * @param mixed $custom_field Custom field to set. + * @return void + */ +function api_set_event_custom_id($id, $value) +{ + // Get the event + $event = events_get_event($id, false, is_metaconsole()); + // If event not exists, end the execution. + if ($event === false) { + returnError( + 'event_not_exists', + 'Event not exists' + ); + $result = false; + } + + // Safe custom fields for hacks. + if (preg_match('/script/i', io_safe_output($value))) { + $result = false; + } + + $result = events_event_custom_id( + $id, + $value + ); + + // If update results failed + if (empty($result) === true || $result === false) { + returnError( + 'The event could not be updated' + ); + return false; + } else { + returnData('string', ['data' => 'Event updated.']); + } +} + + /** * Extract info Agents for inventories ITSM. * diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index bfdd131748..e47e84adeb 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -249,10 +249,6 @@ function config_update_config() $error_update[] = __('Enable Netflow'); } - if (config_update_value('activate_sflow', (bool) get_parameter('activate_sflow'), true) === false) { - $error_update[] = __('Enable Sflow'); - } - if (config_update_value('activate_feedback', (bool) get_parameter('activate_feedback'), true) === false) { $error_update[] = __('Enable Feedback'); } @@ -371,6 +367,10 @@ function config_update_config() $error_update[] = __('show_experimental_features'); } + if (config_update_value('number_modules_queue', get_parameter('number_modules_queue'), true) === false) { + $error_update[] = __('number_modules_queue'); + } + if (config_update_value('console_log_enabled', get_parameter('console_log_enabled'), true) === false) { $error_update[] = __('Console log enabled'); } @@ -1619,6 +1619,10 @@ function config_update_config() if (config_update_value('netflow_get_ip_hostname', (int) get_parameter('netflow_get_ip_hostname'), true) === false) { $error_update[] = __('Name resolution for IP address'); } + + if (config_update_value('activate_sflow', (bool) get_parameter('activate_sflow'), true) === false) { + $error_update[] = __('Enable Sflow'); + } break; case 'sflow': @@ -2441,6 +2445,10 @@ function config_process_config() config_update_value('show_experimental_features', 0); } + if (!isset($config['number_modules_queue'])) { + config_update_value('number_modules_queue', 500); + } + if (!isset($config['agent_vulnerabilities'])) { config_update_value('agent_vulnerabilities', 1); } diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 2a91641315..013698b33d 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -219,6 +219,7 @@ function events_get_all_fields() $columns['module_status'] = __('Module status'); $columns['module_custom_id'] = __('Module custom id'); $columns['custom_data'] = __('Custom data'); + $columns['event_custom_id'] = __('Event Custom ID'); return $columns; } @@ -322,6 +323,9 @@ function events_get_column_name($field, $table_alias=false) case 'custom_data': return __('Custom data'); + case 'event_custom_id': + return __('Event Custom ID'); + default: return __($field); } @@ -2356,7 +2360,8 @@ function events_create_event( $custom_data='', $server_id=0, $id_extra='', - $ack_utimestamp=0 + $ack_utimestamp=0, + $event_custom_id=null ) { if ($source === false) { $source = get_product_name(); @@ -2388,6 +2393,7 @@ function events_create_event( 'custom_data' => $custom_data, 'data' => '', 'module_status' => 0, + 'event_custom_id' => $event_custom_id, ]; return (int) db_process_sql_insert('tevento', $values); @@ -2611,7 +2617,6 @@ function events_print_type_img( $urlImage = ui_get_full_url(false); $icon = ''; $style = 'main_menu_icon'; - switch ($type) { case 'alert_recovered': $icon = 'images/alert_recovered@svg.svg'; @@ -2677,16 +2682,6 @@ function events_print_type_img( if ($only_url) { $output = $urlImage.'/'.$icon; } else { - /* - $output .= html_print_div( - [ - 'title' => events_print_type_description($type, true), - 'class' => $style, - 'style' => ((empty($icon) === false) ? 'background-image: url('.$icon.'); background-repeat: no-repeat;' : ''), - ], - true - ); - */ $output .= html_print_image( $icon, true, @@ -4658,6 +4653,30 @@ function events_page_details($event, $server_id=0) $data[1] = ''.__('N/A').''; } + $table_details->data[] = $data; + $readonly = true; + if (check_acl($config['id_user'], 0, 'EW')) { + $readonly = false; + } + + $data = []; + $data[0] = __('Event Custom ID'); + $data[1] = '
'.html_print_input_text('event_custom_id', $event['event_custom_id'], '', false, 255, true, $readonly, false, '', 'w60p'); + if ($readonly === false) { + $data[1] .= html_print_button( + __('Update'), + 'update_event_custom_id', + false, + 'update_event_custom_id('.$event['id_evento'].', '.$event['server_id'].');', + [ + 'icon' => 'next', + 'mode' => 'link', + ], + true + ); + } + + $data[1] .= '
'; $table_details->data[] = $data; $details = '
'.html_print_table($table_details, true).'
'; @@ -6260,6 +6279,63 @@ function event_get_counter_extraId(array $event, ?array $filters) } +/** + * Update event detail custom field + * + * @param mixed $id_event Event ID or array of events. + * @param string $event_custom_id Event custom ID to be update. + * + * @return boolean Whether or not it was successful + */ +function events_event_custom_id( + $id_event, + $event_custom_id, +) { + global $config; + // Cleans up the selection for all unwanted values also casts any single + // values as an array. + if (![$id_event]) { + $id_event = (array) safe_int($id_event, 1); + } + + // Check ACL. + foreach ($id_event as $k => $id) { + $event_group = events_get_group($id); + if (check_acl($config['id_user'], $event_group, 'EW') == 0) { + db_pandora_audit( + AUDIT_LOG_ACL_VIOLATION, + 'Attempted updating event #'.$id + ); + + unset($id_event[$k]); + } + } + + if (empty($id_event) === true) { + return false; + } + + // Get the current event comments. + $first_event = $id_event; + if (is_array($id_event) === true) { + $first_event = reset($id_event); + } + + // Update comment. + $ret = db_process_sql_update( + 'tevento', + ['event_custom_id' => $event_custom_id], + ['id_evento' => $first_event] + ); + + if (($ret === false) || ($ret === 0)) { + return false; + } + + return true; +} + + function event_print_graph( $filter, $graph_height=100, diff --git a/pandora_console/include/functions_macros.php b/pandora_console/include/functions_macros.php new file mode 100644 index 0000000000..bba0bd1898 --- /dev/null +++ b/pandora_console/include/functions_macros.php @@ -0,0 +1,61 @@ + ($agente['nombre']) ?: '', + '_agentalias_' => ($agente['alias']) ?: '', + '_agent_' => ($agente['alias']) ?: (($agente['nombre']) ?: ''), + '_agentcustomid_' => ($agente['custom_id']) ?: '', + '_agentdescription_' => ($agente['comentarios']) ?: '', + '_agentgroup_' => ($grupo['nombre']) ?: '', + '_agentos_' => ($agente['id_os']) ?: '', + '_address_' => ($agente['direccion']) ?: '', + '_homeurl_' => ($config['public_url']) ?: '', + '_groupcontact_' => ($agente['contact']) ?: '', + '_groupcustomid_' => ($agente['custom_id']) ?: '', + '_groupother_' => ($agente['other']) ?: '', + '_server_ip_' => ($server_ip) ?: '', + '_server_name_' => ($agente['server_name']) ?: '', + ]; + + return $array_macros; +} diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index 346dee04b5..1df84f6025 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -1170,6 +1170,14 @@ if (is_ajax()) {

'.$sys_info->data->ramInfo->value.'

+ + +

'.$sys_info->data->distroInfo->name.'

+ + +

'.$sys_info->data->distroInfo->value.'

+ +

'.$sys_info->data->osInfo->name.'

diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 23e0c87514..dce7dd9efc 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -13698,38 +13698,47 @@ function reporting_tiny_stats( } if ($modern === true) { - $out .= '
'; if (isset($fired_count) && $fired_count > 0) { + $out .= '
'; $out .= '
'; $out .= ''.$fired_count.'
'; + $out .= '
'; } if (isset($critical_count) && $critical_count > 0) { + $out .= '
'; $out .= '
'; $out .= ''.$critical_count.'
'; + $out .= '
'; } if (isset($warning_count) && $warning_count > 0) { + $out .= '
'; $out .= '
'; $out .= ''.$warning_count.'
'; + $out .= '
'; } if (isset($unknown_count) && $unknown_count > 0) { + $out .= '
'; $out .= '
'; $out .= ''.$unknown_count.'
'; + $out .= '
'; } if (isset($not_init_count) && $not_init_count > 0) { + $out .= '
'; $out .= '
'; $out .= ''.$not_init_count.'
'; + $out .= '
'; } if (isset($normal_count) && $normal_count > 0) { + $out .= '
'; $out .= '
'; $out .= ''.$normal_count.'
'; + $out .= '
'; } - - $out .= '
'; } else { // Classic ones. $out .= ''.$total_count.''; diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 577ac7a30c..1a59ab50e8 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -1653,6 +1653,10 @@ function paint_graph_status( max_c = 0; } + // Remove Error class. + $("#text-max_warning").removeClass("input_error"); + $("#text-max_critical").removeClass("input_error"); + //if haven't errors if (error_w == 0 && error_c == 0) { //parse element @@ -1958,6 +1962,9 @@ function paint_graph_status( .html(message_error_critical) .style("text-anchor", "first"); } + if (error_c == 2) { + $("#text-max_critical").addClass("input_error"); + } } } diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index ed6adf6301..65ea9f2a75 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -492,6 +492,37 @@ function event_comment(current_event) { return false; } +// Save custom_field into an event. +function update_event_custom_id(event_id, server_id) { + var event_custom_id = $("#text-event_custom_id").val(); + + var params = { + page: "include/ajax/events", + update_event_custom_id: 1, + event_custom_id: event_custom_id, + event_id: event_id, + server_id: server_id + }; + + $("#button-update_custom_field").attr("disabled", "disabled"); + $("#response_loading").show(); + + jQuery.ajax({ + data: params, + type: "POST", + url: getUrlAjax(), + dataType: "html", + success: function(data) { + if (data === "update_error") { + alert("Event Custom ID not valid"); + } + $("#button-update_custom_field").removeAttr("disabled"); + $("#response_loading").hide(); + $("#button-events_form_search_bt").trigger("click"); + } + }); +} + var processed = 0; function update_event(table, id_evento, type, event_rep, row, server_id) { var inputs = $("#events_form :input"); @@ -1004,6 +1035,7 @@ function openSoundEventsDialog(settings, dialog_parameters, reload) { modal: false, width: 600, height: 600, + dialogClass: "modal-sound", open: function() { $.ajax({ method: "post", @@ -1064,10 +1096,10 @@ function openSoundEventsDialog(settings, dialog_parameters, reload) { if (reload == false && dialog_parameters != undefined) { if ($("#button-start-search").hasClass("play")) { - $("#filter_id").val(dialog_parameters["filter_id"]); - $("#interval").val(dialog_parameters["interval"]); - $("#time_sound").val(dialog_parameters["time_sound"]); - $("#sound_id").val(dialog_parameters["sound_id"]); + $("#filter_id").val(dialog_parameters.filter_id); + $("#interval").val(dialog_parameters.interval); + $("#time_sound").val(dialog_parameters.time_sound); + $("#sound_id").val(dialog_parameters.sound_id); $("#filter_id").trigger("change"); $("#interval").trigger("change"); @@ -1124,14 +1156,15 @@ function openSoundEventsDialog(settings, dialog_parameters, reload) { } function openSoundEventModal(settings) { + var win = ""; if ($("#hidden-metaconsole_activated").val() === "1") { - var win = open( + win = open( "../../operation/events/sound_events.php", "day_123", "width=600,height=500" ); } else { - var win = open( + win = open( "operation/events/sound_events.php", "day_123", "width=600,height=500" @@ -1502,11 +1535,6 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) { typeof requestBody.includes === "function" && requestBody.includes("drawConsoleSound=1") ) { - console.log( - "AJAX request sent with drawConsoleSound=1:", - ajaxOptions.url - ); - // Find the dialog element by the aria-describedby attribute var dialog = $('[aria-describedby="modal-sound"]'); @@ -1516,62 +1544,32 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) { // Add the minimize button before the close button var minimizeButton = $("