diff --git a/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/ConnectionCustomToast.java b/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/ConnectionCustomToast.java index 8540370a2b..5026d96d98 100644 --- a/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/ConnectionCustomToast.java +++ b/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/ConnectionCustomToast.java @@ -2,7 +2,7 @@ Pandora FMS - http://pandorafms.com ================================================== -Copyright (c) 2005-2021 Artica Soluciones Tecnologicas +Copyright (c) 2005-2023 Pandora FMS Please see http://pandorafms.org for full contribution list This program is free software; you can redistribute it and/or diff --git a/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/Help.java b/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/Help.java index 32d73a7fa8..60708495c1 100644 --- a/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/Help.java +++ b/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/Help.java @@ -2,7 +2,7 @@ Pandora FMS - http://pandorafms.com ================================================== -Copyright (c) 2005-2021 Artica Soluciones Tecnologicas +Copyright (c) 2005-2023 Pandora FMS Please see http://pandorafms.org for full contribution list This program is free software; you can redistribute it and/or diff --git a/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/Options.java b/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/Options.java index 2cd8542fa0..782448ace6 100644 --- a/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/Options.java +++ b/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/Options.java @@ -2,7 +2,7 @@ Pandora FMS - http://pandorafms.com ================================================== -Copyright (c) 2005-2021 Artica Soluciones Tecnologicas +Copyright (c) 2005-2023 Pandora FMS Please see http://pandorafms.org for full contribution list This program is free software; you can redistribute it and/or diff --git a/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/PandoraWebView.java b/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/PandoraWebView.java index 4c566ff0f4..5b03bd03d3 100644 --- a/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/PandoraWebView.java +++ b/extras/PandoraFMS_android_console/src/pandorafms/pandorafmsandroidconsole/PandoraWebView.java @@ -2,7 +2,7 @@ Pandora FMS - http://pandorafms.com ================================================== -Copyright (c) 2005-2021 Artica Soluciones Tecnologicas +Copyright (c) 2005-2023 Pandora FMS Please see http://pandorafms.org for full contribution list This program is free software; you can redistribute it and/or diff --git a/extras/android-event-viewer/app/src/main/AndroidManifest.xml b/extras/android-event-viewer/app/src/main/AndroidManifest.xml index 56e27364eb..1678445c33 100644 --- a/extras/android-event-viewer/app/src/main/AndroidManifest.xml +++ b/extras/android-event-viewer/app/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ + Dark/20/builder@svg + Created with Sketch. + + + + \ No newline at end of file diff --git a/pandora_console/images/data-group@svg.svg b/pandora_console/images/data-group@svg.svg new file mode 100644 index 0000000000..58bc904f58 --- /dev/null +++ b/pandora_console/images/data-group@svg.svg @@ -0,0 +1,7 @@ + + + data-group@svg + + + + \ No newline at end of file diff --git a/pandora_console/images/graph-container.png b/pandora_console/images/graph-container.png index 0a1b70b721..36e49814e4 100644 Binary files a/pandora_console/images/graph-container.png and b/pandora_console/images/graph-container.png differ diff --git a/pandora_console/images/graph-container@2x.png b/pandora_console/images/graph-container@2x.png new file mode 100644 index 0000000000..3d0815e1b3 Binary files /dev/null and b/pandora_console/images/graph-container@2x.png differ diff --git a/pandora_console/images/graph-container@svg.svg b/pandora_console/images/graph-container@svg.svg new file mode 100644 index 0000000000..4e86fa8fa3 --- /dev/null +++ b/pandora_console/images/graph-container@svg.svg @@ -0,0 +1,19 @@ + + + Icons/Dark/20/graph container@svg + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/images/image_problem_area.png b/pandora_console/images/image_problem_area.png index d89324cf81..1859e373e6 100644 Binary files a/pandora_console/images/image_problem_area.png and b/pandora_console/images/image_problem_area.png differ diff --git a/pandora_console/images/no_data_toshow.png b/pandora_console/images/no_data_toshow.png index d89324cf81..1859e373e6 100644 Binary files a/pandora_console/images/no_data_toshow.png and b/pandora_console/images/no_data_toshow.png differ diff --git a/pandora_console/images/no_data_toshow.svg b/pandora_console/images/no_data_toshow.svg new file mode 100644 index 0000000000..5826508c63 --- /dev/null +++ b/pandora_console/images/no_data_toshow.svg @@ -0,0 +1,50 @@ + + + No data to show v2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/images/no_data_toshow@2x.png b/pandora_console/images/no_data_toshow@2x.png new file mode 100644 index 0000000000..afb138f09c Binary files /dev/null and b/pandora_console/images/no_data_toshow@2x.png differ diff --git a/pandora_console/images/welcome_image.svg b/pandora_console/images/welcome_image.svg new file mode 100644 index 0000000000..0a15560136 --- /dev/null +++ b/pandora_console/images/welcome_image.svg @@ -0,0 +1,291 @@ + + + 9C390E1A-9FE4-4604-9F9A-D60ED1281F4D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/include/Image/image_functions.php b/pandora_console/include/Image/image_functions.php index e8a682e1ab..ff92e36651 100644 --- a/pandora_console/include/Image/image_functions.php +++ b/pandora_console/include/Image/image_functions.php @@ -5,10 +5,10 @@ */ /** - * Pandora FMS - http://pandorafms.com + * Pandora FMS - https://pandorafms.com * ================================================== - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/pandora_console/include/ajax/agent.php b/pandora_console/include/ajax/agent.php index a6189abe1e..65dcd96aef 100644 --- a/pandora_console/include/ajax/agent.php +++ b/pandora_console/include/ajax/agent.php @@ -1,9 +1,9 @@ '; + if (is_metaconsole()) { + $data .= '
'; + } else { + $data .= ''; + } + $data .= ''; $data .= html_print_input_hidden( 'update_action', @@ -453,6 +484,11 @@ if ($show_update_action_menu) { $id_action, true ); + $data .= html_print_input_hidden( + 'id_agent', + $server_name, + true + ); if (! $id_agente) { $data .= ''; $data .= ''; $data .= ''; + + if (isset($action_option['module_action_threshold']) === false) { + $action_option['module_action_threshold'] = '300'; + } + $data .= ''; $data .= ''; $data .= ''; $data .= ''; @@ -571,6 +612,11 @@ if ($show_update_action_menu) { true ); $data .= ''; + if (is_metaconsole()) { + // Restore db connection. + metaconsole_restore_db(); + } + echo $data; return; } @@ -833,12 +879,20 @@ if ($get_agent_alerts_datatable === true) { } else { $whereAlertSimple .= sprintf( ' AND id_agent_module IN ( - SELECT tam.id_agente_modulo - FROM tagente_modulo tam - WHERE tam.id_agente IN (SELECT ta.id_agente - FROM tagente ta LEFT JOIN tagent_secondary_group tasg ON - ta.id_agente = tasg.id_agent - WHERE (ta.id_grupo IN (%s) OR tasg.id_group IN (%s)))) ', + SELECT tam.id_agente_modulo + FROM tagente_modulo tam + WHERE + tam.id_agente IN ( + SELECT ta.id_agente + FROM tagente ta + WHERE ta.id_grupo IN (%s) + ) + OR tam.id_agente IN ( + SELECT DISTINCT(tasg.id_agent) + FROM tagent_secondary_group tasg + WHERE tasg.id_group IN (%s) + ) + ) ', implode(',', $id_groups), implode(',', $id_groups) ); @@ -928,22 +982,23 @@ if ($get_agent_alerts_datatable === true) { $tmp->force = $row[2]; $tmp->agent_name = $row[3]; $tmp->agent_module_name = $row[4]; - $tmp->template_name = $row[5]; - $tmp->action = $row[6]; - $tmp->last_fired = $row[7]; - $tmp->status = $row[8]; - $tmp->validate = $row[9]; + $tmp->template_name = $row[5].$row[6]; + $tmp->action = $row[7]; + $tmp->last_fired = $row[8]; + $tmp->status = $row[9]; + $tmp->validate = $row[10]; + $tmp->actions = $row[11]; } else { // Open. $tmp->standby = $row[0]; $tmp->force = $row[1]; $tmp->agent_name = $row[2]; $tmp->agent_module_name = $row[3]; - $tmp->template_name = $row[4]; - $tmp->action = $row[5]; - $tmp->last_fired = $row[6]; - $tmp->status = $row[7]; - $tmp->validate = $row[8]; + $tmp->template_name = $row[4].$row[5]; + $tmp->action = $row[6]; + $tmp->last_fired = $row[7]; + $tmp->status = $row[8]; + $tmp->validate = $row[9]; } $carry[] = $tmp; diff --git a/pandora_console/include/ajax/audit_log.php b/pandora_console/include/ajax/audit_log.php index dbb842047c..c979568b21 100644 --- a/pandora_console/include/ajax/audit_log.php +++ b/pandora_console/include/ajax/audit_log.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/ajax/consoles.ajax.php b/pandora_console/include/ajax/consoles.ajax.php index bb20320c75..d060d6f9b6 100644 --- a/pandora_console/include/ajax/consoles.ajax.php +++ b/pandora_console/include/ajax/consoles.ajax.php @@ -9,12 +9,12 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ========================================================== - * Copyright (c) 2005-2022 Artica Soluciones Tecnol贸gicas S.L + * Copyright (c) 2005-2023 Pandora FMS * This code is NOT free software. This code is NOT licenced under GPL2 licence * You cannot redistribute it without written permission of copyright holder. * ============================================================================ diff --git a/pandora_console/include/ajax/custom_fields.php b/pandora_console/include/ajax/custom_fields.php index 77e79800aa..a403f77748 100644 --- a/pandora_console/include/ajax/custom_fields.php +++ b/pandora_console/include/ajax/custom_fields.php @@ -10,13 +10,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/ajax/double_auth.ajax.php b/pandora_console/include/ajax/double_auth.ajax.php index 54856a26c3..03ed2029d4 100644 --- a/pandora_console/include/ajax/double_auth.ajax.php +++ b/pandora_console/include/ajax/double_auth.ajax.php @@ -10,13 +10,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index f03c8af06b..666d23d244 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. @@ -73,6 +73,7 @@ $meta = get_parameter('meta', 0); $history = get_parameter('history', 0); $table_events = get_parameter('table_events', 0); $total_events = (bool) get_parameter('total_events'); +$filter_groups = (string) get_parameter('filter_groups', ''); $total_event_graph = (bool) get_parameter('total_event_graph'); $graphic_event_group = (bool) get_parameter('graphic_event_group'); $get_table_response_command = (bool) get_parameter('get_table_response_command'); @@ -2109,12 +2110,42 @@ if ($table_events) { if ($total_events) { global $config; - $sql_count_event = 'SELECT SQL_NO_CACHE COUNT(id_evento) FROM tevento '; - if ($config['event_view_hr']) { - $sql_count_event .= 'WHERE utimestamp > (UNIX_TIMESTAMP(NOW()) - '.($config['event_view_hr'] * SECONDS_1HOUR).')'; + if (is_metaconsole() === true) { + $system_events = 0; + $servers = metaconsole_get_servers(); + + // Check if the group can be deleted or not. + if (isset($servers) === true + && is_array($servers) === true + ) { + foreach ($servers as $server) { + if (metaconsole_connect($server) == NOERR) { + $sql_count_event = 'SELECT SQL_NO_CACHE COUNT(id_evento) FROM tevento '; + if ($config['event_view_hr']) { + $sql_count_event .= 'WHERE utimestamp > (UNIX_TIMESTAMP(NOW()) - '.($config['event_view_hr'] * SECONDS_1HOUR).')'; + if ($filter_groups !== '') { + $sql_count_event .= ' AND id_grupo in ('.$filter_groups.')'; + } + } + + $system_events += db_get_value_sql($sql_count_event); + } + + metaconsole_restore_db(); + } + } + } else { + $sql_count_event = 'SELECT SQL_NO_CACHE COUNT(id_evento) FROM tevento '; + if ($config['event_view_hr']) { + $sql_count_event .= 'WHERE utimestamp > (UNIX_TIMESTAMP(NOW()) - '.($config['event_view_hr'] * SECONDS_1HOUR).')'; + if ($filter_groups !== '') { + $sql_count_event .= ' AND id_grupo in ('.$filter_groups.')'; + } + } + + $system_events = db_get_value_sql($sql_count_event); } - $system_events = db_get_value_sql($sql_count_event); echo $system_events; return; } diff --git a/pandora_console/include/ajax/events_extended.php b/pandora_console/include/ajax/events_extended.php index 5b08209e1e..d059b50373 100644 --- a/pandora_console/include/ajax/events_extended.php +++ b/pandora_console/include/ajax/events_extended.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/ajax/fav_menu.ajax.php b/pandora_console/include/ajax/fav_menu.ajax.php index 0b837ec9b3..a698f699ff 100644 --- a/pandora_console/include/ajax/fav_menu.ajax.php +++ b/pandora_console/include/ajax/fav_menu.ajax.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/ajax/graph.ajax.php b/pandora_console/include/ajax/graph.ajax.php index 7b96d1e85b..7b2d08970b 100644 --- a/pandora_console/include/ajax/graph.ajax.php +++ b/pandora_console/include/ajax/graph.ajax.php @@ -1,8 +1,8 @@ 0) { + if (https_is_running()) { + header('Content-type: application/json'); + } + + $module_id = $get_module_macros; + + $module_macros = db_get_value( + 'macros', + 'tagente_modulo', + 'id_agente_modulo', + $module_id + ); + + $macros = []; + $macros['base64'] = base64_encode($module_macros); + $macros['array'] = json_decode($module_macros, true); + + echo json_encode($macros); + return; + } + if ($search_modules) { if (https_is_running()) { header('Content-type: application/json'); @@ -1058,8 +1081,8 @@ if (check_login()) { $policyInfo = policies_info_module_policy($module['id_policy_module']); $adopt = policies_is_module_adopt($module['id_agente_modulo']); - if ($linked === true) { - if ($adopt === true) { + if ((bool) $linked === true) { + if ((bool) $adopt === true) { $img = 'images/policies_brick.png'; $title = '('.__('Adopted').') '.$name_policy; } else { @@ -1067,7 +1090,7 @@ if (check_login()) { $title = $name_policy; } } else { - if ($adopt === true) { + if ((bool) $adopt === true) { $img = 'images/policies_not_brick.png'; $title = '('.__('Unlinked').') ('.__('Adopted').') '.$name_policy; } else { @@ -1152,10 +1175,13 @@ if (check_login()) { $title ); + if (strlen($module['ip_target']) !== 0) { + $title .= '
IP: '.$module['ip_target']; + } + $last_status_change_text = __('Time elapsed since last status change: '); $last_status_change_text .= (empty($module['last_status_change']) === false) ? human_time_comparation($module['last_status_change']) : __('N/A'); - $data[4] .= ui_print_status_image($status, htmlspecialchars($title), true, false, false, true, $last_status_change_text); if ($show_context_help_first_time === false) { $show_context_help_first_time = true; @@ -1164,6 +1190,8 @@ if (check_login()) { } } + $data[4] .= ui_print_status_image($status, htmlspecialchars($title), true, false, false, true, $last_status_change_text); + // Module thresholds. $data[5] = ''; if ((int) $module['id_tipo_modulo'] !== 25) { @@ -1224,7 +1252,10 @@ if (check_login()) { 'content' => html_print_image( 'images/event-history.svg', true, - [ 'class' => 'main_menu_icon' ] + [ + 'title' => __('Event history'), + 'class' => 'main_menu_icon forced_title', + ] ), ], true @@ -1239,7 +1270,10 @@ if (check_login()) { 'content' => html_print_image( 'images/module-graph.svg', true, - [ 'class' => 'main_menu_icon' ] + [ + 'title' => __('Module graph'), + 'class' => 'main_menu_icon forced_title', + ] ), ], true @@ -1256,7 +1290,10 @@ if (check_login()) { 'content' => html_print_image( 'images/simple-value.svg', true, - [ 'class' => 'main_menu_icon' ] + [ + 'title' => __('Module detail'), + 'class' => 'main_menu_icon forced_title', + ] ), ], true @@ -1292,7 +1329,10 @@ if (check_login()) { 'content' => html_print_image( $imgaction, true, - [ 'class' => 'main_menu_icon' ] + [ + 'title' => __('Force remote check'), + 'class' => 'main_menu_icon forced_title', + ] ), ], true @@ -1309,7 +1349,10 @@ if (check_login()) { 'content' => html_print_image( 'images/edit.svg', true, - [ 'class' => 'main_menu_icon' ] + [ + 'title' => __('Edit configuration'), + 'class' => 'main_menu_icon forced_title', + ] ), ], true @@ -1685,6 +1728,7 @@ if (check_login()) { $length = ($length != '-1') ? $length : '18446744073709551615'; $order = get_datatable_order(true); $nodes = get_parameter('nodes', 0); + $disabled_modules = (bool) get_parameter('disabled_modules', false); $where = ''; $recordsTotal = 0; @@ -1709,9 +1753,13 @@ if (check_login()) { $where .= sprintf( 'tagente_estado.estado IN (%s) AND tagente_modulo.delete_pending = 0', - $status + $status, ); + if ($disabled_modules === false) { + $where .= ' AND tagente_modulo.disabled = 0'; + } + if (is_metaconsole() === false) { $order_by = ''; switch ($order['field']) { diff --git a/pandora_console/include/ajax/order_interpreter.php b/pandora_console/include/ajax/order_interpreter.php index c55f501fb7..bcc58c900a 100644 --- a/pandora_console/include/ajax/order_interpreter.php +++ b/pandora_console/include/ajax/order_interpreter.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/ajax/planned_downtime.ajax.php b/pandora_console/include/ajax/planned_downtime.ajax.php index 277ba77411..61b3f619ca 100644 --- a/pandora_console/include/ajax/planned_downtime.ajax.php +++ b/pandora_console/include/ajax/planned_downtime.ajax.php @@ -1,9 +1,9 @@ utimestamp); + $tmp->utimestamp = ''.modules_format_timestamp($tmp->utimestamp).''; - $tmp->utimestamp = human_time_comparation($tmp->utimestamp); + $carry[] = $tmp; + return $carry; + } + ); + } else if ($config['prominent_time'] === 'comparation') { + $data = array_reduce( + $data, + function ($carry, $item) { + // Transforms array of arrays $data into an array + // of objects, making a post-process of certain fields. + $tmp = (object) $item; + date_default_timezone_set($user_timezone); + $title = modules_format_timestamp($tmp->utimestamp); + $tmp->utimestamp = ''.human_time_comparation($tmp->utimestamp).''; - $carry[] = $tmp; - return $carry; - } - ); + $carry[] = $tmp; + return $carry; + } + ); + } else if ($config['prominent_time'] === 'compact') { + $data = array_reduce( + $data, + function ($carry, $item) { + // Transforms array of arrays $data into an array + // of objects, making a post-process of certain fields. + $tmp = (object) $item; + date_default_timezone_set($user_timezone); + $title = modules_format_timestamp($tmp->utimestamp); + $tmp->utimestamp = ''.human_time_comparation($tmp->utimestamp, 'tiny').''; + + $carry[] = $tmp; + return $carry; + } + ); + } else { + $data = array_reduce( + $data, + function ($carry, $item) { + // Transforms array of arrays $data into an array + // of objects, making a post-process of certain fields. + $tmp = (object) $item; + date_default_timezone_set($user_timezone); + $title = modules_format_timestamp($tmp->utimestamp); + $tmp->utimestamp = ''.human_time_comparation($tmp->utimestamp).''; + + $carry[] = $tmp; + return $carry; + } + ); + } } // Datatables format: RecordsTotal && recordsfiltered. diff --git a/pandora_console/include/ajax/visual_console.ajax.php b/pandora_console/include/ajax/visual_console.ajax.php index cd4dde48e1..402a5ddc1a 100644 --- a/pandora_console/include/ajax/visual_console.ajax.php +++ b/pandora_console/include/ajax/visual_console.ajax.php @@ -1,8 +1,8 @@ $result]); return; } + +if ($update_grid_style === true) { + $idVisualConsole = (int) get_parameter('idVisualConsole', 0); + $color = get_parameter('color', '#CCC'); + $size = get_parameter('size', '10'); + + $values = []; + $values['grid_color'] = $color; + $values['grid_size'] = $size; + + $result = db_process_sql_update( + 'tlayout', + $values, + ['id' => $idVisualConsole] + ); + + echo json_encode(['result' => $result]); + return; +} diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 5736815d6c..843ca72934 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -1,8 +1,8 @@ - - + + diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index 8c1e27f0f9..9ebeaaf167 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -10,13 +10,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. @@ -43,8 +43,8 @@ if (isset($config) === false) { - - + + @@ -801,6 +801,30 @@ function update_user(string $id_user, array $values) return false; } + if (isset($values['section']) === true) { + $homeScreenValues = [ + HOME_SCREEN_DEFAULT => __('Default'), + HOME_SCREEN_VISUAL_CONSOLE => __('Visual console'), + HOME_SCREEN_EVENT_LIST => __('Event list'), + HOME_SCREEN_GROUP_VIEW => __('Group view'), + HOME_SCREEN_TACTICAL_VIEW => __('Tactical view'), + HOME_SCREEN_ALERT_DETAIL => __('Alert detail'), + HOME_SCREEN_EXTERNAL_LINK => __('External link'), + HOME_SCREEN_OTHER => __('Other'), + HOME_SCREEN_DASHBOARD => __('Dashboard'), + ]; + + if (is_metaconsole() === true) { + $values['metaconsole_section'] = $values['section']; + $values['metaconsole_data_section'] = $values['data_section']; + $values['metaconsole_default_event_filter'] = $values['default_event_filter']; + unset($values['id_skin']); + unset($values['section']); + unset($values['data_section']); + unset($values['default_event_filter']); + } + } + $output = db_process_sql_update('tusuario', $values, ['id_user' => $id_user]); if (isset($values['is_admin']) === true && (bool) $values['is_admin'] === true) { @@ -1596,7 +1620,7 @@ function local_ldap_search( } $dn = ' -b '.escapeshellarg($dn); - $ldapsearch_command = 'ldapsearch -LLL -o ldif-wrap=no -o nettimeout='.$ldap_search_time.' -x'.$ldap_host.$ldap_version.' -E pr=10000/noprompt '.$ldap_admin_user.$ldap_admin_pass.$dn.$filter.$tls.' | grep -v "^#\|^$" | sed "s/:\+ /=>/g"'; + $ldapsearch_command = 'timeout '.$ldap_search_time.' ldapsearch -LLL -o ldif-wrap=no -o nettimeout='.$ldap_search_time.' -x'.$ldap_host.$ldap_version.' -E pr=10000/noprompt '.$ldap_admin_user.$ldap_admin_pass.$dn.$filter.$tls.' | grep -v "^#\|^$" | sed "s/:\+ /=>/g"'; $shell_ldap_search = explode("\n", shell_exec($ldapsearch_command)); foreach ($shell_ldap_search as $line) { $values = explode('=>', $line); diff --git a/pandora_console/include/chart_generator.php b/pandora_console/include/chart_generator.php index 62701365e5..b2eb97bd1b 100644 --- a/pandora_console/include/chart_generator.php +++ b/pandora_console/include/chart_generator.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. @@ -46,6 +46,8 @@ if (json_last_error() === JSON_ERROR_NONE) { $session_id = $data_decoded['session_id']; $type_graph_pdf = $data_decoded['type_graph_pdf']; $id_user = $data_decoded['id_user']; + $slicebar = $data_decoded['slicebar']; + $slicebar_value = $data_decoded['slicebar_value']; $data_combined = []; if (isset($data_decoded['data_combined']) === true) { @@ -64,6 +66,9 @@ global $config; // Care whit this!!! check_login not working if you remove this. $config['id_user'] = $id_user; $_SESSION['id_usuario'] = $id_user; +if (!isset($config[$slicebar])) { + $config[$slicebar] = $slicebar_value; +} // Try to initialize session using existing php session id. $user = new PandoraFMS\User(['phpsessionid' => $session_id]); @@ -131,37 +136,38 @@ if (file_exists('languages/'.$user_language.'.mo') === true) { $l10n->load_tables(); } +$hack_metaconsole = (is_metaconsole() === true) ? '../../' : ''; ?> Pandora FMS Graph - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + ;'> '.__('Click to Download the agent').''; html_print_div( [ 'id' => 'mac_installer', 'class' => 'white_table_flex agent_details_col', 'style' => 'margin-bottom: 20px', - 'content' => $content.$mac_warn_box, + 'content' => $content.$mac_warn_box.$mac_content_link, ] ); @@ -660,7 +662,7 @@ class AgentDeployWizard var group_val = $('[name="group"] option:selected').text(); var win_installer_command = `Invoke-WebRequest -Uri https://firefly.pandorafms.com/pandorafms/latest/Windows/Pandora%20FMS%20Windows%20Agent%20v7.0NG.x86_64.exe -OutFile \$\{env:tmp\}\\\pandora-agent-windows.exe; & \$\{env:tmp\}\\\pandora-agent-windows.exe /S --ip ${server_addr_val} --group \"${group_val}\" --remote_config 1`; - var linux_installer_command = `export PANDORA_SERVER_IP='${server_addr_val}' && \\ \nexport PANDORA_REMOTE_CONFIG=1 && \\ \nexport PANDORA_GROUP='${group_val}' && \\ \ncurl -Ls https://pfms.me/agent-deploy | bash`; + var linux_installer_command = `export PANDORA_SERVER_IP='${server_addr_val}' && \\\nexport PANDORA_REMOTE_CONFIG=1 && \\\nexport PANDORA_GROUP='${group_val}' && \\\ncurl -Ls https://pfms.me/agent-deploy | bash`; var mac_installer_text = `To complete the installation process, please perform a manual installation and configure the server IP to ${server_addr_val} and specify the group as ${group_val}. Thank you for your cooperation`; var linux_service_start = "/etc/init.d/pandora_agent_daemon start"; var win_service_start = "NET START PandoraFMSAgent"; diff --git a/pandora_console/include/class/AgentWizard.class.php b/pandora_console/include/class/AgentWizard.class.php index 6ae1fb0009..c558977475 100644 --- a/pandora_console/include/class/AgentWizard.class.php +++ b/pandora_console/include/class/AgentWizard.class.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. @@ -325,7 +325,7 @@ class AgentWizard extends HTML $this->wizardSection = get_parameter('wizard_section', 'snmp_explorer'); $this->idAgent = get_parameter('id_agente', ''); $this->idPolicy = get_parameter('id', ''); - $this->targetIp = get_parameter('targetIp', ''); + $this->targetIp = io_safe_input(trim(io_safe_output(get_parameter('targetIp', '')))); $this->wmiBinary = $config['wmiBinary']; $this->defaultSNMPValues = (array) json_decode(io_safe_output($config['agent_wizard_defaults'])); @@ -1645,13 +1645,13 @@ class AgentWizard extends HTML } else if (preg_match('/module-critical-max/', $k) > 0) { $result[$value]['criticalMax'] = $data[$k]; } else if (preg_match('/module-critical-inv/', $k) > 0) { - $result[$value]['criticalInv'] = $data[$k.'_sent']; + $result[$value]['criticalInv'] = $data[$k]; } else if (preg_match('/module-warning-inv/', $k) > 0) { - $result[$value]['warningInv'] = $data[$k.'_sent']; + $result[$value]['warningInv'] = $data[$k]; } else if (preg_match('/module-warning-perc/', $k) > 0) { - $result[$value]['warningPerc'] = $data[$k.'_sent']; + $result[$value]['warningPerc'] = $data[$k]; } else if (preg_match('/module-critical-perc/', $k) > 0) { - $result[$value]['criticalPerc'] = $data[$k.'_sent']; + $result[$value]['criticalPerc'] = $data[$k]; } else if (preg_match('/module-type/', $k) > 0) { $result[$value]['moduleType'] = $data[$k]; } else if (preg_match('/module-unit/', $k) > 0) { @@ -2333,7 +2333,7 @@ class AgentWizard extends HTML } $tmp->id_plugin($infoMacros['server_plugin']); - $tmp->macros(json_encode($fieldsPlugin)); + $tmp->macros(io_json_mb_encode($fieldsPlugin)); } } } @@ -2507,7 +2507,7 @@ class AgentWizard extends HTML } $tmp->id_plugin($infoMacros['server_plugin']); - $tmp->macros(json_encode($fieldsPlugin)); + $tmp->macros(io_json_mb_encode($fieldsPlugin)); } $tmp->ip_target(io_safe_input($this->targetIp)); @@ -4360,7 +4360,7 @@ class AgentWizard extends HTML true, false, 'change_control(this, \''.$uniqueId.'\')', - false, + true, 'form="form-create-modules"' ), ], @@ -4376,7 +4376,7 @@ class AgentWizard extends HTML true, false, 'change_control(this, \''.$uniqueId.'\')', - false, + true, 'form="form-create-modules"' ), ], @@ -4442,7 +4442,7 @@ class AgentWizard extends HTML true, false, 'change_control(this, \''.$uniqueId.'\')', - false, + true, 'form="form-create-modules"' ), ], @@ -4459,7 +4459,7 @@ class AgentWizard extends HTML true, false, 'change_control(this,\''.$uniqueId.'\')', - false, + true, 'form="form-create-modules"' ), ], @@ -6240,22 +6240,24 @@ class AgentWizard extends HTML function change_control(checkbox, uniqueId) { var checkbox_name = $(checkbox).attr('name'); - if($(checkbox).prop('checked', true)) { - if(checkbox_name.match(/warning-inv/gm) !== null) { - $('#checkbox-module-warning-perc-'+uniqueId.replace('/','\\/')).prop('checked', false); - } + if(checkbox_name.match(/warning-inv/gm) !== null) { + $('#checkbox-module-warning-perc-'+uniqueId.replace('/','\\/')).prop('checked', false); + $('#checkbox-'+checkbox_name).val(1) + } - if(checkbox_name.match(/critical-inv/gm) !== null) { - $('#checkbox-module-critical-perc-'+uniqueId.replace('/','\\/')).prop('checked', false); - } + if(checkbox_name.match(/warning-perc/gm) !== null) { + $('#checkbox-module-warning-inv-'+uniqueId.replace('/','\\/')).prop('checked', false); + $('#checkbox-'+checkbox_name).val(1) + } - if(checkbox_name.match(/warning-perc/gm) !== null) { - $('#checkbox-module-warning-inv-'+uniqueId.replace('/','\\/')).prop('checked', false); - } + if(checkbox_name.match(/critical-inv/gm) !== null) { + $('#checkbox-module-critical-perc-'+uniqueId.replace('/','\\/')).prop('checked', false); + $('#checkbox-'+checkbox_name).val(1) + } - if(checkbox_name.match(/critical-perc/gm) !== null) { - $('#checkbox-module-critical-inv-'+uniqueId.replace('/','\\/')).prop('checked', false); - } + if(checkbox_name.match(/critical-perc/gm) !== null) { + $('#checkbox-module-critical-inv-'+uniqueId.replace('/','\\/')).prop('checked', false); + $('#checkbox-'+checkbox_name).val(1) } } diff --git a/pandora_console/include/class/AgentsAlerts.class.php b/pandora_console/include/class/AgentsAlerts.class.php index 1e3dc705b8..e55566f469 100644 --- a/pandora_console/include/class/AgentsAlerts.class.php +++ b/pandora_console/include/class/AgentsAlerts.class.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/class/AuditLog.class.php b/pandora_console/include/class/AuditLog.class.php index e0d1ce2620..98bca38e43 100644 --- a/pandora_console/include/class/AuditLog.class.php +++ b/pandora_console/include/class/AuditLog.class.php @@ -10,13 +10,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/class/CalendarManager.class.php b/pandora_console/include/class/CalendarManager.class.php index d2411e8263..ba1761d6f9 100644 --- a/pandora_console/include/class/CalendarManager.class.php +++ b/pandora_console/include/class/CalendarManager.class.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/class/ConfigPEN.class.php b/pandora_console/include/class/ConfigPEN.class.php index 03638df6f2..2177e73a74 100644 --- a/pandora_console/include/class/ConfigPEN.class.php +++ b/pandora_console/include/class/ConfigPEN.class.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 4dc665fb26..7ef169aec1 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. @@ -278,6 +278,12 @@ class ConsoleSupervisor if ((bool) enterprise_installed() === true) { $this->checkLibaryError(); } + + /* + * Check MYSQL Support Version + */ + + $this->checkMYSQLSettings(); } @@ -560,6 +566,12 @@ class ConsoleSupervisor $this->checkLibaryError(); } + /* + * Check MYSQL Support Version + * + */ + $this->checkMYSQLSettings(); + } @@ -860,6 +872,7 @@ class ConsoleSupervisor case 'NOTIF.CRON.CONFIGURED': case 'NOTIF.ALLOWOVERRIDE.MESSAGE': case 'NOTIF.HAMASTER.MESSAGE': + case 'NOTIF.MYSQL.VERSION': default: // NOTIF.SERVER.STATUS. @@ -1790,6 +1803,45 @@ class ConsoleSupervisor $this->cleanNotifications('NOTIF.PHP.SERIALIZE_PRECISION'); } + if (version_compare('8.1', PHP_VERSION) >= 0) { + $url = 'https://www.php.net/supported-versions.php'; + $this->notify( + [ + 'type' => 'NOTIF.PHP.VERSION', + 'title' => __('PHP UPDATE REQUIRED'), + 'message' => __('You should update your PHP version because it will be out of official support').'
'.__('Current PHP version: ').PHP_VERSION, + 'url' => $url, + ] + ); + } else { + $this->cleanNotifications('NOTIF.PHP.VERSION'); + } + } + + + /** + * Checks if MYSQL version is supported. + * + * @return void + */ + public function checkMYSQLSettings() + { + global $config; + + $mysql_version = $config['dbconnection']->server_info; + if (version_compare('8.0', $mysql_version) >= 0) { + $url = 'https://www.mysql.com/support/eol-notice.html'; + $this->notify( + [ + 'type' => 'NOTIF.MYSQL.VERSION', + 'title' => __('MYSQL UPDATE REQUIRED'), + 'message' => __('You should update your MYSQL version because it will be out of official support').'
'.__('Current MYSQL version: ').$mysql_version, + 'url' => $url, + ] + ); + } else { + $this->cleanNotifications('NOTIF.MYSQL.VERSION'); + } } diff --git a/pandora_console/include/class/CredentialStore.class.php b/pandora_console/include/class/CredentialStore.class.php index 904ddbc6e4..b82a129cd1 100644 --- a/pandora_console/include/class/CredentialStore.class.php +++ b/pandora_console/include/class/CredentialStore.class.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. @@ -1366,7 +1366,7 @@ class CredentialStore extends Wizard $('#li_snmp_2').show(); if ($('#li_snmp_1').length > 0) { - $('#version').val('1'); + //$('#version').val('1'); $('#version').trigger('change'); } else { const ul = $('#modal_form').children('ul')[0]; diff --git a/pandora_console/include/class/CustomNetScan.class.php b/pandora_console/include/class/CustomNetScan.class.php index 2fec9d8b9a..409f5636cf 100644 --- a/pandora_console/include/class/CustomNetScan.class.php +++ b/pandora_console/include/class/CustomNetScan.class.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/class/Diagnostics.class.php b/pandora_console/include/class/Diagnostics.class.php index 7599e3c71d..7483cbca30 100644 --- a/pandora_console/include/class/Diagnostics.class.php +++ b/pandora_console/include/class/Diagnostics.class.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/class/EventSound.class.php b/pandora_console/include/class/EventSound.class.php index 41e54cc4ff..e485ac4dfb 100644 --- a/pandora_console/include/class/EventSound.class.php +++ b/pandora_console/include/class/EventSound.class.php @@ -10,13 +10,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. @@ -209,7 +209,7 @@ class EventSound extends HTML $titleHeader = __('Add new sound'); } else { $helpHeader = 'servers_ha_clusters_tab'; - $titleHeader = __('Accoustic console sound list'); + $titleHeader = __('Acoustic console sound list'); } // Header. @@ -227,7 +227,7 @@ class EventSound extends HTML ], [ 'link' => '', - 'label' => __('Accoustic console setup'), + 'label' => __('Acoustic console setup'), ], ] ); diff --git a/pandora_console/include/class/ExternalTools.class.php b/pandora_console/include/class/ExternalTools.class.php index b086dd0419..7165a4fcbb 100644 --- a/pandora_console/include/class/ExternalTools.class.php +++ b/pandora_console/include/class/ExternalTools.class.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/class/HTML.class.php b/pandora_console/include/class/HTML.class.php index 5ef8dac20c..cb04097f33 100644 --- a/pandora_console/include/class/HTML.class.php +++ b/pandora_console/include/class/HTML.class.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/class/Heatmap.class.php b/pandora_console/include/class/Heatmap.class.php index 8d5a4aadd9..34ef485d8b 100644 --- a/pandora_console/include/class/Heatmap.class.php +++ b/pandora_console/include/class/Heatmap.class.php @@ -10,13 +10,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. @@ -102,12 +102,26 @@ class Heatmap protected $group = null; /** - * Heatmap group. + * Heatmap dashboard. * * @var boolean */ protected $dashboard = null; + /** + * Public hash. + * + * @var boolean + */ + protected $hash = null; + + /** + * Public user. + * + * @var boolean + */ + protected $publicUser = null; + /** * Constructor function @@ -131,7 +145,9 @@ class Heatmap int $height=0, string $search=null, int $group=1, - bool $dashboard=false + bool $dashboard=false, + string $hash='', + string $publicUser='' ) { $this->type = $type; $this->filter = $filter; @@ -142,6 +158,8 @@ class Heatmap $this->search = $search; $this->group = $group; $this->dashboard = $dashboard; + $this->hash = $hash; + $this->publicUser = $publicUser; } @@ -164,15 +182,18 @@ class Heatmap false ), 'data' => [ - 'page' => 'operation/heatmap', - 'method' => 'showHeatmap', - 'randomId' => $this->randomId, - 'type' => $this->type, - 'filter' => $this->filter, - 'refresh' => $this->refresh, - 'search' => $this->search, - 'group' => $this->group, - 'dashboard' => (int) $this->dashboard, + 'page' => 'operation/heatmap', + 'method' => 'showHeatmap', + 'randomId' => $this->randomId, + 'type' => $this->type, + 'filter' => $this->filter, + 'refresh' => $this->refresh, + 'search' => $this->search, + 'group' => $this->group, + 'dashboard' => (int) $this->dashboard, + 'auth_hash' => $this->hash, + 'auth_class' => 'PandoraFMS\Dashboard\Manager', + 'id_user' => $this->publicUser, ], ]; diff --git a/pandora_console/include/class/HelpFeedBack.class.php b/pandora_console/include/class/HelpFeedBack.class.php index bfbf4adc4e..d78ac3cb76 100644 --- a/pandora_console/include/class/HelpFeedBack.class.php +++ b/pandora_console/include/class/HelpFeedBack.class.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/class/ManageNetScanScripts.class.php b/pandora_console/include/class/ManageNetScanScripts.class.php index a6c07f46b0..b4e2a9a17f 100644 --- a/pandora_console/include/class/ManageNetScanScripts.class.php +++ b/pandora_console/include/class/ManageNetScanScripts.class.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. @@ -553,7 +553,7 @@ class ManageNetScanScripts extends Wizard $table->colspan['recon_name'][1] = 3; $data = []; - $data[0] = __('Script fullpath'); + $data[0] = __('Script full path'); $data[1] = ''; $table->data['recon_fullpath'] = $data; $table->colspan['recon_fullpath'][1] = 3; @@ -732,9 +732,9 @@ class ManageNetScanScripts extends Wizard true ); $datam[0] .= ''; - $datam[0] .= '
'; @@ -535,9 +571,14 @@ if ($show_update_action_menu) { ); $data .= '
'; - $data .= __('Threshold'); + $data .= __('Threshold').ui_print_help_tip(__('If a value of 0 is assigned, the Threshold of the action will be used.'), true); $data .= ''; $data .= html_print_extended_select_for_time( @@ -555,7 +596,7 @@ if ($show_update_action_menu) { false, '', false, - true + false ); $data .= '
- logo + + logo +

'.$product_name.'

-

'.__('Version').' '.$pandora_version.' - '.(enterprise_installed() ? 'Enterprise' : 'Community').'

+

'.__('Version').' '.$pandora_version.$lts_name.' - '.(enterprise_installed() ? 'Enterprise' : 'Community').'

'.__('MR version').' MR'.$config['MR'].'

-

'.__('Build').' '.$build_version.'

-

'.__('Support expires').' 2023/04/26

'; +

Build'.$build_version.'

'; + if (enterprise_installed() === true) { + $dialog .= '

'.__('Support expires').''.$license_expiry_date.'

'; + } + + if ($license_expired === false) { + $dialog .= '

'.__('This system has official support, warranty and official updates.').'

'; + } else if (enterprise_installed() === true) { + $dialog .= '

'.__('This system has no active support contract, and has no support, upgrades or warranty.').'

'; + $dialog .= '

'.__('Contact Pandora FMS for expand your support contract.').'

'; + } else { + $dialog .= '

'.__('The OpenSource version has no support or warranty of any kind.').'

'; + $dialog .= '

'.__('Contact Pandora FMS for official support contract.').'

'; + } if (((bool) check_acl($config['id_user'], 0, 'PM') === true) && (is_metaconsole() === false)) { $dialogButtons = []; @@ -969,7 +994,7 @@ if (is_ajax()) { 'location.href="'.ui_get_full_url('/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=history', false, false, false).'"', [ 'icon' => 'cog', - 'mode' => 'mini secondary', + 'mode' => 'secondary', ], true ); @@ -981,7 +1006,7 @@ if (is_ajax()) { 'location.href="'.ui_get_full_url('/index.php?sec=gextensions&sec2=tools/diagnostics', false, false, false).'"', [ 'icon' => 'info', - 'mode' => 'mini secondary', + 'mode' => 'secondary', ], true ); @@ -1000,7 +1025,7 @@ if (is_ajax()) {
- +
@@ -1015,7 +1040,7 @@ if (is_ajax()) {

'.$db_health->data->unknownAgents->name.'

@@ -1023,7 +1048,7 @@ if (is_ajax()) {

'.$db_health->data->notInitAgents->name.'

@@ -1031,7 +1056,7 @@ if (is_ajax()) {

'.$db_health->data->pandoraDbLastRun->name.'

@@ -1045,7 +1070,7 @@ if (is_ajax()) {

'.$db_info->data->dbSchemeFirstVersion->name.'

@@ -1053,7 +1078,7 @@ if (is_ajax()) {

'.$db_info->data->dbSchemeVersion->name.'

@@ -1061,7 +1086,7 @@ if (is_ajax()) {

'.$db_info->data->dbSchemeBuild->name.'

@@ -1069,7 +1094,7 @@ if (is_ajax()) {

'.$db_info->data->dbSize->name.'

@@ -1083,7 +1108,7 @@ if (is_ajax()) {

'.$db_fragmentation->data->tablesFragmentationMax->name.'

@@ -1091,7 +1116,7 @@ if (is_ajax()) {

'.$db_fragmentation->data->tablesFragmentationValue->name.'

@@ -1114,11 +1139,11 @@ if (is_ajax()) { - @@ -1126,7 +1151,7 @@ if (is_ajax()) {

'.$sys_info->data->ramInfo->name.'

@@ -1134,7 +1159,7 @@ if (is_ajax()) {

'.$sys_info->data->osInfo->name.'

@@ -1142,7 +1167,7 @@ if (is_ajax()) {

'.$sys_info->data->hostnameInfo->name.'

@@ -1150,7 +1175,7 @@ if (is_ajax()) {

'.$sys_info->data->ipInfo->name.'

@@ -1158,7 +1183,7 @@ if (is_ajax()) {

'.$system_date->data->date->name.'

@@ -1173,11 +1198,11 @@ if (is_ajax()) { - @@ -1185,7 +1210,7 @@ if (is_ajax()) {

'.$php_sys->data->maxExecutionTime->name.'

@@ -1193,7 +1218,7 @@ if (is_ajax()) {

'.$php_sys->data->maxInputTime->name.'

@@ -1201,7 +1226,7 @@ if (is_ajax()) {

'.$php_sys->data->memoryLimit->name.'

@@ -1209,7 +1234,7 @@ if (is_ajax()) {

'.$php_sys->data->sessionLifetime->name.'

@@ -1220,4 +1245,104 @@ if (is_ajax()) { echo $dialog; } + + if ($about_operation) { + global $config; + global $pandora_version; + global $build_version; + $product_name = io_safe_output(get_product_name()); + $license_expiry_date = substr($config['license_expiry_date'], 0, 4).'/'.substr($config['license_expiry_date'], 4, 2).'/'.substr($config['license_expiry_date'], 6, 2); + $license_expired = false; + $timestamp = strtotime($license_expiry_date); + if ($timestamp < time() || enterprise_installed() === false) { + $license_expired = true; + } + + $lts_name = ''; + if (empty($config['lts_name']) === false) { + $lts_name = ' '.$config['lts_name'].''; + } + + $image_about = ui_get_full_url('/images/custom_logo/logo-default-pandorafms.png', false, false, false); + if (enterprise_installed() === false) { + if ($config['style'] === 'pandora_black') { + $image_about = 'images/custom_logo/'.HEADER_LOGO_BLACK_CLASSIC; + } else if ($config['style'] === 'pandora') { + $image_about = 'images/custom_logo/'.HEADER_LOGO_DEFAULT_CLASSIC; + } + } else { + if ($config['style'] === 'pandora_black' && $config['custom_logo'] === HEADER_LOGO_DEFAULT_CLASSIC) { + $config['custom_logo'] = HEADER_LOGO_BLACK_CLASSIC; + } else if ($config['style'] === 'pandora' && $config['custom_logo'] === HEADER_LOGO_BLACK_CLASSIC) { + $config['custom_logo'] = HEADER_LOGO_DEFAULT_CLASSIC; + } + + $image_about = 'images/custom_logo/'.$config['custom_logo']; + + if (file_exists(ENTERPRISE_DIR.'/'.$image_about) === true) { + $image_about = ENTERPRISE_DIR.'/'.$image_about; + } + } + + if (is_metaconsole() === true) { + $image_about = ui_get_full_url('/enterprise/images/custom_logo/pandoraFMS_metaconsole_full.svg', false, false, false); + + if ($config['meta_custom_logo'] === 'pandoraFMS_metaconsole_full.svg') { + $image_about = 'images/custom_logo/'.$config['meta_custom_logo']; + } else { + $image_about = '../images/custom_logo/'.$config['meta_custom_logo']; + } + + if (file_exists(ENTERPRISE_DIR.'/'.$image_about) === true) { + $image_about = $image_about; + } + } + + + $dialog = ' +
-

'.$db_health->data->unknownAgents->value.'

+

'.$db_health->data->unknownAgents->value.'

-

'.$db_health->data->notInitAgents->value.'

+

'.$db_health->data->notInitAgents->value.'

-

'.$db_health->data->pandoraDbLastRun->value.'

+

'.$db_health->data->pandoraDbLastRun->value.'

-

'.$db_info->data->dbSchemeFirstVersion->value.'

+

'.$db_info->data->dbSchemeFirstVersion->value.'

-

'.$db_info->data->dbSchemeVersion->value.'

+

'.$db_info->data->dbSchemeVersion->value.'

-

'.$db_info->data->dbSchemeBuild->value.'

+

'.$db_info->data->dbSchemeBuild->value.'

-

'.$db_info->data->dbSize->value.'

+

'.$db_info->data->dbSize->value.'

-

'.$db_fragmentation->data->tablesFragmentationMax->value.'

+

'.$db_fragmentation->data->tablesFragmentationMax->value.'

-

'.$db_fragmentation->data->tablesFragmentationValue->value.'

+

'.$db_fragmentation->data->tablesFragmentationValue->value.'

+

'.$sys_info->data->cpuInfo->name.'

-

'.$sys_info->data->cpuInfo->value.'

+

'.$sys_info->data->cpuInfo->value.'

-

'.$sys_info->data->ramInfo->value.'

+

'.$sys_info->data->ramInfo->value.'

-

'.$sys_info->data->osInfo->value.'

+

'.$sys_info->data->osInfo->value.'

-

'.$sys_info->data->hostnameInfo->value.'

+

'.$sys_info->data->hostnameInfo->value.'

-

'.$sys_info->data->ipInfo->value.'

+

'.$sys_info->data->ipInfo->value.'

-

'.$system_date->data->date->value.'

+

'.$system_date->data->date->value.'

+

'.$php_sys->data->phpVersion->name.'

-

'.$php_sys->data->phpVersion->value.'

+

'.$php_sys->data->phpVersion->value.'

-

'.$php_sys->data->maxExecutionTime->value.'

+

'.$php_sys->data->maxExecutionTime->value.'

-

'.$php_sys->data->maxInputTime->value.'

+

'.$php_sys->data->maxInputTime->value.'

-

'.$php_sys->data->memoryLimit->value.'

+

'.$php_sys->data->memoryLimit->value.'

-

'.$php_sys->data->sessionLifetime->value.'

+

'.$php_sys->data->sessionLifetime->value.'

+ + + + + + +
+ + logo + + +

'.$product_name.'

+

'.__('Version').' '.$pandora_version.$lts_name.' - '.(enterprise_installed() ? 'Enterprise' : 'Community').'

+

'.__('MR version').' MR'.$config['MR'].'

+

Build'.$build_version.'

'; + if (enterprise_installed() === true) { + $dialog .= '

'.__('Support expires').''.$license_expiry_date.'

'; + } + + if ($license_expired === false) { + $dialog .= '

'.__('This system has official support, warranty and official updates.').'

'; + } else if (enterprise_installed() === true) { + $dialog .= '

'.__('This system has no active support contract, and has no support, upgrades or warranty.').'

'; + $dialog .= '

'.__('Contact Pandora FMS for expand your support contract.').'

'; + } else { + $dialog .= '

'.__('The OpenSource version has no support or warranty of any kind.').'

'; + $dialog .= '

'.__('Contact Pandora FMS for official support contract.').'

'; + } + + $dialog .= '
+ +
+ + '; + + echo $dialog; + } } diff --git a/pandora_console/include/functions_messages.php b/pandora_console/include/functions_messages.php index b92073baee..189844c174 100644 --- a/pandora_console/include/functions_messages.php +++ b/pandora_console/include/functions_messages.php @@ -11,13 +11,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/functions_migration.php b/pandora_console/include/functions_migration.php index a473369267..b4e80c7f54 100644 --- a/pandora_console/include/functions_migration.php +++ b/pandora_console/include/functions_migration.php @@ -1,9 +1,9 @@ $value) { + if ($value !== 0) { + $array_parent_module_id[] = $key; + get_agent_module_childs($array_parent_module_id, $key, $id_agente); + } + } + } +} diff --git a/pandora_console/include/functions_netflow.php b/pandora_console/include/functions_netflow.php index 66e1ad1a9f..59d02ccb4f 100644 --- a/pandora_console/include/functions_netflow.php +++ b/pandora_console/include/functions_netflow.php @@ -6,10 +6,10 @@ * @package Functons. * @subpackage Netflow functions. * - * Pandora FMS - http://pandorafms.com + * Pandora FMS - https://pandorafms.com * ================================================== - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; version 2 diff --git a/pandora_console/include/functions_network.php b/pandora_console/include/functions_network.php index 1945b5428b..1135c46ddf 100644 --- a/pandora_console/include/functions_network.php +++ b/pandora_console/include/functions_network.php @@ -5,10 +5,10 @@ * @package Include. * @subpackage Network functions. * - * Pandora FMS - http://pandorafms.com + * Pandora FMS - https://pandorafms.com * ================================================== - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; version 2 diff --git a/pandora_console/include/functions_network_components.php b/pandora_console/include/functions_network_components.php index f6c0087b37..64e59ee28b 100644 --- a/pandora_console/include/functions_network_components.php +++ b/pandora_console/include/functions_network_components.php @@ -1,8 +1,8 @@ $id_parent], 'id_sg'); + + if ($ids !== false) { + foreach ($ids as $key => $id) { + $groups = network_component_get_groups_recursive($id['id_sg'], $groups); + } + } + + return $groups; +} diff --git a/pandora_console/include/functions_network_profiles.php b/pandora_console/include/functions_network_profiles.php index d8b437822b..279a2e31e0 100644 --- a/pandora_console/include/functions_network_profiles.php +++ b/pandora_console/include/functions_network_profiles.php @@ -1,9 +1,9 @@ __('Add elements'), - 'style' => 'rotate: 90deg', + 'style' => 'rotate: 180deg', 'onclick' => sprintf( "notifications_modify_two_ways_element('%s', '%s', 'add')", $users, @@ -970,11 +970,7 @@ function notifications_print_two_ways_select($info_selec, $users, $source_id) __('Add'), 'Add', false, - sprintf( - "notifications_add_source_element_to_database('%s', '%s')", - $users, - $source_id - ), + 'notifications_add_source_element_to_database("'.$users.'",'.$source_id.')', "class='sub add'", true ) diff --git a/pandora_console/include/functions_os.php b/pandora_console/include/functions_os.php index 64020cb6aa..55d1eb264c 100755 --- a/pandora_console/include/functions_os.php +++ b/pandora_console/include/functions_os.php @@ -1,9 +1,9 @@ 0 AND id_os=%d', $table, + $table, $id_os ) ); @@ -36,10 +37,11 @@ function os_agents_critical($id_os) sprintf( 'SELECT COUNT(*) FROM %s - WHERE tagente.disabled=0 AND + WHERE %s.disabled=0 AND critical_count>0 AND id_os=%d AND id_grupo IN (%s)', $table, + $table, $id_os, implode(',', $groups) ) @@ -60,9 +62,10 @@ function os_agents_ok($id_os) sprintf( 'SELECT COUNT(*) FROM %s - WHERE tagente.disabled=0 AND + WHERE %s.disabled=0 AND normal_count=total_count AND id_os=%d', $table, + $table, $id_os ) ); @@ -73,10 +76,11 @@ function os_agents_ok($id_os) sprintf( 'SELECT COUNT(*) FROM %s - WHERE tagente.disabled=0 AND + WHERE %s.disabled=0 AND normal_count=total_count AND id_os=%d AND id_grupo IN (%s)', $table, + $table, $id_os, implode(',', $groups) ) @@ -97,10 +101,11 @@ function os_agents_warning($id_os) sprintf( 'SELECT COUNT(*) FROM %s - WHERE tagente.disabled=0 AND + WHERE %s.disabled=0 AND critical_count=0 AND warning_count>0 AND id_os=%d', $table, + $table, $id_os ) ); @@ -111,10 +116,11 @@ function os_agents_warning($id_os) sprintf( 'SELECT COUNT(*) FROM %s - WHERE tagente.disabled=0 AND + WHERE %s.disabled=0 AND critical_count=0 AND warning_count>0 AND id_os=%d AND id_grupo IN (%s)', $table, + $table, $id_os, implode(',', $groups) ) @@ -135,10 +141,11 @@ function os_agents_unknown($id_os) sprintf( 'SELECT COUNT(*) FROM %s - WHERE tagente.disabled=0 AND + WHERE %s.disabled=0 AND critical_count=0 AND warning_count=0 AND unknown_count>0 AND id_os=%d', $table, + $table, $id_os ) ); @@ -149,10 +156,11 @@ function os_agents_unknown($id_os) sprintf( 'SELECT COUNT(*) FROM %s - WHERE tagente.disabled=0 AND + WHERE %s.disabled=0 AND critical_count=0 AND warning_count=0 AND unknown_count>0 AND id_os=%d AND id_grupo IN (%s)', $table, + $table, $id_os, implode(',', $groups) ) @@ -179,7 +187,8 @@ function os_agents_total(int $id_os) sprintf( 'SELECT COUNT(*) FROM %s - WHERE tagente.disabled=0 AND id_os=%d', + WHERE %s.disabled=0 AND id_os=%d', + $table, $table, $id_os ) @@ -191,7 +200,8 @@ function os_agents_total(int $id_os) sprintf( 'SELECT COUNT(*) FROM %s - WHERE tagente.disabled=0 AND id_os=%d AND id_grupo IN (%s)', + WHERE %s.disabled=0 AND id_os=%d AND id_grupo IN (%s)', + $table, $table, $id_os, implode(',', $groups) diff --git a/pandora_console/include/functions_pandora_networkmap.php b/pandora_console/include/functions_pandora_networkmap.php index adc967caad..8eaf529076 100644 --- a/pandora_console/include/functions_pandora_networkmap.php +++ b/pandora_console/include/functions_pandora_networkmap.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/functions_planned_downtimes.php b/pandora_console/include/functions_planned_downtimes.php index 38ee77a422..d9925a24b2 100644 --- a/pandora_console/include/functions_planned_downtimes.php +++ b/pandora_console/include/functions_planned_downtimes.php @@ -1,9 +1,9 @@ 0, + 'date_to' => time(), + ]; + + $result = db_process_sql_update( + 'tplanned_downtime', + $values, + ['id' => $id_downtime] + ); + break; default: // Nothing to do. diff --git a/pandora_console/include/functions_plugins.php b/pandora_console/include/functions_plugins.php index 8cdd2fdab6..8213cbe560 100644 --- a/pandora_console/include/functions_plugins.php +++ b/pandora_console/include/functions_plugins.php @@ -9,13 +9,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. diff --git a/pandora_console/include/functions_post_process.php b/pandora_console/include/functions_post_process.php index e866431dbc..6eddf99e6a 100755 --- a/pandora_console/include/functions_post_process.php +++ b/pandora_console/include/functions_post_process.php @@ -1,9 +1,9 @@ $value) { - $group_stats[$key] += $value; + if (array_key_exists($key, $group_stats)) { + $group_stats[$key] += $value; + } } if (is_metaconsole() === true) { @@ -7538,7 +7542,7 @@ function reporting_text($report, $content) * * @return array */ -function reporting_sql($report, $content) +function reporting_sql($report, $content, $pdf=false) { global $config; @@ -7567,10 +7571,10 @@ function reporting_sql($report, $content) if (is_metaconsole() === true && $content['server_name'] === 'all') { $sync = new Synchronizer(); $results = $sync->apply( - function ($node) use ($report, $content) { + function ($node) use ($report, $content, $pdf) { try { $node->connect(); - $rs = reporting_sql_auxiliary($report, $content); + $rs = reporting_sql_auxiliary($report, $content, $pdf); $node->disconnect(); } catch (Exception $e) { return [ @@ -7620,7 +7624,7 @@ function reporting_sql($report, $content) $node->connect(); } - $query_result = reporting_sql_auxiliary($report, $content); + $query_result = reporting_sql_auxiliary($report, $content, $pdf); $return = array_merge($return, $query_result); if (is_metaconsole() === true && $id_server > 0) { @@ -7645,8 +7649,10 @@ function reporting_sql($report, $content) * * @return array */ -function reporting_sql_auxiliary($report, $content) +function reporting_sql_auxiliary($report, $content, $pdf=false) { + global $config; + if ($content['treport_custom_sql_id'] != 0) { $sql = io_safe_output( db_get_value_filter( @@ -7659,6 +7665,46 @@ function reporting_sql_auxiliary($report, $content) $sql = $content['external_source']; } + if ($pdf === true && isset($config['limit_sql_pdf']) === true && $config['limit_sql_pdf'] > 0) { + $pattern_limit_offset = '/LIMIT\s+(\d+)(?:\s*,\s*(\d+))?/i'; + + if (preg_match($pattern_limit_offset, $sql, $matches_limit_offset)) { + // Item query contains a LIMIT clause. + $limit1 = (int) $matches_limit_offset[1]; + + if (isset($matches_limit_offset[2]) === true && $matches_limit_offset[2] !== '') { + // The LIMIT clause has a second limit value in the form of LIMIT X, Y. + $limit2 = (int) $matches_limit_offset[2]; + + if ($config['limit_sql_pdf'] < $limit2) { + // Overwrite the second limit value only if $config['limit_sql_pdf'] is less than the original limit. + $new_limit2 = $config['limit_sql_pdf']; + $sql = preg_replace($pattern_limit_offset, " LIMIT $limit1, $new_limit2", $sql); + } + } else { + // The LIMIT clause is a simple LIMIT in the form of LIMIT X. + if ($config['limit_sql_pdf'] < $limit1) { + // Overwrite the limit value only if $config['limit_sql_pdf'] is less than the original limit. + $new_limit1 = $config['limit_sql_pdf']; + $sql = preg_replace($pattern_limit_offset, " LIMIT $new_limit1", $sql); + } + } + } else { + $limit_str = ' LIMIT '.$config['limit_sql_pdf']; + + // Check if SQL ends with semicolon or "\G". + if (substr(trim($sql), -1) === ';') { + $sql = rtrim($sql, ';'); + $sql .= $limit_str.';'; + } else if (substr(trim($sql), -2) === '\\G') { + $sql = rtrim($sql, '\G'); + $sql .= $limit_str.'\G'; + } else { + $sql .= $limit_str; + } + } + } + // Check if SQL macro exists. $sql = reporting_sql_macro($report, $sql); @@ -7689,6 +7735,7 @@ function reporting_sql_auxiliary($report, $content) } $result = db_get_all_rows_sql($sql, $historical_db); + if ($result !== false) { foreach ($result as $row) { $data_row = []; @@ -7711,7 +7758,7 @@ function reporting_sql_auxiliary($report, $content) } } else { $return['correct'] = 0; - $return['error'] = __('Illegal query: Due security restrictions, there are some tokens or words you cannot use: *, delete, drop, alter, modify, password, pass, insert or update.'); + $return['error'] = __('Illegal query: Due to security restrictions, there are some tokens or words you cannot use: *, delete, drop, alter, modify, password, pass, insert or update.'); } return $return; @@ -9123,7 +9170,7 @@ function reporting_availability($report, $content, $date=false, $time=false) modules_get_agentmodule_agent($item['id_agent_module']) ); - if (empty($text)) { + if (empty($row['data']['availability_item'])) { $row['data']['availability_item'] = __('No Address'); } } else { @@ -12095,7 +12142,7 @@ function reporting_get_stats_indicators($data, $width=280, $height=20, $html=tru $table_ind->data[] = $tdata; $tdata[0] = '
- '.__('Module sanityX').ui_print_help_tip(sprintf(__('%d Not inited monitors'), (int) $data['monitor_not_init']), true).''.progress_bar($data['module_sanity'], $width, $height, $data['module_sanity'].'% '.__('of total modules inited'), 0).'
'; + '.__('Module sanity').ui_print_help_tip(sprintf(__('%d Not inited monitors'), (int) $data['monitor_not_init']), true).''.progress_bar($data['module_sanity'], $width, $height, $data['module_sanity'].'% '.__('of total modules inited'), 0).''; $table_ind->rowclass[] = ''; $table_ind->data[] = $tdata; @@ -12299,29 +12346,29 @@ function reporting_get_stats_modules_status($data, $graph_width=250, $graph_heig $tdata = []; $tdata[0] = html_print_div(['class' => 'main_menu_icon module_background_state', 'style' => 'background-color: '.COL_CRITICAL, 'title' => __('Monitor critical')], true); $tdata[1] = $data['monitor_critical'] <= 0 ? '-' : $data['monitor_critical']; - $tdata[1] = ''.$tdata[1].''; + $tdata[1] = ''.$tdata[1].''; $tdata[2] = html_print_div(['class' => 'main_menu_icon module_background_state', 'style' => 'background-color: '.COL_WARNING_DARK, 'title' => __('Monitor warning')], true); $tdata[3] = $data['monitor_warning'] <= 0 ? '-' : $data['monitor_warning']; - $tdata[3] = ''.$tdata[3].''; + $tdata[3] = ''.$tdata[3].''; $table_mbs->rowclass[] = ''; $table_mbs->data[] = $tdata; $tdata = []; $tdata[0] = html_print_div(['class' => 'main_menu_icon module_background_state', 'style' => 'background-color: '.COL_NORMAL, 'title' => __('Monitor normal')], true); $tdata[1] = $data['monitor_ok'] <= 0 ? '-' : $data['monitor_ok']; - $tdata[1] = ''.$tdata[1].''; + $tdata[1] = ''.$tdata[1].''; $tdata[2] = html_print_div(['class' => 'main_menu_icon module_background_state', 'style' => 'background-color: '.COL_UNKNOWN, 'title' => __('Monitor unknown')], true); $tdata[3] = $data['monitor_unknown'] <= 0 ? '-' : $data['monitor_unknown']; - $tdata[3] = ''.$tdata[3].''; + $tdata[3] = ''.$tdata[3].''; $table_mbs->rowclass[] = ''; $table_mbs->data[] = $tdata; $tdata = []; $tdata[0] = html_print_div(['class' => 'main_menu_icon module_background_state', 'style' => 'background-color: '.COL_NOTINIT, 'title' => __('Monitor not init')], true); $tdata[1] = $data['monitor_not_init'] <= 0 ? '-' : $data['monitor_not_init']; - $tdata[1] = ''.$tdata[1].''; + $tdata[1] = ''.$tdata[1].''; $tdata[2] = $tdata[3] = ''; $table_mbs->rowclass[] = ''; @@ -14696,11 +14743,11 @@ function reporting_get_agentmodule_sla_day($id_agent_module, $period=0, $min_val } -function reporting_get_stats_servers() +function reporting_get_stats_servers($filter=[]) { global $config; - $server_performance = servers_get_performance(); + $server_performance = servers_get_performance($filter); // Alerts table $table_srv = html_get_predefined_table(); @@ -14814,7 +14861,13 @@ function reporting_get_stats_servers() 'class' => 'main_menu_icon invert_filter', ] ); - $tdata[1] = ''.html_print_image('images/spinner.gif', true).''; + $sql_count_event = 'SELECT SQL_NO_CACHE COUNT(id_evento) FROM tevento '; + if ($config['event_view_hr']) { + $sql_count_event .= 'WHERE utimestamp > (UNIX_TIMESTAMP(NOW()) - '.($config['event_view_hr'] * SECONDS_1HOUR).')'; + } + + $system_events = db_get_value_sql($sql_count_event); + $tdata[1] = ''.$system_events.''; if (isset($system_events) && $system_events > 50000 && !enterprise_installed()) { $tdata[2] = "
"; @@ -14836,6 +14889,9 @@ function reporting_get_stats_servers() $output .= 'var parameters = {};'; $output .= 'parameters["page"] = "include/ajax/events";'; $output .= 'parameters["total_events"] = 1;'; + if (empty($filter) === false && empty($filter['groups']) === false) { + $output .= 'parameters["filter_groups"] = "'.$filter['groups'].'";'; + } $output .= '$.ajax({type: "GET",url: "'.ui_get_full_url('ajax.php', false, false, false).'",data: parameters,'; $output .= 'success: function(data) {'; @@ -15832,7 +15888,11 @@ function reporting_module_histogram_graph($report, $content, $pdf=0) $return['time_critical'] = $data['time_error']; $return['time_warning'] = $data['time_warning']; $return['time_ok'] = $data['time_ok']; - $return['percent_ok'] = (($data['checks_ok'] * 100) / $data['checks_total']); + if ($data['checks_total'] > 0) { + $return['percent_ok'] = (($data['checks_ok'] * 100) / $data['checks_total']); + } else { + $return['percent_ok'] = 0; + } $colors = [ 1 => COL_NORMAL, @@ -15845,6 +15905,11 @@ function reporting_module_histogram_graph($report, $content, $pdf=0) ]; $width_graph = 100; + if ($metaconsole_on && $server_name != '') { + // Restore db connection. + metaconsole_restore_db(); + } + if (empty($array_result) === false) { $return['chart'] = flot_slicesbar_graph( $array_result, @@ -15871,11 +15936,6 @@ function reporting_module_histogram_graph($report, $content, $pdf=0) $return['chart'] = graph_nodata_image(['height' => $height_graph]); } - if ($metaconsole_on && $server_name != '') { - // Restore db connection. - metaconsole_restore_db(); - } - return reporting_check_structure_content($return); } diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 60b70c751d..2f227e430c 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -10,13 +10,13 @@ * @license See below * * ______ ___ _______ _______ ________ - * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| - * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas - * Please see http://pandorafms.org for full contribution list + * Copyright (c) 2005-2023 Pandora FMS + * Please see https://pandorafms.com/community/ for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation for version 2. @@ -5255,6 +5255,12 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) if ($data['monitor_checks'] > 0) { // Fixed width non interactive charts. $status_chart_width = $graph_width; + $monitor_data = []; + $monitor_data['monitor_critical'] = $data['monitor_critical']; + $monitor_data['monitor_warning'] = $data['monitor_warning']; + $monitor_data['monitor_ok'] = $data['monitor_ok']; + $monitor_data['monitor_unknown'] = $data['monitor_unknown']; + $monitor_data['monitor_not_init'] = $data['monitor_not_init']; $tdata[0] = '
'; $tdata[0] .= '
'; @@ -5263,12 +5269,13 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) $graph_width, $graph_height, true, - true + true, + $monitor_data ); $tdata[0] .= '
'; $tdata[0] .= '
'; } else { - $tdata[2] = html_print_image( + $tdata[0] = html_print_image( 'images/image_problem_area_small.png', true, ['width' => $graph_width] diff --git a/pandora_console/include/functions_reporting_xml.php b/pandora_console/include/functions_reporting_xml.php index 9b733c40d3..b92bd63147 100644 --- a/pandora_console/include/functions_reporting_xml.php +++ b/pandora_console/include/functions_reporting_xml.php @@ -1,9 +1,9 @@ 0 - AND delete_pending = 0 - AND tagente.disabled = 0 - GROUP BY tagente_modulo.id_modulo' - ); + if (is_metaconsole() === true) { + $counts = []; + $servers = metaconsole_get_servers(); + + // Check if the group can be deleted or not. + if (isset($servers) === true + && is_array($servers) === true + ) { + foreach ($servers as $server) { + if (metaconsole_connect($server) == NOERR) { + $meta_counts = db_get_all_rows_sql( + 'SELECT tagente_modulo.id_modulo, + COUNT(tagente_modulo.id_agente_modulo) modules + FROM tagente_modulo, tagente_estado, tagente + WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo + AND tagente.id_agente = tagente_estado.id_agente + AND tagente_modulo.disabled = 0 + AND tagente_modulo.id_modulo <> 0 + AND delete_pending = 0 + AND tagente.disabled = 0 + '.$filter_group.' + GROUP BY tagente_modulo.id_modulo' + ); + foreach ($meta_counts as $key => $val) { + if (array_key_exists($key, $counts)) { + if ($meta_counts[$key]['id_modulo'] == $counts[$key]['id_modulo']) { + $counts[$key]['modules'] += $meta_counts[$key]['modules']; + } + } else { + $counts[$key] = $meta_counts[$key]; + } + } + } + + metaconsole_restore_db(); + } + } + } else { + $counts = db_get_all_rows_sql( + 'SELECT tagente_modulo.id_modulo, + COUNT(tagente_modulo.id_agente_modulo) modules + FROM tagente_modulo, tagente_estado, tagente + WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo + AND tagente.id_agente = tagente_estado.id_agente + AND tagente_modulo.disabled = 0 + AND tagente_modulo.id_modulo <> 0 + AND delete_pending = 0 + AND tagente.disabled = 0 + '.$filter_group.' + GROUP BY tagente_modulo.id_modulo' + ); + } if (empty($counts)) { $counts = []; @@ -284,28 +330,76 @@ function servers_get_performance() } $interval_avgs = []; + if (is_metaconsole() === true) { + $interval_avgs_modules = []; + $servers = metaconsole_get_servers(); - // Avg of modules interval when modules have module_interval > 0. - $interval_avgs_modules = db_get_all_rows_sql( - 'SELECT count(tagente_modulo.id_modulo) modules , - tagente_modulo.id_modulo, - AVG(tagente_modulo.module_interval) avg_interval - FROM tagente_modulo, tagente_estado, tagente - WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo - AND tagente_modulo.disabled = 0 - AND module_interval > 0 - AND (utimestamp > 0 OR ( - id_tipo_modulo = 100 - OR (id_tipo_modulo > 21 - AND id_tipo_modulo < 23 + // Check if the group can be deleted or not. + if (isset($servers) === true + && is_array($servers) === true + ) { + foreach ($servers as $server) { + if (metaconsole_connect($server) == NOERR) { + // Avg of modules interval when modules have module_interval > 0. + $meta_interval_avgs_modules = db_get_all_rows_sql( + 'SELECT count(tagente_modulo.id_modulo) modules , + tagente_modulo.id_modulo, + AVG(tagente_modulo.module_interval) avg_interval + FROM tagente_modulo, tagente_estado, tagente + WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo + AND tagente_modulo.disabled = 0 + AND module_interval > 0 + AND (utimestamp > 0 OR ( + id_tipo_modulo = 100 + OR (id_tipo_modulo > 21 + AND id_tipo_modulo < 23 + ) + ) + ) + AND delete_pending = 0 + AND tagente.disabled = 0 + AND tagente.id_agente = tagente_estado.id_agente + GROUP BY tagente_modulo.id_modulo' + ); + + foreach ($meta_interval_avgs_modules as $key => $val) { + if (array_key_exists($key, $interval_avgs_modules)) { + if ($meta_interval_avgs_modules[$key]['id_modulo'] == $interval_avgs_modules[$key]['id_modulo']) { + $interval_avgs_modules[$key]['modules'] += $meta_interval_avgs_modules[$key]['modules']; + $interval_avgs_modules[$key]['avg_interval'] += $meta_interval_avgs_modules[$key]['avg_interval']; + } + } else { + $interval_avgs_modules[$key] = $meta_interval_avgs_modules[$key]; + } + } + } + + metaconsole_restore_db(); + } + } + } else { + // Avg of modules interval when modules have module_interval > 0. + $interval_avgs_modules = db_get_all_rows_sql( + 'SELECT count(tagente_modulo.id_modulo) modules , + tagente_modulo.id_modulo, + AVG(tagente_modulo.module_interval) avg_interval + FROM tagente_modulo, tagente_estado, tagente + WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo + AND tagente_modulo.disabled = 0 + AND module_interval > 0 + AND (utimestamp > 0 OR ( + id_tipo_modulo = 100 + OR (id_tipo_modulo > 21 + AND id_tipo_modulo < 23 + ) ) ) - ) - AND delete_pending = 0 - AND tagente.disabled = 0 - AND tagente.id_agente = tagente_estado.id_agente - GROUP BY tagente_modulo.id_modulo' - ); + AND delete_pending = 0 + AND tagente.disabled = 0 + AND tagente.id_agente = tagente_estado.id_agente + GROUP BY tagente_modulo.id_modulo' + ); + } if (empty($interval_avgs_modules)) { $interval_avgs_modules = []; diff --git a/pandora_console/include/functions_snmp.php b/pandora_console/include/functions_snmp.php index 02b904d023..afabd059cc 100644 --- a/pandora_console/include/functions_snmp.php +++ b/pandora_console/include/functions_snmp.php @@ -1,9 +1,9 @@ size[0] = '30%'; $table->size[1] = '30%'; $table->size[2] = '30%'; + $target_ip = get_parameter('target_ip', ''); + if (str_contains($target_ip, '_')) { + $custom_field = explode('_', $target_ip)[2]; + $agent_alias = get_parameter('agent_alias', ''); + $id_agente = db_get_all_rows_sql('SELECT id_agente FROM tagente WHERE alias = "'.io_safe_output($agent_alias).'"')[0]['id_agente']; + $target_ip = db_get_all_rows_sql('SELECT description FROM tagent_custom_data WHERE id_field = '.$custom_field.' AND id_agent = '.$id_agente)[0]['description']; + } $table->data[0][0] = html_print_label_input_block( __('Target IP'), @@ -711,7 +730,7 @@ function snmp_browser_print_container( [ 'type' => 'text', 'name' => 'target_ip', - 'value' => get_parameter('target_ip', ''), + 'value' => $target_ip, 'required' => true, 'size' => 25, 'maxlength' => 0, @@ -1122,10 +1141,26 @@ function snmp_browser_print_container( if ($toggle === false) { // This extra div that can be handled by jquery's dialog. - $output .= '