From a2d9aa81d0932ac601928ad2243a02826694899b Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 19 Jan 2023 14:44:30 +0100 Subject: [PATCH 001/234] #9895 Add description error login ldap --- pandora_console/index.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandora_console/index.php b/pandora_console/index.php index c712be0567..fed8053b4a 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -415,6 +415,7 @@ if (isset($config['id_user']) === false) { unset($_POST['auth_code'], $code); if (!$double_auth_success) { + $config['auth_error'] = __('Double auth error'); $login_failed = true; include_once 'general/login_page.php'; db_pandora_audit( @@ -440,6 +441,7 @@ if (isset($config['id_user']) === false) { } else if (($config['auth'] === 'saml') && ($login_button_saml)) { $saml_user_id = enterprise_hook('saml_process_user_login'); if (!$saml_user_id) { + $config['auth_error'] = __('saml error'); $login_failed = true; include_once 'general/login_page.php'; while (ob_get_length() > 0) { @@ -702,6 +704,7 @@ if (isset($config['id_user']) === false) { login_check_failed($nick); } + $config['auth_error'] = __('User is blocked'); $login_failed = true; } From fe507b2530de3f7a63b12b98d3ac7b16b6b3e4ac Mon Sep 17 00:00:00 2001 From: alejandro Date: Mon, 6 Feb 2023 13:32:19 +0100 Subject: [PATCH 002/234] Added log message in case of agent plugin failure --- pandora_agents/unix/pandora_agent | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index f75da86403..806d961606 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -3741,6 +3741,7 @@ sub module_plugin ($) { # Do not save the output if there was an error if ($? != 0) { + log_message ('error', "plugin execution '". $command ."' exited with error code " . $?); return (); } From 971fc84a470b2ebd536c970cfe7bd7f82d264ab6 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Thu, 9 Feb 2023 10:12:59 +0100 Subject: [PATCH 003/234] 9680-Create widget ModulesByStatus --- .../images/widgets/ModulesByStatus.png | Bin 0 -> 5875 bytes pandora_console/include/ajax/module.php | 258 ++++++++ pandora_console/include/functions_html.php | 26 + .../include/lib/Dashboard/Widget.php | 1 + .../lib/Dashboard/Widgets/ModulesByStatus.php | 589 ++++++++++++++++++ 5 files changed, 874 insertions(+) create mode 100644 pandora_console/images/widgets/ModulesByStatus.png create mode 100644 pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php diff --git a/pandora_console/images/widgets/ModulesByStatus.png b/pandora_console/images/widgets/ModulesByStatus.png new file mode 100644 index 0000000000000000000000000000000000000000..796ff6382a7ae408cfa6e47897a50bf42f14a969 GIT binary patch literal 5875 zcmVA>GynXv&p&enqGNL2+tHE8O1n^) zgor16=J6?+6)c*7o>jS9??ktmJv-~WpQ}VjuyVEkrry;NJ&j4^Omet zL;t>YdolpM{Fpn)=~9K< zK6Ic8gTMWk_NZ=2gHT6GN{Z%XQ(ANJyb9m{&;r$tAVP|Zl?u6Q)CkoJ_8AO7o_sBn zj`}MCy*wU42A=L5)R$D!k~+NaASu37Ob#E|PAU&x|WRji3W7(q7fs;ztDZ`-TF z;7=ohN{SU0Dr=aw#jgs>$@jYLP?0Mu%A<+&Dl62xj2YupJ1;IDWW&SECRDItfMTBmXMv?v4nQrqBr$;_LM=TYC>!x&_HruTltpVh>Y-7znQ1D z2Mm|kL;$$^vrnI$@#C2o?%1xT-587?*y&>gS`F6#QqskjSN-l5^s_ehxCqOdG?G9A z?LM`(pGP<}Asi?W7L^bN=-Ci4Zx%0GONy&`XtdujA$F8PGT^9l$2PQYBIMkKVztGs zTeg^d@ntTesP>9AM-F-!=CLEa!o&_Zvn3!XOf2~zl+HVW}1n%^)X4TEu(HJwZ=0s}Gb|o-R{!<0N6G8= zZezjZSmx0PKX{_r5dbHS{g>Uz$;qTTsF1=+fH*U&p8vUW`;hMsMk-MdDz%5)mhu;59S zh>$FY1EC~Itdd2sGW-4!wR0szHn4RQ;=3gST3xUp2hYrUXiO0w7?Dss3Gfj^1<0PB zskK}+p`6XTTgkz)9z3!e{)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2^ zy0gY&N-h_X6JH)8TmSdHQ1PY0P{$j)JwNp)PyJ6U{6*bt!${n^6G}7aJ9%_}dS&UA z>um;%Md8S9(dve(ZoLK+wrQ7c@nLi0Xie{gvSdxSsoBy*Iw{2%0koIH%28B4Nv&nH_=H(Ley8IlIW{Z!KPQE8vNC$NYUu~ z;Jvj9`rcZw>Af}m0connect(); + + $sql = sprintf( + 'SELECT + tagente_modulo.nombre, + tagente.alias, + tagente.id_agente, + tagente_estado.last_status_change, + tagente_estado.estado + FROM tagente_modulo + INNER JOIN tagente + ON tagente_modulo.id_agente = tagente.id_agente + INNER JOIN tagente_estado + ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo + WHERE %s', + $where + ); + + $res_sql = db_get_all_rows_sql($sql); + + foreach ($res_sql as $row_sql) { + $row_sql['server_name'] = $node->server_name(); + $row_sql['server_url'] = $node->server_url(); + array_push($data, $row_sql); + } + + $node->disconnect(); + } catch (\Exception $e) { + // Unexistent modules. + $node->disconnect(); + } + } + + // Drop temporary table if exist. + db_process_sql('DROP TEMPORARY TABLE IF EXISTS temp_modules_status;'); + + $table_temporary = 'CREATE TEMPORARY TABLE IF NOT EXISTS temp_modules_status ( + id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, + nombre VARCHAR(600), + alias VARCHAR(600), + id_agente INT, + last_status_change INT, + estado INT, + server_name VARCHAR(100), + server_url VARCHAR(200), + PRIMARY KEY (`id`), + KEY `nombre` (`nombre`(600)) + )'; + db_process_sql($table_temporary); + + $result = db_process_sql_insert_multiple('temp_modules_status', $data); + + if (empty($result) === false) { + $data = []; + $sql = ''; + $where = ''; + + if (empty($search) === false) { + $where = 'nombre LIKE "%%'.$search.'%%" AND '; + } + + $where .= sprintf( + 'estado IN (%s)', + $status + ); + + $order_by = $order['field'].' '.$order['direction']; + + $sql = sprintf( + 'SELECT + nombre, + alias, + id_agente, + last_status_change, + estado, + server_name, + server_url + FROM temp_modules_status + WHERE %s + ORDER BY %s + LIMIT %d, %d', + $where, + $order_by, + $start, + $length + ); + $data = db_get_all_rows_sql($sql); + + $sql_count = sprintf( + 'SELECT COUNT(*) AS "total" + FROM temp_modules_status' + ); + + $recordsTotal = db_get_value_sql($sql_count); + } + } + + if ($data === false) { + $data = []; + } + + foreach ($data as $key => $row) { + $data[$key]['nombre'] = html_ellipsis_characters($row['nombre'], 35, true); + + if (is_metaconsole() === false) { + $name_link = ''; + $name_link .= ''; + + $data[$key]['alias'] = $name_link; + + $data[$key]['last_status_change'] = ui_print_timestamp( + $row['last_status_change'], + true + ); + + switch ((int) $row['estado']) { + case 0: + $status_img = ui_print_status_image(STATUS_MODULE_OK, __('Normal'), true); + break; + + case 1: + case 6: + $status_img = ui_print_status_image(STATUS_MODULE_CRITICAL, __('Critical'), true); + break; + + case 2: + $status_img = ui_print_status_image(STATUS_MODULE_WARNING, __('Warning'), true); + break; + + case 3: + $status_img = ui_print_status_image(STATUS_MODULE_UNKNOWN, __('Unknown'), true); + break; + + case 5: + $status_img = ui_print_status_image(STATUS_MODULE_NO_DATA, __('Not init'), true); + break; + + default: + $status_img = ''; + break; + } + + $data[$key]['estado'] = $status_img; + } + + echo json_encode( + [ + 'data' => $data, + 'recordsTotal' => $recordsTotal, + 'recordsFiltered' => $recordsTotal, + ] + ); + } + if ($get_children_modules === true) { $parent_modules = get_parameter('parent_modulues', false); $children_selected = []; diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 31c2e5214a..4ace0131ab 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -6361,3 +6361,29 @@ function html_print_extended_select_for_downtime_cron( echo $returnString; } } + + +/** + * Ellipse string to x characters. + * + * @param string $string String to ellipsis. + * @param integer $characters Characters size to show. + * @return string String ellipsed. + */ +function html_ellipsis_characters( + string $string, + int $characters, + bool $return=false +) { + $out = $string; + + if (strlen($string) > $characters) { + $out = substr($string, 0, $characters).'...'; + } + + if ($return === true) { + return $out; + } else { + echo $out; + } +} \ No newline at end of file diff --git a/pandora_console/include/lib/Dashboard/Widget.php b/pandora_console/include/lib/Dashboard/Widget.php index 2753b8a55d..3b4e47cb35 100644 --- a/pandora_console/include/lib/Dashboard/Widget.php +++ b/pandora_console/include/lib/Dashboard/Widget.php @@ -420,6 +420,7 @@ class Widget case 'ColorModuleTabs': case 'BlockHistogram': case 'DataMatrix': + case 'ModulesByStatus': $className .= '\\'.$name; break; diff --git a/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php b/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php new file mode 100644 index 0000000000..8191607616 --- /dev/null +++ b/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php @@ -0,0 +1,589 @@ +width = $width; + + // Height. + $this->height = $height; + + // Grid Width. + $this->gridWidth = $gridWidth; + + // Cell Id. + $this->cellId = $cellId; + + // Options. + $this->values = $this->decoders($this->getOptionsWidget()); + + // Positions. + $this->position = $this->getPositionWidget(); + + // Page. + $this->page = basename(__FILE__); + + // ClassName. + $class = new \ReflectionClass($this); + $this->className = $class->getShortName(); + + // Title. + $this->title = __('Module status'); + + // Name. + if (empty($this->name) === true) { + $this->name = 'ModulesByStatus'; + } + + // This forces at least a first configuration. + // This forces at least a first configuration. + $this->configurationRequired = false; + if (empty($this->values['status']) === true) { + $this->configurationRequired = true; + } + + $this->overflow_scrollbars = false; + } + + + /** + * Decoders hack for retrocompability. + * + * @param array $decoder Values. + * + * @return array Returns the values ​​with the correct key. + */ + public function decoders(array $decoder): array + { + $values = []; + // Retrieve global - common inputs. + $values = parent::decoders($decoder); + + if (isset($decoder['search']) === true) { + $values['search'] = $decoder['search']; + } + + if (isset($decoder['status']) === true) { + $values['status'] = $decoder['status']; + } + + if (isset($decoder['limit']) === true) { + $values['limit'] = $decoder['limit']; + } + + if (isset($decoder['nodes']) === true) { + $values['nodes'] = $decoder['nodes']; + } + + return $values; + } + + + /** + * Generates inputs for form (specific). + * + * @return array Of inputs. + * + * @throws Exception On error. + */ + public function getFormInputs(): array + { + global $config; + + $values = $this->values; + + // Retrieve global - common inputs. + $inputs = parent::getFormInputs(); + + // Search. + $inputs[] = [ + 'label' => __('Free search').ui_print_help_tip(__('Search filter by Module name field content'), true), + 'arguments' => [ + 'name' => 'search', + 'type' => 'text', + 'value' => $values['search'], + 'return' => true, + 'size' => 0, + ], + ]; + + // Status fields. + $status_fields = []; + $status_fields[AGENT_MODULE_STATUS_NORMAL] = __('Normal'); + $status_fields[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical'); + $status_fields[AGENT_MODULE_STATUS_WARNING] = __('Warning'); + $status_fields[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown'); + $status_fields[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init'); + $status_fields[AGENT_MODULE_STATUS_NOT_NORMAL] = __('Not normal'); + $status_selected = explode(',', $values['status']); + + (isset($values['status']) === false) ? $status_selected = AGENT_MODULE_STATUS_WARNING : ''; + + $inputs[] = [ + 'label' => __('Status'), + 'arguments' => [ + 'name' => 'status', + 'type' => 'select', + 'fields' => $status_fields, + 'selected' => $status_selected, + 'return' => true, + 'multiple' => true, + 'class' => 'overflow-hidden', + 'size' => count($status_fields), + 'select_all' => false, + 'required' => true, + ], + ]; + + // Limit fields. + $limit_fields = []; + $limit_fields[5] = 5; + $limit_fields[10] = 10; + $limit_fields[25] = 25; + $limit_fields[100] = 100; + $limit_fields[200] = 200; + $limit_fields[500] = 500; + $limit_fields[1000] = 1000; + $limit_selected = explode(',', $values['limit']); + + (isset($values['limit']) === false) ? $limit_selected = 5 : ''; + + $inputs[] = [ + 'label' => __('Limit'), + 'arguments' => [ + 'name' => 'limit', + 'type' => 'select', + 'fields' => $limit_fields, + 'selected' => $limit_selected, + 'return' => true, + 'required' => true, + 'select2_enable' => false, + ], + ]; + + if (is_metaconsole() === true) { + // Nodes fields. + $nodes_fields = []; + $servers_ids = array_column(metaconsole_get_servers(), 'id'); + foreach ($servers_ids as $server_id) { + $nodes_fields[$server_id] = $server_id; + } + + $nodes_selected = explode(',', $values['nodes']); + + (isset($values['nodes']) === false) ? $nodes_selected = '' : ''; + + $inputs[] = [ + 'label' => __('Nodes'), + 'arguments' => [ + 'name' => 'nodes', + 'type' => 'select', + 'fields' => $nodes_fields, + 'selected' => $nodes_selected, + 'return' => true, + 'multiple' => true, + 'class' => 'overflow-hidden', + 'size' => count($nodes_fields), + 'select_all' => false, + 'required' => true, + ], + ]; + } + + return $inputs; + } + + + /** + * Get Post for widget. + * + * @return array + */ + public function getPost():array + { + // Retrieve global - common inputs. + $values = parent::getPost(); + + $values['search'] = \get_parameter('search', ''); + $values['status'] = \get_parameter('status', ''); + $values['limit'] = \get_parameter('limit', ''); + $values['nodes'] = \get_parameter('nodes', ''); + + return $values; + } + + + /** + * Draw widget. + * + * @return string; + */ + public function load() + { + $this->size = parent::getSize(); + + $output = ''; + + if (is_metaconsole() === true) { + $modules = []; + + $servers_ids = array_column(metaconsole_get_servers(), 'id'); + + foreach ($servers_ids as $server_id) { + try { + $node = new Node((int) $server_id); + + $node->connect(); + $modules_tmp = $this->getInfoModules( + $this->values['search'], + $this->values['status'], + $this->values['nodes'] + ); + $modules[$node->id()] = $modules_tmp[0]; + $node->disconnect(); + } catch (\Exception $e) { + // Unexistent modules. + $node->disconnect(); + } + } + } else { + $modules = $this->getInfoModules( + $this->values['search'], + $this->values['status'] + ); + } + + if ($modules !== false && empty($modules) === false) { + // Datatables list. + try { + $info_columns = $this->columns(); + $column_names = $info_columns['column_names']; + $columns = $info_columns['columns']; + + $tableId = 'ModuleByStatus_'.$this->dashboardId.'_'.$this->cellId; + // Load datatables user interface. + ui_print_datatable( + [ + 'id' => $tableId, + 'class' => 'info_table align-left-important', + 'style' => 'width: 100%', + 'columns' => $columns, + 'column_names' => $column_names, + 'ajax_url' => 'include/ajax/module', + 'ajax_data' => [ + 'get_data_ModulesByStatus' => 1, + 'table_id' => $tableId, + 'search' => $this->values['search'], + 'status' => $this->values['status'], + 'nodes' => $this->values['nodes'], + ], + 'default_pagination' => $this->values['limit'], + 'order' => [ + 'field' => 'last_status_change', + 'direction' => 'desc', + ], + 'csv' => 0, + ] + ); + } catch (\Exception $e) { + echo $e->getMessage(); + } + } else { + $output = ''; + $output .= '
'; + $output .= \ui_print_info_message( + __('Not found modules'), + '', + true + ); + $output .= '
'; + + return $output; + } + } + + + /** + * Get info modules. + * + * @param string $search Free search. + * @param string $status Modules status. + * + * @return array Data. + */ + private function getInfoModules(string $search, string $status): array + { + if (empty($search) === false) { + $where = 'tagente_modulo.nombre LIKE "%%'.$search.'%%" AND '; + } + + $where .= sprintf( + 'tagente_estado.estado IN (%s) + AND tagente_modulo.delete_pending = 0', + $status + ); + + $sql = sprintf( + 'SELECT + COUNT(*) AS "modules" + FROM tagente_modulo + INNER JOIN tagente + ON tagente_modulo.id_agente = tagente.id_agente + INNER JOIN tagente_estado + ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo + WHERE %s', + $where + ); + + $modules = db_get_all_rows_sql($sql); + + if ($modules === false) { + $modules = []; + } + + return $modules; + } + + + /** + * Get columns. + * + * @return array + */ + private function columns() + { + $columns = []; + $column_names = []; + + if (is_metaconsole() === true) { + $column_names = [ + __('Module name'), + __('Agent'), + __('Node'), + __('Last status change'), + __('Status'), + ]; + + $columns = [ + 'nombre', + 'alias', + 'server_name', + 'last_status_change', + 'estado', + ]; + } else { + $column_names = [ + __('Module name'), + __('Agent'), + __('Last status change'), + __('Status'), + ]; + + $columns = [ + 'nombre', + 'alias', + 'last_status_change', + 'estado', + ]; + } + + $data = [ + 'columns' => $columns, + 'column_names' => $column_names, + ]; + + return $data; + } + + + /** + * Get description. + * + * @return string. + */ + public static function getDescription() + { + return __('Modules by status'); + } + + + /** + * Get Name. + * + * @return string. + */ + public static function getName() + { + return 'ModulesByStatus'; + } + + + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + if (is_metaconsole() === true) { + $nodes_fields = array_column(metaconsole_get_servers(), 'id'); + + $height_counter = (((int) count($nodes_fields)) * 20); + + $size = [ + 'width' => 450, + 'height' => (520 + $height_counter), + ]; + } else { + $size = [ + 'width' => 450, + 'height' => 480, + ]; + } + + return $size; + } + + +} From f35acde8ebb822694f364843b7eb8ca9503019e0 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Thu, 9 Feb 2023 10:37:12 +0100 Subject: [PATCH 004/234] 9680-Create widget ModulesByStatus --- .../include/lib/Dashboard/Widgets/ModulesByStatus.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php b/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php index 8191607616..e2c83ca59d 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php +++ b/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php @@ -258,7 +258,7 @@ class ModulesByStatus extends Widget $status_fields[AGENT_MODULE_STATUS_NOT_NORMAL] = __('Not normal'); $status_selected = explode(',', $values['status']); - (isset($values['status']) === false) ? $status_selected = AGENT_MODULE_STATUS_WARNING : ''; + (isset($values['status']) === false) ? $status_selected = AGENT_MODULE_STATUS_CRITICAL_BAD : ''; $inputs[] = [ 'label' => __('Status'), From b439ed684ee04ea181a751aca841dfe864e4ae2b Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Fri, 10 Feb 2023 10:31:41 +0100 Subject: [PATCH 005/234] 9859-Widget AvgSumMaxMinModule --- .../images/widgets/AvgSumMaxMinModule.png | Bin 0 -> 5984 bytes .../include/lib/Dashboard/Widget.php | 1 + .../Dashboard/Widgets/AvgSumMaxMinModule.php | 701 ++++++++++++++++++ 3 files changed, 702 insertions(+) create mode 100644 pandora_console/images/widgets/AvgSumMaxMinModule.png create mode 100644 pandora_console/include/lib/Dashboard/Widgets/AvgSumMaxMinModule.php diff --git a/pandora_console/images/widgets/AvgSumMaxMinModule.png b/pandora_console/images/widgets/AvgSumMaxMinModule.png new file mode 100644 index 0000000000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?ASfe-;UphGG0HLuz+Kzp2AL$G16SKFAc;f4qDj* z&wig2@2Sz1sqEs#i*9nY5`%YnMAWYP@uN>ZH{Tb7LaA(iQI3>gpwswWsy}`|`J&d9 zGg`dydsU5^wwMv9t7x=%`U^(xA0ft{RnR<&TyEsAKB$y*P%q4)kG^g1W^CfUL6xDU zU#(x#{nW98FBBISH7D%})Z@_|5)yi9!SYyt~-WgalnB_i0xewidth = $width; + + // Height. + $this->height = $height; + + // Grid Width. + $this->gridWidth = $gridWidth; + + // Cell Id. + $this->cellId = $cellId; + + // Options. + $this->values = $this->decoders($this->getOptionsWidget()); + + // Positions. + $this->position = $this->getPositionWidget(); + + // Page. + $this->page = basename(__FILE__); + + // ClassName. + $class = new \ReflectionClass($this); + $this->className = $class->getShortName(); + + // Title. + $this->title = __('Avg|Sum|Max|Min Module Data'); + + // Name. + if (empty($this->name) === true) { + $this->name = 'AvgSumMaxMinModule'; + } + + // This forces at least a first configuration. + $this->configurationRequired = false; + if (empty($this->values['moduleId']) === true) { + $this->configurationRequired = true; + } else { + try { + if (is_metaconsole() === true + && $this->values['metaconsoleId'] > 0 + ) { + $node = new Node($this->values['metaconsoleId']); + $node->connect(); + } + + $check_exist = db_get_sql( + sprintf( + 'SELECT id_agente_modulo + FROM tagente_modulo + WHERE id_agente_modulo = %s + AND delete_pending = 0', + $this->values['moduleId'] + ) + ); + } catch (\Exception $e) { + // Unexistent agent. + if (is_metaconsole() === true + && $this->values['metaconsoleId'] > 0 + ) { + $node->disconnect(); + } + + $check_exist = false; + } finally { + if (is_metaconsole() === true + && $this->values['metaconsoleId'] > 0 + ) { + $node->disconnect(); + } + } + + if ($check_exist === false) { + $this->loadError = true; + } + } + + $this->overflow_scrollbars = false; + } + + + /** + * Decoders hack for retrocompability. + * + * @param array $decoder Values. + * + * @return array Returns the values ​​with the correct key. + */ + public function decoders(array $decoder): array + { + $values = []; + // Retrieve global - common inputs. + $values = parent::decoders($decoder); + + if (isset($decoder['label_'.$this->cellId]) === true) { + $values['label'] = $decoder['label_'.$this->cellId]; + } + + if (isset($decoder['label']) === true) { + $values['label'] = $decoder['label']; + } + + if (isset($decoder['id_agent_'.$this->cellId]) === true) { + $values['agentId'] = $decoder['id_agent_'.$this->cellId]; + } + + if (isset($decoder['type_'.$this->cellId]) === true) { + $values['type'] = $decoder['type_'.$this->cellId]; + } + + if (isset($decoder['type']) === true) { + $values['type'] = $decoder['type']; + } + + if (isset($decoder['period_'.$this->cellId]) === true) { + $values['period'] = $decoder['period_'.$this->cellId]; + } + + if (isset($decoder['period']) === true) { + $values['period'] = $decoder['period']; + } + + if (isset($decoder['agentId']) === true) { + $values['agentId'] = $decoder['agentId']; + } + + if (isset($decoder['metaconsoleId']) === true) { + $values['metaconsoleId'] = $decoder['metaconsoleId']; + } + + if (isset($decoder['id_module_'.$this->cellId]) === true) { + $values['moduleId'] = $decoder['id_module_'.$this->cellId]; + } + + if (isset($decoder['moduleId']) === true) { + $values['moduleId'] = $decoder['moduleId']; + } + + if (isset($decoder['size_value_'.$this->cellId]) === true) { + $values['sizeValue'] = $decoder['size_value_'.$this->cellId]; + } + + if (isset($decoder['sizeValue']) === true) { + $values['sizeValue'] = $decoder['sizeValue']; + } + + if (isset($decoder['size_label_'.$this->cellId]) === true) { + $values['sizeLabel'] = $decoder['size_label_'.$this->cellId]; + } + + if (isset($decoder['sizeLabel']) === true) { + $values['sizeLabel'] = $decoder['sizeLabel']; + } + + if (isset($decoder['text_color_'.$this->cellId]) === true) { + $values['text_color'] = $decoder['text_color_'.$this->cellId]; + } + + if (isset($decoder['text_color']) === true) { + $values['text_color'] = $decoder['text_color']; + } + + if (isset($decoder['unit_'.$this->cellId]) === true) { + $values['unit'] = $decoder['unit_'.$this->cellId]; + } + + if (isset($decoder['unit']) === true) { + $values['unit'] = $decoder['unit']; + } + + return $values; + } + + + /** + * Generates inputs for form (specific). + * + * @return array Of inputs. + * + * @throws Exception On error. + */ + public function getFormInputs(): array + { + global $config; + + $values = $this->values; + + // Default values. + if (isset($values['sizeLabel']) === false) { + $values['sizeLabel'] = 20; + } + + if (isset($values['sizeValue']) === false) { + $values['sizeValue'] = 20; + } + + // Retrieve global - common inputs. + $inputs = parent::getFormInputs(); + + // Label. + $inputs[] = [ + 'label' => __('Label'), + 'arguments' => [ + 'name' => 'label', + 'type' => 'text', + 'value' => $values['label'], + 'return' => true, + 'size' => 0, + ], + ]; + + // Type. + $type_fields = []; + $type_fields[0] = 'AVG'; + $type_fields[1] = 'SUM'; + $type_fields[2] = 'MAX'; + $type_fields[3] = 'MIN'; + $type_selected = explode(',', $values['type']); + + (isset($values['type']) === false) ? $type_selected = 0 : ''; + + $inputs[] = [ + 'label' => __('Type'), + 'arguments' => [ + 'name' => 'type', + 'type' => 'select', + 'fields' => $type_fields, + 'selected' => $type_selected, + 'return' => true, + 'required' => true, + 'select2_enable' => false, + 'sort' => false, + ], + ]; + + // Period. + $period_fields = []; + $period_fields[0] = __('Last 30 days'); + $period_fields[1] = __('This month'); + $period_fields[2] = __('Last 7 days'); + $period_fields[3] = __('This week'); + $period_fields[4] = __('Last 24 hrs'); + $period_fields[5] = __('Today'); + $period_selected = explode(',', $values['period']); + + (isset($values['period']) === false) ? $period_selected = 0 : ''; + + $inputs[] = [ + 'label' => __('Time period'), + 'arguments' => [ + 'name' => 'period', + 'type' => 'select', + 'fields' => $period_fields, + 'selected' => $period_selected, + 'return' => true, + 'required' => true, + 'select2_enable' => false, + 'sort' => false, + ], + ]; + + // Autocomplete agents. + $inputs[] = [ + 'label' => __('Agent'), + 'arguments' => [ + 'type' => 'autocomplete_agent', + 'name' => 'agentAlias', + 'id_agent_hidden' => $values['agentId'], + 'name_agent_hidden' => 'agentId', + 'server_id_hidden' => $values['metaconsoleId'], + 'name_server_hidden' => 'metaconsoleId', + 'return' => true, + 'module_input' => true, + 'module_name' => 'moduleId', + 'module_none' => false, + 'size' => 0, + ], + ]; + + // Autocomplete module. + $inputs[] = [ + 'label' => __('Module'), + 'arguments' => [ + 'type' => 'autocomplete_module', + 'name' => 'moduleId', + 'selected' => $values['moduleId'], + 'return' => true, + 'sort' => false, + 'agent_id' => $values['agentId'], + 'metaconsole_id' => $values['metaconsoleId'], + 'style' => 'width: inherit;', + 'filter_modules' => (users_access_to_agent($values['agentId']) === false) ? [$values['moduleId']] : [], + 'nothing' => __('None'), + 'nothing_value' => 0, + ], + ]; + + // Text size of value in px. + $inputs[] = [ + 'label' => __('Text size of value in px'), + 'arguments' => [ + 'name' => 'sizeValue', + 'type' => 'number', + 'value' => $values['sizeValue'], + 'return' => true, + 'min' => 0, + ], + ]; + + // Text size of label in px. + $inputs[] = [ + 'label' => __('Text size of label in px'), + 'arguments' => [ + 'name' => 'sizeLabel', + 'type' => 'number', + 'value' => $values['sizeLabel'], + 'return' => true, + 'min' => 0, + ], + ]; + + // Text color. + if (empty($values['text_color']) === true) { + $values['text_color'] = '#000000'; + + if ($config['style'] === 'pandora_black' + && is_metaconsole() === false + ) { + $values['text_color'] = '#eeeeee'; + } + } + + $inputs[] = [ + 'label' => __('Text color'), + 'arguments' => [ + 'wrapper' => 'div', + 'name' => 'text_color', + 'type' => 'color', + 'value' => $values['text_color'], + 'return' => true, + ], + ]; + + // Unit. + $inputs[] = [ + 'label' => __('Unit'), + 'arguments' => [ + 'wrapper' => 'div', + 'name' => 'unit', + 'type' => 'switch', + 'value' => $values['unit'], + 'return' => true, + ], + ]; + + return $inputs; + } + + + /** + * Get Post for widget. + * + * @return array + */ + public function getPost():array + { + // Retrieve global - common inputs. + $values = parent::getPost(); + + $values['label'] = \get_parameter('label', ''); + $values['type'] = \get_parameter('type', 0); + $values['period'] = \get_parameter('period', 0); + $values['agentId'] = \get_parameter('agentId', 0); + $values['metaconsoleId'] = \get_parameter('metaconsoleId', 0); + $values['moduleId'] = \get_parameter('moduleId', 0); + $values['sizeValue'] = \get_parameter('sizeValue', 0); + $values['sizeLabel'] = \get_parameter_switch('sizeLabel'); + $values['text_color'] = \get_parameter('text_color', 0); + $values['unit'] = \get_parameter_switch('unit'); + + return $values; + } + + + /** + * Draw widget. + * + * @return string; + */ + public function load() + { + global $config; + + $output = ''; + $text_color = 'color:'.$this->values['text_color'].' !important;'; + + $id_module = $this->values['moduleId']; + + $to = 0; + $now = time(); + + switch ((int) $this->values['period']) { + case 0: + $to = strtotime('-30 days'); + break; + + case 1: + $to = strtotime(date('Y-m-01 00:00:00')); + break; + + case 2: + $to = strtotime('-7 days'); + break; + + case 3: + $to = strtotime('last Monday'); + break; + + case 4: + $to = strtotime('-1 days'); + break; + + case 5: + $to = strtotime(date('Y-m-d 00:00:00')); + break; + + default: + $to = 0; + break; + } + + $data = 0; + switch ((int) $this->values['type']) { + case 0: + $rows = modules_get_raw_data($id_module, $to, $now); + $count = (int) count($rows); + $sum = 0; + foreach ($rows as $row) { + $sum += (int) $row['datos']; + } + + $data = ($sum / $count); + break; + + case 1: + $rows = modules_get_raw_data($id_module, $to, $now); + $sum = 0; + foreach ($rows as $row) { + $sum += (int) $row['datos']; + } + + $data = $sum; + break; + + case 2: + $rows = modules_get_min_max_data($id_module, $to); + + $data = $rows[0]['max']; + break; + + case 3: + $rows = modules_get_min_max_data($id_module, $to); + + $data = $rows[0]['min']; + break; + + default: + $data = 0; + break; + } + + $label = $this->values['label']; + $sizeLabel = (isset($this->values['sizeLabel']) === true) ? $this->values['sizeLabel'] : 40; + $sizeValue = (isset($this->values['sizeValue']) === true) ? $this->values['sizeValue'] : 40; + + $output .= '
'; + // General div. + $output .= '
'; + // Div value. + $output .= '
'; + + if (is_numeric($data) === true) { + $dataDatos = remove_right_zeros( + number_format( + $data, + $config['graph_precision'], + $config['decimal_separator'], + $config['thousand_separator'] + ) + ); + } else { + $dataDatos = trim($data); + } + + $unit = ''; + if (empty($this->values['unit']) === false) { + $unit = modules_get_unit($id_module); + } + + $output .= $dataDatos.' '.$unit; + + $output .= '
'; + + if (empty($label) === false) { + // Div Label. + $output .= '
'.$label.'
'; + } + + $output .= '
'; + $output .= '
'; + return $output; + } + + + /** + * Get description. + * + * @return string. + */ + public static function getDescription() + { + return __('Avg|Sum|Max|Min Module Data'); + } + + + /** + * Get Name. + * + * @return string. + */ + public static function getName() + { + return 'AvgSumMaxMinModule'; + } + + + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 550, + 'height' => 710, + ]; + + return $size; + } + + +} From 0125ba742b53269d879f7e3ca295662dc277acef Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Wed, 15 Feb 2023 11:42:50 +0100 Subject: [PATCH 006/234] 9680-Create widget ModulesByStatus --- .../lib/Dashboard/Widgets/ModulesByStatus.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php b/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php index e2c83ca59d..21fa53d21c 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php +++ b/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php @@ -302,17 +302,23 @@ class ModulesByStatus extends Widget ], ]; + // Nodes. if (is_metaconsole() === true) { - // Nodes fields. $nodes_fields = []; - $servers_ids = array_column(metaconsole_get_servers(), 'id'); - foreach ($servers_ids as $server_id) { - $nodes_fields[$server_id] = $server_id; + $servers_ids = metaconsole_get_servers(); + + foreach ($servers_ids as $server) { + $nodes_fields[$server['id']] = $server['server_name']; } $nodes_selected = explode(',', $values['nodes']); - (isset($values['nodes']) === false) ? $nodes_selected = '' : ''; + (isset($values['nodes']) === false) ? $nodes_selected = $servers_ids : ''; + + $nodes_height = count($nodes_fields); + if (count($nodes_fields) > 5) { + $nodes_height = 5; + } $inputs[] = [ 'label' => __('Nodes'), @@ -324,7 +330,7 @@ class ModulesByStatus extends Widget 'return' => true, 'multiple' => true, 'class' => 'overflow-hidden', - 'size' => count($nodes_fields), + 'size' => $nodes_height, 'select_all' => false, 'required' => true, ], From d447b621dec6055cd4cc1c670da37d3d1bc48875 Mon Sep 17 00:00:00 2001 From: Calvo Date: Thu, 16 Feb 2023 13:16:41 +0100 Subject: [PATCH 007/234] Fix events comment tags acl --- pandora_console/include/functions_events.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 48ef7b2c30..9d6aa611d5 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -3476,7 +3476,7 @@ function events_page_responses($event) // Comments. $data = []; - $data[0] = __('Comment'); + $data[0] = __('Comsssment'); $data[1] = ''; $data[2] = html_print_button( __('Add comment'), @@ -5168,10 +5168,6 @@ function events_page_comments($event, $ajax=false, $groupedComments=[]) true ); $comments_form .= '
'; - } else { - $comments_form = ui_print_message( - __('If event replication is ongoing, it won\'t be possible to enter comments here. This option is only to allow local pandora users to see comments, but not to operate with them. The operation, when event replication is enabled, must be done only in the Metaconsole.') - ); } if ($ajax === true) { @@ -5196,9 +5192,10 @@ function events_clean_tags($tags) } $event_tags = tags_get_tags_formatted($tags, false); + $event_tags = str_replace(' ', '', $event_tags); $event_tags = io_safe_input($event_tags); - return explode(',', str_replace(' ', '', $event_tags)); + return explode(',', $event_tags); } From f70ab4c44d53b429ebbd2240167d5b2530a4f464 Mon Sep 17 00:00:00 2001 From: Calvo Date: Thu, 16 Feb 2023 16:57:11 +0100 Subject: [PATCH 008/234] Fix misspell --- pandora_console/include/functions_events.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 9d6aa611d5..8c6c6fb8e3 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -3476,7 +3476,7 @@ function events_page_responses($event) // Comments. $data = []; - $data[0] = __('Comsssment'); + $data[0] = __('Comment'); $data[1] = ''; $data[2] = html_print_button( __('Add comment'), From 6efaa2bbc605747c02e1922ebb326e130addee97 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 21 Feb 2023 15:06:15 +0100 Subject: [PATCH 009/234] #8642 Added heatmap widget --- pandora_console/include/class/Heatmap.class.php | 4 +++- pandora_console/include/lib/Dashboard/Widget.php | 4 ++++ pandora_console/operation/heatmap.php | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/class/Heatmap.class.php b/pandora_console/include/class/Heatmap.class.php index 8572d6cad1..bab7f8fd85 100644 --- a/pandora_console/include/class/Heatmap.class.php +++ b/pandora_console/include/class/Heatmap.class.php @@ -25,6 +25,8 @@ * GNU General Public License for more details. * ============================================================================ */ + +namespace PandoraFMS; class Heatmap { @@ -159,7 +161,7 @@ class Heatmap ], ]; - echo '
'; + echo '
'; ?> '; $table->data[1][0] = ''.__('Daemon interval').''; $table->data[1][1] = html_print_input_text('netflow_interval', $config['netflow_interval'], false, 50, 200, true); diff --git a/pandora_console/godmode/setup/setup_sflow.php b/pandora_console/godmode/setup/setup_sflow.php new file mode 100644 index 0000000000..2610bc3361 --- /dev/null +++ b/pandora_console/godmode/setup/setup_sflow.php @@ -0,0 +1,84 @@ +width = '100%'; +$table->border = 0; +$table->cellspacing = 3; +$table->cellpadding = 5; +$table->class = 'databox filters'; + +$table->data = []; + +$table->data[0][0] = ''.__('Data storage path').''; +$table->data[0][1] = html_print_input_text('sflow_name_dir', $config['sflow_name_dir'], false, 50, 200, true); +$table->data[0][1] .= ''; + + +$table->data[1][0] = ''.__('Daemon interval').''; +$table->data[1][1] = html_print_input_text('sflow_interval', $config['sflow_interval'], false, 50, 200, true); + +$table->data[2][0] = ''.__('Daemon binary path').''; +$table->data[2][1] = html_print_input_text('sflow_daemon', $config['sflow_daemon'], false, 50, 200, true); + +$table->data[3][0] = ''.__('Nfdump binary path').''; +$table->data[3][1] = html_print_input_text('sflow_nfdump', $config['sflow_nfdump'], false, 50, 200, true); + +$table->data[4][0] = ''.__('Nfexpire binary path').''; +$table->data[4][1] = html_print_input_text('sflow_nfexpire', $config['sflow_nfexpire'], false, 50, 200, true); + +$table->data[5][0] = ''.__('Maximum chart resolution').''; +$table->data[5][1] = html_print_input_text('sflow_max_resolution', $config['sflow_max_resolution'], false, 50, 200, true); + +$table->data[6][0] = ''.__('Disable custom live view filters').''; +$table->data[6][1] = html_print_checkbox_switch('sflow_disable_custom_lvfilters', 1, $config['sflow_disable_custom_lvfilters'], true); +$table->data[7][0] = ''.__('Max. sflow lifetime').''; +$table->data[7][1] = html_print_input_text('sflow_max_lifetime', $config['sflow_max_lifetime'], false, 50, 200, true); + +$table->data[8][0] = ''.__('Name resolution for IP address').''; +$onclick = "if (!confirm('".__('Warning').'. '.__('IP address resolution can take a lot of time')."')) return false;"; +$table->data[8][1] = html_print_checkbox_switch_extended('sflow_get_ip_hostname', 1, $config['sflow_get_ip_hostname'], false, $onclick, '', true); + +echo '
'; + +html_print_table($table); + +// Update button. +echo '
'; + html_print_input_hidden('update_config', 1); + html_print_submit_button(__('Update'), 'upd_button', false, 'class="sub upd"'); +echo '
'; diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 24d2de537d..66b978a0d2 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -260,6 +260,24 @@ function config_update_config() $error_update[] = __('Enable Netflow'); } + if (config_update_value('activate_sflow', (bool) get_parameter('activate_sflow'), true) === false) { + $error_update[] = __('Enable Sflow'); + } + + if (config_update_value('general_network_path', get_parameter('general_network_path'), true) === false) { + $error_update[] = __('General network path'); + } else { + if (empty($config['netflow_name_dir']) === false && $config['netflow_name_dir'] !== '') { + $path = get_parameter('general_network_path'); + config_update_value('netflow_path', $path.$config['netflow_name_dir']); + } + + if (empty($config['sflow_name_dir']) === false && $config['sflow_name_dir'] !== '') { + $path = get_parameter('general_network_path'); + config_update_value('sflow_path', $path.$config['sflow_name_dir']); + } + } + $timezone = (string) get_parameter('timezone'); if (empty($timezone) === true || config_update_value('timezone', $timezone, true) === false) { $error_update[] = __('Timezone setup'); @@ -1501,8 +1519,13 @@ function config_update_config() break; case 'net': - if (config_update_value('netflow_path', get_parameter('netflow_path'), true) === false) { - $error_update[] = __('Data storage path'); + if (config_update_value('netflow_name_dir', get_parameter('netflow_name_dir'), true) === false) { + $error_update[] = __('Name storage path'); + } else { + if (empty($config['general_network_path']) === false && $config['general_network_path'] !== '') { + $name = get_parameter('netflow_name_dir'); + config_update_value('netflow_path', $config['general_network_path'].$name); + } } if (config_update_value('netflow_interval', (int) get_parameter('netflow_interval'), true) === false) { @@ -1538,6 +1561,49 @@ function config_update_config() } break; + case 'sflow': + if (config_update_value('sflow_name_dir', get_parameter('sflow_name_dir'), true) === false) { + $error_update[] = __('Sflow name dir'); + } else { + if (empty($config['general_network_path']) === false && $config['general_network_path'] !== '') { + $name = get_parameter('sflow_name_dir'); + config_update_value('sflow_path', $config['general_network_path'].$name); + } + } + + if (config_update_value('sflow_interval', (int) get_parameter('sflow_interval'), true) === false) { + $error_update[] = __('Daemon interval'); + } + + if (config_update_value('sflow_daemon', get_parameter('sflow_daemon'), true) === false) { + $error_update[] = __('Daemon binary path'); + } + + if (config_update_value('sflow_nfdump', get_parameter('sflow_nfdump'), true) === false) { + $error_update[] = __('Nfdump binary path'); + } + + if (config_update_value('sflow_nfexpire', get_parameter('sflow_nfexpire'), true) === false) { + $error_update[] = __('Nfexpire binary path'); + } + + if (config_update_value('sflow_max_resolution', (int) get_parameter('sflow_max_resolution'), true) === false) { + $error_update[] = __('Maximum chart resolution'); + } + + if (config_update_value('sflow_disable_custom_lvfilters', get_parameter('sflow_disable_custom_lvfilters'), true) === false) { + $error_update[] = __('Disable custom live view filters'); + } + + if (config_update_value('sflow_max_lifetime', (int) get_parameter('sflow_max_lifetime'), true) === false) { + $error_update[] = __('Sflow max lifetime'); + } + + if (config_update_value('sflow_get_ip_hostname', (int) get_parameter('sflow_get_ip_hostname'), true) === false) { + $error_update[] = __('Name resolution for IP address'); + } + break; + case 'log': if (config_update_value('elasticsearch_ip', get_parameter('elasticsearch_ip'), true) === false) { $error_update[] = __('IP ElasticSearch server'); @@ -2768,6 +2834,28 @@ function config_process_config() config_update_value('activate_netflow', 0); } + if (!isset($config['activate_sflow'])) { + config_update_value('activate_sflow', 0); + } + + if (!isset($config['general_network_path'])) { + if ($is_windows) { + $default = 'C:\PandoraFMS\Pandora_Server\data_in\\'; + } else { + $default = '/var/spool/pandora/data_in/'; + } + + config_update_value('general_network_path', $default); + } + + if (!isset($config['netflow_name_dir'])) { + config_update_value('netflow_name_dir', 'netflow'); + } + + if (!isset($config['sflow_name_dir'])) { + config_update_value('sflow_name_dir', 'sflow'); + } + if (!isset($config['netflow_path'])) { if ($is_windows) { $default = 'C:\PandoraFMS\Pandora_Server\data_in\netflow'; @@ -2806,6 +2894,48 @@ function config_process_config() config_update_value('netflow_max_lifetime', '5'); } + if (!isset($config['sflow_interval'])) { + config_update_value('sflow_interval', SECONDS_10MINUTES); + } + + if (!isset($config['sflow_daemon'])) { + config_update_value('sflow_daemon', '/usr/bin/nfcapd'); + } + + if (!isset($config['sflow_nfdump'])) { + config_update_value('sflow_nfdump', '/usr/bin/nfdump'); + } + + if (!isset($config['sflow_nfexpire'])) { + config_update_value('sflow_nfexpire', '/usr/bin/nfexpire'); + } + + if (!isset($config['sflow_max_resolution'])) { + config_update_value('sflow_max_resolution', '50'); + } + + if (!isset($config['sflow_disable_custom_lvfilters'])) { + config_update_value('sflow_disable_custom_lvfilters', 0); + } + + if (!isset($config['sflow_max_lifetime'])) { + config_update_value('sflow_max_lifetime', '5'); + } + + if (!isset($config['sflow_name_dir'])) { + config_update_value('sflow_name_dir', 'sflow'); + } + + if (!isset($config['sflow_path'])) { + if ($is_windows) { + $default = 'C:\PandoraFMS\Pandora_Server\data_in\sflow'; + } else { + $default = '/var/spool/pandora/data_in/sflow'; + } + + config_update_value('sflow_path', $default); + } + if (!isset($config['auth'])) { config_update_value('auth', 'mysql'); } diff --git a/pandora_console/include/functions_netflow.php b/pandora_console/include/functions_netflow.php index e4ac71e690..be271ef974 100644 --- a/pandora_console/include/functions_netflow.php +++ b/pandora_console/include/functions_netflow.php @@ -1025,9 +1025,29 @@ function netflow_get_command($options, $filter) // Build command. $command = io_safe_output($config['netflow_nfdump']).' -N'; - // Netflow data path. - if (isset($config['netflow_path']) && $config['netflow_path'] != '') { - $command .= ' -R. -M '.$config['netflow_path']; + if ($config['activate_sflow'] && $config['activate_netflow']) { + if (isset($config['sflow_name_dir']) && $config['sflow_name_dir'] !== '' + && isset($config['netflow_name_dir']) && $config['netflow_name_dir'] !== '' + && isset($config['general_network_path']) && $config['general_network_path'] !== '' + ) { + $command .= ' -R. -M '.$config['general_network_path'].$config['netflow_name_dir'].':'.$config['sflow_name_dir']; + } + } else { + if ($config['activate_sflow']) { + if (isset($config['sflow_name_dir']) && $config['sflow_name_dir'] !== '' + && isset($config['general_network_path']) && $config['general_network_path'] !== '' + ) { + $command .= ' -R. -M '.$config['general_network_path'].$config['sflow_name_dir']; + } + } + + if ($config['activate_netflow']) { + if (isset($config['netflow_name_dir']) && $config['netflow_name_dir'] !== '' + && isset($config['general_network_path']) && $config['general_network_path'] !== '' + ) { + $command .= ' -R. -M '.$config['general_network_path'].$config['netflow_name_dir']; + } + } } // Add options. @@ -1035,7 +1055,7 @@ function netflow_get_command($options, $filter) // Filter options. $command .= ' '.netflow_get_filter_arguments($filter); - + hd($command, true); return $command; } diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 62984b4078..7dd1126cd9 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -205,7 +205,7 @@ if ($access_console_node === true) { $sub['operation/inventory/inventory']['refr'] = 0; } - if ($config['activate_netflow']) { + if ($config['activate_netflow'] || $config['activate_sflow']) { $sub['network_traffic'] = [ 'text' => __('Network'), 'id' => 'Network', @@ -213,34 +213,20 @@ if ($access_console_node === true) { 'subtype' => 'nolink', 'refr' => 0, ]; - - // Initialize the submenu. - $netflow_sub = []; - - $netflow_sub = array_merge( - $netflow_sub, - [ - 'operation/netflow/netflow_explorer' => [ - 'text' => __('Netflow explorer'), - 'id' => 'Netflow explorer', - ], - 'operation/netflow/nf_live_view' => [ - 'text' => __('Netflow Live View'), - 'id' => 'Netflow Live View', - ], - ] - ); - - $netflow_sub = array_merge( - $netflow_sub, - [ - 'operation/network/network_usage_map' => [ - 'text' => __('Network usage map'), - 'id' => 'Network usage map', - ], - ] - ); - + $netflow_sub = [ + 'operation/netflow/netflow_explorer' => [ + 'text' => __('Netflow explorer'), + 'id' => 'Netflow explorer', + ], + 'operation/netflow/nf_live_view' => [ + 'text' => __('Netflow Live View'), + 'id' => 'Netflow Live View', + ], + 'operation/network/network_usage_map' => [ + 'text' => __('Network usage map'), + 'id' => 'Network usage map', + ], + ]; $sub['network_traffic']['sub2'] = $netflow_sub; } diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index acb6636dca..f79f17b8cd 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -72,6 +72,8 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('stats_interval', '60'), ('activate_gis', '0'), ('activate_netflow', '0'), +('activate_sflow', '0'), +('general_network_path', '/var/spool/pandora/data_in/'), ('timezone', 'Europe/Berlin'), ('string_purge', 7), ('audit_purge', 15), @@ -87,6 +89,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('netflow_daemon', '/usr/bin/nfcapd'), ('netflow_nfdump', '/usr/bin/nfdump'), ('netflow_max_resolution', '50'), +('sflow_interval', '3600'), +('sflow_daemon', '/usr/bin/nfcapd'), +('sflow_nfdump', '/usr/bin/nfdump'), +('sflow_max_resolution', '50'), ('event_fields', 'mini_severity,evento,estado,agent_name,timestamp'), ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,last_status_change,graph,warn,data,timestamp'), ('list_ACL_IPs_for_API', '127.0.0.1'), From a4d1d2c9b23a2a077bd6dad9aa69d4347aec4027 Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 11 Mar 2023 01:00:20 +0100 Subject: [PATCH 053/234] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 5a6b6e4894..0a32463988 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.769-230310 +Version: 7.0NG.769-230311 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 0ff5c31c0b..818a7dfae0 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.769-230310" +pandora_version="7.0NG.769-230311" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 0e6522165b..6d80b6ff83 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1023,7 +1023,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.769'; -use constant AGENT_BUILD => '230310'; +use constant AGENT_BUILD => '230311'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index c23d462fd1..e5f98516a4 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230310 +%define release 230311 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 33324b25e1..7fa9acc2c3 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230310 +%define release 230311 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index ab50df62d1..6f6ba7ccc4 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230310" +PI_BUILD="230311" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 8d6bea8586..21581e29b2 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230310} +{230311} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 024db5dc39..c3602378d9 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.769 Build 230310") +#define PANDORA_VERSION ("7.0NG.769 Build 230311") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 63db898d79..cbccd60e65 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.769(Build 230310))" + VALUE "ProductVersion", "(7.0NG.769(Build 230311))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index de8bff7c41..187c697b96 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.769-230310 +Version: 7.0NG.769-230311 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 486224eab7..ab21f4a778 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.769-230310" +pandora_version="7.0NG.769-230311" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 3ad202b031..5a644be4dc 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC230310'; +$build_version = 'PC230311'; $pandora_version = 'v7.0NG.769'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index eb75f84d09..cb931e1931 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -131,7 +131,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 7f657e1ab8..42a1c0735a 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_server %define version 7.0NG.769 -%define release 230310 +%define release 230311 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index adbe75189b..3d9164a73c 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_server %define version 7.0NG.769 -%define release 230310 +%define release 230311 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index da483f4b7d..0fceb4999e 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230310" +PI_BUILD="230311" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 6942f8e4fe..cf74e3a4a0 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.769 Build 230310"; +my $version = "7.0NG.769 Build 230311"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 15ff91c2b8..8dd39c6752 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.769 Build 230310"; +my $version = "7.0NG.769 Build 230311"; # save program name for logging my $progname = basename($0); From 39ace106296008af33212072efc6c2f1546237d8 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Sat, 11 Mar 2023 02:08:37 +0100 Subject: [PATCH 054/234] Fix image issue with Networkmap --- pandora_console/operation/agentes/pandora_networkmap.editor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index 4450e101ea..14d04dcc60 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -275,7 +275,7 @@ if ($not_found) { } else { if ($disabled_source === false) { echo '
'; - echo html_print_image('images/spinner.gif', true, 'width: 50px;height: 50px;'); + echo html_print_image('images/spinner.gif', true, ['width' => '50px', 'height' => '50px']); echo '
'.__('Creating map...').'
'; echo '
'; $info1 = __('To create a network map that visually recreates link-level (L2) relationships, you must first discover these relationships with Discovery Server. Network maps only reflect relationships that have already been discovered.'); From f553019a404e2ad075e1cde7a99f4305dfb46d7c Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Sat, 11 Mar 2023 02:10:16 +0100 Subject: [PATCH 055/234] Minor fixes --- pandora_console/include/styles/pandora.css | 1 + pandora_console/include/styles/pandora_black.css | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 5a340c3218..f3a2e32799 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -11262,6 +11262,7 @@ span.subsection_header_title { span.subsection_header_title.secondary { height: 14px; + line-height: 14px; } .regular_font { diff --git a/pandora_console/include/styles/pandora_black.css b/pandora_console/include/styles/pandora_black.css index 9a0a6ac63e..94c87cd1fc 100644 --- a/pandora_console/include/styles/pandora_black.css +++ b/pandora_console/include/styles/pandora_black.css @@ -1111,6 +1111,7 @@ select, border: 1px solid #707070; background-color: #222 !important; color: #fff !important; + border-radius: 0; } .white_table_graph { @@ -1475,13 +1476,6 @@ span.select2-dropdown.select2-dropdown--below { z-index: 1200; } -div.fixed_filter_bar, -div.white_table_graph_header { - border-radius: 0; - border-left: 0px; - border-right: 0px; -} - div.white_table_graph { border-radius: 0; } @@ -1502,3 +1496,9 @@ table.filter-table-adv td > div label { #principal_action_buttons { background: #111111; } +div.fixed-bottom-box, +div.fixed-bottom-box + > div.fixed-bottom-box-head + > div.fixed-bottom-box-head-body { + background-color: #111111 !important; +} From ef04e54058f40e7326cb00013baaf4de8f8fa767 Mon Sep 17 00:00:00 2001 From: artica Date: Sun, 12 Mar 2023 01:00:40 +0100 Subject: [PATCH 056/234] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 0a32463988..8cb75d2199 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.769-230311 +Version: 7.0NG.769-230312 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 818a7dfae0..97696c12a9 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.769-230311" +pandora_version="7.0NG.769-230312" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 6d80b6ff83..1d44d5ff12 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1023,7 +1023,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.769'; -use constant AGENT_BUILD => '230311'; +use constant AGENT_BUILD => '230312'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index e5f98516a4..453ae23d37 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230311 +%define release 230312 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 7fa9acc2c3..35f6aa06c0 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230311 +%define release 230312 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 6f6ba7ccc4..ac1c2c241c 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230311" +PI_BUILD="230312" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 21581e29b2..ed2843992d 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230311} +{230312} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index c3602378d9..3c010ae74f 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.769 Build 230311") +#define PANDORA_VERSION ("7.0NG.769 Build 230312") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index cbccd60e65..eb988c71cc 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.769(Build 230311))" + VALUE "ProductVersion", "(7.0NG.769(Build 230312))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 187c697b96..781bfd3b59 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.769-230311 +Version: 7.0NG.769-230312 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index ab21f4a778..829b62c00f 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.769-230311" +pandora_version="7.0NG.769-230312" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 5a644be4dc..b3341342d8 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC230311'; +$build_version = 'PC230312'; $pandora_version = 'v7.0NG.769'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index cb931e1931..676f79a973 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -131,7 +131,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 42a1c0735a..39a650ee84 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_server %define version 7.0NG.769 -%define release 230311 +%define release 230312 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 3d9164a73c..9d017bd114 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_server %define version 7.0NG.769 -%define release 230311 +%define release 230312 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 0fceb4999e..19f13fafb9 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230311" +PI_BUILD="230312" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index cf74e3a4a0..be892298a4 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.769 Build 230311"; +my $version = "7.0NG.769 Build 230312"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 8dd39c6752..23ba6cbdc0 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.769 Build 230311"; +my $version = "7.0NG.769 Build 230312"; # save program name for logging my $progname = basename($0); From 87e165ff806935dc634435c6f73e89adf22463ce Mon Sep 17 00:00:00 2001 From: artica Date: Mon, 13 Mar 2023 01:00:18 +0100 Subject: [PATCH 057/234] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 8cb75d2199..e6553ada2f 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.769-230312 +Version: 7.0NG.769-230313 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 97696c12a9..cadc4a6fd2 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.769-230312" +pandora_version="7.0NG.769-230313" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 1d44d5ff12..f828e1a7ae 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1023,7 +1023,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.769'; -use constant AGENT_BUILD => '230312'; +use constant AGENT_BUILD => '230313'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 453ae23d37..4ff8cf8848 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230312 +%define release 230313 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 35f6aa06c0..6705e0ee72 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230312 +%define release 230313 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index ac1c2c241c..06c37d34cd 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230312" +PI_BUILD="230313" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index ed2843992d..60ebc7abad 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230312} +{230313} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 3c010ae74f..e7aeba8540 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.769 Build 230312") +#define PANDORA_VERSION ("7.0NG.769 Build 230313") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index eb988c71cc..394e2e2be5 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.769(Build 230312))" + VALUE "ProductVersion", "(7.0NG.769(Build 230313))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 781bfd3b59..020733306e 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.769-230312 +Version: 7.0NG.769-230313 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 829b62c00f..5a23822ad2 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.769-230312" +pandora_version="7.0NG.769-230313" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index b3341342d8..9fa5ae55f2 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC230312'; +$build_version = 'PC230313'; $pandora_version = 'v7.0NG.769'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 676f79a973..94fba1f271 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -131,7 +131,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 39a650ee84..f12dce0155 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_server %define version 7.0NG.769 -%define release 230312 +%define release 230313 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 9d017bd114..6b03f847d1 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_server %define version 7.0NG.769 -%define release 230312 +%define release 230313 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 19f13fafb9..b14901c613 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230312" +PI_BUILD="230313" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index be892298a4..1d7dd60493 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.769 Build 230312"; +my $version = "7.0NG.769 Build 230313"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 23ba6cbdc0..37c365cfcd 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.769 Build 230312"; +my $version = "7.0NG.769 Build 230313"; # save program name for logging my $progname = basename($0); From 596ade6d3706a54b9cf5a5c9ccf185ed6b618ead Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 13 Mar 2023 09:14:16 +0100 Subject: [PATCH 058/234] #10324 added system fav in tactical view group --- pandora_console/godmode/groups/tactical.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandora_console/godmode/groups/tactical.php b/pandora_console/godmode/groups/tactical.php index 037af05723..d7984c3212 100644 --- a/pandora_console/godmode/groups/tactical.php +++ b/pandora_console/godmode/groups/tactical.php @@ -74,6 +74,12 @@ if (is_metaconsole() === false) { 'link' => '', 'label' => __('Tactic group'), ], + ], + [ + 'id_element' => $id_group, + 'url' => 'gagent&sec2=godmode/groups/tactical&id_group='.$id_group, + 'label' => groups_get_name($id_group), + 'section' => 'Tactic_group', ] ); } From bbec6a92a4c065c49d41f82a1d98f1402a334ca8 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Mon, 13 Mar 2023 09:35:12 +0100 Subject: [PATCH 059/234] Minor fixes --- pandora_console/godmode/category/category.php | 5 +---- pandora_console/include/functions_treeview.php | 12 ++++++------ pandora_console/include/functions_ui.php | 14 ++++++++++---- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/pandora_console/godmode/category/category.php b/pandora_console/godmode/category/category.php index aa3a23778d..935d2c1d5d 100755 --- a/pandora_console/godmode/category/category.php +++ b/pandora_console/godmode/category/category.php @@ -262,10 +262,7 @@ if ($is_management_allowed === true) { [ 'icon' => 'next' ], true ), - [ - 'type' => 'form_action', - 'right_content' => $tablePagination, - ] + [ 'right_content' => $tablePagination ] ); echo ''; diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index e93910ec15..86367a1097 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -727,8 +727,8 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) false, false, '', - 'white-box-content', - 'white_table_flex margin-bottom-10 border-bottom-gray' + 'white-box-content mrgn_top_0 mrgn_btn_0px', + 'white_table_flex' ); if ($config['agentaccess']) { @@ -747,8 +747,8 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) true, false, '', - 'white-box-content border-bottom-gray', - 'white_table_flex margin-top-10 margin-bottom-10' + 'white-box-content mrgn_top_0 mrgn_btn_0px border-bottom-gray', + 'white_table_flex' ); } @@ -920,8 +920,8 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) true, false, '', - 'white-box-content border-bottom-gray', - 'white_table_flex margin-top-10 margin-bottom-10' + 'white-box-content mrgn_top_0 mrgn_btn_0px border-bottom-gray', + 'white_table_flex' ); if (empty($server_data) === false && is_metaconsole() === true) { diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index d272ee224a..8df6dc2fa1 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -4327,7 +4327,10 @@ function ui_toggle( $image_a = html_print_image( $img_a, true, - [ 'style' => 'rotate: '.$rotateA ], + [ + 'class' => 'mrgn_right_10px', + 'style' => 'rotate: '.$rotateA, + ], true ); } else { @@ -4338,7 +4341,10 @@ function ui_toggle( $image_b = html_print_image( $img_b, true, - [ 'style' => 'rotate: '.$rotateB ], + [ + 'class' => 'mrgn_right_10px', + 'style' => 'margin-right:10px; rotate: '.$rotateB, + ], true ); } else { @@ -4401,7 +4407,7 @@ function ui_toggle( $original, true, [ - 'class' => 'float-left main_menu_icon', + 'class' => 'float-left main_menu_icon mrgn_right_10px', 'style' => 'object-fit: contain; margin-right:10px; rotate:'.$imageRotate, 'title' => $title, 'id' => 'image_'.$uniqid, @@ -4433,7 +4439,7 @@ function ui_toggle( $original, true, [ - 'class' => 'main_menu_icon', + 'class' => 'main_menu_icon mrgn_right_10px', 'style' => 'object-fit: contain; float:right; margin-right:10px; rotate:'.$imageRotate, 'title' => $title, 'id' => 'image_'.$uniqid, From daae94f904f1d03e5dc6db2a2b33feb6b4f6027f Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 13 Mar 2023 09:49:44 +0100 Subject: [PATCH 060/234] #9624 deleted General network path from database --- pandora_console/pandoradb_data.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index f79f17b8cd..0e75acb879 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -73,7 +73,6 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('activate_gis', '0'), ('activate_netflow', '0'), ('activate_sflow', '0'), -('general_network_path', '/var/spool/pandora/data_in/'), ('timezone', 'Europe/Berlin'), ('string_purge', 7), ('audit_purge', 15), From f79d22b7813af682fba1140f0ff4efae7a572fab Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 13 Mar 2023 09:57:57 +0100 Subject: [PATCH 061/234] #9624 clear log --- pandora_console/include/functions_netflow.php | 1 - 1 file changed, 1 deletion(-) diff --git a/pandora_console/include/functions_netflow.php b/pandora_console/include/functions_netflow.php index be271ef974..89a6110b2e 100644 --- a/pandora_console/include/functions_netflow.php +++ b/pandora_console/include/functions_netflow.php @@ -1055,7 +1055,6 @@ function netflow_get_command($options, $filter) // Filter options. $command .= ' '.netflow_get_filter_arguments($filter); - hd($command, true); return $command; } From 80076434b34d44b73eda55b180a457efb90cab93 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 13 Mar 2023 10:29:03 +0100 Subject: [PATCH 062/234] SNMP visual fix staticts --- .../include/class/SnmpConsole.class.php | 140 +++++------------- pandora_console/include/functions_ui.php | 9 +- pandora_console/include/styles/pandora.css | 18 +++ .../operation/snmpconsole/snmp_statistics.php | 29 ++-- 4 files changed, 79 insertions(+), 117 deletions(-) diff --git a/pandora_console/include/class/SnmpConsole.class.php b/pandora_console/include/class/SnmpConsole.class.php index ec7e3394dd..f1895dfc51 100644 --- a/pandora_console/include/class/SnmpConsole.class.php +++ b/pandora_console/include/class/SnmpConsole.class.php @@ -181,113 +181,47 @@ class SnmpConsole extends HTML $default_refr = 300; - if (!isset($config['pure']) || $config['pure'] === false) { - $statistics['text'] = ''.html_print_image( - 'images/logs@svg.svg', - true, - [ - 'title' => __('Statistics'), - 'class' => 'main_menu_icon invert_filter', - ] - ).''; - $list['text'] = ''.html_print_image( - 'images/SNMP-network-numeric-data@svg.svg', - true, - [ - 'title' => __('List'), - 'class' => 'main_menu_icon invert_filter', - ] - ).''; - $list['active'] = true; + $statistics['text'] = ''.html_print_image( + 'images/logs@svg.svg', + true, + [ + 'title' => __('Statistics'), + 'class' => 'main_menu_icon invert_filter', + ] + ).''; + $list['text'] = ''.html_print_image( + 'images/SNMP-network-numeric-data@svg.svg', + true, + [ + 'title' => __('List'), + 'class' => 'main_menu_icon invert_filter', + ] + ).''; + $list['active'] = true; - $screen['text'] = ''.html_print_image( - 'images/fullscreen@svg.svg', - true, + // Header. + ui_print_standard_header( + __('SNMP Console'), + 'images/op_snmp.png', + false, + 'snmp_console', + false, + [ + $screen, + $list, + $statistics, + ], + [ [ - 'title' => __('View in full screen'), - 'class' => 'main_menu_icon invert_filter', - ] - ).''; - - // Header. - ui_print_standard_header( - __('SNMP Console'), - 'images/op_snmp.png', - false, - 'snmp_console', - false, - [ - $screen, - $list, - $statistics, + 'link' => '', + 'label' => __('Monitoring'), ], [ - [ - 'link' => '', - 'label' => __('Monitoring'), - ], - [ - 'link' => '', - 'label' => __('SNMP'), - ], - ] - ); - } else { - echo '
'; - - echo ''; - - echo '
'; - - ui_require_css_file('pandora_enterprise', ENTERPRISE_DIR.'/include/styles/'); - ui_require_css_file('pandora_dashboard', ENTERPRISE_DIR.'/include/styles/'); - ui_require_css_file('cluetip', 'include/styles/js/'); - - ui_require_jquery_file('countdown'); - ui_require_javascript_file('pandora_dashboard', ENTERPRISE_DIR.'/include/javascript/'); - ui_require_javascript_file('wz_jsgraphics'); - ui_require_javascript_file('pandora_visual_console'); - } + 'link' => '', + 'label' => __('SNMP'), + ], + ] + ); // Datatables list. try { diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index d272ee224a..5a19b69da3 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -5044,6 +5044,8 @@ function ui_print_page_header( $breadcrumbs='', $hide_left_small=false ) { + global $config; + $title = io_safe_input_html($title); if (($icon == '') && ($godmode == true)) { $icon = 'images/gm_setup.png'; @@ -5057,13 +5059,18 @@ function ui_print_page_header( $type = 'view'; $type2 = 'menu_tab_frame_view'; $separator_class = 'separator'; + $div_style = ''; } else { $type = 'view'; $type2 = 'menu_tab_frame_view'; $separator_class = 'separator_view'; + $div_style = ''; + if ($config['pure'] === true) { + $div_style = 'top:0px;'; + } } - $buffer = '
'; + $buffer = '
'; if (!empty($breadcrumbs)) { $buffer .= ''; echo '
'; @@ -230,7 +233,7 @@ if ($is_ajax === false && $pure === true) { // Control call flow. try { // Heatmap construct. - $heatmap = new Heatmap($type, $filter, $randomId, $refresh, $width, $height, $search, $group); + $heatmap = new Heatmap($type, $filter, $randomId, $refresh, $width, $height, $search, $group, $dashboard); } catch (Exception $e) { if (is_ajax() === true) { echo json_encode(['error' => '[Heatmap]'.$e->getMessage() ]); From a7a283fe2275326b54848974d7c9f6aba9512cb0 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 14 Mar 2023 12:52:44 +0100 Subject: [PATCH 100/234] #8642 Fixed heatmap widget --- pandora_console/include/class/Heatmap.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/class/Heatmap.class.php b/pandora_console/include/class/Heatmap.class.php index f7375c2a5e..c440fcfecc 100644 --- a/pandora_console/include/class/Heatmap.class.php +++ b/pandora_console/include/class/Heatmap.class.php @@ -381,7 +381,7 @@ class Heatmap } $id_grupo = ''; - if (empty($this->filter) === false && current($this->filter) != 0) { + if (empty($this->filter) === false && empty(current($this->filter)) === false) { $id_grupo = ' AND id_grupo IN ('.implode(',', $this->filter).')'; } From b428e77e7cf26e9234ced2e10dbf2eba2d965faf Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 14 Mar 2023 13:11:57 +0100 Subject: [PATCH 101/234] User management for meta --- pandora_console/general/header.php | 1 - .../godmode/users/configure_user.php | 269 ++---------------- pandora_console/godmode/users/user_list.php | 2 - .../godmode/users/user_management.php | 218 ++++++++------ pandora_console/include/functions_profile.php | 16 +- 5 files changed, 161 insertions(+), 345 deletions(-) diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 40f6c3a382..b0cbc0cec5 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -407,7 +407,6 @@ echo sprintf('
', $menuTypeClass); // User. - // $headerUserImage = (is_user_admin($config['id_user']) === true) ? 'images/header_user_admin_green.png' : 'images/header_user_green.png'; $headerUser = []; $headerUser[] = html_print_image( 'images/edit_user@header.svg', diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 287de6a316..ecc3a76b72 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -1,5 +1,4 @@ 'user_form_title', - 'content' => ((bool) $id === true) ? sprintf('%s [ %s ]', __('Update User'), $id) : __('Create User'), - ] - ); -} - if (!$new_user) { $user_id = '

