diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 20c3b4b06b..763978bce8 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.739-191011 +Version: 7.0NG.739-191021 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 c9ae4c3432..7421b18a9f 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.739-191011" +pandora_version="7.0NG.739-191021" 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 da90764344..6de679d7fe 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.739'; -use constant AGENT_BUILD => '191011'; +use constant AGENT_BUILD => '191021'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 5eef934b38..2439e91ca5 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.739 -%define release 191011 +%define release 191021 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 cdcdc8dada..2e03b08789 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.739 -%define release 191011 +%define release 191021 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 fce0f526b8..91f719a4e2 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.739" -PI_BUILD="191011" +PI_BUILD="191021" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 53f8fed466..786a817cb6 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{191011} +{191021} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 66f2e17ce5..88a235b6e2 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.739(Build 191011)") +#define PANDORA_VERSION ("7.0NG.739(Build 191021)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 741fd096c8..82fe0caeb3 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.739(Build 191011))" + VALUE "ProductVersion", "(7.0NG.739(Build 191021))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index c9f68147ae..765d6a1e0b 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.739-191011 +Version: 7.0NG.739-191021 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 a8ef06811d..fea794764e 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.739-191011" +pandora_version="7.0NG.739-191021" package_pear=0 package_pandora=1 diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 6ee2343fc0..d6b9448576 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -765,7 +765,7 @@ $table_adv_agent_icon .= html_print_select( ).''; if ($config['activate_gis']) { - $table_adv_gis = '

'.__('Ignore new GIS data:').'

'; + $table_adv_gis = '

'.__('Update new GIS data:').'

'; if ($new_agent) { $update_gis_data = true; } diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php index 0126aa93f9..83001be810 100755 --- a/pandora_console/godmode/massive/massive_edit_agents.php +++ b/pandora_console/godmode/massive/massive_edit_agents.php @@ -59,8 +59,10 @@ if ($update_agents) { $values['id_grupo'] = get_parameter('group'); } - if (get_parameter('interval', 0) != 0) { - $values['intervalo'] = get_parameter('interval'); + if (!(get_parameter('interval_select') == -1 && empty(get_parameter('interval_text')))) { + if (get_parameter('interval', 0) != 0) { + $values['intervalo'] = get_parameter('interval'); + } } if (get_parameter('id_os', '') != -1) { @@ -523,7 +525,7 @@ $table->data[1][1] = html_print_select_groups(false, 'AR', false, 'group', $grou $table->data[2][0] = __('Interval'); -$table->data[2][1] = html_print_extended_select_for_time('interval', 0, '', __('No change'), '0', 10, true, 'width: 150px'); +$table->data[2][1] = html_print_extended_select_for_time('interval', 0, '', __('No change'), '0', 10, true, 'width: 150px', false); $table->data[3][0] = __('OS'); $table->data[3][1] = html_print_select_from_sql( diff --git a/pandora_console/godmode/reporting/graph_container.php b/pandora_console/godmode/reporting/graph_container.php index ccc3b6dde6..3b87fc63e3 100644 --- a/pandora_console/godmode/reporting/graph_container.php +++ b/pandora_console/godmode/reporting/graph_container.php @@ -16,10 +16,10 @@ global $config; // Check user credentials check_login(); -if (! check_acl($config['id_user'], 0, 'RR')) { +if (! check_acl($config['id_user'], 0, 'RR') || enterprise_installed() === false) { db_pandora_audit( 'ACL Violation', - 'Trying to access Inventory Module Management' + 'Trying to access Graph container' ); include 'general/noaccess.php'; return; diff --git a/pandora_console/godmode/reporting/graphs.php b/pandora_console/godmode/reporting/graphs.php index fd8d3cff84..1fba644037 100644 --- a/pandora_console/godmode/reporting/graphs.php +++ b/pandora_console/godmode/reporting/graphs.php @@ -71,10 +71,12 @@ switch ($activeTab) { break; } -$buttons['graph_container'] = [ - 'active' => false, - 'text' => ''.html_print_image('images/graph-container.png', true, ['title' => __('Graphs containers')]).'', -]; +if ($enterpriseEnable) { + $buttons['graph_container'] = [ + 'active' => false, + 'text' => ''.html_print_image('images/graph-container.png', true, ['title' => __('Graphs containers')]).'', + ]; +} $delete_graph = (bool) get_parameter('delete_graph'); $view_graph = (bool) get_parameter('view_graph'); diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 45993ec38e..1322095990 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -3144,17 +3144,19 @@ if ($enterpriseEnable && defined('METACONSOLE')) { break; } - ui_print_page_header( - $textReportName, - 'images/op_reporting.png', - false, - $helpers, - false, - $buttons, - false, - '', - 60 - ); + if ($action !== 'update') { + ui_print_page_header( + $textReportName, + 'images/op_reporting.png', + false, + $helpers, + false, + $buttons, + false, + '', + 60 + ); + } } if ($resultOperationDB !== null) { @@ -3176,6 +3178,24 @@ if ($resultOperationDB !== null) { __('Successfull action'), __('Unsuccessful action

