Merge remote-tracking branch 'origin/develop' into ent-12293-16468-borrado-de-agentes-deshabilitados-mediante-el-pandora_db

This commit is contained in:
daniel 2023-12-01 10:33:21 +01:00
commit 95fb500fb5
82 changed files with 1198 additions and 299 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.774-231129 Version: 7.0NG.774-231201
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.774-231129" pandora_version="7.0NG.774-231201"
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

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.774'; use constant AGENT_VERSION => '7.0NG.774';
use constant AGENT_BUILD => '231129'; use constant AGENT_BUILD => '231201';
# 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.774 %define version 7.0NG.774
%define release 231129 %define release 231201
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231129 %define release 231201
%define debug_package %{nil} %define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231129 %define release 231201
%define debug_package %{nil} %define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231129 %define release 231201
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary 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.774 %define version 7.0NG.774
%define release 231129 %define release 231201
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.774" PI_VERSION="7.0NG.774"
PI_BUILD="231129" PI_BUILD="231201"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{231129} {231201}
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.774 Build 231129") #define PANDORA_VERSION ("7.0NG.774 Build 231201")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS" VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.774(Build 231129))" VALUE "ProductVersion", "(7.0NG.774(Build 231201))"
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.774-231129 Version: 7.0NG.774-231201
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.774-231129" pandora_version="7.0NG.774-231201"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -1,10 +1,25 @@
START TRANSACTION; START TRANSACTION;
ALTER TABLE `tevento`
ADD COLUMN `event_custom_id` TEXT NULL AFTER `module_status`;
-- Telegram and vonage default alerts
UPDATE talert_actions
SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_'
WHERE id=9;
UPDATE talert_actions
SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_'
WHERE id=11;
-- Delete table tagent_access -- Delete table tagent_access
DROP TABLE tagent_access; DROP TABLE tagent_access;
ALTER TABLE `tevent_rule` DROP COLUMN `user_comment`;
ALTER TABLE `tevent_rule` DROP COLUMN `operator_user_comment`;
ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL; ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL;
ALTER TABLE `tevent_filter`
ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`;
-- Update macros for plugin oracle -- Update macros for plugin oracle
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle'; UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle';
@ -17,5 +32,19 @@ INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT id_rt, '_clientPath_', 'custom', '', 0 FROM `trecon_task` WHERE `id_app` = @id_app; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT id_rt, '_clientPath_', 'custom', '', 0 FROM `trecon_task` WHERE `id_app` = @id_app;
UPDATE `trecon_task` SET `setup_complete` = 1 WHERE `id_app` = @id_app; UPDATE `trecon_task` SET `setup_complete` = 1 WHERE `id_app` = @id_app;
-- Update lts updates
UPDATE tconfig SET value='1' WHERE token='lts_updates';
ALTER TABLE `tdashboard`
ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`,
ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`,
ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`;
SELECT @generic_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_data";
SELECT @generic_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_proc";
SELECT @async_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_data";
SELECT @async_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_proc";
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_data WHERE `tagente_modulo`.`id_tipo_modulo` = @async_data;
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_proc WHERE `tagente_modulo`.`id_tipo_modulo` = @async_proc;
COMMIT; COMMIT;

View File