'.__('User ID').':

'; $user_id .= ''.$id.''; @@ -1282,8 +1272,9 @@ if (is_metaconsole() === false) { if (is_metaconsole() === true) { $array_filters = get_filters_custom_fields_view(0, true); - $search_custom_fields_view = '

'.__('Search custom field view').' '.ui_print_help_tip(__('Load by default the selected view in custom field view'), true).'

'; - $search_custom_fields_view .= html_print_select( + $searchCustomFieldView = []; + $searchCustomFieldView[] = __('Search custom field view'); + $searchCustomFieldView[] = html_print_select( $array_filters, 'default_custom_view', $user_info['default_custom_view'], @@ -1295,7 +1286,10 @@ if (is_metaconsole() === true) { true, '', false - ).'
'; + ).ui_print_input_placeholder( + __('Load by default the selected view in custom field view'), + true + ); } $values = [ @@ -1377,6 +1371,8 @@ $home_screen .= html_print_input_text( false ); +$home_screen = ''; + $size_pagination = '

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

'; $size_pagination .= html_print_input_text( 'block_size', @@ -1395,19 +1391,20 @@ if ($id === $config['id_user']) { ); } -if (enterprise_installed() && is_metaconsole() === true) { +if (enterprise_installed() === true && is_metaconsole() === true) { $user_info_metaconsole_access = 'only_console'; if (isset($user_info['metaconsole_access'])) { $user_info_metaconsole_access = $user_info['metaconsole_access']; } - // TODO review help tips on meta. - $meta_access = '

