diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index e973ee49c8..abfc49eb1d 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.767-221213 +Version: 7.0NG.767-221219 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 0b7f8bc7e9..78792cd154 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.767-221213" +pandora_version="7.0NG.767-221219" 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 32eae64142..af13e03c0d 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.767'; -use constant AGENT_BUILD => '221213'; +use constant AGENT_BUILD => '221219'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; @@ -2403,6 +2403,11 @@ sub check_collections () { if (open (MD5_FILE, "< $ConfDir/collections/$collection_md5_file")) { $local_collection_md5 = ; close MD5_FILE; + if ( ! defined ($local_collection_md5) ) { + log_message ('Collection', "Size of $ConfDir/collections/$collection_md5_file is 0"); + unlink ("$ConfDir/collections/$collection_md5_file"); + $local_collection_md5 = "Size 0"; + } } else { log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file"); next; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 1ae170b7db..5e53615f94 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.767 -%define release 221213 +%define release 221219 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 1592197613..da70bd1b3f 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.767 -%define release 221213 +%define release 221219 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 5ab13098da..5d9e4070b6 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.767" -PI_BUILD="221213" +PI_BUILD="221219" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 91700da9ba..04b176b463 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{221213} +{221219} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index c9916a35fa..6384ff688a 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.767 Build 221213") +#define PANDORA_VERSION ("7.0NG.767 Build 221219") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 7e4b708029..a7ea7512ee 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.767(Build 221213))" + VALUE "ProductVersion", "(7.0NG.767(Build 221219))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 552a0fad17..bed03d3f62 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.767-221213 +Version: 7.0NG.767-221219 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 2407eade45..aa7da3f20a 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.767-221213" +pandora_version="7.0NG.767-221219" 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 96223ccd69..90107df226 100644 --- a/pandora_console/extras/delete_files/delete_files.txt +++ b/pandora_console/extras/delete_files/delete_files.txt @@ -1667,3 +1667,13 @@ godmode/um_client/vendor/sebastian godmode/um_client/vendor update_manager_client/resources/styles/pandora.css enterprise/meta/general/upload_head_image.php +general/first_task/transactional_list.php +enterprise/include/ajax/transactional.ajax.php +enterprise/include/class/Transactionalmap.class.php +enterprise/include/help/es/help_transactional_map_phases.php +enterprise/include/javascript/transactional/TransactionalController.js +enterprise/include/functions_transactional.php +enterprise/operation/agentes/manage_transmap.php +enterprise/operation/agentes/manage_transmap_creation.php +enterprise/operation/agentes/manage_transmap_creation_phases_data.php +enterprise/operation/agentes/transactional_map.php diff --git a/pandora_console/extras/mr/60.sql b/pandora_console/extras/mr/60.sql index bf1ff4131a..c263f37864 100644 --- a/pandora_console/extras/mr/60.sql +++ b/pandora_console/extras/mr/60.sql @@ -1,5 +1,14 @@ START TRANSACTION; +ALTER TABLE treport_content ADD COLUMN use_prefix_notation tinyint(1) default '1'; +ALTER TABLE treport_content_template ADD COLUMN use_prefix_notation tinyint(1) default '1'; + +DROP TABLE IF EXISTS `tphase`; +DROP TABLE IF EXISTS `ttransaction`; + ALTER TABLE `tagent_custom_fields` ADD `is_link_enabled` TINYINT(1) NOT NULL DEFAULT 0; +ALTER TABLE `tevent_filter` ADD COLUMN `owner_user` TEXT; +ALTER TABLE `tevent_filter` ADD COLUMN `not_search` INT NOT NULL DEFAULT 0; + COMMIT; diff --git a/pandora_console/general/first_task/transactional_list.php b/pandora_console/general/first_task/transactional_list.php deleted file mode 100644 index c1d9ef2f42..0000000000 --- a/pandora_console/general/first_task/transactional_list.php +++ /dev/null @@ -1,46 +0,0 @@ - - true, 'message' => __('There are no transactions defined yet.') ]); - -if ($networkmaps_write || $networkmaps_manage) { - ?> - -
-
- __('Transactions')]); ?> -
-
-

- -

