diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index aa5eedaa03..b2ed508ab3 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.759-220105 +Version: 7.0NG.759-220113 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 07feacaab3..88eef55d92 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.759-220105" +pandora_version="7.0NG.759-220113" 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 0bd21f041a..bee6aafd05 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1015,7 +1015,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.759'; -use constant AGENT_BUILD => '220105'; +use constant AGENT_BUILD => '220113'; # 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 933a922ca7..d6c5fcbb89 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.759 -%define release 220105 +%define release 220113 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 ec54f4dc77..ad32404e80 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.759 -%define release 220105 +%define release 220113 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 abacbae420..7c0718478a 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.759" -PI_BUILD="220105" +PI_BUILD="220113" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index aa101df1a3..6841bbb5bb 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{220105} +{220113} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index abd4819381..72e0c91c84 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.759 Build 220105") +#define PANDORA_VERSION ("7.0NG.759 Build 220113") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 9896187251..fc3fe4ac49 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.759(Build 220105))" + VALUE "ProductVersion", "(7.0NG.759(Build 220113))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 8f84afe6ea..4b0d8190ca 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.759-220105 +Version: 7.0NG.759-220113 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 81f68cb86a..9e31575c18 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.759-220105" +pandora_version="7.0NG.759-220113" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/delete_files/delete_files.txt b/pandora_console/extras/delete_files/delete_files.txt index a809818909..f5db52a42a 100644 --- a/pandora_console/extras/delete_files/delete_files.txt +++ b/pandora_console/extras/delete_files/delete_files.txt @@ -115,4 +115,6 @@ enterprise/include/styles/tooltipster.bundle.min.css mobile/include/javascript/jquery.mobile-1.3.1.js mobile/include/style/jquery.mobile-1.3.1.css godmode/alerts/configure_alert_special_days.php -godmode/admin_access_logs.php \ No newline at end of file +godmode/admin_access_logs.php +enterprise/extensions/backup/main.php +enterprise/extensions/backup.php \ No newline at end of file diff --git a/pandora_console/extras/mr/52.sql b/pandora_console/extras/mr/52.sql index 81f1436632..d2d5e1be65 100644 --- a/pandora_console/extras/mr/52.sql +++ b/pandora_console/extras/mr/52.sql @@ -1,5 +1,5 @@ START TRANSACTION; ALTER TABLE `tpolicy_queue` MODIFY COLUMN `progress` int(10) NOT NULL default '0'; - +CREATE INDEX `IDX_tservice_element` ON `tservice_element`(`id_service`,`id_agente_modulo`); COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 6f3596cfa3..53cfa31ecb 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -480,7 +480,8 @@ CREATE TABLE IF NOT EXISTS `tservice_element` ( `id_agent` int(10) unsigned NOT NULL default 0, `id_service_child` int(10) unsigned NOT NULL default 0, `id_server_meta` int(10) unsigned NOT NULL default 0, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + INDEX `IDX_tservice_element` (`id_service`,`id_agente_modulo`) ) ENGINE=InnoDB COMMENT = 'Table to define the modules and the weights of the modules that define a service' DEFAULT CHARSET=utf8; diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 1c338abda1..7965dbc566 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -2428,7 +2428,7 @@ switch ($tab) { var aget_id_os = ''; - if('' != $('#text-name').val() && + if('' != $('#text-name').val() && '' == 19){ event.preventDefault(); @@ -2462,7 +2462,7 @@ switch ($tab) { var module_type_snmp = ''; - if('' != $('#text-name').val() && ( + if('' != $('#text-name').val() && ( module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){ event.preventDefault(); diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index 43cb69b74f..616777ad6e 100644 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -628,20 +628,20 @@ $table->data[5][1] = "
tag for show code. + * For debug purposes, see for `hd()` function. + * + * @param string $content Content of tag. + * @param boolean $return Return the tag string formed. + * @param array $attributes Attributes availables for pre tags. + * + * @return string + */ +function html_print_code( + string $content, + bool $return=true, + array $attributes=[] +) { + $output = '$value) { + $output .= ' '.$attribute.'="'.io_safe_input_html($value).'"'; + } + } + + $output .= sprintf('>%s', $content); + + if ($return === true) { + return $output; + } else { + echo $output; + } +} + + /** * Render an anchor html element. * diff --git a/pandora_console/include/functions_io.php b/pandora_console/include/functions_io.php index 853fbb330a..f11c49a939 100755 --- a/pandora_console/include/functions_io.php +++ b/pandora_console/include/functions_io.php @@ -545,11 +545,12 @@ function io_input_password($password) * Process the given password read from the Pandora FMS Database, * decrypting it if necessary. * - * @param string password Password read from the DB. + * @param string $password Password read from the DB. + * @param string $wrappedBy Wrap the password with the informed character. * * @return string The processed password. */ -function io_output_password($password) +function io_output_password($password, $wrappedBy='') { global $config; @@ -562,11 +563,14 @@ function io_output_password($password) ] ); - if ($plaintext === ENTERPRISE_NOT_HOOK) { - return io_safe_output($password); - } + $output = ($plaintext === ENTERPRISE_NOT_HOOK) ? $password : $plaintext; - return io_safe_output($plaintext); + return sprintf( + '%s%s%s', + $wrappedBy, + io_safe_output($output), + $wrappedBy + ); } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 8caca733a5..63e39a652a 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -8775,6 +8775,8 @@ function reporting_increment($report, $content) $return['data'] = []; + $search_in_history_db = db_search_in_history_db($return['from']); + if (is_metaconsole()) { $sql1 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC'; @@ -8801,17 +8803,23 @@ function reporting_increment($report, $content) $connection = false; } - $old_data = db_get_value_sql($sql1); + $old_data = db_get_value_sql($sql1, false, $search_in_history_db); - $last_data = db_get_value_sql($sql2); + $last_data = db_get_value_sql($sql2, false, $search_in_history_db); } } else { $old_data = db_get_value_sql( 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' - AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC' + AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC', + false, + $search_in_history_db ); - $last_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC'); + $last_data = db_get_value_sql( + 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC', + false, + $search_in_history_db + ); } if (!is_metaconsole()) { diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php index 4f405efb00..cf61fec7a7 100644 --- a/pandora_console/include/functions_servers.php +++ b/pandora_console/include/functions_servers.php @@ -1347,7 +1347,16 @@ function servers_get_server_string_name(int $server) return __('WUX server'); case SERVER_TYPE_ENTERPRISE_SATELLITE: - return __('Satellite'); + return __('Satellite server'); + + case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL: + return __('Transactional server'); + + case SERVER_TYPE_ALERT: + return __('Alert server'); + + case SERVER_TYPE_NCM: + return __('NCM server'); default: return __('N/A'); diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index f553fac7d0..f05d0de6e2 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -3420,7 +3420,7 @@ function visual_map_get_status_element($layoutData) break; case GROUP_ITEM: - $group_status = groups_get_status($layoutData['id_group']); + $group_status = groups_get_status($layoutData['id_group'], true); switch ($group_status) { case AGENT_STATUS_ALERT_FIRED: diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 6bd2782d3c..13e72bdaca 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -437,25 +437,23 @@ function pandoraFlotHBars( var format = new Array(); for (var i = 0; i < labels_total.length; i++) { var label = labels_total[i][1]; - // var shortLabel = reduceText(label, 25); - var title = label; - if (label.length > 30) { - label = reduceText(label, 30); - } var div_attributes = 'style="font-size:' + font_size + "pt !important;" + - " margin: 0; max-width: 150px;" + - "margin-right:5px"; - +"margin-left: -1.5em"; - +"text-align: right"; + "margin: 0; max-width: 200px;" + + "margin-right:5px;" + + "margin-left: -1.5em" + + "text-align: right" + + "text-overflow: ellipsis;" + + "overflow: hidden;" + + "white-space: pre;"; if (label.indexOf("
") != -1) { div_attributes += "min-height: 2.5em;"; } - div_attributes += '" title="' + title + '" style="overflow: hidden;"'; + div_attributes += '" title="' + label + '" style="overflow: hidden;"'; format.push([i, "" + label + ""]); } @@ -3270,5 +3268,6 @@ function reduceText(text, maxLength) { if (text.length <= maxLength) return text; var firstSlideEnd = parseInt((maxLength - 3) / 1.6); var str_cut = text.substr(0, firstSlideEnd); - return str_cut + "...
" + text.substr(-firstSlideEnd - 3); + //return str_cut + "...
" + text.substr(-firstSlideEnd - 3); + return str_cut + "..." + text.substr(-firstSlideEnd - 3); } diff --git a/pandora_console/include/javascript/pandora_dashboards.js b/pandora_console/include/javascript/pandora_dashboards.js index a3cc3b24fc..e223e485d2 100644 --- a/pandora_console/include/javascript/pandora_dashboards.js +++ b/pandora_console/include/javascript/pandora_dashboards.js @@ -389,7 +389,7 @@ function initialiceLayout(data) { widgetId: widgetId }, width: widgetId == 14 || widgetId == 2 || widgetId == 23 ? 750 : 450, - maxHeight: 600, + maxHeight: 610, minHeight: 400 }, onsubmit: { diff --git a/pandora_console/include/javascript/tree/TreeController.js b/pandora_console/include/javascript/tree/TreeController.js index 461066abbc..afa55434c0 100644 --- a/pandora_console/include/javascript/tree/TreeController.js +++ b/pandora_console/include/javascript/tree/TreeController.js @@ -976,6 +976,11 @@ var TreeController = { "" ); + // Avoiding 'undefined' text. + if (typeof element.value === "undefined") { + element.value = ""; + } + // Value. $content.append( '' + element.value + "" diff --git a/pandora_console/include/lib/Dashboard/Widgets/maps_status.php b/pandora_console/include/lib/Dashboard/Widgets/maps_status.php index 34e28dd8f1..2f59a29f0a 100755 --- a/pandora_console/include/lib/Dashboard/Widgets/maps_status.php +++ b/pandora_console/include/lib/Dashboard/Widgets/maps_status.php @@ -323,11 +323,22 @@ class MapsStatusWidget extends Widget $data = []; $url = $config['homeurl']; - $url .= 'index.php?sec=visualc'; - $url .= '&sec2=operation/visual_console/render_view&refr=60'; + if (\is_metaconsole() === true) { + $url .= sprintf( + 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&refr=%s&id_visualmap=%s', + $config['vc_refr'], + $id_layout + ); + } else { + $url .= sprintf( + 'index.php?sec=visualc&sec2=operation/visual_console/render_view&refr=%s&id=%s', + $config['vc_refr'], + $id_layout + ); + } // This will give us the group name. - $data[0] = ''; + $data[0] = ''; $data[0] .= $user_layouts[$id_layout]['name']; $data[0] .= ''; diff --git a/pandora_console/include/lib/Dashboard/Widgets/network_map.php b/pandora_console/include/lib/Dashboard/Widgets/network_map.php index ee01c9a83c..c07e09758f 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/network_map.php +++ b/pandora_console/include/lib/Dashboard/Widgets/network_map.php @@ -253,6 +253,14 @@ class NetworkMapWidget extends Widget // Retrieve global - common inputs. $inputs = parent::getFormInputs(); + $inputs[] = [ + 'label' => \ui_print_info_message( + __('It is recommended to have only one such widget in the control panel.'), + '', + true + ), + ]; + // Default values. if (isset($values['xOffset']) === false) { $values['xOffset'] = 0; diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n.php b/pandora_console/include/lib/Dashboard/Widgets/top_n.php index 446f15af21..24845cec87 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/top_n.php +++ b/pandora_console/include/lib/Dashboard/Widgets/top_n.php @@ -455,6 +455,7 @@ class TopNWidget extends Widget $data_hbar = []; foreach ($modules as $module) { + $module['aliasAgent'] = ui_print_truncate_text($module['aliasAgent'], 20); $item_name = ''; $item_name = $module['aliasAgent'].' - '.$module['nameModule']; $data_hbar[$item_name]['g'] = $module[$display]; diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php b/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php index 885721cda6..286d766c14 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php @@ -346,9 +346,7 @@ final class Group extends Item $countStatus = \db_get_row_sql($sql); - if ($countStatus['fired'] > 0) { - $status = AGENT_STATUS_ALERT_FIRED; - } else if ($countStatus['critical'] > 0) { + if ($countStatus['critical'] > 0) { $status = AGENT_STATUS_CRITICAL; } else if ($countStatus['warning'] > 0) { $status = AGENT_STATUS_WARNING; @@ -359,7 +357,7 @@ final class Group extends Item } } else { // Get the status img src. - $status = \groups_get_status($groupId); + $status = \groups_get_status($groupId, true); } $imagePath = \visual_map_get_image_status_element($data, $status); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index ca46e46291..5ff90674f4 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -8435,6 +8435,12 @@ div.stat-win-spinner img { font-size: 12px; } +/* For backups dt, can be useful for others */ +#backups_list > thead > tr > th:last-child, +#backups_list > tbody > tr > td:last-child { + text-align: center; +} + /* err_msg_centralised */ div#err_msg_centralised div { margin-top: 1em; diff --git a/pandora_console/index.php b/pandora_console/index.php index b9e3585579..7828b2c700 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -424,6 +424,8 @@ if (! isset($config['id_user'])) { // Process logout. include 'general/logoff.php'; } + + $validatedCSRF = true; } else { // process_user_login is a virtual function which should be defined in each auth file. // It accepts username and password. The rest should be internal to the auth file. diff --git a/pandora_console/install.php b/pandora_console/install.php index 8a49ebdac7..bad3470acd 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@var treeController = TreeController.getController(); - + processTreeSearch(); $("form#tree_search").submit(function(e) { diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 6c93b10a71..0a682d3046 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -186,6 +186,8 @@ if (isset($_GET['modified']) && !$view_mode) { } else { if (!empty($password_new) && !empty($password_confirm)) { $success_msg = __('Password successfully updated'); + } else if ($upd_info['id_skin'] !== $user_info['id_skin']) { + $success_msg = __('Skin successfully updated'); } else { $return = false; $error_msg = __('No changes have been made'); @@ -549,13 +551,13 @@ $table_ichanges = ''.html_print_image( - 'images/darrowright_green.png', - true, - [ - 'id' => 'right_autorefreshlist', - 'alt' => __('Push selected pages into autorefresh list'), - 'title' => __('Push selected pages into autorefresh list'), - ] + 'images/darrowright_green.png', + true, + [ + 'id' => 'right_autorefreshlist', + 'alt' => __('Push selected pages into autorefresh list'), + 'title' => __('Push selected pages into autorefresh list'), + ] ).' '.html_print_image( 'images/darrowleft_green.png', diff --git a/pandora_console/operation/visual_console/view.php b/pandora_console/operation/visual_console/view.php index 33a860ef22..8b51d0a8f6 100644 --- a/pandora_console/operation/visual_console/view.php +++ b/pandora_console/operation/visual_console/view.php @@ -398,6 +398,17 @@ if ($pure === false) { echo ''; if ($aclWrite === true || $aclManage === true) { + if (!is_metaconsole()) { + echo ''.html_print_image( + 'images/target.png', + true, + [ + 'title' => __('Force remote checks'), + 'class' => 'invert_filter', + ] + ).''; + } + echo html_print_checkbox_switch('edit-mode', 1, false, true); } @@ -671,12 +682,14 @@ if ($edit_capable === true) { if ($(this).prop('checked')) { visualConsoleManager.visualConsole.enableEditMode(); visualConsoleManager.changeUpdateInterval(0); + $('#force_check').hide(); $('#edit-controls').css('visibility', ''); } else { visualConsoleManager.visualConsole.disableEditMode(); visualConsoleManager.visualConsole.unSelectItems(); visualConsoleManager.changeUpdateInterval(); // To ms. $('#edit-controls').css('visibility', 'hidden'); + $('#force_check').show(); } }); '; + $.ajax({ + type: "GET", + url: "ajax.php", + dataType: "json", + data: { + page: "include/ajax/visual_console.ajax", + force_remote_check: true, + id_layout: id_layout + }, + success: function (data) { + if (data == 1) { + visualConsoleManager.changeUpdateInterval(5000); + setTimeout(resetInterval, 6000); + } else { + resetInterval(); + } + }, + error: function (data) { + resetInterval(); + } + }); + }); + + function resetInterval() { + visualConsoleManager.changeUpdateInterval(); + } + /** * Process ajax responses and shows a dialog with results. */ diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index d56eb17253..97807397a1 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.759 -%define release 220105 +%define release 220113 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec index 6f0ce7e5c9..3256cbcfd8 100644 --- a/pandora_console/pandora_console.rhel7.spec +++ b/pandora_console/pandora_console.rhel7.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.759 -%define release 220105 +%define release 220113 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index 363f64caed..8a7899ec92 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.759 -%define release 220105 +%define release 220113 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 62cb177d3e..0f766eea65 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -2856,7 +2856,8 @@ CREATE TABLE IF NOT EXISTS `tservice_element` ( `id_service_child` int(10) unsigned NOT NULL default 0, `id_server_meta` int(10) unsigned NOT NULL default 0, `rules` text, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + INDEX `IDX_tservice_element` (`id_service`,`id_agente_modulo`) ) ENGINE=InnoDB COMMENT = 'Table to define the modules and the weights of the modules that define a service' DEFAULT CHARSET=utf8; diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index 475d1951a6..33c12ca9e0 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.759-220105 +Version: 7.0NG.759-220113 Architecture: all Priority: optional Section: admin diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index 59c9eb7e3c..cf3a7e7c27 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/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.759-220105" +pandora_version="7.0NG.759-220113" package_cpan=0 package_pandora=1 diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 7e53d28c39..7dc311915c 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -348,6 +348,9 @@ fsnmp /usr/bin/pandorafsnmp autocreate_group 10 +# Works like autocreate_group, except the name of the group is specified (instead of its id). Do not set both. +#autocreate_group_name Unknown + # If set to 1, new agents will be added to the group specified by autocreate_group (the group specified by the agent will be used as fallback). # If set to 0, new agents will be added to the group specified by the agent (the group specified by autocreate_group will be used as fallback). diff --git a/pandora_server/conf/pandora_server.conf.windows b/pandora_server/conf/pandora_server.conf.windows index 9d953cfa94..0a2717793c 100644 --- a/pandora_server/conf/pandora_server.conf.windows +++ b/pandora_server/conf/pandora_server.conf.windows @@ -274,6 +274,9 @@ dataserver_threads 2 autocreate_group 10 +# Works like autocreate_group, except the name of the group is specified (instead of its id). Do not set both. +#autocreate_group_name Unknown + # If set to 1, new agents will be added to the group specified by autocreate_group (the group specified by the agent will be used as fallback). # If set to 0, new agents will be added to the group specified by the agent (the group specified by autocreate_group will be used as fallback). diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 1c38f4a355..4c20438422 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -46,7 +46,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.759"; -my $pandora_build = "220105"; +my $pandora_build = "220113"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash @@ -398,6 +398,7 @@ sub pandora_load_config { $pa_config->{'autocreate_group'} = -1; $pa_config->{'autocreate_group_force'} = 1; + $pa_config->{'autocreate_group_name'} = ''; $pa_config->{'autocreate'} = 1; # max log size (bytes) @@ -942,6 +943,9 @@ sub pandora_load_config { elsif ($parametro =~ m/^autocreate_group_force\s+([0-1])/i) { $pa_config->{'autocreate_group_force'}= clean_blank($1); } + elsif ($parametro =~ m/^autocreate_group_name\s(.*)/i) { + $pa_config->{'autocreate_group_name'}= clean_blank($1); + } elsif ($parametro =~ m/^discovery_threads\s+([0-9]*)/i) { $pa_config->{'discovery_threads'}= clean_blank($1); } diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 9058d83e96..9d1736266f 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -3846,7 +3846,8 @@ sub pandora_get_agent_group { my ($pa_config, $dbh, $agent_name, $agent_group, $agent_group_password) = @_; my $group_id; - my @groups = $pa_config->{'autocreate_group_force'} == 1 ? ($pa_config->{'autocreate_group'}, $agent_group) : ($agent_group, $pa_config->{'autocreate_group'}); + my $auto_group = $pa_config->{'autocreate_group_name'} ne '' ? $pa_config->{'autocreate_group_name'} : $pa_config->{'autocreate_group'}; + my @groups = $pa_config->{'autocreate_group_force'} == 1 ? ($auto_group, $agent_group) : ($agent_group, $auto_group); foreach my $group (@groups) { next unless defined($group); diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index f3b6fd63aa..2bd398cfda 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -89,11 +89,20 @@ sub new ($$;$) { } } - if ($config->{'autocreate_group'} > 0 && !defined(get_group_name ($dbh, $config->{'autocreate_group'}))) { - my $msg = "Group id " . $config->{'autocreate_group'} . " does not exist (check autocreate_group config token)."; - logger($config, $msg, 3); - print_message($config, $msg, 1); - pandora_event ($config, $msg, 0, 0, 0, 0, 0, 'error', 0, $dbh); + if ($config->{'autocreate_group_name'} ne '') { + if (get_group_id($dbh, $config->{'autocreate_group_name'}) == -1) { + my $msg = "Group '" . $config->{'autocreate_group_name'} . "' does not exist (check autocreate_group_name config token)."; + logger($config, $msg, 3); + print_message($config, $msg, 1); + pandora_event ($config, $msg, 0, 0, 0, 0, 0, 'error', 0, $dbh); + } + } elsif ($config->{'autocreate_group'} > 0) { + if (!defined(get_group_name ($dbh, $config->{'autocreate_group'}))) { + my $msg = "Group id " . $config->{'autocreate_group'} . " does not exist (check autocreate_group config token)."; + logger($config, $msg, 3); + print_message($config, $msg, 1); + pandora_event ($config, $msg, 0, 0, 0, 0, 0, 'error', 0, $dbh); + } } bless $self, $class; diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index ca12f4e204..13121c0a90 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -34,7 +34,7 @@ our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.759"; -my $pandora_build = "220105"; +my $pandora_build = "220113"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 607e4c5f2f..c826a174c9 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.759 -%define release 220105 +%define release 220113 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 36961c491b..bd72417d4c 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.759 -%define release 220105 +%define release 220113 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 86ed18ed21..193a048ff7 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.759" -PI_BUILD="220105" +PI_BUILD="220113" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 737d7acaf3..b073a3623b 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.759 Build 220105"; +my $version = "7.0NG.759 Build 220113"; # Pandora server configuration my %conf; @@ -391,11 +391,11 @@ sub pandora_purgedb ($$) { # Delete old log data log_message ('PURGE', "Deleting old network configuration manager data."); - if (defined($conf->{'days_purge_ncm'}) && $conf->{'days_purge_ncm'} > 0) { - log_message ('PURGE', 'Deleting NCM data older than ' . $conf->{'days_purge_ncm'} . ' days.'); - enterprise_hook ('pandora_purge_ncm', [$dbh, \&log_message, $conf->{'days_purge_ncm'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}]); + if (defined($conf->{'_days_purge'}) && $conf->{'_days_purge'} > 0) { + log_message ('PURGE', 'Deleting NCM data older than ' . $conf->{'_days_purge'} . ' days.'); + enterprise_hook ('pandora_purge_ncm', [$dbh, \&log_message, $conf->{'_days_purge'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}]); } else { - log_message ('PURGE', 'days_purge_ncm is set to 0. Old network configuration manager data will not be deleted.'); + log_message ('PURGE', '_days_purge is set to 0. Old network configuration manager data will not be deleted.'); } # Delete old special days diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 6163c0fef7..3b3a173061 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.759 Build 220105"; +my $version = "7.0NG.759 Build 220113"; # save program name for logging my $progname = basename($0);