'.__('Metaconsole access').' './* ui_print_help_icon('meta_access', true). */ '

'; $metaconsole_accesses = [ 'basic' => __('Basic'), 'advanced' => __('Advanced'), ]; - $meta_access .= html_print_select( + + $outputMetaAccess = []; + $outputMetaAccess[] = __('Metaconsole access'); + $outputMetaAccess[] = html_print_select( $metaconsole_accesses, 'metaconsole_access', $user_info_metaconsole_access, @@ -1417,51 +1414,9 @@ if (enterprise_installed() && is_metaconsole() === true) { true, false, false - ).'
'; + ); } -/* - $not_login = '

'.__('Not Login').'

'; - $not_login .= ui_print_help_tip( - __('The user with not login set only can access to API.'), - true - ); - $not_login .= html_print_checkbox_switch( - 'not_login', - 1, - $user_info['not_login'], - true - ).'
'; - - $local_user = '

'.__('Local user').'

'; - $local_user .= ui_print_help_tip( - __('The user with local authentication enabled will always use local authentication.'), - true - ); - $local_user .= html_print_checkbox_switch( - 'local_user', - 1, - $user_info['local_user'], - true - ).'
'; - - $session_time = '

'.__('Session Time'); - $session_time .= ui_print_help_tip( - __('This is defined in minutes, If you wish a permanent session should putting -1 in this field.'), - true - ).'

