From 34fede2ce103f9c9add426828ddf8a2cbe7aa61e Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 27 Jan 2023 12:42:23 +0100 Subject: [PATCH 01/22] #9819 New section configuration sound event --- pandora_console/extras/mr/65.sql | 10 + .../godmode/events/configuration_sounds.php | 71 +++ pandora_console/include/ajax/events.php | 5 + .../include/class/EventSound.class.php | 495 ++++++++++++++++++ .../operation/events/sound_events.php | 5 + pandora_console/operation/menu.php | 4 + 6 files changed, 590 insertions(+) create mode 100644 pandora_console/extras/mr/65.sql create mode 100644 pandora_console/godmode/events/configuration_sounds.php create mode 100644 pandora_console/include/class/EventSound.class.php diff --git a/pandora_console/extras/mr/65.sql b/pandora_console/extras/mr/65.sql new file mode 100644 index 0000000000..7e65e62c2f --- /dev/null +++ b/pandora_console/extras/mr/65.sql @@ -0,0 +1,10 @@ +START TRANSACTION; + +CREATE TABLE `tevent_sound` ( + `id` INT NOT NULL AUTO_INCREMENT, + `name` TEXT NULL, + `sound` TEXT NULL, + `active` TINYINT NOT NULL DEFAULT '1', +PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +COMMIT; diff --git a/pandora_console/godmode/events/configuration_sounds.php b/pandora_console/godmode/events/configuration_sounds.php new file mode 100644 index 0000000000..d4e9d77688 --- /dev/null +++ b/pandora_console/godmode/events/configuration_sounds.php @@ -0,0 +1,71 @@ + '[EventSound]'.$e->getMessage() ]); + exit; + } else { + echo '[EventSound]'.$e->getMessage(); + } + + // Stop this execution, but continue 'globally'. + return; +} + +// AJAX controller. +if ((bool) is_ajax() === true) { + $method = get_parameter('method'); + + if (method_exists($controller, $method) === true) { + if ($controller->ajaxMethod($method) === true) { + $controller->{$method}(); + } else { + $controller->error('Unavailable method.'); + } + } else { + $controller->error('Method not found. ['.$method.']'); + } + + // Stop any execution. + exit; +} else { + // Run. + $controller->run(); +} diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index d9be30cc33..2f06006f0b 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -2348,6 +2348,11 @@ if ($drawConsoleSound === true) { 'Star_Trek_emergency_simulation.wav' => 'StarTrek emergency simulation', ]; + $eventsounds = mysql_db_get_all_rows_sql('SELECT * FROM tevent_sound WHERE active = 1'); + foreach ($eventsounds as $key => $row) { + $sounds[$row['sound']] = $row['name']; + } + $inputs[] = [ 'class' => 'test-sounds', 'direct' => 1, diff --git a/pandora_console/include/class/EventSound.class.php b/pandora_console/include/class/EventSound.class.php new file mode 100644 index 0000000000..93f42ec7c4 --- /dev/null +++ b/pandora_console/include/class/EventSound.class.php @@ -0,0 +1,495 @@ +ajaxController = $ajaxController; + } + + + /** + * Run view + * + * @return void + */ + public function run() + { + global $config; + $tab = get_parameter('tab', ''); + $action = get_parameter('action', ''); + $message_ok = 0; + $error_msg = __('Name already exist'); + $ok_msg = __('Successfully created'); + + if ($action == 'create') { + $name = get_parameter('name', ''); + $sound = get_parameter('file', ''); + + $exist = db_get_all_rows_sql(sprintf('SELECT * FROM tevent_sound WHERE name = "%s"', $name)); + + if ($exist === false) { + $uploadMaxFilesize = config_return_in_bytes(ini_get('upload_max_filesize')); + + $upload_status = get_file_upload_status('file'); + $upload_result = translate_file_upload_status($upload_status); + if ($uploadMaxFilesize < $sound['size']) { + $error_msg = __('File is too large to upload. Check the configuration in php.ini.'); + } else { + $pathname = $config['homedir'].'/include/sounds/'; + $nameSound = str_replace(' ', '_', $_FILES['file']['name']); + $target_file = $pathname.basename($nameSound); + + if (file_exists($target_file)) { + $error_msg = __('Sound already are exists.'); + } else { + if (move_uploaded_file($_FILES['file']['tmp_name'], $target_file)) { + $insert = db_process_sql_insert( + 'tevent_sound', + [ + 'name' => $name, + 'sound' => $nameSound, + ] + ); + $ok_msg = __('Successfully created'); + } else { + $error_msg = __('Fail uploading the sound'); + } + } + } + + if ($insert > 0) { + $tab = ''; + $message_ok = 1; + } + } else { + $error_msg = __('Sound already are exists'); + } + } else if ($action == 'change_action') { + $id = get_parameter('id', ''); + $new_action = (int) get_parameter('set_action', '1'); + + $exist = db_get_all_rows_sql(sprintf('SELECT * FROM tevent_sound WHERE id = "%s"', $id)); + + if ($exist !== false) { + $result = db_process_sql_update( + 'tevent_sound', + ['active' => $new_action], + ['id' => $id] + ); + if (false === (bool) $result) { + $error_msg = __('Error on update status'); + } else { + $message_ok = 1; + } + } else { + $error_msg = __('Sound not exist'); + } + } + + if ($action) { + ui_print_result_message( + $message_ok, + $ok_msg, + $error_msg, + '', + false + ); + } + + $base_url = 'index.php?sec=eventos&sec2=godmode/events/configuration_sounds'; + $setup_url = $base_url.'&tab=add'; + $tabs = [ + 'list' => [ + 'text' => ''.html_print_image( + 'images/eye_show.png', + true, + [ + 'title' => __('Sounds'), + 'class' => 'invert_filter', + ] + ).'', + 'active' => (bool) ($tab != 'add'), + ], + 'options' => [ + 'text' => ''.html_print_image( + 'images/pen.png', + true, + [ + 'title' => __('Create'), + 'class' => 'invert_filter', + ] + ).'', + 'active' => (bool) ($tab == 'add'), + ], + ]; + + if ($tab === 'add') { + $helpHeader = ''; + $titleHeader = __('Add new sound'); + } else { + $helpHeader = 'servers_ha_clusters_tab'; + $titleHeader = __('Events sound list'); + } + + // Header. + ui_print_standard_header( + $titleHeader, + 'images/gm_servers.png', + false, + $helpHeader, + false, + $tabs, + [ + [ + 'link' => '', + 'label' => __('Events'), + ], + [ + 'link' => '', + 'label' => __('Configuration Sounds'), + ], + ] + ); + + // Javascript. + ui_require_jquery_file('pandora'); + // CSS. + ui_require_css_file('wizard'); + ui_require_css_file('discovery'); + + if ($tab === 'add') { + echo '
'; + $table = new stdClass(); + $table->width = '100%'; + + $table->class = 'databox filters'; + $table->data = []; + $table->data[0][0] = __('Name:'); + + $table->data[0][1] = html_print_input_text( + 'name', + '', + '', + 80, + 100, + true, + false, + true + ); + + $table->data[1][0] = __('WAV Sound'); + $table->data[1][1] = html_print_input_file('file', true, ['required' => true]); + + html_print_table($table); + + echo '
'; + html_print_submit_button( + __('Create'), + 'save_sound', + false, + 'class="sub wand"' + ); + echo '
'; + echo '
'; + + // Load own javascript file. + echo $this->loadJS(); + } else { + // Datatables list. + try { + $columns = [ + 'name', + 'sound', + [ + 'text' => 'options', + 'class' => 'action_buttons mw120px', + ], + ]; + + $column_names = [ + __('Name'), + __('Sound'), + __('Options'), + ]; + + $this->tableId = 'event_sounds'; + + if (is_metaconsole() === true) { + // Only in case of Metaconsole, format the frame. + open_meta_frame(); + } + + // Load datatables user interface. + ui_print_datatable( + [ + 'id' => $this->tableId, + 'class' => 'info_table', + 'style' => 'width: 100%', + 'columns' => $columns, + 'column_names' => $column_names, + 'ajax_url' => $this->ajaxController, + 'ajax_data' => ['method' => 'draw'], + 'no_sortable_columns' => [-1], + 'order' => [ + 'field' => 'id', + 'direction' => 'asc', + ], + 'search_button_class' => 'sub filter', + 'form' => [ + 'inputs' => [ + [ + 'label' => __('Free search').ui_print_help_tip(__('Search filter by Name or Sound fields content'), true), + 'type' => 'text', + 'class' => 'w200px', + 'id' => 'filter_text', + 'name' => 'filter_text', + ], + [ + 'label' => __('Active'), + 'type' => 'select', + 'fields' => [ + '' => __('All'), + '0' => __('No'), + '1' => __('Yes'), + ], + 'class' => 'w100px', + 'id' => 'active', + 'name' => 'active', + ], + ], + ], + ] + ); + } catch (Exception $e) { + echo $e->getMessage(); + } + + if (is_metaconsole() === true) { + // Close the frame. + close_meta_frame(); + } + + // Load own javascript file. + echo $this->loadJS(); + } + } + + + /** + * Get the data for draw the table. + * + * @return void. + */ + public function draw() + { + global $config; + // Initialice filter. + $filter = '1=1'; + // Init data. + $data = []; + // Count of total records. + $count = 0; + // Catch post parameters. + $start = get_parameter('start', 0); + $length = get_parameter('length', $config['block_size']); + // There is a limit of (2^32)^2 (18446744073709551615) rows in a MyISAM table, show for show all use max nrows. + $length = ($length != '-1') ? $length : '18446744073709551615'; + $order = get_datatable_order(); + $filters = get_parameter('filter', []); + $filterText = $filters['filter_text']; + $filterActive = $filters['active']; + + if (empty($filterText) === false) { + $filter .= sprintf( + " AND (name LIKE '%%%s%%' OR sound LIKE '%%%s%%')", + $filterText, + $filterText + ); + } + + if (in_array($filterActive, [0, 1])) { + $filter .= sprintf( + ' AND active = %s', + $filterActive, + ); + } + + $count = (int) db_get_value_sql(sprintf('SELECT COUNT(*) as "total" FROM tevent_sound WHERE %s', $filter)); + + $sql = sprintf( + 'SELECT * + FROM tevent_sound + WHERE %s + ORDER BY %s + LIMIT %d, %d', + $filter, + $order, + $start, + $length + ); + $data = db_get_all_rows_sql($sql); + + foreach ($data as $key => $row) { + if ($row['active'] === '1') { + $img = 'images/lightbulb.png'; + $action = __('Disable sound'); + $new_action = 0; + } else { + $img = 'images/lightbulb_off.png'; + $action = __('Enable sound'); + $new_action = 1; + } + + $options = ''; + $options .= html_print_image( + $img, + true, + [ + 'title' => $action, + 'class' => 'invert_filter', + ] + ); + $options .= ''; + + $data[$key]['options'] = $options; + } + + echo json_encode( + [ + 'data' => $data, + 'recordsTotal' => $count, + 'recordsFiltered' => $count, + ] + ); + } + + + /** + * Checks if target method is available to be called using AJAX. + * + * @param string $method Target method. + * + * @return boolean True allowed, false not. + */ + public function ajaxMethod(string $method) + { + return in_array($method, $this->AJAXMethods); + } + + + /** + * Load Javascript code. + * + * @return string. + */ + public function loadJS() + { + // Nothing for this moment. + ob_start(); + + // Javascript content. + ?> + + 'StarTrek emergency simulation', ]; +$eventsounds = mysql_db_get_row_sql('SELECT * FROM tevent_sound WHERE active = 1'); +foreach ($eventsounds as $key => $row) { + $sounds[$row['sound']] = $row['name']; +} + $inputs[] = [ 'label' => \__('Sounds'), 'class' => 'flex-row', diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index bb0802a567..fd681495be 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -477,6 +477,10 @@ if ($access_console_node === true) { } Date: Fri, 27 Jan 2023 13:43:23 +0100 Subject: [PATCH 02/22] Fix empty module data list view --- pandora_console/operation/agentes/status_monitor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 8da3b9b2ba..82ba6fcfee 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -1939,7 +1939,7 @@ if (!empty($result)) { } else { $sub_string = substr(io_safe_output($row['datos']), 0, 12); if ($module_value == $sub_string) { - if ($module_value == 0 && !$sub_string) { + if ((empty($module_value) === true || $module_value == 0) && !$sub_string) { $salida = 0; } else { $data_macro = modules_get_unit_macro($row['datos'], $row['unit']); From 624463d5739ec26dff469ddede86dc8b31e85d7d Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 30 Jan 2023 08:27:03 +0100 Subject: [PATCH 03/22] #9819 change setcion menu configuration sound --- pandora_console/godmode/menu.php | 4 ++++ pandora_console/operation/menu.php | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index d98eb9d3c6..9dc13b6abb 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -435,6 +435,10 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($ } } + $sub['godmode/events/configuration_sounds']['text'] = __('Configuration Sounds'); + $sub['godmode/events/configuration_sounds']['id'] = 'Configuration Sounds'; + $sub['godmode/events/configuration_sounds']['pages'] = ['godmode/events/configuration_sounds']; + $menu_godmode['gextensions']['sub'] = $sub; } diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index fd681495be..c777e1d97b 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -477,10 +477,6 @@ if ($access_console_node === true) { } Date: Tue, 31 Jan 2023 08:35:47 +0100 Subject: [PATCH 04/22] #9819 Change labels Accoustic console --- pandora_console/godmode/menu.php | 4 ++-- pandora_console/include/class/EventSound.class.php | 6 +++--- pandora_console/operation/events/events.php | 6 +++--- pandora_console/operation/events/sound_events.php | 4 ++-- pandora_console/operation/menu.php | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 9dc13b6abb..d4f903290e 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -435,8 +435,8 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($ } } - $sub['godmode/events/configuration_sounds']['text'] = __('Configuration Sounds'); - $sub['godmode/events/configuration_sounds']['id'] = 'Configuration Sounds'; + $sub['godmode/events/configuration_sounds']['text'] = __('Accoustic console setup'); + $sub['godmode/events/configuration_sounds']['id'] = 'Accoustic console setup'; $sub['godmode/events/configuration_sounds']['pages'] = ['godmode/events/configuration_sounds']; $menu_godmode['gextensions']['sub'] = $sub; diff --git a/pandora_console/include/class/EventSound.class.php b/pandora_console/include/class/EventSound.class.php index 93f42ec7c4..b943e9cce1 100644 --- a/pandora_console/include/class/EventSound.class.php +++ b/pandora_console/include/class/EventSound.class.php @@ -209,7 +209,7 @@ class EventSound extends HTML $titleHeader = __('Add new sound'); } else { $helpHeader = 'servers_ha_clusters_tab'; - $titleHeader = __('Events sound list'); + $titleHeader = __('Accoustic console sound list'); } // Header. @@ -223,11 +223,11 @@ class EventSound extends HTML [ [ 'link' => '', - 'label' => __('Events'), + 'label' => __('Admin tools'), ], [ 'link' => '', - 'label' => __('Configuration Sounds'), + 'label' => __('Accoustic console setup'), ], ] ); diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 648581a3a6..eb885bf479 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -1473,13 +1473,13 @@ if ($pure) { ] ).''; - // Sound events. + // Accoustic console. $sound_event['active'] = false; $sound_event['text'] = ''.html_print_image( 'images/sound.png', true, [ - 'title' => __('Sound events'), + 'title' => __('Accoustic console'), 'class' => 'invert_filter', ] ).''; @@ -1529,7 +1529,7 @@ if ($pure) { switch ($section) { case 'sound_event': $onheader['sound_event']['active'] = true; - $section_string = __('Sound events'); + $section_string = __('Accoustic console'); break; case 'history': diff --git a/pandora_console/operation/events/sound_events.php b/pandora_console/operation/events/sound_events.php index 2f2b11e065..6ce7a31c3a 100644 --- a/pandora_console/operation/events/sound_events.php +++ b/pandora_console/operation/events/sound_events.php @@ -60,7 +60,7 @@ ob_start(); echo ''; echo ''; -echo ''.__('Sound Events').''; +echo ''.__('Accoustic console').''; ui_require_css_file('wizard'); ui_require_css_file('discovery'); ?> @@ -161,7 +161,7 @@ if ($config['style'] === 'pandora_black' && !is_metaconsole()) { echo ''; echo ""; -echo "

