diff --git a/pandora_agents/Dockerfile b/pandora_agents/Dockerfile index 945a74b1c9..69117e2ca7 100644 --- a/pandora_agents/Dockerfile +++ b/pandora_agents/Dockerfile @@ -9,6 +9,7 @@ RUN yum -y install \ epel-release \ unzip \ perl \ + python3 \ sed \ "perl(Sys::Syslog)" diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index d0a9b4fc46..2152bb8890 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.742-191217 +Version: 7.0NG.742-191226 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 bbd81c6f51..8293f84f4e 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.742-191217" +pandora_version="7.0NG.742-191226" 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 59ab0b9530..1774a9e089 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.742'; -use constant AGENT_BUILD => '191217'; +use constant AGENT_BUILD => '191226'; # 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 10e99ce4dc..096c0fb1fc 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.742 -%define release 191217 +%define release 191226 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 4bf932d9cd..e335c73739 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.742 -%define release 191217 +%define release 191226 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 7c1a0f802b..54186e424d 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.742" -PI_BUILD="191217" +PI_BUILD="191226" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 774fa3d46e..b35c3ac50f 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{191217} +{191226} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index e4b720807c..783b0cf4a6 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.742(Build 191217)") +#define PANDORA_VERSION ("7.0NG.742(Build 191226)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 32e28abb66..9f0d863497 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.742(Build 191217))" + VALUE "ProductVersion", "(7.0NG.742(Build 191226))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 0c893684f3..58ba00cbee 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.742-191217 +Version: 7.0NG.742-191226 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 57885c0b67..6537bebf0f 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.742-191217" +pandora_version="7.0NG.742-191226" package_pear=0 package_pandora=1 diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 368accd39b..b0bc0bf1d1 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -13,6 +13,8 @@ require_once 'include/functions_messages.php'; require_once 'include/functions_servers.php'; require_once 'include/functions_notifications.php'; +require_once 'include/ajax/order_interpreter.php'; +ui_require_css_file('order_interpreter'); // Check permissions // Global errors/warnings checking. @@ -99,7 +101,8 @@ if ($config['menu_type'] == 'classic') { if ($acl_head_search) { // Search bar. - $search_bar = '
'; + $search_bar = ''; + ''; if (!isset($config['search_keywords'])) { $search_bar .= ''; } else { @@ -110,7 +113,7 @@ if ($config['menu_type'] == 'classic') { } } - $search_bar .= ''; + $search_bar .= 'type="search" onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');" + onkeyup="showinterpreter()" class="search_input"/>'; + + $search_bar .= '
'; // $search_bar .= 'onClick="javascript: document.quicksearch.submit()"'; $search_bar .= ""; $search_bar .= '
'; @@ -622,7 +627,7 @@ if ($config['menu_type'] == 'classic') { }); } - // Resize event + // Resize event. window.addEventListener("resize", function() { attatch_to_image(); }); @@ -630,7 +635,86 @@ if ($config['menu_type'] == 'classic') { var fixed_header = ; var new_chat = ; + + function showinterpreter(){ + document.onclick = function(e) { + $('#result_order').hide(); + $('#keywords').addClass('search_input'); + $('#keywords').removeClass('results-found'); + $('#keywords').value = ''; + $('#keywords').attr('placeholder','Enter keywords to search'); + } + + if(event.keyCode == 13 && $("#result_items li.active").length != 0 ) + { + window.location = $('#result_items').find("li.active a").attr('href'); + } + var code = event.key; + switch (code){ + case 'ArrowDown': + if($("#result_items li.active").length!=0) + { + var storeTarget = $('#result_items').find("li.active").next(); + $("#result_items li.active").removeClass("active"); + storeTarget.focus().addClass("active"); + + } + else + { + $('#result_items').find("li:first").focus().addClass("active"); + } + return; + + case 'ArrowUp': + if($("#result_items li.active")) + { + var storeTarget = $('#result_items').find("li.active").prev(); + $("#result_items li.active").removeClass("active"); + storeTarget.focus().addClass("active"); + } + else + { + $('#result_items').find("li:first").focus().addClass("active"); + } + return; + + case 'ArrowRight': + return; + case 'ArrowLeft': + return; + + } + + if( $('#keywords').val() === ''){ + $('#keywords').addClass('search_input'); + $('#keywords').removeClass('results-found'); + $('#result_order').hide(); + $('#keywords').attr('placeholder','Enter keywords to search'); + }else { + $.ajax({ + type: "POST", + url: "ajax.php", + dataType: "html", + data: { + page: 'include/ajax/order_interpreter', + method: 'getResult', + text: $('#keywords').val(), + }, + success: function (data) { + $('#result_order').html(data); + console.log(data); + }, + error: function (data) { + console.error("Fatal error in AJAX call to interpreter order", data) + } + }); + $('#keywords').removeClass('search_input'); + $('#keywords').addClass('results-found'); + $('#result_order').show(); + + } + } /** * Loads modal from AJAX to add feedback. */ diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index 816533aab0..2410094c41 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -82,12 +82,18 @@ if (!empty($page) && !empty($sec)) { } $login_body_style = ''; +$login_body_class = ''; // Overrides the default background with the defined by the user. if (!empty($config['login_background'])) { $background_url = 'images/backgrounds/'.$config['login_background']; $login_body_style = "style=\"background:linear-gradient(74deg, #02020255 36%, transparent 36%), url('".$background_url."');\""; } +// Support for Internet Explorer and Microsoft Edge browsers +if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Edge') !== false) { + $login_body_class = "class='login_body_trident'"; +} + // Get alternative custom in case of db fail. $custom_fields = [ 'custom_logo_login', @@ -111,7 +117,7 @@ foreach ($custom_fields as $field) { // Get the custom icons. $docs_logo = ui_get_docs_logo(); $support_logo = ui_get_support_logo(); -echo '
'; +echo '
'; echo '
'; echo '
    '; diff --git a/pandora_console/godmode/alerts/alert_actions.php b/pandora_console/godmode/alerts/alert_actions.php index b0a88eeec0..793156457d 100644 --- a/pandora_console/godmode/alerts/alert_actions.php +++ b/pandora_console/godmode/alerts/alert_actions.php @@ -32,19 +32,6 @@ if (! check_acl($config['id_user'], 0, 'LM')) { exit; } -if (is_ajax()) { - $get_alert_action = (bool) get_parameter('get_alert_action'); - if ($get_alert_action) { - $id = (int) get_parameter('id'); - $action = alerts_get_alert_action($id); - $action['command'] = alerts_get_alert_action_alert_command($action['id']); - - echo json_encode($action); - } - - return; -} - $update_action = (bool) get_parameter('update_action'); $create_action = (bool) get_parameter('create_action'); $delete_action = (bool) get_parameter('delete_action'); @@ -57,15 +44,22 @@ if (defined('METACONSOLE')) { $sec = 'galertas'; } -if ((!$copy_action) && (!$delete_action)) { - // Header - if (defined('METACONSOLE')) { - alerts_meta_print_header(); - } else { - ui_print_page_header(__('Alerts').' » '.__('Alert actions'), 'images/gm_alerts.png', false, 'alerts_action', true); - } -} +// Header. +if (defined('METACONSOLE')) { + alerts_meta_print_header(); +} else { + $header_help = 'alerts_action'; + if ($copy_action) { + $header_help = 'alerts_config'; + } + + if ($delete_action) { + $header_help = 'alerts_action'; + } + + ui_print_page_header(__('Alerts').' » '.__('Alert actions'), 'images/gm_alerts.png', false, $header_help, true); +} if ($copy_action) { $id = get_parameter('id'); @@ -83,13 +77,6 @@ if ($copy_action) { ); include 'general/noaccess.php'; exit; - } else { - // Header - if (defined('METACONSOLE')) { - alerts_meta_print_header(); - } else { - ui_print_page_header(__('Alerts').' » '.__('Alert actions'), 'images/gm_alerts.png', false, 'alerts_config', true); - } } } //end if else { @@ -102,14 +89,7 @@ if ($copy_action) { $is_in_group = in_array($al_action['id_group'], $own_groups); // Then action group have to be in his own groups - if ($is_in_group) { - // Header - if (defined('METACONSOLE')) { - alerts_meta_print_header(); - } else { - ui_print_page_header(__('Alerts').' » '.__('Alert actions'), 'images/gm_alerts.png', false, 'alerts_config', true); - } - } else { + if (!$is_in_group) { db_pandora_audit( 'ACL Violation', 'Trying to access Alert Management' @@ -118,13 +98,6 @@ if ($copy_action) { exit; } } - } else { - // Header - if (defined('METACONSOLE')) { - alerts_meta_print_header(); - } else { - ui_print_page_header(__('Alerts').' » '.__('Alert actions'), 'images/gm_alerts.png', false, 'alerts_config', true); - } } $result = alerts_clone_alert_action($id); @@ -162,13 +135,6 @@ if ($delete_action) { ); include 'general/noaccess.php'; exit; - } else { - // Header - if (defined('METACONSOLE')) { - alerts_meta_print_header(); - } else { - ui_print_page_header(__('Alerts').' » '.__('Alert actions'), 'images/gm_alerts.png', false, 'alert_action', true); - } } // If user tries to delete an action of others groups @@ -182,14 +148,7 @@ if ($delete_action) { $is_in_group = in_array($al_action['id_group'], $own_groups); // Then action group have to be in his own groups - if ($is_in_group) { - // Header - if (defined('METACONSOLE')) { - alerts_meta_print_header(); - } else { - ui_print_page_header(__('Alerts').' » '.__('Alert actions'), 'images/gm_alerts.png', false, 'alert_action', true); - } - } else { + if (!$is_in_group) { db_pandora_audit( 'ACL Violation', 'Trying to access Alert Management' @@ -198,9 +157,6 @@ if ($delete_action) { exit; } } - } else { - // Header - ui_print_page_header(__('Alerts').' » '.__('Alert actions'), 'images/gm_alerts.png', false, '', true); } @@ -285,10 +241,14 @@ foreach ($actions as $action) { 2 => 'action_buttons', 3 => 'action_buttons', ]; - $data[2] = ''.html_print_image('images/copy.png', true).''; - $data[3] = ''.html_print_image('images/cross.png', true).''; + + $id_action = $action['id']; + $text_confirm = __('Are you sure?'); + + $data[2] = ''.html_print_image('images/copy.png', true).''; + $data[3] = ''.html_print_image('images/cross.png', true).''; } array_push($table->data, $data); @@ -308,3 +268,45 @@ echo ''; echo '