'; - $session_time .= html_print_input_text( - 'session_time', - $user_info['session_time'], - '', - 5, - 5, - true.false, - false, - '', - 'class="input_line_small"' - ).'
'; -*/ $user_groups = implode(',', array_keys((users_get_groups($id, 'AR', $display_all_group)))); if (empty($user_groups) === false) { @@ -1582,31 +1537,6 @@ if (empty($doubleAuthElementsContent) === false) { $doubleAuthentication = ''; } - -/* - if (isset($double_authentication)) { - $double_authentication .= '
'; -}*/ - - - - - - - - - - - - - - - - - - - - $autorefresh_list_out = []; if (is_metaconsole() === false || is_centralized() === true) { $autorefresh_list_out['operation/agentes/estado_agente'] = 'Agent detail'; @@ -1665,31 +1595,32 @@ if (isset($autorefresh_list) === false) { } } - - if (is_metaconsole() === true) { enterprise_include_once('include/functions_metaconsole.php'); $access_node = db_get_value('metaconsole_access_node', 'tusuario', 'id_user', $id); - $metaconsole_agents_manager = '

'.__('Enable agents managment').'

'; - $metaconsole_agents_manager .= html_print_checkbox_switch( + $metaconsoleAgentManager = []; + $metaconsoleAgentManager[] = __('Enable agents managment'); + $metaconsoleAgentManager[] = html_print_checkbox_switch( 'metaconsole_agents_manager', 1, $user_info['metaconsole_agents_manager'], true - ).'
'; + ); - $metaconsole_access_node = '