".__('Sound console').'

'; +echo "

".__('Accoustic console').'

'; // Connection lost alert. ui_require_css_file('register', 'include/styles/', true); diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index c777e1d97b..eed84a4d48 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -432,11 +432,11 @@ if ($access_console_node === true) { $sub['operation/events/events_rss.php?user='.$config['id_user'].'&hashup='.$hashup.'&fb64='.$fb64]['type'] = 'direct'; } - // Sound Events. + // Accoustic console. $data_sound = base64_encode( json_encode( [ - 'title' => __('Sound Console'), + 'title' => __('Accoustic console'), 'start' => __('Start'), 'stop' => __('Stop'), 'noAlert' => __('No alert'), @@ -449,8 +449,8 @@ if ($access_console_node === true) { ); $javascript = 'javascript: openSoundEventModal(`'.$data_sound.'`);'; - $sub[$javascript]['text'] = __('Sound Events'); - $sub[$javascript]['id'] = 'Sound Events Modal'; + $sub[$javascript]['text'] = __('Accoustic console'); + $sub[$javascript]['id'] = 'Accoustic console Modal'; $sub[$javascript]['type'] = 'direct'; echo ''; From a7a0886e6ce7121299492edadd84f15d50bb5aea Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 6 Feb 2023 13:24:37 +0100 Subject: [PATCH 05/22] policy maintenance mode --- pandora_console/include/functions.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 7d4fee1d21..790df73e8a 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -6397,3 +6397,23 @@ function getBearerToken() return false; } + + +/** + * Check whether an instance of pandora_db is running. + * + * @return boolean Result. + */ +function is_pandora_db_running() +{ + $is_free_lock = mysql_db_process_sql( + 'SELECT IS_FREE_LOCK("pandora_pandora_db") AS "value"', + 'affected_rows', + '', + false + ); + + $is_free_lock = (bool) $is_free_lock[0]['value']; + + return !$is_free_lock; +} \ No newline at end of file From de3a74ae1ac61deadcfaaac4fe29ecb0dba14f26 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 6 Feb 2023 13:27:25 +0100 Subject: [PATCH 06/22] policy maintenance mode --- pandora_console/include/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 790df73e8a..75e8e7ee58 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -6416,4 +6416,4 @@ function is_pandora_db_running() $is_free_lock = (bool) $is_free_lock[0]['value']; return !$is_free_lock; -} \ No newline at end of file +} From a1ccfc99eca99efe7b28a206adce400a3b3bb4af Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 6 Feb 2023 13:41:31 +0100 Subject: [PATCH 07/22] policy maintenance mode --- pandora_console/include/functions.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 75e8e7ee58..a4713b6f67 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -6406,8 +6406,11 @@ function getBearerToken() */ function is_pandora_db_running() { + // Get current DB name: useful for metaconsole connection to node. + $db_name = db_get_sql('SELECT DATABASE()'); + $is_free_lock = mysql_db_process_sql( - 'SELECT IS_FREE_LOCK("pandora_pandora_db") AS "value"', + 'SELECT IS_FREE_LOCK("'.$db_name.'_pandora_db") AS "value"', 'affected_rows', '', false From 6d85b912e2c5f635a390ba4746a5deebe1b0f2f1 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Mon, 6 Feb 2023 16:34:40 +0100 Subject: [PATCH 08/22] 9962-Omnishell in agent view --- pandora_console/images/omnishell.png | Bin 0 -> 606 bytes pandora_console/include/functions_html.php | 21 ++++++++++++++++++ pandora_console/include/functions_ui.php | 18 +++++++++++++++ .../operation/agentes/ver_agente.php | 21 ++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 pandora_console/images/omnishell.png diff --git a/pandora_console/images/omnishell.png b/pandora_console/images/omnishell.png new file mode 100644 index 0000000000000000000000000000000000000000..02c8f0e071e936d8b8fe8d83261e3d25a867b588 GIT binary patch literal 606 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc#=yY%t50_}ki(Mh=?zc(M!jHiZ6P)IEGjV&JEe^ z#q20jYPQ>R<$?vRQ4vcvbw+q9oOct>IU4m@w63XsLBi^#3nDlSIh)LqxYp|UDsYsA zRlcn{H$$@Q@tT_!8>-*WseX26=1ybfPe1>BE3nuz({Z!gx!G?%v`>5DpJF80-`85E zCwsm0`^y&s)~g~*S_Jx-QsO%`1X{MGXf<5>yeE~@Op5m*zsH6EjWhq5*qaY7mpAb{ z=^wDq&+gRMHB67ggm<=7?cLY8a``dOH`z%xa{g(XBgIc=CY|>>bAZ2Yrb}Z&cXq1! zn#LNDPKoZLWotaM&K%-;ZP~Uobcc$XP-p1z!e=5GnZ|?soj0C%zq!e{?UiazhH=Bx`-_bDH@tpRyg2jbm4)3^8tcBu)E|@nuV?he zZB#ZBaqcwgp3GH#az!7k0 zRZ*LF8HeNg2%TlW{?@%X%d=vk^7&@@C(W(K0ShJK`dvF>e>|T2r$NCbtf1ufj{MC6 zdk>%9ypW~hwBTg@m4`BlcgAq`Kizuh(6lv=F5fy=5x7kB!{=C$qVvy+n>6SD`D|0R j;0MdX+; literal 0 HcmV?d00001 diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 31c2e5214a..44a8289b0d 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -84,6 +84,27 @@ function html_debug_print($var, $file='', $oneline=false) } +/** + * Console log. + */ +function jslog($var) +{ + $more_info = ''; + if (is_string($var)) { + $more_info = 'size: '.strlen($var); + } else if (is_bool($var)) { + $more_info = 'val: '.($var ? 'true' : 'false'); + } else if (is_null($var)) { + $more_info = 'is null'; + } else if (is_array($var)) { + $more_info = count($var); + } + + echo ''."\n"; + echo ''; +} + + // Alias for "html_debug_print" function html_debug($var, $file='', $oneline=false) { diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 6a658997f6..ce17086f02 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -7084,3 +7084,21 @@ function ui_get_inventory_module_add_form( } +function ui_print_status_div($status) +{ + switch ((int) $status) { + case 0: + $return = '
 