@ -38,6 +38,7 @@ $isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
require_once $config['homedir'].'/include/functions_modules.php'; require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_servers.php'; require_once $config['homedir'].'/include/functions_servers.php';
require_once $config['homedir'].'/include/functions_macros.php';
$search_string = get_parameter('search_string'); $search_string = get_parameter('search_string');
@ -949,8 +950,24 @@ if ($modules !== false) {
); );
if (strlen($module['ip_target']) !== 0) { if (strlen($module['ip_target']) !== 0) {
// Check if value is custom field.
if ($module['ip_target'][0] == '_' && $module['ip_target'][(strlen($module['ip_target']) - 1)] == '_') {
$custom_field_name = substr($module['ip_target'], 1, -1);
$custom_value = agents_get_agent_custom_field($id_agente, $custom_field_name);
if (isset($custom_value) && $custom_value !== false) {
$title .= '<br/>IP: '.$custom_value;
} else {
$array_macros = return_agent_macros($id_agente);
if (isset($array_macros[$module['ip_target']])) {
$title .= '<br/>IP: '.$array_macros[$module['ip_target']];
} else {
$title .= '<br/>IP: '.$module['ip_target']; $title .= '<br/>IP: '.$module['ip_target'];
} }
}
} else {
$title .= '<br/>IP: '.$module['ip_target'];
}
}
// This module is initialized ? (has real data). // This module is initialized ? (has real data).
if ($status === STATUS_MODULE_NO_DATA) { if ($status === STATUS_MODULE_NO_DATA) {

View File

@ -2003,23 +2003,14 @@ ui_require_jquery_file('json');
var type_names = jQuery.parseJSON(Base64.decode($('#hidden-type_names').val())); var type_names = jQuery.parseJSON(Base64.decode($('#hidden-type_names').val()));
var type_name_selected = type_names[type_selected]; var type_name_selected = type_names[type_selected];
if ($('#radius-percentage_warning').prop('checked') === true || $('#radius-percentage_critical').prop('checked') === true || type_name_selected == 'generic_data_string') { if (($('#radius-percentage_warning').prop('checked') === true && $('#radius-percentage_critical').prop('checked') === true) || type_name_selected == 'generic_data_string') {
paint_graph_values();
$("#svg_dinamic").hide(); $("#svg_dinamic").hide();
} else { } else {
paint_graph_values(); paint_graph_values();
$("#svg_dinamic").show(); $("#svg_dinamic").show();
} }
if ($('#radius-percentage_warning').prop('checked') === true) {
$('#radius-warning_inverse').hide();
$('#label-radius-warning_inverse').hide();
}
if ($('#radius-warning_inverse').prop('checked') === true) {
$('#radius-percentage_warning').hide();
$('#label-radius-percentage_warning').hide();
}
if ($('#radius-normal_warning').prop('checked') === true) { if ($('#radius-normal_warning').prop('checked') === true) {
$('#radius-warning_inverse').show(); $('#radius-warning_inverse').show();
$('#label-radius-warning_inverse').show(); $('#label-radius-warning_inverse').show();
@ -2027,17 +2018,6 @@ ui_require_jquery_file('json');
$('#label-radius-percentage_warning').show(); $('#label-radius-percentage_warning').show();
} }
if ($('#radius-percentage_critical').prop('checked') === true) {
$('#radius-critical_inverse').hide();
$('#label-radius-critical_inverse').hide();
}
if ($('#radius-critical_inverse').prop('checked') === true) {
$('#radius-percentage_critical').hide();
$('#label-radius-percentage_critical').hide();
}
if ($('#radius-normal_critical').prop('checked') === true) { if ($('#radius-normal_critical').prop('checked') === true) {
$('#radius-critical_inverse').show(); $('#radius-critical_inverse').show();
$('#label-radius-critical_inverse').show(); $('#label-radius-critical_inverse').show();
@ -2354,30 +2334,48 @@ ui_require_jquery_file('json');
var message_error_percentage = '<?php echo __('Please introduce a positive percentage value'); ?>'; var message_error_percentage = '<?php echo __('Please introduce a positive percentage value'); ?>';
//if haven't error //if haven't error
if (max_w == 0 || max_w > min_w) { if (max_w == 0 || max_w > min_w || $('#radius-percentage_warning').is(':checked') === true) {
if (max_c == 0 || max_c > min_c) { if (max_c == 0 || max_c > min_c || $('#radius-percentage_critical').is(':checked') === true) {
error_c = 0;
error_w = 0;
} else {
error_c = 1;
min_w = 0;
max_w = 0;
min_c = 0;
max_c = 0;
inverse_w = 0;
inverse_c = 0;
}
} else {
if (max_c !== 0 && max_c < min_c && $('#radius-percentage_critical').is(':checked') === false) {
error_c = 2;
}
error_w = 1;
min_w = 0;
max_w = 0;
min_c = 0;
max_c = 0;
inverse_w = 0;
inverse_c = 0;
}
if ($('#radius-percentage_warning').is(':checked') === true){
min_w = 0;
max_w = 0;
}
if ($('#radius-percentage_critical').is(':checked') === true){
min_c = 0;
max_c = 0;
}
paint_graph_status( paint_graph_status(
min_w, max_w, min_c, max_c, inverse_w, min_w, max_w, min_c, max_c, inverse_w,
inverse_c, error_w, error_c, inverse_c, error_w, error_c,
legend_normal, legend_warning, legend_critical, legend_normal, legend_warning, legend_critical,
message_error_warning, message_error_critical message_error_warning, message_error_critical
); );
} else {
error_c = 1;
paint_graph_status(
0, 0, 0, 0, 0, 0, error_w, error_c,
legend_normal, legend_warning, legend_critical,
message_error_warning, message_error_critical
);
}
} else {
error_w = 1;
paint_graph_status(
0, 0, 0, 0, 0, 0, error_w, error_c,
legend_normal, legend_warning, legend_critical,
message_error_warning, message_error_critical
);
}
} }
/* ]]> */ /* ]]> */

View File

@ -256,7 +256,7 @@ $schedule = io_safe_output(
$data[0] = ''; $data[0] = '';
$data[0] .= html_print_input_hidden('schedule', $schedule, true); $data[0] .= html_print_input_hidden('schedule', $schedule, true);
$data[0] .= '<div id="calendar_map"></div>'; $data[0] .= '<div id="calendar_map" class="alert_view_calendar"></div>';
$data[1] = ''; $data[1] = '';
$table_conditions->data[] = $data; $table_conditions->data[] = $data;

View File

@ -115,6 +115,7 @@ $fields_available['module_status'] = __('Module Status');
$fields_available['mini_severity'] = __('Severity mini'); $fields_available['mini_severity'] = __('Severity mini');
$fields_available['module_custom_id'] = __('Module custom ID'); $fields_available['module_custom_id'] = __('Module custom ID');
$fields_available['custom_data'] = __('Custom data'); $fields_available['custom_data'] = __('Custom data');
$fields_available['event_custom_id'] = __('Event Custom ID');
// Remove fields already selected. // Remove fields already selected.

View File

@ -163,7 +163,10 @@ switch ($activeTab) {
$background_color = (string) get_parameter('background_color'); $background_color = (string) get_parameter('background_color');
$width = (int) get_parameter('width'); $width = (int) get_parameter('width');
$height = (int) get_parameter('height'); $height = (int) get_parameter('height');
$visualConsoleName = (string) io_safe_input(get_parameter('name')); $visualConsoleName = (string) get_parameter('name');
$visualConsoleName = str_replace('&lt;', '', $visualConsoleName);
$visualConsoleName = str_replace('&gt;', '', $visualConsoleName);
$visualConsoleName = (string) io_safe_input($visualConsoleName);
$is_favourite = (int) get_parameter('is_favourite_sent'); $is_favourite = (int) get_parameter('is_favourite_sent');
$auto_adjust = (int) get_parameter('auto_adjust_sent'); $auto_adjust = (int) get_parameter('auto_adjust_sent');

View File

@ -187,7 +187,8 @@ $button_test .= '&nbsp;<span id="ITSM-message" class="invisible"></span>';
$row['control'] = html_print_label_input_block( $row['control'] = html_print_label_input_block(
__('Test connection pandora to ITSM'), __('Test connection pandora to ITSM'),
$button_test $button_test,
['div_class' => 'ITSM-remote-setup-ITSM_token']
); );
$table_remote->data['ITSM_test'] = $row; $table_remote->data['ITSM_test'] = $row;

View File

@ -405,19 +405,6 @@ $table->data[$i++][] = html_print_label_input_block(
$table->data[$i][] = html_print_label_input_block( $table->data[$i][] = html_print_label_input_block(
__('Enable Sflow'),
html_print_checkbox_switch_extended(
'activate_sflow',
1,
$config['activate_sflow'],
$rbt_disabled,
'',
'',
true
),
);
$table->data[$i++][] = html_print_label_input_block(
__('General network path'), __('General network path'),
html_print_input_text( html_print_input_text(
'general_network_path', 'general_network_path',
@ -733,7 +720,7 @@ $table->data[$i++][] = html_print_label_input_block(
); );
$help_tip = ui_print_help_tip( $help_tip = ui_print_help_tip(
__('If there are any &#x22;In process&#x22; events with a specific Extra ID and a New event with that Extra ID is received, it will be created as &#x22;In process&#x22; instead.'), __('If there are any &#x22;In process&#x22; events with a specific Extra ID and a New event with that Extra ID is received, it will be created as &#x22;In process&#x22; instead. The new events also inherit Event Custom ID'),
true true
); );

View File

@ -83,6 +83,19 @@ $table->data[3][] = html_print_label_input_block(
html_print_checkbox_switch_extended('netflow_get_ip_hostname', 1, $config['netflow_get_ip_hostname'], false, $onclick, '', true) html_print_checkbox_switch_extended('netflow_get_ip_hostname', 1, $config['netflow_get_ip_hostname'], false, $onclick, '', true)
); );
$table->data[4][] = html_print_label_input_block(
__('Enable Sflow'),
html_print_checkbox_switch_extended(
'activate_sflow',
1,
$config['activate_sflow'],
$rbt_disabled,
'',
'',
true
),
);
echo '<form class="max_floating_element_size" id="netflow_setup" method="post">'; echo '<form class="max_floating_element_size" id="netflow_setup" method="post">';
html_print_table($table); html_print_table($table);
html_print_input_hidden('update_config', 1); html_print_input_hidden('update_config', 1);

View File

@ -61,7 +61,7 @@ $license = db_get_value(
); );
if (isset($config['lts_updates']) === false) { if (isset($config['lts_updates']) === false) {
$config['lts_updates'] = false; $config['lts_updates'] = true;
} }
if (empty($license) === true) { if (empty($license) === true) {

View File

@ -0,0 +1,111 @@
<?php
/**
* Modal LTS versions update manager.
*
* @category Update Manager
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* 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;
check_login();
// The ajax is in include/ajax/update_manager.php.
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php';
return;
}
require_once $config['homedir'].'/vendor/autoload.php';
$php_version = phpversion();
$php_version_array = explode('.', $php_version);
if ($php_version_array[0] < 7) {
include_once 'general/php_message.php';
}
?>
<!-- Lts Updates. -->
<div id="lts-updates" title="
<?php echo __('LTS versions'); ?>
" class="invisible">
<div style="display: flex; justify-content: space-between">
<div style="width: 250px; padding: 36px">
<?php
echo html_print_image(
'images/info-warning.svg',
true,
[ 'style' => 'padding-top: 30px' ]
);
?>
</div>
<div style="padding: 5px 90px 5px 5px;">
<p class="lato font_10pt bolder">
<?php
echo __('There are two types of versions in Pandora FMS: the LTS versions (Long-Term Support), e.g: 772 LTS, and the RRR (Regular Rolling Release) versions, e.g: 771, 773, 774, 775.');
?>
</p>
<p class="lato font_10pt bolder">
<?php
echo __('LTS versions have frequent, periodic updates (fixes), correcting both security problems and critical bugs detected in the tool. These are the versions we recommend to use in production environments.');
?>
</p>
<p class="lato font_10pt bolder">
<?php
echo __('RRR versions incorporate new features in each version, as well as bug fixes, but due to their dynamic nature, errors are more likely.');
?>
</p>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
// Lts Updates.
$("#lts-updates").dialog({
resizable: true,
draggable: true,
modal: true,
width: 740,
overlay: {
opacity: 0.5,
background: "black"
},
closeOnEscape: true,
buttons: [{
text: "OK",
click: function() {
$(this).dialog("close");
}
}],
open: function(event, ui) {
$(".ui-dialog-titlebar-close").hide();
}
});
});
</script>

View File

@ -119,11 +119,13 @@ switch ($tab) {
case 'setup': case 'setup':
include $config['homedir'].'/godmode/update_manager/update_manager.setup.php'; include $config['homedir'].'/godmode/update_manager/update_manager.setup.php';
include $config['homedir'].'/godmode/update_manager/modal_lts_update.php';
break; break;
case 'offline': case 'offline':
$mode = \UpdateManager\UI\Manager::MODE_OFFLINE; $mode = \UpdateManager\UI\Manager::MODE_OFFLINE;
include $config['homedir'].'/godmode/um_client/index.php'; include $config['homedir'].'/godmode/um_client/index.php';
include $config['homedir'].'/godmode/update_manager/modal_lts_update.php';
break; break;
case 'online': case 'online':
@ -163,5 +165,6 @@ switch ($tab) {
$mode = \UpdateManager\UI\Manager::MODE_ONLINE; $mode = \UpdateManager\UI\Manager::MODE_ONLINE;
include $config['homedir'].'/godmode/um_client/index.php'; include $config['homedir'].'/godmode/um_client/index.php';
include $config['homedir'].'/godmode/update_manager/modal_lts_update.php';
break; break;
} }

View File

@ -63,6 +63,10 @@ if (users_is_admin()) {
} }
} }
if (isset($config['lts_updates']) === false) {
config_update_value('lts_updates', 1);
}
if (!$action_update_url_update_manager) { if (!$action_update_url_update_manager) {
$url_update_manager = get_parameter( $url_update_manager = get_parameter(
'url_update_manager', 'url_update_manager',

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icons/Dark/20/desacoplar-ventana</title>
<g id="Icons/Dark/20/desacoplar-ventana" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Back" transform="translate(3, 1)">
<rect id="Rectangle-2" stroke="#3F3F3F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x="0" y="0" width="20" height="16" rx="1"></rect>
<path d="M3,4 C3.55228475,4 4,3.55228475 4,3 C4,2.44771525 3.55228475,2 3,2 C2.44771525,2 2,2.44771525 2,3 C2,3.55228475 2.44771525,4 3,4 Z M6,4 C6.55228475,4 7,3.55228475 7,3 C7,2.44771525 6.55228475,2 6,2 C5.44771525,2 5,2.44771525 5,3 C5,3.55228475 5.44771525,4 6,4 Z M9,4 C9.55228475,4 10,3.55228475 10,3 C10,2.44771525 9.55228475,2 9,2 C8.44771525,2 8,2.44771525 8,3 C8,3.55228475 8.44771525,4 9,4 Z" id="Oval-2" fill="#3F3F3F"></path>
</g>
<g id="Front" transform="translate(0, 8)">
<rect id="Rectangle-2" fill="#3F3F3F" x="0" y="0" width="20" height="16" rx="1"></rect>
<path d="M3,4 C3.55228475,4 4,3.55228475 4,3 C4,2.44771525 3.55228475,2 3,2 C2.44771525,2 2,2.44771525 2,3 C2,3.55228475 2.44771525,4 3,4 Z M6,4 C6.55228475,4 7,3.55228475 7,3 C7,2.44771525 6.55228475,2 6,2 C5.44771525,2 5,2.44771525 5,3 C5,3.55228475 5.44771525,4 6,4 Z M9,4 C9.55228475,4 10,3.55228475 10,3 C10,2.44771525 9.55228475,2 9,2 C8.44771525,2 8,2.44771525 8,3 C8,3.55228475 8.44771525,4 9,4 Z" id="Oval-2" fill="#FFFFFF"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icons/Dark/20/minimizar</title>
<g id="Icons/Dark/20/minimizar" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<rect id="Rectangle" fill="#3F3F3F" x="2" y="18" width="20" height="4" rx="2"></rect>
</g>
</svg>

After

Width:  |  Height:  |  Size: 436 B

View File

@ -92,6 +92,7 @@ $get_id_source_event = get_parameter('get_id_source_event');
$node_id = (int) get_parameter('node_id', 0); $node_id = (int) get_parameter('node_id', 0);
$settings_modal = get_parameter('settings', 0); $settings_modal = get_parameter('settings', 0);
$parameters_modal = get_parameter('parameters', 0); $parameters_modal = get_parameter('parameters', 0);
$update_event_custom_id = get_parameter('update_event_custom_id', 0);
$draw_events_graph = get_parameter('drawEventsGraph', false); $draw_events_graph = get_parameter('drawEventsGraph', false);
// User private filter. // User private filter.
@ -313,6 +314,7 @@ if ($save_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1)); $values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status'); $values['status'] = get_parameter('status');
$values['search'] = get_parameter('search'); $values['search'] = get_parameter('search');
$values['regex'] = get_parameter('regex');
$values['not_search'] = get_parameter('not_search'); $values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent'); $values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent'); $values['id_agent'] = get_parameter('id_agent');
@ -381,6 +383,7 @@ if ($update_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1)); $values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status'); $values['status'] = get_parameter('status');
$values['search'] = get_parameter('search'); $values['search'] = get_parameter('search');
$values['regex'] = get_parameter('regex');
$values['not_search'] = get_parameter('not_search'); $values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent'); $values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent'); $values['id_agent'] = get_parameter('id_agent');
@ -640,6 +643,8 @@ function load_form_filter() {
$("#status").val(val); $("#status").val(val);
if (i == 'search') if (i == 'search')
$('#text-search').val(val); $('#text-search').val(val);
if (i == 'regex')
$('#text-regex').val(val);
if (i == 'not_search') if (i == 'not_search')
$('#checkbox-not_search').val(val); $('#checkbox-not_search').val(val);
if (i == 'text_agent') if (i == 'text_agent')
@ -970,6 +975,7 @@ function save_new_filter() {
"severity" : $("#severity").val(), "severity" : $("#severity").val(),
"status" : $("#status").val(), "status" : $("#status").val(),
"search" : $("#text-search").val(), "search" : $("#text-search").val(),
"regex" : $('#text-regex').val(),
"not_search" : $("#checkbox-not_search").val(), "not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_id_agent").val(), "text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(), "id_agent" : $('input:hidden[name=id_agent]').val(),
@ -1050,6 +1056,7 @@ function save_update_filter() {
"severity" : $("#severity").val(), "severity" : $("#severity").val(),
"status" : $("#status").val(), "status" : $("#status").val(),
"search" : $("#text-search").val(), "search" : $("#text-search").val(),
"regex" : $('#text-regex').val(),
"not_search" : $("#checkbox-not_search").val(), "not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_id_agent").val(), "text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(), "id_agent" : $('input:hidden[name=id_agent]').val(),
@ -2644,6 +2651,8 @@ if ($get_events_fired) {
$filter['date_to'] = date('Y-m-d', $end); $filter['date_to'] = date('Y-m-d', $end);
$filter['time_from'] = date('H:i:s', $start); $filter['time_from'] = date('H:i:s', $start);
$filter['time_to'] = date('H:i:s', $end); $filter['time_to'] = date('H:i:s', $end);
$filter['severity'] = explode(',', $filter['severity']);
$data = events_get_all( $data = events_get_all(
['te.*'], ['te.*'],
$filter $filter
@ -2754,6 +2763,52 @@ if ($draw_row_response_info === true) {
return; return;
} }
if ($update_event_custom_id) {
$event_custom_id = get_parameter('event_custom_id');
$event_id = get_parameter('event_id');
$server_id = 0;
if (is_metaconsole() === true) {
$server_id = (int) get_parameter('server_id');
}
// Safe custom fields for hacks.
if (preg_match('/script/i', io_safe_output($event_custom_id))) {
$return = false;
} else {
try {
if (is_metaconsole() === true
&& $server_id > 0
) {
$node = new Node($server_id);
$node->connect();
}
$return = events_event_custom_id(
$event_id,
$event_custom_id
);
} catch (\Exception $e) {
// Unexistent agent.
if (is_metaconsole() === true
&& $server_id > 0
) {
$node->disconnect();
}
$return = false;
} finally {
if (is_metaconsole() === true
&& $server_id > 0
) {
$node->disconnect();
}
}
}
echo ($return === true) ? 'update_ok' : 'update_error';
return;
}
if ((bool) $draw_events_graph === true) { if ((bool) $draw_events_graph === true) {
$filter = get_parameter('filter'); $filter = get_parameter('filter');
$output = event_print_graph($filter); $output = event_print_graph($filter);

View File

@ -35,6 +35,7 @@ if (check_login()) {
include_once $config['homedir'].'/include/functions_agents.php'; include_once $config['homedir'].'/include/functions_agents.php';
include_once $config['homedir'].'/include/functions_modules.php'; include_once $config['homedir'].'/include/functions_modules.php';
include_once $config['homedir'].'/include/functions_ui.php'; include_once $config['homedir'].'/include/functions_ui.php';
include_once $config['homedir'].'/include/functions_macros.php';
enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_metaconsole.php');
$get_plugin_macros = get_parameter('get_plugin_macros'); $get_plugin_macros = get_parameter('get_plugin_macros');
@ -1206,8 +1207,24 @@ if (check_login()) {
); );
if (strlen($module['ip_target']) !== 0) { if (strlen($module['ip_target']) !== 0) {
// Check if value is custom field.
if ($module['ip_target'][0] == '_' && $module['ip_target'][(strlen($module['ip_target']) - 1)] == '_') {
$custom_field_name = substr($module['ip_target'], 1, -1);
$custom_value = agents_get_agent_custom_field($id_agente, $custom_field_name);
if (isset($custom_value) && $custom_value !== false) {
$title .= '<br/>IP: '.$custom_value;
} else {
$array_macros = return_agent_macros($id_agente);
if (isset($array_macros[$module['ip_target']])) {
$title .= '<br/>IP: '.$array_macros[$module['ip_target']];
} else {
$title .= '<br/>IP: '.$module['ip_target']; $title .= '<br/>IP: '.$module['ip_target'];
} }
}
} else {
$title .= '<br/>IP: '.$module['ip_target'];
}
}
$last_status_change_text = __('Time elapsed since last status change: '); $last_status_change_text = __('Time elapsed since last status change: ');
$last_status_change_text .= (empty($module['last_status_change']) === false) ? human_time_comparation($module['last_status_change']) : __('N/A'); $last_status_change_text .= (empty($module['last_status_change']) === false) ? human_time_comparation($module['last_status_change']) : __('N/A');

View File

@ -2404,13 +2404,17 @@ class ConsoleSupervisor
{ {
global $config; global $config;
include_once $config['homedir'].'/include/functions_update_manager.php'; include_once $config['homedir'].'/include/functions_update_manager.php';
$server_name = db_get_value_filter(
'name',
'tserver',
[ 'server_type' => '1' ]
);
if (update_manager_verify_api() === false) { if (update_manager_verify_api() === false) {
$this->notify( $this->notify(
[ [
'type' => 'NOTIF.API.ACCESS', 'type' => 'NOTIF.API.ACCESS',
'title' => __('Cannot access the Pandora FMS API '), 'title' => __('Cannot access the Pandora FMS API '),
'message' => __('Please check the configuration, some components may fail due to this misconfiguration.'), 'message' => __('Please check the configuration, some components may fail due to this misconfiguration in '.$server_name.' ('.$config['public_url'].')'),
] ]
); );
} else { } else {

View File

@ -737,7 +737,7 @@ class Diagnostics extends Wizard
$cpuModelName = 'cat /proc/cpuinfo | grep "model name" | tail -1 | cut -f 2 -d ":"'; $cpuModelName = 'cat /proc/cpuinfo | grep "model name" | tail -1 | cut -f 2 -d ":"';
$cpuProcessor = 'cat /proc/cpuinfo | grep "processor" | wc -l'; $cpuProcessor = 'cat /proc/cpuinfo | grep "processor" | wc -l';
$ramMemTotal = 'cat /proc/meminfo | grep "MemTotal"'; $ramMemTotal = 'cat /proc/meminfo | grep "MemTotal"';
$distroInfo = 'cat /etc/os-release | grep "PRETTY_NAME" | cut -f 2 -d "="';
exec( exec(
"ifconfig | awk '{ print $2}' | grep -E -o '([0-9]{1,3}[\.]){3}[0-9]{1,3}'", "ifconfig | awk '{ print $2}' | grep -E -o '([0-9]{1,3}[\.]){3}[0-9]{1,3}'",
$output $output
@ -756,6 +756,10 @@ class Diagnostics extends Wizard
'name' => __('RAM'), 'name' => __('RAM'),
'value' => exec($ramMemTotal), 'value' => exec($ramMemTotal),
], ],
'distroInfo' => [
'name' => __('Distro'),
'value' => str_replace('"', '', exec($distroInfo)),
],
'osInfo' => [ 'osInfo' => [
'name' => __('Os'), 'name' => __('Os'),
'value' => exec('uname -a'), 'value' => exec('uname -a'),

View File

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

View File

@ -990,6 +990,70 @@ function get_parameter($name, $default='')
} }
function get_parameter_date($name, $default='', $date_format='Y/m/d')
{
$date_end = get_parameter('date_end', 0);
$time_end = get_parameter('time_end');
$datetime_end = strtotime($date_end.' '.$time_end);
$custom_date = get_parameter('custom_date', 0);
$range = get_parameter('range', SECONDS_1DAY);
$date_text = get_parameter('range_text', SECONDS_1DAY);
$date_init_less = (strtotime(date('Y/m/d')) - SECONDS_1DAY);
$date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less));
$time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less));
$datetime_init = strtotime($date_init.' '.$time_init);
if ($custom_date === '1') {
if ($datetime_init >= $datetime_end) {
$datetime_init = $date_init_less;
}
$date_init = date('Y/m/d H:i:s', $datetime_init);
$date_end = date('Y/m/d H:i:s', $datetime_end);
$period = ($datetime_end - $datetime_init);
} else if ($custom_date === '2') {
$date_units = get_parameter('range_units');
$date_end = date('Y/m/d H:i:s');
$date_init = date('Y/m/d H:i:s', (strtotime($date_end) - ((int) $date_text * (int) $date_units)));
$period = (strtotime($date_end) - strtotime($date_init));
} else if (in_array($range, ['this_week', 'this_month', 'past_week', 'past_month'])) {
if ($range === 'this_week') {
$monday = date('Y/m/d', strtotime('last monday'));
$sunday = date('Y/m/d', strtotime($monday.' +6 days'));
$period = (strtotime($sunday) - strtotime($monday));
$date_init = $monday;
$date_end = $sunday;
} else if ($range === 'this_month') {
$date_end = date('Y/m/d', strtotime('last day of this month'));
$first_of_month = date('Y/m/d', strtotime('first day of this month'));
$date_init = $first_of_month;
$period = (strtotime($date_end) - strtotime($first_of_month));
} else if ($range === 'past_month') {
$date_end = date('Y/m/d', strtotime('last day of previous month'));
$first_of_month = date('Y/m/d', strtotime('first day of previous month'));
$date_init = $first_of_month;
$period = (strtotime($date_end) - strtotime($first_of_month));
} else if ($range === 'past_week') {
$date_end = date('Y/m/d', strtotime('sunday', strtotime('last week')));
$first_of_week = date('Y/m/d', strtotime('monday', strtotime('last week')));
$date_init = $first_of_week;
$period = (strtotime($date_end) - strtotime($first_of_week));
}
} else {
$date_end = date('Y/m/d H:i:s');
$date_init = date('Y/m/d H:i:s', (strtotime($date_end) - $range));
$period = (strtotime($date_end) - strtotime($date_init));
}
return [
'date_init' => date($date_format, strtotime($date_init)),
'date_end' => date($date_format, strtotime($date_end)),
'period' => $period,
];
}
/** /**
* Get a parameter from a get request. * Get a parameter from a get request.
* *

View File

@ -4752,7 +4752,7 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
$secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]); $secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
$secondaryLinks = []; $secondaryLinks = [];
if (empty($secondary_groups['for_select']) === true) { if (empty($secondary_groups['for_select']) === true) {
$secondaryLinks[] = '<em>'.__('N/A').'</em>'; $secondaryLinks = [];
} else { } else {
foreach ($secondary_groups['for_select'] as $id => $name) { foreach ($secondary_groups['for_select'] as $id => $name) {
$secondaryLinks[] = html_print_anchor( $secondaryLinks[] = html_print_anchor(
@ -4811,22 +4811,22 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
'content' => groups_get_name($agent['id_grupo']), 'content' => groups_get_name($agent['id_grupo']),
], ],
true true
); ).' '.ui_print_group_icon($agent['id_grupo'], true, '', 'margin-left: 2%;', true, false, false, '', true);
$table_contact->data[] = $data; $table_contact->data[] = $data;
// Secondary groups. // Secondary groups.
$data = []; $data = [];
if (!empty($secondaryLinks) === true) {
$data[0] = '<b>'.__('Secondary groups').'</b>'; $data[0] = '<b>'.__('Secondary groups').'</b>';
$data[1] = implode(', ', $secondaryLinks); $data[1] = implode(', ', $secondaryLinks);
$table_contact->data[] = $data; $table_contact->data[] = $data;
}
// Parent agent line. // Parent agent line.
if (enterprise_installed() === true) { if (enterprise_installed() === true) {
if ((int) $agent['id_parent'] !== 0) {
$data = []; $data = [];
$data[0] = '<b>'.__('Parent').'</b>'; $data[0] = '<b>'.__('Parent').'</b>';
if ((int) $agent['id_parent'] === 0) {
$data[1] = '<em>'.__('N/A').'</em>';
} else {
$data[1] = html_print_anchor( $data[1] = html_print_anchor(
[ [
'href' => 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent['id_parent'], 'href' => 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent['id_parent'],
@ -4834,10 +4834,10 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
], ],
true true
); );
}
$table_contact->data[] = $data; $table_contact->data[] = $data;
} }
}
// Last status change line. // Last status change line.
$data = []; $data = [];
@ -4845,6 +4845,44 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
$data[1] = $time_elapsed; $data[1] = $time_elapsed;
$table_contact->data[] = $data; $table_contact->data[] = $data;
$has_remote_conf = enterprise_hook(
'config_agents_has_remote_configuration',
[$agent['id_agente']]
);
if ((bool) $has_remote_conf) {
$data = [];
$data[0] = __('Remote configuration');
$data[1] = '<spam style="position: relative;top: -10%; margin-right: 10px;">'.__('Enabled').'</spam>';
$data[1] .= html_print_menu_button(
[
'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$agent['id_agente'].'&disk_conf=1'),
'image' => 'images/remote-configuration@svg.svg',
'title' => __('Edit remote config'),
],
true
);
$satellite_server = (int) db_get_value_filter(
'satellite_server',
'tagente',
['id_agente' => $id_agente]
);
if (empty($satellite_server) === false) {
$satellite_name = db_get_value_filter(
'name',
'tserver',
['id_server' => $satellite_server]
);
$data[0] = __('Satellite server');
$data[1] = $satellite_name;
}
$table_contact->data[] = $data;
}
if (enterprise_installed() === true) { if (enterprise_installed() === true) {
// SecurityMon line. // SecurityMon line.
$id_module_group = db_get_value('id_mg', 'tmodule_group', 'name', 'Security'); $id_module_group = db_get_value('id_mg', 'tmodule_group', 'name', 'Security');
@ -4887,6 +4925,43 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
} }
} }
// Optional data
// Position Information.
if ((bool) $config['activate_gis'] === true) {
$data = [];
$dataPositionAgent = gis_get_data_last_position_agent(
$agent['id_agente']
);
if (is_array($dataPositionAgent) === true && $dataPositionAgent['stored_longitude'] !== '' && $dataPositionAgent['stored_latitude'] !== '') {
$data[0] = __('Position (Long, Lat)');
$dataOptionalOutput = html_print_anchor(
[
'href' => 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=gis&amp;id_agente='.$id_agente,
'content' => $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude'],
],
true
);
if (empty($dataPositionAgent['description']) === false) {
$dataOptionalOutput .= ' ('.$dataPositionAgent['description'].')';
}
$data[1] = $dataOptionalOutput;
}
$table_contact->data[] = $data;
}
// Timezone Offset.
if ((int) $agent['timezone_offset'] !== 0) {
$data = [];
$data[0] = __('Timezone Offset');
$data[1] = $agent['timezone_offset'];
$table_contact->data[] = $data;
}
$agent_contact = html_print_div( $agent_contact = html_print_div(
[ [
'class' => 'agent_details_header', 'class' => 'agent_details_header',

View File

@ -13132,7 +13132,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
if ($other['data'][18] != '') { if ($other['data'][18] != '') {
$values['id_extra'] = $other['data'][18]; $values['id_extra'] = $other['data'][18];
$sql_validation = 'SELECT id_evento,estado,ack_utimestamp,id_usuario $sql_validation = 'SELECT id_evento,estado,ack_utimestamp,id_usuario,event_custom_id
FROM tevento FROM tevento
WHERE estado IN (0,2) AND id_extra ="'.$other['data'][18].'";'; WHERE estado IN (0,2) AND id_extra ="'.$other['data'][18].'";';
@ -13147,6 +13147,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
$values['status'] = 2; $values['status'] = 2;
$ack_utimestamp = $val['ack_utimestamp']; $ack_utimestamp = $val['ack_utimestamp'];
$values['id_usuario'] = $val['id_usuario']; $values['id_usuario'] = $val['id_usuario'];
$values['event_custom_id'] = $val['event_custom_id'];
} }
api_set_validate_event_by_id($val['id_evento']); api_set_validate_event_by_id($val['id_evento']);
@ -13177,7 +13178,8 @@ function api_set_create_event($id, $trash1, $other, $returnType)
$custom_data, $custom_data,
$values['server_id'], $values['server_id'],
$values['id_extra'], $values['id_extra'],
$ack_utimestamp $ack_utimestamp,
$values['event_custom_id'] ?? null
); );
if ($other['data'][12] != '') { if ($other['data'][12] != '') {
@ -17787,6 +17789,48 @@ function api_token_check(string $token)
} }
/**
* Set custom field value in tevento
*
* @param mixed $id_event Event id.
* @param mixed $custom_field Custom field to set.
* @return void
*/
function api_set_event_custom_id($id, $value)
{
// Get the event
$event = events_get_event($id, false, is_metaconsole());
// If event not exists, end the execution.
if ($event === false) {
returnError(
'event_not_exists',
'Event not exists'
);
$result = false;
}
// Safe custom fields for hacks.
if (preg_match('/script/i', io_safe_output($value))) {
$result = false;
}
$result = events_event_custom_id(
$id,
$value
);
// If update results failed
if (empty($result) === true || $result === false) {
returnError(
'The event could not be updated'
);
return false;
} else {
returnData('string', ['data' => 'Event updated.']);
}
}
/** /**
* Extract info Agents for inventories ITSM. * Extract info Agents for inventories ITSM.
* *

View File

@ -249,10 +249,6 @@ function config_update_config()
$error_update[] = __('Enable Netflow'); $error_update[] = __('Enable Netflow');
} }
if (config_update_value('activate_sflow', (bool) get_parameter('activate_sflow'), true) === false) {
$error_update[] = __('Enable Sflow');
}
if (config_update_value('activate_feedback', (bool) get_parameter('activate_feedback'), true) === false) { if (config_update_value('activate_feedback', (bool) get_parameter('activate_feedback'), true) === false) {
$error_update[] = __('Enable Feedback'); $error_update[] = __('Enable Feedback');
} }
@ -1623,6 +1619,10 @@ function config_update_config()
if (config_update_value('netflow_get_ip_hostname', (int) get_parameter('netflow_get_ip_hostname'), true) === false) { if (config_update_value('netflow_get_ip_hostname', (int) get_parameter('netflow_get_ip_hostname'), true) === false) {
$error_update[] = __('Name resolution for IP address'); $error_update[] = __('Name resolution for IP address');
} }
if (config_update_value('activate_sflow', (bool) get_parameter('activate_sflow'), true) === false) {
$error_update[] = __('Enable Sflow');
}
break; break;
case 'sflow': case 'sflow':

View File

@ -219,6 +219,7 @@ function events_get_all_fields()
$columns['module_status'] = __('Module status'); $columns['module_status'] = __('Module status');
$columns['module_custom_id'] = __('Module custom id'); $columns['module_custom_id'] = __('Module custom id');
$columns['custom_data'] = __('Custom data'); $columns['custom_data'] = __('Custom data');
$columns['event_custom_id'] = __('Event Custom ID');
return $columns; return $columns;
} }
@ -322,6 +323,9 @@ function events_get_column_name($field, $table_alias=false)
case 'custom_data': case 'custom_data':
return __('Custom data'); return __('Custom data');
case 'event_custom_id':
return __('Event Custom ID');
default: default:
return __($field); return __($field);
} }
@ -2356,7 +2360,8 @@ function events_create_event(
$custom_data='', $custom_data='',
$server_id=0, $server_id=0,
$id_extra='', $id_extra='',
$ack_utimestamp=0 $ack_utimestamp=0,
$event_custom_id=null
) { ) {
if ($source === false) { if ($source === false) {
$source = get_product_name(); $source = get_product_name();
@ -2388,6 +2393,7 @@ function events_create_event(
'custom_data' => $custom_data, 'custom_data' => $custom_data,
'data' => '', 'data' => '',
'module_status' => 0, 'module_status' => 0,
'event_custom_id' => $event_custom_id,
]; ];
return (int) db_process_sql_insert('tevento', $values); return (int) db_process_sql_insert('tevento', $values);
@ -2611,7 +2617,6 @@ function events_print_type_img(
$urlImage = ui_get_full_url(false); $urlImage = ui_get_full_url(false);
$icon = ''; $icon = '';
$style = 'main_menu_icon'; $style = 'main_menu_icon';
switch ($type) { switch ($type) {
case 'alert_recovered': case 'alert_recovered':
$icon = 'images/alert_recovered@svg.svg'; $icon = 'images/alert_recovered@svg.svg';
@ -2677,16 +2682,6 @@ function events_print_type_img(
if ($only_url) { if ($only_url) {
$output = $urlImage.'/'.$icon; $output = $urlImage.'/'.$icon;
} else { } else {
/*
$output .= html_print_div(
[
'title' => events_print_type_description($type, true),
'class' => $style,
'style' => ((empty($icon) === false) ? 'background-image: url('.$icon.'); background-repeat: no-repeat;' : ''),
],
true
);
*/
$output .= html_print_image( $output .= html_print_image(
$icon, $icon,
true, true,
@ -4658,6 +4653,30 @@ function events_page_details($event, $server_id=0)
$data[1] = '<i>'.__('N/A').'</i>'; $data[1] = '<i>'.__('N/A').'</i>';
} }
$table_details->data[] = $data;
$readonly = true;
if (check_acl($config['id_user'], 0, 'EW')) {
$readonly = false;
}
$data = [];
$data[0] = __('Event Custom ID');
$data[1] = '<div class="flex-row-center">'.html_print_input_text('event_custom_id', $event['event_custom_id'], '', false, 255, true, $readonly, false, '', 'w60p');
if ($readonly === false) {
$data[1] .= html_print_button(
__('Update'),
'update_event_custom_id',
false,
'update_event_custom_id('.$event['id_evento'].', '.$event['server_id'].');',
[
'icon' => 'next',
'mode' => 'link',
],
true
);
}
$data[1] .= '</div>';
$table_details->data[] = $data; $table_details->data[] = $data;
$details = '<div id="extended_event_details_page" class="extended_event_pages">'.html_print_table($table_details, true).'</div>'; $details = '<div id="extended_event_details_page" class="extended_event_pages">'.html_print_table($table_details, true).'</div>';
@ -6260,6 +6279,63 @@ function event_get_counter_extraId(array $event, ?array $filters)
} }
/**
* Update event detail custom field
*
* @param mixed $id_event Event ID or array of events.
* @param string $event_custom_id Event custom ID to be update.
*
* @return boolean Whether or not it was successful
*/
function events_event_custom_id(
$id_event,
$event_custom_id,
) {
global $config;
// Cleans up the selection for all unwanted values also casts any single
// values as an array.
if (![$id_event]) {
$id_event = (array) safe_int($id_event, 1);
}
// Check ACL.
foreach ($id_event as $k => $id) {
$event_group = events_get_group($id);
if (check_acl($config['id_user'], $event_group, 'EW') == 0) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Attempted updating event #'.$id
);
unset($id_event[$k]);
}
}
if (empty($id_event) === true) {
return false;
}
// Get the current event comments.
$first_event = $id_event;
if (is_array($id_event) === true) {
$first_event = reset($id_event);
}
// Update comment.
$ret = db_process_sql_update(
'tevento',
['event_custom_id' => $event_custom_id],
['id_evento' => $first_event]
);
if (($ret === false) || ($ret === 0)) {
return false;
}
return true;
}
function event_print_graph( function event_print_graph(
$filter, $filter,
$graph_height=100, $graph_height=100,

View File

@ -0,0 +1,61 @@
<?php
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// 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.
/**
* Return array with macros of agent like core.pm
*
* @param interger $id_agente Id agent to return data.
*
* @return array Array with all macros.
*/
function return_agent_macros($id_agente)
{
global $config;
$array_macros = [];
$grupo = [];
$agente = db_get_row_sql(
'SELECT * FROM tagente WHERE id_agente = '.$id_agente
);
if (isset($agente['id_grupo'])) {
$grupo = db_get_row_sql(
'SELECT * FROM tgrupo WHERE id_grupo = '.$agente['id_grupo']
);
}
if (isset($agente['server_name'])) {
$server_ip = db_get_row_sql(
'SELECT ip_address FROM tserver WHERE name = "'.$agente['server_name'].'"'
)['id_address'];
}
$array_macros = [
'_agentname_' => ($agente['nombre']) ?: '',
'_agentalias_' => ($agente['alias']) ?: '',
'_agent_' => ($agente['alias']) ?: (($agente['nombre']) ?: ''),
'_agentcustomid_' => ($agente['custom_id']) ?: '',
'_agentdescription_' => ($agente['comentarios']) ?: '',
'_agentgroup_' => ($grupo['nombre']) ?: '',
'_agentos_' => ($agente['id_os']) ?: '',
'_address_' => ($agente['direccion']) ?: '',
'_homeurl_' => ($config['public_url']) ?: '',
'_groupcontact_' => ($agente['contact']) ?: '',
'_groupcustomid_' => ($agente['custom_id']) ?: '',
'_groupother_' => ($agente['other']) ?: '',
'_server_ip_' => ($server_ip) ?: '',
'_server_name_' => ($agente['server_name']) ?: '',
];
return $array_macros;
}

View File

@ -1170,6 +1170,14 @@ if (is_ajax()) {
<p style="font-size: 10pt;">'.$sys_info->data->ramInfo->value.'</p> <p style="font-size: 10pt;">'.$sys_info->data->ramInfo->value.'</p>
</th> </th>
</tr> </tr>
<tr>
<th style="width: 15%;">
<p><span>'.$sys_info->data->distroInfo->name.'</span></p>
</th>
<th style="width: 85%;">
<p style="font-size: 10pt;">'.$sys_info->data->distroInfo->value.'</p>
</th>
</tr>
<tr> <tr>
<th style="width: 15%;"> <th style="width: 15%;">
<p><span>'.$sys_info->data->osInfo->name.'</span></p> <p><span>'.$sys_info->data->osInfo->name.'</span></p>

View File

@ -13698,38 +13698,47 @@ function reporting_tiny_stats(
} }
if ($modern === true) { if ($modern === true) {
$out .= '<div id="bullets_modules">';
if (isset($fired_count) && $fired_count > 0) { if (isset($fired_count) && $fired_count > 0) {
$out .= '<div class="bullets_modules">';
$out .= '<div><div id="fired_count_'.$uniq_id.'" class="forced_title bullet_modules orange_background"></div>'; $out .= '<div><div id="fired_count_'.$uniq_id.'" class="forced_title bullet_modules orange_background"></div>';
$out .= '<span class="font_12pt">'.$fired_count.'</span></div>'; $out .= '<span class="font_12pt">'.$fired_count.'</span></div>';
$out .= '</div>';
} }
if (isset($critical_count) && $critical_count > 0) { if (isset($critical_count) && $critical_count > 0) {
$out .= '<div class="bullets_modules">';
$out .= '<div><div id="critical_count_'.$uniq_id.'" class="forced_title bullet_modules red_background"></div>'; $out .= '<div><div id="critical_count_'.$uniq_id.'" class="forced_title bullet_modules red_background"></div>';
$out .= '<span class="font_12pt">'.$critical_count.'</span></div>'; $out .= '<span class="font_12pt">'.$critical_count.'</span></div>';
$out .= '</div>';
} }
if (isset($warning_count) && $warning_count > 0) { if (isset($warning_count) && $warning_count > 0) {
$out .= '<div class="bullets_modules">';
$out .= '<div><div id="warning_count_'.$uniq_id.'" class="forced_title bullet_modules yellow_background"></div>'; $out .= '<div><div id="warning_count_'.$uniq_id.'" class="forced_title bullet_modules yellow_background"></div>';
$out .= '<span class="font_12pt">'.$warning_count.'</span></div>'; $out .= '<span class="font_12pt">'.$warning_count.'</span></div>';
$out .= '</div>';
} }
if (isset($unknown_count) && $unknown_count > 0) { if (isset($unknown_count) && $unknown_count > 0) {
$out .= '<div class="bullets_modules">';
$out .= '<div><div id="unknown_count_'.$uniq_id.'" class="forced_title bullet_modules grey_background"></div>'; $out .= '<div><div id="unknown_count_'.$uniq_id.'" class="forced_title bullet_modules grey_background"></div>';
$out .= '<span class="font_12pt">'.$unknown_count.'</span></div>'; $out .= '<span class="font_12pt">'.$unknown_count.'</span></div>';
$out .= '</div>';
} }
if (isset($not_init_count) && $not_init_count > 0) { if (isset($not_init_count) && $not_init_count > 0) {
$out .= '<div class="bullets_modules">';
$out .= '<div><div id="not_init_count_'.$uniq_id.'" class="forced_title bullet_modules blue_background"></div>'; $out .= '<div><div id="not_init_count_'.$uniq_id.'" class="forced_title bullet_modules blue_background"></div>';
$out .= '<span class="font_12pt">'.$not_init_count.'</span></div>'; $out .= '<span class="font_12pt">'.$not_init_count.'</span></div>';
$out .= '</div>';
} }
if (isset($normal_count) && $normal_count > 0) { if (isset($normal_count) && $normal_count > 0) {
$out .= '<div class="bullets_modules">';
$out .= '<div><div id="normal_count_'.$uniq_id.'" class="forced_title bullet_modules green_background"></div>'; $out .= '<div><div id="normal_count_'.$uniq_id.'" class="forced_title bullet_modules green_background"></div>';
$out .= '<span class="font_12pt">'.$normal_count.'</span></div>'; $out .= '<span class="font_12pt">'.$normal_count.'</span></div>';
}
$out .= '</div>'; $out .= '</div>';
}
} else { } else {
// Classic ones. // Classic ones.
$out .= '<b><span id="total_count_'.$uniq_id.'" class="forced_title" >'.$total_count.'</span>'; $out .= '<b><span id="total_count_'.$uniq_id.'" class="forced_title" >'.$total_count.'</span>';

View File

@ -1653,6 +1653,10 @@ function paint_graph_status(
max_c = 0; max_c = 0;
} }
// Remove Error class.
$("#text-max_warning").removeClass("input_error");
$("#text-max_critical").removeClass("input_error");
//if haven't errors //if haven't errors
if (error_w == 0 && error_c == 0) { if (error_w == 0 && error_c == 0) {
//parse element //parse element
@ -1958,6 +1962,9 @@ function paint_graph_status(
.html(message_error_critical) .html(message_error_critical)
.style("text-anchor", "first"); .style("text-anchor", "first");
} }
if (error_c == 2) {
$("#text-max_critical").addClass("input_error");
}
} }
} }

View File

@ -492,6 +492,37 @@ function event_comment(current_event) {
return false; return false;
} }
// Save custom_field into an event.
function update_event_custom_id(event_id, server_id) {
var event_custom_id = $("#text-event_custom_id").val();
var params = {
page: "include/ajax/events",
update_event_custom_id: 1,
event_custom_id: event_custom_id,
event_id: event_id,
server_id: server_id
};
$("#button-update_custom_field").attr("disabled", "disabled");
$("#response_loading").show();
jQuery.ajax({
data: params,
type: "POST",
url: getUrlAjax(),
dataType: "html",
success: function(data) {
if (data === "update_error") {
alert("Event Custom ID not valid");
}
$("#button-update_custom_field").removeAttr("disabled");
$("#response_loading").hide();
$("#button-events_form_search_bt").trigger("click");
}
});
}
var processed = 0; var processed = 0;
function update_event(table, id_evento, type, event_rep, row, server_id) { function update_event(table, id_evento, type, event_rep, row, server_id) {
var inputs = $("#events_form :input"); var inputs = $("#events_form :input");
@ -1004,6 +1035,7 @@ function openSoundEventsDialog(settings, dialog_parameters, reload) {
modal: false, modal: false,
width: 600, width: 600,
height: 600, height: 600,
dialogClass: "modal-sound",
open: function() { open: function() {
$.ajax({ $.ajax({
method: "post", method: "post",
@ -1064,10 +1096,10 @@ function openSoundEventsDialog(settings, dialog_parameters, reload) {
if (reload == false && dialog_parameters != undefined) { if (reload == false && dialog_parameters != undefined) {
if ($("#button-start-search").hasClass("play")) { if ($("#button-start-search").hasClass("play")) {
$("#filter_id").val(dialog_parameters["filter_id"]); $("#filter_id").val(dialog_parameters.filter_id);
$("#interval").val(dialog_parameters["interval"]); $("#interval").val(dialog_parameters.interval);
$("#time_sound").val(dialog_parameters["time_sound"]); $("#time_sound").val(dialog_parameters.time_sound);
$("#sound_id").val(dialog_parameters["sound_id"]); $("#sound_id").val(dialog_parameters.sound_id);
$("#filter_id").trigger("change"); $("#filter_id").trigger("change");
$("#interval").trigger("change"); $("#interval").trigger("change");
@ -1124,14 +1156,15 @@ function openSoundEventsDialog(settings, dialog_parameters, reload) {
} }
function openSoundEventModal(settings) { function openSoundEventModal(settings) {
var win = "";
if ($("#hidden-metaconsole_activated").val() === "1") { if ($("#hidden-metaconsole_activated").val() === "1") {
var win = open( win = open(
"../../operation/events/sound_events.php", "../../operation/events/sound_events.php",
"day_123", "day_123",
"width=600,height=500" "width=600,height=500"
); );
} else { } else {
var win = open( win = open(
"operation/events/sound_events.php", "operation/events/sound_events.php",
"day_123", "day_123",
"width=600,height=500" "width=600,height=500"
@ -1502,11 +1535,6 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
typeof requestBody.includes === "function" && typeof requestBody.includes === "function" &&
requestBody.includes("drawConsoleSound=1") requestBody.includes("drawConsoleSound=1")
) { ) {
console.log(
"AJAX request sent with drawConsoleSound=1:",
ajaxOptions.url
);
// Find the dialog element by the aria-describedby attribute // Find the dialog element by the aria-describedby attribute
var dialog = $('[aria-describedby="modal-sound"]'); var dialog = $('[aria-describedby="modal-sound"]');
@ -1516,62 +1544,32 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
// Add the minimize button before the close button // Add the minimize button before the close button
var minimizeButton = $("<button>", { var minimizeButton = $("<button>", {
class: class:
"ui-corner-all ui-widget ui-button-icon-only ui-window-minimize ui-dialog-titlebar-minimize", "ui-corner-all ui-widget ui-button-icon-only ui-window-minimize ui-dialog-titlebar-minimize minimize-buttom-image",
type: "button", type: "button",
title: "Minimize", title: "Minimize"
style: "float: right;margin-right: 1.5em;"
}).insertBefore(closeButton); }).insertBefore(closeButton);
// Add the minimize icon to the minimize button
$("<span>", {
class: "ui-button-icon ui-icon ui-icon-minusthick",
style: "background-color: #fff;"
}).appendTo(minimizeButton);
$("<span>", {
class: "ui-button-icon-space"
})
.html(" ")
.appendTo(minimizeButton);
// Add the disengage button before the minimize button // Add the disengage button before the minimize button
var disengageButton = $("<button>", { var disengageButton = $("<button>", {
class: class:
"ui-corner-all ui-widget ui-button-icon-only ui-dialog-titlebar-disengage", "ui-corner-all ui-widget ui-button-icon-only ui-dialog-titlebar-disengage disengage-buttom-image",
type: "button", type: "button",
title: "Disengage", title: "Disengage"
style: "float: right;margin-right: 0.5em; position:relative;"
}).insertBefore(minimizeButton); }).insertBefore(minimizeButton);
// Add the disengage icon to the disengage button
$("<span>", {
class: "ui-button-icon ui-icon ui-icon-circle-triangle-n",
style: "background-color: #fff;"
}).appendTo(disengageButton);
$("<span>", {
class: "ui-button-icon-space"
})
.html(" ")
.appendTo(disengageButton);
minimizeButton.click(function(e) { minimizeButton.click(function(e) {
console.log("here");
if ($("#minimize_arrow_event_sound").hasClass("arrow_menu_up")) { if ($("#minimize_arrow_event_sound").hasClass("arrow_menu_up")) {
console.log("arrow_menu_up");
$("#minimize_arrow_event_sound").removeClass("arrow_menu_up"); $("#minimize_arrow_event_sound").removeClass("arrow_menu_up");
$("#minimize_arrow_event_sound").addClass("arrow_menu_down"); $("#minimize_arrow_event_sound").addClass("arrow_menu_down");
} else if ( } else if (
$("#minimize_arrow_event_sound").hasClass("arrow_menu_down") $("#minimize_arrow_event_sound").hasClass("arrow_menu_down")
) { ) {
console.log("arrow_menu_down");
$("#minimize_arrow_event_sound").removeClass("arrow_menu_down"); $("#minimize_arrow_event_sound").removeClass("arrow_menu_down");
$("#minimize_arrow_event_sound").addClass("arrow_menu_up"); $("#minimize_arrow_event_sound").addClass("arrow_menu_up");
} }
if (!dialog.data("isMinimized")) { if (!dialog.data("isMinimized")) {
$(".ui-widget-overlay").hide(); $(".ui-widget-overlay").hide();
console.log("Minimize Window");
dialog.data("originalPos", dialog.position()); dialog.data("originalPos", dialog.position());
dialog.data("originalSize", { dialog.data("originalSize", {
width: dialog.width(), width: dialog.width(),
@ -1582,7 +1580,6 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
dialog.animate( dialog.animate(
{ {
height: "40px", height: "40px",
top: 0,
top: $(window).height() - 100 top: $(window).height() - 100
}, },
200, 200,
@ -1597,17 +1594,13 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
}, },
5 5
); );
//dialog.find(".ui-dialog-content").hide();
} else { } else {
console.log("Restore Window");
$(".ui-widget-overlay").show(); $(".ui-widget-overlay").show();
//dialog.find(".ui-dialog-content").show();
dialog.data("isMinimized", false); dialog.data("isMinimized", false);
dialog.animate( dialog.animate(
{ {
height: "40px", height: "40px",
top: 0,
top: $(window).height() - 100 top: $(window).height() - 100
}, },
5 5

View File

@ -458,6 +458,12 @@ class Manager implements PublicLogin
$this->publicLink $this->publicLink
); );
if ((bool) $this->dashboardFields['date_range'] === true) {
$dateFrom = $this->dashboardFields['date_from'];
$dateTo = $this->dashboardFields['date_to'];
$instance->setDateRange($dateFrom, $dateTo);
}
return $instance; return $instance;
} }
@ -1041,6 +1047,8 @@ class Manager implements PublicLogin
$id_group = \get_parameter('id_group'); $id_group = \get_parameter('id_group');
$slideshow = \get_parameter_switch('slideshow'); $slideshow = \get_parameter_switch('slideshow');
$favourite = \get_parameter_switch('favourite'); $favourite = \get_parameter_switch('favourite');
$dateRange = \get_parameter_switch('date_range');
$dateData = \get_parameter_date('range', '', 'U');
$id_user = (empty($private) === false) ? $config['id_user'] : ''; $id_user = (empty($private) === false) ? $config['id_user'] : '';
@ -1050,6 +1058,9 @@ class Manager implements PublicLogin
'id_group' => $id_group, 'id_group' => $id_group,
'cells_slideshow' => $slideshow, 'cells_slideshow' => $slideshow,
'active' => $favourite, 'active' => $favourite,
'date_range' => $dateRange,
'date_from' => $dateData['date_init'],
'date_to' => $dateData['date_end'],
]; ];
if ($this->dashboardId === 0) { if ($this->dashboardId === 0) {

View File

@ -51,6 +51,20 @@ class Widget
*/ */
private $showSelectNodeMeta; private $showSelectNodeMeta;
/**
* Date from init for filter widget.
*
* @var integer
*/
private $dateFrom;
/**
* Date from end for filter widget.
*
* @var integer
*/
private $dateTo;
/** /**
* Contructor widget. * Contructor widget.
@ -824,4 +838,41 @@ class Widget
} }
/**
* Set the date range of parent configuration.
*
* @param integer $dateFrom Date from init for filter widget.
* @param integer $dateTo Date from end for filter widget.
*
* @return void
*/
public function setDateRange(int $dateFrom, int $dateTo)
{
$this->dateFrom = $dateFrom;
$this->dateTo = $dateTo;
}
public function getDateFrom()
{
return $this->dateFrom;
}
public function getDateTo()
{
return $this->dateTo;
}
public function getPeriod():mixed
{
if (empty($this->dateFrom) === false && empty($this->dateTo) === false) {
return ($this->dateTo - $this->dateFrom);
} else {
return null;
}
}
} }

View File

@ -637,6 +637,10 @@ class BasicChart extends Widget
$color_status = $this->values['colorValue']; $color_status = $this->values['colorValue'];
} }
if (empty(parent::getPeriod()) === false) {
$this->values['period'] = parent::getPeriod();
}
$params = [ $params = [
'agent_module_id' => $this->values['moduleId'], 'agent_module_id' => $this->values['moduleId'],
'period' => $this->values['period'], 'period' => $this->values['period'],

View File

@ -520,6 +520,9 @@ class BlockHistogram extends Widget
global $config; global $config;
$size = parent::getSize(); $size = parent::getSize();
if (empty(parent::getPeriod()) === false) {
$this->values['period'] = parent::getPeriod();
}
// Desactive scroll bars only this item. // Desactive scroll bars only this item.
$id_agent = $data['agent_id']; $id_agent = $data['agent_id'];

View File

@ -473,6 +473,10 @@ class DataMatrix extends Widget
return $output; return $output;
} }
if (empty(parent::getPeriod()) === false) {
$this->values['period'] = parent::getPeriod();
}
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$modules_nodes = array_reduce( $modules_nodes = array_reduce(
$this->values['moduleDataMatrix'], $this->values['moduleDataMatrix'],

View File

@ -472,6 +472,10 @@ class CustomGraphWidget extends Widget
$size = parent::getSize(); $size = parent::getSize();
if (empty(parent::getPeriod()) === false) {
$this->values['period'] = parent::getPeriod();
}
switch ($this->values['type']) { switch ($this->values['type']) {
case CUSTOM_GRAPH_STACKED_LINE: case CUSTOM_GRAPH_STACKED_LINE:
case CUSTOM_GRAPH_STACKED_AREA: case CUSTOM_GRAPH_STACKED_AREA:

View File

@ -838,6 +838,7 @@ class EventsListWidget extends Widget
'mini_severity' => __('Severity mini'), 'mini_severity' => __('Severity mini'),
'module_custom_id' => __('Module custom ID'), 'module_custom_id' => __('Module custom ID'),
'custom_data' => __('Custom data'), 'custom_data' => __('Custom data'),
'event_custom_id' => __('Event Custom ID'),
]; ];
} }

View File

@ -302,6 +302,10 @@ class GraphModuleHistogramWidget extends Widget
$values['period'] = SECONDS_1DAY; $values['period'] = SECONDS_1DAY;
} }
if (empty(parent::getPeriod()) === false) {
$this->values['period'] = parent::getPeriod();
}
if (isset($values['sizeLabel']) === false) { if (isset($values['sizeLabel']) === false) {
$values['sizeLabel'] = 30; $values['sizeLabel'] = 30;
} }

View File

@ -309,6 +309,12 @@ class Netflow extends Widget
$start_date = (time() - $this->values['period']); $start_date = (time() - $this->values['period']);
$end_date = time(); $end_date = time();
if (empty(parent::getPeriod()) === false) {
$start_date = parent::getDateFrom();
$end_date = parent::getDateTo();
}
if ($this->values['chart_type'] === 'usage_map') { if ($this->values['chart_type'] === 'usage_map') {
$map_data = netflow_build_map_data( $map_data = netflow_build_map_data(
$start_date, $start_date,

View File

@ -135,8 +135,6 @@ class SecurityHardening extends Widget
// Includes. // Includes.
include_once ENTERPRISE_DIR.'/include/functions_security_hardening.php'; include_once ENTERPRISE_DIR.'/include/functions_security_hardening.php';
include_once $config['homedir'].'/include/graphs/fgraph.php'; include_once $config['homedir'].'/include/graphs/fgraph.php';
include_once $config['homedir'].'/include/functions_graph.php';
// WARNING: Do not edit. This chunk must be in the constructor. // WARNING: Do not edit. This chunk must be in the constructor.
parent::__construct( parent::__construct(
$cellId, $cellId,
@ -328,6 +326,11 @@ class SecurityHardening extends Widget
$id_groups = $this->checkAcl($values['group']); $id_groups = $this->checkAcl($values['group']);
$output .= '<b>'.$this->elements[$data_type].'</b>'; $output .= '<b>'.$this->elements[$data_type].'</b>';
if (empty(parent::getPeriod()) === false) {
$values['date_init'] = parent::getDateFrom();
$values['date_end'] = parent::getDateTo();
}
switch ($data_type) { switch ($data_type) {
case 'top_n_agents_sh': case 'top_n_agents_sh':
$output .= $this->loadTopNAgentsSh($id_groups, $values['limit']); $output .= $this->loadTopNAgentsSh($id_groups, $values['limit']);

View File

@ -440,6 +440,10 @@ class SingleGraphWidget extends Widget
$module_name = \modules_get_agentmodule_name($this->values['moduleId']); $module_name = \modules_get_agentmodule_name($this->values['moduleId']);
$units_name = \modules_get_unit($this->values['moduleId']); $units_name = \modules_get_unit($this->values['moduleId']);
if (empty(parent::getPeriod()) === false) {
$this->values['period'] = parent::getPeriod();
}
$trickHight = 0; $trickHight = 0;
if ($this->values['showLegend'] === 1) { if ($this->values['showLegend'] === 1) {
// Needed for legend. // Needed for legend.

View File

@ -459,6 +459,9 @@ class SLAPercentWidget extends Widget
global $config; global $config;
$size = parent::getSize(); $size = parent::getSize();
if (empty(parent::getPeriod()) === false) {
$this->values['period'] = parent::getPeriod();
}
$output .= ''; $output .= '';
$id_agent = $this->values['agentId']; $id_agent = $this->values['agentId'];

View File

@ -374,6 +374,10 @@ class TopNWidget extends Widget
$size = parent::getSize(); $size = parent::getSize();
if (empty(parent::getPeriod()) === false) {
$this->values['period'] = parent::getPeriod();
}
$quantity = $this->values['quantity']; $quantity = $this->values['quantity'];
$period = $this->values['period']; $period = $this->values['period'];
@ -420,6 +424,20 @@ class TopNWidget extends Widget
// Prevent double safe input in agents_get_group_agents function. // Prevent double safe input in agents_get_group_agents function.
$agentRegex = io_safe_output($agentRegex); $agentRegex = io_safe_output($agentRegex);
// Validate regex.
if (@preg_match('/'.$agentRegex.'/', '') === false
|| @preg_match('/'.$this->values['module'].'/', '') === false
) {
$output .= '<div class="container-center">';
$output .= \ui_print_info_message(
__('Invalid regex'),
'',
true
);
$output .= '</div>';
return $output;
}
// This function check ACL. // This function check ACL.
$agents = @agents_get_group_agents(0, ['aliasRegex' => $agentRegex]); $agents = @agents_get_group_agents(0, ['aliasRegex' => $agentRegex]);
$agentsId = \array_keys($agents); $agentsId = \array_keys($agents);

View File

@ -1120,7 +1120,10 @@ class Manager
} }
$onheader = []; $onheader = [];
if (users_is_admin() === true) {
$onheader['configure'] = $setup_tab; $onheader['configure'] = $setup_tab;
}
$onheader['dashboard'] = $dashboard_tab; $onheader['dashboard'] = $dashboard_tab;
$onheader['list'] = $list_tab; $onheader['list'] = $list_tab;
if ($idIncidence !== 0) { if ($idIncidence !== 0) {

View File

@ -6,6 +6,10 @@ div#bullets_modules span {
font-weight: 700; font-weight: 700;
} }
div.bullets_modules span {
font-weight: 700;
}
div.agent_details_agent_caption { div.agent_details_agent_caption {
flex: 1; flex: 1;
} }

View File

@ -538,3 +538,7 @@ div.container-filter-buttons {
.ui-state-active { .ui-state-active {
border-radius: 0px !important; border-radius: 0px !important;
} }
.ui-dialog.modal-sound .ui-widget-header {
display: flex !important;
}

View File

@ -46,15 +46,10 @@
} }
.ui-dialog .ui-dialog-titlebar-minimize { .ui-dialog .ui-dialog-titlebar-minimize {
position: absolute; position: relative;
right: 1.5em;
width: 21px;
margin: 0px 0 0 0;
padding: 1px;
height: 20px; height: 20px;
bottom: 30%; width: 20px;
top: 2em; margin-right: 1px;
background-color: #fff !important;
} }
.ui-dialog .ui-dialog-titlebar-minimize:hover { .ui-dialog .ui-dialog-titlebar-minimize:hover {
@ -63,16 +58,9 @@
.ui-dialog .ui-dialog-titlebar-disengage { .ui-dialog .ui-dialog-titlebar-disengage {
position: relative; position: relative;
right: 1.5em;
width: 21px;
margin: 0px 0 0 0;
padding: 1px;
height: 20px; height: 20px;
bottom: 30%; width: 20px;
background-color: #fff !important; margin-right: 5px;
-ms-transform: scale(1.2);
-webkit-transform: scale(1.2);
transform: scale(1.2);
} }
.ui-dialog .ui-dialog-titlebar-disengage:hover { .ui-dialog .ui-dialog-titlebar-disengage:hover {

View File

@ -6043,18 +6043,18 @@ div.switch_radio_button label:last-of-type {
margin-top: -2px; margin-top: -2px;
} }
/*
div#bullets_modules {
display: flex;
margin-left: 2em;
}
*/
div#bullets_modules div { div#bullets_modules div {
display: flex; display: flex;
align-items: center; align-items: center;
margin: 0 5px; margin: 0 5px;
} }
div.bullets_modules div {
display: flex;
align-items: center;
margin: 0 10px;
}
.orange_background { .orange_background {
background: #ffa631; background: #ffa631;
} }
@ -6225,7 +6225,7 @@ div#status_pie {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
padding: 20px; padding: 20px;
padding-bottom: 0; padding-bottom: 1%;
} }
.agent_details_content_cluster { .agent_details_content_cluster {
@ -6315,6 +6315,7 @@ div#status_pie {
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 100%;
} }
.agent_details_agent_data { .agent_details_agent_data {
@ -6344,23 +6345,45 @@ div#status_pie {
justify-content: flex-start; justify-content: flex-start;
} }
.agent_details_bullets .bullets_modules {
display: flex;
justify-content: flex-start;
}
.agent_details_bullets_cluster #bullets_modules { .agent_details_bullets_cluster #bullets_modules {
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
flex-direction: column; flex-direction: column;
} }
.agent_details_bullets_cluster .bullets_modules {
display: flex;
justify-content: flex-start;
flex-direction: column;
}
.agent_details_bullets_cluster #bullets_modules > div { .agent_details_bullets_cluster #bullets_modules > div {
padding: 0px; padding: 0px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.agent_details_bullets_cluster .bullets_modules > div {
padding: 0px;
margin-bottom: 10px;
}
.agent_details_bullets #bullets_modules > div { .agent_details_bullets #bullets_modules > div {
display: flex; display: flex;
align-items: center; align-items: center;
padding-bottom: 20px; padding-bottom: 20px;
} }
.agent_details_bullets .bullets_modules > div {
display: flex;
align-items: center;
padding-bottom: 20px;
}
#agent_contact_main tr td img { #agent_contact_main tr td img {
max-width: 100%; max-width: 100%;
} }
@ -6412,6 +6435,11 @@ div#status_pie {
float: right; float: right;
} }
.white_table_graph_header div.bullets_modules {
display: flex;
float: right;
}
.white_table_graph_header img, .white_table_graph_header img,
.white_table_graph_header span { .white_table_graph_header span {
vertical-align: middle; vertical-align: middle;
@ -10809,6 +10837,13 @@ button div.fail {
-webkit-mask: url(../../images/fail@svg.svg) no-repeat center / contain; -webkit-mask: url(../../images/fail@svg.svg) no-repeat center / contain;
} }
button div.refresh {
mask: url(../../images/refresh@svg.svg) no-repeat center / contain;
-webkit-mask: url(../../images/refresh@svg.svg) no-repeat center / contain;
width: 22px;
height: 22px;
}
button div.force { button div.force {
mask: url(../../images/force@svg.svg) no-repeat center / contain; mask: url(../../images/force@svg.svg) no-repeat center / contain;
-webkit-mask: url(../../images/force@svg.svg) no-repeat center / contain; -webkit-mask: url(../../images/force@svg.svg) no-repeat center / contain;
@ -12753,6 +12788,10 @@ div.agents_custom_fields #datatables_wrapper div.bottom {
justify-content: flex-start !important; justify-content: flex-start !important;
} }
.alert_view_calendar > .fc-view-harness > .fc-view > .fc-scrollgrid {
width: auto !important;
}
.title_tactical { .title_tactical {
padding: 10px 0px 10px 0px; padding: 10px 0px 10px 0px;
text-align: center; text-align: center;
@ -12831,3 +12870,16 @@ tr.shown td.details-control {
position: absolute; position: absolute;
margin-left: 5px; margin-left: 5px;
} }
.disengage-buttom-image {
background-color: rgb(51, 51, 51);
mask: url(../../images/desacoplar-ventana.svg) no-repeat right / contain;
-webkit-mask: url(../../images/desacoplar-ventana.svg) no-repeat right /
contain;
}
.minimize-buttom-image {
background-color: rgb(51, 51, 51);
mask: url(../../images/minimizar.svg) no-repeat right / contain;
-webkit-mask: url(../../images/minimizar.svg) no-repeat right / contain;
}

View File

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

View File

@ -102,17 +102,37 @@ $agentCountModules = html_print_div(
$table_status = new stdClass(); $table_status = new stdClass();
$table_status->id = 'agent_status_main'; $table_status->id = 'agent_status_main';
$table_status->width = '100%'; $table_status->width = '90%';
$table_status->height = 'auto';
$table_status->cellspacing = 0; $table_status->cellspacing = 0;
$table_status->cellpadding = 0; $table_status->cellpadding = 0;
$table_status->class = 'floating_form'; $table_status->class = 'floating_form';
$table_status->style[0] = 'height: 32px; width: 30%; padding-right: 5px; text-align: end; vertical-align: top'; $table_status->style[0] = 'height: 28px; width: 30%; padding-right: 5px; text-align: end; vertical-align: top';
$table_status->style[1] = 'height: 32px; width: 70%; padding-left: 5px; font-weight: lighter; vertical-align: top'; $table_status->style[1] = 'height: 28px; width: 70%; padding-left: 5px; font-weight: lighter; vertical-align: top';
$table_status->data['agent_os'][0] = __('OS');
$agentOS = []; $os_agent_text = '';
$agentOS[] = html_print_div([ 'content' => (empty($agent['os_version']) === true) ? get_os_name((int) $agent['id_os']) : $agent['os_version']], true); $os_name = get_os_name((int) $agent['id_os']);
$agentOS[] = html_print_div([ 'style' => 'width: 16px;padding-left: 5px', 'content' => ui_print_os_icon($agent['id_os'], false, true, true, false, false, false, ['width' => '16px'])], true); if (empty($agent['os_version']) !== true) {
$table_status->data['agent_os'][1] = html_print_div(['class' => 'agent_details_agent_data', 'content' => implode('', $agentOS)], true); $agent['os_version'] = io_safe_output($agent['os_version']);
if (strpos($agent['os_version'], '(') !== false) {
$os_name = preg_split('/[0-9]|[\(]/', $agent['os_version'])[0];
$os_version = explode($os_name, explode('(', $agent['os_version'])[0])[1];
$os_version_name = preg_split('/[\(]|[\)]/', $agent['os_version']);
$os_agent_text = $os_version.' ('.$os_version_name[1].')';
} else {
$os_name = preg_split('/[0-9]/', $agent['os_version'])[0];
$os_version = explode($os_name, explode('(', $agent['os_version'])[0])[1];
$os_agent_text = $os_version;
}
}
$table_status->data['agent_os'][0] = html_print_div([ 'style' => 'width: 16px; position: relative; left: 75%', 'content' => ui_print_os_icon($agent['id_os'], false, true, true, false, false, false, ['width' => '16px'])], true);
$table_status->data['agent_os'][1] = $os_name;
if (empty($agent['os_version']) !== true) {
$table_status->data['agent_os_version'][0] = __('OS Version');
$table_status->data['agent_os_version'][1] = $os_agent_text;
}
$addresses = agents_get_addresses($id_agente); $addresses = agents_get_addresses($id_agente);
$address = agents_get_address($id_agente); $address = agents_get_address($id_agente);
@ -124,43 +144,48 @@ foreach ($addresses as $k => $add) {
} }
if (empty($address) === false) { if (empty($address) === false) {
$address_text = '<span class="bolder" >'.$address.'</span>';
if (!empty($addresses) === true) {
foreach ($addresses as $sec_address) {
$address_text .= '<br/><span class="italic">'.$sec_address.'</span>';
}
}
$table_status->data['ip_address'][0] = __('IP address'); $table_status->data['ip_address'][0] = __('IP address');
$table_status->data['ip_address'][1] = (empty($address) === true) ? '<em>'.__('N/A').'</em>' : $address; $table_status->data['ip_address'][1] = (empty($address) === true) ? '<em>'.__('N/A').'</em>' : $address_text;
} }
$table_status->data['agent_version'][0] = __('Agent Version'); $table_status->data['agent_version'][0] = __('Agent Version');
$table_status->data['agent_version'][1] = (empty($agent['agent_version']) === true) ? '<i>'.__('N/A').'</i>' : $agent['agent_version']; $table_status->data['agent_version'][1] = (empty($agent['agent_version']) === true) ? '<i>'.__('N/A').'</i>' : $agent['agent_version'];
$table_status->data['description'][0] = __('Description'); $table_status->data['description'][0] = __('Description');
$table_status->data['description'][1] = (empty($agent['comentarios']) === true) ? '<em>'.__('N/A').'</em>' : $agent['comentarios']; $table_status->data['description'][1] = (empty($agent['comentarios']) === true) ? '<em>'.__('N/A').'</em>' : ui_print_truncate_text($agent['comentarios'], 'description', true);
$has_remote_conf = enterprise_hook( $agentEventsHeader = html_print_div(
'config_agents_has_remote_configuration', [
[$agent['id_agente']] 'class' => 'agent_details_header',
'content' => '<span class="subsection_header_title">'.__('Events (Last 24h)').'</span>',
],
true
); );
if ((bool) $has_remote_conf) { $agentEventsGraph = html_print_div(
$table_status->data['remote_config'][0] = __('Remote configuration'); [
$table_status->data['remote_config'][1] = __('Enabled'); 'class' => 'white-table-graph-content',
'content' => graph_graphic_agentevents(
$satellite_server = (int) db_get_value_filter( $id_agente,
'satellite_server', 95,
'tagente', 50,
['id_agente' => $id_agente] SECONDS_1DAY,
); '',
true,
if (empty($satellite_server) === false) { true,
$satellite_name = db_get_value_filter( 500
'name', ),
'tserver', 'style' => 'margin-top: -25px',
['id_server' => $satellite_server] ],
); true
);
$table_status->data['remote_config'][0] = __('Satellite server');
$table_status->data['remote_config'][1] = $satellite_name;
}
}
$table_agent = $agentStatusHeader.' $table_agent = $agentStatusHeader.'
<div class="agent_details_content"> <div class="agent_details_content">
@ -170,6 +195,9 @@ $table_agent = $agentStatusHeader.'
<div class="agent_details_info"> <div class="agent_details_info">
'.$alive_animation.html_print_table($table_status, true).' '.$alive_animation.html_print_table($table_status, true).'
</div> </div>
</div>
<div class="agent_details_graph">
'.$agentEventsHeader.$agentEventsGraph.'
</div>'; </div>';
@ -189,11 +217,12 @@ $data_opcional->class = 'floating_form';
// Gis and url address. // Gis and url address.
$agentAdditionalContent = ''; $agentAdditionalContent = '';
// Position Information. // Position Information.
if ((bool) $config['activate_gis'] === true) { /*
if ((bool) $config['activate_gis'] === true) {
$dataPositionAgent = gis_get_data_last_position_agent( $dataPositionAgent = gis_get_data_last_position_agent(
$agent['id_agente'] $agent['id_agente']
); );
if (is_array($dataPositionAgent) === true && $dataPositionAgent['stored_longitude'] !== '' && $dataPositionAgent['stored_longitude'] !== '') { if (is_array($dataPositionAgent) === true && $dataPositionAgent['stored_longitude'] !== '' && $dataPositionAgent['stored_latitude'] !== '') {
$data_opcional->data['agent_position'][0] = __('Position (Long, Lat)'); $data_opcional->data['agent_position'][0] = __('Position (Long, Lat)');
$dataOptionalOutput = html_print_anchor( $dataOptionalOutput = html_print_anchor(
@ -210,10 +239,11 @@ if ((bool) $config['activate_gis'] === true) {
$data_opcional->data['agent_position'][1] = $dataOptionalOutput; $data_opcional->data['agent_position'][1] = $dataOptionalOutput;
} }
} }*/
// If the url description is set. // If the url description is set.
if (empty($agent['url_address']) === false) { /*
if (empty($agent['url_address']) === false) {
$data_opcional->data['url_address'][0] = __('Url address'); $data_opcional->data['url_address'][0] = __('Url address');
$data_opcional->data['url_address'][1] = html_print_anchor( $data_opcional->data['url_address'][1] = html_print_anchor(
[ [
@ -222,11 +252,12 @@ if (empty($agent['url_address']) === false) {
], ],
true true
); );
} }*/
// Other IP address and timezone offset. // Other IP address and timezone offset.
if (empty($addresses) === false) { /*
if (empty($addresses) === false) {
$data_opcional->data['other_ip_address'][0] = __('Other IP addresses'); $data_opcional->data['other_ip_address'][0] = __('Other IP addresses');
$data_opcional->data['other_ip_address'][1] = html_print_div( $data_opcional->data['other_ip_address'][1] = html_print_div(
[ [
@ -235,13 +266,14 @@ if (empty($addresses) === false) {
], ],
true true
); );
} }
*/
// Timezone Offset. // Timezone Offset.
if ((int) $agent['timezone_offset'] !== 0) { /*
if ((int) $agent['timezone_offset'] !== 0) {
$data_opcional->data['timezone_offset'][0] = __('Timezone Offset'); $data_opcional->data['timezone_offset'][0] = __('Timezone Offset');
$data_opcional->data['timezone_offset'][1] = $agent['timezone_offset']; $data_opcional->data['timezone_offset'][1] = $agent['timezone_offset'];
} }*/
// Custom fields. // Custom fields.
$fields = db_get_all_rows_filter( $fields = db_get_all_rows_filter(
@ -485,39 +517,6 @@ $agentContact = html_print_div(
true true
); );
$agentEventsHeader = html_print_div(
[
'class' => 'agent_details_header',
'content' => '<span class="subsection_header_title">'.__('Events (Last 24h)').'</span>',
],
true
);
$agentEventsGraph = html_print_div(
[
'class' => 'white-table-graph-content',
'content' => graph_graphic_agentevents(
$id_agente,
95,
70,
SECONDS_1DAY,
'',
true,
true,
500
),
],
true
);
$agentEvents = html_print_div(
[
'class' => 'box-flat agent_details_col w50p',
'content' => $agentEventsHeader.$agentEventsGraph,
],
true
);
/* /*
* EVENTS TABLE END. * EVENTS TABLE END.
*/ */

View File

@ -130,6 +130,11 @@ $severity = get_parameter(
'filter[severity]', 'filter[severity]',
($filter['severity'] ?? '') ($filter['severity'] ?? '')
); );
$regex = get_parameter(
'filter[regex]',
(io_safe_output($filter['regex']) ?? '')
);
unset($filter['regex']);
$status = get_parameter( $status = get_parameter(
'filter[status]', 'filter[status]',
($filter['status'] ?? '') ($filter['status'] ?? '')
@ -378,6 +383,7 @@ if (is_ajax() === true) {
'te.owner_user', 'te.owner_user',
'if(te.ack_utimestamp > 0, te.ack_utimestamp,"") as ack_utimestamp', 'if(te.ack_utimestamp > 0, te.ack_utimestamp,"") as ack_utimestamp',
'te.custom_data', 'te.custom_data',
'te.event_custom_id',
'te.data', 'te.data',
'te.module_status', 'te.module_status',
'ta.alias as agent_name', 'ta.alias as agent_name',
@ -472,7 +478,7 @@ if (is_ajax() === true) {
$data = array_reduce( $data = array_reduce(
$events, $events,
function ($carry, $item) use ($table_id, &$redirection_form_id, $filter, $compact_date, $external_url, $compact_name_event) { function ($carry, $item) use ($table_id, &$redirection_form_id, $filter, $compact_date, $external_url, $compact_name_event, $regex) {
global $config; global $config;
$tmp = (object) $item; $tmp = (object) $item;
@ -1207,12 +1213,34 @@ if (is_ajax() === true) {
} }
} }
if (empty($tmp) === false && $regex !== '') {
$regex_validation = false;
foreach (json_decode(json_encode($tmp), true) as $key => $field) {
if (preg_match('/'.$regex.'/', $field)) {
$regex_validation = true;
}
}
if ($regex_validation === false) {
unset($tmp);
}
}
$carry[] = $tmp; $carry[] = $tmp;
return $carry; return $carry;
} }
); );
} }
$data = array_values(
array_filter(
$data,
function ($item) {
return (bool) (array) $item;
}
)
);
$count = count($data);
// RecordsTotal && recordsfiltered resultados totales. // RecordsTotal && recordsfiltered resultados totales.
echo json_encode( echo json_encode(
[ [
@ -1293,6 +1321,7 @@ if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false
$severity = $filter['severity']; $severity = $filter['severity'];
$status = $filter['status']; $status = $filter['status'];
$search = $filter['search']; $search = $filter['search'];
$regex = $filter['regex'];
$not_search = $filter['not_search']; $not_search = $filter['not_search'];
$text_agent = $filter['text_agent']; $text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent']; $id_agent = $filter['id_agent'];
@ -2057,6 +2086,12 @@ $in = '<div class="filter_input"><label>'.__('Severity').'</label>';
$in .= $data.'</div>'; $in .= $data.'</div>';
$inputs[] = $in; $inputs[] = $in;
// REGEX search datatable.
$in = '<div class="filter_input"><label>'.__('Regex search').ui_print_help_tip(__('Regular expresion to filter.'), true).'</label>';
$in .= html_print_input_text('regex', $regex, '', '', 255, true);
$in .= '</div>';
$inputs[] = $in;
// User private filter. // User private filter.
$inputs[] = html_print_input_hidden('private_filter_event', $private_filter_event, true); $inputs[] = html_print_input_hidden('private_filter_event', $private_filter_event, true);
// Trick view in table. // Trick view in table.
@ -3488,6 +3523,10 @@ $(document).ready( function() {
click_button_remove_tag("without"); click_button_remove_tag("without");
}); });
$('#myInputTextField').keyup(function(){
$("#table_events").search($(this).val()).draw() ;
});
$("#button-events_form_search_bt").click(function(){ $("#button-events_form_search_bt").click(function(){
show_events_graph(); show_events_graph();
}); });

View File

@ -6,7 +6,7 @@
%define debug_package %{nil} %define debug_package %{nil}
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231129 %define release 231201
# 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

@ -6,7 +6,7 @@
%define debug_package %{nil} %define debug_package %{nil}
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231129 %define release 231201
# 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.774 %define version 7.0NG.774
%define release 231129 %define release 231201
%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

@ -726,6 +726,7 @@ CREATE TABLE IF NOT EXISTS `tevento` (
`custom_data` TEXT, `custom_data` TEXT,
`data` TINYTEXT, `data` TINYTEXT,
`module_status` INT NOT NULL DEFAULT 0, `module_status` INT NOT NULL DEFAULT 0,
`event_custom_id` TEXT,
PRIMARY KEY (`id_evento`), PRIMARY KEY (`id_evento`),
KEY `idx_agente` (`id_agente`), KEY `idx_agente` (`id_agente`),
KEY `idx_agentmodule` (`id_agentmodule`), KEY `idx_agentmodule` (`id_agentmodule`),
@ -1271,6 +1272,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
`custom_data_filter_type` TINYINT UNSIGNED DEFAULT 0, `custom_data_filter_type` TINYINT UNSIGNED DEFAULT 0,
`owner_user` TEXT, `owner_user` TEXT,
`private_filter_user` TEXT, `private_filter_user` TEXT,
`regex` TEXT,
PRIMARY KEY (`id_filter`) PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
@ -2640,6 +2642,9 @@ CREATE TABLE IF NOT EXISTS `tdashboard` (
`active` TINYINT NOT NULL DEFAULT 0, `active` TINYINT NOT NULL DEFAULT 0,
`cells` INT UNSIGNED DEFAULT 0, `cells` INT UNSIGNED DEFAULT 0,
`cells_slideshow` TINYINT NOT NULL DEFAULT 0, `cells_slideshow` TINYINT NOT NULL DEFAULT 0,
`date_range` TINYINT NOT NULL DEFAULT 0,
`date_from` INT NOT NULL DEFAULT 0,
`date_to` INT NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
@ -3031,7 +3036,6 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` (
`module` TEXT, `module` TEXT,
`alert` TEXT, `alert` TEXT,
`criticity` TEXT, `criticity` TEXT,
`user_comment` TEXT,
`id_tag` TEXT, `id_tag` TEXT,
`name` TEXT, `name` TEXT,
`group_recursion` TEXT, `group_recursion` TEXT,
@ -3046,7 +3050,6 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` (
`operator_module` TEXT COMMENT 'Operator for module', `operator_module` TEXT COMMENT 'Operator for module',
`operator_alert` TEXT COMMENT 'Operator for alert', `operator_alert` TEXT COMMENT 'Operator for alert',
`operator_criticity` TEXT COMMENT 'Operator for criticity', `operator_criticity` TEXT COMMENT 'Operator for criticity',
`operator_user_comment` TEXT COMMENT 'Operator for user_comment',
`operator_id_tag` TEXT COMMENT 'Operator for id_tag', `operator_id_tag` TEXT COMMENT 'Operator for id_tag',
`operator_log_content` TEXT COMMENT 'Operator for log_content', `operator_log_content` TEXT COMMENT 'Operator for log_content',
`operator_log_source` TEXT COMMENT 'Operator for log_source', `operator_log_source` TEXT COMMENT 'Operator for log_source',

View File

@ -156,7 +156,8 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('gotty', '/usr/bin/gotty'), ('gotty', '/usr/bin/gotty'),
('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}'), ('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}'),
('server_unique_identifier', replace(uuid(),'-','')), ('server_unique_identifier', replace(uuid(),'-','')),
('lts_name', ''); ('lts_name', ''),
('lts_updates', 1);
UNLOCK TABLES; UNLOCK TABLES;
-- --
@ -1167,9 +1168,9 @@ INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field
INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`) VALUES (6,'Create&#x20;Pandora&#x20;ITSM&#x20;ticket',16); INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`) VALUES (6,'Create&#x20;Pandora&#x20;ITSM&#x20;ticket',16);
INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (7, 'Pandora&#x20;Google&#x20;chat', 17, "", "data=_data_", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "", 0, 0, "", "data=_data_", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", ""); INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (7, 'Pandora&#x20;Google&#x20;chat', 17, "", "data=_data_", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "", 0, 0, "", "data=_data_", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "");
INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (8, 'Pandora&#x20;Slack', 18, "data=_data_", "", ":red_circle:", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", 0, 0, "data=_data_", "", ":green_circle:", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", ""); INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (8, 'Pandora&#x20;Slack', 18, "data=_data_", "", ":red_circle:", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", 0, 0, "data=_data_", "", ":green_circle:", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "");
INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (9, 'Pandora&#x20;Telegram', 19, "", "[PANDORA] Alert FIRED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "", 0, 0, "", "[PANDORA] Alert RECOVERED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", ""); INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (9, 'Pandora&#x20;Telegram', 19, "", "[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_", "", "", "", "", "", "", "", "", 0, 0, "", "[PANDORA] Alert RECOVERED on _agent_ / _module_ / _timestamp_ / _data_", "", "", "", "", "", "", "", "");
INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (10, 'Pandora&#x20;ilert', 20, "alert", "", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "", 0, 0, "resolved", "", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", ""); INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (10, 'Pandora&#x20;ilert', 20, "alert", "", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "", 0, 0, "resolved", "", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "");
INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (11, 'Pandora&#x20;Vonage', 21, "", "[PANDORA] Alert FIRED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "", 0, 0, "", "[PANDORA] Alert RECOVERED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", ""); INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (11, 'Pandora&#x20;Vonage', 21, "", "[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_", "", "", "", "", "", "", "", "", 0, 0, "", "[PANDORA] Alert RECOVERED on _agent_ / _module_ / _timestamp_ / _data_", "", "", "", "", "", "", "", "");
-- alert templates (default) -- alert templates (default)

View File

@ -102,6 +102,31 @@ $inputs = [
], ],
], ],
], ],
[
'label' => __('Date range'),
'arguments' => [
'name' => 'date_range',
'id' => 'date_range',
'type' => 'switch',
'value' => $arrayDashboard['date_range'],
'onchange' => 'handle_date_range(this)',
],
],
[
'label' => __('Select range'),
'style' => 'display: none;',
'class' => 'row_date_range',
'arguments' => [
'name' => 'range',
'id' => 'range',
'selected' => ($arrayDashboard['date_from'] === '0' && $arrayDashboard['date_to'] === '0') ? 300 : 'chose_range',
'type' => 'date_range',
'date_init' => date('Y/m/d', $arrayDashboard['date_from']),
'time_init' => date('H:i:s', $arrayDashboard['date_from']),
'date_end' => date('Y/m/d', $arrayDashboard['date_to']),
'time_end' => date('H:i:s', $arrayDashboard['date_to']),
],
],
[ [
'block_id' => 'private', 'block_id' => 'private',
'direct' => 1, 'direct' => 1,
@ -135,3 +160,30 @@ HTML::printForm(
'inputs' => $inputs, 'inputs' => $inputs,
] ]
); );
?>
<script>
function handle_date_range(element){
if(element.checked) {
$(".row_date_range").show();
var def_state_range = $('#range_range').is(':visible');
var def_state_default = $('#range_default').is(':visible');
var def_state_extend = $('#range_extend').is(':visible');
if (
def_state_range === false
&& def_state_default === false
&& def_state_extend === false
&& $('#range').val() !== 'chose_range'
) {
$('#range_default').show();
} else if ($('#range').val() === 'chose_range') {
$('#range_range').show();
}
} else {
$(".row_date_range").hide();
}
}
var date_range = $("#date_range")[0];
handle_date_range(date_range);
</script>

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.774-231129 Version: 7.0NG.774-231201
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.774-231129" pandora_version="7.0NG.774-231201"
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.774"; my $pandora_version = "7.0NG.774";
my $pandora_build = "231129"; my $pandora_build = "231201";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -4304,6 +4304,7 @@ sub pandora_event {
my $utimestamp = time (); my $utimestamp = time ();
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime ($utimestamp)); my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime ($utimestamp));
my $event_custom_id = undef;
$id_agentmodule = 0 unless defined ($id_agentmodule); $id_agentmodule = 0 unless defined ($id_agentmodule);
# Validate events with the same event id # Validate events with the same event id
@ -4321,6 +4322,7 @@ sub pandora_event {
logger($pa_config, "Keeping In process status from last event with extended id '$id_extra'.", 10); logger($pa_config, "Keeping In process status from last event with extended id '$id_extra'.", 10);
$ack_utimestamp = get_db_value ($dbh, 'SELECT ack_utimestamp FROM tevento WHERE id_extra=? AND estado=2', $id_extra); $ack_utimestamp = get_db_value ($dbh, 'SELECT ack_utimestamp FROM tevento WHERE id_extra=? AND estado=2', $id_extra);
$event_status = 2; $event_status = 2;
$event_custom_id = get_db_value ($dbh, 'SELECT event_custom_id FROM tevento WHERE id_extra=? AND estado=2', $id_extra);
} }
} }
@ -4332,8 +4334,8 @@ sub pandora_event {
# Create the event # Create the event
logger($pa_config, "Generating event '$evento' for agent ID $id_agente module ID $id_agentmodule.", 10); logger($pa_config, "Generating event '$evento' for agent ID $id_agente module ID $id_agentmodule.", 10);
$event_id = db_insert ($dbh, 'id_evento','INSERT INTO tevento (id_agente, id_grupo, evento, timestamp, estado, utimestamp, event_type, id_agentmodule, id_alert_am, criticity, tags, source, id_extra, id_usuario, critical_instructions, warning_instructions, unknown_instructions, ack_utimestamp, custom_data, data, module_status) $event_id = db_insert ($dbh, 'id_evento','INSERT INTO tevento (id_agente, id_grupo, evento, timestamp, estado, utimestamp, event_type, id_agentmodule, id_alert_am, criticity, tags, source, id_extra, id_usuario, critical_instructions, warning_instructions, unknown_instructions, ack_utimestamp, custom_data, data, module_status, event_custom_id)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id_agente, $id_grupo, safe_input ($evento), $timestamp, $event_status, $utimestamp, $event_type, $id_agentmodule, $id_alert_am, $severity, $module_tags, $source, $id_extra, $user_name, $critical_instructions, $warning_instructions, $unknown_instructions, $ack_utimestamp, $custom_data, safe_input($module_data), $module_status); VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id_agente, $id_grupo, safe_input ($evento), $timestamp, $event_status, $utimestamp, $event_type, $id_agentmodule, $id_alert_am, $severity, $module_tags, $source, $id_extra, $user_name, $critical_instructions, $warning_instructions, $unknown_instructions, $ack_utimestamp, $custom_data, safe_input($module_data), $module_status, $event_custom_id);
if(defined($event_id) && $comment ne '') { if(defined($event_id) && $comment ne '') {
my $comment_id = db_insert ($dbh, 'id','INSERT INTO tevent_comment (id_event, utimestamp, comment, id_user, action) my $comment_id = db_insert ($dbh, 'id','INSERT INTO tevent_comment (id_event, utimestamp, comment, id_user, action)

View File

@ -181,17 +181,21 @@ sub data_consumer ($$) {
AND tagent_module_inventory.id_module_inventory = tmodule_inventory.id_module_inventory', AND tagent_module_inventory.id_module_inventory = tmodule_inventory.id_module_inventory',
$module_id); $module_id);
# No code to run my $command;
return if ($module->{'interpreter'} eq '');
# Save script in a temporary file
my ($fh, $temp_file) = tempfile(); my ($fh, $temp_file) = tempfile();
if ($module->{'script_mode'} == '1') {
my $script_file = $module->{'script_path'};
$command = $module->{'interpreter'} . ' ' . $script_file . ' "' . $module->{'target'} . '"';
} else {
# Save script in a temporary file
$fh->print (decode_base64($module->{'code'})); $fh->print (decode_base64($module->{'code'}));
close ($fh); close ($fh);
set_file_permissions($pa_config, $temp_file, "0777"); set_file_permissions($pa_config, $temp_file, "0777");
# Run the script # Run the script
my $command = $module->{'interpreter'} . ' ' . $temp_file . ' "' . $module->{'target'} . '"'; $command = $module->{'interpreter'} . ' ' . $temp_file . ' "' . $module->{'target'} . '"';
}
# Try to read the custom fields to use them as arguments into the command # Try to read the custom fields to use them as arguments into the command
if (defined($module->{'custom_fields'}) && $module->{'custom_fields'} ne '') { if (defined($module->{'custom_fields'}) && $module->{'custom_fields'} ne '') {
@ -206,7 +210,11 @@ sub data_consumer ($$) {
if (!defined ($decoded_cfields)) { if (!defined ($decoded_cfields)) {
logger ($pa_config, "Remote inventory module ".$module->{'name'}." has failed because the custom fields can't be read", 6); logger ($pa_config, "Remote inventory module ".$module->{'name'}." has failed because the custom fields can't be read", 6);
if ($module->{'script_mode'} == '2') {
unlink ($temp_file); unlink ($temp_file);
}
return; return;
} }
@ -237,11 +245,18 @@ sub data_consumer ($$) {
# Check for errors # Check for errors
if ($? != 0) { if ($? != 0) {
logger ($pa_config, "Remote inventory module ".$module->{'name'}." has failed with error level $?", 6); logger ($pa_config, "Remote inventory module ".$module->{'name'}." has failed with error level $?", 6);
if ($module->{'script_mode'} == '2') {
unlink ($temp_file); unlink ($temp_file);
}
return; return;
} }
if ($module->{'script_mode'} == '2') {
unlink ($temp_file); unlink ($temp_file);
}
my $utimestamp = time (); my $utimestamp = time ();
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime ($utimestamp)); my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime ($utimestamp));
eval { eval {

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.774"; my $pandora_version = "7.0NG.774";
my $pandora_build = "231129"; my $pandora_build = "231201";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -7,7 +7,7 @@
%define debug_package %{nil} %define debug_package %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231129 %define release 231201
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.774 %define version 7.0NG.774
%define release 231129 %define release 231201
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

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

View File

@ -38,7 +38,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.774 Build 231129"; my $version = "7.0NG.774 Build 231201";
# 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.774 Build 231129"; my $version = "7.0NG.774 Build 231201";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);
@ -201,6 +201,7 @@ sub help_screen{
help_screen_line('--disable_double_auth', '<user_name>', 'Disable the double authentication for the specified user'); help_screen_line('--disable_double_auth', '<user_name>', 'Disable the double authentication for the specified user');
print "\nEVENTS:\n\n" unless $param ne ''; print "\nEVENTS:\n\n" unless $param ne '';
help_screen_line('--create_event', "<event> <event_type> <group_name> [<agent_name> <module_name>\n\t <event_status> <severity> <template_name> <user_name> <comment> \n\t <source> <id_extra> <tags> <custom_data_json> <force_create_agent> \n\t <critical_instructions> <warning_instructions> <unknown_instructions> <use_alias>]", 'Add event'); help_screen_line('--create_event', "<event> <event_type> <group_name> [<agent_name> <module_name>\n\t <event_status> <severity> <template_name> <user_name> <comment> \n\t <source> <id_extra> <tags> <custom_data_json> <force_create_agent> \n\t <critical_instructions> <warning_instructions> <unknown_instructions> <use_alias>]", 'Add event');
help_screen_line('--update_event_custom_id', "<event> <event_custom_id>", 'Update Event Custom ID');
help_screen_line('--validate_event', "<agent_name> <module_name> <datetime_min> <datetime_max>\n\t <user_name> <criticity> <template_name> [<use_alias>]", 'Validate events'); help_screen_line('--validate_event', "<agent_name> <module_name> <datetime_min> <datetime_max>\n\t <user_name> <criticity> <template_name> [<use_alias>]", 'Validate events');
help_screen_line('--validate_event_id', '<event_id>', 'Validate event given a event id'); help_screen_line('--validate_event_id', '<event_id>', 'Validate event given a event id');
help_screen_line('--get_event_info', '<event_id>[<csv_separator>]', 'Show info about a event given a event id'); help_screen_line('--get_event_info', '<event_id>[<csv_separator>]', 'Show info about a event given a event id');
@ -4549,6 +4550,17 @@ sub cli_create_event() {
} }
} }
##############################################################################
# Update event custom id
# Related option: --update_event_custom_id
##############################################################################
sub cli_update_event_custom_id() {
my ($id_event, $event_custom_id) = @ARGV[2..3];
my $result = api_call(\%conf, 'set', 'event_custom_id', $id_event, $event_custom_id);
print "\n$result\n";
}
############################################################################## ##############################################################################
# Validate event. # Validate event.
# Related option: --validate_event # Related option: --validate_event
@ -8335,6 +8347,10 @@ sub pandora_manage_main ($$$) {
param_check($ltotal, 4, 0); param_check($ltotal, 4, 0);
cli_insert_gis_data(); cli_insert_gis_data();
} }
elsif ($param eq '--update_event_custom_id'){
param_check($ltotal, 2);
cli_update_event_custom_id();
}
else { else {
print_log "[ERROR] Invalid option '$param'.\n\n"; print_log "[ERROR] Invalid option '$param'.\n\n";
$param = ''; $param = '';