'.__('Enable node access').ui_print_help_tip(__('With this option enabled, the user will can access to nodes console'), true).'

'; - $metaconsole_access_node .= html_print_checkbox( + $metaconsoleAgentManager[] = __('Enable node access').ui_print_help_tip( + __('With this option enabled, the user will can access to nodes console'), + true + ); + $metaconsoleAgentManager[] = html_print_checkbox_switch( 'metaconsole_access_node', 1, $access_node, true - ).'
'; + ); } - echo '
'; echo '
'; @@ -1701,141 +1632,8 @@ if (!$id) { $user_id_create = $user_id; } -if (is_metaconsole() === true) { - $access_or_pagination = $meta_access; - if ($id != '' && !$is_err) { - $div_user_info = ' - '; - } else { - $div_user_info = ' - '; - } - - echo '
-
- -

Extra info

'.$email.$phone.$not_login.$local_user.$session_time.'
-
-
-
'.$language.$access_or_pagination.$skin.$default_event_filter.$double_authentication.'
- -
'.$timezone; - - echo $search_custom_fields_view.$metaconsole_agents_manager.$metaconsole_access_node; - - $autorefresh_show = '

'._('Autorefresh').ui_print_help_tip( - __('This will activate autorefresh in selected pages'), - true - ).'

'; - $select_out = html_print_select( - $autorefresh_list_out, - 'autorefresh_list_out[]', - '', - '', - '', - '', - true, - true, - true, - '', - false, - 'width:100%' - ); - $arrows = ' '; - $select_in = html_print_select( - $autorefresh_list, - 'autorefresh_list[]', - '', - '', - '', - '', - true, - true, - true, - '', - false, - 'width:100%' - ); - - $table_ichanges = '
'; - - $autorefresh_show .= $table_ichanges; - - // Time autorefresh. - $times = get_refresh_time_array(); - $time_autorefresh = '