'.$err) ); + + if ($action == 'update') { + $buttons[$activeTab]['active'] = false; + $activeTab = 'list_items'; + $buttons[$activeTab]['active'] = true; + + ui_print_page_header( + $textReportName, + 'images/op_reporting.png', + false, + $helpers, + false, + $buttons, + false, + '', + 60 + ); + } } switch ($activeTab) { diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index 3eb385332c..79fcfc61a2 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.php @@ -928,10 +928,10 @@ if (($create != '') || ($view != '')) { $other['plugin_type'] = $plugin_meta['plugin_type']; $other['macros'] = urlencode($plugin_meta['macros']); $other['parameters'] = urlencode($plugin_meta['parameters']); - $other = implode('%7C', $other); + $other = implode('%7E', $other); $auth_token = json_decode($value['auth_token']); - $url = $value['server_url'].'include/api.php?op=set&op2=push_plugin'.'&id='.$pluginid.'&other_mode=url_encode_separator_%7C&other='.$other."&apipass=$auth_token->api_password"."&user=$auth_token->console_user&pass=$auth_token->console_password"; + $url = $value['server_url'].'include/api.php?op=set&op2=push_plugin'.'&id='.$pluginid.'&other_mode=url_encode_separator_%7E&other='.$other."&apipass=$auth_token->api_password"."&user=$auth_token->console_user&pass=$auth_token->console_password"; $file_path = realpath($plugin_meta['execute']); $post = ''; if (file_exists($file_path)) { diff --git a/pandora_console/godmode/users/configure_profile.php b/pandora_console/godmode/users/configure_profile.php index 418add8aa8..8c69c0e0a9 100644 --- a/pandora_console/godmode/users/configure_profile.php +++ b/pandora_console/godmode/users/configure_profile.php @@ -18,7 +18,7 @@ check_login(); enterprise_hook('open_meta_frame'); -if (! check_acl($config['id_user'], 0, 'PM')) { +if (! check_acl($config['id_user'], 0, 'UM')) { db_pandora_audit( 'ACL Violation', 'Trying to access Profile Management' @@ -320,24 +320,29 @@ if ($id_profile || $new_profile) { $table->data['IM'] = $row; $table->data[] = '
'; + $disable_option = 'javascript: return false;'; + if (check_acl($config['id_user'], 0, 'PM') || users_is_admin()) { + $disable_option = ''; + } + // Users $row = []; $row['name'] = __('Manage users'); - $row['input'] = html_print_checkbox('user_management', 1, $user_management, true); + $row['input'] = html_print_checkbox('user_management', 1, $user_management, true, false, $disable_option); $table->data['UM'] = $row; $table->data[] = '
'; // DB $row = []; $row['name'] = __('Manage database'); - $row['input'] = html_print_checkbox('db_management', 1, $db_management, true); + $row['input'] = html_print_checkbox('db_management', 1, $db_management, true, false, $disable_option); $table->data['DM'] = $row; $table->data[] = '
'; // Pandora $row = []; $row['name'] = __('%s management', get_product_name()); - $row['input'] = html_print_checkbox('pandora_management', 1, $pandora_management, true); + $row['input'] = html_print_checkbox('pandora_management', 1, $pandora_management, true, false, $disable_option); $table->data['PM'] = $row; $table->data[] = '
'; @@ -359,3 +364,18 @@ if ($id_profile || $new_profile) { } enterprise_hook('close_meta_frame'); + +?> + + diff --git a/pandora_console/godmode/users/profile_list.php b/pandora_console/godmode/users/profile_list.php index da77dffd9f..a87323f0f8 100644 --- a/pandora_console/godmode/users/profile_list.php +++ b/pandora_console/godmode/users/profile_list.php @@ -362,7 +362,10 @@ foreach ($profiles as $profile) { $data['PM'] = ($profile['pandora_management'] ? $img : ''); $table->cellclass[]['operations'] = 'action_buttons'; $data['operations'] = ''.html_print_image('images/config.png', true, ['title' => __('Edit')]).''; - $data['operations'] .= ''.html_print_image('images/cross.png', true).''; + if (check_acl($config['id_user'], 0, 'PM') || users_is_admin()) { + $data['operations'] .= ''.html_print_image('images/cross.png', true).''; + } + array_push($table->data, $data); } diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index 4e8cfbb2c1..6a02f4bb57 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -420,7 +420,9 @@ else { $u = get_user_info($key); $g = users_get_groups($key, 'AR', $u['is_admin']); $result = array_intersect($g, $own_groups); - if (!$usr['is_admin'] && !empty($result)) { + + // Show users without profile too. + if (!$usr['is_admin'] && !empty($result) || (!$usr['is_admin'] && db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $usr['id_user']) === false)) { $info[$key] = $usr; } diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index b659ff82e1..09d8018039 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 = 'PC191011'; +$build_version = 'PC191021'; $pandora_version = 'v7.0NG.739'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 7aa5278a7e..2473b5c2af 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -6225,9 +6225,8 @@ function api_set_planned_downtimes_created($id, $thrash1, $other, $thrash3) return; } - $date_from = strtotime(html_entity_decode($other['data'][1])); - $date_to = strtotime(html_entity_decode($other['data'][2])); - + $date_from = strtotime(html_entity_decode($other['data'][1].' '.$other['data'][11])); + $date_to = strtotime(html_entity_decode($other['data'][2].' '.$other['data'][12])); $values = []; $values['name'] = $id; $values = [ diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index ccbe7f6dd2..9563732c68 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -4615,7 +4615,7 @@ function events_page_comments($event, $ajax=false) foreach ($comm as $c) { $data[0] = ''.$c['action'].' by '.$c['id_user'].''; $data[0] .= '

