From 718cf41098133bd5fb22a5298ad153fb6f390239 Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 3 Nov 2023 12:16:54 +0100 Subject: [PATCH 01/10] Fix btn csv datatables pandora_enterprise#12370 --- pandora_console/include/styles/pandora.css | 6 ------ pandora_console/include/styles/tables.css | 2 -- pandora_console/views/cluster/list.php | 14 ++++++++------ 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 63179618b1..759acca415 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -12741,12 +12741,6 @@ div.agents_custom_fields #datatables_wrapper div.bottom { justify-content: flex-start !important; } -.dt-buttons { - width: auto; - position: absolute; - margin-left: 90px; -} - .title_tactical { padding: 10px 0px 10px 0px; text-align: center; diff --git a/pandora_console/include/styles/tables.css b/pandora_console/include/styles/tables.css index 0e4879220a..b0129d5968 100644 --- a/pandora_console/include/styles/tables.css +++ b/pandora_console/include/styles/tables.css @@ -369,8 +369,6 @@ a.pandora_pagination.current:hover { font-size: 20px; height: 38px; width: 80px; - margin-left: 90px; - display: flex; justify-content: space-between; flex-direction: row; diff --git a/pandora_console/views/cluster/list.php b/pandora_console/views/cluster/list.php index 39c00efd91..78b6b25698 100644 --- a/pandora_console/views/cluster/list.php +++ b/pandora_console/views/cluster/list.php @@ -120,6 +120,7 @@ try { echo $e->getMessage(); } +$buttons = []; if (check_acl($config['id_user'], 0, 'AW')) { $buttons[] = html_print_submit_button( __('New cluster'), @@ -131,10 +132,11 @@ if (check_acl($config['id_user'], 0, 'AW')) { ], true ); - echo '
'; - html_print_action_buttons( - implode('', $buttons), - ['type' => 'form_action'] - ); - echo '
'; } + +echo '
'; +html_print_action_buttons( + implode('', $buttons), + ['type' => 'form_action'] +); +echo '
'; From a0e1274ee6286d5c346ffc7e7c40913b9d8f1963 Mon Sep 17 00:00:00 2001 From: Calvo Date: Mon, 6 Nov 2023 13:30:49 +0100 Subject: [PATCH 02/10] Added server conf option for self monitoring agent name --- pandora_console/include/lib/TacticalView/Element.php | 8 +++++++- pandora_server/bin/pandora_server | 2 ++ pandora_server/conf/pandora_server.conf.new | 3 +++ pandora_server/lib/PandoraFMS/Config.pm | 6 ++++++ pandora_server/lib/PandoraFMS/Core.pm | 8 ++++---- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/lib/TacticalView/Element.php b/pandora_console/include/lib/TacticalView/Element.php index 8e81d4fd15..a0a534a31e 100644 --- a/pandora_console/include/lib/TacticalView/Element.php +++ b/pandora_console/include/lib/TacticalView/Element.php @@ -79,11 +79,17 @@ class Element public function __construct( $ajax_controller='include/ajax/general_tactical_view.ajax' ) { + global $config; $this->interval = 0; $this->title = __('Default element'); $this->ajaxController = $ajax_controller; // Without ACL. - $agent = db_get_row('tagente', 'nombre', 'pandora.internals', '*'); + $agent_name = $config['self_monitoring_agent_name']; + if (empty($agent_name) === true) { + $agent_name = 'pandora.internals'; + } + + $agent = db_get_row('tagente', 'nombre', $agent_name, '*'); if (is_array($agent) === true) { $this->monitoringAgent = $agent; } diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server index eaf6f48968..619a00e1b6 100755 --- a/pandora_server/bin/pandora_server +++ b/pandora_server/bin/pandora_server @@ -818,6 +818,8 @@ sub main() { && $Config{"self_monitoring"} == 1 && !is_metaconsole(\%Config) && time() - $thr_time_ref > $Config{'self_monitoring_interval'}) { + # Update agent name token. + pandora_set_tconfig_token($DBH, 'self_monitoring_agent_name', $Config{'self_monitoring_agent_name'}); $thr_time_ref = time(); pandora_thread_monitoring (\%Config, $DBH, \@Servers); } diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 33ab26d411..2e485501e4 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -422,6 +422,9 @@ self_monitoring 1 # Self monitoring interval (in seconds). self_monitoring_interval 300 +# Self monitoring agent name. +self_monitoring_agent_name pandora.internals + # Update parent from the agent xml update_parent 1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index da4ef06822..53911f5c3f 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -416,6 +416,9 @@ sub pandora_load_config { # Self monitoring interval $pa_config->{'self_monitoring_interval'} = 300; # 5.1SP1 + # Self monitoring agent name. + $pa_config->{'self_monitoring_agent_name'} = 'pandora.internals'; # 7.774 + # Process XML data files as a stack $pa_config->{"dataserver_lifo"} = 0; # 5.0 @@ -1041,6 +1044,9 @@ sub pandora_load_config { elsif ($parametro =~ m/^self_monitoring_interval\s+([0-9]*)/i) { $pa_config->{'self_monitoring_interval'} = clean_blank($1); } + elsif ($parametro =~ m/^self_monitoring_agent_name\s+(.*)/i) { + $pa_config->{'self_monitoring_agent_name'} = clean_blank($1); + } elsif ($parametro =~ m/^update_parent\s+([0-1])/i) { $pa_config->{'update_parent'} = clean_blank($1); } diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index e047cd7500..afd3e8e865 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -6315,7 +6315,7 @@ sub pandora_self_monitoring ($$) { my $xml_output = ""; - $xml_output = "{'version'} . "' agent_name='pandora.internals' agent_alias='pandora.internals' interval='".$pa_config->{"self_monitoring_interval"}."' timestamp='".$timestamp."' >"; + $xml_output = "{'version'} . "' agent_name='" . $pa_config->{"self_monitoring_agent_name"} . "' agent_alias='" . $pa_config->{"self_monitoring_agent_name"} . "' interval='".$pa_config->{"self_monitoring_interval"}."' timestamp='".$timestamp."' >"; $xml_output .=" "; $xml_output .=" Status"; $xml_output .=" generic_proc"; @@ -6514,7 +6514,7 @@ sub pandora_self_monitoring ($$) { $xml_output .= ""; - my $filename = $pa_config->{"incomingdir"}."/pandora.internals.self".$utimestamp.".data"; + my $filename = $pa_config->{"incomingdir"}."/".$pa_config->{"self_monitoring_agent_name"}.".self".$utimestamp.".data"; open (XMLFILE, ">", $filename) or die "[FATAL] Could not open internal monitoring XML file for deploying monitorization at '$filename'"; print XMLFILE $xml_output; close (XMLFILE); @@ -6539,7 +6539,7 @@ sub pandora_thread_monitoring ($$$) { # All trhead modules are "Status" module sons. $module_parent = 'Status'; - $xml_output = "{'version'} . "' agent_name='pandora.internals' agent_alias='pandora.internals' interval='".$pa_config->{"self_monitoring_interval"}."' timestamp='".$timestamp."' >"; + $xml_output = "{'version'} . "' agent_name='" . $pa_config->{'self_monitoring_agent_name'} . "' agent_alias='pandora.internals' interval='".$pa_config->{"self_monitoring_interval"}."' timestamp='".$timestamp."' >"; foreach my $server (@{$servers}) { my $producer_stats = $server->getProducerStats(); while (my ($tid, $stats) = each(%{$producer_stats})) { @@ -6605,7 +6605,7 @@ sub pandora_thread_monitoring ($$$) { } $xml_output .= ""; - my $filename = $pa_config->{"incomingdir"}."/pandora.internals.threads.".$utimestamp.".data"; + my $filename = $pa_config->{"incomingdir"}."/".$pa_config->{'self_monitoring_agent_name'}.".threads.".$utimestamp.".data"; open (XMLFILE, ">", $filename) or die "[FATAL] Could not write to the thread monitoring XML file '$filename'"; print XMLFILE $xml_output; close (XMLFILE); From 7b7370659ebd18204a084dc08b83e932d7fb9af1 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 7 Nov 2023 11:11:08 +0100 Subject: [PATCH 03/10] Fix home screen external link pandora_enterprise#12413 --- .../godmode/users/configure_user.php | 83 ++----------------- .../godmode/users/user_management.php | 55 ++++++++---- 2 files changed, 48 insertions(+), 90 deletions(-) diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 08040f839c..c2089ab298 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -33,8 +33,6 @@ check_login(); require_once $config['homedir'].'/vendor/autoload.php'; -use PandoraFMS\Dashboard\Manager; - require_once $config['homedir'].'/include/functions_profile.php'; require_once $config['homedir'].'/include/functions_users.php'; require_once $config['homedir'].'/include/functions_groups.php'; @@ -1376,72 +1374,6 @@ if (is_metaconsole() === true) { ); } -$values = [ - -1 => __('Use global conf'), - 1 => __('Yes'), - 0 => __('No'), -]; - -$home_screen = '

'.__('Home screen').ui_print_help_tip( - __('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1 to show agent detail view'), - true -).'

'; - -$dashboards = Manager::getDashboards( - -1, - -1, - false, - false, - $id_usr -); - -$dashboards_aux = []; -if ($dashboards === false) { - $dashboards = ['None' => 'None']; -} else { - foreach ($dashboards as $key => $dashboard) { - $dashboards_aux[$dashboard['id']] = $dashboard['name']; - } -} - -$home_screen .= ''; - -$layouts = visual_map_get_user_layouts($config['id_user'], true); -$layouts_aux = []; -if ($layouts === false) { - $layouts_aux = ['None' => 'None']; -} else { - foreach ($layouts as $layout) { - $layouts_aux[$layout] = $layout; - } -} - -$home_screen .= ''; - -$home_screen .= html_print_input_text( - 'data_section', - $user_info['data_section'], - '', - 60, - 255, - true, - false -); - -$home_screen = ''; - $size_pagination = '

'.__('Block size for pagination').'

'; $size_pagination .= html_print_input_text( 'block_size', @@ -2078,17 +2010,20 @@ if (is_metaconsole() === false) { } function show_data_section() { - var $section = $("#section").val(); - var $allElements = $('div[id^="custom_home_screen_"]'); - var $elementSelected = $('div[id="custom_home_screen_' + $section + '"]'); + var section = $("#section").val(); + if(section === 'other'){ + section = 'external_link'; + } + var allElements = $('div[id^="custom_home_screen_"]'); + var elementSelected = $('div[id="custom_home_screen_' + section + '"]'); // Hide all elements. - $allElements.each(function() { + allElements.each(function() { $(this).addClass('invisible'); $(this).children().addClass('invisible'); }) // Show only the selected. - $elementSelected.removeClass('invisible'); - $elementSelected.children().removeClass('invisible'); + elementSelected.removeClass('invisible'); + elementSelected.children().removeClass('invisible'); } function switch_ehorus_conf() { diff --git a/pandora_console/godmode/users/user_management.php b/pandora_console/godmode/users/user_management.php index 6d5f9bf18b..95def919c2 100644 --- a/pandora_console/godmode/users/user_management.php +++ b/pandora_console/godmode/users/user_management.php @@ -48,13 +48,44 @@ $homeScreenValues = [ // Custom Home Screen controls. $customHomeScreenAddition = []; // Home screen. Dashboard. -$customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%'); +$customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select( + $dashboards_aux, + 'dashboard', + $user_info['data_section'], + '', + '', + '', + true, + false, + true, + 'w100p', + false, + 'width: 100%' +); // Home screen. Visual consoles. -$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%'); +$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select( + $layouts_aux, + 'visual_console', + $user_info['data_section'], + '', + '', + '', + true, + false, + true, + 'w100p', + false, + 'width: 100%' +); // Home screen. External link and Other. -$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true); -$customHomeScreenAddition[HOME_SCREEN_OTHER] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true); - +$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text( + 'data_section', + $user_info['data_section'], + '', + 60, + 255, + true +); $customHomeScreenDataField = ''; foreach ($customHomeScreenAddition as $key => $customField) { $customHomeScreenDataField .= html_print_div( @@ -576,7 +607,7 @@ $userManagementTable->data['fields_autorefreshTime'][0] .= ui_print_input_placeh true ); -// eHorus conf +// EHorus conf. if (isset($config['ehorus_user_level_conf']) === true && (bool) $config['ehorus_user_level_conf'] === true) { $userManagementTable->data['captions_ehorus_user_level_enabled'][1] = __('Pandora RC user access enabled'); $userManagementTable->data['fields_ehorus_user_level_enabled'][1] = html_print_checkbox_switch( @@ -791,7 +822,7 @@ $userManagementTable->data['fields_addSettings'][0] = html_print_textarea( 5, 65, $user_info['comments'], - ($view_mode ? 'readonly="readonly"' : ''), + ($view_mode) ? 'readonly="readonly"' : '', true, '' ); @@ -945,15 +976,7 @@ $(document).ready(function () { $('#advanced-line1_looknfeel-1 > a').css('display', 'block'); }) - var ehorus_user_level_enabled = - - ; + var ehorus_user_level_enabled = ''; var chk_ehorus_user_level_enabled = ehorus_user_level_enabled; if (ehorus_user_level_enabled == 0) { From 65dbef9889eb8a30325b384aee72482585b8203f Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 7 Nov 2023 11:57:24 +0100 Subject: [PATCH 04/10] Fix list CV pagination pandora_enterprise#12414 --- .../godmode/reporting/map_builder.php | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 53db920b2b..d879bb5a5a 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -571,6 +571,7 @@ if (!$maps && is_metaconsole() === false) { } if ($maps || is_metaconsole() === true) { + $buttons = ''; if ($vconsoles_write || $vconsoles_manage) { if (is_metaconsole() === false) { $actionUrl = 'index.php?sec=network&sec2=godmode/reporting/visual_console_builder'; @@ -578,20 +579,22 @@ if ($maps || is_metaconsole() === true) { $actionUrl = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&action2=new&operation=new_visualmap&tab=data&pure='.$pure; } - echo '
'; - html_print_input_hidden('edit_layout', 1); + $buttons .= ''; + $buttons .= html_print_input_hidden('edit_layout', 1, true); - html_print_action_buttons( - html_print_submit_button( - __('Create'), - '', - false, - [ 'icon' => 'next'], - true - ), - [ 'right_content' => $tablePagination ] + $buttons .= html_print_submit_button( + __('Create'), + '', + false, + [ 'icon' => 'next'], + true ); - echo '
'; + $buttons .= ''; } + + html_print_action_buttons( + $buttons, + [ 'right_content' => $tablePagination ] + ); } From 8f8e5ecf453a960fdf01abe3241ad8fb64920fc1 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Tue, 7 Nov 2023 13:18:44 +0100 Subject: [PATCH 05/10] #12376 multiple changes in general tactical view --- .../agentes/module_manager_editor_common.php | 2 +- .../godmode/setup/setup_visuals.php | 9 ++ pandora_console/include/functions_config.php | 8 + pandora_console/include/functions_graph.php | 37 ++++- pandora_console/include/graphs/fgraph.php | 6 + .../javascript/general_tactical_view.js | 137 ++++++++++++++++++ .../lib/TacticalView/GeneralTacticalView.php | 17 +++ .../lib/TacticalView/elements/Agents.php | 17 +++ .../lib/TacticalView/elements/Database.php | 2 + .../lib/TacticalView/elements/Events.php | 49 ++++--- .../lib/TacticalView/elements/Groups.php | 17 ++- .../elements/MonitoringElements.php | 18 ++- .../lib/TacticalView/elements/Overview.php | 4 + .../include/styles/general_tactical_view.css | 26 +++- pandora_console/operation/events/events.php | 5 +- pandora_console/views/tacticalView/view.php | 120 +++++++-------- 16 files changed, 378 insertions(+), 96 deletions(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index ca74b7d171..de08a299de 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -1387,7 +1387,7 @@ $table_advanced->data['made_enabled'][0] = html_print_checkbox_switch( 'made_enabled', 1, (bool) $made_enabled, - false, + true, false, '', false, diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 6379f86d3a..4336da55b9 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -2129,6 +2129,15 @@ $table_other->data[$row][] = html_print_label_input_block( __('Data multiplier to use in graphs/data'), html_print_select($options_data_multiplier, 'use_data_multiplier', $config['use_data_multiplier'], '', '', 1, true, false, false) ); +$table_other->data[$row][] = html_print_label_input_block( + __('Disable general statistics in main tactical view'), + html_print_checkbox_switch( + 'disable_general_statistics', + 1, + $config['disable_general_statistics'], + true + ) +); $row++; /* diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 1fe38aac0b..a09e3f1706 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1568,6 +1568,10 @@ function config_update_config() $error_update[] = __('Use data multiplier'); } + if (config_update_value('disable_general_statistics', get_parameter('disable_general_statistics', 0), true) === false) { + $error_update[] = __('Disable general statistics'); + } + if (config_update_value('decimal_separator', (string) get_parameter('decimal_separator', '.'), true) === false) { $error_update[] = __('Decimal separator'); } else { @@ -3703,6 +3707,10 @@ function config_process_config() config_update_value('use_data_multiplier', '1'); } + if (!isset($config['disable_general_statistics'])) { + config_update_value('disable_general_statistics', 0); + } + if (!isset($config['command_snapshot'])) { config_update_value('command_snapshot', 1); } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 3ba76b17d0..d1c31f95b0 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -27,6 +27,8 @@ * ============================================================================ */ +use Models\VisualConsole\Items\Percentile; + require_once $config['homedir'].'/include/graphs/fgraph.php'; require_once $config['homedir'].'/include/functions_reporting.php'; require_once $config['homedir'].'/include/functions_agents.php'; @@ -2686,7 +2688,9 @@ function graph_agent_status( $return=false, $show_not_init=false, $data_agents=false, - $donut_narrow_graph=false + $donut_narrow_graph=false, + $onClick='', + $data_in_percentage=false, ) { global $config; @@ -2766,6 +2770,25 @@ function graph_agent_status( 'labels' => array_keys($data), ]; + if (empty($onClick) === false) { + $options['onClick'] = $onClick; + } + + if ($data_in_percentage === true) { + $percentages = []; + $total = array_sum($data); + foreach ($data as $key => $value) { + $percentage = (($value / $total) * 100); + if ($percentage < 1 && $percentage > 0) { + $percentage = 1; + } + + $percentages[$key] = format_numeric($percentage, 0); + } + + $data = $percentages; + } + if ($donut_narrow_graph == true) { $out = ring_graph( $data, @@ -4625,9 +4648,15 @@ function graph_nodata_image($options) return base64_encode($dataImg); } - $widthImage = '200px'; + $style = ''; if (isset($options['nodata_image']['width']) === true) { - $widthImage = $options['nodata_image']['width']; + $style .= 'width: '.$options['nodata_image']['width'].'; '; + } else { + $style .= 'width: 200px; '; + } + + if (isset($options['nodata_image']['height']) === true) { + $style .= 'height: '.$options['nodata_image']['height'].'; '; } return html_print_image( @@ -4635,7 +4664,7 @@ function graph_nodata_image($options) true, [ 'title' => __('No data'), - 'style' => 'width: '.$widthImage.';', + 'style' => $style, ] ); } diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 5e5818357b..afb2154cfe 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -669,6 +669,12 @@ function get_build_setup_charts($type, $options, $data) $chart->setId($id); + if (isset($options['onClick']) === true + && empty($options['onClick']) === false + ) { + $chart->options()->setOnClick($options['onClick']); + } + // Height is null maximum possible. if (isset($options['height']) === true && empty($options['height']) === false diff --git a/pandora_console/include/javascript/general_tactical_view.js b/pandora_console/include/javascript/general_tactical_view.js index b671c56103..5761f4b51f 100644 --- a/pandora_console/include/javascript/general_tactical_view.js +++ b/pandora_console/include/javascript/general_tactical_view.js @@ -73,8 +73,40 @@ $(document).ready(function() { $("#heatmap-title").html($(title).html()); } }); + rescaling(); + + $(window).on("resize", function() { + rescaling(); + }); }); +function showLabel(element, event, label) { + $(".label_heatmap").remove(); + const tooltip = $(document.createElement("div")); + tooltip.html(label); + tooltip.attr("class", "label_heatmap"); + $("#heatmap-group").append(tooltip); + var x = event.clientX; + var y = event.clientY; + tooltip.attr( + "style", + "position: fixed; top:" + (y + 15) + "px; left:" + (x + 20) + "px;" + ); +} + +function hideLabel() { + $(".label_heatmap").remove(); +} + +function rescaling() { + if (window.innerWidth < 1300) { + $(".trigger-100").attr("style", "width: 100%;"); + $(".trigger-100").addClass("br-b"); + } else { + $(".trigger-100").removeAttr("style"); + $(".trigger-100").removeClass("br-b"); + } +} function autoRefresh(interval, id, method, php_class) { setInterval(() => { $.ajax({ @@ -92,3 +124,108 @@ function autoRefresh(interval, id, method, php_class) { }); }, interval); } + +function redirectStatus(e, element) { + if (element.length > 0) { + switch (e.chart.legend.legendItems[element[0].index].text) { + case "Critical": + window.location.assign( + `index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group=0&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=1&sort_field=&sort=none&pure=` + ); + break; + + case "Warning": + window.location.assign( + `index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group=0&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=2&sort_field=&sort=none&pure=` + ); + break; + + case "Unknown": + window.location.assign( + `index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group=0&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=3&sort_field=&sort=none&pure=` + ); + break; + + case "Not init": + window.location.assign( + `index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group=0&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=5&sort_field=&sort=none&pure=` + ); + break; + + default: + window.location.assign( + `index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group=0&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=-1&sort_field=&sort=none&pure=` + ); + break; + } + } +} + +function redirectHeatmap(view, id, id_agente = 0) { + switch (view) { + case "group": + window.location.assign( + `index.php?sec=view&sec2=godmode/groups/tactical&id_group=${id}` + ); + break; + + case "agent": + window.location.assign( + `index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=${id}` + ); + break; + + case "module": + if (id_agente > 0) { + window.location.assign( + `index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=${id_agente}&tab=module&id_agent_module=${id}&edit_module=1` + ); + } + break; + + default: + break; + } +} + +function redirectAgentStatus(e, element) { + if (element.length > 0) { + switch (e.chart.legend.legendItems[element[0].index].text) { + case "No monitors": + window.location.assign( + `index.php?sec=view&sec2=operation/agentes/estado_agente` + ); + break; + + case "CRITICAL": + window.location.assign( + `index.php?sec=view&sec2=operation/agentes/estado_agente&status=1` + ); + break; + + case "WARNING": + window.location.assign( + `index.php?sec=view&sec2=operation/agentes/estado_agente&status=2` + ); + break; + + case "UKNOWN": + window.location.assign( + `index.php?sec=view&sec2=operation/agentes/estado_agente&status=3` + ); + break; + + case "NORMAL": + window.location.assign( + `index.php?sec=view&sec2=operation/agentes/estado_agente&status=0` + ); + break; + + default: + window.location.assign( + `index.php?sec=view&sec2=operation/agentes/estado_agente` + ); + break; + } + } +} diff --git a/pandora_console/include/lib/TacticalView/GeneralTacticalView.php b/pandora_console/include/lib/TacticalView/GeneralTacticalView.php index 3bc2e45246..d61b748bca 100644 --- a/pandora_console/include/lib/TacticalView/GeneralTacticalView.php +++ b/pandora_console/include/lib/TacticalView/GeneralTacticalView.php @@ -50,6 +50,22 @@ class GeneralTacticalView } + /** + * Returns whether general statistics are disabled. + * + * @return boolean + */ + public function disableGeneralStatistics():bool + { + global $config; + if (users_is_admin($config['id_user']) === true) { + return false; + } else { + return (bool) $config['disable_general_statistics']; + } + } + + /** * Instantiate all the elements that will build the dashboard * @@ -109,6 +125,7 @@ class GeneralTacticalView { $data = []; $data['javascript'] = $this->javascript(); + $data['disableGeneralStatistics'] = $this->disableGeneralStatistics(); $data = array_merge($data, $this->elements); View::render( 'tacticalView/view', diff --git a/pandora_console/include/lib/TacticalView/elements/Agents.php b/pandora_console/include/lib/TacticalView/elements/Agents.php index 97063ec300..a0e14313e0 100644 --- a/pandora_console/include/lib/TacticalView/elements/Agents.php +++ b/pandora_console/include/lib/TacticalView/elements/Agents.php @@ -429,12 +429,29 @@ class Agents extends Element 'cutout' => 80, 'nodata_image' => ['width' => '80%'], 'colors' => $colors, + 'onClick' => 'redirectAgentStatus', ]; + + // To avoid that if a value is too small it is not seen. + $percentages = []; + $total = array_sum($data); + foreach ($data as $key => $value) { + $percentage = (($value / $total) * 100); + if ($percentage < 1 && $percentage > 0) { + $percentage = 1; + } + + $percentages[$key] = format_numeric($percentage, 0); + } + + $data = $percentages; + $pie = ring_graph($data, $options); $output = html_print_div( [ 'content' => $pie, 'style' => 'margin: 0 auto; max-width: 80%; max-height: 220px;', + 'class' => 'clickable', ], true ); diff --git a/pandora_console/include/lib/TacticalView/elements/Database.php b/pandora_console/include/lib/TacticalView/elements/Database.php index 21f8053163..4c0d3a5368 100644 --- a/pandora_console/include/lib/TacticalView/elements/Database.php +++ b/pandora_console/include/lib/TacticalView/elements/Database.php @@ -34,7 +34,9 @@ class Database extends Element */ public function __construct() { + global $config; parent::__construct(); + include_once $config['homedir'].'/include/graphs/fgraph.php'; $this->title = __('Database'); $this->ajaxMethods = [ 'getStatus', diff --git a/pandora_console/include/lib/TacticalView/elements/Events.php b/pandora_console/include/lib/TacticalView/elements/Events.php index a7f9970ee3..1c87f4cc9e 100644 --- a/pandora_console/include/lib/TacticalView/elements/Events.php +++ b/pandora_console/include/lib/TacticalView/elements/Events.php @@ -57,23 +57,13 @@ class Events extends Element { global $config; $id_groups = array_keys(users_get_groups($config['id_user'], 'AR', false)); - if (in_array(0, $id_groups) === false) { - foreach ($id_groups as $key => $id_group) { - if ((bool) check_acl_restricted_all($config['id_user'], $id_group, 'AR') === false) { - unset($id_groups[$key]); - } - } - } - - if (users_can_manage_group_all() === true) { - $id_groups[] = 0; - } - $id_groups = implode(',', $id_groups); $event_view_h = (int) ($config['event_view_hr'] > 24) ? 24 : $config['event_view_hr']; $time_events = ($event_view_h * 3600); $intervalh = (time() - $time_events); - $sql = 'SELECT utimestamp from tevento WHERE utimestamp >= '.$intervalh.' ORDER BY utimestamp DESC;'; + $sql = 'SELECT utimestamp + FROM tevento + WHERE utimestamp >= '.$intervalh.' AND id_grupo IN ('.$id_groups.') ORDER BY utimestamp DESC;'; $rows = db_process_sql($sql); $cut_seconds = ($time_events / 24); $now = (time() - 300); @@ -377,6 +367,13 @@ class Events extends Element $data = []; $colors = []; foreach ($rows as $key => $row) { + if ($row['criticity'] != EVENT_CRIT_CRITICAL + && $row['criticity'] != EVENT_CRIT_NORMAL + && $row['criticity'] != EVENT_CRIT_WARNING + ) { + continue; + } + switch ($row['criticity']) { case EVENT_CRIT_CRITICAL: $label = __('CRITICAL'); @@ -394,9 +391,7 @@ class Events extends Element break; default: - $colors[] = COL_UNKNOWN; - $label = __('UNKNOWN'); - break; + continue; } $labels[] = $this->controlSizeText($label); @@ -410,6 +405,21 @@ class Events extends Element 'nodata_image' => ['width' => '100%'], 'colors' => $colors, ]; + + // To avoid that if a value is too small it is not seen. + $percentages = []; + $total = array_sum($data); + foreach ($data as $key => $value) { + $percentage = (($value / $total) * 100); + if ($percentage < 1 && $percentage > 0) { + $percentage = 1; + } + + $percentages[$key] = format_numeric($percentage, 0); + } + + $data = $percentages; + $pie = ring_graph($data, $options); $output = html_print_div( [ @@ -448,9 +458,10 @@ class Events extends Element 'style' => 'width: 90%;', 'ajax_url' => 'operation/events/events', 'ajax_data' => [ - 'get_events' => 1, - 'compact_date' => 1, - 'external_url' => 1, + 'get_events' => 1, + 'compact_date' => 1, + 'external_url' => 1, + 'compact_name_event' => 1, ], 'order' => [ 'field' => 'timestamp', diff --git a/pandora_console/include/lib/TacticalView/elements/Groups.php b/pandora_console/include/lib/TacticalView/elements/Groups.php index 82b0f358b1..dfb40fb79d 100644 --- a/pandora_console/include/lib/TacticalView/elements/Groups.php +++ b/pandora_console/include/lib/TacticalView/elements/Groups.php @@ -118,7 +118,6 @@ class Groups extends Element return graph_nodata_image(['width' => '400']); } - $groups = $modules; // Best square. $high = (float) max($width, $height); $low = 0.0; @@ -147,7 +146,7 @@ class Groups extends Element $x = 0; $y = 0; $cont = 1; - foreach ($groups as $key => $value) { + foreach ($modules as $key => $value) { $module_id = $value['id_agente_modulo']; $db_status = modules_get_agentmodule_status($module_id); $module_value = modules_get_last_value($module_id); @@ -183,10 +182,16 @@ class Groups extends Element break; } + $redirect = ''; + if (check_acl($config['id_user'], 0, 'AW')) { + $redirect = 'onclick="redirectHeatmap(\'module\', '.$module_id.', '.$value['id_agente'].')"'; + } + $heatmap .= sprintf( - '', + '', 'rect_'.$cont, $x, + $value['nombre'], $y, $row, $column, @@ -350,9 +355,10 @@ class Groups extends Element } $heatmap .= sprintf( - '', + '', 'rect_'.$cont, $x, + $value['alias'], $y, $row, $column, @@ -490,9 +496,10 @@ class Groups extends Element } $heatmap .= sprintf( - '', + '', 'rect_'.$cont, $x, + $value['_name_'], $y, $row, $column, diff --git a/pandora_console/include/lib/TacticalView/elements/MonitoringElements.php b/pandora_console/include/lib/TacticalView/elements/MonitoringElements.php index eece06f65f..8a572219bd 100644 --- a/pandora_console/include/lib/TacticalView/elements/MonitoringElements.php +++ b/pandora_console/include/lib/TacticalView/elements/MonitoringElements.php @@ -75,7 +75,10 @@ class MonitoringElements extends Element 'display' => false, ], 'cutout' => 80, - 'nodata_image' => ['width' => '100%'], + 'nodata_image' => [ + 'width' => '100%', + 'height' => '90%', + ], ]; $pie = ring_graph($data, $options); $output = html_print_div( @@ -139,7 +142,10 @@ class MonitoringElements extends Element 'display' => false, ], 'cutout' => 80, - 'nodata_image' => ['width' => '100%'], + 'nodata_image' => [ + 'width' => '100%', + 'height' => '90%', + ], ]; $pie = ring_graph($data, $options); $output = html_print_div( @@ -208,7 +214,10 @@ class MonitoringElements extends Element 'display' => false, ], 'cutout' => 80, - 'nodata_image' => ['width' => '100%'], + 'nodata_image' => [ + 'width' => '100%', + 'height' => '90%', + ], ]; $pie = ring_graph($data, $options); $output = html_print_div( @@ -230,11 +239,12 @@ class MonitoringElements extends Element */ public function getMonitoringStatusGraph():string { - $pie = graph_agent_status(false, '', '', true, true, false, true); + $pie = graph_agent_status(false, '', '', true, true, false, true, 'redirectStatus', true); $output = html_print_div( [ 'content' => $pie, 'style' => 'margin: 0 auto; max-width: 80%; max-height: 220px;', + 'class' => 'clickable', ], true ); diff --git a/pandora_console/include/lib/TacticalView/elements/Overview.php b/pandora_console/include/lib/TacticalView/elements/Overview.php index 1e9534b652..6234887e94 100644 --- a/pandora_console/include/lib/TacticalView/elements/Overview.php +++ b/pandora_console/include/lib/TacticalView/elements/Overview.php @@ -36,6 +36,7 @@ class Overview extends Element { global $config; parent::__construct(); + include_once $config['homedir'].'/include/graphs/fgraph.php'; if (is_ajax() === true) { include_once $config['homedir'].'/include/functions_servers.php'; } @@ -163,6 +164,9 @@ class Overview extends Element if ($info['limit'] > $info['count']) { $used = round(($info['count'] / $info['limit']) * 100); $free = (100 - $used); + } else if ($info['limit'] <= $info['count']) { + $free = 0; + $used = 100; } else { $free = 100; $used = 0; diff --git a/pandora_console/include/styles/general_tactical_view.css b/pandora_console/include/styles/general_tactical_view.css index 0a7f6bdd67..24997f8f17 100644 --- a/pandora_console/include/styles/general_tactical_view.css +++ b/pandora_console/include/styles/general_tactical_view.css @@ -23,11 +23,12 @@ align-items: stretch; } .col-12 { - width: 100%; + width: 99%; } .col-6, .col-xl-6 { width: 50%; + flex: 1; display: flex; flex-wrap: nowrap; flex-direction: column; @@ -58,6 +59,9 @@ border-radius: 10px; height: 100%; max-width: 100%; + display: flex; + flex-direction: column; + justify-content: flex-start; } .br-l { border-left: 1px solid #e5e9ed; @@ -325,6 +329,22 @@ table.dataTable thead th { background-color: #ec7176; } +#svg rect { + cursor: pointer; +} + +.trigger-100 { + display: flex; + flex-direction: column; +} +.label_heatmap { + position: absolute; + background-color: #757575; + color: white; + padding: 2px 5px; + border-radius: 5px; +} + @media (max-width: 1636px) { .col-xl-6 { width: 100%; @@ -344,9 +364,7 @@ table.dataTable thead th { .col-7 { width: 56%; } - .col-5 { - width: 41%; - } + .flex-nowrap { flex-wrap: nowrap !important; } diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 4c3eae145e..86f8d43a27 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -342,6 +342,7 @@ if (is_ajax() === true) { $table_id = get_parameter('table_id', ''); $groupRecursion = (bool) get_parameter('groupRecursion', false); $compact_date = (int) get_parameter('compact_date', 0); + $compact_name_event = (int) get_parameter('compact_name_event', 0); // Datatables offset, limit. $start = (int) get_parameter('start', 0); @@ -471,7 +472,7 @@ if (is_ajax() === true) { $data = array_reduce( $events, - function ($carry, $item) use ($table_id, &$redirection_form_id, $filter, $compact_date, $external_url) { + function ($carry, $item) use ($table_id, &$redirection_form_id, $filter, $compact_date, $external_url, $compact_name_event) { global $config; $tmp = (object) $item; @@ -518,7 +519,7 @@ if (is_ajax() === true) { $tmp->evento = ui_print_truncate_text( $tmp->evento, - 'description', + (empty($compact_name_event) === true) ? 'description' : GENERIC_SIZE_TEXT, false, true, false, diff --git a/pandora_console/views/tacticalView/view.php b/pandora_console/views/tacticalView/view.php index e09e5f16ae..a7fad1ee86 100644 --- a/pandora_console/views/tacticalView/view.php +++ b/pandora_console/views/tacticalView/view.php @@ -41,32 +41,34 @@
-
-
- - - - getLicenseUsageGraph(); ?> + +
+
+ + + + getLicenseUsageGraph(); ?> +
-
+
-
+
title; ?>
-
-
+
+
- getTagsGraph(); ?> + getMonitoringStatusGraph(); ?>
-
+
- getMonitoringStatusGraph(); ?> + getTagsGraph(); ?>
+
@@ -184,7 +187,7 @@ getTotalSources(); ?>
-
+
@@ -221,6 +224,7 @@
+
@@ -236,13 +240,13 @@
- getCurrentlyTriggered(); ?> + getCurrentlyTriggered(); ?>
- getActiveAlerts(); ?> + getActiveAlerts(); ?>
checkAclUserList() === true) : ?> @@ -261,13 +265,13 @@
title; ?>
-
-
+
+
loading(); ?>
-
+
@@ -276,7 +280,7 @@
- +
loading(); ?>
@@ -288,7 +292,7 @@
-
+
@@ -333,7 +337,7 @@
getOperatingSystemGraph(); ?>
- +
getStatusGraph(); ?>
@@ -341,41 +345,43 @@
-
-
- title; ?> -
- + checkAcl() === true) : ?>
From 76721a9445ba50e5a9e1a9fe1bc2d56a5ed55789 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 7 Nov 2023 13:20:08 +0100 Subject: [PATCH 06/10] Fix home screen external link pandora_enterprise#12413 --- .../godmode/users/user_management.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/pandora_console/godmode/users/user_management.php b/pandora_console/godmode/users/user_management.php index 95def919c2..8d9efea97b 100644 --- a/pandora_console/godmode/users/user_management.php +++ b/pandora_console/godmode/users/user_management.php @@ -26,6 +26,8 @@ * ============================================================================ */ +use PandoraFMS\Dashboard\Manager; + // Load global vars. global $config; @@ -45,6 +47,23 @@ $homeScreenValues = [ HOME_SCREEN_DASHBOARD => __('Dashboard'), ]; +$dashboards = Manager::getDashboards( + -1, + -1, + false, + false, + $id_usr +); + +$dashboards_aux = []; +if ($dashboards === false) { + $dashboards = ['None' => 'None']; +} else { + foreach ($dashboards as $key => $dashboard) { + $dashboards_aux[$dashboard['id']] = $dashboard['name']; + } +} + // Custom Home Screen controls. $customHomeScreenAddition = []; // Home screen. Dashboard. @@ -62,6 +81,17 @@ $customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select( false, 'width: 100%' ); + +$layouts = visual_map_get_user_layouts($config['id_user'], true); +$layouts_aux = []; +if ($layouts === false) { + $layouts_aux = ['None' => 'None']; +} else { + foreach ($layouts as $layout) { + $layouts_aux[$layout] = $layout; + } +} + // Home screen. Visual consoles. $customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select( $layouts_aux, From cacb524ece2b15c2947ae089c33459392a6c5dd6 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Tue, 7 Nov 2023 13:28:35 +0100 Subject: [PATCH 07/10] #12376 changed label in new token --- pandora_console/godmode/setup/setup_visuals.php | 2 +- pandora_console/include/functions_config.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 4336da55b9..d6a1719cd8 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -2130,7 +2130,7 @@ $table_other->data[$row][] = html_print_label_input_block( html_print_select($options_data_multiplier, 'use_data_multiplier', $config['use_data_multiplier'], '', '', 1, true, false, false) ); $table_other->data[$row][] = html_print_label_input_block( - __('Disable general statistics in main tactical view'), + __('Hide general stats for non admin users in tactical view'), html_print_checkbox_switch( 'disable_general_statistics', 1, diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index a09e3f1706..9731851a24 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1569,7 +1569,7 @@ function config_update_config() } if (config_update_value('disable_general_statistics', get_parameter('disable_general_statistics', 0), true) === false) { - $error_update[] = __('Disable general statistics'); + $error_update[] = __('Hide general stats for non admin users in tactical view'); } if (config_update_value('decimal_separator', (string) get_parameter('decimal_separator', '.'), true) === false) { From 2d3f30974fd3d6de3b82dfa101312818100b7bbc Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 8 Nov 2023 01:00:25 +0100 Subject: [PATCH 08/10] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.redhat_bin.el8.spec | 4 ++-- pandora_agents/unix/pandora_agent.redhat_bin.el9.spec | 4 ++-- pandora_agents/unix/pandora_agent.redhat_bin.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 28 files changed, 30 insertions(+), 30 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index e63567d459..43dd282881 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.774-231107 +Version: 7.0NG.774-231108 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 b2f9b8652a..b5f0984fc4 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.774-231107" +pandora_version="7.0NG.774-231108" 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 ab8f9a996d..44c032504b 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1039,7 +1039,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.774'; -use constant AGENT_BUILD => '231107'; +use constant AGENT_BUILD => '231108'; # 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 3f9c84767e..f32130c825 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231107 +%define release 231108 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec index 1615f10ae1..905f42240b 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec @@ -4,8 +4,8 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux -%define version 7.0NG.773.3 -%define release 230919 +%define version 7.0NG.774 +%define release 231108 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec index 0f63a6d626..b81dfabb64 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec @@ -4,8 +4,8 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux -%define version 7.0NG.773.3 -%define release 230919 +%define version 7.0NG.774 +%define release 231108 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.spec b/pandora_agents/unix/pandora_agent.redhat_bin.spec index 3b0fc9e492..0961de9751 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231107 +%define release 231108 Summary: Pandora FMS Linux agent, binary version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index d6722c8036..a073668d48 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231107 +%define release 231108 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 7ada05ee2b..a4c7c4dab9 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.774" -PI_BUILD="231107" +PI_BUILD="231108" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index b83cdeca2b..819ac19d42 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{231107} +{231108} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 9e57c9f62e..3724085695 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.774 Build 231107") +#define PANDORA_VERSION ("7.0NG.774 Build 231108") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index d3dc406445..3826481a1c 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Pandora FMS" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.774(Build 231107))" + VALUE "ProductVersion", "(7.0NG.774(Build 231108))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 95fe521eea..a72475b9e0 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.774-231107 +Version: 7.0NG.774-231108 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 cf23a349d9..218d44986e 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.774-231107" +pandora_version="7.0NG.774-231108" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 8c68ac61e7..91729f7c8a 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 = 'PC231107'; +$build_version = 'PC231108'; $pandora_version = 'v7.0NG.774'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 93b32c3e53..de999bb92d 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -131,7 +131,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index c17bc6bc75..ced71627ab 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -7,7 +7,7 @@ %define debug_package %{nil} %define name pandorafms_server %define version 7.0NG.774 -%define release 231107 +%define release 231108 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 068f793e96..10f7c27059 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_server %define version 7.0NG.774 -%define release 231107 +%define release 231108 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 167deee016..cbe62fa053 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.774" -PI_BUILD="231107" +PI_BUILD="231108" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 08c11f8082..e473dec36f 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -38,7 +38,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.774 Build 231107"; +my $version = "7.0NG.774 Build 231108"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 4a94ed4fec..1f54391bf4 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.774 Build 231107"; +my $version = "7.0NG.774 Build 231108"; # save program name for logging my $progname = basename($0); From 7223423dc79acd120e05a23f20a8f1fb98d9cdda Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 8 Nov 2023 13:15:05 +0100 Subject: [PATCH 09/10] #12376 fixed color group and fixed status color in heatmap --- .../include/lib/TacticalView/elements/Groups.php | 9 +++++++-- pandora_console/views/tacticalView/view.php | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/lib/TacticalView/elements/Groups.php b/pandora_console/include/lib/TacticalView/elements/Groups.php index dfb40fb79d..4fe07b743a 100644 --- a/pandora_console/include/lib/TacticalView/elements/Groups.php +++ b/pandora_console/include/lib/TacticalView/elements/Groups.php @@ -148,11 +148,16 @@ class Groups extends Element $cont = 1; foreach ($modules as $key => $value) { $module_id = $value['id_agente_modulo']; - $db_status = modules_get_agentmodule_status($module_id); + $module_status = db_get_row( + 'tagente_estado', + 'id_agente_modulo', + $module_id, + ); + $module_value = modules_get_last_value($module_id); $status = ''; $title = ''; - modules_get_status($module_id, $db_status, $module_value, $status, $title); + modules_get_status($module_id, $module_status['estado'], $module_value, $status, $title); switch ($status) { case STATUS_MODULE_NO_DATA: // Not init status. diff --git a/pandora_console/views/tacticalView/view.php b/pandora_console/views/tacticalView/view.php index a7fad1ee86..308c9626e9 100644 --- a/pandora_console/views/tacticalView/view.php +++ b/pandora_console/views/tacticalView/view.php @@ -246,7 +246,7 @@
- getActiveAlerts(); ?> + getActiveAlerts(); ?>
checkAclUserList() === true) : ?> From 3132fabef9c98bb7ffb756ca07edfe190eae66d2 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 8 Nov 2023 13:36:43 +0100 Subject: [PATCH 10/10] #12376 fixed only enabled alerts in tactical view --- pandora_console/include/functions_alerts.php | 6 +++++- .../include/lib/TacticalView/elements/Alerts.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index 2c738a6578..94dcb97f6c 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -22,7 +22,7 @@ require_once $config['homedir'].'/include/functions_modules.php'; require_once $config['homedir'].'/include/functions_users.php'; -function alerts_get_alerts($id_group=0, $free_search='', $status='all', $standby=-1, $acl=false, $total=false, $id_agent=0) +function alerts_get_alerts($id_group=0, $free_search='', $status='all', $standby=-1, $acl=false, $total=false, $id_agent=0, $only_enabled=false) { $sql = ''; $alerts = []; @@ -121,6 +121,10 @@ function alerts_get_alerts($id_group=0, $free_search='', $status='all', $standby // Only enabled agent. $sql .= ' AND t3.disabled = 0'; + if ($only_enabled === true) { + $sql .= ' AND t0.disabled = 0'; + } + $row_alerts = db_get_all_rows_sql($sql); if ($total) { diff --git a/pandora_console/include/lib/TacticalView/elements/Alerts.php b/pandora_console/include/lib/TacticalView/elements/Alerts.php index 1c4388e708..44dfb83f4b 100644 --- a/pandora_console/include/lib/TacticalView/elements/Alerts.php +++ b/pandora_console/include/lib/TacticalView/elements/Alerts.php @@ -83,7 +83,7 @@ class Alerts extends Element */ public function getActiveAlerts():string { - $total = alerts_get_alerts(0, '', 'all', -1, 'AR', true); + $total = alerts_get_alerts(0, '', 'all', -1, 'AR', true, 0, true); return html_print_div( [ 'content' => format_numeric($total, 0),