'; enterprise_hook('close_meta_frame'); +?> + + + diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php index 83001be810..71c8bbaabd 100755 --- a/pandora_console/godmode/massive/massive_edit_agents.php +++ b/pandora_console/godmode/massive/massive_edit_agents.php @@ -117,6 +117,14 @@ if ($update_agents) { $values['quiet'] = get_parameter('quiet_select'); } + if (get_parameter('safe_mode_change', -1) == 1 && get_parameter('safe_mode_module', '') != '') { + // Get the module name. + $values['safe_mode_module'] = get_parameter('safe_mode_module'); + } else if (get_parameter('safe_mode_change', -1) == 0) { + // Disabled Safe Operation Mode. + $values['safe_mode_module'] = '0'; + } + $fields = db_get_all_fields_in_table('tagent_custom_fields'); if ($fields === false) { @@ -134,6 +142,20 @@ if ($update_agents) { } } + // Get the id_agente_modulo to update the 'safe_operation_mode' field. + if (isset($values['safe_mode_module']) && ($values['safe_mode_module'] != '0')) { + foreach ($id_agents as $id_agent) { + $id_module_safe[$id_agent] = db_get_value_filter( + 'id_agente_modulo', + 'tagente_modulo', + [ + 'id_agente' => $id_agent, + 'nombre' => $values['safe_mode_module'], + ] + ); + } + } + // CONF FILE DELETION if (isset($values['delete_conf'])) { unset($values['delete_conf']); @@ -188,6 +210,11 @@ if ($update_agents) { } } + // Get the id_agent_module for this agent to update the 'safe_operation_mode' field. + if (isset($values['safe_mode_module']) && ($values['safe_mode_module'] != '0')) { + $values['safe_mode_module'] = $id_module_safe[$id_agent]; + } + $result = db_process_sql_update( 'tagente', $values, @@ -677,6 +704,27 @@ $table->data[6][1] = html_print_select( true ); +$table->data[7][0] = __('Safe operation mode').': '.ui_print_help_tip( + __( + 'This mode allow %s to disable all modules +of this agent while the selected module is on CRITICAL status', + get_product_name() + ), + true +); +$table->data[7][1] .= html_print_select( + [ + 1 => __('Enabled'), + 0 => __('Disabled'), + ], + 'safe_mode_change', + -1, + '', + __('No change'), + -1, + true +).' '; +$table->data[7][1] .= __('Module').' '.html_print_select('', 'safe_mode_module', '', '', __('Any'), -1, true).'
'; ui_toggle(html_print_table($table, true), __('Advanced options')); unset($table); @@ -810,6 +858,54 @@ $(document).ready (function () { } }); + + // Enable Safe Operation Mode if 'Enabled' is selected. + $("#safe_mode_module").attr("disabled", "disabled"); + $("#safe_mode_change").on('change', function() { + if ($("#safe_mode_change").val() == 1) { + $("#safe_mode_module").removeAttr("disabled"); + refreshSafeModules(); + } + else { + $("#safe_mode_module").attr("disabled", "disabled"); + $('#safe_mode_module').empty(); + $("#safe_mode_module").append($("").attr("value", 'Any').html('Any')); + } + }); + + // Fill modules in Safe Operation Mode. + function refreshSafeModules(){ + var idAgents = Array(); + jQuery.each ($("#id_agents option:selected"), function (i, val) { + idAgents.push($(val).val()); + }); + + var params = { + "page" : "operation/agentes/ver_agente", + "get_agent_modules_json_for_multiple_agents" : 1, + "id_agent" : idAgents, + "selection_mode": "common" + }; + + jQuery.post ("ajax.php", + params, + function (data, status) { + $('#safe_mode_module').empty(); + if($.type(data) === "object"){ + jQuery.each (data, function (id, value) { + option = $("").attr("value", value).html(value); + $("#safe_mode_module").append(option); + }); + } else { + option = $("").attr("value", 'None').html('None'); + $("#safe_mode_module").append(option); + } + }, + "json" + ); + } + + $("#form_agent").submit(function() { var get_parameters_count = window.location.href.slice( window.location.href.indexOf('?') + 1).split('&').length; @@ -833,7 +929,7 @@ $(document).ready (function () { $("#id_group").trigger("change"); }); - $("#id_agents").change (function () { + $('#id_agents').on('change', function() { var idAgents = Array(); jQuery.each ($("#id_agents option:selected"), function (i, val) { idAgents.push($(val).val()); @@ -858,6 +954,10 @@ $(document).ready (function () { ); $("#form_agents").attr("style", ""); + + if($("#safe_mode_change").val() == 1) { + refreshSafeModules(); + } }); $("#id_group").change (function () { diff --git a/pandora_console/godmode/reporting/graph_container.php b/pandora_console/godmode/reporting/graph_container.php index 3b87fc63e3..ca2acf7ca7 100644 --- a/pandora_console/godmode/reporting/graph_container.php +++ b/pandora_console/godmode/reporting/graph_container.php @@ -125,6 +125,20 @@ if ($report_r && $report_w) { get_graphs_container(id_container,hash,time); } }); + + $("div[id^=period_container_] a").on('click', function(e){ + if ($("div[id^=period_container_][id$=_default]").css('display') == 'none') { + $('#refresh_custom_time').show(); + $('#refresh_custom_time').on('click', function(e){ + var time = $('input[id *= hidden-period_container_'+hash+']').val(); + get_graphs_container(id_container,hash,time); + }); + } + else if ($("div[id^=period_container_][id$=_manual]").css('display') == 'none') { + $('#refresh_custom_time').hide(); + } + }); + } }); } diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 96f86191d7..db38955357 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -454,10 +454,10 @@ if (!$maps && !is_metaconsole()) { 4 => 'action_buttons', ]; $data[3] = ''.html_print_image('images/copy.png', true).''; - $data[4] = ''.html_print_image('images/cross.png', true).''; + $data[4] = ''.html_print_image('images/cross.png', true).''; } else { $data[3] = ''.html_print_image('images/copy.png', true).''; - $data[4] = ''.html_print_image('images/cross.png', true).''; + $data[4] = ''.html_print_image('images/cross.png', true).''; } } else { $data[3] = ''; diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index f95ba7cee9..98ee756b7b 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -905,6 +905,28 @@ $class = 'databox filters'; + + + + + + + + + - - - - - - - - - + ); + updateAgents($(this).val(), + + ); + }); $("#combo_group").change(function() { updateAgents($(this).val(), + ); + updateAgents($(this).val(), + + ); + }); + $("#combo_group").change(function() { $('#hidden-date_selected').val(''); updateInventoryDates( diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index 1b7d3b4df6..00e93efa28 100755 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -386,7 +386,7 @@ if ($items) { } $table->head[4] = __('Time lapse'); - $table->head[5] = __('Name').' / '.__('Description'); + $table->head[5] = __('Name or Description'); if (check_acl($config['id_user'], 0, 'RM')) { $table->head[6] = ''.__('Op.').''; if ($report_w || $report_m) { diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index 79fcfc61a2..a5b7ce6121 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.php @@ -398,7 +398,7 @@ if (($create != '') || ($view != '')) { } $data[1] .= ' '; - $data[1] .= html_print_image('images/file.png', true); + $data[1] .= html_print_image('images/file.png', true, false, false, true); $data[1] .= ''; $table->data['plugin_command'] = $data; diff --git a/pandora_console/images/default_docs.png b/pandora_console/images/default_docs.png new file mode 100755 index 0000000000..5fcdbe1352 Binary files /dev/null and b/pandora_console/images/default_docs.png differ diff --git a/pandora_console/images/default_list.png b/pandora_console/images/default_list.png old mode 100644 new mode 100755 diff --git a/pandora_console/images/default_support.png b/pandora_console/images/default_support.png new file mode 100755 index 0000000000..a6e57f4bd6 Binary files /dev/null and b/pandora_console/images/default_support.png differ diff --git a/pandora_console/images/demo_background.jpg b/pandora_console/images/demo_background.jpg new file mode 100644 index 0000000000..b92c718af5 Binary files /dev/null and b/pandora_console/images/demo_background.jpg differ diff --git a/pandora_console/images/demo_background_left.jpg b/pandora_console/images/demo_background_left.jpg new file mode 100644 index 0000000000..aeb5a61c97 Binary files /dev/null and b/pandora_console/images/demo_background_left.jpg differ diff --git a/pandora_console/images/demo_background_left.png b/pandora_console/images/demo_background_left.png new file mode 100644 index 0000000000..f1c7445259 Binary files /dev/null and b/pandora_console/images/demo_background_left.png differ diff --git a/pandora_console/images/demo_background_right.jpg b/pandora_console/images/demo_background_right.jpg new file mode 100644 index 0000000000..d6926faf8c Binary files /dev/null and b/pandora_console/images/demo_background_right.jpg differ diff --git a/pandora_console/images/demo_background_right.png b/pandora_console/images/demo_background_right.png new file mode 100644 index 0000000000..a1691eb692 Binary files /dev/null and b/pandora_console/images/demo_background_right.png differ diff --git a/pandora_console/images/demo_logo_spinner.gif b/pandora_console/images/demo_logo_spinner.gif new file mode 100644 index 0000000000..6b2d50f4f7 Binary files /dev/null and b/pandora_console/images/demo_logo_spinner.gif differ diff --git a/pandora_console/include/ajax/graph.ajax.php b/pandora_console/include/ajax/graph.ajax.php index 410a6dd972..ad840f2e6c 100644 --- a/pandora_console/include/ajax/graph.ajax.php +++ b/pandora_console/include/ajax/graph.ajax.php @@ -171,8 +171,9 @@ if ($get_graphs) { '', false, $periods, - 'vertical-align: middle;' + 'vertical-align: middle; margin-bottom:0;' ); + $single_table .= html_print_image('images/refresh_mc.png', true, ['id' => 'refresh_custom_time', 'title' => 'Refresh graph', 'style' => 'cursor:pointer; vertical-align: middle; display:none;']); $single_table .= ''; $single_table .= ''; $single_table .= ''; diff --git a/pandora_console/include/ajax/order_interpreter.php b/pandora_console/include/ajax/order_interpreter.php new file mode 100644 index 0000000000..ce14996bb4 --- /dev/null +++ b/pandora_console/include/ajax/order_interpreter.php @@ -0,0 +1,62 @@ +ajaxMethod($method) === true) { + $order_interpreter->{$method}(); + } else { + $order_interpreter->error('Unavailable method.'); + } +} else { + $order_interpreter->error('Method not found. ['.$method.']'); +} + +// Stop any execution. +exit; diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index e6b2720dd8..9a588782a9 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -391,13 +391,6 @@ class ConsoleSupervisor $this->checkDefaultPassword(); - /* - * Check if there's an active subscription. - * NOTIF.NEWSLETTER.SUBSCRIPTION - */ - - $this->checkNewsletterSubscription(); - /* * Check if there're new updates. * NOTIF.UPDATEMANAGER.OPENSETUP @@ -608,7 +601,6 @@ class ConsoleSupervisor case 'NOTIF.MISC.DEVELOPBYPASS': case 'NOTIF.MISC.FONTPATH': case 'NOTIF.SECURITY.DEFAULT_PASSWORD': - case 'NOTIF.NEWSLETTER.SUBSCRIPTION': case 'NOTIF.UPDATEMANAGER.OPENSETUP': case 'NOTIF.UPDATEMANAGER.UPDATE': case 'NOTIF.UPDATEMANAGER.MINOR': @@ -2000,41 +1992,6 @@ class ConsoleSupervisor } - /** - * Check if instance is subscribed to newsletter. - * - * @return void - */ - public function checkNewsletterSubscription() - { - global $config; - $login = get_parameter('login', false); - - // Newsletter advice. - $newsletter = db_get_value( - 'middlename', - 'tusuario', - 'id_user', - $config['id_user'] - ); - if (!$config['disabled_newsletter'] - && $newsletter != 1 - && $login === false - ) { - $this->notify( - [ - 'type' => 'NOTIF.NEWSLETTER.SUBSCRIPTION', - 'title' => __('Not subscribed to the newsletter'), - 'message' => __('Click here to subscribe to the newsletter'), - 'url' => 'javascript: force_run_newsletter();', - ] - ); - } else { - $this->cleanNotifications('NOTIF.NEWSLETTER.SUBSCRIPTION'); - } - } - - /** * Check if user 'admin' is enabled and using default password. * diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index 505d057665..52bfa9b6c0 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -1341,6 +1341,9 @@ class NetworkMap && $rel['child_type'] == NODE_MODULE ) { // Module information available. + $id_parent = $rel['id_parent_source_data']; + $id_child = $rel['id_child_source_data']; + $priority = 1; $valid = 1; diff --git a/pandora_console/include/class/OrderInterpreter.class.php b/pandora_console/include/class/OrderInterpreter.class.php new file mode 100644 index 0000000000..43abced394 --- /dev/null +++ b/pandora_console/include/class/OrderInterpreter.class.php @@ -0,0 +1,453 @@ + $msg] + ); + } + + + /** + * Checks if target method is available to be called using AJAX. + * + * @param string $method Target method. + * + * @return boolean True allowed, false not. + */ + public function ajaxMethod($method) + { + global $config; + + // Check access. + check_login(); + + return in_array($method, $this->AJAXMethods); + } + + + /** + * Constructor. + * + * @param string $ajax_controller Controller. + * + * @return object + * @throws Exception On error. + */ + public function __construct( + $ajax_controller='include/ajax/order_interpreter' + ) { + global $config; + $this->ajaxController = $ajax_controller; + + $this->pages_menu = [ + [ + 'name' => __('Tactical View'), + 'icon' => ui_get_full_url( + 'images/op_monitoring.menu_gray.png' + ), + 'url' => ui_get_full_url( + 'index.php?sec=view&sec2=operation/agentes/tactical' + ), + 'acl' => check_acl( + $config['id_user'], + 0, + 'AR' + ) || check_acl( + $config['id_user'], + 0, + 'AW' + ), + ], + [ + 'name' => __('Agent Management'), + 'icon' => ui_get_full_url( + 'images/gm_resources.menu_gray.png' + ), + 'url' => ui_get_full_url( + 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente' + ), + 'acl' => check_acl( + $config['id_user'], + 0, + 'AW' + ) && check_acl( + $config['id_user'], + 0, + 'AD' + ), + ], + [ + 'name' => __('General Setup'), + 'icon' => ui_get_full_url( + 'images/gm_setup.menu_gray.png' + ), + 'url' => ui_get_full_url( + 'index.php?sec=general&sec2=godmode/setup/setup§ion=general' + ), + 'acl' => check_acl( + $config['id_user'], + 0, + 'PM' + ) || is_user_admin( + $config['id_user'] + ), + ], + [ + 'name' => __('Manage Policies'), + 'icon' => ui_get_full_url( + 'images/gm_configuration.menu_gray.png' + ), + 'url' => ui_get_full_url( + 'index.php?sec=gmodules&sec2=enterprise/godmode/policies/policies' + ), + 'acl' => check_acl( + $config['id_user'], + 0, + 'AW' + ), + ], + [ + 'name' => __('List Alerts'), + 'icon' => ui_get_full_url( + 'images/gm_alerts.menu_gray.png' + ), + 'url' => ui_get_full_url( + 'index.php?sec=galertas&sec2=godmode/alerts/alert_list' + ), + 'acl' => check_acl( + $config['id_user'], + 0, + 'LW' + ) + || check_acl( + $config['id_user'], + 0, + 'AD' + ) + || check_acl( + $config['id_user'], + 0, + 'LM' + ), + ], + [ + 'name' => __('View Events'), + 'icon' => ui_get_full_url( + 'images/op_events.menu_gray.png' + ), + 'url' => ui_get_full_url( + 'index.php?sec=eventos&sec2=operation/events/events' + ), + 'acl' => check_acl( + $config['id_user'], + 0, + 'ER' + ) || + check_acl( + $config['id_user'], + 0, + 'EW' + ) || + check_acl( + $config['id_user'], + 0, + 'EM' + ), + ], + [ + 'name' => __('Dashboard'), + 'icon' => ui_get_full_url( + 'images/op_reporting.menu_gray.png' + ), + 'url' => ui_get_full_url( + 'index.php?sec=reporting&sec2=enterprise/dashboard/dashboards' + ), + 'acl' => check_acl( + $config['id_user'], + 0, + 'RR' + ), + ], + [ + 'name' => __('Visual Console'), + 'icon' => ui_get_full_url( + 'images/op_network.menu_gray.png' + ), + 'url' => ui_get_full_url( + 'index.php?sec=network&sec2=godmode/reporting/map_builder' + ), + 'acl' => check_acl( + $config['id_user'], + 0, + 'VR' + ), + ], + [ + 'name' => __('Manage Servers'), + 'icon' => ui_get_full_url( + 'images/gm_servers.menu_gray.png' + ), + 'url' => ui_get_full_url( + 'index.php?sec=gservers&sec2=godmode/servers/modificar_server' + ), + 'acl' => check_acl( + $config['id_user'], + 0, + 'AW' + ), + ], + [ + 'name' => __('Edit User'), + 'icon' => ui_get_full_url( + 'images/gm_users.menu_gray.png' + ), + 'url' => ui_get_full_url( + 'index.php?sec=workspace&sec2=operation/users/user_edit' + ), + 'acl' => true, + ], + [ + 'name' => __('Tree View'), + 'icon' => ui_get_full_url( + 'images/op_monitoring.menu_gray.png' + ), + 'url' => ui_get_full_url( + 'index.php?sec=view&sec2=operation/tree' + ), + 'acl' => true, + ], + [ + 'name' => __('Network Component'), + 'icon' => ui_get_full_url( + 'images/gm_configuration.menu_gray.png' + ), + 'url' => ui_get_full_url( + 'index.php?sec=gmodules&sec2=godmode/modules/manage_network_components' + ), + 'acl' => check_acl( + $config['id_user'], + 0, + 'PM' + ), + ], + [ + 'name' => __('Task List'), + 'icon' => ui_get_full_url( + 'images/gm_discovery.menu.png' + ), + 'url' => ui_get_full_url( + 'index.php?sec=discovery&sec2=godmode/servers/discovery&wiz=tasklist' + ), + 'acl' => check_acl( + $config['id_user'], + 0, + 'AR' + ) + || check_acl( + $config['id_user'], + 0, + 'AW' + ) + || check_acl( + $config['id_user'], + 0, + 'AM' + ) + || check_acl( + $config['id_user'], + 0, + 'RR' + ) + || check_acl( + $config['id_user'], + 0, + 'RW' + ) + || check_acl( + $config['id_user'], + 0, + 'RM' + ) + || check_acl( + $config['id_user'], + 0, + 'PM' + ), + ], + [ + 'name' => __('Update Manager'), + 'icon' => ui_get_full_url( + 'images/um_messages.menu_gray.png' + ), + 'url' => ui_get_full_url( + 'index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=setup' + ), + 'acl' => check_acl( + $config['id_user'], + 0, + 'PM' + ) && is_user_admin($config['id_user']), + ], + [ + 'name' => __('Manage Agent Groups'), + 'icon' => ui_get_full_url( + 'images/gm_users.menu_gray.png' + ), + 'url' => ui_get_full_url( + 'index.php?sec=gagente&sec2=godmode/groups/group_list&tab=groups' + ), + 'acl' => check_acl( + $config['id_user'], + 0, + 'PM' + ), + ], + + ]; + + } + + + /** + * Method to print order interpreted on header search input. + * + * @return void + */ + public function getResult() + { + global $config; + + // Take value from input search. + $text = get_parameter('text', ''); + $array_found = []; + $iterator = 0; + $more_results = 0; + + if ($text !== '') { + echo '
'; + echo '
    '; + + foreach ($this->pages_menu as $key => $value) { + if (preg_match( + '/.*'.io_safe_output($text).'.*/i', + __('GO TO '.$value['name']) + ) && $value['acl'] + ) { + if ($iterator <= 9) { + echo '
  • '; + echo ' + Go to   + '; + echo '  + + '.$value['name'].'
    '; + } + + $iterator ++; + + if ($iterator > 10) { + $more_results ++; + } + } + } + + if ($iterator > 9) { + echo '
  • '; + } + + echo $this->loadJS(); + echo '