'.date($config['date_format'], $c['utimestamp']).''; - $data[1] = $c['comment']; + $data[1] = '

'.$c['comment'].'

'; $table_comments->data[] = $data; } } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 4ad8294ae1..359eedbe10 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -3609,7 +3609,7 @@ function graph_custom_sql_graph( $sql = io_safe_output($sql['sql']); } - if (($config['metaconsole'] == 1) && defined('METACONSOLE')) { + if (($config['metaconsole'] == 1) && defined('METACONSOLE') && $report_content['server_name'] != '' && $report_content['server_name'] != '0') { $metaconsole_connection = enterprise_hook('metaconsole_get_connection', [$report_content['server_name']]); if ($metaconsole_connection === false) { @@ -3624,7 +3624,7 @@ function graph_custom_sql_graph( $data_result = db_get_all_rows_sql($sql, $historical_db); - if (($config['metaconsole'] == 1) && defined('METACONSOLE')) { + if (($config['metaconsole'] == 1) && defined('METACONSOLE') && $report_content['server_name'] != '' && $report_content['server_name'] != '0') { enterprise_hook('metaconsole_restore_db'); } diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index e4fb19e814..dda25538ee 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -2327,7 +2327,13 @@ function migrate_older_open_maps($id) $new_map_filter = []; $new_map_filter['dont_show_subgroups'] = $old_networkmap['dont_show_subgroups']; $new_map_filter['node_radius'] = 40; - $new_map_filter['id_migrate_map'] = $id; + $new_map_filter['x_offs'] = 0; + $new_map_filter['y_offs'] = 0; + $new_map_filter['z_dash'] = '0.5'; + $new_map_filter['node_sep'] = '0.1'; + $new_map_filter['rank_sep'] = 1; + $new_map_filter['mindist'] = 1; + $new_map_filter['kval'] = '0.1'; $map_values['filter'] = json_encode($new_map_filter); $map_values['description'] = 'Mapa open migrado'; @@ -2340,11 +2346,7 @@ function migrate_older_open_maps($id) $map_values['source_period'] = 60; $map_values['source'] = 0; $map_values['source_data'] = $old_networkmap['id_group']; - if ($old_networkmap['type'] == 'radial_dinamic') { - $map_values['generation_method'] = 6; - } else { - $map_values['generation_method'] = 4; - } + $map_values['generation_method'] = 3; $map_values['generated'] = 0; diff --git a/pandora_console/include/functions_planned_downtimes.php b/pandora_console/include/functions_planned_downtimes.php index 1147ad97a8..a9b701241b 100644 --- a/pandora_console/include/functions_planned_downtimes.php +++ b/pandora_console/include/functions_planned_downtimes.php @@ -796,6 +796,11 @@ function planned_downtimes_created($values) 'return' => false, 'message' => __('Not created. Error inserting data').'. '.__('There is no group with such id'), ]; + } else if (!$values['date_from'] || !$values['date_to']) { + return [ + 'return' => false, + 'message' => __('Not created. Error inserting data').'. '.__('Date is wrong formatted'), + ]; } else { if (trim(io_safe_output($values['name'])) != '') { if (!$check) { diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 86f180ad09..a54bce17de 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -4193,6 +4193,7 @@ function reporting_sql_graph( switch ($type) { case 'dinamic': case 'static': + case 'data': $return['chart'] = graph_custom_sql_graph( $content['id_rc'], $width, @@ -4204,9 +4205,6 @@ function reporting_sql_graph( $content['top_n_value'] ); break; - - case 'data': - break; } return reporting_check_structure_content($return); @@ -4406,6 +4404,7 @@ function reporting_netflow( switch ($type) { case 'dinamic': case 'static': + case 'data': $return['chart'] = netflow_draw_item( ($report['datetime'] - $content['period']), $report['datetime'], @@ -7561,8 +7560,26 @@ function reporting_custom_graph( $content['name'] = __('Simple graph'); } + $id_agent = agents_get_module_id( + $content['id_agent_module'] + ); + $id_agent_module = $content['id_agent_module']; + $agent_description = agents_get_description($id_agent); + $agent_group = agents_get_agent_group($id_agent); + $agent_address = agents_get_address($id_agent); + $agent_alias = agents_get_alias($id_agent); + $module_name = modules_get_agentmodule_name( + $id_agent_module + ); + + $module_description = modules_get_agentmodule_descripcion( + $id_agent_module + ); + $return['title'] = $content['name']; $return['subtitle'] = io_safe_output($graph['name']); + $return['agent_name'] = $agent_alias; + $return['module_name'] = $module_name; $return['description'] = $content['description']; $return['date'] = reporting_get_date_text( $report, @@ -7576,6 +7593,7 @@ function reporting_custom_graph( switch ($type) { case 'dinamic': case 'static': + case 'data': $params = [ 'period' => $content['period'], 'width' => $width, diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 577e8e11ff..6da735618b 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -39,7 +39,7 @@ if (isset($config['homedir'])) { /** - * Transform bbcode to HTML. + * Transform bbcode to HTML and truncate log. * * @param string $text Text. * @param array $allowed_tags Allowed_tags. @@ -48,16 +48,22 @@ if (isset($config['homedir'])) { */ function ui_bbcode_to_html($text, $allowed_tags=['[url]']) { - if (array_search('[url]', $allowed_tags) !== false) { - // If link hasn't http, add it. - if (preg_match('/https?:\/\//', $text)) { - $html_bbcode = '$2'; - } else { - $html_bbcode = '$2'; - } - + if (array_search('[url]', $allowed_tags) !== false || a) { // Replace bbcode format [url=www.example.org] String [/url] with or without http and slashes - $return = preg_replace('/\[url(?|](((?:https?:\/\/)?[^[]+))|(?:=[\'"]?((?:https?:\/\/)?[^]]+?)[\'"]?)](.+?))\[\/url]/', $html_bbcode, $text); + preg_match('/\[url(?|](((?:https?:\/\/)?[^[]+))|(?:=[\'"]?((?:https?:\/\/)?[^]]+?)[\'"]?)](.+?))\[\/url]/', $text, $matches); + if ($matches) { + $url = $matches[1]; + // Truncate text + $t_text = ui_print_truncate_text($matches[2]); + // If link hasn't http, add it. + if (preg_match('/https?:\/\//', $text)) { + $return = ''.$t_text.''; + } else { + $return = ''.$t_text.''; + } + } else { + $return = ui_print_truncate_text($text); + } } return $return; @@ -5655,3 +5661,63 @@ function ui_print_breadcrums($tab_name) return $section; } + + +/** + * Show last comment + * + * @param array $comments array with comments + * + * @return string HTML string with the last comment of the events. + */ +function ui_print_comments($comments) +{ + global $config; + + $comments = explode('
', $comments); + $comments = str_replace(["\n", ' '], '
', $comments); + if (is_array($comments)) { + foreach ($comments as $comm) { + if (empty($comm)) { + continue; + } + + $comments_array[] = json_decode(io_safe_output($comm), true); + } + } + + foreach ($comments_array as $comm) { + // Show the comments more recent first. + if (is_array($comm)) { + $last_comment[] = array_reverse($comm); + } + } + + // Only show the last comment. If commment its too long,the comment will short with ... + // If $config['prominent_time'] is timestamp the date show Month, day, hour and minutes. + // Else show comments hours ago + + if ($last_comment[0][0]['action'] != 'Added comment'){ + $last_comment[0][0]['comment'] = $last_comment[0][0]['action']; + } + + $short_comment = substr($last_comment[0][0]['comment'], 0, '80px'); + if ($config['prominent_time'] == 'timestamp') { + $comentario = ''.date($config['date_format'], $last_comment[0][0]['utimestamp']).' ('.$last_comment[0][0]['id_user'].'): '.$last_comment[0][0]['comment'].''; + + if (strlen($comentario) > '200px') { + $comentario = ''.date($config['date_format'], $last_comment[0][0]['utimestamp']).' ('.$last_comment[0][0]['id_user'].'): '.$short_comment.'...'; + } + } else { + $rest_time = (time() - $last_comment[0][0]['utimestamp']); + $time_last = (($rest_time / 60) / 60); + $comentario = ''.number_format($time_last, 0).'  Hours  ('.$last_comment[0][0]['id_user'].'): '.$last_comment[0][0]['comment'].''; + + if (strlen($comentario) > '200px') { + $comentario = ''.number_format($time_last, 0).'  Hours  ('.$last_comment[0][0]['id_user'].'): '.$short_comment.'...'; + } + } + + return io_safe_output($comentario); + +} diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index 0fb6c1a6ef..79668406e1 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -63,6 +63,20 @@ function show_event_dialog(event, dialog_page, result) { height: 600 }) .show(); + $.post({ + url: "ajax.php", + data: { + page: "include/ajax/events", + get_comments: 1, + event: event, + filter: values + }, + dataType: "html", + success: function(data) { + $("#extended_event_comments_page").empty(); + $("#extended_event_comments_page").html(data); + } + }); $("#refrcounter").countdown("pause"); $("div.vc-countdown").countdown("pause"); diff --git a/pandora_console/include/styles/login.css b/pandora_console/include/styles/login.css index 8edd7d46c0..f6c072b314 100644 --- a/pandora_console/include/styles/login.css +++ b/pandora_console/include/styles/login.css @@ -261,6 +261,7 @@ div.login_button_saml input:hover { .login_back input { background-image: url("../../images/back_login.png"); background-position: left 5% center; + background-repeat: no-repeat; } .login_back input:hover { diff --git a/pandora_console/install.php b/pandora_console/install.php index f1e4aa5eb7..bf88307227 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
graph_type == 'boolean') { + $fullscale = 1; + } else { + $fullscale = 0; + } + } + ob_start(); switch ($this->graph_type) { case 'boolean': @@ -188,6 +201,7 @@ class ModuleGraph 'menu' => false, 'type_graph' => $config['type_module_charts'], 'vconsole' => true, + 'fullscale' => $fullscale, ]; $graph = grafico_modulo_sparse($params); diff --git a/pandora_console/operation/agentes/gis_view.php b/pandora_console/operation/agentes/gis_view.php index 139f8f8ae9..352b66f7af 100644 --- a/pandora_console/operation/agentes/gis_view.php +++ b/pandora_console/operation/agentes/gis_view.php @@ -97,17 +97,6 @@ echo ''; html_print_submit_button(__('Refresh path'), 'refresh', false, 'class = "sub upd" style="margin-top:0px"'); echo ''; -// Get the total number of Elements for the pagination -$sqlCount = sprintf( - 'SELECT COUNT(*) - FROM tgis_data_history - WHERE tagente_id_agente = %d AND end_timestamp > FROM_UNIXTIME(%d) - ORDER BY end_timestamp DESC', - $agentId, - (get_system_time() - $period) -); -$countData = (int) db_get_value_sql($sqlCount); - // Get the elements to present in this page switch ($config['dbtype']) { case 'mysql': @@ -147,33 +136,39 @@ switch ($config['dbtype']) { $result = db_get_all_rows_sql($sql, true); -if ($result === false) { - $sql2 = sprintf( - ' - SELECT current_longitude AS longitude, current_latitude AS latitude, current_altitude AS altitude, - start_timestamp, description, number_of_packages, manual_placement - FROM tgis_data_status - WHERE tagente_id_agente = %d - ORDER BY start_timestamp DESC - LIMIT %d OFFSET %d', - $agentId, - $config['block_size'], - (int) get_parameter('offset') - ); +$sql2 = sprintf( + ' + SELECT current_longitude AS longitude, current_latitude AS latitude, current_altitude AS altitude, + start_timestamp, description, number_of_packages, manual_placement + FROM tgis_data_status + WHERE tagente_id_agente = %d + ORDER BY start_timestamp DESC + LIMIT %d OFFSET %d', + $agentId, + $config['block_size'], + (int) get_parameter('offset') +); $result2 = db_get_all_rows_sql($sql2, true); - if ($result2 === false) { +if ($result === false && $result2 === false) { ui_print_empty_data(__('This agent doesn\'t have any GIS data.')); +} else { + if ($result === false) { + $result = $result2; } else { $result2[0]['end_timestamp'] = date('Y-m-d H:i:s'); - $result = $result2; + array_unshift($result, $result2[0]); } } + if ($result !== false) { echo '