-
- -
-
-
- $severity, 'status' => $status, 'search' => $search, + 'not_search' => $not_search, 'text_agent' => $text_agent, 'id_agent_module' => $id_agent_module, 'id_agent' => $id_agent, 'pagination' => $pagination, 'event_view_hr' => $event_view_hr, 'id_user_ack' => $id_user_ack, + 'owner_user' => $owner_user, 'group_rep' => $group_rep, 'tag_with' => $tag_with_json, 'tag_without' => $tag_without_json, @@ -376,6 +384,15 @@ $table->data[6][1] = html_print_input_text( 255, true ); +$table->data[6][1] .= ' '.html_print_checkbox_switch( + 'not_search', + $not_search, + $not_search, + true, + false, + 'checked_slide_events(this);', + true +); $table->data[7][0] = ''.__('Agent search').''; $params = []; @@ -420,7 +437,12 @@ $table->data[9][1] = html_print_input_text( true ); -$table->data[10][0] = ''.__('User ack.').''.' '.ui_print_help_tip(__('Choose between the users who have validated an event. '), true); +$table->data[10][0] = ''.__('User ack.').''; +$table->data[10][0] .= ' '; +$table->data[10][0] .= ui_print_help_tip( + __('Choose between the users who have validated an event. '), + true +); if ($strict_user) { $users = [$config['id_user'] => $config['id_user']]; @@ -442,14 +464,25 @@ $table->data[10][1] = html_print_select( true ); +$table->data[11][0] = ''.__('Owner.').''; +$table->data[11][1] = html_print_select( + $users, + 'owner_user', + $owner_user, + '', + __('Any'), + 0, + true +); + $repeated_sel = [ EVENT_GROUP_REP_ALL => __('All events'), EVENT_GROUP_REP_EVENTS => __('Group events'), EVENT_GROUP_REP_AGENTS => __('Group agents'), EVENT_GROUP_REP_EXTRAIDS => __('Group extra id'), ]; -$table->data[11][0] = ''.__('Repeated').''; -$table->data[11][1] = html_print_select( +$table->data[12][0] = ''.__('Repeated').''; +$table->data[12][1] = html_print_select( $repeated_sel, 'group_rep', $group_rep, @@ -459,11 +492,11 @@ $table->data[11][1] = html_print_select( true ); -$table->data[12][0] = ''.__('Date from').''; -$table->data[12][1] = html_print_input_text('date_from', $date_from, '', 15, 10, true); +$table->data[13][0] = ''.__('Date from').''; +$table->data[13][1] = html_print_input_text('date_from', $date_from, '', 15, 10, true); -$table->data[13][0] = ''.__('Date to').''; -$table->data[13][1] = html_print_input_text('date_to', $date_to, '', 15, 10, true); +$table->data[14][0] = ''.__('Date to').''; +$table->data[14][1] = html_print_input_text('date_to', $date_to, '', 15, 10, true); $tag_with = json_decode($tag_with_json_clean, true); if (empty($tag_with)) { @@ -502,9 +535,9 @@ $remove_with_tag_disabled = empty($tag_with_temp); $add_without_tag_disabled = empty($tags_select_without); $remove_without_tag_disabled = empty($tag_without_temp); -$table->colspan[14][0] = '2'; -$table->data[14][0] = ''.__('Events with following tags').''; -$table->data[15][0] = html_print_select( +$table->colspan[15][0] = '2'; +$table->data[15][0] = ''.__('Events with following tags').''; +$table->data[16][0] = html_print_select( $tags_select_with, 'select_with', '', @@ -518,7 +551,7 @@ $table->data[15][0] = html_print_select( false, 'width: 220px;' ); -$table->data[15][1] = html_print_button( +$table->data[16][1] = html_print_button( __('Add'), 'add_whith', $add_with_tag_disabled, @@ -527,7 +560,7 @@ $table->data[15][1] = html_print_button( true ); -$table->data[16][0] = html_print_select( +$table->data[17][0] = html_print_select( $tag_with_temp, 'tag_with_temp', [], @@ -541,12 +574,12 @@ $table->data[16][0] = html_print_select( false, 'width: 220px; height: 50px;' ); -$table->data[16][0] .= html_print_input_hidden( +$table->data[17][0] .= html_print_input_hidden( 'tag_with', $tag_with_base64, true ); -$table->data[16][1] = html_print_button( +$table->data[17][1] = html_print_button( __('Remove'), 'remove_whith', $remove_with_tag_disabled, @@ -555,9 +588,9 @@ $table->data[16][1] = html_print_button( true ); -$table->colspan[17][0] = '2'; -$table->data[17][0] = ''.__('Events without following tags').''; -$table->data[18][0] = html_print_select( +$table->colspan[18][0] = '2'; +$table->data[18][0] = ''.__('Events without following tags').''; +$table->data[19][0] = html_print_select( $tags_select_without, 'select_without', '', @@ -571,7 +604,7 @@ $table->data[18][0] = html_print_select( false, 'width: 220px;' ); -$table->data[18][1] = html_print_button( +$table->data[19][1] = html_print_button( __('Add'), 'add_whithout', $add_without_tag_disabled, @@ -580,7 +613,7 @@ $table->data[18][1] = html_print_button( true ); -$table->data[19][0] = html_print_select( +$table->data[20][0] = html_print_select( $tag_without_temp, 'tag_without_temp', [], @@ -594,12 +627,12 @@ $table->data[19][0] = html_print_select( false, 'width: 220px; height: 50px;' ); -$table->data[19][0] .= html_print_input_hidden( +$table->data[20][0] .= html_print_input_hidden( 'tag_without', $tag_without_base64, true ); -$table->data[19][1] = html_print_button( +$table->data[20][1] = html_print_button( __('Remove'), 'remove_whithout', $remove_without_tag_disabled, @@ -608,8 +641,8 @@ $table->data[19][1] = html_print_button( true ); -$table->data[20][0] = ''.__('Alert events').''; -$table->data[20][1] = html_print_select( +$table->data[21][0] = ''.__('Alert events').''; +$table->data[21][1] = html_print_select( [ '-1' => __('All'), '0' => __('Filter alert events'), @@ -624,8 +657,8 @@ $table->data[20][1] = html_print_select( ); if (!is_metaconsole()) { - $table->data[21][0] = ''.__('Module search').''; - $table->data[21][1] .= html_print_autocomplete_modules( + $table->data[22][0] = ''.__('Module search').''; + $table->data[22][1] .= html_print_autocomplete_modules( 'module_search', $text_module, false, @@ -637,17 +670,17 @@ if (!is_metaconsole()) { ); } -$table->data[22][0] = ''.__('Source').''; -$table->data[22][1] = html_print_input_text('source', $source, '', 35, 255, true); +$table->data[23][0] = ''.__('Source').''; +$table->data[23][1] = html_print_input_text('source', $source, '', 35, 255, true); -$table->data[23][0] = ''.__('Extra ID').''; -$table->data[23][1] = html_print_input_text('id_extra', $id_extra, '', 11, 255, true); +$table->data[24][0] = ''.__('Extra ID').''; +$table->data[24][1] = html_print_input_text('id_extra', $id_extra, '', 11, 255, true); -$table->data[24][0] = ''.__('Comment').''; -$table->data[24][1] = html_print_input_text('user_comment', $user_comment, '', 35, 255, true); +$table->data[25][0] = ''.__('Comment').''; +$table->data[25][1] = html_print_input_text('user_comment', $user_comment, '', 35, 255, true); -$table->data[25][0] = ''.__('Custom data filter type').''; -$table->data[25][1] = html_print_select( +$table->data[26][0] = ''.__('Custom data filter type').''; +$table->data[26][1] = html_print_select( [ '0' => __('Filter custom data by name field'), '1' => __('Filter custom data by value field'), @@ -660,12 +693,12 @@ $table->data[25][1] = html_print_select( true ); -$table->data[26][0] = ''.__('Custom data').''; -$table->data[26][1] = html_print_input_text('custom_data', $custom_data, '', 35, 255, true); +$table->data[27][0] = ''.__('Custom data').''; +$table->data[27][1] = html_print_input_text('custom_data', $custom_data, '', 35, 255, true); if (is_metaconsole()) { - $table->data[27][0] = ''.__('Id souce event').''; - $table->data[27][1] = html_print_input_text( + $table->data[28][0] = ''.__('Id souce event').''; + $table->data[28][1] = html_print_input_text( 'id_source_event', $id_source_event, '', @@ -727,6 +760,14 @@ $(document).ready( function() { }); +function checked_slide_events(element) { + var value = $("#checkbox-"+element.name).val(); + if (value == 0) { + $("#checkbox-"+element.name).val(1); + } else { + $("#checkbox-"+element.name).val(0); + } +} function click_button_remove_tag(what_button) { if (what_button == "with") { diff --git a/pandora_console/godmode/massive/massive_add_action_alerts.php b/pandora_console/godmode/massive/massive_add_action_alerts.php index 178f3c830a..fcc9957bdb 100755 --- a/pandora_console/godmode/massive/massive_add_action_alerts.php +++ b/pandora_console/godmode/massive/massive_add_action_alerts.php @@ -181,6 +181,7 @@ if (empty($alert_templates)) { $alert_templates = ''; } +$table = new stdClass(); $table->id = 'delete_table'; $table->width = '98%'; $table->data = []; diff --git a/pandora_console/godmode/massive/massive_delete_action_alerts.php b/pandora_console/godmode/massive/massive_delete_action_alerts.php index cc6f9e4c90..c19823fc57 100644 --- a/pandora_console/godmode/massive/massive_delete_action_alerts.php +++ b/pandora_console/godmode/massive/massive_delete_action_alerts.php @@ -192,6 +192,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) { $return_all_group = true; } +$table = new stdClass(); $table->id = 'delete_table'; $table->class = 'databox filters'; $table->width = '100%'; diff --git a/pandora_console/godmode/massive/massive_delete_alerts.php b/pandora_console/godmode/massive/massive_delete_alerts.php index 37961cded8..7e899e7f9f 100755 --- a/pandora_console/godmode/massive/massive_delete_alerts.php +++ b/pandora_console/godmode/massive/massive_delete_alerts.php @@ -249,6 +249,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) { $return_all_group = true; } +$table = new stdClass(); $table->id = 'delete_table'; $table->class = 'databox filters'; $table->width = '100%'; diff --git a/pandora_console/godmode/massive/massive_enable_disable_alerts.php b/pandora_console/godmode/massive/massive_enable_disable_alerts.php index bfe6d436e8..78d84d6b57 100644 --- a/pandora_console/godmode/massive/massive_enable_disable_alerts.php +++ b/pandora_console/godmode/massive/massive_enable_disable_alerts.php @@ -148,6 +148,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) { $return_all_group = true; } +$table = new stdClass(); $table->id = 'delete_table'; $table->class = 'databox filters'; $table->width = '100%'; diff --git a/pandora_console/godmode/massive/massive_standby_alerts.php b/pandora_console/godmode/massive/massive_standby_alerts.php index e1def56976..704f17bfc8 100644 --- a/pandora_console/godmode/massive/massive_standby_alerts.php +++ b/pandora_console/godmode/massive/massive_standby_alerts.php @@ -164,6 +164,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) { $return_all_group = true; } +$table = new stdClass(); $table->id = 'delete_table'; $table->class = 'databox filters'; $table->width = '100%'; diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php index 61da7f6413..bd1fd74f24 100644 --- a/pandora_console/godmode/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -229,7 +229,8 @@ if ($add_module === true) { // Safe output remove all entities. io_safe_output_array($id_modules, ''); - $id_modules = array_map(function ($mod) { + $id_modules = array_map( + function ($mod) { return io_safe_input($mod); }, $id_modules diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 2eb9ca0c1d..80e72e65cf 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -169,6 +169,7 @@ $visual_format = 0; $filter_search = ''; $filter_exclude = ''; +$use_prefix_notation = true; // Added for select fields. $total_time = true; @@ -461,6 +462,7 @@ switch ($action) { $lapse = $item['lapse']; $lapse_calc = $item['lapse_calc']; $visual_format = $item['visual_format']; + $use_prefix_notation = $item['use_prefix_notation']; break; case 'max_value': @@ -476,6 +478,7 @@ switch ($action) { $lapse = $item['lapse']; $lapse_calc = $item['lapse_calc']; $visual_format = $item['visual_format']; + $use_prefix_notation = $item['use_prefix_notation']; break; case 'min_value': @@ -491,6 +494,7 @@ switch ($action) { $lapse = $item['lapse']; $lapse_calc = $item['lapse_calc']; $visual_format = $item['visual_format']; + $use_prefix_notation = $item['use_prefix_notation']; break; case 'sumatory': @@ -504,6 +508,7 @@ switch ($action) { $idAgentModule = $item['id_agent_module']; $period = $item['period']; $uncompressed_module = $item['uncompressed_module']; + $use_prefix_notation = $item['use_prefix_notation']; break; case 'historical_data': @@ -773,6 +778,7 @@ switch ($action) { $show_resume = $item['show_resume']; $show_graph = $item['show_graph']; $order_uptodown = $item['order_uptodown']; + $use_prefix_notation = $item['use_prefix_notation']; $text_agent = ''; if (isset($style['text_agent']) === true @@ -3404,6 +3410,22 @@ $class = 'databox filters'; + + + + + + + + + data[$row][1] = ''.__('Example').' '.date($config['date_f $table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true); $row++; +$decimal_separators = [ + ',' => ',', + '.' => '.' +]; + +$table_other->data[$row][0] = __('Decimal separator'); +$table_other->data[$row][1] = html_print_select( + $decimal_separators, + 'decimal_separator', + $config['decimal_separator'], + '', + '', + '', + true, + false, + false +); + + +$row++; + if ($config['prominent_time'] == 'comparation') { $timestamp = false; $comparation = true; diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 5388aa9a45..a1fa53ced3 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -1450,17 +1450,17 @@ class DiscoveryTaskList extends HTML // Header information. if ((int) $task['status'] <= 0 && empty($summary)) { - if ($task['type'] == DISCOVERY_APP_VMWARE && $task['utimestamp'] != 0) { - $outputMessage = __('Task completed.'); + if ((int) $task['utimestamp'] !== 0) { + $output .= $this->progressTaskGraph($task); } else { $outputMessage = __('This task has never executed'); - } - $output .= ui_print_info_message( - $outputMessage, - '', - true - ); + $output .= ui_print_info_message( + $outputMessage, + '', + true + ); + } } else if ($task['status'] == 1 || ($task['utimestamp'] == 0 && $task['interval_sweep']) ) { diff --git a/pandora_console/include/ajax/custom_fields.php b/pandora_console/include/ajax/custom_fields.php index 3fd81ec4b0..77e79800aa 100644 --- a/pandora_console/include/ajax/custom_fields.php +++ b/pandora_console/include/ajax/custom_fields.php @@ -429,7 +429,9 @@ if (check_login()) { $table_modules->data[$key][1] = remove_right_zeros( number_format( $value['datos'], - $config['graph_precision'] + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] ) ); } else { diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 95e123a99b..2494a83634 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -351,12 +351,14 @@ if ($save_event_filter) { $values['severity'] = implode(',', get_parameter('severity', -1)); $values['status'] = get_parameter('status'); $values['search'] = get_parameter('search'); + $values['not_search'] = get_parameter('not_search'); $values['text_agent'] = get_parameter('text_agent'); $values['id_agent'] = get_parameter('id_agent'); $values['id_agent_module'] = get_parameter('id_agent_module'); $values['pagination'] = get_parameter('pagination'); $values['event_view_hr'] = get_parameter('event_view_hr'); $values['id_user_ack'] = get_parameter('id_user_ack'); + $values['owner_user'] = get_parameter('owner_user'); $values['group_rep'] = get_parameter('group_rep'); $values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([])); $values['tag_without'] = get_parameter( @@ -409,12 +411,14 @@ if ($update_event_filter) { $values['severity'] = implode(',', get_parameter('severity', -1)); $values['status'] = get_parameter('status'); $values['search'] = get_parameter('search'); + $values['not_search'] = get_parameter('not_search'); $values['text_agent'] = get_parameter('text_agent'); $values['id_agent'] = get_parameter('id_agent'); $values['id_agent_module'] = get_parameter('id_agent_module'); $values['pagination'] = get_parameter('pagination'); $values['event_view_hr'] = get_parameter('event_view_hr'); $values['id_user_ack'] = get_parameter('id_user_ack'); + $values['owner_user'] = get_parameter('owner_user'); $values['group_rep'] = get_parameter('group_rep'); $values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([])); $values['tag_without'] = get_parameter( @@ -481,6 +485,7 @@ if ($get_filter_values) { 'user_comment' => '', 'id_extra' => '', 'id_user_ack' => '', + 'owner_user' => '', 'date_from' => '', 'time_from' => '', 'date_to' => '', @@ -642,6 +647,8 @@ function load_form_filter() { $("#status").val(val); if (i == 'search') $('#text-search').val(val); + if (i == 'not_search') + $('#checkbox-not_search').val(val); if (i == 'text_agent') $('input[name=text_agent]').val(val); if (i == 'id_agent') @@ -654,6 +661,8 @@ function load_form_filter() { $("#text-event_view_hr").val(val); if (i == 'id_user_ack') $("#id_user_ack").val(val); + if (i == 'owner_user') + $("#owner_user").val(val); if (i == 'group_rep') $("#group_rep").val(val); if (i == 'tag_with') @@ -898,12 +907,14 @@ function save_new_filter() { "severity" : $("#severity").val(), "status" : $("#status").val(), "search" : $("#text-search").val(), + "not_search" : $("#checkbox-not_search").val(), "text_agent" : $("#text_id_agent").val(), "id_agent" : $('input:hidden[name=id_agent]').val(), "id_agent_module" : $('input:hidden[name=module_search_hidden]').val(), "pagination" : $("#pagination").val(), "event_view_hr" : $("#text-event_view_hr").val(), "id_user_ack" : $("#id_user_ack").val(), + "owner_user" : $("#owner_user").val(), "group_rep" : $("#group_rep").val(), "tag_with": Base64.decode($("#hidden-tag_with").val()), "tag_without": Base64.decode($("#hidden-tag_without").val()), @@ -975,12 +986,14 @@ function save_update_filter() { "severity" : $("#severity").val(), "status" : $("#status").val(), "search" : $("#text-search").val(), + "not_search" : $("#checkbox-not_search").val(), "text_agent" : $("#text_id_agent").val(), "id_agent" : $('input:hidden[name=id_agent]').val(), "id_agent_module" : $('input:hidden[name=module_search_hidden]').val(), "pagination" : $("#pagination").val(), "event_view_hr" : $("#text-event_view_hr").val(), "id_user_ack" : $("#id_user_ack").val(), + "owner_user" : $("#owner_user").val(), "group_rep" : $("#group_rep").val(), "tag_with" : Base64.decode($("#hidden-tag_with").val()), "tag_without" : Base64.decode($("#hidden-tag_without").val()), @@ -2421,6 +2434,7 @@ if ($get_events_fired) { 'severity' => -1, 'status' => -1, 'search' => '', + 'not_search' => 0, 'text_agent' => '', 'id_agent' => 0, 'id_agent_module' => 0, diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index c43da3e146..8efb03df12 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -499,7 +499,9 @@ if (check_login()) { $data[] = remove_right_zeros( number_format( $row[$attr[0]], - $config['graph_precision'] + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] ) ); } @@ -507,7 +509,9 @@ if (check_login()) { $data[] = remove_right_zeros( number_format( $row[$attr[0]], - $config['graph_precision'] + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] ) ); } @@ -524,7 +528,9 @@ if (check_login()) { $data[] = remove_right_zeros( number_format( $row[$attr[0]], - $config['graph_precision'] + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] ) ); } diff --git a/pandora_console/include/class/AgentWizard.class.php b/pandora_console/include/class/AgentWizard.class.php index 5dad75e5ad..7c5a827b51 100644 --- a/pandora_console/include/class/AgentWizard.class.php +++ b/pandora_console/include/class/AgentWizard.class.php @@ -2636,6 +2636,8 @@ class AgentWizard extends HTML */ private function resultsInterfaceWizard() { + global $config; + $generalInterfaceModules = $this->getInterfacesModules(); $generalInterfaceTables = []; $generalInterfaceModulesUpdated = []; @@ -2849,7 +2851,12 @@ class AgentWizard extends HTML // Format current value with thousands and decimals. if (is_numeric($currentValue) === true) { $decimals = (is_float($currentValue) === true) ? 2 : 0; - $currentValue = number_format($currentValue, $decimals); + $currentValue = number_format( + $currentValue, + $decimals, + $config['decimal_separator'], + $config['thousand_separator'] + ); } // It unit of measure have data, attach to current value. diff --git a/pandora_console/include/class/Diagnostics.class.php b/pandora_console/include/class/Diagnostics.class.php index a8f84f04be..db9f459f00 100644 --- a/pandora_console/include/class/Diagnostics.class.php +++ b/pandora_console/include/class/Diagnostics.class.php @@ -987,7 +987,7 @@ class Diagnostics extends Wizard ], 'tablesFragmentationValue' => [ 'name' => __('Tables fragmentation (current value)'), - 'value' => number_format($tFragmentationValue, 2).'%', + 'value' => number_format($tFragmentationValue, 2, $config['decimal_separator'], $config['thousand_separator']).'%', ], 'tablesFragmentationStatus' => [ 'name' => __('Table fragmentation status'), @@ -1122,7 +1122,9 @@ class Diagnostics extends Wizard if ($totalModuleIntervalTime !== false) { $averageTime = number_format( ((int) $totalNetworkModules / (int) $totalModuleIntervalTime), - 3 + 3, + $config['decimal_separator'], + $config['thousand_separator'] ); } @@ -1749,7 +1751,7 @@ class Diagnostics extends Wizard $sizeServerLog = number_format($fileSize); $sizeServerLog = (0 + str_replace(',', '', $sizeServerLog)); - $value = number_format(($fileSize / $mega), 3); + $value = number_format(($fileSize / $mega), 3, $config['decimal_separator'], $config['thousand_separator']); $message = __('You have more than 10 MB of logs'); $status = 0; if ($sizeServerLog <= $tenMega) { diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 4210c515ad..95187cb95d 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 = 'PC221213'; +$build_version = 'PC221219'; $pandora_version = 'v7.0NG.767'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 6848e505f5..2d3fbb26e8 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -223,6 +223,8 @@ function list_files($directory, $stringSearch, $searchHandler, $return=false) */ function format_numeric($number, $decimals=1) { + global $config; + // Translate to float in case there are characters in the string so // fmod doesn't throw a notice $number = (float) $number; @@ -231,17 +233,11 @@ function format_numeric($number, $decimals=1) return 0; } - // Translators: This is separator of decimal point - $dec_point = __('.'); - // Translators: This is separator of decimal point - $thousands_sep = __(','); - - // If has decimals if (fmod($number, 1) > 0) { - return number_format($number, $decimals, $dec_point, $thousands_sep); + return number_format($number, $decimals, $config['decimal_separator'], $config['thousand_separator']); } - return number_format($number, 0, $dec_point, $thousands_sep); + return number_format($number, 0, $config['decimal_separator'], $config['thousand_separator']); } @@ -4088,14 +4084,18 @@ function series_type_graph_array($data, $show_elements_graph) $data_return['legend'][$key] .= remove_right_zeros( number_format( $value['min'], - $config['graph_precision'] + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] ) ); $data_return['legend'][$key] .= ' '.__('Max:'); $data_return['legend'][$key] .= remove_right_zeros( number_format( $value['max'], - $config['graph_precision'] + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] ) ); $data_return['legend'][$key] .= ' '._('Avg:'); @@ -4103,7 +4103,8 @@ function series_type_graph_array($data, $show_elements_graph) number_format( $value['avg'], $config['graph_precision'], - $config['csv_decimal_separator'] + $config['decimal_separator'], + $config['thousand_separator'] ) ).' '.$str; } @@ -4160,7 +4161,9 @@ function series_type_graph_array($data, $show_elements_graph) $data_return['legend'][$key] .= remove_right_zeros( number_format( $value['data'][0][1], - $config['graph_precision'] + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] ) ).' '.$str; } diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index c8b9d7ae01..ce6387ffc7 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -604,95 +604,6 @@ function api_get_module_last_value($idAgentModule, $trash1, $other=';', $returnT } -/* - DB column mapping table used by tree_agents (and get module_properties) -*/ - -/* - * Agent related field mappings (output field => column designation for 'tagente'). - * agent_id is not in this list (because it is mandatory). - * agent_id_group is not in this list. - */ -$agent_field_column_mapping = [ - 'agent_name' => 'nombre as agent_name', - 'agent_direction' => 'direccion as agent_direction', - 'agent_comentary' => 'comentarios as agent_comentary', - 'agent_last_contant' => 'ultimo_contacto as agent_last_contant', - 'agent_mode' => 'modo as agent_mode', - 'agent_interval' => 'intervalo as agent_interval', - 'agent_id_os' => 'id_os as agent_id_os', - 'agent_os_version' => 'os_version as agent_os_version', - 'agent_version' => 'agent_version as agent_version', - 'agent_last_remote_contact' => 'ultimo_contacto_remoto as agent_last_remote_contact', - 'agent_disabled' => 'disabled as agent_disabled', - 'agent_id_parent' => 'id_parent as agent_id_parent', - 'agent_custom_id' => 'custom_id as agent_custom_id', - 'agent_server_name' => 'server_name as agent_server_name', - 'agent_cascade_protection' => 'cascade_protection as agent_cascade_protection', - 'agent_cascade_protection_module' => 'cascade_protection_module as agent_cascade_protection_module', -]; - -// module related field mappings 1/2 (output field => column for 'tagente_modulo') -// module_id_agent_modulo is not in this list -$module_field_column_mampping = [ - 'module_id_agent' => 'id_agente as module_id_agent', - 'module_id_module_type' => 'id_tipo_modulo as module_id_module_type', - 'module_description' => 'descripcion as module_description', - 'module_name' => 'nombre as module_name', - 'module_max' => 'max as module_max', - 'module_min' => 'min as module_min', - 'module_interval' => 'module_interval', - 'module_tcp_port' => 'tcp_port as module_tcp_port', - 'module_tcp_send' => 'tcp_send as module_tcp_send', - 'module_tcp_rcv' => 'tcp_rcv as module_tcp_rcv', - 'module_snmp_community' => 'snmp_community as module_snmp_community', - 'module_snmp_oid' => 'snmp_oid as module_snmp_oid', - 'module_ip_target' => 'ip_target as module_ip_target', - 'module_id_module_group' => 'id_module_group as module_id_module_group', - 'module_flag' => 'flag as module_flag', - 'module_id_module' => 'id_modulo as module_id_module', - 'module_disabled' => 'disabled as module_disabled', - 'module_id_export' => 'id_export as module_id_export', - 'module_plugin_user' => 'plugin_user as module_plugin_user', - 'module_plugin_pass' => 'plugin_pass as module_plugin_pass', - 'module_plugin_parameter' => 'plugin_parameter as module_plugin_parameter', - 'module_id_plugin' => 'id_plugin as module_id_plugin', - 'module_post_process' => 'post_process as module_post_process', - 'module_prediction_module' => 'prediction_module as module_prediction_module', - 'module_max_timeout' => 'max_timeout as module_max_timeout', - 'module_max_retries' => 'max_retries as module_max_retries', - 'module_custom_id' => 'custom_id as module_custom_id', - 'module_history_data' => 'history_data as module_history_data', - 'module_min_warning' => 'min_warning as module_min_warning', - 'module_max_warning' => 'max_warning as module_max_warning', - 'module_str_warning' => 'str_warning as module_str_warning', - 'module_min_critical' => 'min_critical as module_min_critical', - 'module_max_critical' => 'max_critical as module_max_critical', - 'module_str_critical' => 'str_critical as module_str_critical', - 'module_min_ff_event' => 'min_ff_event as module_min_ff_event', - 'module_delete_pending' => 'delete_pending as module_delete_pending', - 'module_plugin_macros' => 'macros as module_plugin_macros', - 'module_macros' => 'module_macros as module_macros', - 'module_critical_inverse' => 'critical_inverse as module_critical_inverse', - 'module_warning_inverse' => 'warning_inverse as module_warning_inverse', -]; - -// module related field mappings 2/2 (output field => column for 'tagente_estado') -// module_id_agent_modulo is not in this list -$estado_fields_to_columns_mapping = [ - 'module_id_agent_state' => 'id_agente_estado as module_id_agent_state', - 'module_data' => 'datos as module_data', - 'module_timestamp' => 'timestamp as module_timestamp', - 'module_state' => 'estado as module_state', - 'module_last_try' => 'last_try as module_last_try', - 'module_utimestamp' => 'utimestamp as module_utimestamp', - 'module_current_interval' => 'current_interval as module_current_interval', - 'module_running_by' => 'running_by as module_running_by', - 'module_last_execution_try' => 'last_execution_try as module_last_execution_try', - 'module_status_changes' => 'status_changes as module_status_changes', - 'module_last_status' => 'last_status as module_last_status', -]; - /*** * end of DB column mapping table ***/ @@ -806,9 +717,9 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) 'module_id_module', 'module_disabled', 'module_id_export', - 'module_plugin_user', - 'module_plugin_pass', 'module_plugin_parameter', + 'module_plugin_pass', + 'module_plugin_user', 'module_id_plugin', 'module_post_process', 'module_prediction_module', @@ -897,14 +808,88 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) 'alert_actions_id_group', ]; - // agent related field mappings (output field => column designation for 'tagente') - global $agent_field_column_mapping; + /* + * Agent related field mappings (output field => column designation for 'tagente'). + * agent_id is not in this list (because it is mandatory). + * agent_id_group is not in this list. + */ + $agent_field_column_mapping = [ + 'agent_name' => 'nombre as agent_name', + 'agent_direction' => 'direccion as agent_direction', + 'agent_comentary' => 'comentarios as agent_comentary', + 'agent_last_contant' => 'ultimo_contacto as agent_last_contant', + 'agent_mode' => 'modo as agent_mode', + 'agent_interval' => 'intervalo as agent_interval', + 'agent_id_os' => 'id_os as agent_id_os', + 'agent_os_version' => 'os_version as agent_os_version', + 'agent_version' => 'agent_version as agent_version', + 'agent_last_remote_contact' => 'ultimo_contacto_remoto as agent_last_remote_contact', + 'agent_disabled' => 'disabled as agent_disabled', + 'agent_id_parent' => 'id_parent as agent_id_parent', + 'agent_custom_id' => 'custom_id as agent_custom_id', + 'agent_server_name' => 'server_name as agent_server_name', + 'agent_cascade_protection' => 'cascade_protection as agent_cascade_protection', + 'agent_cascade_protection_module' => 'cascade_protection_module as agent_cascade_protection_module', + ]; // module related field mappings 1/2 (output field => column for 'tagente_modulo') - global $module_field_column_mampping; + // module_id_agent_modulo is not in this list + // module_plugin_user, module_plugin_pass, module_plugin_macros are not in this list due to security purposes. + $module_field_column_mapping = [ + 'module_id_agent' => 'id_agente as module_id_agent', + 'module_id_module_type' => 'id_tipo_modulo as module_id_module_type', + 'module_description' => 'descripcion as module_description', + 'module_name' => 'nombre as module_name', + 'module_max' => 'max as module_max', + 'module_min' => 'min as module_min', + 'module_interval' => 'module_interval', + 'module_tcp_port' => 'tcp_port as module_tcp_port', + 'module_tcp_send' => 'tcp_send as module_tcp_send', + 'module_tcp_rcv' => 'tcp_rcv as module_tcp_rcv', + 'module_snmp_community' => 'snmp_community as module_snmp_community', + 'module_snmp_oid' => 'snmp_oid as module_snmp_oid', + 'module_ip_target' => 'ip_target as module_ip_target', + 'module_id_module_group' => 'id_module_group as module_id_module_group', + 'module_flag' => 'flag as module_flag', + 'module_id_module' => 'id_modulo as module_id_module', + 'module_disabled' => 'disabled as module_disabled', + 'module_id_export' => 'id_export as module_id_export', + 'module_plugin_parameter' => 'plugin_parameter as module_plugin_parameter', + 'module_id_plugin' => 'id_plugin as module_id_plugin', + 'module_post_process' => 'post_process as module_post_process', + 'module_prediction_module' => 'prediction_module as module_prediction_module', + 'module_max_timeout' => 'max_timeout as module_max_timeout', + 'module_max_retries' => 'max_retries as module_max_retries', + 'module_custom_id' => 'custom_id as module_custom_id', + 'module_history_data' => 'history_data as module_history_data', + 'module_min_warning' => 'min_warning as module_min_warning', + 'module_max_warning' => 'max_warning as module_max_warning', + 'module_str_warning' => 'str_warning as module_str_warning', + 'module_min_critical' => 'min_critical as module_min_critical', + 'module_max_critical' => 'max_critical as module_max_critical', + 'module_str_critical' => 'str_critical as module_str_critical', + 'module_min_ff_event' => 'min_ff_event as module_min_ff_event', + 'module_delete_pending' => 'delete_pending as module_delete_pending', + 'module_macros' => 'module_macros as module_macros', + 'module_critical_inverse' => 'critical_inverse as module_critical_inverse', + 'module_warning_inverse' => 'warning_inverse as module_warning_inverse', + ]; // module related field mappings 2/2 (output field => column for 'tagente_estado') - global $estado_fields_to_columns_mapping; + // module_id_agent_modulo is not in this list + $estado_fields_to_columns_mapping = [ + 'module_id_agent_state' => 'id_agente_estado as module_id_agent_state', + 'module_data' => 'datos as module_data', + 'module_timestamp' => 'timestamp as module_timestamp', + 'module_state' => 'estado as module_state', + 'module_last_try' => 'last_try as module_last_try', + 'module_utimestamp' => 'utimestamp as module_utimestamp', + 'module_current_interval' => 'current_interval as module_current_interval', + 'module_running_by' => 'running_by as module_running_by', + 'module_last_execution_try' => 'last_execution_try as module_last_execution_try', + 'module_status_changes' => 'status_changes as module_status_changes', + 'module_last_status' => 'last_status as module_last_status', + ]; // alert related field mappings (output field => column for 'talert_template_modules', ... ) $alert_fields_to_columns_mapping = [ @@ -985,8 +970,8 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) $agent_additional_columns .= (', '.$agent_field_column_mapping[$fld] ); } - if (array_key_exists($fld, $module_field_column_mampping)) { - $module_additional_columns .= (', '.$module_field_column_mampping[$fld]); + if (array_key_exists($fld, $module_field_column_mapping)) { + $module_additional_columns .= (', '.$module_field_column_mapping[$fld]); } if (array_key_exists($fld, $estado_fields_to_columns_mapping)) { @@ -1016,9 +1001,13 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) $groups = []; } - $groups = str_replace('\n', $returnReplace, $groups); - foreach ($groups as &$group) { + if (check_acl($config['id_user'], $group['group_id'], 'AR') === false) { + continue; + } + + $group = str_replace('\n', $returnReplace, $group); + $group['type_row'] = 'group'; $returnVar[] = $group; @@ -1034,9 +1023,23 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) $agents = []; } - $agents = str_replace('\n', $returnReplace, $agents); + if ((bool) check_acl($config['id_user'], $id_group, 'AW') === true) { + if (array_search('module_plugin_user', $fields) !== false) { + $module_additional_columns .= ' ,plugin_user as module_plugin_user'; + } + + if (array_search('module_plugin_pass', $fields) !== false) { + $module_additional_columns .= ' ,plugin_pass as module_plugin_pass'; + } + + if (array_search('module_plugin_macros', $fields) !== false) { + $module_additional_columns .= ' ,macros as module_plugin_macros'; + } + } foreach ($agents as $index => &$agent) { + $agent = str_replace('\n', $returnReplace, $agent); + $agent['type_row'] = 'agent'; $returnVar[] = $agent; @@ -1048,24 +1051,26 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) // SKIP collecting MODULES and ALERTS } + $sql = 'SELECT * + FROM (SELECT id_agente_modulo as module_id_agent_modulo '.$module_additional_columns.' + FROM tagente_modulo t1 + WHERE id_agente = '.$agent['agent_id'].') t1 + INNER JOIN (SELECT id_agente_modulo as module_id_agent_modulo '.$estado_additional_columns.' + FROM tagente_estado + WHERE id_agente = '.$agent['agent_id'].') t2 + ON t1.module_id_agent_modulo = t2.module_id_agent_modulo'; + $modules = db_get_all_rows_sql( - 'SELECT * - FROM (SELECT id_agente_modulo as module_id_agent_modulo '.$module_additional_columns.' - FROM tagente_modulo - WHERE id_agente = '.$agent['agent_id'].') t1 - INNER JOIN (SELECT id_agente_modulo as module_id_agent_modulo '.$estado_additional_columns.' - FROM tagente_estado - WHERE id_agente = '.$agent['agent_id'].') t2 - ON t1.module_id_agent_modulo = t2.module_id_agent_modulo' + $sql ); if ($modules === false) { $modules = []; } - $modules = str_replace('\n', $returnReplace, $modules); - foreach ($modules as &$module) { + $module = str_replace('\n', $returnReplace, $module); + $module['type_row'] = 'module'; if ($module['module_macros']) { @@ -1097,9 +1102,8 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) $alerts = []; } - $alerts = str_replace('\n', $returnReplace, $alerts); - foreach ($alerts as &$alert) { + $alert = str_replace('\n', $returnReplace, $alert); $alert['type_row'] = 'alert'; $returnVar[] = $alert; } @@ -1366,10 +1370,66 @@ function get_module_properties($id_module, $fields, $separator, $returnType, $re ]; // module related field mappings 1/2 (output field => column for 'tagente_modulo') - global $module_field_column_mampping; + // module_id_agent_modulo is not in this list + // module_plugin_user, module_plugin_pass, module_plugin_macros are not in this list due to security purposes. + $module_field_column_mapping = [ + 'module_id_agent' => 'id_agente as module_id_agent', + 'module_id_module_type' => 'id_tipo_modulo as module_id_module_type', + 'module_description' => 'descripcion as module_description', + 'module_name' => 'nombre as module_name', + 'module_max' => 'max as module_max', + 'module_min' => 'min as module_min', + 'module_interval' => 'module_interval', + 'module_tcp_port' => 'tcp_port as module_tcp_port', + 'module_tcp_send' => 'tcp_send as module_tcp_send', + 'module_tcp_rcv' => 'tcp_rcv as module_tcp_rcv', + 'module_snmp_community' => 'snmp_community as module_snmp_community', + 'module_snmp_oid' => 'snmp_oid as module_snmp_oid', + 'module_ip_target' => 'ip_target as module_ip_target', + 'module_id_module_group' => 'id_module_group as module_id_module_group', + 'module_flag' => 'flag as module_flag', + 'module_id_module' => 'id_modulo as module_id_module', + 'module_disabled' => 'disabled as module_disabled', + 'module_id_export' => 'id_export as module_id_export', + 'module_plugin_parameter' => 'plugin_parameter as module_plugin_parameter', + 'module_plugin_user' => 'plugin_user as module_plugin_user', + 'module_plugin_pass' => 'plugin_pass as module_plugin_pass', + 'module_plugin_macros' => 'macros as module_plugin_macros', + 'module_id_plugin' => 'id_plugin as module_id_plugin', + 'module_post_process' => 'post_process as module_post_process', + 'module_prediction_module' => 'prediction_module as module_prediction_module', + 'module_max_timeout' => 'max_timeout as module_max_timeout', + 'module_max_retries' => 'max_retries as module_max_retries', + 'module_custom_id' => 'custom_id as module_custom_id', + 'module_history_data' => 'history_data as module_history_data', + 'module_min_warning' => 'min_warning as module_min_warning', + 'module_max_warning' => 'max_warning as module_max_warning', + 'module_str_warning' => 'str_warning as module_str_warning', + 'module_min_critical' => 'min_critical as module_min_critical', + 'module_max_critical' => 'max_critical as module_max_critical', + 'module_str_critical' => 'str_critical as module_str_critical', + 'module_min_ff_event' => 'min_ff_event as module_min_ff_event', + 'module_delete_pending' => 'delete_pending as module_delete_pending', + 'module_macros' => 'module_macros as module_macros', + 'module_critical_inverse' => 'critical_inverse as module_critical_inverse', + 'module_warning_inverse' => 'warning_inverse as module_warning_inverse', + ]; // module related field mappings 2/2 (output field => column for 'tagente_estado') - global $estado_fields_to_columns_mapping; + // module_id_agent_modulo is not in this list + $estado_fields_to_columns_mapping = [ + 'module_id_agent_state' => 'id_agente_estado as module_id_agent_state', + 'module_data' => 'datos as module_data', + 'module_timestamp' => 'timestamp as module_timestamp', + 'module_state' => 'estado as module_state', + 'module_last_try' => 'last_try as module_last_try', + 'module_utimestamp' => 'utimestamp as module_utimestamp', + 'module_current_interval' => 'current_interval as module_current_interval', + 'module_running_by' => 'running_by as module_running_by', + 'module_last_execution_try' => 'last_execution_try as module_last_execution_try', + 'module_status_changes' => 'status_changes as module_status_changes', + 'module_last_status' => 'last_status as module_last_status', + ]; if ($fields == false) { $fields = $module_properties_master_fields; @@ -1379,8 +1439,8 @@ function get_module_properties($id_module, $fields, $separator, $returnType, $re $module_additional_columns = ''; $estado_additional_columns = ''; foreach ($fields as $fld) { - if (array_key_exists($fld, $module_field_column_mampping)) { - $module_additional_columns .= (', '.$module_field_column_mampping[$fld]); + if (array_key_exists($fld, $module_field_column_mapping)) { + $module_additional_columns .= (', '.$module_field_column_mapping[$fld]); } if (array_key_exists($fld, $estado_fields_to_columns_mapping)) { @@ -1405,9 +1465,9 @@ function get_module_properties($id_module, $fields, $separator, $returnType, $re $modules = []; } - $modules = str_replace('\n', $returnReplace, $modules); - foreach ($modules as &$module) { + $module = str_replace('\n', $returnReplace, $module); + $module['type_row'] = 'module'; if ($module['module_macros']) { @@ -16930,6 +16990,32 @@ function api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $retur ]; + $group_exist = db_get_value_filter( + 'id_grupo', + 'tgrupo', + [ + 'id_grupo' => $values['id_grupo'], + ] + ); + + if ((bool) $group_exist === false) { + returnError('Selected group does not exist'); + return; + } + + $profile_exist = db_get_value_filter( + 'id_perfil', + 'tperfil', + [ + 'id_perfil' => $values['id_perfil'], + ] + ); + + if ((bool) $profile_exist === false) { + returnError('Selected profile does not exist'); + return; + } + $where_id_up = ['id_up' => $other['data'][4]]; if ($exist_profile === $other['data'][4] && $where_id_up !== null) { $sucessfull_insert = db_process_sql_update('tusuario_perfil', $values, $where_id_up); diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 6870f9ae30..cc49761959 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1475,6 +1475,15 @@ function config_update_config() if (config_update_value('use_data_multiplier', get_parameter('use_data_multiplier', '1'), true) === false) { $error_update[] = __('Use data multiplier'); } + + if (config_update_value('decimal_separator', (string) get_parameter('decimal_separator', '.'), true) === false) { + $error_update[] = __('Decimal separator'); + } else { + $thousand_separator = ((string) get_parameter('decimal_separator', '.') === '.') ? ',' : '.'; + if (config_update_value('thousand_separator', $thousand_separator, true) === false) { + $error_update[] = __('Thousand separator'); + } + } break; case 'net': @@ -3446,7 +3455,7 @@ function config_process_config() } if (!isset($config['ehorus_port'])) { - config_update_value('ehorus_port', 18080); + config_update_value('ehorus_port', 443); } if (!isset($config['ehorus_req_timeout'])) { @@ -3479,6 +3488,10 @@ function config_process_config() config_update_value('module_library_password', ''); } + if (!isset($config['decimal_separator'])) { + config_update_value('decimal_separator', '.'); + } + // Finally, check if any value was overwritten in a form. config_update_config(); } diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 05f0c08d32..680b053333 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -640,11 +640,13 @@ function events_update_status($id_evento, $status, $filter=null) * 'status' * 'agent_alias' * 'search' + * 'not_search' * 'id_extra' * 'id_source_event' * 'user_comment' * 'source' * 'id_user_ack' + * 'owner_user' * 'tag_with' * 'tag_without' * 'filter_only_alert' @@ -1058,16 +1060,40 @@ function events_get_all( $custom_data_search = 'te.custom_data'; } - $sql_filters[] = vsprintf( - ' AND (lower(ta.alias) like lower("%%%s%%") - OR te.id_evento like "%%%s%%" - OR lower(te.evento) like lower("%%%s%%") - OR lower(te.user_comment) like lower("%%%s%%") - OR lower(te.id_extra) like lower("%%%s%%") - OR lower(te.source) like lower("%%%s%%") - OR lower('.$custom_data_search.') like lower("%%%s%%") )', - array_fill(0, 7, $filter['search']) - ); + $not_search = ''; + $nexo = 'OR'; + $array_search = [ + 'te.id_evento', + 'lower(te.evento)', + 'lower(te.user_comment)', + 'lower(te.id_extra)', + 'lower(te.source)', + 'lower('.$custom_data_search.')', + ]; + if (isset($filter['not_search']) === true + && empty($filter['not_search']) === false + ) { + $not_search = 'NOT'; + $nexo = 'AND'; + } else { + $array_search[] = 'lower(ta.alias)'; + } + + $sql_search = ' AND ('; + foreach ($array_search as $key => $field) { + $sql_search .= sprintf( + '%s %s %s like lower("%%%s%%")', + ($key === 0) ? '' : $nexo, + $field, + $not_search, + $filter['search'] + ); + $sql_search .= ' '; + } + + $sql_search .= ' )'; + + $sql_filters[] = $sql_search; } // Free search exclude. @@ -1152,11 +1178,19 @@ function events_get_all( // Validated or in process by. if (empty($filter['id_user_ack']) === false) { $sql_filters[] = sprintf( - ' AND te.owner_user like lower("%%%s%%") ', + ' AND te.id_usuario like lower("%%%s%%") ', $filter['id_user_ack'] ); } + // Owner by. + if (empty($filter['owner_user']) === false) { + $sql_filters[] = sprintf( + ' AND te.owner_user like lower("%%%s%%") ', + $filter['owner_user'] + ); + } + $tag_names = []; // With following tags. if (empty($filter['tag_with']) === false) { diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 9e0333965d..31c2e5214a 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1950,7 +1950,7 @@ function html_print_extended_select_for_post_process( $found = false; if ($selected) { - if (array_key_exists(number_format($selected, 14, '.', ','), $fields)) { + if (array_key_exists(number_format($selected, 14, $config['decimal_separator'], $config['thousand_separator']), $fields)) { $found = true; } } diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 443e482173..59ead9b943 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -2589,12 +2589,12 @@ function modules_get_agentmodule_data_for_humans($module) $salida = human_milliseconds_to_string($module['datos']); } } else { - $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'])); + $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])); } break; default: - $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'])); + $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])); break; } break; @@ -2613,12 +2613,12 @@ function modules_get_agentmodule_data_for_humans($module) $salida = human_milliseconds_to_string($module['datos']); } } else { - $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'])); + $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])); } break; default: - $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'])); + $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])); break; } } @@ -2900,7 +2900,7 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit } if (is_numeric($data)) { - $title .= ': '.remove_right_zeros(number_format($data, $config['graph_precision'])); + $title .= ': '.remove_right_zeros(number_format($data, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])); } else { $text = io_safe_output($data); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index cd5ac7edbd..9780ad8ce0 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -1834,14 +1834,24 @@ function reporting_event_top_n( $divisor = get_data_multiplier($units[$key_dt]); - $data['formated_value'] = format_for_graph( - $dt, - 2, - '.', - ',', - $divisor, - $units[$key_dt] - ); + if ((bool) $content['use_prefix_notation'] === false) { + $data['formated_value'] = number_format( + $dt, + 2, + $config['decimal_separator'], + $config['thousand_separator'] + ).' '.$units[$key_dt]; + } else { + $data['formated_value'] = format_for_graph( + $dt, + 2, + '.', + ',', + $divisor, + $units[$key_dt] + ); + } + $data_return[] = $data; } @@ -1902,14 +1912,25 @@ function reporting_event_top_n( $data['agent'] = $an; $data['module'] = $module_name[$key_an]; $data['value'] = $data_top[$key_an]; - $data['formated_value'] = format_for_graph( - $data_top[$key_an], - 2, - '.', - ',', - $divisor, - $units[$key_an] - ); + + if ((bool) $content['use_prefix_notation'] === false) { + $data['formated_value'] = number_format( + $data_top[$key_an], + 2, + $config['decimal_separator'], + $config['thousand_separator'] + ).' '.$units[$key_an]; + } else { + $data['formated_value'] = format_for_graph( + $data_top[$key_an], + 2, + '.', + ',', + $divisor, + $units[$key_an] + ); + } + $data_return[] = $data; } @@ -6963,6 +6984,13 @@ function reporting_value($report, $content, $type, $pdf=false) if (!$config['simple_module_value']) { $formated_value = $value; + } else if ((bool) $content['use_prefix_notation'] === false) { + $formated_value = number_format( + $value, + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] + ).' '.$unit; } else { $formated_value = format_for_graph( $value, @@ -7123,6 +7151,13 @@ function reporting_value($report, $content, $type, $pdf=false) ); if (!$config['simple_module_value']) { $formated_value = $value; + } else if ((bool) $content['use_prefix_notation'] === false) { + $formated_value = number_format( + $value, + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] + ).' '.$unit; } else { $divisor = get_data_multiplier($unit); diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 7f0679af15..77c6db2807 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2291,7 +2291,9 @@ function reporting_html_agent_module_status($table, $item, $pdf=0) $row['data_module'] = remove_right_zeros( number_format( $data['data_module'], - $config['graph_precision'] + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] ) ); } else { @@ -2784,7 +2786,7 @@ function reporting_html_historical_data($table, $item, $pdf=0) } else { $row = [ $data[__('Date')], - remove_right_zeros(number_format($data[__('Data')], $config['graph_precision'])), + remove_right_zeros(number_format($data[__('Data')], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])), ]; } @@ -2924,7 +2926,9 @@ function reporting_html_last_value($table, $item, $pdf=0) $dataDatos = remove_right_zeros( number_format( $item['data']['datos'], - $config['graph_precision'] + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] ) ); } else { @@ -3469,7 +3473,9 @@ function reporting_html_monitor_report($table, $item, $mini, $pdf=0) ).' '.__('OK').': '.remove_right_zeros( number_format( $item['data']['ok']['value'], - $config['graph_precision'] + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] ) ).' %

'; @@ -3480,7 +3486,9 @@ function reporting_html_monitor_report($table, $item, $mini, $pdf=0) ).' '.__('Not OK').': '.remove_right_zeros( number_format( $item['data']['fail']['value'], - $config['graph_precision'] + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] ) ).' % '.'

'; } @@ -3834,7 +3842,9 @@ function reporting_html_value( remove_right_zeros( number_format( $data[__('Maximun')], - $config['graph_precision'] + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] ) ), ]; diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php index cf61fec7a7..3f9fe1a6b2 100644 --- a/pandora_console/include/functions_servers.php +++ b/pandora_console/include/functions_servers.php @@ -1349,9 +1349,6 @@ function servers_get_server_string_name(int $server) case SERVER_TYPE_ENTERPRISE_SATELLITE: return __('Satellite server'); - case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL: - return __('Transactional server'); - case SERVER_TYPE_ALERT: return __('Alert server'); diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index 3fc35f4d84..be76db9459 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -193,7 +193,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') { $data = "".human_milliseconds_to_string($last_data['datos']).''; } else if (is_numeric($last_data['datos'])) { - $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).''; + $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).''; } else { $data = ui_print_truncate_text( io_safe_output($last_data['datos']), @@ -209,7 +209,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals default: if (is_numeric($last_data['datos'])) { - $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).''; + $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).''; } else { $data = ui_print_truncate_text( io_safe_output($last_data['datos']), @@ -232,7 +232,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') { $data = "".human_milliseconds_to_string($last_data['datos']).''; } else if (is_numeric($last_data['datos'])) { - $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).''; + $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).''; } else { $data = ui_print_truncate_text( io_safe_output($last_data['datos']), @@ -248,7 +248,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals default: if (is_numeric($last_data['datos'])) { - $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).''; + $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).''; } else { $data = ui_print_truncate_text( io_safe_output($last_data['datos']), @@ -271,7 +271,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals $data_macro = modules_get_unit_macro($last_data['datos'], $module['unit']); if ($data_macro) { if (is_numeric($data_macro)) { - $last_data_str = "".remove_right_zeros(number_format($data_macro, $config['graph_precision'])).''; + $last_data_str = "".remove_right_zeros(number_format($data_macro, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).''; } else { $last_data_str = ui_print_truncate_text( io_safe_output($data_macro), @@ -594,10 +594,10 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) $hashdata = $user.$pwd_deserialiced['auth_token']; $hashdata = md5($hashdata); - $url = $server_data['server_url'].'/index.php?'.'sec=estado&'.'sec2=operation/agentes/ver_agente&'.'id_agente='.$agent['id_agente'].'&'.'loginhash=auto&'."loginhash_data=$hashdata&".'loginhash_user='.str_rot13($user); + $url = $server_data['server_url'].'/index.php?'.'sec=estado&'.'sec2=operation/agentes/ver_agente&'.'id_agente='.$agent['id_agente']; if ($grants_on_node && (bool) $user_access_node !== false) { - $cellName .= ''.''.$agent['alias'].''; + $cellName .= ''.$agent['alias'].''; } else { $cellName .= ''.$agent['alias'].''; } @@ -703,7 +703,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) $go_to_agent .= html_print_submit_button(__('Edit cluster'), 'upd_button', false, 'class="sub config"', true); } } else { - $go_to_agent .= ''; + $go_to_agent .= ''; $go_to_agent .= html_print_submit_button(__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true); } @@ -905,5 +905,12 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) metaconsole_restore_db(); } - return; + echo " + "; } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index f31d02b3c5..52ad703edd 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -6592,10 +6592,11 @@ function ui_print_comments($comments) } else { $rest_time = (time() - $last_comment['utimestamp']); $time_last = (($rest_time / 60) / 60); - $comentario = ''.number_format($time_last, 0).'  Hours  ('.$last_comment['id_user'].'): '.$last_comment['comment'].''; + + $comentario = ''.number_format($time_last, 0, $config['decimal_separator'], $config['thousand_separator']).'  Hours  ('.$last_comment['id_user'].'): '.$last_comment['comment'].''; if (strlen($comentario) > '200px') { - $comentario = ''.number_format($time_last, 0).'  Hours  ('.$last_comment['id_user'].'): '.$short_comment.'...'; + $comentario = ''.number_format($time_last, 0, $config['decimal_separator'], $config['thousand_separator']).'  Hours  ('.$last_comment['id_user'].'): '.$short_comment.'...'; } } diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 0bfc8dd335..ef7ea33ca7 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -924,7 +924,7 @@ function visual_map_print_item( $value_text = format_for_graph($module_value, 2); if ($value_text <= 0) { - $value_text = remove_right_zeros(number_format($module_value, $config['graph_precision'])); + $value_text = remove_right_zeros(number_format($module_value, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])); } if (!empty($unit_text)) { @@ -1743,7 +1743,7 @@ function visual_map_print_item( || (modules_is_boolean($layoutData['id_agente_modulo']) && $layoutData['show_last_value'] != 0) ) { if (is_numeric($value)) { - $img_style_title .= '
'.__('Last value: ').remove_right_zeros(number_format($value, $config['graph_precision'])); + $img_style_title .= '
'.__('Last value: ').remove_right_zeros(number_format($value, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])); } else { $img_style_title .= '
'.__('Last value: ').$value; } @@ -1881,13 +1881,13 @@ function visual_map_print_item( echo ''; echo ""; echo ''; - echo "
".remove_right_zeros(number_format($stat_agent_cr, 2)).'%
'; + echo "
".remove_right_zeros(number_format($stat_agent_cr, 2, $config['decimal_separator'], $config['thousand_separator'])).'%
'; echo "
Critical
"; - echo "
".remove_right_zeros(number_format($stat_agent_wa, 2)).'%
'; + echo "
".remove_right_zeros(number_format($stat_agent_wa, 2, $config['decimal_separator'], $config['thousand_separator'])).'%
'; echo "
Warning
"; - echo "
".remove_right_zeros(number_format($stat_agent_ok, 2)).'%
'; + echo "
".remove_right_zeros(number_format($stat_agent_ok, 2, $config['decimal_separator'], $config['thousand_separator'])).'%
'; echo "
Normal
"; - echo "
".remove_right_zeros(number_format($stat_agent_un, 2)).'%
'; + echo "
".remove_right_zeros(number_format($stat_agent_un, 2, $config['decimal_separator'], $config['thousand_separator'])).'%
'; echo "
Unknown
"; echo ''; echo ''; @@ -2452,7 +2452,7 @@ function visual_map_get_simple_value($type, $id_module, $period=SECONDS_1DAY) } else { if (is_numeric($value)) { if ($config['simple_module_value']) { - $value = remove_right_zeros(number_format($value, $config['graph_precision'])); + $value = remove_right_zeros(number_format($value, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])); } } diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 54ec7a8927..b76abb634e 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -504,11 +504,11 @@ function flot_custom_pie_chart( foreach ($graph_values as $label => $value) { if ($value['value']) { if ($value['value'] > 1000000) { - $legendvalue = sprintf('%sM', remove_right_zeros(number_format(($value['value'] / 1000000), $config['graph_precision']))); + $legendvalue = sprintf('%sM', remove_right_zeros(number_format(($value['value'] / 1000000), $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']))); } else if ($value['value'] > 1000) { - $legendvalue = sprintf('%sK', remove_right_zeros(number_format(($value['value'] / 1000), $config['graph_precision']))); + $legendvalue = sprintf('%sK', remove_right_zeros(number_format(($value['value'] / 1000), $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']))); } else { - $legendvalue = remove_right_zeros(number_format($value['value'], $config['graph_precision'])); + $legendvalue = remove_right_zeros(number_format($value['value'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])); } } else { $legendvalue = __('No data'); diff --git a/pandora_console/include/lib/Dashboard/Widgets/module_icon.php b/pandora_console/include/lib/Dashboard/Widgets/module_icon.php index 3b1adc888b..5523a851ef 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/module_icon.php +++ b/pandora_console/include/lib/Dashboard/Widgets/module_icon.php @@ -555,7 +555,7 @@ class ModuleIconWidget extends Widget // Div value. $output .= '
'; $output .= remove_right_zeros( - number_format($data_module, $config['graph_precision']) + number_format($data_module, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']) ); $output .= '
'; diff --git a/pandora_console/include/lib/Dashboard/Widgets/module_value.php b/pandora_console/include/lib/Dashboard/Widgets/module_value.php index 41fdd41663..6577ad3c89 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/module_value.php +++ b/pandora_console/include/lib/Dashboard/Widgets/module_value.php @@ -439,7 +439,9 @@ class ModuleValueWidget extends Widget $dataDatos = remove_right_zeros( number_format( $data_module, - $config['graph_precision'] + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] ) ); } else { 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 27b400db97..50fca70543 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php @@ -397,10 +397,12 @@ final class Group extends Item string $groupName, array $agentStats ): string { - $critical = \number_format($agentStats['critical'], 2).'%'; - $warning = \number_format($agentStats['warning'], 2).'%'; - $normal = \number_format($agentStats['normal'], 2).'%'; - $unknown = \number_format($agentStats['unknown'], 2).'%'; + global $config; + + $critical = \number_format($agentStats['critical'], 2, $config['decimal_separator'], $config['thousand_separator']).'%'; + $warning = \number_format($agentStats['warning'], 2, $config['decimal_separator'], $config['thousand_separator']).'%'; + $normal = \number_format($agentStats['normal'], 2, $config['decimal_separator'], $config['thousand_separator']).'%'; + $unknown = \number_format($agentStats['unknown'], 2, $config['decimal_separator'], $config['thousand_separator']).'%'; $html = '
'; $html .= '
'; diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/Percentile.php b/pandora_console/include/rest-api/models/VisualConsole/Items/Percentile.php index 19e14f3456..657f73364d 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/Percentile.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/Percentile.php @@ -396,8 +396,8 @@ final class Percentile extends Item $data['value'] = (float) \number_format( (float) $moduleValue, (int) $config['graph_precision'], - '.', - '' + $config['decimal_separator'], + $config['thousand_separator'] ); $unit = ''; if ($moduleId !== null && $moduleId !== 0) { diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php b/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php index adeaa9c29e..4eb1ba3abc 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php @@ -281,7 +281,7 @@ final class StaticGraph extends Item ) { if (\is_numeric($value)) { $imgTitle .= __('Last value: ').\remove_right_zeros( - \number_format((float) $value, (int) $config['graph_precision']) + \number_format((float) $value, (int) $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']) ); } else { $imgTitle .= __('Last value: ').$value; diff --git a/pandora_console/include/styles/events.css b/pandora_console/include/styles/events.css index 32317e3e4c..2f43d50beb 100644 --- a/pandora_console/include/styles/events.css +++ b/pandora_console/include/styles/events.css @@ -140,6 +140,11 @@ form.flex-row div.filter_input.filter_input_switch .p-slider { width: 30px; } +form .filter_input_not_search .p-switch { + flex: 0 1 30px; + margin: 0; +} + fieldset { margin: 0 auto; } diff --git a/pandora_console/install.php b/pandora_console/install.php index 771a41889c..f336097afd 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
z_dash)) { - $array_filter->z_dash = number_format($scale, 2); + $array_filter->z_dash = number_format( + $scale, + 2, + $config['decimal_separator'], + $config['thousand_separator'] + ); } $filter = json_encode($array_filter); diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 320282e403..b0c7c3eba1 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -1589,7 +1589,7 @@ if (!empty($result)) { if (is_numeric($row['datos'])) { $data[6] = ui_print_status_image( STATUS_MODULE_OK, - __('NORMAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), + __('NORMAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])), true ); } else { @@ -1604,7 +1604,12 @@ if (!empty($result)) { $data[6] = ui_print_status_image( STATUS_MODULE_CRITICAL, __('CRITICAL').': '.remove_right_zeros( - number_format($row['datos'], $config['graph_precision']) + number_format( + $row['datos'], + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] + ) ), true ); @@ -1620,7 +1625,12 @@ if (!empty($result)) { $data[6] = ui_print_status_image( STATUS_MODULE_WARNING, __('WARNING').': '.remove_right_zeros( - number_format($row['datos'], $config['graph_precision']) + number_format( + $row['datos'], + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] + ) ), true ); @@ -1636,7 +1646,12 @@ if (!empty($result)) { $data[6] = ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').': '.remove_right_zeros( - number_format($row['datos'], $config['graph_precision']) + number_format( + $row['datos'], + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] + ) ), true ); @@ -1652,7 +1667,12 @@ if (!empty($result)) { $data[6] = ui_print_status_image( STATUS_MODULE_NO_DATA, __('NO DATA').': '.remove_right_zeros( - number_format($row['datos'], $config['graph_precision']) + number_format( + $row['datos'], + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] + ) ), true ); @@ -1672,7 +1692,7 @@ if (!empty($result)) { if (is_numeric($row['datos'])) { $data[6] = ui_print_status_image( STATUS_MODULE_UNKNOWN, - __('UNKNOWN').' - '.__('Last status').' '.__('NORMAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), + __('UNKNOWN').' - '.__('Last status').' '.__('NORMAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])), true ); } else { @@ -1688,7 +1708,7 @@ if (!empty($result)) { if (is_numeric($row['datos'])) { $data[6] = ui_print_status_image( STATUS_MODULE_UNKNOWN, - __('UNKNOWN').' - '.__('Last status').' '.__('CRITICAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), + __('UNKNOWN').' - '.__('Last status').' '.__('CRITICAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])), true ); } else { @@ -1704,7 +1724,7 @@ if (!empty($result)) { if (is_numeric($row['datos'])) { $data[6] = ui_print_status_image( STATUS_MODULE_UNKNOWN, - __('UNKNOWN').' - '.__('Last status').' '.__('WARNING').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), + __('UNKNOWN').' - '.__('Last status').' '.__('WARNING').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])), true ); } else { @@ -1849,12 +1869,12 @@ if (!empty($result)) { if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') { $salida = human_milliseconds_to_string($row['datos']); } else { - $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision'])); + $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])); } break; default: - $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision'])); + $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])); break; } break; @@ -1866,12 +1886,12 @@ if (!empty($result)) { if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') { $salida = human_milliseconds_to_string($row['datos']); } else { - $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision'])); + $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])); } break; default: - $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision'])); + $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])); break; } } diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 207377fdfc..695b99b888 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -122,6 +122,10 @@ $search = get_parameter( 'filter[search]', ($filter['search'] ?? '') ); +$not_search = get_parameter( + 'filter[not_search]', + 0 +); $text_agent = get_parameter( 'filter[text_agent]', ($filter['text_agent'] ?? '') @@ -153,6 +157,10 @@ $id_user_ack = get_parameter( 'filter[id_user_ack]', ($filter['id_user_ack'] ?? '') ); +$owner_user = get_parameter( + 'filter[owner_user]', + ($filter['owner_user'] ?? '') +); $group_rep = get_parameter( 'filter[group_rep]', ($filter['group_rep'] ?? '') @@ -1082,6 +1090,7 @@ if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false $severity = $filter['severity']; $status = $filter['status']; $search = $filter['search']; + $not_search = $filter['not_search']; $text_agent = $filter['text_agent']; $id_agent = $filter['id_agent']; $id_agent_module = $filter['id_agent_module']; @@ -1095,6 +1104,7 @@ if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false $pagination = $filter['pagination']; $event_view_hr = $filter['event_view_hr']; $id_user_ack = $filter['id_user_ack']; + $owner_user = $filter['owner_user']; $group_rep = $filter['group_rep']; $tag_with = json_decode(io_safe_output($filter['tag_with'])); $tag_without = json_decode(io_safe_output($filter['tag_without'])); @@ -1707,8 +1717,23 @@ $inputs[] = $in; // Free search. $data = html_print_input_text('search', $search, '', '', 255, true); -$in = '
'; -$in .= $data.'
'; +// Search recursive groups. +$data .= ui_print_help_tip( + __('Search for elements NOT containing given text.'), + true +); +$data .= html_print_checkbox_switch( + 'not_search', + $not_search, + $not_search, + true, + false, + 'checked_slide_events(this);', + true +); +$in = ''; $inputs[] = $in; if (is_array($severity) === false) { @@ -1747,7 +1772,7 @@ $data = html_print_checkbox_switch( $search_recursive_groups, true, false, - 'search_in_secondary_groups(this);', + 'checked_slide_events(this);', true ); @@ -1769,7 +1794,7 @@ $data = html_print_checkbox_switch( $search_secondary_groups, true, false, - 'search_in_secondary_groups(this);', + 'checked_slide_events(this);', true ); @@ -1934,6 +1959,19 @@ $in = '
'; $in .= $data.'
'; $adv_inputs[] = $in; +$data = html_print_select( + $user_users, + 'owner_user', + $owner_user, + '', + __('Any'), + 0, + true +); +$in = '
'; +$in .= $data.'
'; +$adv_inputs[] = $in; + // Only alert events. $data = html_print_select( [ @@ -3076,7 +3114,7 @@ $(document).ready( function() { }); -function search_in_secondary_groups(element) { +function checked_slide_events(element) { var value = $("#checkbox-"+element.name).val(); if (value == 0) { $("#checkbox-"+element.name).val(1); diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index d8c47f43d7..8db384eda6 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -166,8 +166,6 @@ if ($access_console_node === true) { $sub['operation/agentes/pandora_networkmap']['text'] = __('Network map'); $sub['operation/agentes/pandora_networkmap']['id'] = 'Network map'; $sub['operation/agentes/pandora_networkmap']['refr'] = 0; - - enterprise_hook('transmap_console'); } enterprise_hook('services_menu'); diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php index 9951ec528e..650bda0c36 100644 --- a/pandora_console/operation/search_results.php +++ b/pandora_console/operation/search_results.php @@ -18,7 +18,8 @@ require_once $config['homedir'].'/include/functions_reporting.php'; enterprise_include('operation/reporting/custom_reporting.php'); $searchAgents = $searchAlerts = $searchModules = check_acl($config['id_user'], 0, 'AR'); -$searchUsers = $searchPolicies = (check_acl($config['id_user'], 0, 'AR') && enterprise_installed()); +$searchUsers = (check_acl($config['id_user'], 0, 'AR')); +$searchPolicies = (check_acl($config['id_user'], 0, 'AR') && enterprise_installed()); $searchReports = $searchGraphs = check_acl($config['id_user'], 0, 'RR'); $searchMaps = check_acl($config['id_user'], 0, 'VR'); $searchMain = true; diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index c1089a36b8..3486ef7a02 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.767 -%define release 221213 +%define release 221219 # 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 445eb9bf39..6c54943ede 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.767 -%define release 221213 +%define release 221219 # 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 8b201699ed..c558e6232c 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.767 -%define release 221213 +%define release 221219 %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 31e6ce1809..fd51f8f529 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1238,6 +1238,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` ( `severity` TEXT, `status` INT NOT NULL DEFAULT -1, `search` TEXT, + `not_search` INT NOT NULL DEFAULT 0, `text_agent` TEXT, `id_agent` INT DEFAULT 0, `id_agent_module` INT DEFAULT 0, @@ -1261,6 +1262,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` ( `time_to` TIME NULL, `custom_data` VARCHAR(500) DEFAULT '', `custom_data_filter_type` TINYINT UNSIGNED DEFAULT 0, + `owner_user` TEXT, PRIMARY KEY (`id_filter`) ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; @@ -1622,6 +1624,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` ( `ipam_ip_not_assigned_to_agent` TINYINT UNSIGNED NOT NULL DEFAULT 0, `macros_definition` TEXT, `render_definition` TEXT, + `use_prefix_notation` TINYINT UNSIGNED NOT NULL DEFAULT 1, PRIMARY KEY(`id_rc`), FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) ON UPDATE CASCADE ON DELETE CASCADE @@ -3253,6 +3256,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` ( `ipam_ip_not_assigned_to_agent` TINYINT UNSIGNED NOT NULL DEFAULT 0, `macros_definition` TEXT, `render_definition` TEXT, + `use_prefix_notation` TINYINT UNSIGNED NOT NULL DEFAULT 1, PRIMARY KEY(`id_rc`) ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; @@ -3411,37 +3415,8 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` ( ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; -- --------------------------------------------------------------------- --- Table `ttransaction` +-- Table `treset_pass` -- --------------------------------------------------------------------- -CREATE TABLE IF NOT EXISTS `ttransaction` ( - `transaction_id` INT UNSIGNED NOT NULL AUTO_INCREMENT, - `agent_id` INT UNSIGNED NOT NULL, - `group_id` INT UNSIGNED NOT NULL DEFAULT 0, - `description` TEXT, - `name` VARCHAR(250) NOT NULL, - `loop_interval` INT UNSIGNED NOT NULL DEFAULT 40, - `ready` INT UNSIGNED NOT NULL DEFAULT 0, - `running` INT UNSIGNED NOT NULL DEFAULT 0, - PRIMARY KEY (`transaction_id`) -) engine=InnoDB DEFAULT CHARSET=UTF8MB4; - --- --------------------------------------------------------------------- --- Table `tphase` --- --------------------------------------------------------------------- -CREATE TABLE IF NOT EXISTS `tphase`( - `phase_id` INT UNSIGNED NOT NULL AUTO_INCREMENT, - `transaction_id` INT UNSIGNED NOT NULL, - `agent_id` INT UNSIGNED NOT NULL, - `name` VARCHAR(250) NOT NULL, - `idx` INT UNSIGNED NOT NULL, - `dependencies` TEXT, - `enables` TEXT, - `launch` TEXT, - `retries` INT UNSIGNED DEFAULT null, - `timeout` INT UNSIGNED DEFAULT null, - PRIMARY KEY (`phase_id`,`transaction_id`) -) engine=InnoDB DEFAULT CHARSET=UTF8MB4; - CREATE TABLE IF NOT EXISTS `treset_pass` ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `id_user` VARCHAR(255) NOT NULL DEFAULT '', diff --git a/pandora_plugins/MySQL/pandora_mysql.pl b/pandora_plugins/MySQL/pandora_mysql.pl index ad9c4ebaa4..356db681e0 100644 --- a/pandora_plugins/MySQL/pandora_mysql.pl +++ b/pandora_plugins/MySQL/pandora_mysql.pl @@ -303,6 +303,10 @@ sub parse_config { if ($parametro =~ m/^check\_name\s(.*)/i) { $checks[$plugin_setup{"numchecks"}]{'check_name'} = trim($1); } + + if ($parametro =~ m/^check\_type\s(.*)/i) { + $checks[$plugin_setup{"numchecks"}]{'check_type'} = trim($1); + } if ($parametro =~ m/^check\_schema\s(.*)/i) { $checks[$plugin_setup{"numchecks"}]{'check_schema'} = trim($1); @@ -1015,6 +1019,7 @@ foreach (@checks) { my $check_show = $_->{'show'}; my $return_type = $_->{'return_type'}; my $check_name = $_->{'check_name'}; + my $check_type = $_->{'check_type'}; $result_check = 0; # Process check (System parameters) @@ -1156,7 +1161,7 @@ foreach (@checks) { print_module("MySQL_" . $type . '_' . $check_show, $module_type, $result_check, '', $check_status); } else { if (defined($check_name)) { - print_module("MySQL_" . $type . "_" . $check_name, $module_type, $result_check, '', $check_status); + print_module("MySQL_" . $type . "_" . $check_name, $check_type, $result_check, '', $check_status); } else { print_module("MySQL_" . $type, $module_type, $result_check, '', $check_status); } @@ -1186,3 +1191,4 @@ foreach (@checks) { } # type ne 'unknown' } + diff --git a/pandora_plugins/intel_dcm/extensions/intel_dcm_agent_view.php b/pandora_plugins/intel_dcm/extensions/intel_dcm_agent_view.php index bdc1186044..737aa70770 100644 --- a/pandora_plugins/intel_dcm/extensions/intel_dcm_agent_view.php +++ b/pandora_plugins/intel_dcm/extensions/intel_dcm_agent_view.php @@ -142,26 +142,26 @@ function main_intel_dcm_agent_view() $sql = "SELECT description FROM tagent_custom_data WHERE id_field = $id_field_derated_power AND id_agent = $id_agent"; $derated_power = db_get_value_sql($sql); - $percent = number_format((($avg_power / $derated_power) * 100), 2); + $percent = number_format((($avg_power / $derated_power) * 100), 2, $config['decimal_separator'], $config['thousand_separator']); $data[0] = ''.__('Power utilization')." $percent%"; $data[0] .= progress_bar($percent, 400, 30, '', 2); $data[0] .= '

'; $data[0] .= ''.__('Current stats').''; $data[0] .= '

'; - $data[0] .= __('Power demand').': '.number_format($avg_power, 2).' Wh'; + $data[0] .= __('Power demand').': '.number_format($avg_power, 2, $config['decimal_separator'], $config['thousand_separator']).' Wh'; $data[0] .= '
'; - $data[0] .= __('Inlet temp').': '.number_format($avg_temp, 2).' ºC'; + $data[0] .= __('Inlet temp').': '.number_format($avg_temp, 2, $config['decimal_separator'], $config['thousand_separator']).' ºC'; $data[0] .= '


'; $data[0] .= ''.__('Last week summary').''; $data[0] .= '

'; - $data[0] .= __('Equipment energy consumed').': '.number_format($mnged_energy, 2).' Wh'; + $data[0] .= __('Equipment energy consumed').': '.number_format($mnged_energy, 2, $config['decimal_separator'], $config['thousand_separator']).' Wh'; $data[0] .= '
'; - $data[0] .= __('Equipment energy bill').': '.number_format($mnged_energy_bill, 2).' €'; + $data[0] .= __('Equipment energy bill').': '.number_format($mnged_energy_bill, 2, $config['decimal_separator'], $config['thousand_separator']).' €'; $data[0] .= '
'; - $data[0] .= __('Calculated cooling energy').': '.number_format($cooling_energy, 2).' Wh'; + $data[0] .= __('Calculated cooling energy').': '.number_format($cooling_energy, 2, $config['decimal_separator'], $config['thousand_separator']).' Wh'; $data[0] .= '
'; - $data[0] .= __('Calculated cooling energy bill').': '.number_format($cooling_energy_bill, 2).' €'; + $data[0] .= __('Calculated cooling energy bill').': '.number_format($cooling_energy_bill, 2, $config['decimal_separator'], $config['thousand_separator']).' €'; // Print avg. power graph $start_date = date('Y-m-d'); diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index 1f60dd635a..475db446e1 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.767-221213 +Version: 7.0NG.767-221219 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 e1edbb8d26..eae0fb80d5 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.767-221213" +pandora_version="7.0NG.767-221219" package_cpan=0 package_pandora=1 diff --git a/pandora_server/FreeBSD/pandora_server.conf.new b/pandora_server/FreeBSD/pandora_server.conf.new index a500453137..bbd58b5cff 100644 --- a/pandora_server/FreeBSD/pandora_server.conf.new +++ b/pandora_server/FreeBSD/pandora_server.conf.new @@ -429,14 +429,6 @@ snmpserver 1 snmp_threads 4 -# Pandora FMS TransactionalServer (PANDORA FMS ENTERPRISE ONLY). - -transactionalserver 0 - -# Threshold for the Transactional Server (PANDORA FMS ENTERPRISE ONLY). - -transactional_threshold 2 - # Block size for block producer/consumer servers, that is, the number of modules # per block (20 by default) (PANDORA FMS ENTERPRISE ONLY). diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 2a47583fa8..8332becd62 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -533,14 +533,6 @@ snmpserver 1 snmp_threads 4 -# Pandora FMS TransactionalServer (PANDORA FMS ENTERPRISE ONLY). - -transactionalserver 0 - -# Threshold for the Transactional Server (PANDORA FMS ENTERPRISE ONLY). - -transactional_threshold 2 - # Block size for block producer/consumer servers, that is, the number of modules # per block (15 by default) (PANDORA FMS ENTERPRISE ONLY). diff --git a/pandora_server/conf/pandora_server.conf.windows b/pandora_server/conf/pandora_server.conf.windows index f7eae25944..efed94ed52 100644 --- a/pandora_server/conf/pandora_server.conf.windows +++ b/pandora_server/conf/pandora_server.conf.windows @@ -430,14 +430,6 @@ snmpserver 1 snmp_threads 4 -# Pandora FMS TransactionalServer (PANDORA FMS ENTERPRISE ONLY). - -transactionalserver 0 - -# Threshold for the Transactional Server (PANDORA FMS ENTERPRISE ONLY). - -transactional_threshold 2 - # Block size for block producer/consumer servers, that is, the number of modules # per block (15 by default) (PANDORA FMS ENTERPRISE ONLY). diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index e279158276..3c0dd5aba6 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.767"; -my $pandora_build = "221213"; +my $pandora_build = "221219"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash @@ -256,8 +256,6 @@ sub pandora_load_config { $pa_config->{"inventoryserver"} = 1; # default $pa_config->{"webserver"} = 1; # 3.0 $pa_config->{"web_timeout"} = 60; # 6.0SP5 - $pa_config->{"transactionalserver"} = 0; # Default 0, introduced on 6.1 - $pa_config->{"transactional_threshold"} = 2; # Default 2, introduced on 6.1 $pa_config->{"transactional_pool"} = $pa_config->{"incomingdir"} . "/" . "trans"; # Default, introduced on 6.1 $pa_config->{'snmp_logfile'} = "/var/log/pandora_snmptrap.log"; $pa_config->{"network_threads"} = 3; # Fixed default @@ -776,12 +774,6 @@ sub pandora_load_config { elsif ($parametro =~ m/^web_timeout\s+([0-9]*)/i) { $pa_config->{'web_timeout'}= clean_blank($1); } - elsif ($parametro =~ m/^transactionalserver\s+([0-9]*)/i) { - $pa_config->{'transactionalserver'}= clean_blank($1); - } - elsif ($parametro =~ m/^transactional_threshold\s+([0-9]*\.{0,1}[0-9]*)/i) { - $pa_config->{'transactional_threshold'}= clean_blank($1); - } if ($parametro =~ m/^transactional_pool\s(.*)/i) { $tbuf= clean_blank($1); if ($tbuf =~ m/^\.(.*)/){ diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 8261acef29..e4bf6eeaae 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -299,7 +299,6 @@ our @ServerTypes = qw ( icmpserver snmpserver satelliteserver - transactionalserver mfserver syncserver wuxserver diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index 4fde88b237..629ff8ae60 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.767"; -my $pandora_build = "221213"; +my $pandora_build = "221219"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index f922e75854..590fdf2020 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -72,7 +72,6 @@ our @EXPORT = qw( SNMPSERVER SATELLITESERVER MFSERVER - TRANSACTIONALSERVER SYNCSERVER SYSLOGSERVER WUXSERVER @@ -2837,7 +2836,6 @@ sub get_server_name { return "ICMPSERVER" if ($server_type eq ICMPSERVER); return "SNMPSERVER" if ($server_type eq SNMPSERVER); return "SATELLITESERVER" if ($server_type eq SATELLITESERVER); - return "TRANSACTIONALSERVER" if ($server_type eq TRANSACTIONALSERVER); return "MFSERVER" if ($server_type eq MFSERVER); return "SYNCSERVER" if ($server_type eq SYNCSERVER); return "WUXSERVER" if ($server_type eq WUXSERVER); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 6b61da4141..a90946ab0e 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.767 -%define release 221213 +%define release 221219 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index b64cc93145..85e797d10f 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.767 -%define release 221213 +%define release 221219 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 2206cc4a0b..1118d2f6df 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.767" -PI_BUILD="221213" +PI_BUILD="221219" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index f321258252..a5e9d8a8f2 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.767 Build 221213"; +my $version = "7.0NG.767 Build 221219"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 9e2e117129..7d0f85e7fd 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.767 Build 221213"; +my $version = "7.0NG.767 Build 221219"; # save program name for logging my $progname = basename($0); diff --git a/pandora_server/util/plugin/pandora_snmp_bandwidth.pl b/pandora_server/util/plugin/pandora_snmp_bandwidth.pl index 3eb2b4fb53..9b28848b48 100755 --- a/pandora_server/util/plugin/pandora_snmp_bandwidth.pl +++ b/pandora_server/util/plugin/pandora_snmp_bandwidth.pl @@ -2,7 +2,7 @@ # ################################################################################ # -# Bandwith usage plugin +# Bandwidth usage plugin # # Requirements: # snmpget @@ -55,7 +55,7 @@ Where OPTIONS could be: [EXTRA] -ifIndex Target interface to retrieve, if not specified, total - bandwith will be reported. + bandwidth will be reported. -uniqid Use custom temporary file name. -inUsage Show only input usage (in percentage) - 1, or not 0. -outUsage Show only output usage (in percentage) - 1, or not 0. @@ -66,7 +66,7 @@ e.g. -v is equal to -version, -c to -community, etc. EO_HELP use constant { - UNKNOWN_DUPLEX => 0, + UNKNOWN_DUPLEX => 1, HALF_DUPLEX => 2, FULL_DUPLEX => 3, }; @@ -133,9 +133,9 @@ sub update_config_key ($) { if ($arg eq 'inUsage') { return "inUsage"; } - if ($arg eq 'outUsage') { - return "outUsage"; - } + if ($arg eq 'outUsage') { + return "outUsage"; + } } ################################################################################ @@ -188,7 +188,7 @@ sub prepare_tree { my $inOctets = snmp_get(\%inOctets_call); if (ref($inOctets) eq "HASH") { - if ($inOctets->{'data'} eq '') { + if (! exists($inOctets->{'data'}) || $inOctets->{'data'} eq '') { $inOctets = 0; } else { $inOctets = int $inOctets->{'data'}; @@ -198,18 +198,18 @@ sub prepare_tree { next; } - my %outOctets_call = %{$config}; - if (is_enabled($config->{'use_x64'})) { - $outOctets_call{'oid'} = $config->{'oid_base'}; - $outOctets_call{'oid'} .= $config->{'x64_indexes'}{'outOctets'}.$ifIndex; - } else { - $outOctets_call{'oid'} = $config->{'oid_base'}; - $outOctets_call{'oid'} .= $config->{'x86_indexes'}{'outOctets'}.$ifIndex; - } + my %outOctets_call = %{$config}; + if (is_enabled($config->{'use_x64'})) { + $outOctets_call{'oid'} = $config->{'oid_base'}; + $outOctets_call{'oid'} .= $config->{'x64_indexes'}{'outOctets'}.$ifIndex; + } else { + $outOctets_call{'oid'} = $config->{'oid_base'}; + $outOctets_call{'oid'} .= $config->{'x86_indexes'}{'outOctets'}.$ifIndex; + } my $outOctets = snmp_get(\%outOctets_call); if (ref($outOctets) eq "HASH") { - if ($outOctets->{'data'} eq '') { + if (! exists($outOctets->{'data'}) || $outOctets->{'data'} eq '') { $outOctets = 0; } else { $outOctets = int $outOctets->{'data'}; @@ -220,28 +220,27 @@ sub prepare_tree { } my %duplex_call = %{$config}; - if (is_enabled($config->{'use_x64'})) { - $duplex_call{'oid'} = $config->{'oid_base'}; - $duplex_call{'oid'} .= $config->{'x64_indexes'}{'duplex'}.$ifIndex; - } else { - $duplex_call{'oid'} = $config->{'oid_base'}; - $duplex_call{'oid'} .= $config->{'x86_indexes'}{'duplex'}.$ifIndex; - } + if (is_enabled($config->{'use_x64'})) { + $duplex_call{'oid'} = $config->{'oid_base'}; + $duplex_call{'oid'} .= $config->{'x64_indexes'}{'duplex'}.$ifIndex; + } else { + $duplex_call{'oid'} = $config->{'oid_base'}; + $duplex_call{'oid'} .= $config->{'x86_indexes'}{'duplex'}.$ifIndex; + } my $duplex = snmp_get(\%duplex_call); if (ref($duplex) eq "HASH") { - if ($duplex->{'data'} eq '') { + if (! exists($duplex->{'data'}) || $duplex->{'data'} eq '') { $duplex = 0; } else { $duplex = int $duplex->{'data'}; } - } else { # Ignore, cannot retrieve inOctets. next; } - my %speed = %{$config}; + my %speed = %{$config}; if (is_enabled($config->{'use_x64'})) { $speed{'oid'} = $config->{'oid_base'}; $speed{'oid'} .= $config->{'x64_indexes'}{'ifSpeed'}.$ifIndex; @@ -492,9 +491,9 @@ $config->{'tmp_separator'} = ';' if empty($config->{'tmp_separator'}); $config->{'tmp'} = (($^O =~ /win/)?$ENV{'TMP'}:'/tmp') if empty($config->{'tmp'}); # Create unique name for tmp and log file for host -my $filename = $config->{'tmp'}.'/pandora_bandwith_'.$config->{'host'}; +my $filename = $config->{'tmp'}.'/pandora_bandwidth_'.$config->{'host'}; if (!empty($config->{'uniqid'})) { - $filename = $config->{'tmp'}.'/pandora_bandwith_'.$config->{'uniqid'}; + $filename = $config->{'tmp'}.'/pandora_bandwidth_'.$config->{'uniqid'}; } # Replace every dot for underscore $filename =~ tr/./_/; @@ -511,7 +510,7 @@ if ( defined($sysobjectid->{'error'}) || $sysobjectid->{'data'} eq '' ) { # Check SNMP x64 interfaces my $walk64 = snmp_walk({%{$config}, 'oid' => '.1.3.6.1.2.1.31.1.1.1.6'}); -if ( $walk64 =~ 'No Such Instance currently exists at this OID' || $walk64 =~ 'No more variables left in this MIB View') { +if ( $walk64 !~ /.*\.[0-9]+ = Counter64: [0-9]+/ ) { $config->{'use_x64'} = 0; } else { $config->{'use_x64'} = 1; @@ -556,35 +555,35 @@ my $j = 0; my $k = 0; foreach my $iface (keys %{$analysis_tree}) { # Calculate summary; - if (is_enabled($analysis_tree->{$iface}{'bandwidth'})) { - $bandwidth = $analysis_tree->{$iface}{'bandwidth'}; + if (is_enabled($analysis_tree->{$iface}{'bandwidth'}) || $analysis_tree->{$iface}{'bandwidth'} == 0) { + $bandwidth += $analysis_tree->{$iface}{'bandwidth'}; $i++; } - if (is_enabled($analysis_tree->{$iface}{'inUsage'})) { - $inUsage = $analysis_tree->{$iface}{'inUsage'}; + if (is_enabled($analysis_tree->{$iface}{'inUsage'}) || $analysis_tree->{$iface}{'inUsage'} == 0) { + $inUsage += $analysis_tree->{$iface}{'inUsage'}; $j++; } - if (is_enabled($analysis_tree->{$iface}{'outUsage'})) { - $outUsage = $analysis_tree->{$iface}{'outUsage'}; + if (is_enabled($analysis_tree->{$iface}{'outUsage'}) || $analysis_tree->{$iface}{'inUsage'} == 0) { + $outUsage += $analysis_tree->{$iface}{'outUsage'}; $k++; } } if ($j > 0 && is_enabled($config->{'inUsage'})) { - $inUsage /= $j; - print sprintf("%.9f\n", $inUsage); + $inUsage /= $j; + print sprintf("%.9f\n", $inUsage); } elsif ($k > 0 && is_enabled($config->{'outUsage'})) { - $outUsage /= $k; - print sprintf("%.9f\n", $outUsage); + $outUsage /= $k; + print sprintf("%.9f\n", $outUsage); } if ($i > 0 && !is_enabled($config->{'inUsage'}) && !is_enabled($config->{'outUsage'}) ) { - $bandwidth /= $i; - print sprintf("%.9f\n", $bandwidth); + $bandwidth /= $i; + print sprintf("%.9f\n", $bandwidth); } logger($config, 'info', "Plugin ends") if (is_enabled($config->{'debug'}));