Merge branch 'develop' into 'ent-10008-Gestion-de-busquedas-en-la-vista-de-agentes-y-mejora-de-las-busquedas'

# Conflicts:
#   pandora_console/extras/mr/62.sql
#   pandora_console/pandoradb.sql
This commit is contained in:
Alejandro Campos 2023-03-02 16:53:42 +00:00
commit f297f6fff9
49 changed files with 1589 additions and 64 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.769-230228 Version: 7.0NG.769-230302
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.769-230228" pandora_version="7.0NG.769-230302"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1023,7 +1023,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.769'; use constant AGENT_VERSION => '7.0NG.769';
use constant AGENT_BUILD => '230228'; use constant AGENT_BUILD => '230302';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230228 %define release 230302
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230228 %define release 230302
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.769" PI_VERSION="7.0NG.769"
PI_BUILD="230228" PI_BUILD="230302"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{230228} {230302}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.769 Build 230228") #define PANDORA_VERSION ("7.0NG.769 Build 230302")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.769(Build 230228))" VALUE "ProductVersion", "(7.0NG.769(Build 230302))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.769-230228 Version: 7.0NG.769-230302
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.769-230228" pandora_version="7.0NG.769-230302"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -15,7 +15,16 @@ CREATE TABLE IF NOT EXISTS `tagent_filter` (
PRIMARY KEY (`id_filter`) PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
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 agente_modulo_estado ON tevento (estado, id_agentmodule);
CREATE INDEX idx_disabled ON talert_template_modules (disabled); 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; COMMIT;

View File

@ -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;

View File