'.__('Positional data from the last').' '.human_time_description_raw($period).'

'; + // Get the total elements for UI pagination + $countData = count($result); + if ($countData > 0) { ui_pagination($countData, false); } diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 77f3d2c8a5..2ee34806d9 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -713,11 +713,7 @@ if (is_ajax()) { $values['options'] = json_encode($options); - $return_update = db_process_sql_update('tnetworkmap_enterprise', $values, ['id' => $id_ent_map]); - if (!$return_update) { - $return_data['ent'] = false; - break; - } + db_process_sql_update('tnetworkmap_enterprise', $values, ['id' => $id_ent_map]); } } } @@ -735,11 +731,7 @@ if (is_ajax()) { } else { $values['text_filter'] = 'migrated'; - $return_update = db_process_sql_update('tnetwork_map', $values, ['id_networkmap' => $id_open_map]); - if (!$return_update) { - $return_data['open'] = false; - break; - } + db_process_sql_update('tnetwork_map', $values, ['id_networkmap' => $id_open_map]); } } } diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index ece97f1f9a..bc9c59eda5 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -280,6 +280,14 @@ if (is_ajax()) { $events, function ($carry, $item) { $tmp = (object) $item; + $tmp->meta = is_metaconsole(); + if (is_metaconsole()) { + if ($tmp->server_name !== null) { + $tmp->data_server = metaconsole_get_servers($tmp->server_id); + $tmp->server_url_hash = metaconsole_get_servers_url_hash($tmp->data_server); + } + } + $tmp->evento = str_replace('"', '', io_safe_output($tmp->evento)); if (strlen($tmp->evento) >= 255) { $tmp->evento = ui_print_truncate_text($tmp->evento, 255, $tmp->evento, true, false); @@ -289,6 +297,10 @@ if (is_ajax()) { $tmp->module_name = io_safe_output($tmp->module_name); } + if ($tmp->comments) { + $tmp->comments = ui_print_comments($tmp->comments); + } + $tmp->agent_name = io_safe_output($tmp->agent_name); $tmp->ack_utimestamp = ui_print_timestamp( $tmp->ack_utimestamp, @@ -1594,6 +1606,28 @@ function process_datatables_callback(table, settings) { function process_datatables_item(item) { + // Url to go to node from meta. + var server_url = ''; + var hashdata = ''; + if(item.meta === true){ + if(typeof item.data_server !== 'undefined' && typeof item.server_url_hash !== 'undefined'){ + server_url = item.data_server.server_url; + hashdata = item.server_url_hash; + } + } + + + // Show comments events. + item.user_comment = item.comments + + if(item.comments.length > 80){ + + item.user_comment += '  '; + item.user_comment += ' __('Show more')]); ?>'; + + } + // Grouped events. if(item.max_id_evento) { item.id_evento = item.max_id_evento @@ -1828,9 +1862,19 @@ function process_datatables_item(item) { /* Update column content now to avoid json poisoning. */ + + // Url to agent view. + var url_link = ''; + var url_link_hash = ''; + if(item.meta === true){ + url_link = server_url+'/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='; + url_link_hash = hashdata; + } + + /* Agent name link */ if (item.id_agente > 0) { - item.agent_name = '' + item.agent_name + ''; + item.agent_name = '' + item.agent_name + ''; } else { item.agent_name = ''; } @@ -1840,11 +1884,11 @@ function process_datatables_item(item) { - item.id_agente = '' + item.id_agente + ''; + item.id_agente = '' + item.id_agente + ''; - item.id_agente = '' + item.agent_name + ''; + item.id_agente = '' + item.agent_name + ''; diff --git a/pandora_console/operation/search_policies.getdata.php b/pandora_console/operation/search_policies.getdata.php index 5186f1f0a9..1274b17076 100644 --- a/pandora_console/operation/search_policies.getdata.php +++ b/pandora_console/operation/search_policies.getdata.php @@ -18,6 +18,11 @@ enterprise_include_once('include/functions_policies.php'); $searchpolicies = check_acl($config['id_user'], 0, 'AW'); +if (!$searchpolicies) { + $totalPolicies = 0; + return; +} + $selectpolicieIDUp = ''; $selectpolicieIDDown = ''; $selectNameUp = ''; @@ -169,7 +174,7 @@ switch ($sortField) { break; } -if ($searchpolicies == 0) { +if ($searchpolicies) { /* We take the user groups to get policies that meet the requirements of the search and which the user have permission on this groups @@ -189,6 +194,7 @@ if ($searchpolicies == 0) { $policies = db_process_sql($sql); + if ($policies !== false) { $totalPolicies = count($policies); diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php index 803a92cdd1..b856f5f14e 100644 --- a/pandora_console/operation/search_results.php +++ b/pandora_console/operation/search_results.php @@ -18,7 +18,7 @@ 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, 'AW'); +$searchUsers = $searchPolicies = check_acl($config['id_user'], 0, 'AR'); $searchMaps = $searchReports = $searchGraphs = check_acl($config['id_user'], 0, 'IR'); $searchMain = true; $searchHelps = true; diff --git a/pandora_console/operation/search_users.getdata.php b/pandora_console/operation/search_users.getdata.php index a39cdf70f1..5e67c90059 100644 --- a/pandora_console/operation/search_users.getdata.php +++ b/pandora_console/operation/search_users.getdata.php @@ -18,6 +18,10 @@ require_once $config['homedir'].'/include/functions_users.php'; require_once $config['homedir'].'/include/functions_groups.php'; $searchUsers = check_acl($config['id_user'], 0, 'UM'); +if (!$searchUsers) { + $totalUsers = 0; + return; +} $selectUserIDUp = ''; $selectUserIDDown = ''; diff --git a/pandora_console/operation/search_users.php b/pandora_console/operation/search_users.php index 8014d5a261..b2232a44f9 100755 --- a/pandora_console/operation/search_users.php +++ b/pandora_console/operation/search_users.php @@ -91,7 +91,7 @@ if (!$users || !$searchUsers) { } echo '
'; - ui_pagination($totalUsers); + // ui_pagination($totalUsers); html_print_table($table); unset($table); ui_pagination($totalUsers); diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index ec065a6a52..fcc719dfaa 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -462,6 +462,8 @@ $autorefresh_list_out['operation/agentes/status_monitor'] = 'Monitor detail'; $autorefresh_list_out['enterprise/operation/services/services'] = 'Services'; $autorefresh_list_out['enterprise/dashboard/main_dashboard'] = 'Dashboard'; $autorefresh_list_out['operation/reporting/graph_viewer'] = 'Graph Viewer'; +$autorefresh_list_out['operation/gis_maps/render_view'] = 'Gis Map'; + $autorefresh_list_out['operation/snmpconsole/snmp_view'] = 'SNMP console'; $autorefresh_list_out['operation/agentes/pandora_networkmap'] = 'Network map'; $autorefresh_list_out['operation/visual_console/render_view'] = 'Visual console'; @@ -1150,7 +1152,7 @@ function ehorus_connection_test(host, port) { var user = $('input#text-ehorus_user_level_user').val(); var pass = $('input#password-ehorus_user_level_pass').val(); - debugger; + var badRequestMessage = ''; var notFoundMessage = ''; var invalidPassMessage = ''; diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index cae8f193b4..0a1f1c162b 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.739 -%define release 191011 +%define release 191021 # 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 0c90f95bce..3ae086053c 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.739 -%define release 191011 +%define release 191021 # 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 e940d7d7be..2a60d06855 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.739 -%define release 191011 +%define release 191021 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index 648d764014..306acbb484 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.739-191011 +Version: 7.0NG.739-191021 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 4443ae3b67..8da95e20c8 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.739-191011" +pandora_version="7.0NG.739-191021" package_cpan=0 package_pandora=1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index c5a6c7555c..5f163fa1df 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -45,7 +45,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.739"; -my $pandora_build = "191011"; +my $pandora_build = "191021"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index ef8a9c18bf..ae67d5ca70 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -1141,21 +1141,21 @@ sub pandora_execute_action ($$$$$$$$$;$) { #logger($pa_config, "Clean name ".$clean_name, 10); # User defined alert if ($action->{'internal'} == 0) { - $macros{_field1_} = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module); - $macros{_field2_} = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module); - $macros{_field3_} = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module); - $macros{_field4_} = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module); - $macros{_field5_} = subst_alert_macros ($field5, \%macros, $pa_config, $dbh, $agent, $module); - $macros{_field6_} = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module); - $macros{_field7_} = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module); - $macros{_field8_} = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module); - $macros{_field9_} = subst_alert_macros ($field9, \%macros, $pa_config, $dbh, $agent, $module); - $macros{_field10_} = subst_alert_macros ($field10, \%macros, $pa_config, $dbh, $agent, $module); - $macros{_field11_} = subst_alert_macros ($field11, \%macros, $pa_config, $dbh, $agent, $module); - $macros{_field12_} = subst_alert_macros ($field12, \%macros, $pa_config, $dbh, $agent, $module); - $macros{_field13_} = subst_alert_macros ($field13, \%macros, $pa_config, $dbh, $agent, $module); - $macros{_field14_} = subst_alert_macros ($field14, \%macros, $pa_config, $dbh, $agent, $module); - $macros{_field15_} = subst_alert_macros ($field15, \%macros, $pa_config, $dbh, $agent, $module); + $macros{_field1_} = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $macros{_field2_} = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $macros{_field3_} = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $macros{_field4_} = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $macros{_field5_} = subst_alert_macros ($field5, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $macros{_field6_} = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $macros{_field7_} = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $macros{_field8_} = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $macros{_field9_} = subst_alert_macros ($field9, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $macros{_field10_} = subst_alert_macros ($field10, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $macros{_field11_} = subst_alert_macros ($field11, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $macros{_field12_} = subst_alert_macros ($field12, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $macros{_field13_} = subst_alert_macros ($field13, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $macros{_field14_} = subst_alert_macros ($field14, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $macros{_field15_} = subst_alert_macros ($field15, \%macros, $pa_config, $dbh, $agent, $module, $alert); my @command_args = (); # divide command into words based on quotes and whitespaces @@ -1186,7 +1186,7 @@ sub pandora_execute_action ($$$$$$$$$;$) { # Internal Audit } elsif ($clean_name eq "Internal Audit") { - $field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module); + $field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert); pandora_audit ($pa_config, $field1, defined ($agent) ? safe_output($agent->{'alias'}) : 'N/A', 'Alert (' . safe_output($alert->{'description'}) . ')', $dbh); # Email @@ -1363,12 +1363,12 @@ sub pandora_execute_action ($$$$$$$$$;$) { # Pandora FMS Event } elsif ($clean_name eq "Monitoring Event") { - $field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module); - $field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module); - $field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module); - $field6 = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module); - $field7 = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module); - $field8 = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module); + $field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field6 = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field7 = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field8 = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module, $alert); # Field 1 (event text) my $event_text = $field1; @@ -1448,13 +1448,13 @@ sub pandora_execute_action ($$$$$$$$$;$) { my $config_api_pass = pandora_get_tconfig_token ($dbh, 'integria_api_pass', ''); my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', ''); my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', ''); - $field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module); - $field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module); - $field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module); - $field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module); - $field5 = subst_alert_macros ($field5, \%macros, $pa_config, $dbh, $agent, $module); - $field6 = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module); - $field7 = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module); + $field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field5 = subst_alert_macros ($field5, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field6 = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module, $alert); + $field7 = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module, $alert); # Field 1 (Integria IMS API path) my $api_path = $config_api_path . "/integria/include/api.php"; @@ -1513,8 +1513,7 @@ sub pandora_execute_action ($$$$$$$$$;$) { } elsif ($clean_name eq "Generate Notification") { # Translate macros - $field3 = subst_alert_macros($field3, \%macros, $pa_config, $dbh, $agent, $module); - $field4 = subst_alert_macros($field4, \%macros, $pa_config, $dbh, $agent, $module); + $field3 = subst_alert_macros($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert); # If no targets ignore notification if (defined($field1) && defined($field2) && ($field1 ne "" || $field2 ne "")) { diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index b7beb919a3..df1cbbecfb 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -230,7 +230,7 @@ sub data_consumer ($$) { } # Ignore the timestamp in the XML and use the file timestamp instead - $xml_data->{'timestamp'} = strftime ("%Y-%m-%d %H:%M:%S", localtime((stat($file_name))[9])) if ($pa_config->{'use_xml_timestamp'} eq '1' || ! defined ($xml_data->{'timestamp'})); + $xml_data->{'timestamp'} = strftime ("%Y-%m-%d %H:%M:%S", localtime((stat($file_name))[9])) if ($pa_config->{'use_xml_timestamp'} eq '0' || ! defined ($xml_data->{'timestamp'})); # Double check that the file exists if (! -f $file_name) { diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index 0bca361e0f..456289bcd1 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -32,7 +32,7 @@ our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.739"; -my $pandora_build = "191011"; +my $pandora_build = "191021"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); @@ -762,7 +762,7 @@ sub transfer_xml { my $file_path; if (! (empty ($name))) { - $file_name = $name . "." . sprintf("%d",time()) . ".data"; + $file_name = $name . "." . sprintf("%d",getCurrentUTimeMilis(). (rand()*10000)) . ".data"; } else { # Inherit file name diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index df9d5b3901..114718ca6e 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -641,19 +641,29 @@ sub logger ($$;$) { # Set the security level my $security_level = 'info'; if ($level < 2) { - $security = 'crit'; + $security_level = 'crit'; } elsif ($level < 5) { - $security = 'warn'; + $security_level = 'warn'; } openlog('pandora_server', 'ndelay', 'daemon'); syslog($security_level, $message); closelog(); } else { + # Obtain the script that invoke this log + my $parent_caller = ""; + $parent_caller = ( caller(2) )[1]; + if (defined $parent_caller) { + $parent_caller = (split '/', $parent_caller)[-1]; + $parent_caller =~ s/\.[^.]+$//; + $parent_caller = " ** " . $parent_caller . " **: "; + } else { + $parent_caller = " "; + } open (FILE, ">> $file") or die "[FATAL] Could not open logfile '$file'"; # Get an exclusive lock on the file (LOCK_EX) flock (FILE, 2); - print FILE strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " " . (defined($pa_config->{'servername'}) ? $pa_config->{'servername'} : '') . " [V". $level ."] " . $message . "\n"; + print FILE strftime ("%Y-%m-%d %H:%M:%S", localtime()) . $parent_caller . (defined($pa_config->{'servername'}) ? $pa_config->{'servername'} : '') . " [V". $level ."] " . $message . "\n"; close (FILE); } } diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index d7629ec337..56c5642692 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.739 -%define release 191011 +%define release 191021 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index af6ddfb37b..0126b94e51 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.739 -%define release 191011 +%define release 191021 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 71f5bcee08..fb63dcb9ca 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.739" -PI_BUILD="191011" +PI_BUILD="191021" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 32f76783cb..7f6be51884 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.739 PS191011"; +my $version = "7.0NG.739 PS191021"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index f6d73cd4b0..7883021a33 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.739 PS191011"; +my $version = "7.0NG.739 PS191021"; # save program name for logging my $progname = basename($0);