'; + if ($iterator > 10) { + echo '
+ + '.$more_results.' '.__('results found').'
'; + } + + if ($iterator === 0) { + echo __('No results found'); + } + + echo '
'; + } + } + + + /** + * Load JS content. + * function to create JS actions. + * + * @return string HTML code for javascript functionality. + */ + public function loadJS() + { + ob_start(); + ?> + + ;;; - * ;;;;;;;; - * ;;;;;;; - * ;;;;;; - * ;;;; in this order - * and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_) - * example: - * - * api.php?op=set&op2=create_network_module&id=pepito&other=prueba|0|7|1|10|15|0|16|18|0|15|0|www.google.es|0||0|180|0|0|0|0|latency%20ping&other_mode=url_encode_separator_| - * - * @param $thrash3 Don't use + * @param string $id Name of agent to add the module. + * @param string $thrash1 Don't use. + * @param array $other It's array, $other as param is ;;; + * ;;;;;;;; + * ;;;;;;; + * ;;;;;; + * ;;;; in this order + * and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_). + * @param string $thrash3 Don't use. + * @example: api.php?op=set&op2=create_network_module&id=pepito&other=prueba|0|7|1|10|15|0|16|18|0|15|0|www.google.es|0||0|180|0|0|0|0|latency%20ping&other_mode=url_encode_separator_|* + * @return mixed Return. */ function api_set_create_network_module($id, $thrash1, $other, $thrash3) { @@ -3155,16 +3154,17 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3) 'min_ff_event_critical' => $other['data'][27], 'critical_inverse' => $other['data'][28], 'warning_inverse' => $other['data'][29], + 'ff_type' => $other['data'][30], ]; if (! $values['descripcion']) { $values['descripcion'] = ''; - // Column 'descripcion' cannot be null + // Column 'descripcion' cannot be null. } if (! $values['module_macros']) { $values['module_macros'] = ''; - // Column 'module_macros' cannot be null + // Column 'module_macros' cannot be null. } if ($agent_by_alias) { @@ -3190,7 +3190,7 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3) } if (is_error($idModule)) { - // TODO: Improve the error returning more info + // TODO: Improve the error returning more info. returnError('error_create_network_module', __('Error in creation network module.')); } else { returnData('string', ['type' => 'string', 'data' => $idModule]); @@ -3307,6 +3307,7 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3) 'critical_inverse', 'warning_inverse', 'policy_linked', + 'ff_type', ]; $values = []; @@ -3420,16 +3421,17 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3) 'min_ff_event_critical' => $other['data'][32], 'critical_inverse' => $other['data'][33], 'warning_inverse' => $other['data'][34], + 'ff_type' => $other['data'][35], ]; if (! $values['descripcion']) { $values['descripcion'] = ''; - // Column 'descripcion' cannot be null + // Column 'descripcion' cannot be null. } if (! $values['module_macros']) { $values['module_macros'] = ''; - // Column 'module_macros' cannot be null + // Column 'module_macros' cannot be null. } if ($agent_by_alias) { @@ -3455,7 +3457,7 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3) } if (is_error($idModule)) { - // TODO: Improve the error returning more info + // TODO: Improve the error returning more info. returnError('error_create_plugin_module', __('Error in creation plugin module.')); } else { returnData('string', ['type' => 'string', 'data' => $idModule]); @@ -3562,6 +3564,7 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3) 'critical_inverse', 'warning_inverse', 'policy_linked', + 'ff_type', ]; $values = []; @@ -3669,16 +3672,17 @@ function api_set_create_data_module($id, $thrash1, $other, $thrash3) 'ff_timeout' => $other['data'][23], 'critical_inverse' => $other['data'][24], 'warning_inverse' => $other['data'][25], + 'ff_type' => $other['data'][26], ]; if (! $values['descripcion']) { $values['descripcion'] = ''; - // Column 'descripcion' cannot be null + // Column 'descripcion' cannot be null. } if (! $values['module_macros']) { $values['module_macros'] = ''; - // Column 'module_macros' cannot be null + // Column 'module_macros' cannot be null. } if ($agent_by_alias) { @@ -3704,7 +3708,7 @@ function api_set_create_data_module($id, $thrash1, $other, $thrash3) } if (is_error($idModule)) { - // TODO: Improve the error returning more info + // TODO: Improve the error returning more info. returnError('error_create_data_module', __('Error in creation data module.')); } else { returnData('string', ['type' => 'string', 'data' => $idModule]); @@ -3785,7 +3789,7 @@ function api_set_create_synthetic_module($id, $agent_by_alias, $other, $thrash3) if (! $values['descripcion']) { $values['descripcion'] = ''; - // Column 'descripcion' cannot be null + // Column 'descripcion' cannot be null. } if ($agent_by_alias) { @@ -3795,7 +3799,7 @@ function api_set_create_synthetic_module($id, $agent_by_alias, $other, $thrash3) $idModule = modules_create_agent_module($idAgent, $name, $values, true); if (is_error($idModule)) { - // TODO: Improve the error returning more info + // TODO: Improve the error returning more info. returnError('error_create_data_module', __('Error in creation data module.')); } else { $synthetic_type = $other['data'][1]; @@ -4190,6 +4194,7 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3) 'critical_inverse', 'warning_inverse', 'policy_linked', + 'ff_type', ]; $values = []; @@ -4277,7 +4282,7 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3) $disabled_types_event[EVENTS_GOING_UNKNOWN] = (int) !$other['data'][27]; $disabled_types_event = json_encode($disabled_types_event); - // SNMP version 3 + // SNMP version 3. if ($other['data'][14] == '3') { if ($other['data'][23] != 'AES' and $other['data'][23] != 'DES') { returnError('error_create_snmp_module', __('Error in creation SNMP module. snmp3_priv_method doesn\'t exist. Set it to \'AES\' or \'DES\'. ')); @@ -4329,6 +4334,7 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3) 'min_ff_event_normal' => $other['data'][31], 'min_ff_event_warning' => $other['data'][32], 'min_ff_event_critical' => $other['data'][33], + 'ff_type' => $other['data'][34], ]; } else { $values = [ @@ -4360,12 +4366,13 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3) 'min_ff_event_normal' => $other['data'][25], 'min_ff_event_warning' => $other['data'][26], 'min_ff_event_critical' => $other['data'][27], + 'ff_type' => $other['data'][28], ]; } if (! $values['descripcion']) { $values['descripcion'] = ''; - // Column 'descripcion' cannot be null + // Column 'descripcion' cannot be null. } if ($agent_by_alias) { @@ -4528,6 +4535,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) 'min_ff_event_warning', 'min_ff_event_critical', 'policy_linked', + 'ff_type', ]; } else { $snmp_module_fields = [ @@ -4559,6 +4567,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) 'min_ff_event_warning', 'min_ff_event_critical', 'policy_linked', + 'ff_type', ]; } @@ -4656,6 +4665,7 @@ function api_set_new_network_component($id, $thrash1, $other, $thrash2) 'min_ff_event_normal' => $other['data'][20], 'min_ff_event_warning' => $other['data'][21], 'min_ff_event_critical' => $other['data'][22], + 'ff_type' => $other['data'][23], ]; $name_check = db_get_value('name', 'tnetwork_component', 'name', $id); @@ -4756,6 +4766,7 @@ function api_set_new_plugin_component($id, $thrash1, $other, $thrash2) 'min_ff_event_normal' => $other['data'][24], 'min_ff_event_warning' => $other['data'][25], 'min_ff_event_critical' => $other['data'][26], + 'ff_type' => $other['data'][27], ]; $name_check = db_get_value('name', 'tnetwork_component', 'name', $id); @@ -4891,6 +4902,7 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) 'min_ff_event_normal' => $other['data'][29], 'min_ff_event_warning' => $other['data'][30], 'min_ff_event_critical' => $other['data'][31], + 'ff_type' => $other['data'][32], ]; } else { $values = [ @@ -4922,6 +4934,7 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) 'min_ff_event_normal' => $other['data'][25], 'min_ff_event_warning' => $other['data'][26], 'min_ff_event_critical' => $other['data'][27], + 'ff_type' => $other['data'][28], ]; } @@ -5002,6 +5015,7 @@ function api_set_new_local_component($id, $thrash1, $other, $thrash2) 'min_ff_event_warning' => $other['data'][8], 'min_ff_event_critical' => $other['data'][9], 'ff_timeout' => $other['data'][10], + 'ff_type' => $other['data'][11], ]; $name_check = enterprise_hook( @@ -6835,6 +6849,7 @@ function api_set_add_data_module_policy($id, $thrash1, $other, $thrash3) $values['min_ff_event_warning'] = $other['data'][21]; $values['min_ff_event_critical'] = $other['data'][22]; $values['ff_timeout'] = $other['data'][23]; + $values['ff_type'] = $other['data'][24]; if ($name_module_policy !== false) { if ($name_module_policy[0]['name'] == $other['data'][0]) { @@ -7076,6 +7091,7 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3) $values['min_ff_event_normal'] = $other['data'][24]; $values['min_ff_event_warning'] = $other['data'][25]; $values['min_ff_event_critical'] = $other['data'][26]; + $values['ff_type'] = $other['data'][27]; if ($name_module_policy !== false) { if ($name_module_policy[0]['name'] == $other['data'][0]) { @@ -7134,7 +7150,7 @@ function api_set_update_network_module_policy($id, $thrash1, $other, $thrash3) return; } - // Check if the module exists + // Check if the module exists. $module_policy = enterprise_hook('policies_get_modules', [$id, ['id' => $other['data'][0]], 'id_module']); if ($module_policy === false) { @@ -7241,7 +7257,7 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) return; } - // Check if the module is already in the policy + // Check if the module is already in the policy. $name_module_policy = enterprise_hook('policies_get_modules', [$id, ['name' => $other['data'][0]], 'name']); if ($name_module_policy === ENTERPRISE_NOT_HOOK) { @@ -7285,6 +7301,7 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) $values['min_ff_event_normal'] = $other['data'][29]; $values['min_ff_event_warning'] = $other['data'][30]; $values['min_ff_event_critical'] = $other['data'][31]; + $values['ff_type'] = $other['data'][32]; if ($name_module_policy !== false) { if ($name_module_policy[0]['name'] == $other['data'][0]) { @@ -7344,7 +7361,7 @@ function api_set_update_plugin_module_policy($id, $thrash1, $other, $thrash3) return; } - // Check if the module exists + // Check if the module exists. $module_policy = enterprise_hook('policies_get_modules', [$id, ['id' => $other['data'][0]], 'id_module']); if ($module_policy === false) { @@ -7449,10 +7466,10 @@ function api_set_add_module_in_conf($id_agent, $module_name, $configuration_data $new_configuration_data = io_safe_output(urldecode($configuration_data['data'])); - // Check if exist a current module with the same name in the conf file + // Check if exist a current module with the same name in the conf file. $old_configuration_data = config_agents_get_module_from_conf($id_agent, io_safe_output($module_name)); - // If exists a module with same name, abort + // If exists a module with same name, abort. if (!empty($old_configuration_data)) { returnError('error_adding_module_conf', '-2'); exit; @@ -7571,7 +7588,7 @@ function api_set_update_module_in_conf($id_agent, $module_name, $configuration_d $new_configuration_data = io_safe_output(urldecode($configuration_data_serialized['data'])); - // Get current configuration + // Get current configuration. $old_configuration_data = config_agents_get_module_from_conf($id_agent, io_safe_output($module_name)); // If not exists @@ -7580,7 +7597,7 @@ function api_set_update_module_in_conf($id_agent, $module_name, $configuration_d exit; } - // If current configuration and new configuration are equal, abort + // If current configuration and new configuration are equal, abort. if ($new_configuration_data == $old_configuration_data) { returnData('string', ['type' => 'string', 'data' => '1']); exit; @@ -7702,6 +7719,7 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) 'min_ff_event_normal' => $other['data'][30], 'min_ff_event_warning' => $other['data'][31], 'min_ff_event_critical' => $other['data'][32], + 'ff_type' => $other['data'][33], ]; } else { $values = [ @@ -7731,6 +7749,7 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) 'min_ff_event_normal' => $other['data'][24], 'min_ff_event_warning' => $other['data'][25], 'min_ff_event_critical' => $other['data'][26], + 'ff_type' => $other['data'][27], ]; } @@ -13508,7 +13527,7 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) } $graph_seconds = (!empty($other) && isset($other['data'][0])) ? $other['data'][0] : SECONDS_1HOUR; - // 1 hour by default + // 1 hour by default. $graph_threshold = (!empty($other) && isset($other['data'][2]) && $other['data'][2]) ? $other['data'][2] : 0; if (is_nan($graph_seconds) || $graph_seconds <= 0) { @@ -13624,7 +13643,7 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) ]; if (!isset($name)) { - // avoid warnings + // avoid warnings. $name = ''; } @@ -13632,7 +13651,7 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) $id_agent = agents_create_agent($values_agent['nombre'], $values_agent['id_grupo'], 300, '', $values_agent); if ($id_agent !== false) { - // Create cluster + // Create cluster. $values_cluster = [ 'name' => $name, 'cluster_type' => $cluster_type, @@ -13644,7 +13663,7 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) $id_cluster = db_process_sql_insert('tcluster', $values_cluster); if ($id_cluster === false) { - // failed to create cluster, rollback previously created agent + // failed to create cluster, rollback previously created agent. agents_delete_agent($id_agent, true); } @@ -13989,7 +14008,7 @@ function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thras return; } - // Take agent data + // Take agent data. $row = db_get_row('tagente', 'id_agente', $id_agent); $intervalo = $row['intervalo']; @@ -14023,7 +14042,7 @@ function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thras } foreach ($nc as $row2) { - // Insert each module from tnetwork_component into agent + // Insert each module from tnetwork_component into agent. $values = [ 'id_agente' => $id_agent, 'id_tipo_modulo' => $row2['type'], @@ -14069,18 +14088,19 @@ function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thras 'min_ff_event_normal' => $row2['min_ff_event_normal'], 'min_ff_event_warning' => $row2['min_ff_event_warning'], 'min_ff_event_critical' => $row2['min_ff_event_critical'], + 'ff_type' => $row2['ff_type'], ]; $name = $row2['name']; - // Put tags in array if the component has to add them later + // Put tags in array if the component has to add them later. if (!empty($row2['tags'])) { $tags = explode(',', $row2['tags']); } else { $tags = []; } - // Check if this module exists in the agent + // Check if this module exists in the agent. $module_name_check = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['delete_pending' => 0, 'nombre' => $name, 'id_agente' => $id_agent]); if ($module_name_check !== false) { diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index a971b896de..8e8e64ea85 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -4009,7 +4009,7 @@ function events_page_details($event, $server='') $data = []; $data[0] = '
'.__('Last contact').'
'; - $data[1] = ($agent['ultimo_contacto'] == '1970-01-01 00:00:00') ? ''.__('N/A').'' : date_w_fixed_tz($agent['ultimo_contacto']); + $data[1] = ($agent['ultimo_contacto'] == '1970-01-01 00:00:00') ? ''.__('N/A').'' : ui_print_timestamp($agent['ultimo_contacto'], true); $table_details->data[] = $data; $data = []; diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 6b29b70797..cd93334327 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -725,11 +725,14 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) $table->data['error']['cell'] = __('There are no Agent/Modules defined'); } - if (!empty($item['charts'])) { + if (empty($item['charts']) === false) { $table1 = new stdClass(); - $table1->width = '99%'; + $table1->width = '100%'; $table1->size = []; $table1->size[0] = '10%'; + if ($pdf !== 0) { + $table1->size[0] = '20%'; + } $table1->data = []; @@ -3424,13 +3427,20 @@ function reporting_html_availability_graph($table, $item, $pdf=0) // Check failover availability report. if ($item['data'][$k_chart]['failover'] === '') { $table1 = new stdClass(); - $table1->width = '99%'; + $table1->width = '100%'; $table1->data = []; $table1->size = []; $table1->size[0] = '10%'; $table1->size[1] = '80%'; $table1->size[2] = '5%'; $table1->size[3] = '5%'; + if ($pdf !== 0) { + $table1->size[0] = '20%'; + $table1->size[1] = '60%'; + $table1->size[2] = '10%'; + $table1->size[3] = '10%'; + } + $table1->data[0][0] = $chart['agent'].'
'.$chart['module']; $table1->data[0][1] = $chart['chart']; $table1->data[0][2] = "".$sla_value.''; diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index c8b893c091..558cc0f061 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -624,7 +624,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) if ($agent['ultimo_contacto_remoto'] == '01-01-1970 00:00:00') { $last_remote_contact = __('Never'); } else { - $last_remote_contact = ui_print_timestamp($agent['ultimo_contacto_remoto'], true); + $last_remote_contact = date_w_fixed_tz($agent['ultimo_contacto_remoto']); } $row = []; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index d4d153d13d..c23ac1ea2b 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -3333,6 +3333,7 @@ function ui_print_datatable(array $parameters) { extend: "csv", text : "'.__('Export current page to CSV').'", + titleAttr: "'.__('Export current page to CSV').'", title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'", fieldSeparator: "'.$config['csv_divider'].'", exportOptions : { diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 1c6afb9eed..417b6dc587 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -1900,6 +1900,8 @@ function visual_map_print_item( echo ''; } } else { + $is_meta = is_metaconsole(); + $agents_critical = agents_get_agents( [ 'disabled' => 0, @@ -1908,7 +1910,10 @@ function visual_map_print_item( ], ['COUNT(*) as total'], 'AR', - false + false, + false, + 0, + $is_meta ); $agents_warning = agents_get_agents( [ @@ -1918,7 +1923,10 @@ function visual_map_print_item( ], ['COUNT(*) as total'], 'AR', - false + false, + false, + 0, + $is_meta ); $agents_unknown = agents_get_agents( [ @@ -1928,7 +1936,10 @@ function visual_map_print_item( ], ['COUNT(*) as total'], 'AR', - false + false, + false, + 0, + $is_meta ); $agents_ok = agents_get_agents( [ @@ -1938,7 +1949,10 @@ function visual_map_print_item( ], ['COUNT(*) as total'], 'AR', - false + false, + false, + 0, + $is_meta ); $total_agents = ($agents_critical[0]['total'] + $agents_warning[0]['total'] + $agents_unknown[0]['total'] + $agents_ok[0]['total']); $stat_agent_ok = ($agents_ok[0]['total'] / $total_agents * 100); diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 0e678c6111..ed99a7b429 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -1447,9 +1447,6 @@ function visual_map_editor_print_hack_translate_strings() '; - $output .= ''; + $output .= ''; + $output .= ''; } else { $output .= ''; $output .= ''; diff --git a/pandora_console/include/javascript/tiny_mce/themes/advanced/skins/default/ui.css b/pandora_console/include/javascript/tiny_mce/themes/advanced/skins/default/ui.css index 9e9fd392ac..32d6e6d27f 100644 --- a/pandora_console/include/javascript/tiny_mce/themes/advanced/skins/default/ui.css +++ b/pandora_console/include/javascript/tiny_mce/themes/advanced/skins/default/ui.css @@ -86,7 +86,6 @@ } .defaultSkin table.mceLayout tr.mceLast td { border-bottom: 1px solid #ccc; - display: none; } .defaultSkin table.mceToolbar, .defaultSkin tr.mceFirst .mceToolbar tr td, diff --git a/pandora_console/include/styles/demos.css b/pandora_console/include/styles/demos.css new file mode 100644 index 0000000000..91f476626c --- /dev/null +++ b/pandora_console/include/styles/demos.css @@ -0,0 +1,103 @@ +/* + * --------------------------------------------------------------------- + * - INSTALLING DB FOR DEMOS - + * --------------------------------------------------------------------- + */ + +.textBanner, +h1, +p { + font-family: "Open Sans", "lato-bolder", sans-serif; + font-size: 1vw; + color: #3f3f3f; +} + +h1 { + font-size: 2vw; + margin-bottom: 40px; + text-transform: none; +} + +p { + font-size: 1vw; +} + +#demo_side_left { + position: absolute; + width: 342px; + height: 1000px; + background-image: url(/pandora_console/images/demo_background_left.png); + z-index: 0; +} + +#demo_side_right { + position: absolute; + width: 640px; + height: 1000px; + right: 0; + background-image: url(/pandora_console/images/demo_background_right.png); + z-index: 0; +} + +#demo_side_center { + position: relative; +} + +#spinner_logo_demo { + background: url(/pandora_console/images/demo_logo_spinner.gif) no-repeat; + margin: 0 auto; + width: 350px; + height: 350px; +} + +#text_message_demo { + text-align: center; +} + +div#header_demo { + width: 100%; + height: 65px; +} + +div.text_banner_demo { + width: 100%; + margin: 20px 0 60px; + text-align: center; +} + +.textBanner { + font-size: 3vw; +} + +.textProduct { + color: #82b92e; +} + +div#container_demo { + width: 100%; + margin-top: 100px; +} + +div#list_icon_docs_support { + float: left; + margin-top: 25px; + margin-left: 5%; +} + +div#list_icon_docs_support ul { + margin-top: 5px; + line-height: 36px; +} + +div#list_icon_docs_support ul li { + display: inline-block; + color: #979797; + vertical-align: middle; + margin-right: 5px; + font-size: 10pt; +} + +div#list_icon_docs_support ul li a { + color: #979797; + font-size: 10pt; +} diff --git a/pandora_console/include/styles/login.css b/pandora_console/include/styles/login.css index f6c072b314..426d06bb89 100644 --- a/pandora_console/include/styles/login.css +++ b/pandora_console/include/styles/login.css @@ -33,6 +33,10 @@ div#error_buttons a { background-repeat: repeat; } +.login_body_trident { + background: url("../../images/backgrounds/background_pandora_console_keys.jpg") !important; +} + p.log_in { color: #fff; padding: 0px 10px; diff --git a/pandora_console/include/styles/order_interpreter.css b/pandora_console/include/styles/order_interpreter.css new file mode 100644 index 0000000000..6af20c68c5 --- /dev/null +++ b/pandora_console/include/styles/order_interpreter.css @@ -0,0 +1,54 @@ +div.show_result_interpreter { + background-color: #fff; + color: #000; + border: 1px solid #e2e2e2; + border-bottom-left-radius: 10px; + border-bottom-right-radius: 10px; + padding-left: 10px; + padding-top: 5px; + padding-bottom: 5px; + box-shadow: 0px 0px 15px -4px #dadada; + position: absolute; + z-index: 1; + width: 300px; +} + +.more_results { + text-align: right; + margin-right: 20px; + display: grid; +} + +.results-found { + background-image: url("../../images/input_zoom_gray.png"); + background-position: center right 10px; + background-repeat: no-repeat; + background-size: 17px; + background-color: #f2f6f7; + padding: 0px; + margin: 0; + width: 300px; + height: 30px; + margin-left: 2px; + padding-left: 15px; + padding-right: 40px; + color: #777; + font-family: "Open Sans", sans-serif; + font-size: 8.5pt; + border-top-left-radius: 10px; + border-top-right-radius: 10px; + border-color: transparent; +} + +.list_found { + padding-top: 5px; +} + +.active { + background: #f2f6f7; +} + +.result_order { + margin-left: 2px; + display: grid; +} diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index a4f9636bf5..5822ab4eac 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -196,6 +196,10 @@ h4 { color: #3f3f3f; text-transform: none; } + +table tbody tr td h4 { + color: #ffffff; +} a { color: #3f3f3f; text-decoration: none; diff --git a/pandora_console/install.php b/pandora_console/install.php index 837221b102..9b7223a66f 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
'.substr($agent['os_version'], $osversion_offset, 15).')'; + if ($agent['os_version'] != '') { + $agent_os_version = ' ('.substr($agent['os_version'], $osversion_offset, 15).')'; + } + + $row[] = ui_print_os_icon($agent['id_os'], true, true).$agent_os_version; $table->data[] = $row; // URL @@ -331,7 +335,12 @@ switch ($opt) { // Agent version $row = []; - $row[] = __('Agent Version'); + if (strtolower(get_os_name($agent['id_os'])) == 'satellite') { + $row[] = __('Satellite Version'); + } else { + $row[] = __('Agent Version'); + } + $row[] = $agent['agent_version']; $table->data[] = $row; diff --git a/pandora_console/operation/users/webchat.php b/pandora_console/operation/users/webchat.php index de59c5d3e8..809ccaa000 100644 --- a/pandora_console/operation/users/webchat.php +++ b/pandora_console/operation/users/webchat.php @@ -165,9 +165,13 @@ echo "
".html_print_button( check_users(); if (first_time) { + var date_first_message = unix_timestamp(data['log'][0]['timestamp']); + if(!date_first_message){ + date_first_message = unix_timestamp(new Date()/1000); + } print_messages({ 0: {'type' : 'notification', - 'text': ''} + 'text': ''+date_first_message} }, true); first_time = false; } @@ -308,4 +312,24 @@ echo "
".html_print_button( } }); } + + // Function to convert a timestamp to human date. + function unix_timestamp(timestamp){ + var date = new Date(timestamp*1000); + + const monthNames = [ + "January", "February", "March", "April", + "May", "June", "July", "August", + "September", "October", "November", "December" + ]; + var month = monthNames[date.getMonth()]; + + var day = date.getDate(); + var year = date.getFullYear(); + + var hour = date.getHours(); + var min = date.getMinutes(); + + return month + ' ' + day + ', '+ year + ', ' + hour+ ':' + min; + } diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index b87dc2ad0f..8b70027e7d 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.742 -%define release 191217 +%define release 191226 # 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 06e4dcef02..71663b268a 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.742 -%define release 191217 +%define release 191226 # 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 bb2d7805c4..d8619e6b86 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.742 -%define release 191217 +%define release 191226 %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 a8491f6571..bf5568b83a 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.742-191217 +Version: 7.0NG.742-191226 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 033ddf4b88..043d4f97fb 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.742-191217" +pandora_version="7.0NG.742-191226" package_cpan=0 package_pandora=1 diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index fa9491ce14..1906fa72eb 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -163,9 +163,11 @@ wmiserver 1 network_timeout 4 # Network timeout (in seconds) for timeout in remote execution commands (PANDORA FMS ENTERPRISE ONLY). - rcmd_timeout 30 +# Remote execution modules, ssh_launcher extra option (PANDORA FMS ENTERPRISE ONLY). +ssh_launcher /usr/share/pandora_server/util/ssh_launcher.sh + # Server keepalive (in seconds) server_keepalive 45 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 60c50a394f..6a55debbf0 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.742"; -my $pandora_build = "191217"; +my $pandora_build = "191226"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash @@ -360,6 +360,9 @@ sub pandora_load_config { # Discovery SAP Artica environment $pa_config->{"sap_artica_test"} = 0; + # Remote execution modules, option ssh_launcher + $pa_config->{"ssh_launcher"} = "/usr/bin/ssh_launcher"; + # braa for enterprise snmp server $pa_config->{"braa"} = "/usr/bin/braa"; @@ -861,6 +864,9 @@ sub pandora_load_config { elsif ($parametro =~ m/^sap_artica_test\s(.*)/i) { $pa_config->{'sap_artica_test'}= clean_blank($1); } + elsif ($parametro =~ m/^ssh_launcher\s(.*)/i) { + $pa_config->{'ssh_launcher'}= clean_blank($1); + } elsif ($parametro =~ m/^nmap_timing_template\s+([0-9]*)/i) { $pa_config->{'nmap_timing_template'}= clean_blank($1); } diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index 6ac9783c33..84924c519a 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.742"; -my $pandora_build = "191217"; +my $pandora_build = "191226"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index ac0ee07142..61a8e52c36 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.742 -%define release 191217 +%define release 191226 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index a810430fca..8023b80f63 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.742 -%define release 191217 +%define release 191226 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 506f15bbb4..e28c53c0b6 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.742" -PI_BUILD="191217" +PI_BUILD="191226" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 6b98359173..dc270c0bc6 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.742 PS191217"; +my $version = "7.0NG.742 PS191226"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 9b3a3b3367..8b7cd277eb 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.742 PS191217"; +my $version = "7.0NG.742 PS191226"; # save program name for logging my $progname = basename($0);