@ -0,0 +1,71 @@
<?php
/**
* Audit log View.
*
* @category Audit log
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config;
require_once $config['homedir'].'/include/class/EventSound.class.php';
$ajaxPage = 'godmode/events/configuration_sounds';
// Control call flow.
try {
// User access and validation is being processed on class constructor.
$controller = new EventSound($ajaxPage);
} catch (Exception $e) {
if ((bool) is_ajax() === true) {
echo json_encode(['error' => '[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();
}

View File

@ -435,6 +435,10 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($
} }
} }
$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; $menu_godmode['gextensions']['sub'] = $sub;
} }

View File

@ -281,7 +281,7 @@ switch ($action) {
$server_name = $item['server_name']; $server_name = $item['server_name'];
// Metaconsole db connection. // Metaconsole db connection.
if ($meta && empty($server_name) === false) { if ($meta && empty($server_name) === false && $server_name !== 'all') {
$connection = metaconsole_get_connection($server_name); $connection = metaconsole_get_connection($server_name);
$server_id = $connection['id']; $server_id = $connection['id'];
if (metaconsole_load_external_db($connection) != NOERR) { if (metaconsole_load_external_db($connection) != NOERR) {
@ -1233,6 +1233,29 @@ $class = 'databox filters';
} }
?> ?>
<?php
$servers_all_opt = array_merge(['all' => 'All nodes'], $servers);
if ($meta) {
?>
<tr id="row_servers_all_opt" class="datos">
<td class="bolder"><?php echo __('Server'); ?></td>
<td >
<?php
html_print_select(
$servers_all_opt,
'combo_server',
$server_name,
'',
$nothing,
$nothing_value
);
?>
</td>
</tr>
<?php
}
?>
<?php <?php
if ($meta) { if ($meta) {
?> ?>
@ -6334,6 +6357,7 @@ function chooseType() {
$("#row_alert_templates").hide(); $("#row_alert_templates").hide();
$("#row_alert_actions").hide(); $("#row_alert_actions").hide();
$("#row_servers").hide(); $("#row_servers").hide();
$("#row_servers_all_opt").hide();
$("#row_multiple_servers").hide(); $("#row_multiple_servers").hide();
$("#row_sort").hide(); $("#row_sort").hide();
$("#row_date").hide(); $("#row_date").hide();
@ -6648,7 +6672,7 @@ function chooseType() {
$("#row_header").show(); $("#row_header").show();
$("#row_custom").show(); $("#row_custom").show();
$("#row_custom_example").show(); $("#row_custom_example").show();
$("#row_servers").show(); $("#row_servers_all_opt").show();
$("#row_historical_db_check").show(); $("#row_historical_db_check").show();
break; break;

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -2352,6 +2352,11 @@ if ($drawConsoleSound === true) {
'Star_Trek_emergency_simulation.wav' => 'StarTrek emergency simulation', '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[] = [ $inputs[] = [
'class' => 'test-sounds', 'class' => 'test-sounds',
'direct' => 1, 'direct' => 1,

View File

@ -0,0 +1,495 @@
<?php
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
/**
* Controller for Audit Logs
*
* @category Controller
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config;
// Necessary classes for extends.
require_once $config['homedir'].'/include/class/HTML.class.php';
enterprise_include_once('godmode/admin_access_logs.php');
/**
* Class EventSound
*/
class EventSound extends HTML
{
/**
* Allowed methods to be called using AJAX request.
*
* @var array
*/
public $AJAXMethods = ['draw'];
/**
* Ajax page.
*
* @var string
*/
private $ajaxController;
/**
* Table id.
*
* @var mixed
*/
private $tableId;
/**
* Class constructor
*
* @param string $ajaxController Ajax controller.
*/
public function __construct(string $ajaxController)
{
global $config;
check_login();
if (check_acl($config['id_user'], 0, 'PM') === false
&& is_user_admin($config['id_user']) === true
) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Event Sound'
);
include 'general/noaccess.php';
return;
}
// Set the ajax controller.
$this->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' => '<a href="'.$base_url.'">'.html_print_image(
'images/eye_show.png',
true,
[
'title' => __('Sounds'),
'class' => 'invert_filter',
]
).'</a>',
'active' => (bool) ($tab != 'add'),
],
'options' => [
'text' => '<a href="'.$setup_url.'">'.html_print_image(
'images/pen.png',
true,
[
'title' => __('Create'),
'class' => 'invert_filter',
]
).'</a>',
'active' => (bool) ($tab == 'add'),
],
];
if ($tab === 'add') {
$helpHeader = '';
$titleHeader = __('Add new sound');
} else {
$helpHeader = 'servers_ha_clusters_tab';
$titleHeader = __('Accoustic console sound list');
}
// Header.
ui_print_standard_header(
$titleHeader,
'images/gm_servers.png',
false,
$helpHeader,
false,
$tabs,
[
[
'link' => '',
'label' => __('Admin tools'),
],
[
'link' => '',
'label' => __('Accoustic console setup'),
],
]
);
// Javascript.
ui_require_jquery_file('pandora');
// CSS.
ui_require_css_file('wizard');
ui_require_css_file('discovery');
if ($tab === 'add') {
echo '<form method="post" enctype="multipart/form-data" action="index.php?sec=eventos&sec2=godmode/events/configuration_sounds&tab=add&action=create">';
$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 '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button(
__('Create'),
'save_sound',
false,
'class="sub wand"'
);
echo '</div>';
echo '</form>';
// 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 = '<a href="index.php?sec=eventos&sec2=godmode/events/configuration_sounds';
$options .= '&action=change_action&id='.$row['id'].'&set_action='.$new_action.'">';
$options .= html_print_image(
$img,
true,
[
'title' => $action,
'class' => 'invert_filter',
]
);
$options .= '</a>';
$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.
?>
<script type="text/javascript">
$(document).ready(function() {
$('#file-sound').change(function(){
var ext = $('#file-sound').val().split('.').pop().toLowerCase();
if($.inArray(ext, ['wav']) == -1) {
alert('<?php __('invalid extension'); ?>');
$('#file-sound').val('');
}
});
$('#submit-save_sound').click(function(){
console.log("a");
});
});
</script>
<?php
// EOF Javascript content.
return ob_get_clean();
}
}

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC230228'; $build_version = 'PC230302';
$pandora_version = 'v7.0NG.769'; $pandora_version = 'v7.0NG.769';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -6399,11 +6399,34 @@ function getBearerToken()
} }
/**
* Check whether an instance of pandora_db is running.
*
* @return boolean Result.
*/
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("'.$db_name.'_pandora_db") AS "value"',
'affected_rows',
'',
false
);
$is_free_lock = (bool) $is_free_lock[0]['value'];
return !$is_free_lock;
}
/** /**
* Check nms license on api. * Check nms license on api.
* *
* @return boolean * @return boolean.
*/ * */
function nms_check_api() function nms_check_api()
{ {
global $config; global $config;

View File

@ -2412,14 +2412,17 @@ function events_create_event(
$source = get_product_name(); $source = get_product_name();
} }
// Get Timestamp.
$timestamp = time();
$values = [ $values = [
'id_agente' => $id_agent, 'id_agente' => $id_agent,
'id_usuario' => $id_user, 'id_usuario' => $id_user,
'id_grupo' => $id_group, 'id_grupo' => $id_group,
'estado' => $status, 'estado' => $status,
'timestamp' => date('Y-m-d H:i:s'), 'timestamp' => date('Y-m-d H:i:s', $timestamp),
'evento' => $event, 'evento' => $event,
'utimestamp' => time(), 'utimestamp' => $timestamp,
'event_type' => $event_type, 'event_type' => $event_type,
'id_agentmodule' => $id_agent_module, 'id_agentmodule' => $id_agent_module,
'id_alert_am' => $id_aam, 'id_alert_am' => $id_aam,
@ -5826,3 +5829,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);
}

View File

@ -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 '<script>console.log("'.date('Y/m/d H:i:s').' ('.gettype($var).') '.$more_info.'");</script>'."\n";
echo '<script>console.log('.json_encode($var).');</script>';
}
// Alias for "html_debug_print" // Alias for "html_debug_print"
function html_debug($var, $file='', $oneline=false) function html_debug($var, $file='', $oneline=false)
{ {

View File

@ -68,6 +68,7 @@ define('REPORT_STATUS_IGNORED', 5);
// Clases. // Clases.
use PandoraFMS\Enterprise\Metaconsole\Node; use PandoraFMS\Enterprise\Metaconsole\Node;
use PandoraFMS\Enterprise\Metaconsole\Synchronizer;
use PandoraFMS\Event; use PandoraFMS\Event;
use PandoraFMS\Module; 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) function reporting_sql($report, $content)
{ {
global $config; global $config;
@ -7438,15 +7447,97 @@ function reporting_sql($report, $content)
$return['description'] = $content['description']; $return['description'] = $content['description'];
$return['date'] = reporting_get_date_text(); $return['date'] = reporting_get_date_text();
if ($config['metaconsole'] && !empty($content['server_name'])) { if (is_metaconsole() === true
$id_meta = metaconsole_get_id_server( && empty($content['server_name']) === false
&& $content['server_name'] !== 'all'
) {
$id_server = metaconsole_get_id_server(
$content['server_name'] $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) { if ($content['treport_custom_sql_id'] != 0) {
$sql = io_safe_output( $sql = io_safe_output(
db_get_value_filter( db_get_value_filter(
@ -7459,7 +7550,7 @@ function reporting_sql($report, $content)
$sql = $content['external_source']; $sql = $content['external_source'];
} }
// Check if exist sql macro. // Check if SQL macro exists.
$sql = reporting_sql_macro($report, $sql); $sql = reporting_sql_macro($report, $sql);
// Do a security check on SQL coming from the user. // 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.'); $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'])) { return $return;
metaconsole_restore_db();
}
return reporting_check_structure_content($return);
} }

View File

@ -7084,3 +7084,21 @@ function ui_get_inventory_module_add_form(
} }
function ui_print_status_div($status)
{
switch ((int) $status) {
case 0:
$return = '<div class="status_rounded_rectangles forced_title" style="display: inline-block; background: #82b92e;" title="OK" data-title="OK" data-use_title_for_force_title="1">&nbsp;</div>';
break;
case 1:
$return = '<div class="status_rounded_rectangles forced_title" style="display: inline-block; background: #e63c52;" title="FAILED" data-title="FAILED" data-use_title_for_force_title="1">&nbsp;</div>';
break;
default:
$return = '<div class="status_rounded_rectangles forced_title" style="display: inline-block; background: #fff;" title="UNDEFINED" data-title="UNDEFINED" data-use_title_for_force_title="1">&nbsp;</div>';
break;
}
return $return;
}

View File

@ -420,6 +420,7 @@ class Widget
case 'ColorModuleTabs': case 'ColorModuleTabs':
case 'BlockHistogram': case 'BlockHistogram':
case 'DataMatrix': case 'DataMatrix':
case 'EventCardboard':
$className .= '\\'.$name; $className .= '\\'.$name;
break; break;

View File

@ -0,0 +1,664 @@
<?php
/**
* Widget Event cardboard Pandora FMS Console
*
* @category Console Class
* @package Pandora FMS
* @subpackage Widget Event cardboard
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
namespace PandoraFMS\Dashboard;
use PandoraFMS\Enterprise\Metaconsole\Node;
/**
* Event cardboard Widgets.
*/
class EventCardboard extends Widget
{
/**
* Name widget.
*
* @var string
*/
protected $name;
/**
* Title widget.
*
* @var string
*/
protected $title;
/**
* Page widget;
*
* @var string
*/
protected $page;
/**
* Class name widget.
*
* @var [type]
*/
protected $className;
/**
* Values options for each widget.
*
* @var [type]
*/
protected $values;
/**
* Configuration required.
*
* @var boolean
*/
protected $configurationRequired;
/**
* Error load widget.
*
* @var boolean
*/
protected $loadError;
/**
* Width.
*
* @var integer
*/
protected $width;
/**
* Heigth.
*
* @var integer
*/
protected $height;
/**
* Grid Width.
*
* @var integer
*/
protected $gridWidth;
/**
* Cell ID.
*
* @var integer
*/
protected $cellId;
/**
* Construct.
*
* @param integer $cellId Cell ID.
* @param integer $dashboardId Dashboard ID.
* @param integer $widgetId Widget ID.
* @param integer|null $width New width.
* @param integer|null $height New height.
* @param integer|null $gridWidth Grid width.
*/
public function __construct(
int $cellId,
int $dashboardId=0,
int $widgetId=0,
?int $width=0,
?int $height=0,
?int $gridWidth=0
) {
global $config;
include_once $config['homedir'].'/include/functions_agents.php';
include_once $config['homedir'].'/include/functions_modules.php';
// WARNING: Do not edit. This chunk must be in the constructor.
parent::__construct(
$cellId,
$dashboardId,
$widgetId
);
// Width.
$this->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 .= '<table class="w100p h100p table-border-0"><tbody><tr>';
$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 .= '<td class="'.$color.'" style="width: '.$width_td.'%;'.$border.'"><span class="med_data">';
$output .= $count;
$output .= '</span><br>';
$output .= $text;
$output .= '</td>';
}
$output .= '</tr></tbody></table>';
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;
}
}

View File

@ -29,3 +29,18 @@ li#select_multiple_modules_filtered {
#menu_tab li.nomn form#form-select-dashboard { #menu_tab li.nomn form#form-select-dashboard {
margin-top: 0px !important; 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;
}

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'> <div style='padding-bottom: 50px'>
<?php <?php
$version = '7.0NG.769'; $version = '7.0NG.769';
$build = '230228'; $build = '230302';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -644,6 +644,7 @@ $last_incident = db_get_row_sql(
); );
if ($last_incident != false) { if ($last_incident != false) {
$table_incident = new stdClass();
$table_incident->id = 'agent_incident_main'; $table_incident->id = 'agent_incident_main';
$table_incident->width = '100%'; $table_incident->width = '100%';
$table_incident->cellspacing = 0; $table_incident->cellspacing = 0;

View File

@ -2012,7 +2012,7 @@ if (!empty($result)) {
} else { } else {
$sub_string = substr(io_safe_output($row['datos']), 0, 12); $sub_string = substr(io_safe_output($row['datos']), 0, 12);
if ($module_value == $sub_string) { if ($module_value == $sub_string) {
if ($module_value == 0 && !$sub_string) { if ((empty($module_value) === true || $module_value == 0) && !$sub_string) {
$salida = 0; $salida = 0;
} else { } else {
$data_macro = modules_get_unit_macro($row['datos'], $row['unit']); $data_macro = modules_get_unit_macro($row['datos'], $row['unit']);

View File

@ -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_modules.php';
require_once $config['homedir'].'/include/functions_users.php'; require_once $config['homedir'].'/include/functions_users.php';
enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_metaconsole.php');
enterprise_include_once('include/functions_omnishell.php');
ui_require_javascript_file('openlayers.pandora'); ui_require_javascript_file('openlayers.pandora');
ui_require_css_file('agent_view'); ui_require_css_file('agent_view');
@ -1487,6 +1488,17 @@ if ($policyTab == -1) {
$policyTab = ''; $policyTab = '';
} }
// Omnishell.
$tasks = count_tasks_agent($id_agente);
if ($tasks === true) {
$omnishellTab = enterprise_hook('omnishell_tab');
if ($omnishellTab == -1) {
$omnishellTab = '';
}
}
// WUX Console. // WUX Console.
$modules_wux = enterprise_hook('get_wux_modules', [$id_agente]); $modules_wux = enterprise_hook('get_wux_modules', [$id_agente]);
if ($modules_wux) { if ($modules_wux) {
@ -1749,6 +1761,7 @@ $onheader = [
'ncm_view' => ($ncm_tab ?? null), 'ncm_view' => ($ncm_tab ?? null),
'external_tools' => ($external_tools ?? null), 'external_tools' => ($external_tools ?? null),
'incident' => ($incidenttab ?? null), 'incident' => ($incidenttab ?? null),
'omnishell' => ($omnishellTab ?? null),
]; ];
@ -1873,6 +1886,10 @@ switch ($tab) {
$tab_name = 'Policies'; $tab_name = 'Policies';
break; break;
case 'omnishell':
$tab_name = 'Omnishell';
break;
case 'ux_console_tab': case 'ux_console_tab':
$tab_name = 'UX Console'; $tab_name = 'UX Console';
break; break;
@ -2011,6 +2028,10 @@ switch ($tab) {
enterprise_include('operation/agentes/policy_view.php'); enterprise_include('operation/agentes/policy_view.php');
break; break;
case 'omnishell':
enterprise_include('operation/agentes/omnishell_view.php');
break;
case 'ux_console_tab': case 'ux_console_tab':
enterprise_include('operation/agentes/ux_console_view.php'); enterprise_include('operation/agentes/ux_console_view.php');
break; break;

View File

@ -357,7 +357,7 @@ if (is_ajax() === true) {
'te.warning_instructions', 'te.warning_instructions',
'te.unknown_instructions', 'te.unknown_instructions',
'te.owner_user', '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.custom_data',
'te.data', 'te.data',
'te.module_status', 'te.module_status',
@ -387,7 +387,7 @@ if (is_ajax() === true) {
$order['field'] = 'agent_name'; $order['field'] = 'agent_name';
break; 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'; $order['field'] = 'ack_utimestamp';
break; break;
@ -528,14 +528,14 @@ if (is_ajax() === true) {
$tmp->agent_name = io_safe_output($tmp->agent_name); $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( $tmp->ack_utimestamp = ui_print_timestamp(
(empty($tmp->ack_utimestamp) === true) ? 0 : $tmp->ack_utimestamp, (empty($tmp->ack_utimestamp) === true) ? 0 : $tmp->ack_utimestamp,
true true
); );
$tmp->timestamp = ui_print_timestamp( $tmp->timestamp = ui_print_timestamp(
$tmp->timestamp, $tmp->utimestamp,
true true
); );
@ -1480,7 +1480,7 @@ if ($pure) {
] ]
).'</a>'; ).'</a>';
// Sound events. // Accoustic console.
$sound_event['active'] = false; $sound_event['active'] = false;
// Sound Events. // Sound Events.
@ -1503,7 +1503,7 @@ if ($pure) {
'images/sound.png', 'images/sound.png',
true, true,
[ [
'title' => __('Sound events'), 'title' => __('Accoustic console'),
'class' => 'invert_filter', 'class' => 'invert_filter',
] ]
).'</a>'; ).'</a>';
@ -1553,7 +1553,7 @@ if ($pure) {
switch ($section) { switch ($section) {
case 'sound_event': case 'sound_event':
$onheader['sound_event']['active'] = true; $onheader['sound_event']['active'] = true;
$section_string = __('Sound events'); $section_string = __('Accoustic console');
break; break;
case 'history': case 'history':

View File

@ -60,7 +60,7 @@ ob_start();
echo '<html>'; echo '<html>';
echo '<head>'; echo '<head>';
echo '<title>'.__('Sound Events').'</title>'; echo '<title>'.__('Accoustic console').'</title>';
ui_require_css_file('wizard'); ui_require_css_file('wizard');
ui_require_css_file('discovery'); ui_require_css_file('discovery');
?> ?>
@ -161,7 +161,7 @@ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
echo '</head>'; echo '</head>';
echo "<body class='sound_events'>"; echo "<body class='sound_events'>";
echo "<h1 class='modalheaderh1'>".__('Sound console').'</h1>'; echo "<h1 class='modalheaderh1'>".__('Accoustic console').'</h1>';
// Connection lost alert. // Connection lost alert.
ui_require_css_file('register', 'include/styles/', true); ui_require_css_file('register', 'include/styles/', true);
@ -252,6 +252,11 @@ $sounds = [
'Star_Trek_emergency_simulation.wav' => 'StarTrek emergency simulation', 'Star_Trek_emergency_simulation.wav' => '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[] = [ $inputs[] = [
'label' => \__('Sounds'), 'label' => \__('Sounds'),
'class' => 'flex-row', 'class' => 'flex-row',

View File

@ -432,11 +432,11 @@ if ($access_console_node === true) {
$sub['operation/events/events_rss.php?user='.$config['id_user'].'&amp;hashup='.$hashup.'&fb64='.$fb64]['type'] = 'direct'; $sub['operation/events/events_rss.php?user='.$config['id_user'].'&amp;hashup='.$hashup.'&fb64='.$fb64]['type'] = 'direct';
} }
// Sound Events. // Accoustic console.
$data_sound = base64_encode( $data_sound = base64_encode(
json_encode( json_encode(
[ [
'title' => __('Sound Console'), 'title' => __('Accoustic console'),
'start' => __('Start'), 'start' => __('Start'),
'stop' => __('Stop'), 'stop' => __('Stop'),
'noAlert' => __('No alert'), 'noAlert' => __('No alert'),
@ -449,8 +449,8 @@ if ($access_console_node === true) {
); );
$javascript = 'javascript: openSoundEventModal(`'.$data_sound.'`);'; $javascript = 'javascript: openSoundEventModal(`'.$data_sound.'`);';
$sub[$javascript]['text'] = __('Sound Events'); $sub[$javascript]['text'] = __('Accoustic console');
$sub[$javascript]['id'] = 'Sound Events Modal'; $sub[$javascript]['id'] = 'Accoustic console Modal';
$sub[$javascript]['type'] = 'direct'; $sub[$javascript]['type'] = 'direct';
echo '<div id="modal-sound" style="display:none;"></div>'; echo '<div id="modal-sound" style="display:none;"></div>';
@ -603,7 +603,6 @@ if ($access_console_node === true) {
} }
} }
if (!empty($sub)) { if (!empty($sub)) {
$menu_operation['extensions']['text'] = __('Tools'); $menu_operation['extensions']['text'] = __('Tools');
$menu_operation['extensions']['sec2'] = 'operation/extensions'; $menu_operation['extensions']['sec2'] = 'operation/extensions';

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230228 %define release 230302
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230228 %define release 230302
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230228 %define release 230302
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -4197,3 +4197,12 @@ CREATE TABLE IF NOT EXISTS `tagent_filter` (
`ag_custom_fields` TEXT, `ag_custom_fields` TEXT,
PRIMARY KEY (`id_filter`) PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; ) 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;

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.769-230228 Version: 7.0NG.769-230302
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.769-230228" pandora_version="7.0NG.769-230302"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.769"; my $pandora_version = "7.0NG.769";
my $pandora_build = "230228"; my $pandora_build = "230302";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.769"; my $pandora_version = "7.0NG.769";
my $pandora_build = "230228"; my $pandora_build = "230302";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );
@ -118,12 +118,12 @@ sub check_lib_version {
$plugin_version = "0NG.0" if empty($plugin_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); $main = 0 if empty($main) || !looks_like_number($main);
$oum = 0 if empty($oum) || !looks_like_number($oum); $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) if (($liboum < $oum)
|| ($libmain != $main)) { || ($libmain != $main)) {

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230228 %define release 230302
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230228 %define release 230302
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.769" PI_VERSION="7.0NG.769"
PI_BUILD="230228" PI_BUILD="230302"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.769 Build 230228"; my $version = "7.0NG.769 Build 230302";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.769 Build 230228"; my $version = "7.0NG.769 Build 230302";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);