'.__('Time autorefresh'); - $time_autorefresh .= ui_print_help_tip( - __('Interval of autorefresh of the elements, by default they are 30 seconds, needing to enable the autorefresh first'), - true - ).'

'; - $time_autorefresh .= html_print_select( - $times, - 'time_autorefresh', - $user_info['time_autorefresh'], - '', - '', - '', - true, - false, - false - ).'
'; - - - echo '
-
-
'.$autorefresh_show.$time_autorefresh.'
-
-
'.$comments.'
-
'; - - if (empty($ehorus) === false) { - html_print_div( - [ - 'class' => 'user_edit_third_row white_box', - 'content' => $ehorus, - ], - true - ); - } - - // User Profile definition table. (Only where user is not creating). - if ($new_user === false && ((bool) check_acl($config['id_user'], 0, 'UM') === true)) { - profile_print_profile_table($id, io_safe_output($json_profile), false, ($is_err === true)); - } -} else { - $access_or_pagination = $size_pagination; - // WIP: Only for node. - include_once 'user_management.php'; -} +// User management form. +require_once 'user_management.php'; if ((bool) $config['admin_can_add_user'] === true) { html_print_csrf_hidden(); @@ -1916,7 +1714,7 @@ if (is_metaconsole() === false) { $(document).ready(function() { // Set up the picker to update target timezone and country select lists. $('#timezone-image').timezonePicker({ - target: '#timezone', + target: '#timezone1', }); // Optionally an auto-detect button to trigger JavaScript geolocation. @@ -1938,17 +1736,6 @@ if (is_metaconsole() === false) { var json_profile = $('#hidden-json_profile'); /* data['passwordManage_table'] = html_print_table($passwordManageTable, true); +if (users_is_admin() === true) { + $userManagementTable->rowclass['captions_loginErrorUser'] = 'field_half_width w50p'; + $userManagementTable->cellclass['captions_loginErrorUser'][0] = 'wrap'; + $userManagementTable->cellclass['captions_loginErrorUser'][1] = 'wrap'; + $notLoginCheckContent = []; + $notLoginCheckContent[] = ''.__('Not Login').''; + $notLoginCheckContent[] = html_print_checkbox_switch( + 'not_login', + 1, + $user_info['not_login'], + true + ); -$userManagementTable->rowclass['captions_loginErrorUser'] = 'field_half_width w50p'; -$userManagementTable->cellclass['captions_loginErrorUser'][0] = 'wrap'; -$userManagementTable->cellclass['captions_loginErrorUser'][1] = 'wrap'; -$notLoginCheckContent = []; -$notLoginCheckContent[] = ''.__('Not Login').''; -$notLoginCheckContent[] = html_print_checkbox_switch( - 'not_login', - 1, - $user_info['not_login'], - true -); + $userManagementTable->data['captions_loginErrorUser'][0] = html_print_div( + [ + 'class' => 'margin-top-10', + 'style' => 'display: flex; flex-direction: row-reverse; align-items: center;', + 'content' => implode('', $notLoginCheckContent), + ], + true + ); + $userManagementTable->data['captions_loginErrorUser'][0] .= ui_print_input_placeholder( + __('The user with not login set only can access to API.'), + true + ); -$userManagementTable->data['captions_loginErrorUser'][0] = html_print_div( - [ - 'class' => 'margin-top-10', - 'style' => 'display: flex; flex-direction: row-reverse; align-items: center;', - 'content' => implode('', $notLoginCheckContent), - ], - true -); -$userManagementTable->data['captions_loginErrorUser'][0] .= ui_print_input_placeholder( - __('The user with not login set only can access to API.'), - true -); + $localUserCheckContent = []; + $localUserCheckContent[] = ''.__('Local User').''; + $localUserCheckContent[] = html_print_checkbox_switch( + 'local_user', + 1, + $user_info['local_user'], + true + ); -$localUserCheckContent = []; -$localUserCheckContent[] = ''.__('Local User').''; -$localUserCheckContent[] = html_print_checkbox_switch( - 'local_user', - 1, - $user_info['local_user'], - true -); + $userManagementTable->data['captions_loginErrorUser'][1] = html_print_div( + [ + 'class' => 'margin-top-10', + 'style' => 'display: flex; flex-direction: row-reverse; align-items: center;', + 'content' => implode('', $localUserCheckContent), + ], + true + ); + $userManagementTable->data['captions_loginErrorUser'][1] .= ui_print_input_placeholder( + __('The user with local authentication enabled will always use local authentication.'), + true + ); +} -$userManagementTable->data['captions_loginErrorUser'][1] = html_print_div( - [ - 'class' => 'margin-top-10', - 'style' => 'display: flex; flex-direction: row-reverse; align-items: center;', - 'content' => implode('', $localUserCheckContent), - ], - true -); -$userManagementTable->data['captions_loginErrorUser'][1] .= ui_print_input_placeholder( - __('The user with local authentication enabled will always use local authentication.'), - true -); $userManagementTable->data['show_tips_startup'][0] = html_print_checkbox_switch('show_tips_startup', 1, ($user_info['show_tips_startup'] === null) ? true : $user_info['show_tips_startup'], true); $userManagementTable->data['show_tips_startup'][1] = ''.__('Show usage tips at startup').''; @@ -551,10 +553,10 @@ $userManagementTable->data['fields_autorefreshTime'][0] .= ui_print_input_placeh // Title for Language and Appearance. $userManagementTable->data['title_lookAndFeel'] = html_print_subtitle_table(__('Language and Appearance')); // Language and color scheme. -$userManagementTable->rowclass['captions_lang_colorscheme'] = 'field_half_width'; -$userManagementTable->rowclass['fields_lang_colorscheme'] = 'field_half_width'; -$userManagementTable->data['captions_lang_colorscheme'][0] = __('Language'); -$userManagementTable->data['fields_lang_colorscheme'][0] = html_print_select_from_sql( +$userManagementTable->rowclass['line1_looknfeel'] = 'field_half_width'; +$userManagementTable->rowclass['line2_looknfeel'] = 'field_half_width'; +$userManagementTable->data['line1_looknfeel'][0] = __('Language'); +$userManagementTable->data['line2_looknfeel'][0] = html_print_select_from_sql( 'SELECT id_language, name FROM tlanguage', 'language', $user_info['language'], @@ -564,8 +566,15 @@ $userManagementTable->data['fields_lang_colorscheme'][0] = html_print_select_fro true ); -$userManagementTable->data['captions_lang_colorscheme'][1] = __('User color scheme'); -$userManagementTable->data['fields_lang_colorscheme'][1] = skins_print_select($id_usr, 'skin', $user_info['id_skin'], '', __('None'), 0, true); +if (is_metaconsole() === true) { + if (users_is_admin() === true) { + $userManagementTable->data['line1_looknfeel'][1] = $outputMetaAccess[0]; + $userManagementTable->data['line2_looknfeel'][1] = $outputMetaAccess[1]; + } +} else { + $userManagementTable->data['line1_looknfeel'][1] = __('User color scheme'); + $userManagementTable->data['line2_looknfeel'][1] = skins_print_select($id_usr, 'skin', $user_info['id_skin'], '', __('None'), 0, true); +} $userManagementTable->rowclass['captions_blocksize_eventfilter'] = 'field_half_width'; $userManagementTable->rowclass['fields_blocksize_eventfilter'] = 'field_half_width'; @@ -591,41 +600,55 @@ $userManagementTable->data['fields_blocksize_eventfilter'][1] = html_print_selec false, false ); +if (is_metaconsole() === false) { + // Home screen table. + $homeScreenTable = new stdClass(); + $homeScreenTable->class = 'w100p table_section full_section'; + $homeScreenTable->id = 'home_screen_table'; + $homeScreenTable->style = []; + $homeScreenTable->rowclass = []; + $homeScreenTable->data = []; + // Home screen. + $homeScreenTable->data['captions_homescreen'][0] = __('Home screen'); + $homeScreenTable->colspan['captions_homescreen'][0] = 2; + $homeScreenTable->rowclass['captions_homescreen'] = 'field_half_width'; + $homeScreenTable->rowclass['fields_homescreen'] = 'field_half_width flex'; + $homeScreenTable->data['fields_homescreen'][0] = html_print_select( + $homeScreenValues, + 'section', + io_safe_output($user_info['section']), + 'show_data_section();', + '', + -1, + true, + false, + false + ); + $homeScreenTable->data['fields_homescreen'][1] = html_print_div( + [ + 'class' => 'w100p', + 'content' => $customHomeScreenDataField, + ], + true + ); -// Home screen table. -$homeScreenTable = new stdClass(); -$homeScreenTable->class = 'w100p table_section full_section'; -$homeScreenTable->id = 'home_screen_table'; -$homeScreenTable->style = []; -$homeScreenTable->rowclass = []; -$homeScreenTable->data = []; + $userManagementTable->rowclass['homescreen_table'] = 'w100p'; + $userManagementTable->data['homescreen_table'] = html_print_table($homeScreenTable, true); +} -// Home screen. -$homeScreenTable->data['captions_homescreen'][0] = __('Home screen'); -$homeScreenTable->colspan['captions_homescreen'][0] = 2; -$homeScreenTable->rowclass['captions_homescreen'] = 'field_half_width'; -$homeScreenTable->rowclass['fields_homescreen'] = 'field_half_width flex'; -$homeScreenTable->data['fields_homescreen'][0] = html_print_select( - $homeScreenValues, - 'section', - io_safe_output($user_info['section']), - 'show_data_section();', - '', - -1, - true, - false, - false -); -$homeScreenTable->data['fields_homescreen'][1] = html_print_div( - [ - 'class' => 'w100p', - 'content' => $customHomeScreenDataField, - ], - true -); +if (is_metaconsole() === true && users_is_admin() === true) { + $userManagementTable->rowclass['search_custom1_looknfeel'] = 'field_half_width'; + $userManagementTable->rowclass['search_custom2_looknfeel'] = 'field_half_width flex-column'; + $userManagementTable->data['search_custom1_looknfeel'][0] = $searchCustomFieldView[0]; + $userManagementTable->data['search_custom2_looknfeel'][0] = $searchCustomFieldView[1]; -$userManagementTable->rowclass['homescreen_table'] = 'w100p'; -$userManagementTable->data['homescreen_table'] = html_print_table($homeScreenTable, true); + $userManagementTable->rowclass['agent_manager1_looknfeel'] = 'field_half_width'; + $userManagementTable->rowclass['agent_manager2_looknfeel'] = 'field_half_width flex-column'; + $userManagementTable->data['agent_manager1_looknfeel'][0] = $metaconsoleAgentManager[0]; + $userManagementTable->data['agent_manager1_looknfeel'][1] = $metaconsoleAgentManager[2]; + $userManagementTable->data['agent_manager2_looknfeel'][0] = $metaconsoleAgentManager[1]; + $userManagementTable->data['agent_manager2_looknfeel'][1] = $metaconsoleAgentManager[3]; +} // Timezone. $userManagementTable->rowclass['captions_timezone'] = 'field_half_width'; @@ -639,14 +662,15 @@ $userManagementTable->data['fields_timezone'][0] .= ui_print_input_placeholder( __('The timezone must be that of the associated server.'), true ); - -$userManagementTable->data['fields_timezone'][1] = html_print_div( - [ - 'id' => 'timezone-picker', - 'content' => implode('', $timezoneContent), - ], - true -); +if (is_metaconsole() === false) { + $userManagementTable->data['fields_timezone'][1] = html_print_div( + [ + 'id' => 'timezone-picker', + 'content' => implode('', $timezoneContent), + ], + true + ); +} // Title for Language and Appearance. $userManagementTable->data['title_additionalSettings'] = html_print_subtitle_table(__('Additional settings')); @@ -743,3 +767,19 @@ html_print_table($userManagementTable); if ($new_user === false && ((bool) check_acl($config['id_user'], 0, 'UM') === true)) { profile_print_profile_table($id, io_safe_output($json_profile), false, ($is_err === true)); } + +?> + \ No newline at end of file diff --git a/pandora_console/include/functions_profile.php b/pandora_console/include/functions_profile.php index d656cdeff2..f9d52ae289 100644 --- a/pandora_console/include/functions_profile.php +++ b/pandora_console/include/functions_profile.php @@ -191,15 +191,9 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c $table->id = 'table_profiles'; $table->width = '100%'; $table->class = 'info_table'; - if (is_metaconsole() === true) { - $table->head_colspan[0] = 0; - $table->width = '100%'; - $table->class = 'databox_tactical data'; - $table->title = $title; - } else { - echo '
'; - echo '