'; + break; + + case 1: + $return = '
 
'; + break; + + default: + $return = '
 
'; + break; + } + + return $return; +} \ No newline at end of file diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index ece6ec2d6c..b5aa181e8b 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -37,6 +37,7 @@ require_once $config['homedir'].'/include/functions_groups.php'; require_once $config['homedir'].'/include/functions_modules.php'; require_once $config['homedir'].'/include/functions_users.php'; enterprise_include_once('include/functions_metaconsole.php'); +enterprise_include_once('include/functions_omnishell.php'); ui_require_javascript_file('openlayers.pandora'); ui_require_css_file('agent_view'); @@ -1485,6 +1486,17 @@ if ($policyTab == -1) { $policyTab = ''; } + +// Omnishell. +$tasks = count_tasks_agent($id_agente); + +if ($tasks === true) { + $omnishellTab = enterprise_hook('omnishell_tab'); + if ($omnishellTab == -1) { + $omnishellTab = ''; + } +} + // WUX Console. $modules_wux = enterprise_hook('get_wux_modules', [$id_agente]); if ($modules_wux) { @@ -1747,6 +1759,7 @@ $onheader = [ 'ncm_view' => ($ncm_tab ?? null), 'external_tools' => ($external_tools ?? null), 'incident' => ($incidenttab ?? null), + 'omnishell' => ($omnishellTab ?? null), ]; @@ -1871,6 +1884,10 @@ switch ($tab) { $tab_name = 'Policies'; break; + case 'omnishell': + $tab_name = 'Omnishell'; + break; + case 'ux_console_tab': $tab_name = 'UX Console'; break; @@ -2009,6 +2026,10 @@ switch ($tab) { enterprise_include('operation/agentes/policy_view.php'); break; + case 'omnishell': + enterprise_include('operation/agentes/omnishell_view.php'); + break; + case 'ux_console_tab': enterprise_include('operation/agentes/ux_console_view.php'); break; From 50e8b457f8d2ae1d0bece5a83937550f393ae8a3 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Thu, 9 Feb 2023 11:42:42 +0100 Subject: [PATCH 09/22] #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 10/22] 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 11/22] 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 12/22] #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 dfa63378ffab0db2fa4991895df3ac1d3f0228ef Mon Sep 17 00:00:00 2001 From: Calvo Date: Thu, 23 Feb 2023 11:19:17 +0100 Subject: [PATCH 13/22] Unified event timestamp and utimestamp --- pandora_console/include/functions_events.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index ca35739891..5f2e66bcae 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -2412,14 +2412,17 @@ function events_create_event( $source = get_product_name(); } + // Get Timestamp. + $timestamp = time(); + $values = [ 'id_agente' => $id_agent, 'id_usuario' => $id_user, 'id_grupo' => $id_group, 'estado' => $status, - 'timestamp' => date('Y-m-d H:i:s'), + 'timestamp' => date('Y-m-d H:i:s', $timestamp), 'evento' => $event, - 'utimestamp' => time(), + 'utimestamp' => $timestamp, 'event_type' => $event_type, 'id_agentmodule' => $id_agent_module, 'id_alert_am' => $id_aam, 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 14/22] 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 15/22] 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 16/22] 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 17/22] 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 6b23a0c6962e7e501da748c55d0806fe504d2fd7 Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 1 Mar 2023 01:00:24 +0100 Subject: [PATCH 18/22] 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 5a22f8ecae..f60763b69b 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-230228 +Version: 7.0NG.769-230301 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 ac85303303..4f52b3aa35 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-230228" +pandora_version="7.0NG.769-230301" 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 a994aabc8b..4fa07035d2 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 => '230228'; +use constant AGENT_BUILD => '230301'; # 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 1e35d4443c..f8ab9c7e41 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 230228 +%define release 230301 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 3519ff8837..6a16d883fd 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 230228 +%define release 230301 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 ec3075858c..46e66a8170 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="230228" +PI_BUILD="230301" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 2f2c4f1324..79687a6d2e 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230228} +{230301} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 9d41d77811..8264d0e9c8 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 230228") +#define PANDORA_VERSION ("7.0NG.769 Build 230301") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index ab42fb366e..ece56bd837 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 230228))" + VALUE "ProductVersion", "(7.0NG.769(Build 230301))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 12ed651bf5..c9f3c45a17 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.769-230228 +Version: 7.0NG.769-230301 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 32b28e5e53..90ab3e8133 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-230228" +pandora_version="7.0NG.769-230301" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index a853e7eef5..e197b66be2 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 = 'PC230228'; +$build_version = 'PC230301'; $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 2a7bde9bb0..e76fce4a52 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 8fbf6b3a47..8b319376d8 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 230228 +%define release 230301 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 2e8dbd979d..931745b212 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 230228 +%define release 230301 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index b4b9a39a65..f4c905a120 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230228" +PI_BUILD="230301" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 95573a89de..cad9bf5993 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 230228"; +my $version = "7.0NG.769 Build 230301"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index ea984d2726..5fbf54b2e5 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 230228"; +my $version = "7.0NG.769 Build 230301"; # save program name for logging my $progname = basename($0); From 36cfcc3c2f7fa6660d42b178f8d920f1900da833 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Wed, 1 Mar 2023 14:19:35 +0100 Subject: [PATCH 19/22] error fix --- pandora_console/operation/agentes/estado_generalagente.php | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index a0bd1bca8f..dca542b800 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -644,6 +644,7 @@ $last_incident = db_get_row_sql( ); if ($last_incident != false) { + $table_incident = new stdClass(); $table_incident->id = 'agent_incident_main'; $table_incident->width = '100%'; $table_incident->cellspacing = 0; From f1bb7b450e3e607b960706d985721ad3b53969a6 Mon Sep 17 00:00:00 2001 From: artica Date: Thu, 2 Mar 2023 01:00:46 +0100 Subject: [PATCH 20/22] 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 2f4543a0234ae05ef17b283270c4c5d4c2596d16 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 2 Mar 2023 08:20:43 +0100 Subject: [PATCH 21/22] #9517 Change MR sql --- pandora_console/extras/mr/62.sql | 2 ++ pandora_console/extras/mr/63.sql | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) delete mode 100644 pandora_console/extras/mr/63.sql diff --git a/pandora_console/extras/mr/62.sql b/pandora_console/extras/mr/62.sql index b5358f6254..b04dd12c25 100644 --- a/pandora_console/extras/mr/62.sql +++ b/pandora_console/extras/mr/62.sql @@ -4,4 +4,6 @@ START TRANSACTION; CREATE INDEX agente_modulo_estado ON tevento (estado, id_agentmodule); CREATE INDEX idx_disabled ON talert_template_modules (disabled); +INSERT INTO `treport_custom_sql` (`name`, `sql`) VALUES ('Agent safe mode not enable', 'select alias from tagente where safe_mode_module = 0'); + COMMIT; diff --git a/pandora_console/extras/mr/63.sql b/pandora_console/extras/mr/63.sql deleted file mode 100644 index 401d4a748c..0000000000 --- a/pandora_console/extras/mr/63.sql +++ /dev/null @@ -1,5 +0,0 @@ -START TRANSACTION; - -INSERT INTO `treport_custom_sql` (`name`, `sql`) VALUES ('Agent safe mode not enable', 'select alias from tagente where safe_mode_module = 0'); - -COMMIT; From 590ddc827c4b5749b4c7d2eccb31d434a1c739a0 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 2 Mar 2023 08:29:06 +0100 Subject: [PATCH 22/22] #9819 Change MR and add pandoradb.sql create table teventsound --- pandora_console/extras/mr/62.sql | 7 +++++++ pandora_console/extras/mr/65.sql | 10 ---------- pandora_console/pandoradb.sql | 10 ++++++++++ 3 files changed, 17 insertions(+), 10 deletions(-) delete mode 100644 pandora_console/extras/mr/65.sql diff --git a/pandora_console/extras/mr/62.sql b/pandora_console/extras/mr/62.sql index b5358f6254..a265c1a62d 100644 --- a/pandora_console/extras/mr/62.sql +++ b/pandora_console/extras/mr/62.sql @@ -1,6 +1,13 @@ -- Active: 1653046769261@@172.16.0.2@3306@pandora START TRANSACTION; +CREATE TABLE `tevent_sound` ( + `id` INT NOT NULL AUTO_INCREMENT, + `name` TEXT NULL, + `sound` TEXT NULL, + `active` TINYINT NOT NULL DEFAULT '1', +PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8; + CREATE INDEX agente_modulo_estado ON tevento (estado, id_agentmodule); CREATE INDEX idx_disabled ON talert_template_modules (disabled); diff --git a/pandora_console/extras/mr/65.sql b/pandora_console/extras/mr/65.sql deleted file mode 100644 index 7e65e62c2f..0000000000 --- a/pandora_console/extras/mr/65.sql +++ /dev/null @@ -1,10 +0,0 @@ -START TRANSACTION; - -CREATE TABLE `tevent_sound` ( - `id` INT NOT NULL AUTO_INCREMENT, - `name` TEXT NULL, - `sound` TEXT NULL, - `active` TINYINT NOT NULL DEFAULT '1', -PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -COMMIT; diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 530a0049ac..3da24db710 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -4179,3 +4179,13 @@ CREATE TABLE IF NOT EXISTS `tmonitor_filter` ( `ag_custom_fields` TEXT, PRIMARY KEY (`id_filter`) ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; + +-- --------------------------------------------------------------------- +-- Table `tevent_sound` +-- --------------------------------------------------------------------- +CREATE TABLE `tevent_sound` ( + `id` INT NOT NULL AUTO_INCREMENT, + `name` TEXT NULL, + `sound` TEXT NULL, + `active` TINYINT NOT NULL DEFAULT '1', +PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8; \ No newline at end of file