Merge branch 'develop' into ent-11494-nuevo-widget-service-level-detail

This commit is contained in:
miguel angel rasteu 2023-12-01 10:34:43 +01:00
commit 41b92cc55f
86 changed files with 1234 additions and 306 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.774-231129
Version: 7.0NG.774-231201
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# 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."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef;
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
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.774"
PI_BUILD="231129"
PI_BUILD="231201"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{231129}
{231201}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#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_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
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"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.774-231129
Version: 7.0NG.774-231201
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -1,10 +1,25 @@
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
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 `tevent_filter`
ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`;
-- Update macros for plugin 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;
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;

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_agents.php';
require_once $config['homedir'].'/include/functions_servers.php';
require_once $config['homedir'].'/include/functions_macros.php';
$search_string = get_parameter('search_string');
@ -949,7 +950,23 @@ if ($modules !== false) {
);
if (strlen($module['ip_target']) !== 0) {
$title .= '<br/>IP: '.$module['ip_target'];
// 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'];
}
}
} else {
$title .= '<br/>IP: '.$module['ip_target'];
}
}
// This module is initialized ? (has real 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_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();
} else {
paint_graph_values();
$("#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) {
$('#radius-warning_inverse').show();
$('#label-radius-warning_inverse').show();
@ -2027,17 +2018,6 @@ ui_require_jquery_file('json');
$('#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) {
$('#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'); ?>';
//if haven't error
if (max_w == 0 || max_w > min_w) {
if (max_c == 0 || max_c > min_c) {
paint_graph_status(
min_w, max_w, min_c, max_c, inverse_w,
inverse_c, error_w, error_c,
legend_normal, legend_warning, legend_critical,
message_error_warning, message_error_critical
);
if (max_w == 0 || max_w > min_w || $('#radius-percentage_warning').is(':checked') === true) {
if (max_c == 0 || max_c > min_c || $('#radius-percentage_critical').is(':checked') === true) {
error_c = 0;
error_w = 0;
} 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
);
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;
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
);
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(
min_w, max_w, min_c, max_c, inverse_w,
inverse_c, 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] .= 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] = '';
$table_conditions->data[] = $data;

View File

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

View File

@ -163,7 +163,10 @@ switch ($activeTab) {
$background_color = (string) get_parameter('background_color');
$width = (int) get_parameter('width');
$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');
$auto_adjust = (int) get_parameter('auto_adjust_sent');

View File

@ -860,8 +860,10 @@ if (empty($create) === false || empty($view) === false) {
if ($management_allowed === false) {
ui_print_warning_message(
__(
'This console is not manager of this environment,
please manage this feature from centralized manager console (Metaconsole).'
'This console is not manager of this environment, please manage this feature from feature from %s.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/servers/plugin_registration&tab=plugin_registration&pure=0'
).'">'.__('metaconsole').'</a>'
)
);
}

View File

@ -179,7 +179,7 @@ foreach ($servers as $server) {
}
$data[7] = '';
if ($server['queued_modules'] > 500) {
if ($server['queued_modules'] >= $config['number_modules_queue']) {
$data[7] .= '<div class="inline"><a onclick="show_dialog();" >'.html_print_image(
'images/info-warning.svg',
true,

View File

@ -187,7 +187,8 @@ $button_test .= '&nbsp;<span id="ITSM-message" class="invisible"></span>';
$row['control'] = html_print_label_input_block(
__('Test connection pandora to ITSM'),
$button_test
$button_test,
['div_class' => 'ITSM-remote-setup-ITSM_token']
);
$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(
__('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'),
html_print_input_text(
'general_network_path',
@ -733,7 +720,7 @@ $table->data[$i++][] = html_print_label_input_block(
);
$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
);
@ -766,6 +753,16 @@ $table->data[$i][] = html_print_label_input_block(
true
)
);
$table->data[$i++][] = html_print_label_input_block(
__('Number of modules in queue'),
html_print_input_number(
[
'name' => 'number_modules_queue',
'min' => 0,
'value' => $config['number_modules_queue'],
]
)
);
echo '<form class="max_floating_element_size" id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';

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)
);
$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">';
html_print_table($table);
html_print_input_hidden('update_config', 1);

View File

@ -61,7 +61,7 @@ $license = db_get_value(
);
if (isset($config['lts_updates']) === false) {
$config['lts_updates'] = false;
$config['lts_updates'] = 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':
include $config['homedir'].'/godmode/update_manager/update_manager.setup.php';
include $config['homedir'].'/godmode/update_manager/modal_lts_update.php';
break;
case 'offline':
$mode = \UpdateManager\UI\Manager::MODE_OFFLINE;
include $config['homedir'].'/godmode/um_client/index.php';
include $config['homedir'].'/godmode/update_manager/modal_lts_update.php';
break;
case 'online':
@ -163,5 +165,6 @@ switch ($tab) {
$mode = \UpdateManager\UI\Manager::MODE_ONLINE;
include $config['homedir'].'/godmode/um_client/index.php';
include $config['homedir'].'/godmode/update_manager/modal_lts_update.php';
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) {
$url_update_manager = get_parameter(
'url_update_manager',

View File

@ -424,8 +424,10 @@ if ($create_user === true) {
$values['data_section'] = $dashboard;
} else if (io_safe_output($values['section']) === HOME_SCREEN_VISUAL_CONSOLE) {
$values['data_section'] = $visual_console;
} else if ($values['section'] === HOME_SCREEN_OTHER || io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
$values['data_section'] = get_parameter('data_section');
} else if ($values['section'] === HOME_SCREEN_OTHER) {
$values['data_section'] = get_parameter('data_section_other');
} else if (io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
$values['data_section'] = get_parameter('data_section_external');
}
// $values['section'] = $homeScreenValues[$values['section']];
@ -722,8 +724,10 @@ if ($update_user) {
$values['data_section'] = $dashboard;
} else if (io_safe_output($values['section']) === HOME_SCREEN_VISUAL_CONSOLE) {
$values['data_section'] = $visual_console;
} else if ($values['section'] === HOME_SCREEN_OTHER || io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
$values['data_section'] = get_parameter('data_section');
} else if ($values['section'] === HOME_SCREEN_OTHER) {
$values['data_section'] = get_parameter('data_section_other');
} else if (io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
$values['data_section'] = get_parameter('data_section_external');
}
// $values['section'] = $homeScreenValues[$values['section']];

View File

@ -81,6 +81,11 @@ $customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select(
false,
'width: 100%'
);
// Home screen. Visual consoles.
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%');
// Home screen. External link and Other.
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section_external', $user_info['data_section'], '', 60, 255, true);
$customHomeScreenAddition[HOME_SCREEN_OTHER] = html_print_input_text('data_section_other', $user_info['data_section'], '', 60, 255, true);
$layouts = visual_map_get_user_layouts($config['id_user'], true);
$layouts_aux = [];

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);
$settings_modal = get_parameter('settings', 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);
// User private filter.
@ -313,6 +314,7 @@ if ($save_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status');
$values['search'] = get_parameter('search');
$values['regex'] = get_parameter('regex');
$values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent');
@ -381,6 +383,7 @@ if ($update_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status');
$values['search'] = get_parameter('search');
$values['regex'] = get_parameter('regex');
$values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent');
@ -640,6 +643,8 @@ function load_form_filter() {
$("#status").val(val);
if (i == 'search')
$('#text-search').val(val);
if (i == 'regex')
$('#text-regex').val(val);
if (i == 'not_search')
$('#checkbox-not_search').val(val);
if (i == 'text_agent')
@ -970,6 +975,7 @@ function save_new_filter() {
"severity" : $("#severity").val(),
"status" : $("#status").val(),
"search" : $("#text-search").val(),
"regex" : $('#text-regex').val(),
"not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(),
@ -1050,6 +1056,7 @@ function save_update_filter() {
"severity" : $("#severity").val(),
"status" : $("#status").val(),
"search" : $("#text-search").val(),
"regex" : $('#text-regex').val(),
"not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_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['time_from'] = date('H:i:s', $start);
$filter['time_to'] = date('H:i:s', $end);
$filter['severity'] = explode(',', $filter['severity']);
$data = events_get_all(
['te.*'],
$filter
@ -2754,6 +2763,52 @@ if ($draw_row_response_info === true) {
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) {
$filter = get_parameter('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_modules.php';
include_once $config['homedir'].'/include/functions_ui.php';
include_once $config['homedir'].'/include/functions_macros.php';
enterprise_include_once('include/functions_metaconsole.php');
$get_plugin_macros = get_parameter('get_plugin_macros');
@ -1206,7 +1207,23 @@ if (check_login()) {
);
if (strlen($module['ip_target']) !== 0) {
$title .= '<br/>IP: '.$module['ip_target'];
// 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'];
}
}
} else {
$title .= '<br/>IP: '.$module['ip_target'];
}
}
$last_status_change_text = __('Time elapsed since last status change: ');

View File

@ -2404,13 +2404,17 @@ class ConsoleSupervisor
{
global $config;
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) {
$this->notify(
[
'type' => 'NOTIF.API.ACCESS',
'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 {

View File

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

View File

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

View File

@ -1006,6 +1006,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.
*

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]);
$secondaryLinks = [];
if (empty($secondary_groups['for_select']) === true) {
$secondaryLinks[] = '<em>'.__('N/A').'</em>';
$secondaryLinks = [];
} else {
foreach ($secondary_groups['for_select'] as $id => $name) {
$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']),
],
true
);
).' '.ui_print_group_icon($agent['id_grupo'], true, '', 'margin-left: 2%;', true, false, false, '', true);
$table_contact->data[] = $data;
// Secondary groups.
$data = [];
$data[0] = '<b>'.__('Secondary groups').'</b>';
$data[1] = implode(', ', $secondaryLinks);
$table_contact->data[] = $data;
if (!empty($secondaryLinks) === true) {
$data[0] = '<b>'.__('Secondary groups').'</b>';
$data[1] = implode(', ', $secondaryLinks);
$table_contact->data[] = $data;
}
// Parent agent line.
if (enterprise_installed() === true) {
$data = [];
$data[0] = '<b>'.__('Parent').'</b>';
if ((int) $agent['id_parent'] === 0) {
$data[1] = '<em>'.__('N/A').'</em>';
} else {
if ((int) $agent['id_parent'] !== 0) {
$data = [];
$data[0] = '<b>'.__('Parent').'</b>';
$data[1] = html_print_anchor(
[
'href' => 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent['id_parent'],
@ -4834,9 +4834,9 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
],
true
);
}
$table_contact->data[] = $data;
$table_contact->data[] = $data;
}
}
// Last status change line.
@ -4845,6 +4845,44 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
$data[1] = $time_elapsed;
$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) {
// SecurityMon line.
$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(
[
'class' => 'agent_details_header',

View File

@ -13132,7 +13132,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
if ($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
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;
$ack_utimestamp = $val['ack_utimestamp'];
$values['id_usuario'] = $val['id_usuario'];
$values['event_custom_id'] = $val['event_custom_id'];
}
api_set_validate_event_by_id($val['id_evento']);
@ -13177,7 +13178,8 @@ function api_set_create_event($id, $trash1, $other, $returnType)
$custom_data,
$values['server_id'],
$values['id_extra'],
$ack_utimestamp
$ack_utimestamp,
$values['event_custom_id'] ?? null
);
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.
*

View File

@ -249,10 +249,6 @@ function config_update_config()
$error_update[] = __('Enable Netflow');
}
if (config_update_value('activate_sflow', (bool) get_parameter('activate_sflow'), true) === false) {
$error_update[] = __('Enable Sflow');
}
if (config_update_value('activate_feedback', (bool) get_parameter('activate_feedback'), true) === false) {
$error_update[] = __('Enable Feedback');
}
@ -371,6 +367,10 @@ function config_update_config()
$error_update[] = __('show_experimental_features');
}
if (config_update_value('number_modules_queue', get_parameter('number_modules_queue'), true) === false) {
$error_update[] = __('number_modules_queue');
}
if (config_update_value('console_log_enabled', get_parameter('console_log_enabled'), true) === false) {
$error_update[] = __('Console log enabled');
}
@ -1619,6 +1619,10 @@ function config_update_config()
if (config_update_value('netflow_get_ip_hostname', (int) get_parameter('netflow_get_ip_hostname'), true) === false) {
$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;
case 'sflow':
@ -2441,6 +2445,10 @@ function config_process_config()
config_update_value('show_experimental_features', 0);
}
if (!isset($config['number_modules_queue'])) {
config_update_value('number_modules_queue', 500);
}
if (!isset($config['agent_vulnerabilities'])) {
config_update_value('agent_vulnerabilities', 1);
}

View File

@ -219,6 +219,7 @@ function events_get_all_fields()
$columns['module_status'] = __('Module status');
$columns['module_custom_id'] = __('Module custom id');
$columns['custom_data'] = __('Custom data');
$columns['event_custom_id'] = __('Event Custom ID');
return $columns;
}
@ -322,6 +323,9 @@ function events_get_column_name($field, $table_alias=false)
case 'custom_data':
return __('Custom data');
case 'event_custom_id':
return __('Event Custom ID');
default:
return __($field);
}
@ -2356,7 +2360,8 @@ function events_create_event(
$custom_data='',
$server_id=0,
$id_extra='',
$ack_utimestamp=0
$ack_utimestamp=0,
$event_custom_id=null
) {
if ($source === false) {
$source = get_product_name();
@ -2388,6 +2393,7 @@ function events_create_event(
'custom_data' => $custom_data,
'data' => '',
'module_status' => 0,
'event_custom_id' => $event_custom_id,
];
return (int) db_process_sql_insert('tevento', $values);
@ -2611,7 +2617,6 @@ function events_print_type_img(
$urlImage = ui_get_full_url(false);
$icon = '';
$style = 'main_menu_icon';
switch ($type) {
case 'alert_recovered':
$icon = 'images/alert_recovered@svg.svg';
@ -2677,16 +2682,6 @@ function events_print_type_img(
if ($only_url) {
$output = $urlImage.'/'.$icon;
} 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(
$icon,
true,
@ -4658,6 +4653,30 @@ function events_page_details($event, $server_id=0)
$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;
$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(
$filter,
$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>
</th>
</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>
<th style="width: 15%;">
<p><span>'.$sys_info->data->osInfo->name.'</span></p>

View File

@ -13698,38 +13698,47 @@ function reporting_tiny_stats(
}
if ($modern === true) {
$out .= '<div id="bullets_modules">';
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 .= '<span class="font_12pt">'.$fired_count.'</span></div>';
$out .= '</div>';
}
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 .= '<span class="font_12pt">'.$critical_count.'</span></div>';
$out .= '</div>';
}
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 .= '<span class="font_12pt">'.$warning_count.'</span></div>';
$out .= '</div>';
}
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 .= '<span class="font_12pt">'.$unknown_count.'</span></div>';
$out .= '</div>';
}
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 .= '<span class="font_12pt">'.$not_init_count.'</span></div>';
$out .= '</div>';
}
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 .= '<span class="font_12pt">'.$normal_count.'</span></div>';
$out .= '</div>';
}
$out .= '</div>';
} else {
// Classic ones.
$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;
}
// Remove Error class.
$("#text-max_warning").removeClass("input_error");
$("#text-max_critical").removeClass("input_error");
//if haven't errors
if (error_w == 0 && error_c == 0) {
//parse element
@ -1958,6 +1962,9 @@ function paint_graph_status(
.html(message_error_critical)
.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;
}
// 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;
function update_event(table, id_evento, type, event_rep, row, server_id) {
var inputs = $("#events_form :input");
@ -1004,6 +1035,7 @@ function openSoundEventsDialog(settings, dialog_parameters, reload) {
modal: false,
width: 600,
height: 600,
dialogClass: "modal-sound",
open: function() {
$.ajax({
method: "post",
@ -1064,10 +1096,10 @@ function openSoundEventsDialog(settings, dialog_parameters, reload) {
if (reload == false && dialog_parameters != undefined) {
if ($("#button-start-search").hasClass("play")) {
$("#filter_id").val(dialog_parameters["filter_id"]);
$("#interval").val(dialog_parameters["interval"]);
$("#time_sound").val(dialog_parameters["time_sound"]);
$("#sound_id").val(dialog_parameters["sound_id"]);
$("#filter_id").val(dialog_parameters.filter_id);
$("#interval").val(dialog_parameters.interval);
$("#time_sound").val(dialog_parameters.time_sound);
$("#sound_id").val(dialog_parameters.sound_id);
$("#filter_id").trigger("change");
$("#interval").trigger("change");
@ -1124,14 +1156,15 @@ function openSoundEventsDialog(settings, dialog_parameters, reload) {
}
function openSoundEventModal(settings) {
var win = "";
if ($("#hidden-metaconsole_activated").val() === "1") {
var win = open(
win = open(
"../../operation/events/sound_events.php",
"day_123",
"width=600,height=500"
);
} else {
var win = open(
win = open(
"operation/events/sound_events.php",
"day_123",
"width=600,height=500"
@ -1502,11 +1535,6 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
typeof requestBody.includes === "function" &&
requestBody.includes("drawConsoleSound=1")
) {
console.log(
"AJAX request sent with drawConsoleSound=1:",
ajaxOptions.url
);
// Find the dialog element by the aria-describedby attribute
var dialog = $('[aria-describedby="modal-sound"]');
@ -1516,62 +1544,32 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
// Add the minimize button before the close button
var minimizeButton = $("<button>", {
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",
title: "Minimize",
style: "float: right;margin-right: 1.5em;"
title: "Minimize"
}).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
var disengageButton = $("<button>", {
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",
title: "Disengage",
style: "float: right;margin-right: 0.5em; position:relative;"
title: "Disengage"
}).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) {
console.log("here");
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").addClass("arrow_menu_down");
} else if (
$("#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").addClass("arrow_menu_up");
}
if (!dialog.data("isMinimized")) {
$(".ui-widget-overlay").hide();
console.log("Minimize Window");
dialog.data("originalPos", dialog.position());
dialog.data("originalSize", {
width: dialog.width(),
@ -1582,7 +1580,6 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
dialog.animate(
{
height: "40px",
top: 0,
top: $(window).height() - 100
},
200,
@ -1597,17 +1594,13 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
},
5
);
//dialog.find(".ui-dialog-content").hide();
} else {
console.log("Restore Window");
$(".ui-widget-overlay").show();
//dialog.find(".ui-dialog-content").show();
dialog.data("isMinimized", false);
dialog.animate(
{
height: "40px",
top: 0,
top: $(window).height() - 100
},
5

View File

@ -458,6 +458,12 @@ class Manager implements PublicLogin
$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;
}
@ -1041,6 +1047,8 @@ class Manager implements PublicLogin
$id_group = \get_parameter('id_group');
$slideshow = \get_parameter_switch('slideshow');
$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'] : '';
@ -1050,6 +1058,9 @@ class Manager implements PublicLogin
'id_group' => $id_group,
'cells_slideshow' => $slideshow,
'active' => $favourite,
'date_range' => $dateRange,
'date_from' => $dateData['date_init'],
'date_to' => $dateData['date_end'],
];
if ($this->dashboardId === 0) {

View File

@ -51,6 +51,20 @@ class Widget
*/
private $showSelectNodeMeta;
/**
* Date from init for filter widget.
*
* @var integer
*/
private $dateFrom;
/**
* Date from end for filter widget.
*
* @var integer
*/
private $dateTo;
/**
* Contructor widget.
@ -828,4 +842,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'];
}
if (empty(parent::getPeriod()) === false) {
$this->values['period'] = parent::getPeriod();
}
$params = [
'agent_module_id' => $this->values['moduleId'],
'period' => $this->values['period'],

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -135,8 +135,6 @@ class SecurityHardening extends Widget
// Includes.
include_once ENTERPRISE_DIR.'/include/functions_security_hardening.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.
parent::__construct(
$cellId,
@ -328,6 +326,11 @@ class SecurityHardening extends Widget
$id_groups = $this->checkAcl($values['group']);
$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) {
case 'top_n_agents_sh':
$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']);
$units_name = \modules_get_unit($this->values['moduleId']);
if (empty(parent::getPeriod()) === false) {
$this->values['period'] = parent::getPeriod();
}
$trickHight = 0;
if ($this->values['showLegend'] === 1) {
// Needed for legend.

View File

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

View File

@ -374,6 +374,10 @@ class TopNWidget extends Widget
$size = parent::getSize();
if (empty(parent::getPeriod()) === false) {
$this->values['period'] = parent::getPeriod();
}
$quantity = $this->values['quantity'];
$period = $this->values['period'];
@ -420,6 +424,20 @@ class TopNWidget extends Widget
// Prevent double safe input in agents_get_group_agents function.
$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.
$agents = @agents_get_group_agents(0, ['aliasRegex' => $agentRegex]);
$agentsId = \array_keys($agents);

View File

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

View File

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

View File

@ -538,3 +538,7 @@ div.container-filter-buttons {
.ui-state-active {
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 {
position: absolute;
right: 1.5em;
width: 21px;
margin: 0px 0 0 0;
padding: 1px;
position: relative;
height: 20px;
bottom: 30%;
top: 2em;
background-color: #fff !important;
width: 20px;
margin-right: 1px;
}
.ui-dialog .ui-dialog-titlebar-minimize:hover {
@ -63,16 +58,9 @@
.ui-dialog .ui-dialog-titlebar-disengage {
position: relative;
right: 1.5em;
width: 21px;
margin: 0px 0 0 0;
padding: 1px;
height: 20px;
bottom: 30%;
background-color: #fff !important;
-ms-transform: scale(1.2);
-webkit-transform: scale(1.2);
transform: scale(1.2);
width: 20px;
margin-right: 5px;
}
.ui-dialog .ui-dialog-titlebar-disengage:hover {

View File

@ -6043,18 +6043,18 @@ div.switch_radio_button label:last-of-type {
margin-top: -2px;
}
/*
div#bullets_modules {
display: flex;
margin-left: 2em;
}
*/
div#bullets_modules div {
display: flex;
align-items: center;
margin: 0 5px;
}
div.bullets_modules div {
display: flex;
align-items: center;
margin: 0 10px;
}
.orange_background {
background: #ffa631;
}
@ -6225,7 +6225,7 @@ div#status_pie {
display: flex;
align-items: flex-start;
padding: 20px;
padding-bottom: 0;
padding-bottom: 1%;
}
.agent_details_content_cluster {
@ -6315,6 +6315,7 @@ div#status_pie {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.agent_details_agent_data {
@ -6344,23 +6345,45 @@ div#status_pie {
justify-content: flex-start;
}
.agent_details_bullets .bullets_modules {
display: flex;
justify-content: flex-start;
}
.agent_details_bullets_cluster #bullets_modules {
display: flex;
justify-content: flex-start;
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 {
padding: 0px;
margin-bottom: 10px;
}
.agent_details_bullets_cluster .bullets_modules > div {
padding: 0px;
margin-bottom: 10px;
}
.agent_details_bullets #bullets_modules > div {
display: flex;
align-items: center;
padding-bottom: 20px;
}
.agent_details_bullets .bullets_modules > div {
display: flex;
align-items: center;
padding-bottom: 20px;
}
#agent_contact_main tr td img {
max-width: 100%;
}
@ -6412,6 +6435,11 @@ div#status_pie {
float: right;
}
.white_table_graph_header div.bullets_modules {
display: flex;
float: right;
}
.white_table_graph_header img,
.white_table_graph_header span {
vertical-align: middle;
@ -10809,6 +10837,13 @@ button div.fail {
-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 {
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;
}
.alert_view_calendar > .fc-view-harness > .fc-view > .fc-scrollgrid {
width: auto !important;
}
.title_tactical {
padding: 10px 0px 10px 0px;
text-align: center;
@ -12831,3 +12870,16 @@ tr.shown td.details-control {
position: absolute;
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'>
<?php
$version = '7.0NG.774';
$build = '231129';
$build = '231201';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -102,17 +102,37 @@ $agentCountModules = html_print_div(
$table_status = new stdClass();
$table_status->id = 'agent_status_main';
$table_status->width = '100%';
$table_status->width = '90%';
$table_status->height = 'auto';
$table_status->cellspacing = 0;
$table_status->cellpadding = 0;
$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[1] = 'height: 32px; width: 70%; padding-left: 5px; font-weight: lighter; vertical-align: top';
$table_status->data['agent_os'][0] = __('OS');
$agentOS = [];
$agentOS[] = html_print_div([ 'content' => (empty($agent['os_version']) === true) ? get_os_name((int) $agent['id_os']) : $agent['os_version']], true);
$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);
$table_status->data['agent_os'][1] = html_print_div(['class' => 'agent_details_agent_data', 'content' => implode('', $agentOS)], true);
$table_status->style[0] = 'height: 28px; width: 30%; padding-right: 5px; text-align: end; vertical-align: top';
$table_status->style[1] = 'height: 28px; width: 70%; padding-left: 5px; font-weight: lighter; vertical-align: top';
$os_agent_text = '';
$os_name = get_os_name((int) $agent['id_os']);
if (empty($agent['os_version']) !== 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);
$address = agents_get_address($id_agente);
@ -124,43 +144,48 @@ foreach ($addresses as $k => $add) {
}
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'][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'][1] = (empty($agent['agent_version']) === true) ? '<i>'.__('N/A').'</i>' : $agent['agent_version'];
$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(
'config_agents_has_remote_configuration',
[$agent['id_agente']]
$agentEventsHeader = html_print_div(
[
'class' => 'agent_details_header',
'content' => '<span class="subsection_header_title">'.__('Events (Last 24h)').'</span>',
],
true
);
if ((bool) $has_remote_conf) {
$table_status->data['remote_config'][0] = __('Remote configuration');
$table_status->data['remote_config'][1] = __('Enabled');
$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]
);
$table_status->data['remote_config'][0] = __('Satellite server');
$table_status->data['remote_config'][1] = $satellite_name;
}
}
$agentEventsGraph = html_print_div(
[
'class' => 'white-table-graph-content',
'content' => graph_graphic_agentevents(
$id_agente,
95,
50,
SECONDS_1DAY,
'',
true,
true,
500
),
'style' => 'margin-top: -25px',
],
true
);
$table_agent = $agentStatusHeader.'
<div class="agent_details_content">
@ -170,6 +195,9 @@ $table_agent = $agentStatusHeader.'
<div class="agent_details_info">
'.$alive_animation.html_print_table($table_status, true).'
</div>
</div>
<div class="agent_details_graph">
'.$agentEventsHeader.$agentEventsGraph.'
</div>';
@ -189,11 +217,12 @@ $data_opcional->class = 'floating_form';
// Gis and url address.
$agentAdditionalContent = '';
// Position Information.
if ((bool) $config['activate_gis'] === true) {
/*
if ((bool) $config['activate_gis'] === true) {
$dataPositionAgent = gis_get_data_last_position_agent(
$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)');
$dataOptionalOutput = html_print_anchor(
@ -210,10 +239,11 @@ if ((bool) $config['activate_gis'] === true) {
$data_opcional->data['agent_position'][1] = $dataOptionalOutput;
}
}
}*/
// 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'][1] = html_print_anchor(
[
@ -222,11 +252,12 @@ if (empty($agent['url_address']) === false) {
],
true
);
}
}*/
// 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'][1] = html_print_div(
[
@ -235,13 +266,14 @@ if (empty($addresses) === false) {
],
true
);
}
}
*/
// 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'][1] = $agent['timezone_offset'];
}
}*/
// Custom fields.
$fields = db_get_all_rows_filter(
@ -485,39 +517,6 @@ $agentContact = html_print_div(
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.
*/

View File

@ -130,6 +130,11 @@ $severity = get_parameter(
'filter[severity]',
($filter['severity'] ?? '')
);
$regex = get_parameter(
'filter[regex]',
(io_safe_output($filter['regex']) ?? '')
);
unset($filter['regex']);
$status = get_parameter(
'filter[status]',
($filter['status'] ?? '')
@ -378,6 +383,7 @@ if (is_ajax() === true) {
'te.owner_user',
'if(te.ack_utimestamp > 0, te.ack_utimestamp,"") as ack_utimestamp',
'te.custom_data',
'te.event_custom_id',
'te.data',
'te.module_status',
'ta.alias as agent_name',
@ -472,7 +478,7 @@ if (is_ajax() === true) {
$data = array_reduce(
$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;
$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;
return $carry;
}
);
}
$data = array_values(
array_filter(
$data,
function ($item) {
return (bool) (array) $item;
}
)
);
$count = count($data);
// RecordsTotal && recordsfiltered resultados totales.
echo json_encode(
[
@ -1293,6 +1321,7 @@ if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false
$severity = $filter['severity'];
$status = $filter['status'];
$search = $filter['search'];
$regex = $filter['regex'];
$not_search = $filter['not_search'];
$text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent'];
@ -2057,6 +2086,12 @@ $in = '<div class="filter_input"><label>'.__('Severity').'</label>';
$in .= $data.'</div>';
$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.
$inputs[] = html_print_input_hidden('private_filter_event', $private_filter_event, true);
// Trick view in table.
@ -3488,6 +3523,10 @@ $(document).ready( function() {
click_button_remove_tag("without");
});
$('#myInputTextField').keyup(function(){
$("#table_events").search($(this).val()).draw() ;
});
$("#button-events_form_search_bt").click(function(){
show_events_graph();
});

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.774
%define release 231129
%define release 231201
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.774
%define release 231129
%define release 231201
# User and Group under which Apache is running
%define httpd_name httpd

View File

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

View File

@ -726,6 +726,7 @@ CREATE TABLE IF NOT EXISTS `tevento` (
`custom_data` TEXT,
`data` TINYTEXT,
`module_status` INT NOT NULL DEFAULT 0,
`event_custom_id` TEXT,
PRIMARY KEY (`id_evento`),
KEY `idx_agente` (`id_agente`),
KEY `idx_agentmodule` (`id_agentmodule`),
@ -1271,6 +1272,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
`custom_data_filter_type` TINYINT UNSIGNED DEFAULT 0,
`owner_user` TEXT,
`private_filter_user` TEXT,
`regex` TEXT,
PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
@ -2640,6 +2642,9 @@ CREATE TABLE IF NOT EXISTS `tdashboard` (
`active` TINYINT NOT NULL DEFAULT 0,
`cells` INT UNSIGNED 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`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
@ -3031,7 +3036,6 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` (
`module` TEXT,
`alert` TEXT,
`criticity` TEXT,
`user_comment` TEXT,
`id_tag` TEXT,
`name` TEXT,
`group_recursion` TEXT,
@ -3046,7 +3050,6 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` (
`operator_module` TEXT COMMENT 'Operator for module',
`operator_alert` TEXT COMMENT 'Operator for alert',
`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_log_content` TEXT COMMENT 'Operator for log_content',
`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'),
('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}'),
('server_unique_identifier', replace(uuid(),'-','')),
('lts_name', '');
('lts_name', ''),
('lts_updates', 1);
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`, `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 (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 (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)

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',
'direct' => 1,
@ -135,3 +160,30 @@ HTML::printForm(
'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
Version: 7.0NG.774-231129
Version: 7.0NG.774-231201
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

@ -4304,6 +4304,7 @@ sub pandora_event {
my $utimestamp = time ();
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime ($utimestamp));
my $event_custom_id = undef;
$id_agentmodule = 0 unless defined ($id_agentmodule);
# 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);
$ack_utimestamp = get_db_value ($dbh, 'SELECT ack_utimestamp FROM tevento WHERE id_extra=? AND estado=2', $id_extra);
$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
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)
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_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, $event_custom_id);
if(defined($event_id) && $comment ne '') {
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',
$module_id);
# No code to run
return if ($module->{'interpreter'} eq '');
# Save script in a temporary file
my $command;
my ($fh, $temp_file) = tempfile();
$fh->print (decode_base64($module->{'code'}));
close ($fh);
set_file_permissions($pa_config, $temp_file, "0777");
# Run the script
my $command = $module->{'interpreter'} . ' ' . $temp_file . ' "' . $module->{'target'} . '"';
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'}));
close ($fh);
set_file_permissions($pa_config, $temp_file, "0777");
# Run the script
$command = $module->{'interpreter'} . ' ' . $temp_file . ' "' . $module->{'target'} . '"';
}
# Try to read the custom fields to use them as arguments into the command
if (defined($module->{'custom_fields'}) && $module->{'custom_fields'} ne '') {
@ -206,7 +210,11 @@ sub data_consumer ($$) {
if (!defined ($decoded_cfields)) {
logger ($pa_config, "Remote inventory module ".$module->{'name'}." has failed because the custom fields can't be read", 6);
unlink ($temp_file);
if ($module->{'script_mode'} == '2') {
unlink ($temp_file);
}
return;
}
@ -237,11 +245,18 @@ sub data_consumer ($$) {
# Check for errors
if ($? != 0) {
logger ($pa_config, "Remote inventory module ".$module->{'name'}." has failed with error level $?", 6);
unlink ($temp_file);
if ($module->{'script_mode'} == '2') {
unlink ($temp_file);
}
return;
}
unlink ($temp_file);
if ($module->{'script_mode'} == '2') {
unlink ($temp_file);
}
my $utimestamp = time ();
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime ($utimestamp));
eval {

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.774";
my $pandora_build = "231129";
my $pandora_build = "231201";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

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

View File

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

View File

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

View File

@ -38,7 +38,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.774 Build 231129";
my $version = "7.0NG.774 Build 231201";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.774 Build 231129";
my $version = "7.0NG.774 Build 231201";
# save program name for logging
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');
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('--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_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');
@ -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.
# Related option: --validate_event
@ -8335,6 +8347,10 @@ sub pandora_manage_main ($$$) {
param_check($ltotal, 4, 0);
cli_insert_gis_data();
}
elsif ($param eq '--update_event_custom_id'){
param_check($ltotal, 2);
cli_update_event_custom_id();
}
else {
print_log "[ERROR] Invalid option '$param'.\n\n";
$param = '';