'.$title.'

'; - } + + echo '
'; + echo '

'.$title.'

'; $table->data = []; $table->head = []; @@ -405,9 +399,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c array_push($table->data, $data); html_print_table($table, $return); - if (is_metaconsole() === false) { - echo '
'; - } + echo '
'; unset($table); } From 00ba02e23e292b8d525d20f4fc99292a234775d1 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 14 Mar 2023 13:26:21 +0100 Subject: [PATCH 102/234] Visual changes PDFs slicebar --- pandora_console/include/chart_generator.php | 7 +-- pandora_console/include/functions.php | 13 +++++ pandora_console/include/functions_events.php | 2 +- .../include/functions_reporting_html.php | 50 ++++++++++--------- .../include/graphs/functions_flot.php | 6 ++- pandora_console/include/styles/events.css | 5 ++ 6 files changed, 54 insertions(+), 29 deletions(-) diff --git a/pandora_console/include/chart_generator.php b/pandora_console/include/chart_generator.php index 7bc4785011..2e9ec50479 100644 --- a/pandora_console/include/chart_generator.php +++ b/pandora_console/include/chart_generator.php @@ -27,8 +27,6 @@ */ // Begin. -require_once 'config.php'; - require_once __DIR__.'/config.php'; require_once __DIR__.'/functions.php'; require_once __DIR__.'/functions_db.php'; @@ -87,7 +85,7 @@ if (check_login(false) === false) {

Access is not granted

-