From 50e8b457f8d2ae1d0bece5a83937550f393ae8a3 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Thu, 9 Feb 2023 11:42:42 +0100 Subject: [PATCH 01/12] #10302 fixed tz in event list --- pandora_console/operation/events/events.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 6777ced4c3..c7c8be45ce 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -350,7 +350,7 @@ if (is_ajax() === true) { 'te.warning_instructions', 'te.unknown_instructions', 'te.owner_user', - 'if(te.ack_utimestamp > 0, from_unixtime(te.ack_utimestamp),"") as ack_utimestamp', + 'if(te.ack_utimestamp > 0, te.ack_utimestamp,"") as ack_utimestamp', 'te.custom_data', 'te.data', 'te.module_status', @@ -380,7 +380,7 @@ if (is_ajax() === true) { $order['field'] = 'agent_name'; break; - case 'if(te.ack_utimestamp > 0, from_unixtime(te.ack_utimestamp),"") as ack_utimestamp': + case 'if(te.ack_utimestamp > 0, te.ack_utimestamp,"") as ack_utimestamp': $order['field'] = 'ack_utimestamp'; break; @@ -528,7 +528,7 @@ if (is_ajax() === true) { true ); $tmp->timestamp = ui_print_timestamp( - $tmp->timestamp, + $tmp->utimestamp, true ); From 55347713516a40fdf30bd36ce97acce723b4f657 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Tue, 14 Feb 2023 10:24:08 +0100 Subject: [PATCH 02/12] added all nodes option in sql query report item in meta --- .../reporting_builder.item_editor.php | 26 ++++- .../include/functions_reporting.php | 109 ++++++++++++++++-- 2 files changed, 123 insertions(+), 12 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 80e72e65cf..8c66b583ee 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -1233,6 +1233,29 @@ $class = 'databox filters'; } ?> + 'All nodes'], $servers); + if ($meta) { + ?> + + + + + + + + @@ -6334,6 +6357,7 @@ function chooseType() { $("#row_alert_templates").hide(); $("#row_alert_actions").hide(); $("#row_servers").hide(); + $("#row_servers_all_opt").hide(); $("#row_multiple_servers").hide(); $("#row_sort").hide(); $("#row_date").hide(); @@ -6648,7 +6672,7 @@ function chooseType() { $("#row_header").show(); $("#row_custom").show(); $("#row_custom_example").show(); - $("#row_servers").show(); + $("#row_servers_all_opt").show(); $("#row_historical_db_check").show(); break; diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 637ae59752..c17745da8b 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -68,6 +68,7 @@ define('REPORT_STATUS_IGNORED', 5); // Clases. use PandoraFMS\Enterprise\Metaconsole\Node; +use PandoraFMS\Enterprise\Metaconsole\Synchronizer; use PandoraFMS\Event; use PandoraFMS\Module; @@ -7421,6 +7422,14 @@ function reporting_text($report, $content) } +/** + * Build SQL report item. + * + * @param array $report Report info. + * @param array $content Content info. + * + * @return array + */ function reporting_sql($report, $content) { global $config; @@ -7438,15 +7447,97 @@ function reporting_sql($report, $content) $return['description'] = $content['description']; $return['date'] = reporting_get_date_text(); - if ($config['metaconsole'] && !empty($content['server_name'])) { - $id_meta = metaconsole_get_id_server( + if (is_metaconsole() === true + && empty($content['server_name']) === false + && $content['server_name'] !== 'all' + ) { + $id_server = metaconsole_get_id_server( $content['server_name'] ); - - $server = metaconsole_get_connection_by_id($id_meta); - metaconsole_connect($server); } + if (is_metaconsole() === true && $content['server_name'] === 'all') { + $sync = new Synchronizer(); + $results = $sync->apply( + function ($node) use ($report, $content) { + try { + $node->connect(); + $rs = reporting_sql_auxiliary($report, $content); + $node->disconnect(); + } catch (Exception $e) { + return [ + 'error' => __( + 'Failed to connect to node %s', + $node->server_name() + ), + ]; + } + + if ($rs === false) { + return ['result' => []]; + } + + return ['result' => $rs]; + }, + false + ); + + $data = []; + $return['correct'] = 1; + $return['error'] = ''; + + foreach ($results as $id_node => $items) { + foreach ($items['result']['data'] as $key => $item) { + $items['result']['data'][$key] = ['node_id' => $id_node] + $items['result']['data'][$key]; + } + + if ((int) $items['result']['correct'] !== 1) { + $return['correct'] = 0; + } + + if ($items['result']['error'] !== '') { + $return['error'] = $items['result']['error']; + } + + $return['sql'] = $items['result']['sql']; + + $data = array_merge($data, $items['result']['data']); + } + + $return['data'] = $data; + } else { + try { + if (is_metaconsole() === true && $id_server > 0) { + $node = new Node($id_server); + $node->connect(); + } + + $query_result = reporting_sql_auxiliary($report, $content); + $return = array_merge($return, $query_result); + + if (is_metaconsole() === true && $id_server > 0) { + $node->disconnect(); + } + } catch (\Exception $e) { + if (is_metaconsole() === true && $id_server > 0) { + $node->disconnect(); + } + } + } + + return reporting_check_structure_content($return); +} + + +/** + * Auxiliary function for reporting_sql. + * + * @param array $report Report info. + * @param array $content Content info. + * + * @return array + */ +function reporting_sql_auxiliary($report, $content) { if ($content['treport_custom_sql_id'] != 0) { $sql = io_safe_output( db_get_value_filter( @@ -7459,7 +7550,7 @@ function reporting_sql($report, $content) $sql = $content['external_source']; } - // Check if exist sql macro. + // Check if SQL macro exists. $sql = reporting_sql_macro($report, $sql); // Do a security check on SQL coming from the user. @@ -7514,11 +7605,7 @@ function reporting_sql($report, $content) $return['error'] = __('Illegal query: Due security restrictions, there are some tokens or words you cannot use: *, delete, drop, alter, modify, password, pass, insert or update.'); } - if ($config['metaconsole'] && !empty($content['server_name'])) { - metaconsole_restore_db(); - } - - return reporting_check_structure_content($return); + return $return; } From 87c3bee756380da6ff865ad7c0bae043c52c3188 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Wed, 15 Feb 2023 11:23:36 +0100 Subject: [PATCH 03/12] 9666-New widget Event cardboard --- .../images/widgets/EventCardboard.png | Bin 0 -> 4179 bytes pandora_console/include/functions_events.php | 55 ++ .../include/lib/Dashboard/Widget.php | 1 + .../lib/Dashboard/Widgets/EventCardboard.php | 664 ++++++++++++++++++ .../include/styles/meta_dashboards.css | 15 + 5 files changed, 735 insertions(+) create mode 100644 pandora_console/images/widgets/EventCardboard.png create mode 100644 pandora_console/include/lib/Dashboard/Widgets/EventCardboard.php diff --git a/pandora_console/images/widgets/EventCardboard.png b/pandora_console/images/widgets/EventCardboard.png new file mode 100644 index 0000000000000000000000000000000000000000..5dba098d468700d397496abf9f0341b9f9bb6cd4 GIT binary patch literal 4179 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 literal 0 HcmV?d00001 diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 48ef7b2c30..6d7de4a9b1 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -5826,3 +5826,58 @@ function get_events_get_response_target( } } } + + +/** + * Gets the count of events by criticity. + * + * @param integer $utimestamp Utimestamp to search. + * @param integer $eventType Event type. + * @param array $groupId Groups. + * @param integer $eventStatus Event status. + * @param array $criticityId Criticity to search. + * + * @return array + */ +function get_count_event_criticity( + $utimestamp, + $eventType, + $groupId, + $eventStatus, + $criticityId +) { + $type = ' '; + if ($eventType !== '0') { + $type = 'AND event_type = "'.$eventType.'"'; + } + + $groups = ' '; + if ((int) $groupId !== 0) { + $groups = 'AND id_grupo IN ('.$groupId.')'; + } + + $status = ' '; + if ((int) $eventStatus !== -1) { + $status = 'AND estado = '.$eventStatus; + } + + $criticity = ' '; + if (empty($criticityId) === false) { + $criticity = 'AND criticity IN ('.$criticityId.')'; + } + + $sql_meta = sprintf( + 'SELECT COUNT(id_evento) AS count, + criticity + FROM tevento + WHERE utimestamp >= %d %s %s %s %s + GROUP BY criticity', + $utimestamp, + $type, + $groups, + $status, + $criticity + ); + + return db_get_all_rows_sql($sql_meta); +} diff --git a/pandora_console/include/lib/Dashboard/Widget.php b/pandora_console/include/lib/Dashboard/Widget.php index 2753b8a55d..bb082de0c7 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 'EventCardboard': $className .= '\\'.$name; break; diff --git a/pandora_console/include/lib/Dashboard/Widgets/EventCardboard.php b/pandora_console/include/lib/Dashboard/Widgets/EventCardboard.php new file mode 100644 index 0000000000..87e592c8af --- /dev/null +++ b/pandora_console/include/lib/Dashboard/Widgets/EventCardboard.php @@ -0,0 +1,664 @@ +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 = __('Event cardboard'); + + // Name. + if (empty($this->name) === true) { + $this->name = 'EventCardboard'; + } + + // This forces at least a first configuration. + $this->configurationRequired = false; + if (isset($this->values['groupId']) === false) { + $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['eventType']) === true) { + $values['eventType'] = $decoder['eventType']; + } + + if (isset($decoder['maxHours']) === true) { + $values['maxHours'] = $decoder['maxHours']; + } + + if (isset($decoder['eventStatus']) === true) { + $values['eventStatus'] = $decoder['eventStatus']; + } + + if (isset($decoder['severity']) === true) { + $values['severity'] = $decoder['severity']; + } + + if (isset($decoder['groupId']) === true) { + $values['groupId'] = $decoder['groupId']; + } + + 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 + { + $values = $this->values; + + // Retrieve global - common inputs. + $inputs = parent::getFormInputs(); + + // Remove background field, this widget doesn't use it. + foreach ($inputs as $kIn => $vIn) { + if ($vIn['label'] === 'Background') { + unset($inputs[$kIn]); + } + } + + $blocks = [ + 'row1', + 'row2', + ]; + + $inputs['blocks'] = $blocks; + + foreach ($inputs as $kInput => $vInput) { + $inputs['inputs']['row1'][] = $vInput; + } + + // Event Type. + $fields = get_event_types(); + $fields['not_normal'] = __('Not normal'); + + $inputs['inputs']['row1'][] = [ + 'label' => __('Event type'), + 'arguments' => [ + 'type' => 'select', + 'fields' => $fields, + 'class' => 'event-widget-input', + 'name' => 'eventType', + 'selected' => $values['eventType'], + 'return' => true, + 'nothing' => __('Any'), + 'nothing_value' => 0, + ], + ]; + + // Max. hours old. Default 8. + if (isset($values['maxHours']) === false) { + $values['maxHours'] = 8; + } + + $inputs['inputs']['row1'][] = [ + 'label' => __('Max. hours old'), + 'arguments' => [ + 'name' => 'maxHours', + 'type' => 'number', + 'class' => 'event-widget-input', + 'value' => $values['maxHours'], + 'return' => true, + 'min' => 0, + ], + ]; + + // Event status. + $fields = [ + -1 => __('All event'), + 1 => __('Only validated'), + 0 => __('Only pending'), + ]; + + $inputs['inputs']['row1'][] = [ + 'label' => __('Event status'), + 'arguments' => [ + 'type' => 'select', + 'fields' => $fields, + 'class' => 'event-widget-input', + 'name' => 'eventStatus', + 'selected' => $values['eventStatus'], + 'return' => true, + ], + ]; + + // Groups. + $return_all_group = false; + $selected_groups_array = explode(',', $values['groupId'][0]); + + if (empty($values['groupId'][0]) === true) { + $selected_groups_array = [0]; + } + + if ((bool) \users_can_manage_group_all('RM') === true + || ($selected_groups_array[0] !== '' + && in_array(0, $selected_groups_array) === true) + ) { + // Return all group if user has permissions or it is a currently + // selected group. + $return_all_group = true; + } + + $inputs['inputs']['row1'][] = [ + 'label' => __('Groups'), + 'arguments' => [ + 'type' => 'select_groups', + 'name' => 'groupId[]', + 'class' => 'event-widget-input', + 'returnAllGroup' => true, + 'privilege' => 'AR', + 'selected' => $selected_groups_array, + 'return' => true, + 'multiple' => true, + 'returnAllGroup' => $return_all_group, + 'required' => true, + ], + ]; + + // Nodes. + if (is_metaconsole() === true) { + $nodes_fields = []; + $servers_ids = metaconsole_get_servers(); + + foreach ($servers_ids as $server) { + $nodes_fields[$server['id']] = $server['server_name']; + } + + $nodes_fields[0] = __('Metaconsola'); + + $nodes_selected = explode(',', $values['nodes']); + + (isset($values['nodes']) === false) ? $nodes_selected = $servers_ids : ''; + + $nodes_height = count($nodes_fields); + if (count($nodes_fields) > 5) { + $nodes_height = 5; + } + + $inputs['inputs']['row2'][] = [ + 'label' => __('Servers'), + 'arguments' => [ + 'name' => 'nodes', + 'type' => 'select', + 'fields' => $nodes_fields, + 'selected' => $nodes_selected, + 'return' => true, + 'multiple' => true, + 'class' => 'overflow-hidden', + 'size' => $nodes_height, + 'select_all' => false, + 'required' => true, + ], + ]; + } + + // Severity. + $fields = get_priorities(); + + $severity_selected = explode(',', $values['severity']); + + if (isset($values['severity']) === false) { + $severity_selected = array_keys($fields); + } + + $inputs['inputs']['row2'][] = [ + 'label' => __('Severity'), + 'arguments' => [ + 'type' => 'select', + 'fields' => $fields, + 'class' => 'event-widget-input', + 'name' => 'severity', + 'selected' => $severity_selected, + 'return' => true, + 'multiple' => true, + ], + ]; + + return $inputs; + } + + + /** + * Get Post for widget. + * + * @return array + */ + public function getPost():array + { + // Retrieve global - common inputs. + $values = parent::getPost(); + + $values['eventType'] = \get_parameter('eventType', 0); + $values['maxHours'] = \get_parameter('maxHours', 8); + $values['eventStatus'] = \get_parameter('eventStatus', -1); + $values['groupId'] = \get_parameter('groupId', []); + $values['severity'] = \get_parameter('severity', -1); + $values['nodes'] = \get_parameter('nodes', 0); + + return $values; + } + + + /** + * Draw widget. + * + * @return string; + */ + public function load() + { + $output = ''; + + ui_require_css_file('events', 'include/styles/', true); + ui_require_javascript_file('pandora_events', 'include/javascript/', true); + + $eventType = $this->values['eventType']; + $groupId = implode(',', $this->values['groupId']); + $utimestamp = strtotime('-'.$this->values['maxHours'].' hours'); + $eventStatus = $this->values['eventStatus']; + $severity = $this->values['severity']; + + $priorities = explode(',', $severity); + // Sort criticity array. + asort($priorities); + + $count_meta = []; + $count_meta_tmp = []; + if (is_metaconsole() === true) { + $meta = false; + $nodes = $this->values['nodes']; + + if (isset($nodes) === true) { + $servers_ids = explode(',', $nodes); + } + + if (in_array(0, $servers_ids) === true) { + $meta = true; + unset($servers_ids[0]); + } + + if (is_metaconsole() === true && $meta === true) { + $events_meta_rows = get_count_event_criticity( + $utimestamp, + $eventType, + $groupId, + $eventStatus, + $severity + ); + + array_push($count_meta_tmp, $events_meta_rows); + } + + foreach ($servers_ids as $server_id) { + try { + $node = new Node((int) $server_id); + $node->connect(); + + $events_meta_rows = get_count_event_criticity( + $utimestamp, + $eventType, + $groupId, + $eventStatus, + $severity + ); + + array_push($count_meta_tmp, $events_meta_rows); + $node->disconnect(); + } catch (\Exception $e) { + // Unexistent envents. + $node->disconnect(); + } + } + + foreach ($count_meta_tmp as $tmpValue) { + foreach ($tmpValue as $value) { + array_push($count_meta, $value); + } + } + + $events_rows = []; + foreach ($priorities as $pKey) { + $count = 0; + $tmp['criticity'] = $pKey; + foreach ($count_meta as $kEventMeta => $vEventMeta) { + if ((int) $pKey === (int) $vEventMeta['criticity']) { + $count += (int) $vEventMeta['count']; + } + } + + $tmp['count'] = $count; + array_push($events_rows, $tmp); + } + } else { + $events_rows = get_count_event_criticity( + $utimestamp, + $eventType, + $groupId, + $eventStatus, + $severity + ); + } + + $output .= ''; + + $width_td = (100 / count(explode(',', $severity))); + + $td_count = 0; + foreach ($priorities as $key) { + $count = 0; + foreach ($events_rows as $event) { + if ((int) $key === (int) $event['criticity']) { + $count = $event['count']; + } + } + + switch ((int) $key) { + case 0: + $text = __('Maintenance'); + $color = get_priority_class((int) $key); + break; + + case 1: + $text = __('Informational'); + $color = get_priority_class((int) $key); + break; + + case 2: + $text = __('Normal'); + $color = get_priority_class((int) $key); + break; + + case 3: + $text = __('Warning'); + $color = get_priority_class((int) $key); + break; + + case 4: + $text = __('Critical'); + $color = get_priority_class((int) $key); + break; + + case 5: + $text = __('Minor'); + $color = get_priority_class((int) $key); + break; + + case 6: + $text = __('Major'); + $color = get_priority_class((int) $key); + break; + + case 20: + $text = __('Not normal'); + $color = get_priority_class((int) $key); + break; + + case 21: + $text = __('Critical').'/'.__('Normal'); + $color = get_priority_class((int) $key); + break; + + case 34: + $text = __('Warning').'/'.__('Critical'); + $color = get_priority_class((int) $key); + break; + + default: + return false; + } + + $border = ''; + $td_count++; + if (count($priorities) > $td_count) { + $border = ' border-right: 1px solid white; border-collapse: collapse;'; + } + + $output .= ''; + } + + $output .= '
'; + $output .= $count; + $output .= '
'; + $output .= $text; + $output .= '
'; + + return $output; + } + + + /** + * Get description. + * + * @return string. + */ + public static function getDescription() + { + return __('Event cardboard'); + } + + + /** + * Get Name. + * + * @return string. + */ + public static function getName() + { + return 'EventCardboard'; + } + + + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + if (is_metaconsole() === true) { + $size = [ + 'width' => 950, + 'height' => 450, + ]; + } else { + $size = [ + 'width' => 900, + 'height' => 450, + ]; + } + + return $size; + } + + +} diff --git a/pandora_console/include/styles/meta_dashboards.css b/pandora_console/include/styles/meta_dashboards.css index f75afafa93..f3716c0f81 100644 --- a/pandora_console/include/styles/meta_dashboards.css +++ b/pandora_console/include/styles/meta_dashboards.css @@ -29,3 +29,18 @@ li#select_multiple_modules_filtered { #menu_tab li.nomn form#form-select-dashboard { margin-top: 0px !important; } + +.table-border-0 { + border: none !important; + border-spacing: 0px !important; +} + +.big_data { + text-decoration: none; + font-size: 2em; +} + +.med_data { + text-decoration: none; + font-size: 1.5em; +} From 3d5458ae4623d332d7cb38cd4ec9650e31fcfd56 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 22 Feb 2023 11:36:09 +0100 Subject: [PATCH 04/12] #10302 fixed ack date --- pandora_console/operation/events/events.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index c7c8be45ce..251d95200d 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -521,7 +521,7 @@ if (is_ajax() === true) { $tmp->agent_name = io_safe_output($tmp->agent_name); - $tmp->ack_utimestamp_raw = strtotime($tmp->ack_utimestamp); + $tmp->ack_utimestamp_raw = $tmp->ack_utimestamp; $tmp->ack_utimestamp = ui_print_timestamp( (empty($tmp->ack_utimestamp) === true) ? 0 : $tmp->ack_utimestamp, From 25bfc490555f38de1cdada1d66d46d592d638056 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Thu, 23 Feb 2023 18:04:04 +0100 Subject: [PATCH 05/12] minor fix --- .../godmode/reporting/reporting_builder.item_editor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 8c66b583ee..c6650d08fe 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -281,7 +281,7 @@ switch ($action) { $server_name = $item['server_name']; // Metaconsole db connection. - if ($meta && empty($server_name) === false) { + if ($meta && empty($server_name) === false && $server_name !== 'all') { $connection = metaconsole_get_connection($server_name); $server_id = $connection['id']; if (metaconsole_load_external_db($connection) != NOERR) { From 9294253675caac425403a378cbfa96471b48dae8 Mon Sep 17 00:00:00 2001 From: Calvo Date: Fri, 24 Feb 2023 15:12:18 +0100 Subject: [PATCH 06/12] Fix regex to extract version and oum --- pandora_server/lib/PandoraFMS/PluginTools.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index dbb60fa2c8..d937120d39 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -33,7 +33,7 @@ use base 'Exporter'; our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only -my $pandora_version = "7.0NG.769"; +my $pandora_version = "7.0NG.769+ALT"; my $pandora_build = "230224"; our $VERSION = $pandora_version." ".$pandora_build; @@ -118,12 +118,12 @@ sub check_lib_version { $plugin_version = "0NG.0" if empty($plugin_version); - my ($main,$oum) = split /NG./, $plugin_version; + my ($main,$oum) = $plugin_version =~ m/(\d*\.?\d+)NG\.(\d*\.?\d+)/; $main = 0 if empty($main) || !looks_like_number($main); $oum = 0 if empty($oum) || !looks_like_number($oum); - my ($libmain,$liboum) = split /NG./, $pandora_version; + my ($libmain,$liboum) = $pandora_version =~ m/(\d*\.?\d+)NG\.(\d*\.?\d+)/; if (($liboum < $oum) || ($libmain != $main)) { From 96a5dd99919d9b78375e53b55791c0e6866738a6 Mon Sep 17 00:00:00 2001 From: Calvo Date: Fri, 24 Feb 2023 15:15:06 +0100 Subject: [PATCH 07/12] Fix minor bug --- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index d937120d39..930174b98c 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -33,7 +33,7 @@ use base 'Exporter'; our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only -my $pandora_version = "7.0NG.769+ALT"; +my $pandora_version = "7.0NG.769"; my $pandora_build = "230224"; our $VERSION = $pandora_version." ".$pandora_build; From fcd9a93f68660168d89a070e88d11682853b28f0 Mon Sep 17 00:00:00 2001 From: Calvo Date: Mon, 27 Feb 2023 10:53:59 +0100 Subject: [PATCH 08/12] Fix code style --- pandora_server/lib/PandoraFMS/PluginTools.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index 930174b98c..0cb752b956 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -118,12 +118,12 @@ sub check_lib_version { $plugin_version = "0NG.0" if empty($plugin_version); - my ($main,$oum) = $plugin_version =~ m/(\d*\.?\d+)NG\.(\d*\.?\d+)/; + my ($main,$oum) = ($plugin_version =~ m/(\d*\.?\d+)NG\.(\d*\.?\d+)/); $main = 0 if empty($main) || !looks_like_number($main); $oum = 0 if empty($oum) || !looks_like_number($oum); - my ($libmain,$liboum) = $pandora_version =~ m/(\d*\.?\d+)NG\.(\d*\.?\d+)/; + my ($libmain,$liboum) = ($pandora_version =~ m/(\d*\.?\d+)NG\.(\d*\.?\d+)/); if (($liboum < $oum) || ($libmain != $main)) { From f1bb7b450e3e607b960706d985721ad3b53969a6 Mon Sep 17 00:00:00 2001 From: artica Date: Thu, 2 Mar 2023 01:00:46 +0100 Subject: [PATCH 09/12] 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 f60763b69b..a8a7940165 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-230301 +Version: 7.0NG.769-230302 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 4f52b3aa35..21522e4937 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-230301" +pandora_version="7.0NG.769-230302" 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 4fa07035d2..a1e5ea6e0e 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 => '230301'; +use constant AGENT_BUILD => '230302'; # 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 f8ab9c7e41..107be42b57 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 230301 +%define release 230302 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 6a16d883fd..0f5ae307c0 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 230301 +%define release 230302 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 46e66a8170..6c14bec893 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="230301" +PI_BUILD="230302" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 79687a6d2e..0c79064ec1 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230301} +{230302} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 8264d0e9c8..13c0a7445d 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 230301") +#define PANDORA_VERSION ("7.0NG.769 Build 230302") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index ece56bd837..eff0e22339 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 230301))" + VALUE "ProductVersion", "(7.0NG.769(Build 230302))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index c9f3c45a17..59ea1588fa 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.769-230301 +Version: 7.0NG.769-230302 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 90ab3e8133..aaae992e96 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-230301" +pandora_version="7.0NG.769-230302" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index e197b66be2..3ba4310159 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 = 'PC230301'; +$build_version = 'PC230302'; $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 e76fce4a52..7938198596 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 8b319376d8..b3438f8d82 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 230301 +%define release 230302 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 931745b212..3b050ebbea 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 230301 +%define release 230302 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index f4c905a120..5f1d3b7245 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230301" +PI_BUILD="230302" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index cad9bf5993..74cbb27d4c 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 230301"; +my $version = "7.0NG.769 Build 230302"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 5fbf54b2e5..dc01241c19 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 230301"; +my $version = "7.0NG.769 Build 230302"; # save program name for logging my $progname = basename($0); From ad33accfda0a738983a5de807b424b28912f7799 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 2 Mar 2023 11:10:09 +0100 Subject: [PATCH 10/12] fixed styles --- .../godmode/alerts/alert_actions.php | 6 --- .../godmode/alerts/alert_commands.php | 4 -- .../godmode/alerts/alert_templates.php | 6 +-- .../godmode/alerts/configure_alert_action.php | 4 -- .../alerts/configure_alert_command.php | 3 -- pandora_console/godmode/category/category.php | 44 +++++++------------ pandora_console/godmode/groups/group_list.php | 3 -- .../modules/manage_inventory_modules.php | 2 - .../godmode/modules/manage_nc_groups.php | 4 -- .../modules/manage_network_components.php | 4 -- pandora_console/godmode/servers/plugin.php | 8 ---- .../godmode/servers/plugin_registration.php | 5 --- .../godmode/users/configure_profile.php | 4 -- .../godmode/users/configure_user.php | 4 -- .../godmode/users/profile_list.php | 4 -- pandora_console/godmode/users/user_list.php | 4 -- pandora_console/operation/users/user_edit.php | 2 - pandora_console/views/calendar/edit.php | 3 -- pandora_console/views/calendar/list.php | 3 -- .../views/calendar/special_days.php | 2 - .../views/calendar/special_days_edit.php | 2 - 21 files changed, 18 insertions(+), 103 deletions(-) diff --git a/pandora_console/godmode/alerts/alert_actions.php b/pandora_console/godmode/alerts/alert_actions.php index 0bd5d33830..05525323e8 100644 --- a/pandora_console/godmode/alerts/alert_actions.php +++ b/pandora_console/godmode/alerts/alert_actions.php @@ -36,10 +36,6 @@ enterprise_include_once('meta/include/functions_alerts_meta.php'); check_login(); - - -enterprise_hook('open_meta_frame'); - if (! check_acl($config['id_user'], 0, 'LM')) { db_pandora_audit( AUDIT_LOG_ACL_VIOLATION, @@ -473,5 +469,3 @@ if (is_management_allowed() === true) { echo ''; echo '
'; } - -enterprise_hook('close_meta_frame'); diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php index 5a02e4814f..610c503cdc 100644 --- a/pandora_console/godmode/alerts/alert_commands.php +++ b/pandora_console/godmode/alerts/alert_commands.php @@ -566,8 +566,6 @@ tyle='display:none;'>"; echo ''; } -enterprise_hook('open_meta_frame'); - if ($update_command) { include_once 'configure_alert_command.php'; return; @@ -836,8 +834,6 @@ if (users_is_admin() === true) { echo ''; } -enterprise_hook('close_meta_frame'); - ?> '; +echo '
'; // Retrieve UM url configured (or default). $url = get_um_url(); $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox filters'; - -if (is_metaconsole()) { - $table->head[0] = __('Licence'); - $table->head_colspan[0] = 3; - $table->headstyle[0] = 'text-align: center'; - $table->style[0] = 'font-weight: bold;'; -} - +$table->class = 'databox filter-table-adv'; +$table->size = []; +$table->size[0] = '50%'; +$table->size[1] = '50%'; $table->data = []; +$table->colspan = []; -$table->data[0][0] = ''.__('Customer key').''; -$table->data[0][1] = html_print_textarea('keys[customer_key]', 10, 255, $settings->customer_key, 'style="width: 450px" class="height_50px w450px"', true); +$table->colspan[0][0] = 2; +$table->data[-1][0] = '
'.__('Licence').'
'; -$table->data[1][0] = ''.__($license['expiry_caption']).''; -$table->data[1][1] = html_print_input_text('expires', $license['expiry_date'], '', 10, 255, true, true); - -$table->data[2][0] = ''.__('Platform Limit').''; -$table->data[2][1] = html_print_input_text('expires', $license['limit'], '', 10, 255, true, true).' '.($license['limit_mode'] == 0 ? __('agents') : __('modules')); - -$table->data[3][0] = ''.__('Current Platform Count').''; -$table->data[3][1] = html_print_input_text('expires', $license['count'], '', 10, 255, true, true).' '.($license['limit_mode'] == 0 ? __('agents') : __('modules')); - -$table->data[4][0] = ''.__('Current Platform Count (enabled: items)').''; -$table->data[4][1] = html_print_input_text('expires', $license['count_enabled'], '', 10, 255, true, true).' '.($license['limit_mode'] == 0 ? __('agents') : __('modules')); - -$table->data[5][0] = ''.__('Current Platform Count (disabled: items)').''; -$table->data[5][1] = html_print_input_text('expires', $license['count_disabled'], '', 10, 255, true, true).' '.($license['limit_mode'] == 0 ? __('agents') : __('modules')); - -$table->data[6][0] = ''.__('License Mode').''; -$table->data[6][1] = html_print_input_text('expires', $license['license_mode'], '', 10, 255, true, true); - -$table->data[7][0] = ''.__('NMS').''; -$table->data[7][1] = html_print_input_text('expires', ($license['nms'] == 1 ? __('enabled') : __('disabled')), '', 10, 255, true, true); - -$table->data[8][0] = ''.__('Satellite').''; -$table->data[8][1] = html_print_input_text('expires', ($license['dhpm'] == 1 ? __('enabled') : __('disabled')), '', 10, 255, true, true); - -if ($license['dhpm'] == 1) { - $table->data[9][0] = ''.__('License encryption key').''.ui_print_help_tip( - __('This key is used to encrypt your Pandora FMS license when it is shared with other Pandora FMS components'), +$table->colspan[0][0] = 2; +$table->data[0][0] = html_print_label_input_block( + __('Customer key'), + html_print_textarea( + 'keys[customer_key]', + 10, + 255, + $settings->customer_key, + 'style="width: 100%; height:80px;"', true - ); - $table->data[9][1] = html_print_input_password( - 'license_encryption_key', - io_safe_output($settings->license_encryption_key), + ) +); + +$table->data[1][0] = html_print_label_input_block( + __($license['expiry_caption']), + html_print_input_text( + 'expires', + $license['expiry_date'], '', 10, 255, true, - false + true + ) +); + +$table->data[1][1] = html_print_label_input_block( + __('Platform Limit'), + html_print_input_text( + 'expires', + $license['limit'], + '', + 10, + 255, + true, + true + ).' '.($license['limit_mode'] == 0 ? __('agents') : __('modules')) +); + +$table->data[2][0] = html_print_label_input_block( + __('Current Platform Count'), + html_print_input_text( + 'expires', + $license['count'], + '', + 10, + 255, + true, + true + ).' '.($license['limit_mode'] == 0 ? __('agents') : __('modules')) +); + +$table->data[2][1] = html_print_label_input_block( + __('Current Platform Count (enabled: items)'), + html_print_input_text( + 'expires', + $license['count_enabled'], + '', + 10, + 255, + true, + true + ).' '.($license['limit_mode'] == 0 ? __('agents') : __('modules')) +); + +$table->data[3][0] = html_print_label_input_block( + __('Current Platform Count (disabled: items)'), + html_print_input_text( + 'expires', + $license['count_disabled'], + '', + 10, + 255, + true, + true + ).' '.($license['limit_mode'] == 0 ? __('agents') : __('modules')) +); + +$table->data[3][1] = html_print_label_input_block( + __('License Mode'), + html_print_input_text( + 'expires', + $license['license_mode'], + '', + 10, + 255, + true, + true + ) +); + +$table->data[4][0] = html_print_label_input_block( + __('NMS'), + html_print_input_text( + 'expires', + ($license['nms'] == 1 ? __('enabled') : __('disabled')), + '', + 10, + 255, + true, + true + ) +); + +$table->data[4][1] = html_print_label_input_block( + __('Satellite'), + html_print_input_text( + 'expires', + ($license['dhpm'] == 1 ? __('enabled') : __('disabled')), + '', + 10, + 255, + true, + true + ) +); + +$table->data[5][0] = html_print_label_input_block( + __('Licensed to'), + html_print_input_text( + 'licensed_to', + $license['licensed_to'], + '', + 64, + 255, + true, + true + ) +); + +if ($license['dhpm'] == 1) { + $table->data[5][1] = html_print_label_input_block( + __('License encryption key').''.ui_print_help_tip( + __('This key is used to encrypt your Pandora FMS license when it is shared with other Pandora FMS components'), + true + ), + html_print_input_password( + 'license_encryption_key', + io_safe_output($settings->license_encryption_key), + '', + 10, + 255, + true, + false + ) ); } -$table->data[10][0] = ''.__('Licensed to').''; -$table->data[10][1] = html_print_input_text('licensed_to', $license['licensed_to'], '', 64, 255, true, true); - html_print_table($table); // If DESTDIR is defined the enterprise license is expired. if (enterprise_installed() || defined('DESTDIR')) { - echo '
'; - html_print_input_hidden('update_settings', 1); - html_print_submit_button(__('Validate'), 'update_button', false, 'class="sub upd"'); - echo '  '; - html_print_button(__('Request new license'), 'license', false, 'generate_request_code()', [ 'fixed_id' => 'button-', 'icon' => 'next']); - echo '
'; + $buttons = html_print_input_hidden('update_settings', 1, true); + $buttons .= html_print_submit_button( + __('Validate'), + 'update_button', + false, + ['icon' => 'next'], + true + ); + $buttons .= html_print_button( + __('Request new license'), + 'license', + false, + 'generate_request_code()', + [ + 'fixed_id' => 'button-', + 'icon' => 'next', + 'mode' => 'secondary', + ], + true + ); + + html_print_action_buttons( + $buttons + ); } +echo '
'; if (is_metaconsole()) { ui_require_css_file('pandora_enterprise', ENTERPRISE_DIR.'/include/styles/'); ui_require_css_file('register', 'include/styles/'); @@ -220,7 +342,6 @@ if (is_metaconsole()) { } if (enterprise_hook('print_activate_licence_dialog') == ENTERPRISE_NOT_HOOK) { - echo ''; echo '