Merge remote-tracking branch 'origin/develop' into ent-test-compile-omnishell
|
@ -5,7 +5,7 @@
|
|||
# Tentacle have IANA assigned port tpc/41121 as official port.
|
||||
##########################################################################
|
||||
# Copyright (c) 2007-2008 Ramon Novoa <rnovoa@artica.es>
|
||||
# Copyright (c) 2005-2010 Artica Soluciones Tecnologicas S.L
|
||||
# Copyright (c) 2005-2022 Artica Soluciones Tecnologicas S.L
|
||||
#
|
||||
# tentacle_server.pl Tentacle Server. See https://pandorafms.com/docs/ for
|
||||
# protocol description.
|
||||
|
@ -1740,6 +1740,19 @@ sub callback_stop {
|
|||
Win32::Daemon::StopService();
|
||||
}
|
||||
|
||||
|
||||
################################################################################
|
||||
## SUB check_ssleay_version
|
||||
## Print a message if the installed version of Net::SSLeay may leak memory.
|
||||
################################################################################
|
||||
sub check_ssleay_version {
|
||||
eval {
|
||||
require Net::SSLeay;
|
||||
return unless defined($Net::SSLeay::VERSION) && $Net::SSLeay::VERSION =~ m/^(\d+)\.(\d+)/ && $1 <= 1 && $2 < 88;
|
||||
print_log ("Net::SSLeay version $Net::SSLeay::VERSION detected. Versions prior to 1.88 may leak memory. To upgrade it see: https://metacpan.org/pod/Net::SSLeay");
|
||||
};
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Main
|
||||
################################################################################
|
||||
|
@ -1753,12 +1766,20 @@ if ($> == 0 && $^O ne 'MSWin32') {
|
|||
# Parse command line options
|
||||
parse_options ();
|
||||
|
||||
# Try to open the log file.
|
||||
if (defined($log_file)) {
|
||||
open(my $fh, ">>", $log_file) || die("Error opening the log file '$log_file': $!.\n");
|
||||
close($fh);
|
||||
}
|
||||
|
||||
# Check command line arguments
|
||||
if ($#ARGV != -1) {
|
||||
print_help ();
|
||||
exit 1;
|
||||
}
|
||||
|
||||
check_ssleay_version() if $t_ssl == 1;
|
||||
|
||||
# Show IPv6 status
|
||||
if ($SOCKET_MODULE eq 'IO::Socket::INET') {
|
||||
print_log ("IO::Socket::INET6 is not found. IPv6 is disabled.");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.765-221013
|
||||
Version: 7.0NG.765-221027
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.765-221013"
|
||||
pandora_version="7.0NG.765-221027"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1015,7 +1015,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.765';
|
||||
use constant AGENT_BUILD => '221013';
|
||||
use constant AGENT_BUILD => '221027';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.765
|
||||
%define release 221013
|
||||
%define release 221027
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.765
|
||||
%define release 221013
|
||||
%define release 221027
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.765"
|
||||
PI_BUILD="221013"
|
||||
PI_BUILD="221027"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# Tentacle have IANA assigned port tpc/41121 as official port.
|
||||
##########################################################################
|
||||
# Copyright (c) 2007-2008 Ramon Novoa <rnovoa@artica.es>
|
||||
# Copyright (c) 2005-2010 Artica Soluciones Tecnologicas S.L
|
||||
# Copyright (c) 2005-2022 Artica Soluciones Tecnologicas S.L
|
||||
#
|
||||
# tentacle_server.pl Tentacle Server. See https://pandorafms.com/docs/ for
|
||||
# protocol description.
|
||||
|
@ -1740,6 +1740,19 @@ sub callback_stop {
|
|||
Win32::Daemon::StopService();
|
||||
}
|
||||
|
||||
|
||||
################################################################################
|
||||
## SUB check_ssleay_version
|
||||
## Print a message if the installed version of Net::SSLeay may leak memory.
|
||||
################################################################################
|
||||
sub check_ssleay_version {
|
||||
eval {
|
||||
require Net::SSLeay;
|
||||
return unless defined($Net::SSLeay::VERSION) && $Net::SSLeay::VERSION =~ m/^(\d+)\.(\d+)/ && $1 <= 1 && $2 < 88;
|
||||
print_log ("Net::SSLeay version $Net::SSLeay::VERSION detected. Versions prior to 1.88 may leak memory. To upgrade it see: https://metacpan.org/pod/Net::SSLeay");
|
||||
};
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Main
|
||||
################################################################################
|
||||
|
@ -1753,12 +1766,20 @@ if ($> == 0 && $^O ne 'MSWin32') {
|
|||
# Parse command line options
|
||||
parse_options ();
|
||||
|
||||
# Try to open the log file.
|
||||
if (defined($log_file)) {
|
||||
open(my $fh, ">>", $log_file) || die("Error opening the log file '$log_file': $!.\n");
|
||||
close($fh);
|
||||
}
|
||||
|
||||
# Check command line arguments
|
||||
if ($#ARGV != -1) {
|
||||
print_help ();
|
||||
exit 1;
|
||||
}
|
||||
|
||||
check_ssleay_version() if $t_ssl == 1;
|
||||
|
||||
# Show IPv6 status
|
||||
if ($SOCKET_MODULE eq 'IO::Socket::INET') {
|
||||
print_log ("IO::Socket::INET6 is not found. IPv6 is disabled.");
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{221013}
|
||||
{221027}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.765 Build 221013")
|
||||
#define PANDORA_VERSION ("7.0NG.765 Build 221027")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.765(Build 221013))"
|
||||
VALUE "ProductVersion", "(7.0NG.765(Build 221027))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.765-221013
|
||||
Version: 7.0NG.765-221027
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.765-221013"
|
||||
pandora_version="7.0NG.765-221027"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -110,12 +110,13 @@ $auth_class = io_safe_output(
|
|||
$page = (string) get_parameter('page');
|
||||
$page = safe_url_extraclean($page);
|
||||
$page .= '.php';
|
||||
$page = realpath($page);
|
||||
$public_hash = get_parameter('auth_hash', false);
|
||||
$public_login = false;
|
||||
|
||||
|
||||
if (false === ((bool) get_parameter('doLogin', false) === true
|
||||
&& $page === 'include/rest-api/index.php')
|
||||
&& $page === realpath('include/rest-api/index.php'))
|
||||
) {
|
||||
// Check user.
|
||||
if (class_exists($auth_class) === false || $public_hash === false) {
|
||||
|
|
|
@ -1666,3 +1666,4 @@ godmode/um_client/vendor/sebastian/object-enumerator
|
|||
godmode/um_client/vendor/sebastian
|
||||
godmode/um_client/vendor
|
||||
update_manager_client/resources/styles/pandora.css
|
||||
enterprise/meta/general/upload_head_image.php
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tusuario` ADD COLUMN `auth_token_secret` VARCHAR(45) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE `tmodule_inventory` ADD COLUMN `script_mode` INT NOT NULL DEFAULT 2;
|
||||
ALTER TABLE `tmodule_inventory` ADD COLUMN `script_path` VARCHAR(1000) DEFAULT '';
|
||||
|
||||
ALTER TABLE `tevent_filter` ADD COLUMN `search_recursive_groups` INT NOT NULL DEFAULT 0;
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -187,7 +187,7 @@ if (!$double_auth_enabled
|
|||
})
|
||||
.show();
|
||||
// Don't allow close the dialog with X button
|
||||
$('.ui-dialog-titlebar-close').css('display', 'none');
|
||||
// $('.ui-dialog-titlebar-close').css('display', 'none');
|
||||
|
||||
</script>
|
||||
<?php
|
||||
|
|
|
@ -181,7 +181,7 @@ $module_macros = [];
|
|||
// Create agent.
|
||||
if ($create_agent) {
|
||||
$mssg_warning = 0;
|
||||
$alias_safe_output = io_safe_output(get_parameter('alias', ''));
|
||||
$alias_safe_output = strip_tags(io_safe_output(get_parameter('alias', '')));
|
||||
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
|
||||
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
||||
$direccion_agente = (string) get_parameter_post('direccion', '');
|
||||
|
@ -935,7 +935,7 @@ if ($update_agent) {
|
|||
$mssg_warning = 0;
|
||||
$id_agente = (int) get_parameter_post('id_agente');
|
||||
$nombre_agente = str_replace('`', '‘', (string) get_parameter_post('agente', ''));
|
||||
$alias_safe_output = io_safe_output(get_parameter('alias', ''));
|
||||
$alias_safe_output = strip_tags(io_safe_output(get_parameter('alias', '')));
|
||||
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
|
||||
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
||||
$direccion_agente = (string) get_parameter_post('direccion', '');
|
||||
|
@ -1047,7 +1047,7 @@ if ($update_agent) {
|
|||
// If there is an agent with the same name, but a different ID.
|
||||
}
|
||||
|
||||
if ($unique_ip && $direccion_agente != '') {
|
||||
if ($direccion_agente !== $address_list && (bool) $unique_ip === true && $direccion_agente != '') {
|
||||
$sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"';
|
||||
$exists_ip = db_get_row_sql($sql);
|
||||
}
|
||||
|
|
|
@ -40,16 +40,7 @@ require_once $config['homedir'].'/include/functions_modules.php';
|
|||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_servers.php';
|
||||
|
||||
$search_string = io_safe_output(
|
||||
urldecode(
|
||||
trim(
|
||||
get_parameter(
|
||||
'search_string',
|
||||
''
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
$search_string = get_parameter('search_string');
|
||||
|
||||
global $policy_page;
|
||||
|
||||
|
|
|
@ -669,13 +669,12 @@ $table_advanced->data[2][3] = __('Max. Value');
|
|||
$table_advanced->data[2][4] = html_print_input_text('max', $max, '', 5, 15, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
$table_advanced->colspan[2][4] = 3;
|
||||
|
||||
|
||||
$table_advanced->data[3][0] = __('Dynamic Threshold Interval');
|
||||
$table_advanced->data[3][1] = html_print_extended_select_for_time(
|
||||
'dynamic_interval',
|
||||
$dynamic_interval,
|
||||
'',
|
||||
'None',
|
||||
__('None'),
|
||||
'0',
|
||||
10,
|
||||
true,
|
||||
|
|
|
@ -1104,11 +1104,7 @@ $table->data[1][0] = __('Available agents');
|
|||
$table->data[1][1] = html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, true, true, true, '', false, 'min-width: 250px;width: 70%;');
|
||||
|
||||
|
||||
if ($type_downtime != 'quiet') {
|
||||
echo '<div id="available_modules_selection_mode" style="padding-top:20px;display: none;">';
|
||||
} else {
|
||||
echo '<div id="available_modules_selection_mode" style="padding-top:20px">';
|
||||
}
|
||||
$table->rowid[2] = 'available_modules_selection_mode';
|
||||
|
||||
$table->data[2][1] = html_print_select(
|
||||
[
|
||||
|
@ -1128,19 +1124,13 @@ $table->data[2][1] = html_print_select(
|
|||
'min-width:180px;'
|
||||
);
|
||||
|
||||
echo '</div>';
|
||||
|
||||
$table->rowid[3] = 'available_modules';
|
||||
$table->data[3][0] = __('Available modules:').ui_print_help_tip(
|
||||
__('Only for type Quiet for downtimes.'),
|
||||
true
|
||||
);
|
||||
|
||||
if ($type_downtime != 'quiet') {
|
||||
echo '<div id="available_modules" style="display: none;">';
|
||||
} else {
|
||||
echo '<div id="available_modules" style="">';
|
||||
}
|
||||
|
||||
$table->data[3][1] = html_print_select(
|
||||
[],
|
||||
'module[]',
|
||||
|
@ -1155,7 +1145,6 @@ $table->data[3][1] = html_print_select(
|
|||
false,
|
||||
'min-width: 250px;width: 70%;'
|
||||
);
|
||||
echo '</div>';
|
||||
|
||||
// Print agent table.
|
||||
html_print_table($table);
|
||||
|
@ -1184,7 +1173,6 @@ if ($id_downtime > 0) {
|
|||
}
|
||||
|
||||
echo '</div>';
|
||||
html_print_input_hidden('all_agents', implode(',', array_keys($agents)));
|
||||
html_print_input_hidden('all_common_modules', '');
|
||||
echo '</form>';
|
||||
|
||||
|
@ -1405,12 +1393,19 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
|
|||
}
|
||||
|
||||
$agents = (array) get_parameter('id_agents');
|
||||
$filter_group = (int) get_parameter('filter_group', 0);
|
||||
$module_names = (array) get_parameter('module');
|
||||
$modules_selection_mode = (string) get_parameter('modules_selection_mode');
|
||||
$type_downtime = (string) get_parameter('type_downtime', 'quiet');
|
||||
$recursion = (bool) get_parameter_checkbox('recursion', false);
|
||||
|
||||
$all_modules = ($modules_selection_mode === 'all' && (empty($module_names) || (string) $module_names[0] === '0'));
|
||||
$all_common_modules = ($modules_selection_mode === 'common' && (empty($module_names) || (string) $module_names[0] === '0'));
|
||||
|
||||
if ($type_downtime === 'disable_agents') {
|
||||
$all_modules = true;
|
||||
}
|
||||
|
||||
if ($all_common_modules === true) {
|
||||
$module_names = explode(',', get_parameter('all_common_modules'));
|
||||
}
|
||||
|
@ -1429,11 +1424,33 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
|
|||
} else {
|
||||
// If is selected 'Any', get all the agents.
|
||||
if (count($agents) === 1 && (int) $agents[0] === -2) {
|
||||
$all_agents = get_parameter('all_agents');
|
||||
$agents = explode(',', $all_agents);
|
||||
if ($recursion === true) {
|
||||
$filter_group = groups_get_children_ids(
|
||||
$filter_group,
|
||||
false,
|
||||
true,
|
||||
'AW'
|
||||
);
|
||||
};
|
||||
|
||||
$agents = db_get_all_rows_filter(
|
||||
'tagente',
|
||||
['id_grupo' => $filter_group],
|
||||
'id_agente'
|
||||
);
|
||||
|
||||
$agents = array_reduce(
|
||||
$agents,
|
||||
function ($carry, $item) {
|
||||
$carry[] = $item['id_agente'];
|
||||
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($agents as $agent_id) {
|
||||
$agent_id = (int) $agent_id;
|
||||
// Check module belongs to the agent.
|
||||
if ($modules_selection_mode == 'all' && $all_modules === false) {
|
||||
$check = false;
|
||||
|
@ -1466,17 +1483,40 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
|
|||
continue;
|
||||
}
|
||||
|
||||
$values = [
|
||||
'id_downtime' => $id_downtime,
|
||||
'id_agent' => $agent_id,
|
||||
'all_modules' => $all_modules,
|
||||
];
|
||||
$result = db_process_sql_insert(
|
||||
// Check if agent is already in downtime.
|
||||
$agent_in_downtime = db_get_value_filter(
|
||||
'id_downtime',
|
||||
'tplanned_downtime_agents',
|
||||
$values
|
||||
[
|
||||
'id_agent' => $agent_id,
|
||||
'id_downtime' => $id_downtime,
|
||||
]
|
||||
);
|
||||
|
||||
if ($result && !$all_modules) {
|
||||
if ($agent_in_downtime !== false) {
|
||||
$values = ['all_modules' => $all_modules];
|
||||
|
||||
$result = db_process_sql_update(
|
||||
'tplanned_downtime_agents',
|
||||
$values,
|
||||
[
|
||||
'id_downtime' => $id_downtime,
|
||||
'id_agent' => $agent_id,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$values = [
|
||||
'id_downtime' => $id_downtime,
|
||||
'id_agent' => $agent_id,
|
||||
'all_modules' => $all_modules,
|
||||
];
|
||||
$result = db_process_sql_insert(
|
||||
'tplanned_downtime_agents',
|
||||
$values
|
||||
);
|
||||
}
|
||||
|
||||
if ($result !== false && (bool) $all_modules === false) {
|
||||
foreach ($module_names as $module_name) {
|
||||
$module = modules_get_agentmodule_id(
|
||||
$module_name,
|
||||
|
@ -1487,17 +1527,32 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
|
|||
continue;
|
||||
}
|
||||
|
||||
$values = [
|
||||
'id_downtime' => $id_downtime,
|
||||
'id_agent' => $agent_id,
|
||||
'id_agent_module' => $module['id_agente_modulo'],
|
||||
];
|
||||
$result = db_process_sql_insert(
|
||||
// Check if modules are already in downtime.
|
||||
$module_in_downtime = db_get_value_filter(
|
||||
'id_downtime',
|
||||
'tplanned_downtime_modules',
|
||||
$values
|
||||
[
|
||||
'id_downtime' => $id_downtime,
|
||||
'id_agent' => $agent_id,
|
||||
'id_agent_module' => $module['id_agente_modulo'],
|
||||
]
|
||||
);
|
||||
|
||||
if ($result) {
|
||||
if ($module_in_downtime !== false) {
|
||||
continue;
|
||||
} else {
|
||||
$values = [
|
||||
'id_downtime' => $id_downtime,
|
||||
'id_agent' => $agent_id,
|
||||
'id_agent_module' => $module['id_agente_modulo'],
|
||||
];
|
||||
$result = db_process_sql_insert(
|
||||
'tplanned_downtime_modules',
|
||||
$values
|
||||
);
|
||||
}
|
||||
|
||||
if ($result !== false) {
|
||||
$values = ['id_user' => $config['id_user']];
|
||||
$result = db_process_sql_update(
|
||||
'tplanned_downtime',
|
||||
|
@ -1526,6 +1581,7 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
|
|||
$("#available_modules_selection_mode").hide();
|
||||
break;
|
||||
case 'quiet':
|
||||
case 'disable_agent_modules':
|
||||
$("#available_modules_selection_mode").show();
|
||||
$("#available_modules").show();
|
||||
break;
|
||||
|
@ -1840,7 +1896,6 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
|
|||
$('input.hasDatepicker[readonly]').disable();
|
||||
|
||||
$("#checkbox-recursion").click(function() {
|
||||
recursion = this.checked;
|
||||
$("#filter_group").trigger("change");
|
||||
});
|
||||
|
||||
|
@ -1850,6 +1905,7 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
|
|||
});
|
||||
|
||||
function populate_agents_selector() {
|
||||
recursion = $("#checkbox-recursion").prop('checked');
|
||||
jQuery.post ("ajax.php",
|
||||
{"page": "operation/agentes/ver_agente",
|
||||
"get_agents_group_json": 1,
|
||||
|
|
|
@ -137,12 +137,49 @@ if (is_ajax() === true) {
|
|||
'filters' => get_parameter('filter', []),
|
||||
];
|
||||
|
||||
$modules = get_agents_modules_planned_dowtime($id, $options);
|
||||
$type_downtime = db_get_value_filter(
|
||||
'type_downtime',
|
||||
'tplanned_downtime',
|
||||
['id' => $id]
|
||||
);
|
||||
|
||||
if ($type_downtime === 'disable_agents') {
|
||||
$sql = sprintf(
|
||||
'SELECT ta.alias as agent_name
|
||||
FROM tplanned_downtime_agents tpa JOIN tagente ta
|
||||
ON tpa.id_agent = ta.id_agente
|
||||
WHERE tpa.id_downtime = %d',
|
||||
$id
|
||||
);
|
||||
$data = db_get_all_rows_sql($sql);
|
||||
|
||||
if (empty($data) === false) {
|
||||
$data = array_reduce(
|
||||
$data,
|
||||
function ($carry, $item) {
|
||||
global $config;
|
||||
// Transforms array of arrays $data into an array
|
||||
// of objects, making a post-process of certain fields.
|
||||
$tmp = (object) $item;
|
||||
|
||||
$tmp->agent_name = io_safe_output($item['agent_name']);
|
||||
$tmp->module_name = __('All modules');
|
||||
|
||||
$carry[] = $tmp;
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$data = get_agents_modules_planned_dowtime($id, $options);
|
||||
}
|
||||
|
||||
|
||||
$count = get_agents_modules_planned_dowtime($id, $options, $count);
|
||||
|
||||
echo json_encode(
|
||||
[
|
||||
'data' => $modules,
|
||||
'data' => $data,
|
||||
'recordsTotal' => $count[0]['total'],
|
||||
'recordsFiltered' => $count[0]['total'],
|
||||
]
|
||||
|
|
|
@ -797,11 +797,7 @@ foreach ($commands as $command) {
|
|||
|
||||
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.
|
||||
if ($is_management_allowed === true && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) {
|
||||
if (check_acl($config['id_user'], 0, 'PM') || is_user_admin(
|
||||
$config['id_user
|
||||
']
|
||||
)
|
||||
) {
|
||||
if (is_user_admin($config['id_user']) === true) {
|
||||
$data['action'] = '<span class="inline_flex">';
|
||||
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&copy_command=1&id='.$command['id'].'&pure='.$pure.'"
|
||||
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true, ['class' => 'invert_filter']).'</a>';
|
||||
|
@ -828,7 +824,8 @@ if (isset($data) === true && count($table->data) > 0) {
|
|||
);
|
||||
}
|
||||
|
||||
if ($is_management_allowed === true && check_acl_restricted_all($config['id_user'], $command['id_group'], 'PM')) {
|
||||
// Commands can only be created by the super administrator.
|
||||
if (users_is_admin() === true) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
|
|
|
@ -90,6 +90,7 @@ if ($id) {
|
|||
|
||||
$filter_only_alert = $filter['filter_only_alert'];
|
||||
$search_secondary_groups = $filter['search_secondary_groups'];
|
||||
$search_recursive_groups = $filter['search_recursive_groups'];
|
||||
$custom_data = $filter['custom_data'];
|
||||
$custom_data_filter_type = $filter['custom_data_filter_type'];
|
||||
|
||||
|
@ -128,6 +129,7 @@ if ($id) {
|
|||
$tag_without_base64 = base64_encode($tag_without_json);
|
||||
$filter_only_alert = '';
|
||||
$search_secondary_groups = 0;
|
||||
$search_recursive_groups = 0;
|
||||
}
|
||||
|
||||
if ($update || $create) {
|
||||
|
@ -170,6 +172,7 @@ if ($update || $create) {
|
|||
|
||||
$filter_only_alert = get_parameter('filter_only_alert', '');
|
||||
$search_secondary_groups = get_parameter('search_secondary_groups', 0);
|
||||
$search_recursive_groups = get_parameter('search_recursive_groups', 0);
|
||||
|
||||
$custom_data = get_parameter('custom_data', '');
|
||||
$custom_data_filter_type = get_parameter('custom_data_filter_type', '');
|
||||
|
@ -198,6 +201,7 @@ if ($update || $create) {
|
|||
'user_comment' => $user_comment,
|
||||
'filter_only_alert' => $filter_only_alert,
|
||||
'search_secondary_groups' => $search_secondary_groups,
|
||||
'search_recursive_groups' => $search_recursive_groups,
|
||||
'custom_data' => $custom_data,
|
||||
'custom_data_filter_type' => $custom_data_filter_type,
|
||||
];
|
||||
|
@ -438,8 +442,12 @@ $table->data[10][1] = html_print_select(
|
|||
true
|
||||
);
|
||||
|
||||
$repeated_sel[0] = __('All events');
|
||||
$repeated_sel[1] = __('Group events');
|
||||
$repeated_sel = [
|
||||
EVENT_GROUP_REP_ALL => __('All events'),
|
||||
EVENT_GROUP_REP_EVENTS => __('Group events'),
|
||||
EVENT_GROUP_REP_AGENTS => __('Group agents'),
|
||||
EVENT_GROUP_REP_EXTRAIDS => __('Group extra id'),
|
||||
];
|
||||
$table->data[11][0] = '<b>'.__('Repeated').'</b>';
|
||||
$table->data[11][1] = html_print_select(
|
||||
$repeated_sel,
|
||||
|
|
|
@ -701,6 +701,28 @@ if (enterprise_installed() === true) {
|
|||
);
|
||||
}
|
||||
|
||||
// Agent Wizard defaults.
|
||||
$defaultAgentWizardOptions = json_decode(io_safe_output($config['agent_wizard_defaults']));
|
||||
$tableSnmpWizard = new stdClass();
|
||||
$tableSnmpWizard->width = '100%';
|
||||
$tableSnmpWizard->class = 'databox filters';
|
||||
$tableSnmpWizard->data = [];
|
||||
$tableSnmpWizard->style[0] = 'font-weight: bold';
|
||||
$tableSnmpWizard->style[2] = 'font-weight: bold';
|
||||
$tableSnmpWizard->size[0] = '30%';
|
||||
$tableSnmpWizard->size[2] = '30%';
|
||||
|
||||
$i = 0;
|
||||
$j = 0;
|
||||
foreach ($defaultAgentWizardOptions as $key => $value) {
|
||||
$tableSnmpWizard->data[$i][$j++] = $key;
|
||||
$tableSnmpWizard->data[$i][$j++] = html_print_checkbox_switch('agent_wizard_defaults_'.$key, 1, $value, true);
|
||||
if ($j >= 3) {
|
||||
$j = 0;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
echo '<form id="form_setup" method="post">';
|
||||
|
||||
echo '<fieldset class="full-column">';
|
||||
|
@ -725,6 +747,11 @@ echo '<fieldset>';
|
|||
html_print_table($table_other);
|
||||
echo '</fieldset>';
|
||||
|
||||
echo '<fieldset>';
|
||||
echo '<legend>'.__('Agent SNMP Interface Wizard defaults').' '.ui_print_help_icon('agent_snmp_wizard_options_tab', true).'</legend>';
|
||||
html_print_table($tableSnmpWizard);
|
||||
echo '</fieldset>';
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_input_hidden('update_config', 1);
|
||||
html_print_submit_button(
|
||||
|
|
|
@ -199,6 +199,21 @@ if (is_ajax()) {
|
|||
);
|
||||
$table->data['ldap_admin_pass'] = $row;
|
||||
|
||||
// Ldapsearch timeout.
|
||||
// Default Ldapsearch timeout.
|
||||
set_when_empty($config['ldap_searh_timeout'], 5);
|
||||
$row = [];
|
||||
$row['name'] = __('Ldap search timeout (secs)');
|
||||
$row['control'] = html_print_input_text(
|
||||
'ldap_search_timeout',
|
||||
$config['ldap_search_timeout'],
|
||||
'',
|
||||
10,
|
||||
10,
|
||||
true
|
||||
);
|
||||
$table->data['ldap_search_timeout'] = $row;
|
||||
|
||||
// Enable/disable secondary ldap.
|
||||
// Set default value.
|
||||
set_unless_defined($config['secondary_ldap_enabled'], false);
|
||||
|
|
|
@ -442,6 +442,13 @@ if ($create_user) {
|
|||
$password_new = '';
|
||||
$password_confirm = '';
|
||||
$new_user = true;
|
||||
} else if (excludedPassword($password_new) === true) {
|
||||
$is_err = true;
|
||||
ui_print_error_message(__('The password provided is not valid. Please set another one.'));
|
||||
$user_info = $values;
|
||||
$password_new = '';
|
||||
$password_confirm = '';
|
||||
$new_user = true;
|
||||
} else {
|
||||
if ((!is_user_admin($config['id_user']) || $config['enable_pass_policy_admin']) && $config['enable_pass_policy']) {
|
||||
$pass_ok = login_validate_pass($password_new, $id, true);
|
||||
|
@ -509,6 +516,10 @@ if ($create_user) {
|
|||
if (!empty($json_profile)) {
|
||||
$json_profile = json_decode(io_safe_output($json_profile), true);
|
||||
foreach ($json_profile as $key => $profile) {
|
||||
if (is_array($profile) === false) {
|
||||
$profile = json_decode($profile, true);
|
||||
}
|
||||
|
||||
if (!empty($profile)) {
|
||||
$group2 = $profile['group'];
|
||||
$profile2 = $profile['profile'];
|
||||
|
@ -532,6 +543,14 @@ if ($create_user) {
|
|||
|
||||
$result_profile = profile_create_user_profile($id, $profile2, $group2, false, $tags, $no_hierarchy);
|
||||
|
||||
if ($result_profile === false) {
|
||||
$is_err = true;
|
||||
$user_info = $values;
|
||||
$password_new = '';
|
||||
$password_confirm = '';
|
||||
$new_user = true;
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result_profile,
|
||||
__('Profile added successfully'),
|
||||
|
@ -824,6 +843,10 @@ if ($add_profile && empty($json_profile)) {
|
|||
'Profile: '.$profile2.' Group: '.$group2.' Tags: '.$tags
|
||||
);
|
||||
$return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $no_hierarchy);
|
||||
if ($return === false) {
|
||||
$is_err = true;
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$return,
|
||||
__('Profile added successfully'),
|
||||
|
@ -1492,12 +1515,12 @@ if ($config['admin_can_add_user']) {
|
|||
|
||||
echo '</div>';
|
||||
|
||||
html_print_input_hidden('json_profile', '');
|
||||
html_print_input_hidden('json_profile', $json_profile);
|
||||
|
||||
echo '</form>';
|
||||
|
||||
|
||||
profile_print_profile_table($id);
|
||||
profile_print_profile_table($id, io_safe_output($json_profile));
|
||||
|
||||
echo '<br />';
|
||||
|
||||
|
@ -1613,13 +1636,18 @@ $(document).ready (function () {
|
|||
switch_ehorus_conf();
|
||||
});
|
||||
$('#checkbox-ehorus_user_level_enabled').trigger('change');
|
||||
|
||||
var img_delete = '<?php echo $delete_image; ?>';
|
||||
var id_user = '<?php echo io_safe_output($id); ?>';
|
||||
var is_metaconsole = '<?php echo $meta; ?>';
|
||||
var user_is_global_admin = '<?php echo users_is_admin($id); ?>';
|
||||
var is_err = '<?php echo $is_err; ?>';
|
||||
var data = [];
|
||||
var aux = 0;
|
||||
|
||||
if(json_profile.val() != '') {
|
||||
var data = JSON.parse(json_profile.val());
|
||||
}
|
||||
|
||||
$('input:image[name="add"]').click(function (e) {
|
||||
e.preventDefault();
|
||||
var profile = $('#assign_profile').val();
|
||||
|
@ -1641,10 +1669,14 @@ $(document).ready (function () {
|
|||
return;
|
||||
}
|
||||
|
||||
if (id_user === '') {
|
||||
if (id_user == '' || is_err == 1) {
|
||||
let new_json = `{"profile":${profile},"group":${group},"tags":[${tags}],"hierarchy":${hierarchy}}`;
|
||||
data.push(new_json);
|
||||
json_profile.val('['+data+']');
|
||||
json_profile.val(JSON.stringify(data));
|
||||
profile_text = `<a href="index.php?sec2=godmode/users/configure_profile&id=${profile}">${profile_text}</a>`;
|
||||
group_img = `<img id="img_group_${aux}" src="" data-title="${group_text}" data-use_title_for_force_title="1" class="bot forced_title" alt="${group_text}"/>`;
|
||||
group_text = `<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id=${group}">${group_img}${group_text}</a>`;
|
||||
|
||||
$('#table_profiles tr:last').before(
|
||||
`<tr>
|
||||
<td>${profile_text}</td>
|
||||
|
@ -1654,6 +1686,10 @@ $(document).ready (function () {
|
|||
<td>${img_delete}</td>
|
||||
</tr>`
|
||||
);
|
||||
|
||||
getGroupIcon(group, $(`#img_group_${aux}`));
|
||||
aux++;
|
||||
|
||||
} else {
|
||||
this.form.submit();
|
||||
}
|
||||
|
|
|
@ -31,8 +31,6 @@ global $config;
|
|||
|
||||
check_login();
|
||||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
require_once $config['homedir'].'/include/functions_profile.php';
|
||||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
require_once $config['homedir'].'/include/functions_groups.php';
|
||||
|
@ -52,8 +50,47 @@ if (is_ajax()) {
|
|||
$method = get_parameter('method');
|
||||
$group_id = get_parameter('group_id');
|
||||
$group_recursion = (bool) get_parameter('group_recursion', 0);
|
||||
$get_user_profile_group = (bool) get_parameter('get_user_profile_group', false);
|
||||
|
||||
$return_all = false;
|
||||
|
||||
if ($get_user_profile_group === true) {
|
||||
$id_user = get_parameter('id_user');
|
||||
|
||||
$user_is_admin = users_is_admin();
|
||||
|
||||
$user_profiles = [];
|
||||
|
||||
if ($user_is_admin === false) {
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
}
|
||||
|
||||
// User profiles.
|
||||
if ($user_is_admin || $id_user == $config['id_user'] || isset($group_um[0])) {
|
||||
$user_profiles = db_get_all_rows_field_filter(
|
||||
'tusuario_perfil',
|
||||
'id_usuario',
|
||||
$id_user
|
||||
);
|
||||
} else {
|
||||
$user_profiles_aux = users_get_user_profile($id_user);
|
||||
foreach ($group_um as $key => $value) {
|
||||
if (isset($user_profiles_aux[$key]) === true) {
|
||||
$user_profiles[$key] = $user_profiles_aux[$key];
|
||||
unset($user_profiles_aux[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($user_profiles as $key => $value) {
|
||||
$user_profiles[$key]['id_perfil'] = profile_get_name($value['id_perfil']);
|
||||
$user_profiles[$key]['id_grupo'] = groups_get_name($value['id_grupo'], true);
|
||||
}
|
||||
|
||||
echo json_encode($user_profiles);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($group_id == -1) {
|
||||
$sql = 'SELECT tusuario.id_user FROM tusuario
|
||||
LEFT OUTER JOIN tusuario_perfil
|
||||
|
@ -95,6 +132,8 @@ if (is_ajax()) {
|
|||
}
|
||||
}
|
||||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
$sortField = get_parameter('sort_field');
|
||||
$sort = get_parameter('sort', 'none');
|
||||
$tab = get_parameter('tab', 'user');
|
||||
|
@ -265,71 +304,75 @@ $delete_user = (bool) get_parameter('user_del', false);
|
|||
if ($delete_user === true) {
|
||||
// Delete user.
|
||||
$id_user = get_parameter('delete_user', 0);
|
||||
if (users_is_admin($id_user) === true && users_is_admin() === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to delete admininstrator user by non administrator user '.$config['id_user']
|
||||
);
|
||||
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
// Only allow delete user if is not the actual user.
|
||||
if ($id_user != $config['id_user']) {
|
||||
$user_row = users_get_user_by_id($id_user);
|
||||
|
||||
$result = delete_user($id_user);
|
||||
|
||||
if ($result) {
|
||||
if ($id_user !== 0) {
|
||||
if (users_is_admin($id_user) === true && users_is_admin() === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_USER_MANAGEMENT,
|
||||
__('Deleted user %s', io_safe_output($id_user))
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to delete admininstrator user by non administrator user '.$config['id_user']
|
||||
);
|
||||
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Successfully deleted'),
|
||||
__('There was a problem deleting the user')
|
||||
);
|
||||
// Only allow delete user if is not the actual user.
|
||||
if ($id_user != $config['id_user']) {
|
||||
$user_row = users_get_user_by_id($id_user);
|
||||
|
||||
// Delete the user in all the consoles.
|
||||
if (is_metaconsole() === true && isset($_GET['delete_all'])) {
|
||||
$servers = metaconsole_get_servers();
|
||||
foreach ($servers as $server) {
|
||||
// Connect to the remote console.
|
||||
if (metaconsole_connect($server) === NOERR) {
|
||||
// Delete the user.
|
||||
$result = delete_user($id_user);
|
||||
$result = delete_user($id_user);
|
||||
|
||||
if ($result) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_USER_MANAGEMENT,
|
||||
__('Deleted user %s', io_safe_output($id_user))
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Successfully deleted'),
|
||||
__('There was a problem deleting the user')
|
||||
);
|
||||
|
||||
// Delete the user in all the consoles.
|
||||
if (is_metaconsole() === true && isset($_GET['delete_all'])) {
|
||||
$servers = metaconsole_get_servers();
|
||||
foreach ($servers as $server) {
|
||||
// Connect to the remote console.
|
||||
if (metaconsole_connect($server) === NOERR) {
|
||||
// Delete the user.
|
||||
$result = delete_user($id_user);
|
||||
if ($result) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_USER_MANAGEMENT,
|
||||
__('Deleted user %s from metaconsole', io_safe_input($id_user))
|
||||
);
|
||||
}
|
||||
|
||||
// Restore the db connection.
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
// Log to the metaconsole too.
|
||||
if ($result) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_USER_MANAGEMENT,
|
||||
__('Deleted user %s from metaconsole', io_safe_input($id_user))
|
||||
__('Deleted user %s from %s', io_safe_input($id_user), io_safe_input($server['server_name']))
|
||||
);
|
||||
}
|
||||
|
||||
// Restore the db connection.
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
// Log to the metaconsole too.
|
||||
if ($result) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_USER_MANAGEMENT,
|
||||
__('Deleted user %s from %s', io_safe_input($id_user), io_safe_input($server['server_name']))
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Successfully deleted from %s', io_safe_input($server['server_name'])),
|
||||
__('There was a problem deleting the user from %s', io_safe_input($server['server_name']))
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Successfully deleted from %s', io_safe_input($server['server_name'])),
|
||||
__('There was a problem deleting the user from %s', io_safe_input($server['server_name']))
|
||||
);
|
||||
}
|
||||
} else {
|
||||
ui_print_error_message(__('There was a problem deleting the user'));
|
||||
}
|
||||
} else {
|
||||
ui_print_error_message(__('There was a problem deleting the user'));
|
||||
ui_print_error_message(__('ID user cannot be empty'));
|
||||
}
|
||||
} else if (isset($_GET['profile_del'])) {
|
||||
// Delete profile.
|
||||
|
@ -586,15 +629,17 @@ $rowPair = true;
|
|||
$iterator = 0;
|
||||
$cont = 0;
|
||||
foreach ($info as $user_id => $user_info) {
|
||||
if (empty($user_id) === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// User profiles.
|
||||
if ($user_is_admin || $user_id == $config['id_user'] || isset($group_um[0])) {
|
||||
$user_profiles = db_get_all_rows_field_filter(
|
||||
'tusuario_perfil',
|
||||
'id_usuario',
|
||||
$user_id
|
||||
$user_profiles = db_get_all_rows_sql(
|
||||
'SELECT * FROM tusuario_perfil where id_usuario LIKE "'.$user_id.'" LIMIT 5'
|
||||
);
|
||||
} else {
|
||||
$user_profiles_aux = users_get_user_profile($user_id);
|
||||
$user_profiles_aux = users_get_user_profile($user_id, 'LIMIT 5');
|
||||
$user_profiles = [];
|
||||
foreach ($group_um as $key => $value) {
|
||||
if (isset($user_profiles_aux[$key]) === true) {
|
||||
|
@ -674,39 +719,35 @@ foreach ($info as $user_id => $user_info) {
|
|||
if ($user_profiles !== false) {
|
||||
$total_profile = 0;
|
||||
|
||||
$data[4] .= '<div class="text_end">';
|
||||
$data[4] .= '<div class="text_end">';
|
||||
foreach ($user_profiles as $row) {
|
||||
if ($total_profile <= 5) {
|
||||
$data[4] .= "<div class='float-left'>";
|
||||
$data[4] .= profile_get_name($row['id_perfil']);
|
||||
$data[4] .= ' / </div>';
|
||||
$data[4] .= "<div class='float-left pdd_l_5px'>";
|
||||
$data[4] .= groups_get_name($row['id_grupo'], true);
|
||||
$data[4] .= '</div>';
|
||||
$data[4] .= "<div class='float-left'>";
|
||||
$data[4] .= profile_get_name($row['id_perfil']);
|
||||
$data[4] .= ' / </div>';
|
||||
$data[4] .= "<div class='float-left pdd_l_5px'>";
|
||||
$data[4] .= groups_get_name($row['id_grupo'], true);
|
||||
$data[4] .= '</div>';
|
||||
|
||||
if ($total_profile == 0 && count($user_profiles) >= 5) {
|
||||
$data[4] .= '<span onclick="showGroups()" class="pdd_l_15px">
|
||||
'.html_print_image(
|
||||
'images/zoom.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Show'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</span>';
|
||||
}
|
||||
if ($total_profile == 0 && count($user_profiles) >= 5) {
|
||||
$data[4] .= '<span onclick="showGroups(`'.$row['id_usuario'].'`)">'.html_print_image(
|
||||
'images/zoom.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Show profiles'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</span>';
|
||||
|
||||
$data[4] .= '<br />';
|
||||
$data[4] .= '<br />';
|
||||
$data[4] .= '</div>';
|
||||
} else {
|
||||
$data[4] .= "<div id='groups_list' class='invisible'>";
|
||||
$data[4] .= '<div >';
|
||||
$data[4] .= profile_get_name($row['id_perfil']);
|
||||
$data[4] .= ' / '.groups_get_name($row['id_grupo'], true).'</div>';
|
||||
$data[4] .= '<br/>';
|
||||
$data[4] .= html_print_input_hidden(
|
||||
'show_groups_'.$row['id_usuario'],
|
||||
-1,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$data[4] .= '<br/>';
|
||||
$data[4] .= '<br/>';
|
||||
|
||||
$total_profile++;
|
||||
}
|
||||
|
||||
|
@ -719,6 +760,8 @@ foreach ($info as $user_id => $user_info) {
|
|||
}
|
||||
|
||||
$data[4] .= '</div>';
|
||||
$data[4] .= '<div class="invisible" id="profiles_'.$user_profiles[0]['id_usuario'].'">';
|
||||
$data[4] .= '</div>';
|
||||
} else {
|
||||
$data[4] .= __('The user doesn\'t have any assigned profile/group');
|
||||
}
|
||||
|
@ -882,16 +925,46 @@ echo '</div>';
|
|||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
function showGroups(){
|
||||
var groups_list = document.getElementById("groups_list");
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function showGroups(id_user) {
|
||||
if ($(`#hidden-show_groups_${id_user}`).val() === '-1') {
|
||||
var request = $.ajax({
|
||||
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: 'godmode/users/user_list',
|
||||
get_user_profile_group: 1,
|
||||
id_user: id_user
|
||||
},
|
||||
success: function (data, textStatus, xhr) {
|
||||
let count = 1;
|
||||
data.forEach( function(valor, indice, array) {
|
||||
if (count >= 6) {
|
||||
let main_div = $(`#profiles_${id_user}`);
|
||||
main_div.append(
|
||||
`<div id="left_${id_user}_${count}" class='float-left'>${valor.id_perfil} / </div>`,
|
||||
`<div id="right_${id_user}_${count}" class='float-left pdd_l_5px'>${valor.id_grupo}</div>`,
|
||||
`<br/><br/>`
|
||||
);
|
||||
}
|
||||
count ++;
|
||||
});
|
||||
},
|
||||
error: function (e, textStatus) {
|
||||
console.error(textStatus);
|
||||
}
|
||||
});
|
||||
$(`#hidden-show_groups_${id_user}`).val('1');
|
||||
$(`#profiles_${id_user}`).show();
|
||||
} else if ($(`#hidden-show_groups_${id_user}`).val() === '1') {
|
||||
$(`#hidden-show_groups_${id_user}`).val('0');
|
||||
$(`#profiles_${id_user}`).hide();
|
||||
} else {
|
||||
$(`#hidden-show_groups_${id_user}`).val('1');
|
||||
$(`#profiles_${id_user}`).show();
|
||||
}
|
||||
}
|
||||
|
||||
if(groups_list.style.display == "none"){
|
||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
||||
element.style.display = "block");
|
||||
}else{
|
||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
||||
element.style.display = "none");
|
||||
};
|
||||
}
|
||||
</script>';
|
||||
</script>
|
||||
|
|
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 5.3 KiB |
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
$token_name = get_parameter('token_name', 0);
|
||||
$no_boolean = (bool) get_parameter('no_boolean', 0);
|
||||
|
||||
$value_token = db_get_value(
|
||||
'value',
|
||||
|
@ -9,4 +10,8 @@ $value_token = db_get_value(
|
|||
$token_name
|
||||
);
|
||||
|
||||
echo (bool) $value_token;
|
||||
if ($no_boolean === true) {
|
||||
echo json_encode(io_safe_output($value_token));
|
||||
} else {
|
||||
echo (bool) $value_token;
|
||||
}
|
||||
|
|
|
@ -64,9 +64,9 @@ $add_comment = (bool) get_parameter('add_comment');
|
|||
$dialogue_event_response = (bool) get_parameter('dialogue_event_response');
|
||||
$perform_event_response = (bool) get_parameter('perform_event_response');
|
||||
$get_response = (bool) get_parameter('get_response');
|
||||
$get_response_target = (bool) get_parameter('get_response_target');
|
||||
$get_response_params = (bool) get_parameter('get_response_params');
|
||||
$get_response_description = (bool) get_parameter('get_response_description');
|
||||
$get_response_massive = (bool) get_parameter('get_response_massive');
|
||||
$get_row_response_action = (bool) get_parameter('get_row_response_action');
|
||||
$draw_row_response_info = (bool) get_parameter('draw_row_response_info', false);
|
||||
$meta = get_parameter('meta', 0);
|
||||
$history = get_parameter('history', 0);
|
||||
$table_events = get_parameter('table_events', 0);
|
||||
|
@ -90,7 +90,7 @@ $node_id = (int) get_parameter('node_id', 0);
|
|||
|
||||
if ($get_comments === true) {
|
||||
$event = get_parameter('event', false);
|
||||
$event_rep = get_parameter('event_rep', false);
|
||||
$event_rep = (int) get_parameter('event_rep', 0);
|
||||
if ($event === false) {
|
||||
return __('Failed to retrieve comments');
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ if ($get_comments === true) {
|
|||
$eventsGrouped = [];
|
||||
// Consider if the event is grouped.
|
||||
$whereGrouped = '1=1';
|
||||
if (isset($event_rep) === true && $event_rep > 0) {
|
||||
if ($event_rep === EVENT_GROUP_REP_EVENTS) {
|
||||
// Default grouped message filtering (evento and estado).
|
||||
$whereGrouped = sprintf(
|
||||
'`evento` = "%s"',
|
||||
|
@ -119,6 +119,11 @@ if ($get_comments === true) {
|
|||
(int) $event['id_agentmodule']
|
||||
);
|
||||
}
|
||||
} else if ($event_rep === EVENT_GROUP_REP_EXTRAIDS) {
|
||||
$whereGrouped = sprintf(
|
||||
'`id_extra` = "%s"',
|
||||
$event['id_extra']
|
||||
);
|
||||
} else {
|
||||
$whereGrouped = sprintf('`id_evento` = %d', $event['id_evento']);
|
||||
}
|
||||
|
@ -175,7 +180,7 @@ if ($delete_event === true) {
|
|||
$filter = get_parameter('filter', []);
|
||||
$id_evento = (int) get_parameter('id_evento', 0);
|
||||
$server_id = (int) get_parameter('server_id', 0);
|
||||
$event_rep = get_parameter('event_rep', 0);
|
||||
$event_rep = (int) get_parameter('event_rep', 0);
|
||||
|
||||
try {
|
||||
if (is_metaconsole() === true
|
||||
|
@ -228,7 +233,7 @@ if ($validate_event === true) {
|
|||
$filter = get_parameter('filter', []);
|
||||
$id_evento = (int) get_parameter('id_evento', 0);
|
||||
$server_id = (int) get_parameter('server_id', 0);
|
||||
$event_rep = get_parameter('event_rep', 0);
|
||||
$event_rep = (int) get_parameter('event_rep', 0);
|
||||
|
||||
try {
|
||||
if (is_metaconsole() === true
|
||||
|
@ -240,7 +245,7 @@ if ($validate_event === true) {
|
|||
|
||||
if ($event_rep === 0) {
|
||||
// Disable group by when there're result is unique.
|
||||
$filter['group_rep'] = 0;
|
||||
$filter['group_rep'] = EVENT_GROUP_REP_ALL;
|
||||
}
|
||||
|
||||
// Check acl.
|
||||
|
@ -285,7 +290,7 @@ if ($in_process_event === true) {
|
|||
$filter = get_parameter('filter', []);
|
||||
$id_evento = (int) get_parameter('id_evento', 0);
|
||||
$server_id = (int) get_parameter('server_id', 0);
|
||||
$event_rep = get_parameter('event_rep', 0);
|
||||
$event_rep = (int) get_parameter('event_rep', 0);
|
||||
|
||||
try {
|
||||
if (is_metaconsole() === true
|
||||
|
@ -297,7 +302,7 @@ if ($in_process_event === true) {
|
|||
|
||||
if ($event_rep === 0) {
|
||||
// Disable group by when there're result is unique.
|
||||
$filter['group_rep'] = 0;
|
||||
$filter['group_rep'] = EVENT_GROUP_REP_ALL;
|
||||
}
|
||||
|
||||
// Check acl.
|
||||
|
@ -360,10 +365,11 @@ if ($save_event_filter) {
|
|||
);
|
||||
$values['filter_only_alert'] = get_parameter('filter_only_alert');
|
||||
$values['search_secondary_groups'] = get_parameter('search_secondary_groups');
|
||||
$values['search_recursive_groups'] = get_parameter('search_recursive_groups');
|
||||
$values['id_group_filter'] = get_parameter('id_group_filter');
|
||||
$values['date_from'] = get_parameter('date_from');
|
||||
$values['date_from'] = get_parameter('date_from', null);
|
||||
$values['time_from'] = get_parameter('time_from');
|
||||
$values['date_to'] = get_parameter('date_to');
|
||||
$values['date_to'] = get_parameter('date_to', null);
|
||||
$values['time_to'] = get_parameter('time_to');
|
||||
$values['source'] = get_parameter('source');
|
||||
$values['id_extra'] = get_parameter('id_extra');
|
||||
|
@ -417,6 +423,7 @@ if ($update_event_filter) {
|
|||
);
|
||||
$values['filter_only_alert'] = get_parameter('filter_only_alert');
|
||||
$values['search_secondary_groups'] = get_parameter('search_secondary_groups');
|
||||
$values['search_recursive_groups'] = get_parameter('search_recursive_groups');
|
||||
$values['id_group_filter'] = get_parameter('id_group_filter');
|
||||
$values['date_from'] = get_parameter('date_from');
|
||||
$values['time_from'] = get_parameter('time_from');
|
||||
|
@ -464,13 +471,13 @@ if ($get_filter_values) {
|
|||
$event_filter = [
|
||||
'status' => EVENT_NO_VALIDATED,
|
||||
'event_view_hr' => $config['event_view_hr'],
|
||||
'group_rep' => 1,
|
||||
'tag_with' => [],
|
||||
'tag_without' => [],
|
||||
'history' => false,
|
||||
'module_search' => '',
|
||||
'filter_only_alert' => '-1',
|
||||
'search_secondary_groups' => 0,
|
||||
'search_recursive_groups' => 0,
|
||||
'user_comment' => '',
|
||||
'id_extra' => '',
|
||||
'id_user_ack' => '',
|
||||
|
@ -480,7 +487,7 @@ if ($get_filter_values) {
|
|||
'time_to' => '',
|
||||
'severity' => '',
|
||||
'event_type' => '',
|
||||
'group_rep' => 0,
|
||||
'group_rep' => EVENT_GROUP_REP_ALL,
|
||||
'id_group' => 0,
|
||||
'id_group_filter' => 0,
|
||||
'group_name' => 'All',
|
||||
|
@ -657,6 +664,8 @@ function load_form_filter() {
|
|||
$("#filter_only_alert").val(val);
|
||||
if (i == 'search_secondary_groups')
|
||||
$("#checkbox-search_secondary_groups").val(val);
|
||||
if (i == 'search_recursive_groups')
|
||||
$("#checkbox-search_recursive_groups").val(val);
|
||||
if (i == 'id_group_filter')
|
||||
$("#id_group_filter").val(val);
|
||||
if (i == 'source')
|
||||
|
@ -900,6 +909,7 @@ function save_new_filter() {
|
|||
"tag_without": Base64.decode($("#hidden-tag_without").val()),
|
||||
"filter_only_alert" : $("#filter_only_alert").val(),
|
||||
"search_secondary_groups" : $("#checkbox-search_secondary_groups").val(),
|
||||
"search_recursive_groups" : $("#checkbox-search_recursive_groups").val(),
|
||||
"id_group_filter": $("#id_group_filter_dialog").val(),
|
||||
"date_from": $("#text-date_from").val(),
|
||||
"time_from": $("#text-time_from").val(),
|
||||
|
@ -976,6 +986,7 @@ function save_update_filter() {
|
|||
"tag_without" : Base64.decode($("#hidden-tag_without").val()),
|
||||
"filter_only_alert" : $("#filter_only_alert").val(),
|
||||
"search_secondary_groups" : $("#checkbox-search_secondary_groups").val(),
|
||||
"search_recursive_groups" : $("#checkbox-search_recursive_groups").val(),
|
||||
"id_group_filter": $("#id_group_filter_dialog").val(),
|
||||
"date_from": $("#text-date_from").val(),
|
||||
"time_from": $("#text-time_from").val(),
|
||||
|
@ -1054,87 +1065,6 @@ $(document).ready(function (){
|
|||
}
|
||||
|
||||
|
||||
if ($get_response_description) {
|
||||
$response_id = get_parameter('response_id');
|
||||
|
||||
$description = db_get_value('description', 'tevent_response', 'id', $response_id);
|
||||
|
||||
if ($description === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$description = io_safe_output($description);
|
||||
$description = str_replace("\r\n", '<br>', $description);
|
||||
|
||||
echo $description;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_response_params) {
|
||||
if (! check_acl($config['id_user'], 0, 'EW')) {
|
||||
echo 'unauthorized';
|
||||
return;
|
||||
}
|
||||
|
||||
$response_id = get_parameter('response_id');
|
||||
|
||||
$params = db_get_value('params', 'tevent_response', 'id', $response_id);
|
||||
|
||||
if ($params === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo json_encode(explode(',', $params));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_response_target === true) {
|
||||
if (! check_acl($config['id_user'], 0, 'EW')) {
|
||||
echo 'unauthorized';
|
||||
return;
|
||||
}
|
||||
|
||||
$response_id = (int) get_parameter('response_id');
|
||||
$event_id = (int) get_parameter('event_id');
|
||||
$server_id = (int) get_parameter('server_id');
|
||||
|
||||
try {
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
) {
|
||||
$node = new Node($server_id);
|
||||
$node->connect();
|
||||
}
|
||||
|
||||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
||||
|
||||
if (empty($event_response) === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo events_get_response_target($event_id, $response_id);
|
||||
} catch (\Exception $e) {
|
||||
// Unexistent agent.
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
) {
|
||||
$node->disconnect();
|
||||
}
|
||||
|
||||
return;
|
||||
} finally {
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
) {
|
||||
$node->disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_response === true) {
|
||||
if (! check_acl($config['id_user'], 0, 'EW')) {
|
||||
echo 'unauthorized';
|
||||
|
@ -1142,62 +1072,27 @@ if ($get_response === true) {
|
|||
}
|
||||
|
||||
$response_id = get_parameter('response_id');
|
||||
$server_id = (int) get_parameter('server_id');
|
||||
$server_id = (int) get_parameter('server_id', 0);
|
||||
$event_id = (int) get_parameter('event_id', 0);
|
||||
$response_parameters = json_decode(
|
||||
io_safe_output(
|
||||
get_parameter('response_parameters', '')
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
try {
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
) {
|
||||
$node = new Node($server_id);
|
||||
$node->connect();
|
||||
}
|
||||
|
||||
$event_response = db_get_row(
|
||||
'tevent_response',
|
||||
'id',
|
||||
$response_id
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// Unexistent agent.
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
) {
|
||||
$node->disconnect();
|
||||
}
|
||||
|
||||
return;
|
||||
} finally {
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
) {
|
||||
$node->disconnect();
|
||||
}
|
||||
}
|
||||
$event_response = db_get_row(
|
||||
'tevent_response',
|
||||
'id',
|
||||
$response_id
|
||||
);
|
||||
|
||||
if (empty($event_response) === true) {
|
||||
return;
|
||||
return [];
|
||||
}
|
||||
|
||||
echo json_encode($event_response);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($perform_event_response === true) {
|
||||
global $config;
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'EW')) {
|
||||
echo 'unauthorized';
|
||||
return;
|
||||
}
|
||||
|
||||
$target = get_parameter('target', '');
|
||||
$response_id = get_parameter('response_id');
|
||||
$event_id = (int) get_parameter('event_id');
|
||||
$server_id = (int) get_parameter('server_id', 0);
|
||||
|
||||
$event_response = false;
|
||||
if (empty($target) === true) {
|
||||
if (empty($event_id) === false) {
|
||||
try {
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
|
@ -1206,20 +1101,12 @@ if ($perform_event_response === true) {
|
|||
$node->connect();
|
||||
}
|
||||
|
||||
$event_response = db_get_row(
|
||||
'tevent_response',
|
||||
'id',
|
||||
$response_id
|
||||
);
|
||||
|
||||
if (empty($event_response) === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
$command = events_get_response_target(
|
||||
$event_response['target'] = events_get_response_target(
|
||||
$event_id,
|
||||
$response_id,
|
||||
$server_id
|
||||
$event_response,
|
||||
$response_parameters,
|
||||
$server_id,
|
||||
($server_id !== 0) ? $node->server_name() : 'Metaconsole'
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// Unexistent agent.
|
||||
|
@ -1237,10 +1124,130 @@ if ($perform_event_response === true) {
|
|||
$node->disconnect();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$command = $target;
|
||||
}
|
||||
|
||||
echo json_encode($event_response);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ($get_response_massive === true) {
|
||||
if (! check_acl($config['id_user'], 0, 'EW')) {
|
||||
echo 'unauthorized';
|
||||
return;
|
||||
}
|
||||
|
||||
$response_id = get_parameter('response_id');
|
||||
|
||||
$event_response = db_get_row(
|
||||
'tevent_response',
|
||||
'id',
|
||||
$response_id
|
||||
);
|
||||
|
||||
if (empty($event_response) === true) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$events = json_decode(
|
||||
io_safe_output(
|
||||
get_parameter('events', '')
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
$response_parameters = json_decode(
|
||||
io_safe_output(
|
||||
get_parameter('response_parameters', '')
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
$event_response_targets = [];
|
||||
if (is_metaconsole() === true) {
|
||||
foreach ($events as $server_id => $idEvents) {
|
||||
foreach ($idEvents as $idEvent) {
|
||||
$event_response_targets[$idEvent.'|'.$server_id]['target'] = get_events_get_response_target(
|
||||
$idEvent,
|
||||
$event_response,
|
||||
$server_id,
|
||||
$response_parameters
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($events as $idEvent) {
|
||||
$event_response_targets[$idEvent]['target'] = get_events_get_response_target(
|
||||
$idEvent,
|
||||
$event_response,
|
||||
0,
|
||||
$response_parameters
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$result = [
|
||||
'event_response' => $event_response,
|
||||
'event_response_targets' => $event_response_targets,
|
||||
];
|
||||
|
||||
echo json_encode($result);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_row_response_action === true) {
|
||||
$response_id = get_parameter('response_id');
|
||||
$response = json_decode(
|
||||
io_safe_output(
|
||||
get_parameter('response', '')
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
$end = (bool) get_parameter('end', false);
|
||||
$index = $response['event_id'];
|
||||
if (is_metaconsole() === true) {
|
||||
$index .= '-'.$response['server_id'];
|
||||
}
|
||||
|
||||
echo get_row_response_action(
|
||||
$response,
|
||||
$response_id,
|
||||
$end,
|
||||
$index
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($perform_event_response === true) {
|
||||
global $config;
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'EW')) {
|
||||
echo __('unauthorized');
|
||||
return;
|
||||
}
|
||||
|
||||
$target = get_parameter('target', '');
|
||||
$response_id = get_parameter('response_id');
|
||||
$event_id = (int) get_parameter('event_id');
|
||||
$server_id = (int) get_parameter('server_id', 0);
|
||||
$response = json_decode(
|
||||
io_safe_output(
|
||||
get_parameter('response', '')
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
$event_response = $response;
|
||||
if (empty($event_response) === true) {
|
||||
echo __('No data');
|
||||
return;
|
||||
}
|
||||
|
||||
$command = $event_response['target'];
|
||||
$command_timeout = ($event_response !== false) ? $event_response['command_timeout'] : 90;
|
||||
if (enterprise_installed() === true) {
|
||||
if ($event_response !== false
|
||||
|
@ -1320,7 +1327,7 @@ if ($perform_event_response === true) {
|
|||
break;
|
||||
}
|
||||
|
||||
system($timeout_bin.' '.$command_timeout.' '.io_safe_output($command).' 2>&1', $ret_val);
|
||||
system($timeout_bin.' '.$command_timeout.' '.io_safe_output($command).' 2>&1', $ret_val);
|
||||
}
|
||||
|
||||
if ($ret_val != 0) {
|
||||
|
@ -1343,78 +1350,19 @@ if ($dialogue_event_response) {
|
|||
$event_id = get_parameter('event_id');
|
||||
$response_id = get_parameter('response_id');
|
||||
$command = get_parameter('target');
|
||||
$massive = get_parameter('massive');
|
||||
$end = get_parameter('end');
|
||||
$show_execute_again_btn = get_parameter('show_execute_again_btn');
|
||||
$out_iterator = get_parameter('out_iterator');
|
||||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
||||
$server_id = get_parameter('server_id');
|
||||
$event_response = json_decode(
|
||||
io_safe_output(
|
||||
get_parameter('response', '')
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
$event = db_get_row('tevento', 'id_evento', $event_id);
|
||||
|
||||
$prompt = '<br>> ';
|
||||
switch ($event_response['type']) {
|
||||
case 'command':
|
||||
$display_command = (bool) $event_response['display_command'];
|
||||
$command_str = ($display_command === true) ? $command : '';
|
||||
|
||||
if ($massive) {
|
||||
echo "<div class='left'>";
|
||||
echo $prompt.sprintf(
|
||||
'(Event #'.$event_id.') '.__(
|
||||
'Executing command: %s',
|
||||
$command_str
|
||||
)
|
||||
);
|
||||
echo '</div><br>';
|
||||
|
||||
echo "<div id='response_loading_command_".$out_iterator."' style='display: none'>";
|
||||
echo html_print_image(
|
||||
'images/spinner.gif',
|
||||
true
|
||||
);
|
||||
echo '</div><br>';
|
||||
echo "<br><div id='response_out_".$out_iterator."'><br><br></div><br>";
|
||||
|
||||
if ($end) {
|
||||
echo "<br><div id='re_exec_command_".$out_iterator."' style='display: none'><br>";
|
||||
html_print_button(
|
||||
__('Execute again'),
|
||||
'btn_str',
|
||||
false,
|
||||
'execute_event_response(false);',
|
||||
"class='sub next'"
|
||||
);
|
||||
echo "<span id='execute_again_loading' style='display: none'>";
|
||||
echo html_print_image(
|
||||
'images/spinner.gif',
|
||||
true
|
||||
);
|
||||
echo '</span>';
|
||||
echo '</div>';
|
||||
}
|
||||
} else {
|
||||
echo "<div class='left'>";
|
||||
|
||||
echo $prompt.'Executing command: '.$command_str;
|
||||
echo '</div><br>';
|
||||
|
||||
echo "<div id='response_loading_command' style='display:none'>";
|
||||
echo html_print_image('images/spinner.gif', true);
|
||||
echo '</div>';
|
||||
echo "<br><br><br><div id='response_out' class='left'></div>";
|
||||
|
||||
echo "<br><div id='re_exec_command' style='display:none'><br><br>";
|
||||
html_print_button(
|
||||
__('Execute again'),
|
||||
'btn_str',
|
||||
false,
|
||||
"perform_response({'target':'".$command."','event_id':".$event_id.",'server_id':".$server_id.'}, '.$response_id.');',
|
||||
"class='sub next'"
|
||||
);
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
echo get_row_response_action(
|
||||
$event_response,
|
||||
$response_id
|
||||
);
|
||||
break;
|
||||
|
||||
case 'url':
|
||||
|
@ -2474,11 +2422,12 @@ if ($get_events_fired) {
|
|||
'id_agent_module' => 0,
|
||||
'pagination' => 0,
|
||||
'id_user_ack' => 0,
|
||||
'group_rep' => 0,
|
||||
'group_rep' => EVENT_GROUP_REP_ALL,
|
||||
'tag_with' => [],
|
||||
'tag_without' => [],
|
||||
'filter_only_alert' => -1,
|
||||
'search_secondary_groups' => 0,
|
||||
'search_recursive_groups' => 0,
|
||||
'source' => '',
|
||||
'id_extra' => '',
|
||||
'user_comment' => '',
|
||||
|
@ -2534,3 +2483,75 @@ if ($get_events_fired) {
|
|||
echo io_json_mb_encode($return);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($draw_row_response_info === true) {
|
||||
$event_response = json_decode(
|
||||
io_safe_output(
|
||||
get_parameter('response', '')
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
$massive = (bool) get_parameter('massive', false);
|
||||
|
||||
$output .= '';
|
||||
if ($massive === true) {
|
||||
$output .= '<div>';
|
||||
$output .= '<h5>';
|
||||
$output .= $event_response['description'];
|
||||
$output .= '</h5>';
|
||||
$output .= '</div>';
|
||||
} else {
|
||||
$output .= '<tr class="params_rows">';
|
||||
$output .= '<td>';
|
||||
$output .= __('Description');
|
||||
$output .= '</td>';
|
||||
$output .= '<td class="height_30px" colspan="2">';
|
||||
$output .= $event_response['description'];
|
||||
$output .= '</td>';
|
||||
$output .= '</tr>';
|
||||
}
|
||||
|
||||
if (empty($event_response['params']) === false) {
|
||||
$response_params = explode(',', $event_response['params']);
|
||||
if (is_array($response_params) === true) {
|
||||
if ($massive === true) {
|
||||
$output .= '<div>';
|
||||
} else {
|
||||
$output .= '<tr class="params_rows">';
|
||||
$output .= '<td class="left pdd_l_20px height_30px" colspan="3">';
|
||||
$output .= __('Parameters');
|
||||
$output .= '</td>';
|
||||
$output .= '</tr>';
|
||||
}
|
||||
|
||||
foreach ($response_params as $param) {
|
||||
$param = trim(io_safe_output($param));
|
||||
if ($massive === true) {
|
||||
$output .= '<div>';
|
||||
$output .= '<label>';
|
||||
$output .= $param;
|
||||
$output .= '</label>';
|
||||
$output .= '<input type="text" name="values_params_'.$param.'" />';
|
||||
$output .= '</div>';
|
||||
} else {
|
||||
$output .= '<tr class="params_rows">';
|
||||
$output .= '<td style="text-align:left; padding-left:40px; font-weight: normal; font-style: italic;">';
|
||||
$output .= $param;
|
||||
$output .= '</td>';
|
||||
$output .= '<td style="text-align:left" colspan="2">';
|
||||
$output .= '<input type="text" name="values_params_'.$param.'" />';
|
||||
$output .= '</td>';
|
||||
$output .= '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($massive === true) {
|
||||
$output .= '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo $output;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ if (is_ajax() === true) {
|
|||
0 => __('Group agents'),
|
||||
1 => __('Group modules by tag'),
|
||||
2 => __('Group modules by module group'),
|
||||
3 => __('Group modules by agents'),
|
||||
],
|
||||
'type',
|
||||
$type,
|
||||
|
@ -203,6 +204,10 @@ if (is_ajax() === true) {
|
|||
'5'
|
||||
);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// Empty.
|
||||
break;
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
@ -212,6 +217,7 @@ if (is_ajax() === true) {
|
|||
enterprise_include_once('include/functions_agents.php');
|
||||
$id = get_parameter('id', 0);
|
||||
switch ($type) {
|
||||
case 3:
|
||||
case 2:
|
||||
$data = db_get_row('tagente_modulo', 'id_agente_modulo', $id);
|
||||
|
||||
|
|
|
@ -1,22 +1,38 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; 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.
|
||||
/**
|
||||
* MySQL Authentication functions.
|
||||
*
|
||||
* @category Functions.
|
||||
* @package Pandora FMS
|
||||
* @subpackage Login.
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
/**
|
||||
* @package Include/auth
|
||||
*/
|
||||
|
||||
if (!isset($config)) {
|
||||
if (isset($config) === false) {
|
||||
die(
|
||||
'
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
@ -63,7 +79,7 @@ $config['user_can_update_password'] = true;
|
|||
$config['admin_can_add_user'] = true;
|
||||
$config['admin_can_delete_user'] = true;
|
||||
$config['admin_can_disable_user'] = false;
|
||||
// currently not implemented
|
||||
// Currently not implemented.
|
||||
$config['admin_can_make_admin'] = true;
|
||||
|
||||
|
||||
|
@ -289,7 +305,7 @@ function process_user_login_remote($login, $pass, $api=false)
|
|||
|
||||
// Authentication ok, check if the user exists in the local database
|
||||
if (is_user($login)) {
|
||||
if (!user_can_login($login)) {
|
||||
if (!user_can_login($login) && $api === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -544,7 +560,7 @@ function get_user_fullname($user)
|
|||
/**
|
||||
* Gets the users email
|
||||
*
|
||||
* @param mixed User id.
|
||||
* @param mixed $user User id.
|
||||
*
|
||||
* @return string The users email address
|
||||
*/
|
||||
|
@ -557,14 +573,14 @@ function get_user_email($user)
|
|||
/**
|
||||
* Gets a Users info
|
||||
*
|
||||
* @param mixed User id
|
||||
* @param mixed $user User id.
|
||||
*
|
||||
* @return mixed An array of users
|
||||
*/
|
||||
function get_user_info($user)
|
||||
{
|
||||
static $cache_user_info = [];
|
||||
if (array_key_exists($user, $cache_user_info)) {
|
||||
if (array_key_exists($user, $cache_user_info) === true) {
|
||||
return $cache_user_info[$user];
|
||||
} else {
|
||||
$return = db_get_row('tusuario', 'id_user', get_user_id($user));
|
||||
|
@ -579,24 +595,19 @@ function get_user_info($user)
|
|||
* We can't simplify this because some auth schemes (like LDAP) automatically (or it's at least cheaper to) return all the information
|
||||
* Functions like get_user_info allow selection of specifics (in functions_db)
|
||||
*
|
||||
* @param string Field to order by (id_user, fullname or registered)
|
||||
* @param mixed $order Field to order by (id_user, fullname or registered).
|
||||
* @param string $filter Filter.
|
||||
* @param string $fields Fields.
|
||||
*
|
||||
* @return array An array of user information
|
||||
*/
|
||||
function get_users($order='fullname', $filter=false, $fields=false)
|
||||
{
|
||||
if (is_array($order)) {
|
||||
if (is_array($order) === true) {
|
||||
$filter['order'] = $order['field'].' '.$order['order'];
|
||||
} else {
|
||||
switch ($order) {
|
||||
case 'registered':
|
||||
case 'last_connect':
|
||||
case 'fullname':
|
||||
break;
|
||||
|
||||
default:
|
||||
$order = 'fullname';
|
||||
break;
|
||||
if ($order !== 'registered' || $order !== 'last_connect' || $order !== 'fullname') {
|
||||
$order = 'fullname';
|
||||
}
|
||||
|
||||
$filter['order'] = $order.' ASC';
|
||||
|
@ -618,9 +629,11 @@ function get_users($order='fullname', $filter=false, $fields=false)
|
|||
/**
|
||||
* Sets the last login for a user
|
||||
*
|
||||
* @param string User id
|
||||
* @param string $id_user User id.
|
||||
*
|
||||
* @return mixed.
|
||||
*/
|
||||
function process_user_contact($id_user)
|
||||
function process_user_contact(string $id_user)
|
||||
{
|
||||
return db_process_sql_update(
|
||||
'tusuario',
|
||||
|
@ -633,6 +646,10 @@ function process_user_contact($id_user)
|
|||
/**
|
||||
* Create a new user
|
||||
*
|
||||
* @param string $id_user Id User.
|
||||
* @param string $password Password for this user.
|
||||
* @param array $user_info Array with information of the user.
|
||||
*
|
||||
* @return boolean false
|
||||
*/
|
||||
function create_user($id_user, $password, $user_info)
|
||||
|
@ -643,16 +660,48 @@ function create_user($id_user, $password, $user_info)
|
|||
$values['last_connect'] = 0;
|
||||
$values['registered'] = get_system_time();
|
||||
|
||||
return (@db_process_sql_insert('tusuario', $values)) !== false;
|
||||
$output = (@db_process_sql_insert('tusuario', $values)) !== false;
|
||||
|
||||
// Add user to notification system.
|
||||
if ($output !== false) {
|
||||
if (isset($values['is_admin']) === true && (bool) $values['is_admin'] === true) {
|
||||
// Administrator user must be activated in all notifications sections.
|
||||
$notificationSources = db_get_all_rows_filter('tnotification_source', [], 'id');
|
||||
foreach ($notificationSources as $notification) {
|
||||
@db_process_sql_insert(
|
||||
'tnotification_source_user',
|
||||
[
|
||||
'id_source' => $notification['id'],
|
||||
'id_user' => $id_user,
|
||||
]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Other users only will be activated in `Message` notifications.
|
||||
$notificationSource = db_get_value('id', 'tnotification_source', 'description', 'Message');
|
||||
@db_process_sql_insert(
|
||||
'tnotification_source_user',
|
||||
[
|
||||
'id_source' => $notificationSource,
|
||||
'id_user' => $id_user,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save password history
|
||||
*
|
||||
* @param string $id_user Id User.
|
||||
* @param string $password Password of user.
|
||||
*
|
||||
* @return boolean false
|
||||
*/
|
||||
function save_pass_history($id_user, $password)
|
||||
function save_pass_history(string $id_user, string $password)
|
||||
{
|
||||
$values['id_user'] = $id_user;
|
||||
$values['password'] = md5($password);
|
||||
|
@ -665,9 +714,11 @@ function save_pass_history($id_user, $password)
|
|||
/**
|
||||
* Deletes the user
|
||||
*
|
||||
* @param string User id
|
||||
* @param string $id_user User id.
|
||||
*
|
||||
* @return boolean.
|
||||
*/
|
||||
function delete_user($id_user)
|
||||
function delete_user(string $id_user)
|
||||
{
|
||||
$result = db_process_sql_delete(
|
||||
'tusuario_perfil',
|
||||
|
@ -685,6 +736,12 @@ function delete_user($id_user)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Remove from notification list as well.
|
||||
$result = db_process_sql_delete(
|
||||
'tnotification_source_user',
|
||||
['id_user' => $id_user]
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -693,15 +750,21 @@ function delete_user($id_user)
|
|||
* Update the password in MD5 for user pass as id_user with
|
||||
* password in plain text.
|
||||
*
|
||||
* @param string user User ID
|
||||
* @param string password Password in plain text.
|
||||
* @param string $user User ID.
|
||||
* @param string $password_new Password in plain text.
|
||||
*
|
||||
* @return mixed False in case of error or invalid values passed. Affected rows otherwise
|
||||
*/
|
||||
function update_user_password($user, $password_new)
|
||||
function update_user_password(string $user, string $password_new)
|
||||
{
|
||||
global $config;
|
||||
if (isset($config['auth']) && $config['auth'] == 'pandora') {
|
||||
|
||||
if (excludedPassword($password_new) === true) {
|
||||
$config['auth_error'] = __('The password provided is not valid. Please, set another one.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($config['auth']) === true && $config['auth'] === 'pandora') {
|
||||
$sql = sprintf(
|
||||
"UPDATE tusuario SET password = '".md5($password_new)."', last_pass_change = '".date('Y-m-d H:i:s', get_system_time())."' WHERE id_user = '".$user."'"
|
||||
);
|
||||
|
@ -714,7 +777,7 @@ function update_user_password($user, $password_new)
|
|||
);
|
||||
$remote_pass_update = db_process_sql($sql, 'affected_rows', $connection);
|
||||
|
||||
if (!$remote_pass_update) {
|
||||
if ((bool) $remote_pass_update === false) {
|
||||
$config['auth_error'] = __('Could not changes password on remote pandora');
|
||||
return false;
|
||||
}
|
||||
|
@ -735,14 +798,14 @@ function update_user_password($user, $password_new)
|
|||
* Update the data of a user that user is choose with
|
||||
* id_user.
|
||||
*
|
||||
* @param string user User ID
|
||||
* @param array values Associative array with index as name of field and content.
|
||||
* @param string $id_user User ID.
|
||||
* @param array $values Associative array with index as name of field and content.
|
||||
*
|
||||
* @return mixed False in case of error or invalid values passed. Affected rows otherwise
|
||||
*/
|
||||
function update_user($id_user, $values)
|
||||
function update_user(string $id_user, array $values)
|
||||
{
|
||||
if (! is_array($values)) {
|
||||
if (is_array($values) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -783,6 +846,9 @@ function ldap_process_user_login($login, $password, $secondary_server=false)
|
|||
$ldap[$token] = $secondary_server === true ? $config[$token.'_secondary'] : $config[$token];
|
||||
}
|
||||
|
||||
// Remove entities ldap admin pass.
|
||||
$ldap['ldap_admin_pass'] = io_safe_output($ldap['ldap_admin_pass']);
|
||||
|
||||
// Connect to the LDAP server
|
||||
if (stripos($ldap['ldap_server'], 'ldap://') !== false
|
||||
|| stripos($ldap['ldap_server'], 'ldaps://') !== false
|
||||
|
@ -799,8 +865,16 @@ function ldap_process_user_login($login, $password, $secondary_server=false)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Set the LDAP version
|
||||
// Set the LDAP version.
|
||||
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, $ldap['ldap_version']);
|
||||
ldap_set_option($ds, LDAP_OPT_NETWORK_TIMEOUT, 1);
|
||||
|
||||
// Set ldap search timeout.
|
||||
ldap_set_option(
|
||||
$ds,
|
||||
LDAP_OPT_TIMELIMIT,
|
||||
(empty($config['ldap_search_timeout']) === true) ? 5 : ((int) $config['ldap_search_timeout'])
|
||||
);
|
||||
|
||||
if ($ldap['ldap_start_tls']) {
|
||||
if (!@ldap_start_tls($ds)) {
|
||||
|
@ -821,7 +895,8 @@ function ldap_process_user_login($login, $password, $secondary_server=false)
|
|||
io_safe_output($ldap['ldap_admin_login']),
|
||||
io_output_password($ldap['ldap_admin_pass']),
|
||||
io_safe_output($login),
|
||||
$ldap['ldap_start_tls']
|
||||
$ldap['ldap_start_tls'],
|
||||
$config['ldap_search_timeout']
|
||||
);
|
||||
|
||||
if ($sr) {
|
||||
|
@ -1430,7 +1505,8 @@ function local_ldap_search(
|
|||
$ldap_admin_user=null,
|
||||
$ldap_admin_pass=null,
|
||||
$user=null,
|
||||
$ldap_start_tls=null
|
||||
$ldap_start_tls=null,
|
||||
$ldap_search_time=5
|
||||
) {
|
||||
global $config;
|
||||
|
||||
|
@ -1463,8 +1539,8 @@ function local_ldap_search(
|
|||
}
|
||||
|
||||
$dn = " -b '".$dn."'";
|
||||
|
||||
$shell_ldap_search = explode("\n", shell_exec('ldapsearch -LLL -o ldif-wrap=no -x'.$ldap_host.$ldap_version.' -E pr=10000/noprompt '.$ldap_admin_user.$ldap_admin_pass.$dn.$filter.$tls.' | grep -v "^#\|^$" | sed "s/:\+ /=>/g"'));
|
||||
$ldapsearch_command = 'ldapsearch -LLL -o ldif-wrap=no -o nettimeout='.$ldap_search_time.' -x'.$ldap_host.$ldap_version.' -E pr=10000/noprompt '.$ldap_admin_user.$ldap_admin_pass.$dn.$filter.$tls.' | grep -v "^#\|^$" | sed "s/:\+ /=>/g"';
|
||||
$shell_ldap_search = explode("\n", shell_exec($ldapsearch_command));
|
||||
foreach ($shell_ldap_search as $line) {
|
||||
$values = explode('=>', $line);
|
||||
if (!empty($values[0]) && !empty($values[1])) {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -285,6 +285,13 @@ class AgentWizard extends HTML
|
|||
*/
|
||||
private $wmiBinary = '';
|
||||
|
||||
/**
|
||||
* Default values for SNMP Interfaces.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $defaultSNMPValues = [];
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -319,6 +326,7 @@ class AgentWizard extends HTML
|
|||
$this->idPolicy = get_parameter('id', '');
|
||||
$this->targetIp = get_parameter('targetIp', '');
|
||||
$this->wmiBinary = $config['wmiBinary'];
|
||||
$this->defaultSNMPValues = (array) json_decode(io_safe_output($config['agent_wizard_defaults']));
|
||||
|
||||
if (empty($this->idAgent) === false) {
|
||||
$array_aux = db_get_all_rows_sql(
|
||||
|
@ -330,7 +338,7 @@ class AgentWizard extends HTML
|
|||
)
|
||||
);
|
||||
|
||||
if (!empty($array_aux)) {
|
||||
if (empty($array_aux) === false) {
|
||||
$this->datalist = [];
|
||||
foreach ($array_aux as $key => $value) {
|
||||
$this->datalist[] = $value['ip'];
|
||||
|
@ -547,7 +555,7 @@ class AgentWizard extends HTML
|
|||
// Fill with servers to perform the discover.
|
||||
$fieldsServers = [];
|
||||
$fieldsServers[0] = __('Local console');
|
||||
if (enterprise_installed()) {
|
||||
if (enterprise_installed() === true) {
|
||||
enterprise_include_once('include/functions_satellite.php');
|
||||
// Get the servers.
|
||||
$rows = get_proxy_servers();
|
||||
|
@ -607,7 +615,7 @@ class AgentWizard extends HTML
|
|||
],
|
||||
];
|
||||
|
||||
if (!empty($this->datalist)) {
|
||||
if (empty($this->datalist) === false) {
|
||||
$inputs[] = [
|
||||
'id' => 'li_address_list',
|
||||
'arguments' => [
|
||||
|
@ -4719,7 +4727,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.2.2.1.8.'.$value,
|
||||
'module_unit' => '',
|
||||
'default_enabled' => true,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifOperStatus'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => $min_warning,
|
||||
|
@ -4776,7 +4784,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.4.1.9.2.2.1.1.12.'.$value,
|
||||
'module_unit' => 'packets/s',
|
||||
'default_enabled' => true,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['locIfInCRC'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -4830,7 +4838,7 @@ class AgentWizard extends HTML
|
|||
'module_info' => 'Indicates whether the port is operating in half-duplex, full-duplex, disagree or auto negotiation mode. If the port could not agree with the far end on port duplex, the port will be in disagree(3) mode.',
|
||||
'execution_type' => 'network',
|
||||
'value' => $duplexMismatchOID,
|
||||
'default_enabled' => true,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['DuplexMismatch'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -4919,7 +4927,7 @@ class AgentWizard extends HTML
|
|||
'id_plugin' => $plugin_id,
|
||||
'id_modulo' => MODULE_PLUGIN,
|
||||
'macros' => json_encode($macros),
|
||||
'default_enabled' => true,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['Bandwidth'],
|
||||
'module_enabled' => false,
|
||||
'module_unit' => '%',
|
||||
'module_thresholds' => [
|
||||
|
@ -4958,7 +4966,7 @@ class AgentWizard extends HTML
|
|||
'id_plugin' => $plugin_id,
|
||||
'id_modulo' => MODULE_PLUGIN,
|
||||
'macros' => json_encode($macros),
|
||||
'default_enabled' => true,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['inUsage'],
|
||||
'module_enabled' => false,
|
||||
'module_unit' => '%',
|
||||
'module_thresholds' => [
|
||||
|
@ -4997,7 +5005,7 @@ class AgentWizard extends HTML
|
|||
'id_plugin' => $plugin_id,
|
||||
'id_modulo' => MODULE_PLUGIN,
|
||||
'macros' => json_encode($macros),
|
||||
'default_enabled' => true,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['outUsage'],
|
||||
'module_enabled' => false,
|
||||
'module_unit' => '%',
|
||||
'module_thresholds' => [
|
||||
|
@ -5029,7 +5037,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.2.2.1.7.'.$value,
|
||||
'module_unit' => '',
|
||||
'default_enabled' => false,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifAdminStatus'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5056,7 +5064,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.2.2.1.13.'.$value,
|
||||
'module_unit' => 'packets/s',
|
||||
'default_enabled' => false,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifInDiscards'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5083,7 +5091,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.2.2.1.19.'.$value,
|
||||
'module_unit' => 'packets/s',
|
||||
'default_enabled' => false,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifOutDiscards'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5110,7 +5118,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.2.2.1.14.'.$value,
|
||||
'module_unit' => 'packets/s',
|
||||
'default_enabled' => false,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifInErrors'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5137,7 +5145,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.2.2.1.20.'.$value,
|
||||
'module_unit' => 'packets/s',
|
||||
'default_enabled' => false,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifOutErrors'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5207,7 +5215,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.2.2.1.10.'.$value,
|
||||
'module_unit' => 'bytes/s',
|
||||
'default_enabled' => true,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifInOctets'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5235,7 +5243,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.2.2.1.16.'.$value,
|
||||
'module_unit' => 'bytes/s',
|
||||
'default_enabled' => true,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifOutOctets'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5263,7 +5271,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.2.2.1.11.'.$value,
|
||||
'module_unit' => 'packets/s',
|
||||
'default_enabled' => false,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifInUcastPkts'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5290,7 +5298,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.2.2.1.17.'.$value,
|
||||
'module_unit' => 'packets/s',
|
||||
'default_enabled' => false,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifOutUcastPkts'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5317,7 +5325,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.2.2.1.12.'.$value,
|
||||
'module_unit' => 'packets/s',
|
||||
'default_enabled' => false,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifInNUcastPkts'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5344,7 +5352,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.2.2.1.18.'.$value,
|
||||
'module_unit' => 'packets/s',
|
||||
'default_enabled' => false,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifOutNUcastPkts'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5414,7 +5422,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.31.1.1.1.6.'.$value,
|
||||
'module_unit' => 'bytes/s',
|
||||
'default_enabled' => true,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifHCInOctets'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5442,7 +5450,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.31.1.1.1.10.'.$value,
|
||||
'module_unit' => 'bytes/s',
|
||||
'default_enabled' => true,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifHCOutOctets'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5470,7 +5478,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.31.1.1.1.7.'.$value,
|
||||
'module_unit' => 'packets/s',
|
||||
'default_enabled' => false,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifHCInUcastPkts'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5498,7 +5506,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.31.1.1.1.11.'.$value,
|
||||
'module_unit' => 'packets/s',
|
||||
'default_enabled' => false,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifHCOutUcastPkts'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5525,7 +5533,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.31.1.1.1.7.'.$value,
|
||||
'module_unit' => 'packets/s',
|
||||
'default_enabled' => false,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifHCInNUcastPkts'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
@ -5552,7 +5560,7 @@ class AgentWizard extends HTML
|
|||
'execution_type' => 'network',
|
||||
'value' => '1.3.6.1.2.1.31.1.1.1.11.'.$value,
|
||||
'module_unit' => 'packets/s',
|
||||
'default_enabled' => false,
|
||||
'default_enabled' => (bool) $this->defaultSNMPValues['ifHCOutNUcastPkts'],
|
||||
'module_enabled' => false,
|
||||
'module_thresholds' => [
|
||||
'min_warning' => '0',
|
||||
|
|
|
@ -44,7 +44,7 @@ class AuditLog extends HTML
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public $AJAXMethods = [ 'draw' ];
|
||||
public $AJAXMethods = ['draw'];
|
||||
|
||||
/**
|
||||
* Ajax page.
|
||||
|
@ -78,7 +78,6 @@ class AuditLog extends HTML
|
|||
|
||||
// Set the ajax controller.
|
||||
$this->ajaxController = $ajaxController;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -232,7 +231,6 @@ class AuditLog extends HTML
|
|||
|
||||
// Load own javascript file.
|
||||
echo $this->loadJS();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -368,39 +366,38 @@ class AuditLog extends HTML
|
|||
|
||||
// Javascript content.
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function format ( d ) {
|
||||
var output = '';
|
||||
<script type="text/javascript">
|
||||
function format(d) {
|
||||
var output = '';
|
||||
|
||||
if (d.extendedInfo === '') {
|
||||
output = "<?php echo __('There is no additional information to display'); ?>";
|
||||
} else {
|
||||
output = d.extendedInfo;
|
||||
}
|
||||
|
||||
return output;
|
||||
if (d.extendedInfo === '') {
|
||||
output = "<?php echo __('There is no additional information to display'); ?>";
|
||||
} else {
|
||||
output = d.extendedInfo;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
// Add event listener for opening and closing details
|
||||
$('#audit_logs tbody').on('click', 'td.show_extended_info', function () {
|
||||
var tr = $(this).closest('tr');
|
||||
var table = <?php echo 'dt_'.$this->tableId; ?>;
|
||||
var row = table.row( tr );
|
||||
|
||||
if ( row.child.isShown() ) {
|
||||
// This row is already open - close it
|
||||
row.child.hide();
|
||||
tr.removeClass('shown');
|
||||
}
|
||||
else {
|
||||
// Open this row
|
||||
row.child( format(row.data()) ).show();
|
||||
tr.addClass('shown');
|
||||
}
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
// Add event listener for opening and closing details
|
||||
$('#audit_logs tbody').on('click', 'td.show_extended_info', function() {
|
||||
var tr = $(this).closest('tr');
|
||||
var table = $("#<?php echo $this->tableId; ?>").DataTable();
|
||||
var row = table.row(tr);
|
||||
|
||||
if (row.child.isShown()) {
|
||||
// This row is already open - close it
|
||||
row.child.hide();
|
||||
tr.removeClass('shown');
|
||||
} else {
|
||||
// Open this row
|
||||
row.child(format(row.data())).show();
|
||||
tr.addClass('shown');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
// EOF Javascript content.
|
||||
return ob_get_clean();
|
||||
|
|
|
@ -933,7 +933,13 @@ class HTML
|
|||
$cb_args = $data['cb_args'];
|
||||
|
||||
$output_head = '<form class="discovery" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
|
||||
$output_head .= '" '.$form['extra'].'>';
|
||||
$output_head .= '" id="'.$form['id'].'" '.$form['extra'].'>';
|
||||
|
||||
if (isset($form['title']) === true && empty($form['title']) === false) {
|
||||
$output_head .= '<div class="form_title"">';
|
||||
$output_head .= '<span>'.$form['title'].'</span>';
|
||||
$output_head .= '</div>';
|
||||
}
|
||||
|
||||
if ($return === false) {
|
||||
echo $output_head;
|
||||
|
|
|
@ -139,7 +139,7 @@ class Heatmap
|
|||
ui_require_css_file('heatmap');
|
||||
|
||||
$settings = [
|
||||
'type' => 'POST',
|
||||
'type' => 'GET',
|
||||
'dataType' => 'html',
|
||||
'url' => ui_get_full_url(
|
||||
'ajax.php',
|
||||
|
@ -169,11 +169,41 @@ class Heatmap
|
|||
setting['data']['height'] = $(`#div_${randomId}`).height() + 10;
|
||||
setting['data']['width'] = $(`#div_${randomId}`).width();
|
||||
|
||||
var totalModules = 0;
|
||||
|
||||
// Initial charge.
|
||||
ajaxRequest(
|
||||
`div_${randomId}`,
|
||||
setting
|
||||
);
|
||||
$.ajax({
|
||||
type: setting.type,
|
||||
dataType: setting.dataType,
|
||||
url: setting.url,
|
||||
data: setting.data,
|
||||
success: function(data) {
|
||||
$(`#div_${randomId}`).append(data);
|
||||
totalModules = $('rect').length;
|
||||
let cont = 0;
|
||||
while (cont < Math.ceil(totalModules / 10)) {
|
||||
oneSquare(getRandomInteger(1, 10), getRandomInteger(100, 900));
|
||||
cont ++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function getRandomInteger(min, max) {
|
||||
return Math.floor(Math.random() * max) + min;
|
||||
}
|
||||
|
||||
function oneSquare(solid, time) {
|
||||
var randomPoint = getRandomInteger(1, totalModules);
|
||||
let target = $(`#${randomId}_${randomPoint}`);
|
||||
setTimeout(function() {
|
||||
let class_name = target.attr('class');
|
||||
class_name = class_name.split(' ')[0];
|
||||
const newClassName = class_name.split('_')[0];
|
||||
target.removeClass(`${class_name} hover`);
|
||||
target.addClass(`${newClassName}_${solid} hover`);
|
||||
oneSquare(getRandomInteger(1, 10), getRandomInteger(100, 900));
|
||||
}, time);
|
||||
}
|
||||
|
||||
// Refresh.
|
||||
setInterval(
|
||||
|
@ -206,23 +236,29 @@ class Heatmap
|
|||
// randomly sort.
|
||||
lista = lista.sort(function() {return Math.random() - 0.5});
|
||||
|
||||
const countPerSecond = total / refresh;
|
||||
let countPerSecond = total / refresh;
|
||||
if (countPerSecond < 1) {
|
||||
countPerSecond = 1;
|
||||
}
|
||||
|
||||
let cont = 0;
|
||||
let limit = countPerSecond - 1;
|
||||
|
||||
const timer = setInterval(
|
||||
function() {
|
||||
while (cont <= limit) {
|
||||
$(`#${randomId}_${lista[cont]['id']}`).removeClass();
|
||||
$(`#${randomId}_${lista[cont]['id']}`).addClass(`${lista[cont]['status']} hover`);
|
||||
|
||||
cont++;
|
||||
function() {
|
||||
while (cont <= limit) {
|
||||
if (typeof lista[cont] !== 'undefined') {
|
||||
const rect = document.getElementsByName(`${lista[cont]['id']}`);
|
||||
$(`#${rect[0].id}`).removeClass();
|
||||
$(`#${rect[0].id}`).addClass(`${lista[cont]['status']} hover`);
|
||||
}
|
||||
limit = limit + countPerSecond;
|
||||
},
|
||||
1000
|
||||
);
|
||||
|
||||
cont++;
|
||||
}
|
||||
limit = limit + countPerSecond;
|
||||
},
|
||||
1000
|
||||
);
|
||||
|
||||
setTimeout(
|
||||
function(){
|
||||
|
@ -314,8 +350,10 @@ class Heatmap
|
|||
|
||||
// All agents.
|
||||
$sql = sprintf(
|
||||
'SELECT DISTINCT id_agente as id,alias,id_grupo,normal_count,warning_count,critical_count, unknown_count,notinit_count,total_count,fired_count,
|
||||
(SELECT last_status_change FROM tagente_estado WHERE id_agente = tagente.id_agente ORDER BY last_status_change DESC LIMIT 1) AS last_status_change
|
||||
'SELECT DISTINCT id_agente as id,alias,id_grupo,normal_count,warning_count,critical_count,
|
||||
unknown_count,notinit_count,total_count,fired_count,
|
||||
(SELECT last_status_change FROM tagente_estado WHERE id_agente = tagente.id_agente
|
||||
ORDER BY last_status_change DESC LIMIT 1) AS last_status_change
|
||||
FROM tagente WHERE `disabled` = 0 %s %s ORDER BY id_grupo,id_agente ASC',
|
||||
$alias,
|
||||
$id_grupo
|
||||
|
@ -391,7 +429,8 @@ class Heatmap
|
|||
|
||||
// All modules.
|
||||
$sql = sprintf(
|
||||
'SELECT am.id_agente_modulo AS id, ae.known_status AS `status`, am.id_module_group AS id_grupo, ae.last_status_change FROM tagente_modulo am
|
||||
'SELECT am.id_agente_modulo AS id, ae.estado AS `status`, am.id_module_group AS id_grupo,
|
||||
ae.last_status_change FROM tagente_modulo am
|
||||
INNER JOIN tagente_estado ae ON am.id_agente_modulo = ae.id_agente_modulo
|
||||
WHERE am.disabled = 0 %s %s GROUP BY am.id_module_group, am.id_agente_modulo',
|
||||
$filter_group,
|
||||
|
@ -489,7 +528,8 @@ class Heatmap
|
|||
|
||||
// All modules.
|
||||
$sql = sprintf(
|
||||
'SELECT ae.id_agente_modulo AS id, ae.known_status AS `status`, tm.id_tag AS id_grupo, ae.last_status_change FROM tagente_estado ae
|
||||
'SELECT ae.id_agente_modulo AS id, ae.estado AS `status`, tm.id_tag AS id_grupo,
|
||||
ae.last_status_change FROM tagente_estado ae
|
||||
INNER JOIN ttag_module tm ON tm.id_agente_modulo = ae.id_agente_modulo
|
||||
WHERE 1=1 %s %s GROUP BY tm.id_tag, ae.id_agente_modulo',
|
||||
$filter_tag,
|
||||
|
@ -567,6 +607,98 @@ class Heatmap
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all modules group by agents
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getAllModulesByAgents()
|
||||
{
|
||||
$filter_name = '';
|
||||
if (empty($this->search) === false) {
|
||||
$filter_name = 'AND nombre LIKE "%'.$this->search.'%"';
|
||||
}
|
||||
|
||||
// All modules.
|
||||
$sql = sprintf(
|
||||
'SELECT am.id_agente_modulo AS id, ae.estado AS `status`, am.id_agente AS id_grupo,
|
||||
ae.last_status_change FROM tagente_modulo am
|
||||
INNER JOIN tagente_estado ae ON am.id_agente_modulo = ae.id_agente_modulo
|
||||
WHERE am.disabled = 0 %s GROUP BY ae.id_agente_modulo ORDER BY id_grupo',
|
||||
$filter_name
|
||||
);
|
||||
|
||||
$result = db_get_all_rows_sql($sql);
|
||||
|
||||
// Module status.
|
||||
foreach ($result as $key => $module) {
|
||||
$status = '';
|
||||
switch ($module['status']) {
|
||||
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||
case 1:
|
||||
case 100:
|
||||
$status = 'critical';
|
||||
break;
|
||||
|
||||
case AGENT_MODULE_STATUS_NORMAL:
|
||||
case AGENT_MODULE_STATUS_NORMAL_ALERT:
|
||||
case 0:
|
||||
case 300:
|
||||
$status = 'normal';
|
||||
break;
|
||||
|
||||
case AGENT_MODULE_STATUS_WARNING:
|
||||
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
||||
case 2:
|
||||
case 200:
|
||||
$status = 'warning';
|
||||
break;
|
||||
|
||||
default:
|
||||
case AGENT_MODULE_STATUS_UNKNOWN:
|
||||
case 3:
|
||||
$status = 'unknown';
|
||||
break;
|
||||
case AGENT_MODULE_STATUS_NOT_INIT:
|
||||
case 5:
|
||||
$status = 'notinit';
|
||||
break;
|
||||
}
|
||||
|
||||
if ($module['last_status_change'] != 0) {
|
||||
$seconds = (time() - $module['last_status_change']);
|
||||
|
||||
if ($seconds >= SECONDS_1DAY) {
|
||||
$status .= '_10';
|
||||
} else if ($seconds >= 77760) {
|
||||
$status .= '_9';
|
||||
} else if ($seconds >= 69120) {
|
||||
$status .= '_8';
|
||||
} else if ($seconds >= 60480) {
|
||||
$status .= '_7';
|
||||
} else if ($seconds >= 51840) {
|
||||
$status .= '_6';
|
||||
} else if ($seconds >= 43200) {
|
||||
$status .= '_5';
|
||||
} else if ($seconds >= 34560) {
|
||||
$status .= '_4';
|
||||
} else if ($seconds >= 25920) {
|
||||
$status .= '_3';
|
||||
} else if ($seconds >= 17280) {
|
||||
$status .= '_2';
|
||||
} else if ($seconds >= 8640) {
|
||||
$status .= '_1';
|
||||
}
|
||||
}
|
||||
|
||||
$result[$key]['status'] = $status;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* GetData
|
||||
*
|
||||
|
@ -575,6 +707,10 @@ class Heatmap
|
|||
public function getData()
|
||||
{
|
||||
switch ($this->type) {
|
||||
case 3:
|
||||
$data = $this->getAllModulesByAgents();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$data = $this->getAllModulesByGroup();
|
||||
break;
|
||||
|
@ -709,9 +845,10 @@ class Heatmap
|
|||
$groups = [];
|
||||
$contX = 0;
|
||||
$contY = 0;
|
||||
$cont = 1;
|
||||
foreach ($result as $value) {
|
||||
echo '<rect id="'.$this->randomId.'_'.$value['id'].'" class="'.$value['status'].' hover"
|
||||
width="1" height="1" x ="'.$contX.' "y="'.$contY.'" />';
|
||||
echo '<rect id="'.$this->randomId.'_'.$cont.'" class="'.$value['status'].' hover"
|
||||
width="1" height="1" x ="'.$contX.' "y="'.$contY.'" name="'.$value['id'].'" />';
|
||||
|
||||
$contX++;
|
||||
if ($contX >= $Xaxis) {
|
||||
|
@ -724,14 +861,15 @@ class Heatmap
|
|||
} else {
|
||||
$groups[$value['id_grupo']] += 1;
|
||||
}
|
||||
|
||||
$cont++;
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('rect').click(function() {
|
||||
const type = <?php echo $this->type; ?>;
|
||||
const hash = '<?php echo $this->randomId; ?>';
|
||||
const id = this.id.replace(`${hash}_`, '');
|
||||
const id = $(`#${this.id}`).attr("name");
|
||||
|
||||
$("#info_dialog").dialog({
|
||||
resizable: true,
|
||||
|
@ -778,6 +916,10 @@ class Heatmap
|
|||
foreach ($groups as $key => $group) {
|
||||
$name = '';
|
||||
switch ($this->type) {
|
||||
case 3:
|
||||
$name = agents_get_alias($key);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$name = modules_get_modulegroup_name($key);
|
||||
break;
|
||||
|
|
|
@ -223,8 +223,9 @@ class SatelliteAgent extends HTML
|
|||
|
||||
echo $modal.$msg.$aux;
|
||||
|
||||
echo '<div id="satellite_actions" class="action-buttons" style="width: 100%">';
|
||||
echo '<div style="display: flex;justify-content: space-between;">';
|
||||
|
||||
echo '<div class="flex-content-left">';
|
||||
html_print_select(
|
||||
[
|
||||
'0' => 'Disable / Enable selected agents',
|
||||
|
@ -248,18 +249,18 @@ class SatelliteAgent extends HTML
|
|||
);
|
||||
echo '</div>';
|
||||
|
||||
echo '</br></br>';
|
||||
|
||||
// Create button.
|
||||
echo '<div class="w100p flex-content-right">';
|
||||
// Create button add host.
|
||||
echo '<div class="flex-content-right">';
|
||||
html_print_submit_button(
|
||||
__('Add host'),
|
||||
'create',
|
||||
false,
|
||||
'class="sub next"'
|
||||
);
|
||||
echo '</div>';
|
||||
|
||||
echo '</div>';
|
||||
|
||||
// Load own javascript file.
|
||||
echo $this->loadJS();
|
||||
}
|
||||
|
@ -1255,6 +1256,8 @@ class SatelliteAgent extends HTML
|
|||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('body').append('<div id="dialog"></div>');
|
||||
|
||||
$("#submit-create").on('click', function() {
|
||||
show_form();
|
||||
});
|
||||
|
@ -1267,61 +1270,140 @@ class SatelliteAgent extends HTML
|
|||
$('#submit-submit_satellite_action').click(function() {
|
||||
const checks = $('input[name*=check_]:checked');
|
||||
const action = $('#satellite_action').val();
|
||||
$.each(checks, function(i, val) {
|
||||
const params = val.value.split(",");
|
||||
if (action === '0') {
|
||||
if (params[2] === '0') {
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
async: false,
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'enterprise/godmode/servers/agents_satellite',
|
||||
method: 'disableAgent',
|
||||
address: params[0],
|
||||
disable: params[3],
|
||||
id: params[4],
|
||||
name: params[1],
|
||||
no_msg: 1,
|
||||
server_remote: <?php echo $this->satellite_server; ?>,
|
||||
},
|
||||
datatype: "json",
|
||||
success: function (data) {
|
||||
},
|
||||
error: function(e) {
|
||||
console.error(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (params[3] === '0') {
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
async: false,
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'enterprise/godmode/servers/agents_satellite',
|
||||
method: 'deleteAgent',
|
||||
address: params[0],
|
||||
name: params[1],
|
||||
id: params[4],
|
||||
delete: params[2],
|
||||
no_msg: 1,
|
||||
server_remote: <?php echo $this->satellite_server; ?>,
|
||||
},
|
||||
datatype: "json",
|
||||
success: function (data) {
|
||||
},
|
||||
error: function(e) {
|
||||
console.error(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
let agent_delete_error = [];
|
||||
let agent_disable_error = [];
|
||||
$('#aux').empty();
|
||||
$('#aux').text('<?php echo __('Are you sure?'); ?>');
|
||||
$('#aux').dialog({
|
||||
title: (action === '0') ? '<?php echo __('Disable / Enable Agents'); ?>' : '<?php echo __('Delete / create Agents'); ?>',
|
||||
buttons: [
|
||||
{
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
||||
text: '<?php echo __('Cancel'); ?>',
|
||||
click: function(e) {
|
||||
$(this).dialog('close');
|
||||
cleanupDOM();
|
||||
|
||||
var dt_satellite_agents = $("#satellite_agents").DataTable();
|
||||
dt_satellite_agents.draw();
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '<?php echo __('Ok'); ?>',
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
||||
click: function(e) {
|
||||
$(this).dialog('close');
|
||||
$.each(checks, function(i, val) {
|
||||
const params = val.value.split(",");
|
||||
if (action === '0') {
|
||||
if (params[2] === '0') {
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
async: false,
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'enterprise/godmode/servers/agents_satellite',
|
||||
method: 'disableAgent',
|
||||
address: params[0],
|
||||
disable: params[3],
|
||||
id: params[4],
|
||||
name: params[1],
|
||||
no_msg: 1,
|
||||
server_remote: <?php echo $this->satellite_server; ?>,
|
||||
},
|
||||
datatype: "json",
|
||||
success: function (data) {
|
||||
},
|
||||
error: function(e) {
|
||||
console.error(e);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
agent_disable_error.push(params[0]);
|
||||
}
|
||||
} else {
|
||||
if (params[3] === '0') {
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
async: false,
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'enterprise/godmode/servers/agents_satellite',
|
||||
method: 'deleteAgent',
|
||||
address: params[0],
|
||||
name: params[1],
|
||||
id: params[4],
|
||||
delete: params[2],
|
||||
no_msg: 1,
|
||||
server_remote: <?php echo $this->satellite_server; ?>,
|
||||
},
|
||||
datatype: "json",
|
||||
success: function (data) {
|
||||
},
|
||||
error: function(e) {
|
||||
console.error(e);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
agent_delete_error.push(params[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (agent_delete_error.length > 0) {
|
||||
$("#dialog").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 240,
|
||||
width: 600,
|
||||
title: '<?php echo __('Warning'); ?>',
|
||||
open: function(){
|
||||
let text = '<?php echo __('These agents could not be deleted. They must first be enabled'); ?>';
|
||||
text += ` (${agent_delete_error.join()})`;
|
||||
$('#dialog').html(`<br><table><tr><td><img src="images/icono-warning-triangulo.png" class="float-left mrgn_lft_25px"></td><td><p id="p_configurar_agente" >${text}</p></td></tr></table>`);
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
text: "Ok",
|
||||
click: function() {
|
||||
$( this ).dialog( "close" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
if (agent_disable_error.length > 0) {
|
||||
$("#dialog").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 240,
|
||||
width: 600,
|
||||
title: '<?php echo __('Warning'); ?>',
|
||||
open: function(){
|
||||
let text = '<?php echo __('These agents could not be disabled. They must first be created'); ?>';
|
||||
text += ` (${agent_disable_error.join()})`;
|
||||
$('#dialog').html(`<br><table><tr><td><img src="images/icono-warning-triangulo.png" class="float-left mrgn_lft_25px"></td><td><p id="p_configurar_agente" >${text}</p></td></tr></table>`);
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
text: "Ok",
|
||||
click: function() {
|
||||
$( this ).dialog( "close" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
var dt_satellite_agents = $("#satellite_agents").DataTable();
|
||||
dt_satellite_agents.draw();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -537,7 +537,7 @@ class TreeService extends Tree
|
|||
if (empty($title) === true) {
|
||||
$tmp['title'] = '';
|
||||
} else {
|
||||
$tmp['title'] = $title.'/';
|
||||
$tmp['title'] = io_safe_output($title).'/';
|
||||
}
|
||||
|
||||
$tmp['title'] .= $service->name();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC221013';
|
||||
$build_version = 'PC221027';
|
||||
$pandora_version = 'v7.0NG.765';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -45,6 +45,11 @@ define('EVENT_VALIDATE', 1);
|
|||
define('EVENT_PROCESS', 2);
|
||||
define('EVENT_NO_VALIDATED', 3);
|
||||
|
||||
// Events group by constants.
|
||||
define('EVENT_GROUP_REP_ALL', 0);
|
||||
define('EVENT_GROUP_REP_EVENTS', 1);
|
||||
define('EVENT_GROUP_REP_AGENTS', 2);
|
||||
define('EVENT_GROUP_REP_EXTRAIDS', 3);
|
||||
|
||||
// Agents disabled status.
|
||||
define('AGENT_ENABLED', 0);
|
||||
|
|
|
@ -3487,12 +3487,13 @@ function agents_get_agent_custom_field($agent_id, $custom_field_name)
|
|||
/**
|
||||
* Unverified documentation.
|
||||
*
|
||||
* @param integer $id_group Module group.
|
||||
* @param array $id_agents Array of agent ids.
|
||||
* @param boolean $selection Show common (false) or all modules (true).
|
||||
* @param boolean $return Return (false) or dump to output (true).
|
||||
* @param boolean $index_by_name Use module name as key.
|
||||
* @param boolean $pure_return Return as retrieved from DB.
|
||||
* @param integer $id_group Module group.
|
||||
* @param array $id_agents Array of agent ids.
|
||||
* @param boolean $selection Show common (false) or all modules (true).
|
||||
* @param boolean $return Return (false) or dump to output (true).
|
||||
* @param boolean $index_by_name Use module name as key.
|
||||
* @param boolean $pure_return Return as retrieved from DB.
|
||||
* @param boolean $notStringModules Not string modules.
|
||||
*
|
||||
* @return array With modules or null if error.
|
||||
*/
|
||||
|
@ -3502,7 +3503,8 @@ function select_modules_for_agent_group(
|
|||
$selection,
|
||||
$return=true,
|
||||
$index_by_name=false,
|
||||
$pure_return=false
|
||||
$pure_return=false,
|
||||
$notStringModules=false
|
||||
) {
|
||||
global $config;
|
||||
$agents = (empty($id_agents)) ? [] : implode(',', $id_agents);
|
||||
|
@ -3510,6 +3512,7 @@ function select_modules_for_agent_group(
|
|||
$filter_agent_group = '';
|
||||
$filter_group = '';
|
||||
$filter_agent = '';
|
||||
$filter_not_string_modules = '';
|
||||
$selection_filter = '';
|
||||
$sql_conditions_tags = '';
|
||||
$sql_tags_inner = '';
|
||||
|
@ -3524,6 +3527,23 @@ function select_modules_for_agent_group(
|
|||
$filter_agent = ' AND tagente.id_agente IN ('.$agents.')';
|
||||
}
|
||||
|
||||
if ($notStringModules === true) {
|
||||
$filter_not_string_modules = sprintf(
|
||||
' AND (tagente_modulo.id_tipo_modulo <> %d AND
|
||||
tagente_modulo.id_tipo_modulo <> %d AND
|
||||
tagente_modulo.id_tipo_modulo <> %d AND
|
||||
tagente_modulo.id_tipo_modulo <> %d AND
|
||||
tagente_modulo.id_tipo_modulo <> %d AND
|
||||
tagente_modulo.id_tipo_modulo <> %d)',
|
||||
MODULE_TYPE_GENERIC_DATA_STRING,
|
||||
MODULE_TYPE_REMOTE_TCP_STRING,
|
||||
MODULE_TYPE_REMOTE_SNMP_STRING,
|
||||
MODULE_TYPE_ASYNC_STRING,
|
||||
MODULE_TYPE_WEB_CONTENT_STRING,
|
||||
MODULE_TYPE_REMOTE_CMD_STRING
|
||||
);
|
||||
}
|
||||
|
||||
if (!users_can_manage_group_all('AR')) {
|
||||
$group_string = implode(',', $groups);
|
||||
$filter_agent_group = " AND (
|
||||
|
@ -3567,6 +3587,7 @@ function select_modules_for_agent_group(
|
|||
$filter_agent_group
|
||||
$filter_group
|
||||
$filter_agent
|
||||
$filter_not_string_modules
|
||||
$sql_conditions_tags
|
||||
) x
|
||||
GROUP BY nombre
|
||||
|
|
|
@ -7673,8 +7673,7 @@ function api_set_planned_downtimes_delete_agents($id, $thrash1, $other, $thrash3
|
|||
}
|
||||
|
||||
if (!empty($other['data'][0])) {
|
||||
$agents = io_safe_input($other['data']);
|
||||
$agents = explode(';', $agents);
|
||||
$agents = $other['data'];
|
||||
$results = false;
|
||||
foreach ($agents as $agent) {
|
||||
if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents WHERE id_agent = %d AND id_downtime = %d', $agent, $id)) !== false) {
|
||||
|
@ -7750,8 +7749,7 @@ function api_set_planned_downtimes_add_agents($id, $thrash1, $other, $thrash3)
|
|||
}
|
||||
|
||||
if (!empty($other['data'][0])) {
|
||||
$agents = io_safe_input($other['data']);
|
||||
$agents = explode(';', $agents);
|
||||
$agents = $other['data'];
|
||||
$results = false;
|
||||
foreach ($agents as $agent) {
|
||||
if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents tpd WHERE tpd.id_agent = %d AND id_downtime = %d', $agent, $id)) === false) {
|
||||
|
@ -9499,14 +9497,16 @@ function api_set_new_user($id, $thrash2, $other, $thrash3)
|
|||
{
|
||||
global $config;
|
||||
|
||||
// if (defined ('METACONSOLE')) {
|
||||
// return;
|
||||
// }
|
||||
if (!check_acl($config['id_user'], 0, 'UM')) {
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($id) === true) {
|
||||
returnError('Id cannot be empty.');
|
||||
return;
|
||||
}
|
||||
|
||||
$idk = get_header('idk');
|
||||
if (is_management_allowed($idk) === false) {
|
||||
returnError('centralized');
|
||||
|
@ -9528,6 +9528,11 @@ function api_set_new_user($id, $thrash2, $other, $thrash3)
|
|||
$values['section'] = $other['data'][11];
|
||||
$values['session_time'] = $other['data'][12];
|
||||
|
||||
if (empty($password) === true) {
|
||||
returnError('Password cannot be empty.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!create_user($id, $password, $values)) {
|
||||
returnError('The user could not created');
|
||||
} else {
|
||||
|
@ -10130,7 +10135,7 @@ function api_set_module_data($id, $thrash2, $other, $trash1)
|
|||
}
|
||||
|
||||
if ($other['type'] == 'array') {
|
||||
if (!util_api_check_agent_and_print_error(modules_get_agentmodule_agent($id), 'string', 'AW')) {
|
||||
if (!util_api_check_agent_and_print_error(modules_get_agentmodule_agent($id), 'string')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -11241,7 +11246,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
|||
$id_user_ack = 0;
|
||||
$event_view_hr = 0;
|
||||
$tag = '';
|
||||
$group_rep = 0;
|
||||
$group_rep = EVENT_GROUP_REP_ALL;
|
||||
$utimestamp_upper = 0;
|
||||
$utimestamp_bottom = 0;
|
||||
$id_alert_template = -1;
|
||||
|
@ -11444,7 +11449,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
|||
$alert_join = ' INNER JOIN talert_template_modules ON '.$table_events.'.id_alert_am=talert_template_modules.id';
|
||||
}
|
||||
|
||||
if ($group_rep == 0) {
|
||||
if ($group_rep == EVENT_GROUP_REP_ALL) {
|
||||
if ($filter['total']) {
|
||||
$sql = 'SELECT COUNT(*)
|
||||
FROM '.$table_events.'
|
||||
|
@ -11734,14 +11739,16 @@ function api_set_delete_user($id, $thrash1, $thrash2, $thrash3)
|
|||
{
|
||||
global $config;
|
||||
|
||||
// if (defined ('METACONSOLE')) {
|
||||
// return;
|
||||
// }
|
||||
if (!check_acl($config['id_user'], 0, 'UM')) {
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($id) === true) {
|
||||
returnError('Id cannot be empty.');
|
||||
return;
|
||||
}
|
||||
|
||||
$idk = get_header('idk');
|
||||
if (is_management_allowed($idk) === false) {
|
||||
returnError('centralized');
|
||||
|
@ -13164,7 +13171,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
|
|||
if ($other['data'][7] != '') {
|
||||
$values['id_agentmodule'] = $other['data'][7];
|
||||
} else {
|
||||
$value['id_agentmodule'] = 0;
|
||||
$values['id_agentmodule'] = 0;
|
||||
}
|
||||
|
||||
if ($other['data'][8] != '') {
|
||||
|
@ -13298,12 +13305,6 @@ function api_set_add_event_comment($id, $thrash2, $other, $thrash3)
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
$meta = true;
|
||||
} else {
|
||||
$meta = $other['data'][1];
|
||||
}
|
||||
|
||||
if (!check_acl($config['id_user'], 0, 'EW')) {
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
|
@ -13314,13 +13315,46 @@ function api_set_add_event_comment($id, $thrash2, $other, $thrash3)
|
|||
return;
|
||||
} else if ($other['type'] == 'array') {
|
||||
$comment = $other['data'][0];
|
||||
$history = $other['data'][2];
|
||||
|
||||
$status = events_comment(
|
||||
$id,
|
||||
$comment,
|
||||
'Added comment'
|
||||
);
|
||||
$node_int = 0;
|
||||
if (is_metaconsole() === true) {
|
||||
if (isset($other['data'][1]) === true
|
||||
&& empty($other['data'][1]) === false
|
||||
) {
|
||||
$node_int = $other['data'][1];
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (is_metaconsole() === true
|
||||
&& (int) $node_int > 0
|
||||
) {
|
||||
$node = new Node($node_int);
|
||||
$node->connect();
|
||||
}
|
||||
|
||||
$status = events_comment(
|
||||
$id,
|
||||
$comment,
|
||||
'Added comment'
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// Unexistent agent.
|
||||
if (is_metaconsole() === true
|
||||
&& $node_int > 0
|
||||
) {
|
||||
$node->disconnect();
|
||||
}
|
||||
|
||||
$status = false;
|
||||
} finally {
|
||||
if (is_metaconsole() === true
|
||||
&& $node_int > 0
|
||||
) {
|
||||
$node->disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
if (is_error($status)) {
|
||||
returnError(
|
||||
'The event comment could not be added.'
|
||||
|
@ -15888,7 +15922,7 @@ function api_set_create_event_filter($name, $thrash1, $other, $thrash3)
|
|||
|
||||
$id_user_ack = (in_array($other['data'][9], $users)) ? $other['data'][9] : 0;
|
||||
|
||||
$group_rep = ($other['data'][10] == 0 || $other['data'][10] == 1) ? $other['data'][10] : 0;
|
||||
$group_rep = ($other['data'][10] == EVENT_GROUP_REP_ALL || $other['data'][10] == EVENT_GROUP_REP_EVENTS) ? $other['data'][10] : EVENT_GROUP_REP_ALL;
|
||||
|
||||
$date_from = (preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $other['data'][11])) ? $other['data'][11] : '0000-00-00';
|
||||
|
||||
|
@ -16115,7 +16149,7 @@ function api_set_update_event_filter($id_event_filter, $thrash1, $other, $thrash
|
|||
break;
|
||||
|
||||
case 11:
|
||||
$values['group_rep'] = ($other['data'][11] == 0 || $other['data'][11] == 1) ? $other['data'][11] : 0;
|
||||
$values['group_rep'] = ($other['data'][11] == EVENT_GROUP_REP_ALL || $other['data'][11] == EVENT_GROUP_REP_EVENTS) ? $other['data'][11] : EVENT_GROUP_REP_ALL;
|
||||
break;
|
||||
|
||||
case 12:
|
||||
|
|
|
@ -467,7 +467,7 @@ function config_update_config()
|
|||
break;
|
||||
|
||||
case 'pass':
|
||||
if (isset($config['enterprise_installed']) === true && (bool) $config['enterprise_installed'] === 1) {
|
||||
if (isset($config['enterprise_installed']) === true && (bool) $config['enterprise_installed'] === true) {
|
||||
if (config_update_value('enable_pass_policy', get_parameter('enable_pass_policy'), true) === false) {
|
||||
$error_update[] = __('Enable password policy');
|
||||
}
|
||||
|
@ -515,6 +515,10 @@ function config_update_config()
|
|||
if (config_update_value('reset_pass_option', (bool) get_parameter('reset_pass_option'), true) === false) {
|
||||
$error_update[] = __('Activate reset password');
|
||||
}
|
||||
|
||||
if (config_update_value('exclusion_word_list', (string) get_parameter('exclusion_word_list'), true) === false) {
|
||||
$error_update[] = __('Exclusion word list for passwords');
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -608,10 +612,14 @@ function config_update_config()
|
|||
$error_update[] = __('Admin LDAP login');
|
||||
}
|
||||
|
||||
if (config_update_value('ldap_admin_pass', io_input_password(io_safe_output(get_parameter('ldap_admin_pass'))), true) === false) {
|
||||
if (config_update_value('ldap_admin_pass', io_input_password(get_parameter('ldap_admin_pass')), true) === false) {
|
||||
$error_update[] = __('Admin LDAP password');
|
||||
}
|
||||
|
||||
if (config_update_value('ldap_search_timeout', (int) get_parameter('ldap_search_timeout', 5), true) === false) {
|
||||
$error_update[] = __('Ldap search timeout');
|
||||
}
|
||||
|
||||
if (config_update_value('ldap_server_secondary', get_parameter('ldap_server_secondary'), true) === false) {
|
||||
$error_update[] = __('Secondary LDAP server');
|
||||
}
|
||||
|
@ -640,7 +648,7 @@ function config_update_config()
|
|||
$error_update[] = __('Admin secondary LDAP login');
|
||||
}
|
||||
|
||||
if (config_update_value('ldap_admin_pass_secondary', io_input_password(io_safe_output(get_parameter('ldap_admin_pass_secondary'))), true) === false) {
|
||||
if (config_update_value('ldap_admin_pass_secondary', io_input_password(get_parameter('ldap_admin_pass_secondary')), true) === false) {
|
||||
$error_update[] = __('Admin secondary LDAP password');
|
||||
}
|
||||
|
||||
|
@ -784,14 +792,7 @@ function config_update_config()
|
|||
case 'perf':
|
||||
// PERFORMANCE SETUP.
|
||||
if (config_update_value('event_purge', get_parameter('event_purge'), true) === false) {
|
||||
$check_metaconsole_events_history = get_parameter('metaconsole_events_history', -1);
|
||||
$error_update[] = $check_metaconsole_events_history;
|
||||
}
|
||||
|
||||
if ($check_metaconsole_events_history != -1) {
|
||||
if (config_update_value('metaconsole_events_history', get_parameter('metaconsole_events_history'), true) === false) {
|
||||
$error_update[] = __('Max. days before delete events');
|
||||
}
|
||||
$error_update[] = __('Event purge');
|
||||
}
|
||||
|
||||
if (config_update_value('trap_purge', get_parameter('trap_purge'), true) === false) {
|
||||
|
@ -916,6 +917,16 @@ function config_update_config()
|
|||
$error_update[] = __('Default WMI Binary');
|
||||
}
|
||||
|
||||
// Walk the array with defaults.
|
||||
$defaultAgentWizardOptions = json_decode(io_safe_output($config['agent_wizard_defaults']));
|
||||
foreach ($defaultAgentWizardOptions as $key => $value) {
|
||||
$selectedAgentWizardOptions[$key] = get_parameter_switch('agent_wizard_defaults_'.$key);
|
||||
}
|
||||
|
||||
if (config_update_value('agent_wizard_defaults', json_encode($selectedAgentWizardOptions), true) === false) {
|
||||
$error_update[] = __('SNMP Interface Agent Wizard');
|
||||
}
|
||||
|
||||
$pjs = get_parameter('phantomjs_cache_interval');
|
||||
switch ($pjs) {
|
||||
case $config['phantomjs_cache_interval']:
|
||||
|
@ -1577,9 +1588,10 @@ function config_update_config()
|
|||
}
|
||||
|
||||
$history_db_string_days = get_parameter('history_db_string_days');
|
||||
if (is_numeric($history_db_string_days) === false
|
||||
if ((is_numeric($history_db_string_days) === false
|
||||
|| $history_db_string_days <= 0
|
||||
|| config_update_value('history_db_string_days', $history_db_string_days) === false
|
||||
|| config_update_value('history_db_string_days', $history_db_string_days) === false)
|
||||
&& get_parameter_switch('history_db_adv', 0) === 1
|
||||
) {
|
||||
$error_update[] = __('String Days');
|
||||
}
|
||||
|
@ -1843,7 +1855,7 @@ function config_update_config()
|
|||
$config['error_config_update_config']['correct'] = false;
|
||||
$values = implode('<br> -', $error_update);
|
||||
$config['error_config_update_config']['message'] = sprintf(
|
||||
__('Failed updated: the next values cannot update: <br> -%s'),
|
||||
__('Update failed. The next values could not be updated: <br> -%s'),
|
||||
$values
|
||||
);
|
||||
|
||||
|
@ -2107,10 +2119,6 @@ function config_process_config()
|
|||
config_update_value('event_purge', 15);
|
||||
}
|
||||
|
||||
if (!isset($config['metaconsole_events_history'])) {
|
||||
config_update_value('metaconsole_events_history', 0);
|
||||
}
|
||||
|
||||
if (!isset($config['realtimestats'])) {
|
||||
config_update_value('realtimestats', 1);
|
||||
}
|
||||
|
@ -2195,6 +2203,10 @@ function config_process_config()
|
|||
config_update_value('reset_pass_option', 0);
|
||||
}
|
||||
|
||||
if (isset($config['exclusion_word_list']) === false) {
|
||||
config_update_value('exclusion_word_list', '');
|
||||
}
|
||||
|
||||
if (!isset($config['include_agents'])) {
|
||||
config_update_value('include_agents', 0);
|
||||
}
|
||||
|
@ -2255,6 +2267,32 @@ function config_process_config()
|
|||
config_update_value('2Fa_auth', '');
|
||||
}
|
||||
|
||||
if (isset($config['agent_wizard_defaults']) === false) {
|
||||
config_update_value(
|
||||
'agent_wizard_defaults',
|
||||
json_encode(
|
||||
[
|
||||
'ifOperStatus' => 1,
|
||||
'ifInOctets' => 1,
|
||||
'ifOutOctets' => 1,
|
||||
'ifInUcastPkts' => 0,
|
||||
'ifOutUcastPkts' => 0,
|
||||
'ifInNUcastPkts' => 0,
|
||||
'ifOutNUcastPkts' => 0,
|
||||
'locIfInCRC' => 1,
|
||||
'Bandwidth' => 1,
|
||||
'inUsage' => 1,
|
||||
'outUsage' => 1,
|
||||
'ifAdminStatus' => 0,
|
||||
'ifInDiscards' => 0,
|
||||
'ifOutDiscards' => 0,
|
||||
'ifInErrors' => 0,
|
||||
'ifOutErrors' => 0,
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the ACL IP list for access API
|
||||
*/
|
||||
|
@ -2671,6 +2709,10 @@ function config_process_config()
|
|||
config_update_value('ldap_admin_pass', '');
|
||||
}
|
||||
|
||||
if (!isset($config['ldap_search_timeout'])) {
|
||||
config_update_value('ldap_search_timeout', 5);
|
||||
}
|
||||
|
||||
if (!isset($config['ldap_server_secondary'])) {
|
||||
config_update_value('ldap_server_secondary', 'localhost');
|
||||
}
|
||||
|
|
|
@ -382,14 +382,14 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal
|
|||
}
|
||||
|
||||
if (isset($filter) === false
|
||||
|| is_array($filter) === true
|
||||
|| is_array($filter) === false
|
||||
) {
|
||||
$filter = ['group_rep' => 0];
|
||||
$filter = ['group_rep' => EVENT_GROUP_REP_ALL];
|
||||
}
|
||||
|
||||
switch ($filter['group_rep']) {
|
||||
case '0':
|
||||
case '2':
|
||||
case EVENT_GROUP_REP_ALL:
|
||||
case EVENT_GROUP_REP_AGENTS:
|
||||
default:
|
||||
// No groups option direct update.
|
||||
$delete_sql = sprintf(
|
||||
|
@ -399,7 +399,8 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal
|
|||
);
|
||||
break;
|
||||
|
||||
case '1':
|
||||
case EVENT_GROUP_REP_EVENTS:
|
||||
case EVENT_GROUP_REP_EXTRAIDS:
|
||||
// Group by events.
|
||||
$sql = events_get_all(
|
||||
['te.*'],
|
||||
|
@ -418,8 +419,16 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal
|
|||
true
|
||||
);
|
||||
|
||||
$target_ids = db_get_all_rows_sql(
|
||||
sprintf(
|
||||
if ((int) $filter['group_rep'] === EVENT_GROUP_REP_EXTRAIDS) {
|
||||
$sql = sprintf(
|
||||
'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf
|
||||
ON tu.id_extra = tf.id_extra
|
||||
AND tf.max_id_evento = %d',
|
||||
$sql,
|
||||
$id_evento
|
||||
);
|
||||
} else {
|
||||
$sql = sprintf(
|
||||
'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf
|
||||
ON tu.estado = tf.estado
|
||||
AND tu.evento = tf.evento
|
||||
|
@ -428,8 +437,10 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal
|
|||
AND tf.max_id_evento = %d',
|
||||
$sql,
|
||||
$id_evento
|
||||
)
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
$target_ids = db_get_all_rows_sql($sql);
|
||||
|
||||
// Try to avoid deadlock while updating full set.
|
||||
if ($target_ids !== false && count($target_ids) > 0) {
|
||||
|
@ -475,12 +486,12 @@ function events_update_status($id_evento, $status, $filter=null)
|
|||
}
|
||||
|
||||
if (isset($filter) === false || is_array($filter) === false) {
|
||||
$filter = ['group_rep' => 0];
|
||||
$filter = ['group_rep' => EVENT_GROUP_REP_ALL];
|
||||
}
|
||||
|
||||
switch ($filter['group_rep']) {
|
||||
case '0':
|
||||
case '2':
|
||||
case EVENT_GROUP_REP_ALL:
|
||||
case EVENT_GROUP_REP_AGENTS:
|
||||
default:
|
||||
// No groups option direct update.
|
||||
$update_sql = sprintf(
|
||||
|
@ -492,7 +503,8 @@ function events_update_status($id_evento, $status, $filter=null)
|
|||
);
|
||||
break;
|
||||
|
||||
case '1':
|
||||
case EVENT_GROUP_REP_EVENTS:
|
||||
case EVENT_GROUP_REP_EXTRAIDS:
|
||||
// Group by events.
|
||||
$sql = events_get_all(
|
||||
['te.*'],
|
||||
|
@ -511,8 +523,16 @@ function events_update_status($id_evento, $status, $filter=null)
|
|||
true
|
||||
);
|
||||
|
||||
$target_ids = db_get_all_rows_sql(
|
||||
sprintf(
|
||||
if ((int) $filter['group_rep'] === EVENT_GROUP_REP_EXTRAIDS) {
|
||||
$sql = sprintf(
|
||||
'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf
|
||||
ON tu.id_extra = tf.id_extra
|
||||
AND tf.max_id_evento = %d',
|
||||
$sql,
|
||||
$id_evento
|
||||
);
|
||||
} else {
|
||||
$sql = sprintf(
|
||||
'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf
|
||||
ON tu.estado = tf.estado
|
||||
AND tu.evento = tf.evento
|
||||
|
@ -521,8 +541,10 @@ function events_update_status($id_evento, $status, $filter=null)
|
|||
AND tf.max_id_evento = %d',
|
||||
$sql,
|
||||
$id_evento
|
||||
)
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
$target_ids = db_get_all_rows_sql($sql);
|
||||
|
||||
// Try to avoid deadlock while updating full set.
|
||||
if ($target_ids !== false && count($target_ids) > 0) {
|
||||
|
@ -627,6 +649,7 @@ function events_update_status($id_evento, $status, $filter=null)
|
|||
* 'tag_without'
|
||||
* 'filter_only_alert'
|
||||
* 'search_secondary_groups'
|
||||
* 'search_recursive_groups'
|
||||
* 'module_search'
|
||||
* 'group_rep'
|
||||
* 'server_id'
|
||||
|
@ -864,7 +887,10 @@ function events_get_all(
|
|||
if (isset($groups) === true
|
||||
&& (is_array($groups) === true || ($groups > 0))
|
||||
) {
|
||||
if ($recursiveGroups === true) {
|
||||
if ($recursiveGroups === true
|
||||
|| (isset($filter['search_recursive_groups']) === true
|
||||
&& (bool) $filter['search_recursive_groups'] === true)
|
||||
) {
|
||||
// Add children groups.
|
||||
$children = [];
|
||||
if (is_array($groups) === true) {
|
||||
|
@ -1363,7 +1389,10 @@ function events_get_all(
|
|||
// Order.
|
||||
$order_by = '';
|
||||
if (isset($order, $sort_field) === true) {
|
||||
if (isset($filter['group_rep']) === true && $filter['group_rep'] == 1) {
|
||||
if (isset($filter['group_rep']) === true
|
||||
&& $filter['group_rep'] === EVENT_GROUP_REP_EVENTS
|
||||
&& $filter['group_rep'] === EVENT_GROUP_REP_EXTRAIDS
|
||||
) {
|
||||
$order_by = events_get_sql_order('MAX('.$sort_field.')', $order);
|
||||
} else {
|
||||
$order_by = events_get_sql_order($sort_field, $order);
|
||||
|
@ -1397,22 +1426,22 @@ function events_get_all(
|
|||
$group_by = 'GROUP BY ';
|
||||
$tagente_join = 'LEFT';
|
||||
if (isset($filter['group_rep']) === false) {
|
||||
$filter['group_rep'] = 0;
|
||||
$filter['group_rep'] = EVENT_GROUP_REP_ALL;
|
||||
}
|
||||
|
||||
switch ($filter['group_rep']) {
|
||||
case '0':
|
||||
case EVENT_GROUP_REP_ALL:
|
||||
default:
|
||||
// All events.
|
||||
$group_by = '';
|
||||
break;
|
||||
|
||||
case '1':
|
||||
case EVENT_GROUP_REP_EVENTS:
|
||||
// Group by events.
|
||||
$group_by .= 'te.evento, te.id_agente, te.id_agentmodule';
|
||||
break;
|
||||
|
||||
case '2':
|
||||
case EVENT_GROUP_REP_AGENTS:
|
||||
// Group by agents.
|
||||
$tagente_join = 'INNER';
|
||||
$group_by = '';
|
||||
|
@ -1426,6 +1455,11 @@ function events_get_all(
|
|||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case EVENT_GROUP_REP_EXTRAIDS:
|
||||
// Group by events.
|
||||
$group_by .= 'te.id_extra';
|
||||
break;
|
||||
}
|
||||
|
||||
$tgrupo_join = 'LEFT';
|
||||
|
@ -1472,7 +1506,6 @@ function events_get_all(
|
|||
// Secondary groups.
|
||||
$event_lj = '';
|
||||
if (!$user_is_admin || ($user_is_admin && isset($groups) === true && $groups > 0)) {
|
||||
db_process_sql('SET group_concat_max_len = 9999999');
|
||||
if ((bool) $filter['search_secondary_groups'] === true) {
|
||||
$event_lj = events_get_secondary_groups_left_join($table);
|
||||
}
|
||||
|
@ -1486,6 +1519,8 @@ function events_get_all(
|
|||
unset($fields[$idx]);
|
||||
}
|
||||
|
||||
db_process_sql('SET group_concat_max_len = 9999999');
|
||||
|
||||
$group_selects = sprintf(
|
||||
',COUNT(id_evento) AS event_rep,
|
||||
%s
|
||||
|
@ -1511,7 +1546,9 @@ function events_get_all(
|
|||
}
|
||||
}
|
||||
|
||||
if ((int) $filter['group_rep'] === 1 && $count === false) {
|
||||
if (((int) $filter['group_rep'] === EVENT_GROUP_REP_EVENTS
|
||||
|| (int) $filter['group_rep'] === EVENT_GROUP_REP_EXTRAIDS) && $count === false
|
||||
) {
|
||||
$sql = sprintf(
|
||||
'SELECT %s
|
||||
%s
|
||||
|
@ -1542,7 +1579,9 @@ function events_get_all(
|
|||
%s
|
||||
%s
|
||||
%s JOIN tgrupo tg
|
||||
ON %s',
|
||||
ON %s
|
||||
%s
|
||||
%s',
|
||||
join(',', $fields),
|
||||
$group_selects_trans,
|
||||
$tevento,
|
||||
|
@ -1571,7 +1610,8 @@ function events_get_all(
|
|||
join(' ', $agent_join_filters),
|
||||
$tgrupo_join,
|
||||
join(' ', $tgrupo_join_filters),
|
||||
join(' ', $sql_filters)
|
||||
join(' ', $sql_filters),
|
||||
$order_by
|
||||
);
|
||||
} else {
|
||||
$sql = sprintf(
|
||||
|
@ -1694,7 +1734,7 @@ function events_get_all(
|
|||
$result_meta = Promise\wait(
|
||||
parallelMap(
|
||||
$metaconsole_connections,
|
||||
function ($node_int) use ($sql) {
|
||||
function ($node_int) use ($sql, $history) {
|
||||
try {
|
||||
if (is_metaconsole() === true
|
||||
&& (int) $node_int > 0
|
||||
|
@ -1703,7 +1743,7 @@ function events_get_all(
|
|||
$node->connect();
|
||||
}
|
||||
|
||||
$res = db_get_all_rows_sql($sql);
|
||||
$res = db_get_all_rows_sql($sql, $history);
|
||||
if ($res === false) {
|
||||
$res = [];
|
||||
}
|
||||
|
@ -1834,7 +1874,7 @@ function events_get_all(
|
|||
}
|
||||
}
|
||||
|
||||
return db_get_all_rows_sql($sql);
|
||||
return db_get_all_rows_sql($sql, $history);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2895,9 +2935,9 @@ function events_get_agent(
|
|||
|
||||
// Group by agent.
|
||||
if ((bool) $show_summary_group === true) {
|
||||
$filters['group_rep'] = 1;
|
||||
$filters['group_rep'] = EVENT_GROUP_REP_EVENTS;
|
||||
} else {
|
||||
$filters['group_rep'] = 2;
|
||||
$filters['group_rep'] = EVENT_GROUP_REP_AGENTS;
|
||||
}
|
||||
|
||||
$events = Event::search(
|
||||
|
@ -3509,7 +3549,7 @@ function events_page_responses($event)
|
|||
__('Execute'),
|
||||
'custom_response_button',
|
||||
false,
|
||||
'execute_response('.$event['id_evento'].','.$server_id.')',
|
||||
'execute_response('.$event['id_evento'].','.$server_id.',0)',
|
||||
"class='sub next w70p'",
|
||||
true
|
||||
);
|
||||
|
@ -3520,27 +3560,15 @@ function events_page_responses($event)
|
|||
$responses_js = "<script>
|
||||
$('#select_custom_response').change(function() {
|
||||
var id_response = $('#select_custom_response').val();
|
||||
var params = get_response_params(id_response);
|
||||
var description = get_response_description(id_response);
|
||||
$('.params_rows').remove();
|
||||
$('#responses_table')
|
||||
.append('<tr class=\"params_rows\"><td>".__('Description')."</td><td class=\"height_30px\" colspan=\"2\">'+description+'</td></tr>');
|
||||
|
||||
if (params.length == 1 && params[0] == '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$('#responses_table')
|
||||
.append('<tr class=\"params_rows\"><td class=\"left pdd_l_20px height_30px\" colspan=\"3\">".__('Parameters')."</td></tr>');
|
||||
|
||||
for (i = 0; i < params.length; i++) {
|
||||
add_row_param('responses_table',params[i]);
|
||||
}
|
||||
table_info_response_event(id_response,".$event['id_evento'].','.$event['server_id'].");
|
||||
});
|
||||
$('#select_custom_response').trigger('change');
|
||||
</script>";
|
||||
|
||||
$responses = '<div id="extended_event_responses_page" class="extended_event_pages">'.html_print_table($table_responses, true).$responses_js.'</div>';
|
||||
$responses = '<div id="extended_event_responses_page" class="extended_event_pages">';
|
||||
$responses .= html_print_table($table_responses, true);
|
||||
$responses .= $responses_js;
|
||||
$responses .= '</div>';
|
||||
|
||||
return $responses;
|
||||
}
|
||||
|
@ -3549,14 +3577,20 @@ function events_page_responses($event)
|
|||
/**
|
||||
* Replace macros in the target of a response and return it.
|
||||
*
|
||||
* @param integer $event_id Event identifier.
|
||||
* @param integer $response_id Event response identifier.
|
||||
* @param integer $event_id Event identifier.
|
||||
* @param array $event_response Event Response.
|
||||
* @param array|null $response_parameters If parameters response values.
|
||||
* @param integer|null $server_id Server Id.
|
||||
* @param string|null $server_name Name server.
|
||||
*
|
||||
* @return string The response text with the macros applied.
|
||||
*/
|
||||
function events_get_response_target(
|
||||
int $event_id,
|
||||
int $response_id
|
||||
array $event_response,
|
||||
?array $response_parameters=null,
|
||||
?int $server_id=0,
|
||||
?string $server_name=''
|
||||
) {
|
||||
global $config;
|
||||
|
||||
|
@ -3569,9 +3603,36 @@ function events_get_response_target(
|
|||
}
|
||||
|
||||
$event = db_get_row('tevento', 'id_evento', $event_id);
|
||||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
||||
$target = io_safe_output($event_response['target']);
|
||||
|
||||
// Replace parameters response.
|
||||
if (isset($response_parameters) === true
|
||||
&& empty($response_parameters) === false
|
||||
) {
|
||||
$response_parameters = array_reduce(
|
||||
$response_parameters,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['name']] = $item['value'];
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($event_response['params']) === false) {
|
||||
$response_params = explode(',', $event_response['params']);
|
||||
if (is_array($response_params) === true) {
|
||||
foreach ($response_params as $param) {
|
||||
$param = trim(io_safe_output($param));
|
||||
$target = str_replace(
|
||||
'_'.$param.'_',
|
||||
$response_parameters['values_params_'.$param],
|
||||
$target
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Replace macros.
|
||||
if (strpos($target, '_agent_alias_') !== false) {
|
||||
$agente_table_name = 'tagente';
|
||||
$filter = ['id_agente' => $event['id_agente']];
|
||||
|
@ -3897,6 +3958,26 @@ function events_get_response_target(
|
|||
);
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true
|
||||
&& strpos($target, '_node_id_') !== false
|
||||
) {
|
||||
$target = str_replace(
|
||||
'_node_id_',
|
||||
$server_id,
|
||||
$target
|
||||
);
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true
|
||||
&& strpos($target, '_node_name_') !== false
|
||||
) {
|
||||
$target = str_replace(
|
||||
'_node_name_',
|
||||
$server_name,
|
||||
$target
|
||||
);
|
||||
}
|
||||
|
||||
return $target;
|
||||
}
|
||||
|
||||
|
@ -5107,7 +5188,7 @@ function events_get_count_events_validated_by_user($data)
|
|||
*
|
||||
* @return string SQL.
|
||||
*/
|
||||
function events_get_sql_order($sort_field='timestamp', $sort='DESC', $group_rep=0, $only_fields=false)
|
||||
function events_get_sql_order($sort_field='timestamp', $sort='DESC', $group_rep=EVENT_GROUP_REP_ALL, $only_fields=false)
|
||||
{
|
||||
$sort_field_translated = $sort_field;
|
||||
switch ($sort_field) {
|
||||
|
@ -5128,7 +5209,7 @@ function events_get_sql_order($sort_field='timestamp', $sort='DESC', $group_rep=
|
|||
break;
|
||||
|
||||
case 'timestamp':
|
||||
$sort_field_translated = ($group_rep == 0) ? 'timestamp' : 'timestamp_last';
|
||||
$sort_field_translated = ($group_rep == EVENT_GROUP_REP_ALL) ? 'timestamp' : 'timestamp_last';
|
||||
break;
|
||||
|
||||
case 'user_id':
|
||||
|
@ -5155,6 +5236,14 @@ function events_get_sql_order($sort_field='timestamp', $sort='DESC', $group_rep=
|
|||
$sort_field_translated = 'id_extra';
|
||||
break;
|
||||
|
||||
case 'agent_name':
|
||||
$sort_field_translated = 'ta.nombre';
|
||||
break;
|
||||
|
||||
case 'module_custom_id':
|
||||
$sort_field_translated = 'am.custom_id';
|
||||
break;
|
||||
|
||||
default:
|
||||
$sort_field_translated = $sort_field;
|
||||
break;
|
||||
|
@ -5543,3 +5632,114 @@ function events_get_criticity_class($criticity)
|
|||
return 'datos_blue';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw row response events.
|
||||
*
|
||||
* @param array $event_response Response.
|
||||
* @param integer|null $response_id Id .
|
||||
* @param boolean $end End block.
|
||||
* @param integer|null $index Index block.
|
||||
*
|
||||
* @return string Html output.
|
||||
*/
|
||||
function get_row_response_action(
|
||||
array $event_response,
|
||||
?int $response_id,
|
||||
$end=false,
|
||||
$index=null
|
||||
) {
|
||||
$output = '<div class="container-massive-events-response-cell">';
|
||||
$display_command = (bool) $event_response['display_command'];
|
||||
$command_str = ($display_command === true) ? $event_response['target'] : '';
|
||||
|
||||
// String command.
|
||||
$output .= '<div class="container-massive-events-response-command">';
|
||||
$output .= '<b>';
|
||||
$output .= __('Event # %d', $event_response['event_id']);
|
||||
if (empty($command_str) === false) {
|
||||
$output .= ' ';
|
||||
$output .= __('Executing command: ');
|
||||
}
|
||||
|
||||
$output .= '</b>';
|
||||
$output .= '<span>'.$command_str.'</span>';
|
||||
$output .= '</div>';
|
||||
|
||||
// Spinner.
|
||||
$output .= '<div id="response_loading_command'.$index.'" style="display:none">';
|
||||
$output .= html_print_image(
|
||||
'images/spinner.gif',
|
||||
true
|
||||
);
|
||||
$output .= '</div>';
|
||||
|
||||
// Output.
|
||||
$output .= '<div id="response_out'.$index.'" class="container-massive-events-response-output"></div>';
|
||||
|
||||
// Butom.
|
||||
$output .= '<div id="re_exec_command'.$index.'" style="display:none" class="container-massive-events-response-execute">';
|
||||
$output .= html_print_button(
|
||||
__('Execute again'),
|
||||
'btn_str',
|
||||
false,
|
||||
'perform_response(\''.base64_encode(json_encode($event_response)).'\','.$response_id.',\''.trim($index).'\')',
|
||||
"class='sub next'",
|
||||
true
|
||||
);
|
||||
$output .= '</div>';
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get evet get response target.
|
||||
*
|
||||
* @param integer $event_id Id event.
|
||||
* @param array $event_response Response.
|
||||
* @param integer $server_id Server id.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_events_get_response_target(
|
||||
$event_id,
|
||||
$event_response,
|
||||
$server_id=0,
|
||||
$response_parameters=[]
|
||||
) {
|
||||
try {
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
) {
|
||||
$node = new Node($server_id);
|
||||
$node->connect();
|
||||
}
|
||||
|
||||
return events_get_response_target(
|
||||
$event_id,
|
||||
$event_response,
|
||||
$response_parameters,
|
||||
$server_id,
|
||||
($server_id !== 0) ? $node->server_name() : 'Metaconsole'
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// Unexistent agent.
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
) {
|
||||
$node->disconnect();
|
||||
}
|
||||
|
||||
return '';
|
||||
} finally {
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
) {
|
||||
$node->disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2070,7 +2070,7 @@ function html_print_extended_select_for_time(
|
|||
$custom_fields=false,
|
||||
$style_icon='',
|
||||
$no_change=false,
|
||||
$allow_zero=false
|
||||
$allow_zero=0
|
||||
) {
|
||||
global $config;
|
||||
$admin = is_user_admin($config['id_user']);
|
||||
|
@ -2084,32 +2084,21 @@ function html_print_extended_select_for_time(
|
|||
$fields['-2'] = __('No change');
|
||||
}
|
||||
|
||||
if (! $selected) {
|
||||
foreach ($fields as $t_key => $t_value) {
|
||||
if ($t_key != -1) {
|
||||
if ($nothing == '') {
|
||||
// -1 means 'custom'
|
||||
$selected = $t_key;
|
||||
break;
|
||||
} else {
|
||||
$selected = $nothing;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Allow the use of the value zero.
|
||||
if ($allow_zero === true) {
|
||||
$selected_zero = true;
|
||||
} else {
|
||||
$selected_zero = ($selected != 0) ? true : false;
|
||||
}
|
||||
|
||||
if (($selected !== false) && (!isset($fields[$selected]) && $selected_zero)) {
|
||||
if (empty($selected) === false
|
||||
&& $selected !== '0'
|
||||
&& isset($fields[$selected]) === false
|
||||
) {
|
||||
$allow_zero = false;
|
||||
$fields[$selected] = human_time_description_raw($selected, true);
|
||||
}
|
||||
|
||||
if (empty($nothing) === true
|
||||
&& (empty($selected) === true
|
||||
|| $selected === '0')
|
||||
) {
|
||||
$selected = 300;
|
||||
}
|
||||
|
||||
$units = [
|
||||
1 => __('seconds'),
|
||||
SECONDS_1MINUTE => __('minutes'),
|
||||
|
@ -2175,14 +2164,23 @@ function html_print_extended_select_for_time(
|
|||
$uniq_name.'_units',
|
||||
'1',
|
||||
''.$script,
|
||||
$nothing,
|
||||
$nothing_value,
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
$class,
|
||||
$readonly,
|
||||
'font-size: xx-small;'.$select_style
|
||||
'padding: 7px 3px;'.$select_style,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
echo ' <a href="javascript:">'.html_print_image(
|
||||
'images/list.png',
|
||||
|
@ -2197,7 +2195,7 @@ function html_print_extended_select_for_time(
|
|||
echo '</div>';
|
||||
echo "<script type='text/javascript'>
|
||||
$(document).ready (function () {
|
||||
period_select_init('".$uniq_name."', ".(($allow_zero) ? 'true' : 'null').");
|
||||
period_select_init('".$uniq_name."', ".(($allow_zero) ? 1 : 0).");
|
||||
period_select_events('".$uniq_name."');
|
||||
});
|
||||
function period_select_".$name."_update(seconds) {
|
||||
|
@ -5603,7 +5601,9 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
0,
|
||||
$data['agent_ids'],
|
||||
$data['selectionModules'],
|
||||
true
|
||||
true,
|
||||
false,
|
||||
(isset($data['notStringModules']) === true && $data['notStringModules'] === true) ? true : false
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -3607,8 +3607,26 @@ function modules_get_agentmodule_mininterval_no_async($id_agent)
|
|||
}
|
||||
|
||||
|
||||
function get_modules_agents($id_module_group, $id_agents, $selection, $select_mode=true, $useName=false)
|
||||
{
|
||||
/**
|
||||
* Get modules agents.
|
||||
*
|
||||
* @param integer $id_module_group ID module group.
|
||||
* @param array $id_agents Array agents.
|
||||
* @param boolean $selection Selection.
|
||||
* @param boolean $select_mode Mode.
|
||||
* @param boolean $useName Use name.
|
||||
* @param boolean $notStringModules Not string modules.
|
||||
*
|
||||
* @return array Modules for this agents.
|
||||
*/
|
||||
function get_modules_agents(
|
||||
$id_module_group,
|
||||
$id_agents,
|
||||
$selection,
|
||||
$select_mode=true,
|
||||
$useName=false,
|
||||
$notStringModules=false
|
||||
) {
|
||||
if ((bool) is_metaconsole() === true) {
|
||||
if ($select_mode === true) {
|
||||
$agents = array_reduce(
|
||||
|
@ -3657,7 +3675,8 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
|
|||
$selection,
|
||||
false,
|
||||
$useName,
|
||||
true
|
||||
true,
|
||||
$notStringModules
|
||||
);
|
||||
|
||||
metaconsole_restore_db();
|
||||
|
@ -3746,7 +3765,8 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
|
|||
$selection,
|
||||
false,
|
||||
$useName,
|
||||
false
|
||||
false,
|
||||
$notStringModules
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4193,6 +4213,11 @@ function modules_get_counter_by_states($state)
|
|||
|
||||
function modules_get_state_condition($state, $prefix='tae')
|
||||
{
|
||||
// Not use empty state 0 -> AGENT_MODULE_STATUS_NORMAL.
|
||||
if ($state === '') {
|
||||
return '1=1';
|
||||
}
|
||||
|
||||
switch ($state) {
|
||||
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||
|
|
|
@ -181,7 +181,7 @@ function profile_delete_profile_and_clean_users($id_profile)
|
|||
* @param int User id
|
||||
* @param bool Show the tags select or not
|
||||
*/
|
||||
function profile_print_profile_table($id)
|
||||
function profile_print_profile_table($id, $json_profile=false, $return=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
@ -243,7 +243,23 @@ function profile_print_profile_table($id)
|
|||
}
|
||||
|
||||
if ($result === false) {
|
||||
$result = [];
|
||||
if ($json_profile !== false && empty($json_profile) !== true) {
|
||||
$profile_decoded = json_decode($json_profile);
|
||||
foreach ($profile_decoded as $profile) {
|
||||
if (is_object($profile) === false) {
|
||||
$profile = json_decode($profile);
|
||||
}
|
||||
|
||||
$result[] = [
|
||||
'id_grupo' => $profile->group,
|
||||
'id_perfil' => $profile->profile,
|
||||
'tags' => $profile->tags,
|
||||
'hierarchy' => $profile->hierarchy,
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$result = [];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($result as $profile) {
|
||||
|
@ -268,7 +284,12 @@ function profile_print_profile_table($id)
|
|||
if (empty($profile['tags'])) {
|
||||
$data['tags'] = '';
|
||||
} else {
|
||||
$tags_ids = explode(',', $profile['tags']);
|
||||
if (is_array($profile['tags'] === false)) {
|
||||
$tags_ids = explode(',', $profile['tags']);
|
||||
} else {
|
||||
$tags_ids = $profile['tags'];
|
||||
}
|
||||
|
||||
$tags = tags_get_tags($tags_ids);
|
||||
$data['tags'] = tags_get_tags_formatted($tags);
|
||||
}
|
||||
|
@ -276,10 +297,10 @@ function profile_print_profile_table($id)
|
|||
$data['hierarchy'] = $profile['no_hierarchy'] ? __('Yes') : __('No');
|
||||
|
||||
$data['actions'] = '<form method="post" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
|
||||
$data['actions'] .= html_print_input_image('del', 'images/cross.png', 1, ['class' => 'invert_filter'], true);
|
||||
$data['actions'] .= html_print_input_hidden('delete_profile', 1, true);
|
||||
$data['actions'] .= html_print_input_hidden('id_user_profile', $profile['id_up'], true);
|
||||
$data['actions'] .= html_print_input_hidden('id_user', $id, true);
|
||||
$data['actions'] .= html_print_input_image('del', 'images/cross.png', 1, ['class' => 'invert_filter'], true);
|
||||
$data['actions'] .= '</form>';
|
||||
|
||||
array_push($table->data, $data);
|
||||
|
@ -345,8 +366,7 @@ function profile_print_profile_table($id)
|
|||
$data['actions'] .= '</form>';
|
||||
|
||||
array_push($table->data, $data);
|
||||
|
||||
html_print_table($table);
|
||||
html_print_table($table, $return);
|
||||
if (!is_metaconsole()) {
|
||||
echo '</div>';
|
||||
}
|
||||
|
|
|
@ -4011,7 +4011,7 @@ function reporting_groups_nodes($content)
|
|||
}
|
||||
|
||||
// Grouped.
|
||||
$filters['group_rep'] = 1;
|
||||
$filters['group_rep'] = EVENT_GROUP_REP_EVENTS;
|
||||
|
||||
$events = Event::search(
|
||||
[
|
||||
|
|
|
@ -1944,7 +1944,16 @@ function reporting_html_inventory($table, $item, $pdf=0)
|
|||
$table1->head[$k] = $k;
|
||||
$table1->headstyle[$k] = 'text-align: left';
|
||||
$table1->cellstyle[$str_key][$k] = 'text-align: left;';
|
||||
$table1->data[$str_key][$k] = $v;
|
||||
if ($pdf === 0) {
|
||||
$table1->data[$str_key][$k] = $v;
|
||||
} else {
|
||||
// Workaround to prevent table columns from growing indefinitely in PDFs.
|
||||
$table1->data[$str_key][$k] = preg_replace(
|
||||
'/([^\s]{30})(?=[^\s])/',
|
||||
'$1'.'<br>',
|
||||
$v
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3402,7 +3402,7 @@ function ui_print_datatable(array $parameters)
|
|||
$filter .= '</li>';
|
||||
|
||||
$filter .= '</ul><div id="both"></div></form>';
|
||||
if (isset($parameters['form']['no_toggle']) === false && ($parameters['form']['no_toggle'] !== true)) {
|
||||
if (isset($parameters['form']['no_toggle']) === false) {
|
||||
$filter = ui_toggle(
|
||||
$filter,
|
||||
__('Filter'),
|
||||
|
@ -3466,7 +3466,10 @@ function ui_print_datatable(array $parameters)
|
|||
foreach ($names as $column) {
|
||||
if (is_array($column)) {
|
||||
$table .= '<th id="'.$column['id'].'" class="'.$column['class'].'" ';
|
||||
$table .= 'title="'.__($column['title']).'" ';
|
||||
if (isset($column['title']) === true) {
|
||||
$table .= 'title="'.__($column['title']).'" ';
|
||||
}
|
||||
|
||||
$table .= ' style="'.$column['style'].'">'.__($column['text']);
|
||||
$table .= $column['extra'];
|
||||
$table .= '</th>';
|
||||
|
@ -6510,7 +6513,7 @@ function ui_print_breadcrums($tab_name)
|
|||
/**
|
||||
* Show last comment
|
||||
*
|
||||
* @param array $comments array with comments
|
||||
* @param string $comments String with comments.
|
||||
*
|
||||
* @return string HTML string with the last comment of the events.
|
||||
*/
|
||||
|
@ -6534,31 +6537,45 @@ function ui_print_comments($comments)
|
|||
foreach ($comments_array as $comm) {
|
||||
// Show the comments more recent first.
|
||||
if (is_array($comm)) {
|
||||
$last_comment[] = array_reverse($comm);
|
||||
$order_utimestamp = array_reduce(
|
||||
$comm,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['utimestamp']] = $item;
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
|
||||
$key_max_utimestamp = max(array_keys($order_utimestamp));
|
||||
|
||||
$last_comment = $order_utimestamp[$key_max_utimestamp];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($last_comment) === true) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Only show the last comment. If commment its too long,the comment will short with ...
|
||||
// If $config['prominent_time'] is timestamp the date show Month, day, hour and minutes.
|
||||
// Else show comments hours ago
|
||||
if ($last_comment[0][0]['action'] != 'Added comment') {
|
||||
$last_comment[0][0]['comment'] = $last_comment[0][0]['action'];
|
||||
if ($last_comment['action'] != 'Added comment') {
|
||||
$last_comment['comment'] = $last_comment['action'];
|
||||
}
|
||||
|
||||
$short_comment = substr($last_comment[0][0]['comment'], 0, 20);
|
||||
$short_comment = substr($last_comment['comment'], 0, 20);
|
||||
if ($config['prominent_time'] == 'timestamp') {
|
||||
$comentario = '<i>'.date($config['date_format'], $last_comment[0][0]['utimestamp']).' ('.$last_comment[0][0]['id_user'].'): '.$last_comment[0][0]['comment'].'';
|
||||
$comentario = '<i>'.date($config['date_format'], $last_comment['utimestamp']).' ('.$last_comment['id_user'].'): '.$last_comment['comment'].'';
|
||||
|
||||
if (strlen($comentario) > '200px') {
|
||||
$comentario = '<i>'.date($config['date_format'], $last_comment[0][0]['utimestamp']).' ('.$last_comment[0][0]['id_user'].'): '.$short_comment.'...';
|
||||
$comentario = '<i>'.date($config['date_format'], $last_comment['utimestamp']).' ('.$last_comment['id_user'].'): '.$short_comment.'...';
|
||||
}
|
||||
} else {
|
||||
$rest_time = (time() - $last_comment[0][0]['utimestamp']);
|
||||
$rest_time = (time() - $last_comment['utimestamp']);
|
||||
$time_last = (($rest_time / 60) / 60);
|
||||
$comentario = '<i>'.number_format($time_last, 0).' Hours ('.$last_comment[0][0]['id_user'].'): '.$last_comment[0][0]['comment'].'';
|
||||
$comentario = '<i>'.number_format($time_last, 0).' Hours ('.$last_comment['id_user'].'): '.$last_comment['comment'].'';
|
||||
|
||||
if (strlen($comentario) > '200px') {
|
||||
$comentario = '<i>'.number_format($time_last, 0).' Hours ('.$last_comment[0][0]['id_user'].'): '.$short_comment.'...';
|
||||
$comentario = '<i>'.number_format($time_last, 0).' Hours ('.$last_comment['id_user'].'): '.$short_comment.'...';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -235,27 +235,31 @@ function groups_combine_acl($acl_group_a, $acl_group_b)
|
|||
}
|
||||
|
||||
$acl_list = [
|
||||
'agent_view' => 1,
|
||||
'agent_edit' => 1,
|
||||
'agent_disable' => 1,
|
||||
'alert_edit' => 1,
|
||||
'alert_management' => 1,
|
||||
'pandora_management' => 1,
|
||||
'db_management' => 1,
|
||||
'user_management' => 1,
|
||||
'report_view' => 1,
|
||||
'report_edit' => 1,
|
||||
'report_management' => 1,
|
||||
'event_view' => 1,
|
||||
'event_edit' => 1,
|
||||
'event_management' => 1,
|
||||
'map_view' => 1,
|
||||
'map_edit' => 1,
|
||||
'map_management' => 1,
|
||||
'vconsole_view' => 1,
|
||||
'vconsole_edit' => 1,
|
||||
'vconsole_management' => 1,
|
||||
'tags' => 1,
|
||||
'agent_view' => 1,
|
||||
'agent_edit' => 1,
|
||||
'agent_disable' => 1,
|
||||
'alert_edit' => 1,
|
||||
'alert_management' => 1,
|
||||
'pandora_management' => 1,
|
||||
'db_management' => 1,
|
||||
'user_management' => 1,
|
||||
'report_view' => 1,
|
||||
'report_edit' => 1,
|
||||
'report_management' => 1,
|
||||
'event_view' => 1,
|
||||
'event_edit' => 1,
|
||||
'event_management' => 1,
|
||||
'map_view' => 1,
|
||||
'map_edit' => 1,
|
||||
'map_management' => 1,
|
||||
'vconsole_view' => 1,
|
||||
'vconsole_edit' => 1,
|
||||
'vconsole_management' => 1,
|
||||
'tags' => 1,
|
||||
'network_config_view' => 1,
|
||||
'network_config_edit' => 1,
|
||||
'network_config_management' => 1,
|
||||
|
||||
];
|
||||
|
||||
foreach ($acl_group_a['tags'] as $key => $value) {
|
||||
|
@ -838,13 +842,14 @@ function users_has_profile_without_UM($id_user, $id_groups)
|
|||
}
|
||||
|
||||
|
||||
function users_get_user_profile($id_user)
|
||||
function users_get_user_profile($id_user, $limit='')
|
||||
{
|
||||
$sql = sprintf(
|
||||
"SELECT * FROM tusuario_perfil
|
||||
INNER JOIN tperfil ON tperfil.id_perfil = tusuario_perfil.id_perfil
|
||||
WHERE tusuario_perfil.id_usuario like '%s'",
|
||||
$id_user
|
||||
WHERE tusuario_perfil.id_usuario like '%s' %s",
|
||||
$id_user,
|
||||
$limit
|
||||
);
|
||||
|
||||
$aux = db_get_all_rows_sql($sql);
|
||||
|
|
|
@ -196,6 +196,13 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) {
|
|||
serialized = "";
|
||||
}
|
||||
|
||||
var id_group = null;
|
||||
if (typeof $("#filter_group") !== "undefined") {
|
||||
try {
|
||||
id_group = $("#filter_group").val();
|
||||
} catch (error) {}
|
||||
}
|
||||
|
||||
$("#module")
|
||||
.prop("disabled", true)
|
||||
.empty()
|
||||
|
@ -238,7 +245,8 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) {
|
|||
selection_mode: selection_mode,
|
||||
serialized: serialized,
|
||||
id_server: id_server,
|
||||
status_module: module_status
|
||||
status_module: module_status,
|
||||
id_group: id_group
|
||||
},
|
||||
function(data) {
|
||||
$("#module").empty();
|
||||
|
@ -575,7 +583,8 @@ function module_changed_by_multiple_modules(event, id_module, selected) {
|
|||
status_module: status_module,
|
||||
"module_name[]": idModules,
|
||||
selection_mode: selection_mode,
|
||||
tags: tags_selected
|
||||
tags: tags_selected,
|
||||
id_group: id_group
|
||||
},
|
||||
function(data) {
|
||||
$("#agents").append(
|
||||
|
@ -886,7 +895,6 @@ function period_select_init(name, allow_zero) {
|
|||
// Manual mode is hidden by default
|
||||
$("#" + name + "_manual").css("display", "none");
|
||||
$("#" + name + "_default").css("display", "inline");
|
||||
|
||||
// If the text input is empty, we put on it 5 minutes by default
|
||||
if ($("#text-" + name + "_text").val() == "") {
|
||||
$("#text-" + name + "_text").val(300);
|
||||
|
@ -897,7 +905,7 @@ function period_select_init(name, allow_zero) {
|
|||
} else {
|
||||
$("#" + name + "_select option:eq(1)").prop("selected", true);
|
||||
}
|
||||
} else if ($("#text-" + name + "_text").val() == 0 && allow_zero != true) {
|
||||
} else if ($("#text-" + name + "_text").val() == 0 && allow_zero == 1) {
|
||||
$("#" + name + "_units option:last").prop("selected", false);
|
||||
$("#" + name + "_manual").css("display", "inline");
|
||||
$("#" + name + "_default").css("display", "none");
|
||||
|
@ -1041,10 +1049,10 @@ function adjustTextUnits(name) {
|
|||
var restInt = parseInt(rest).toString();
|
||||
|
||||
if (rest != restInt && unitsSelected == false) {
|
||||
$("#" + name + "_units option:eq(" + ($(this).index() - 1) + ")").prop(
|
||||
"selected",
|
||||
true
|
||||
);
|
||||
var value_selected = $(
|
||||
"#" + name + "_units option:eq(" + ($(this).index() - 1) + ")"
|
||||
).val();
|
||||
$("#" + name + "_units").val(value_selected);
|
||||
|
||||
$("#text-" + name + "_text").val(restPrev);
|
||||
unitsSelected = true;
|
||||
|
@ -2176,3 +2184,19 @@ $.fn.filterByText = function(textbox) {
|
|||
});
|
||||
});
|
||||
};
|
||||
|
||||
function loadPasswordConfig(id, value) {
|
||||
$.ajax({
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: "include/ajax/config.ajax",
|
||||
token_name: `${value}`,
|
||||
no_boolean: 1
|
||||
},
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
$(`#${id}`).val(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1536,3 +1536,18 @@ function loadSliceWidget(settings) {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function showManualThresholds(element) {
|
||||
$("#min_warning").val(null);
|
||||
$("#max_warning").val(null);
|
||||
$("#min_critical").val(null);
|
||||
$("#max_critical").val(null);
|
||||
if ($(element).is(":checked") === true) {
|
||||
$(".dashboard-input-threshold-warning").removeClass("invisible_important");
|
||||
$(".dashboard-input-threshold-critical").removeClass("invisible_important");
|
||||
} else {
|
||||
$(".dashboard-input-threshold-warning").addClass("invisible_important");
|
||||
$(".dashboard-input-threshold-critical").addClass("invisible_important");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,29 +85,6 @@ function show_event_dialog(event, dialog_page) {
|
|||
$("#refrcounter").countdown("pause");
|
||||
$("div.vc-countdown").countdown("pause");
|
||||
|
||||
/*
|
||||
switch (result) {
|
||||
case "comment_ok":
|
||||
$("#notification_comment_success").show();
|
||||
break;
|
||||
case "comment_error":
|
||||
$("#notification_comment_error").show();
|
||||
break;
|
||||
case "status_ok":
|
||||
$("#notification_status_success").show();
|
||||
break;
|
||||
case "status_error":
|
||||
$("#notification_status_error").show();
|
||||
break;
|
||||
case "owner_ok":
|
||||
$("#notification_owner_success").show();
|
||||
break;
|
||||
case "owner_error":
|
||||
$("#notification_owner_error").show();
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
forced_title_callback();
|
||||
},
|
||||
"html"
|
||||
|
@ -119,37 +96,152 @@ function show_event_dialog(event, dialog_page) {
|
|||
function execute_response(event_id, server_id) {
|
||||
var response_id = $("#select_custom_response option:selected").val();
|
||||
|
||||
var response = get_response(response_id, server_id);
|
||||
|
||||
// If cannot get response abort it
|
||||
if (response == null) {
|
||||
return;
|
||||
var response_parameters_list = $('input[name^="values_params_"]');
|
||||
var response_parameters = [];
|
||||
if (response_parameters_list.length > 0) {
|
||||
response_parameters_list.each(function() {
|
||||
var acum = {
|
||||
name: $(this).attr("name"),
|
||||
value: $(this).val()
|
||||
};
|
||||
response_parameters.push(acum);
|
||||
});
|
||||
}
|
||||
|
||||
response["target"] = get_response_target(event_id, response_id, server_id);
|
||||
response["event_id"] = event_id;
|
||||
response["server_id"] = server_id;
|
||||
var params = [];
|
||||
params.push({ name: "page", value: "include/ajax/events" });
|
||||
params.push({ name: "get_response", value: 1 });
|
||||
params.push({ name: "response_id", value: response_id });
|
||||
params.push({ name: "server_id", value: server_id });
|
||||
params.push({ name: "event_id", value: event_id });
|
||||
params.push({
|
||||
name: "response_parameters",
|
||||
value: JSON.stringify(response_parameters)
|
||||
});
|
||||
|
||||
if (response["type"] == "url" && response["new_window"] == 1) {
|
||||
window.open(response["target"], "_blank");
|
||||
} else {
|
||||
show_response_dialog(response_id, response);
|
||||
}
|
||||
jQuery.ajax({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
// If cannot get response abort it
|
||||
if (response == null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
response["event_id"] = event_id;
|
||||
response["server_id"] = server_id;
|
||||
if (response["type"] == "url" && response["new_window"] == 1) {
|
||||
window.open(response["target"], "_blank");
|
||||
} else {
|
||||
show_response_dialog(response_id, response);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Check the response type and open it in a modal dialog or new window
|
||||
function execute_response_massive(events, response_id, response_parameters) {
|
||||
var params = [];
|
||||
params.push({ name: "page", value: "include/ajax/events" });
|
||||
params.push({ name: "get_response_massive", value: 1 });
|
||||
params.push({ name: "response_id", value: response_id });
|
||||
params.push({ name: "events", value: JSON.stringify(events) });
|
||||
params.push({ name: "response_parameters", value: response_parameters });
|
||||
|
||||
jQuery.ajax({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
// If cannot get response abort it
|
||||
if (data == null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$(".container-massive-events-response").empty();
|
||||
|
||||
// Convert to array.
|
||||
var array_data = Object.entries(data.event_response_targets);
|
||||
var total_count = array_data.length;
|
||||
|
||||
// Each input checkeds.
|
||||
array_data.forEach(function(element, index) {
|
||||
var id = element[0];
|
||||
var target = element[1].target;
|
||||
var meta = $("#hidden-meta").val();
|
||||
var event_id = id;
|
||||
var server_id = 0;
|
||||
if (meta != 0) {
|
||||
var split_id = id.split("|");
|
||||
event_id = split_id[0];
|
||||
server_id = split_id[1];
|
||||
}
|
||||
|
||||
var end = 0;
|
||||
if (total_count - 1 === index) {
|
||||
end = 1;
|
||||
}
|
||||
|
||||
var response = data.event_response;
|
||||
response["event_id"] = event_id;
|
||||
response["server_id"] = server_id;
|
||||
response["target"] = target;
|
||||
if (response["type"] == "url" && response["new_window"] == 1) {
|
||||
window.open(response["target"], "_blank");
|
||||
} else {
|
||||
var params = [];
|
||||
params.push({ name: "page", value: "include/ajax/events" });
|
||||
params.push({ name: "get_row_response_action", value: 1 });
|
||||
params.push({ name: "response_id", value: response_id });
|
||||
params.push({ name: "server_id", value: response.server_id });
|
||||
params.push({ name: "end", value: end });
|
||||
params.push({ name: "response", value: JSON.stringify(response) });
|
||||
|
||||
jQuery.ajax({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$(".container-massive-events-response").append(data);
|
||||
response["event_id"] = event_id;
|
||||
response["server_id"] = server_id;
|
||||
response["target"] = target;
|
||||
|
||||
var indexstr = event_id;
|
||||
if (meta != 0) {
|
||||
indexstr += "-" + server_id;
|
||||
}
|
||||
|
||||
perform_response(
|
||||
btoa(JSON.stringify(response)),
|
||||
response_id,
|
||||
indexstr
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Show the modal window of an event response
|
||||
function show_response_dialog(response_id, response) {
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("dialogue_event_response=1");
|
||||
params.push("massive=0");
|
||||
params.push("event_id=" + response["event_id"]);
|
||||
params.push("target=" + encodeURIComponent(response["target"]));
|
||||
params.push("response_id=" + response_id);
|
||||
params.push("server_id=" + response["server_id"]);
|
||||
params.push({ name: "page", value: "include/ajax/events" });
|
||||
params.push({ name: "dialogue_event_response", value: 1 });
|
||||
params.push({ name: "event_id", value: response.event_id });
|
||||
params.push({ name: "target", value: response.target });
|
||||
params.push({ name: "response_id", value: response_id });
|
||||
params.push({ name: "server_id", value: response.server_id });
|
||||
params.push({ name: "response", value: JSON.stringify(response) });
|
||||
|
||||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
dataType: "html",
|
||||
|
@ -164,271 +256,49 @@ function show_response_dialog(response_id, response) {
|
|||
draggable: true,
|
||||
modal: false,
|
||||
open: function() {
|
||||
perform_response(response, response_id);
|
||||
perform_response(btoa(JSON.stringify(response)), response_id, "");
|
||||
},
|
||||
width: response["modal_width"],
|
||||
height: response["modal_height"]
|
||||
height: response["modal_height"],
|
||||
buttons: []
|
||||
})
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Show the modal window of event responses when multiple events are selected
|
||||
function show_massive_response_dialog(
|
||||
response_id,
|
||||
response,
|
||||
out_iterator,
|
||||
end
|
||||
) {
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("dialogue_event_response=1");
|
||||
params.push("massive=1");
|
||||
params.push("end=" + end);
|
||||
params.push("out_iterator=" + out_iterator);
|
||||
params.push("event_id=" + response["event_id"]);
|
||||
params.push("target=" + response["target"]);
|
||||
params.push("response_id=" + response_id);
|
||||
params.push("server_id=" + response["server_id"]);
|
||||
// Perform a response and put the output into a div
|
||||
function perform_response(response, response_id, index) {
|
||||
$("#re_exec_command" + index).hide();
|
||||
$("#response_loading_command" + index).show();
|
||||
$("#response_out" + index).html("");
|
||||
|
||||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
response_tg: response,
|
||||
response_id: response_id,
|
||||
out_iterator: out_iterator,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
if (out_iterator === 0) $("#event_response_window").empty();
|
||||
|
||||
$("#event_response_window")
|
||||
.hide()
|
||||
.append(data)
|
||||
.dialog({
|
||||
title: $("#select_custom_response option:selected").html(),
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
open: function() {
|
||||
$("#response_loading_dialog").hide();
|
||||
$("#button-submit_event_response").show();
|
||||
},
|
||||
close: function() {
|
||||
$("#checkbox-all_validate_box").prop("checked", false);
|
||||
$(".chk_val").prop("checked", false);
|
||||
},
|
||||
width: response["modal_width"],
|
||||
height: response["modal_height"]
|
||||
})
|
||||
.show();
|
||||
|
||||
perform_response_massive(
|
||||
this.response_tg,
|
||||
this.response_id,
|
||||
this.out_iterator
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Get an event response from db
|
||||
function get_response(response_id, server_id) {
|
||||
var response = "";
|
||||
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("get_response=1");
|
||||
params.push("response_id=" + response_id);
|
||||
params.push("server_id=" + server_id);
|
||||
|
||||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: false,
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
response = data;
|
||||
}
|
||||
});
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
// Get an event response params from db
|
||||
function get_response_params(response_id) {
|
||||
var response_params;
|
||||
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("get_response_params=1");
|
||||
params.push("response_id=" + response_id);
|
||||
|
||||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: false,
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
response_params = data;
|
||||
}
|
||||
});
|
||||
|
||||
return response_params;
|
||||
}
|
||||
|
||||
// Get an event response description from db
|
||||
function get_response_description(response_id) {
|
||||
var response_description = "";
|
||||
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("get_response_description=1");
|
||||
params.push("response_id=" + response_id);
|
||||
|
||||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: false,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
response_description = data;
|
||||
}
|
||||
});
|
||||
|
||||
return response_description;
|
||||
}
|
||||
|
||||
function add_row_param(id_table, param) {
|
||||
$("#" + id_table).append(
|
||||
'<tr class="params_rows"><td style="text-align:left; padding-left:40px; font-weight: normal; font-style: italic;">' +
|
||||
param +
|
||||
'</td><td style="text-align:left" colspan="2"><input type="text" name="' +
|
||||
param +
|
||||
'" id="' +
|
||||
param +
|
||||
'"></td></tr>'
|
||||
);
|
||||
}
|
||||
|
||||
// Get an event response from db
|
||||
function get_response_target(
|
||||
event_id,
|
||||
response_id,
|
||||
server_id,
|
||||
response_command
|
||||
) {
|
||||
var target = "";
|
||||
|
||||
// Replace the main macros
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("get_response_target=1");
|
||||
params.push("event_id=" + event_id);
|
||||
params.push("response_id=" + response_id);
|
||||
params.push("server_id=" + server_id);
|
||||
|
||||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: false,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
target = data;
|
||||
}
|
||||
});
|
||||
|
||||
// Replace the custom params macros.
|
||||
var response_params = get_response_params(response_id);
|
||||
if (response_params.length > 1 || response_params[0] != "") {
|
||||
for (var i = 0; i < response_params.length; i++) {
|
||||
if (!response_command) {
|
||||
var response_param = "_" + response_params[i] + "_";
|
||||
|
||||
if (
|
||||
response_params[i].startsWith("_") &&
|
||||
response_params[i].endsWith("_")
|
||||
) {
|
||||
response_param = response_params[i];
|
||||
}
|
||||
|
||||
target = target.replace(
|
||||
response_param,
|
||||
$("#" + response_params[i]).val()
|
||||
);
|
||||
} else {
|
||||
target = target.replace(
|
||||
"_" + response_params[i] + "_",
|
||||
response_command[response_params[i] + "-" + i]
|
||||
);
|
||||
}
|
||||
}
|
||||
try {
|
||||
response = JSON.parse(atob(response));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return;
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
// Perform a response and put the output into a div
|
||||
function perform_response(response, response_id) {
|
||||
$("#re_exec_command").hide();
|
||||
$("#response_loading_command").show();
|
||||
$("#response_out").html("");
|
||||
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("perform_event_response=1");
|
||||
params.push("target=" + encodeURIComponent(response["target"]));
|
||||
params.push("response_id=" + response_id);
|
||||
params.push("event_id=" + response["event_id"]);
|
||||
params.push("server_id=" + response["server_id"]);
|
||||
params.push({ name: "page", value: "include/ajax/events" });
|
||||
params.push({ name: "perform_event_response", value: 1 });
|
||||
params.push({ name: "target", value: response["target"] });
|
||||
params.push({ name: "response_id", value: response_id });
|
||||
params.push({ name: "event_id", value: response["event_id"] });
|
||||
params.push({ name: "server_id", value: response["server_id"] });
|
||||
params.push({ name: "response", value: JSON.stringify(response) });
|
||||
|
||||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: true,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
var out = data.replace(/[\n|\r]/g, "<br>");
|
||||
$("#response_out").html(out);
|
||||
$("#response_loading_command").hide();
|
||||
$("#re_exec_command").show();
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Perform a response and put the output into a div
|
||||
function perform_response_massive(response, response_id, out_iterator) {
|
||||
$("#re_exec_command").hide();
|
||||
$("#response_loading_command_" + out_iterator).show();
|
||||
$("#response_out_" + out_iterator).html("");
|
||||
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("perform_event_response=1");
|
||||
params.push("target=" + response["target"]);
|
||||
params.push("response_id=" + response_id);
|
||||
params.push("event_id=" + response["event_id"]);
|
||||
params.push("server_id=" + response["server_id"]);
|
||||
|
||||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: true,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
var out = data.replace(/[\n|\r]/g, "<br>");
|
||||
$("#response_out_" + out_iterator).html(out);
|
||||
$("#response_loading_command_" + out_iterator).hide();
|
||||
$("#re_exec_command_" + out_iterator).show();
|
||||
$("#response_out" + index).html(out);
|
||||
$("#response_loading_command" + index).hide();
|
||||
$("#re_exec_command" + index).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -600,54 +470,6 @@ function event_comment(current_event) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function show_event_response_command_dialog(id, response, total_checked) {
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("get_table_response_command=1");
|
||||
params.push("event_response_id=" + id);
|
||||
|
||||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#event_response_command_window")
|
||||
.hide()
|
||||
.empty()
|
||||
.append(data)
|
||||
.dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
open: function() {
|
||||
$("#response_loading_dialog").hide();
|
||||
$("#button-submit_event_response").show();
|
||||
},
|
||||
width: 600,
|
||||
height: 300
|
||||
})
|
||||
.show();
|
||||
|
||||
$("#submit-enter_command").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
var response_command = [];
|
||||
|
||||
$(".response_command_input").each(function() {
|
||||
response_command[$(this).attr("name")] = $(this).val();
|
||||
});
|
||||
|
||||
check_massive_response_event(
|
||||
id,
|
||||
response,
|
||||
total_checked,
|
||||
response_command
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var processed = 0;
|
||||
function update_event(table, id_evento, type, event_rep, row, server_id) {
|
||||
var inputs = $("#events_form :input");
|
||||
|
@ -820,8 +642,13 @@ function execute_delete_event_reponse(
|
|||
|
||||
// Imported from old files.
|
||||
function execute_event_response(event_list_btn) {
|
||||
var response_id = $("select[name=response_id]").val();
|
||||
if (!isNaN(response_id)) {
|
||||
table_info_response_event(response_id, 0, 0, true);
|
||||
}
|
||||
|
||||
var message =
|
||||
"<h4 style = 'text-align: center; color:black' > Are you sure?</h4> ";
|
||||
"<h4 style = 'text-align: center; color:black' > Are you sure?</h4> <div id='massive-parameters-response'></div> ";
|
||||
confirmDialog({
|
||||
title: "ATTENTION",
|
||||
message: message,
|
||||
|
@ -833,8 +660,6 @@ function execute_event_response(event_list_btn) {
|
|||
$("#max_custom_event_resp_msg").hide();
|
||||
$("#max_custom_selected").hide();
|
||||
|
||||
var response_id = $("select[name=response_id]").val();
|
||||
|
||||
var total_checked = $(".chk_val:checked").length;
|
||||
|
||||
// Check select an event.
|
||||
|
@ -844,58 +669,28 @@ function execute_event_response(event_list_btn) {
|
|||
}
|
||||
|
||||
if (!isNaN(response_id)) {
|
||||
// It is a custom response
|
||||
var response = get_response(response_id);
|
||||
|
||||
// If cannot get response abort it
|
||||
if (response == null) {
|
||||
return;
|
||||
var response_parameters_list = $('input[name^="values_params_"]');
|
||||
var response_parameters = [];
|
||||
if (response_parameters_list.length > 0) {
|
||||
response_parameters_list.each(function() {
|
||||
var acum = {
|
||||
name: $(this).attr("name"),
|
||||
value: $(this).val()
|
||||
};
|
||||
response_parameters.push(acum);
|
||||
});
|
||||
}
|
||||
|
||||
// Limit number of events to apply custom responses
|
||||
// due performance reasons.
|
||||
if (total_checked > $("#max_execution_event_response").val()) {
|
||||
$("#max_custom_event_resp_msg").show();
|
||||
return;
|
||||
}
|
||||
|
||||
var response_command = [];
|
||||
$(".response_command_input").each(function() {
|
||||
response_command[$(this).attr("name")] = $(this).val();
|
||||
});
|
||||
response_parameters = JSON.stringify(response_parameters);
|
||||
|
||||
if (event_list_btn) {
|
||||
$("#button-submit_event_response").hide(function() {
|
||||
$("#response_loading_dialog").show(function() {
|
||||
var check_params = get_response_params(response_id);
|
||||
|
||||
if (check_params[0] !== "") {
|
||||
show_event_response_command_dialog(
|
||||
response_id,
|
||||
response,
|
||||
total_checked
|
||||
);
|
||||
} else {
|
||||
check_massive_response_event(
|
||||
response_id,
|
||||
response,
|
||||
total_checked,
|
||||
response_command
|
||||
);
|
||||
}
|
||||
show_response_dialog_massive(response_id, response_parameters);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$("#button-btn_str").hide(function() {
|
||||
$("#execute_again_loading").show(function() {
|
||||
check_massive_response_event(
|
||||
response_id,
|
||||
response,
|
||||
total_checked,
|
||||
response_command
|
||||
);
|
||||
});
|
||||
});
|
||||
check_execute_response_massive(response_id, response_parameters);
|
||||
}
|
||||
} else {
|
||||
// It is not a custom response
|
||||
|
@ -912,7 +707,7 @@ function execute_event_response(event_list_btn) {
|
|||
}
|
||||
|
||||
in_process_event(
|
||||
"events",
|
||||
"table_events",
|
||||
event_id,
|
||||
$(this).attr("event_rep"),
|
||||
this.parentElement.parentElement,
|
||||
|
@ -932,7 +727,7 @@ function execute_event_response(event_list_btn) {
|
|||
}
|
||||
|
||||
validate_event(
|
||||
"events",
|
||||
"table_events",
|
||||
event_id,
|
||||
$(this).attr("event_rep"),
|
||||
this.parentElement.parentElement,
|
||||
|
@ -952,7 +747,7 @@ function execute_event_response(event_list_btn) {
|
|||
}
|
||||
|
||||
execute_delete_event_reponse(
|
||||
"events",
|
||||
"table_events",
|
||||
event_id,
|
||||
$(this).attr("event_rep"),
|
||||
this.parentElement.parentElement,
|
||||
|
@ -970,15 +765,63 @@ function execute_event_response(event_list_btn) {
|
|||
});
|
||||
}
|
||||
|
||||
function check_massive_response_event(
|
||||
response_id,
|
||||
response,
|
||||
total_checked,
|
||||
response_command
|
||||
) {
|
||||
var counter = 0;
|
||||
var end = 0;
|
||||
function show_response_dialog_massive(response_id, response_parameters) {
|
||||
var params = [];
|
||||
params.push({ name: "page", value: "include/ajax/events" });
|
||||
params.push({ name: "get_response", value: 1 });
|
||||
params.push({ name: "response_id", value: response_id });
|
||||
|
||||
jQuery.ajax({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
// If cannot get response abort it
|
||||
if (response == null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$("#event_response_window")
|
||||
.hide()
|
||||
.empty()
|
||||
.append('<div class="container-massive-events-response"></div>')
|
||||
.dialog({
|
||||
title: $("#response_id option:selected").html(),
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
open: function() {
|
||||
check_execute_response_massive(response_id, response_parameters);
|
||||
},
|
||||
close: function() {
|
||||
$("#checkbox-all_validate_box").prop("checked", false);
|
||||
$(".chk_val").prop("checked", false);
|
||||
$("#response_loading_dialog").hide();
|
||||
$("#button-submit_event_response").show();
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
text: "Execute All",
|
||||
id: "execute-again-all",
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
||||
click: function() {
|
||||
execute_event_response(false);
|
||||
}
|
||||
}
|
||||
],
|
||||
width: response["modal_width"],
|
||||
height: response["modal_height"]
|
||||
})
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function check_execute_response_massive(response_id, response_parameters) {
|
||||
var events = [];
|
||||
$(".container-massive-events-response").empty();
|
||||
$(".chk_val:checked").each(function() {
|
||||
var event_id = $(this).val();
|
||||
var meta = $("#hidden-meta").val();
|
||||
|
@ -987,23 +830,18 @@ function check_massive_response_event(
|
|||
var split_id = event_id.split("|");
|
||||
event_id = split_id[0];
|
||||
server_id = split_id[1];
|
||||
|
||||
if (events[server_id] === undefined) {
|
||||
events[server_id] = [];
|
||||
}
|
||||
|
||||
events[server_id].push(event_id);
|
||||
} else {
|
||||
events.push(event_id);
|
||||
}
|
||||
|
||||
response["target"] = get_response_target(
|
||||
event_id,
|
||||
response_id,
|
||||
server_id,
|
||||
response_command
|
||||
);
|
||||
response["server_id"] = server_id;
|
||||
response["event_id"] = event_id;
|
||||
|
||||
if (total_checked - 1 === counter) end = 1;
|
||||
|
||||
show_massive_response_dialog(response_id, response, counter, end);
|
||||
|
||||
counter++;
|
||||
});
|
||||
|
||||
execute_response_massive(events, response_id, response_parameters);
|
||||
}
|
||||
|
||||
function event_widget_options() {
|
||||
|
@ -1287,3 +1125,43 @@ function check_event_sound(settings) {
|
|||
"json"
|
||||
);
|
||||
}
|
||||
|
||||
function table_info_response_event(response_id, event_id, server_id, massive) {
|
||||
var params = [];
|
||||
params.push({ name: "page", value: "include/ajax/events" });
|
||||
params.push({ name: "get_response", value: 1 });
|
||||
params.push({ name: "response_id", value: response_id });
|
||||
params.push({ name: "server_id", value: server_id });
|
||||
params.push({ name: "event_id", value: event_id });
|
||||
|
||||
jQuery.ajax({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
if (response) {
|
||||
var params = [];
|
||||
params.push({ name: "page", value: "include/ajax/events" });
|
||||
params.push({ name: "draw_row_response_info", value: 1 });
|
||||
params.push({ name: "massive", value: massive === true ? 1 : 0 });
|
||||
params.push({ name: "response", value: JSON.stringify(response) });
|
||||
|
||||
jQuery.ajax({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
dataType: "html",
|
||||
success: function(output) {
|
||||
if (massive === true) {
|
||||
$("#massive-parameters-response").append(output);
|
||||
} else {
|
||||
$(".params_rows").remove();
|
||||
$("#responses_table").append(output);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -740,3 +740,26 @@ function reveal_password(name) {
|
|||
revealElement.attr("src", imagesPath + "eye_show.png");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns html img group icon.
|
||||
* @param {int} $id_group
|
||||
*/
|
||||
function getGroupIcon(id_group, img_container) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "godmode/groups/group_list",
|
||||
get_group_json: 1,
|
||||
id_group: id_group
|
||||
},
|
||||
success: function(data) {
|
||||
img_container.attr("src", "images/groups_small/" + data["icon"] + ".png");
|
||||
},
|
||||
error: function() {
|
||||
img_container.attr("src", "");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -858,11 +858,12 @@ var TreeController = {
|
|||
$content.append($statusImage);
|
||||
}
|
||||
var image_tooltip =
|
||||
'<span><img class="invert_filter" src="' +
|
||||
(controller.baseURL.length > 0 ? controller.baseURL : "") +
|
||||
'images/help.png" class="img_help" title="' +
|
||||
'<span><img class="invert_filter forced_title" data-title="' +
|
||||
(element.title ? element.title : element.name) +
|
||||
'" alt="' +
|
||||
'" data-use_title_for_force_title="1" src="' +
|
||||
(controller.baseURL.length > 0 ? controller.baseURL : "") +
|
||||
'images/help.png" class="img_help" ' +
|
||||
' alt="' +
|
||||
element.name +
|
||||
'"/></span> ';
|
||||
|
||||
|
@ -883,7 +884,6 @@ var TreeController = {
|
|||
window.location.href = element.serviceDetail;
|
||||
})
|
||||
.css("cursor", "pointer");
|
||||
|
||||
$content.append($serviceDetailImage);
|
||||
$content.append(" " + image_tooltip);
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ final class Config
|
|||
$link->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2);
|
||||
$rc = mysqli_real_connect(
|
||||
$link,
|
||||
$$config['history_db_host'],
|
||||
$config['history_db_host'],
|
||||
$config['history_db_user'],
|
||||
io_output_password($config['history_db_pass']),
|
||||
$config['history_db_name'],
|
||||
|
@ -90,29 +90,31 @@ final class Config
|
|||
}
|
||||
|
||||
ob_get_clean();
|
||||
}
|
||||
|
||||
if ($config['history_db_connection'] !== false) {
|
||||
$data = \db_get_all_rows_sql(
|
||||
'SELECT * FROM `tconfig`',
|
||||
false,
|
||||
false,
|
||||
$config['history_db_connection']
|
||||
);
|
||||
}
|
||||
|
||||
if (is_array($data) !== true) {
|
||||
return [];
|
||||
}
|
||||
|
||||
self::$settings = array_reduce(
|
||||
$data,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['token']] = $item['value'];
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
if (isset($config['history_db_connection']) === true
|
||||
&& $config['history_db_connection'] !== false
|
||||
) {
|
||||
$data = \db_get_all_rows_sql(
|
||||
'SELECT * FROM `tconfig`',
|
||||
false,
|
||||
false,
|
||||
$config['history_db_connection']
|
||||
);
|
||||
}
|
||||
|
||||
if (is_array($data) !== true) {
|
||||
return [];
|
||||
}
|
||||
|
||||
self::$settings = array_reduce(
|
||||
$data,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['token']] = $item['value'];
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -416,6 +416,7 @@ class Widget
|
|||
$className .= '\OsQuickReportWidget';
|
||||
break;
|
||||
|
||||
case 'GroupedMeterGraphs':
|
||||
case 'ColorModuleTabs':
|
||||
case 'BlockHistogram':
|
||||
$className .= '\\'.$name;
|
||||
|
|
|
@ -710,9 +710,13 @@ class AgentModuleWidget extends Widget
|
|||
|
||||
if (empty($allModules) === false) {
|
||||
if (is_metaconsole() === true && $this->values['mShowCommonModules'] !== 'on') {
|
||||
$modules = $agent->searchModules(
|
||||
['nombre' => array_keys($reduceAllModules['modules_selected'][$tserver])]
|
||||
);
|
||||
if (isset($reduceAllModules['modules_selected'][$tserver]) === true) {
|
||||
$modules = $agent->searchModules(
|
||||
['nombre' => array_keys($reduceAllModules['modules_selected'][$tserver])]
|
||||
);
|
||||
} else {
|
||||
$modules = null;
|
||||
}
|
||||
} else {
|
||||
$modules = $agent->searchModules(
|
||||
['nombre' => array_keys($allModules)]
|
||||
|
|
|
@ -328,7 +328,7 @@ class ServiceMapWidget extends Widget
|
|||
];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Enable sunburst'),
|
||||
'label' => __('Show sunburst by default'),
|
||||
'arguments' => [
|
||||
'type' => 'switch',
|
||||
'name' => 'sunburst',
|
||||
|
|
|
@ -749,6 +749,10 @@ class Module extends Entity
|
|||
$updates = $this->fields;
|
||||
$updates['id_tipo_modulo'] = $this->moduleType()->id_tipo();
|
||||
|
||||
if (empty($updates['debug_content']) === false) {
|
||||
$updates['debug_content'] = str_replace("'", '"', $updates['debug_content']);
|
||||
}
|
||||
|
||||
// In the case of the webserver modules, debug_content special characters must be handled.
|
||||
if ($updates['id_tipo_modulo'] >= MODULE_TYPE_WEB_ANALYSIS
|
||||
&& $updates['id_tipo_modulo'] <= MODULE_TYPE_WEB_CONTENT_STRING
|
||||
|
|
|
@ -128,7 +128,7 @@ class User implements PublicLogin
|
|||
{
|
||||
$user = new self($data);
|
||||
|
||||
if ($user === null) {
|
||||
if ($user->idUser === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -188,6 +188,14 @@ class User implements PublicLogin
|
|||
$config['public_access'] = false;
|
||||
}
|
||||
|
||||
if (empty($other_secret) === true) {
|
||||
$auth_token_secret = db_get_value('auth_token_secret', 'tusuario', 'id_user', $config['id_user']);
|
||||
|
||||
if (empty($auth_token_secret) === false) {
|
||||
$other_secret = $auth_token_secret;
|
||||
}
|
||||
}
|
||||
|
||||
// Build a hash to check.
|
||||
$hashCheck = self::generatePublicHash($other_secret);
|
||||
if ($hashCheck === $hash) {
|
||||
|
|
|
@ -66,7 +66,19 @@ if ($doLogin === true) {
|
|||
]
|
||||
) === true
|
||||
) {
|
||||
echo json_encode(['auth_hash' => User::generatePublicHash()]);
|
||||
$newGeneratedSecret = bin2hex(openssl_random_pseudo_bytes(15));
|
||||
|
||||
$res_update = update_user(
|
||||
$id_user,
|
||||
['auth_token_secret' => $newGeneratedSecret]
|
||||
);
|
||||
|
||||
if ($res_update === false) {
|
||||
http_response_code(404);
|
||||
return;
|
||||
}
|
||||
|
||||
echo json_encode(['auth_hash' => User::generatePublicHash($newGeneratedSecret)]);
|
||||
} else {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
|
|
|
@ -677,6 +677,128 @@ form.modal-dashboard
|
|||
text-align: initial;
|
||||
}
|
||||
|
||||
.container-grouped-meter {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 98%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.container-grouped-meter .container-info-module-meter {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.container-grouped-meter
|
||||
.container-info-module-meter
|
||||
.container-info-module-meter-title {
|
||||
flex: 1 1 20%;
|
||||
font-size: 100%;
|
||||
font-weight: bolder;
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.container-grouped-meter
|
||||
.container-info-module-meter
|
||||
.container-info-module-meter-graphs {
|
||||
flex: 1 1 65%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.container-grouped-meter
|
||||
.container-info-module-meter
|
||||
.container-info-module-meter-graphs
|
||||
div {
|
||||
border-radius: 2px;
|
||||
width: 17px;
|
||||
height: 90%;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.container-grouped-meter
|
||||
.container-info-module-meter
|
||||
.container-info-module-meter-graphs
|
||||
div.meter-graph-critical {
|
||||
background-color: #e63c52;
|
||||
}
|
||||
|
||||
.container-grouped-meter
|
||||
.container-info-module-meter
|
||||
.container-info-module-meter-graphs
|
||||
div.meter-graph-warning {
|
||||
background-color: #f3b200;
|
||||
}
|
||||
|
||||
.container-grouped-meter
|
||||
.container-info-module-meter
|
||||
.container-info-module-meter-graphs
|
||||
div.meter-graph-normal {
|
||||
background-color: #82b92e;
|
||||
}
|
||||
|
||||
.container-grouped-meter
|
||||
.container-info-module-meter
|
||||
.container-info-module-meter-graphs
|
||||
div.meter-graph-opacity {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.container-grouped-meter
|
||||
.container-info-module-meter
|
||||
.container-info-module-meter-data {
|
||||
flex: 1 1 15%;
|
||||
font-size: 150%;
|
||||
font-weight: bolder;
|
||||
text-align: right;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.container-grouped-meter
|
||||
.container-info-module-meter
|
||||
.container-info-module-meter-data.meter-data-critical {
|
||||
color: #e63c52;
|
||||
}
|
||||
|
||||
.container-grouped-meter
|
||||
.container-info-module-meter
|
||||
.container-info-module-meter-data.meter-data-warning {
|
||||
color: #f3b200;
|
||||
}
|
||||
|
||||
.container-grouped-meter
|
||||
.container-info-module-meter
|
||||
.container-info-module-meter-data.meter-data-normal {
|
||||
color: #82b92e;
|
||||
}
|
||||
|
||||
.dashboard-input-threshold {
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.dashboard-input-threshold input {
|
||||
max-width: 20% !important;
|
||||
}
|
||||
|
||||
.dashboard-input-threshold label:not(:first-child) {
|
||||
flex: 0 !important;
|
||||
}
|
||||
|
||||
.content-widget .dataTables_wrapper {
|
||||
width: 98%;
|
||||
margin-top: 5px;
|
||||
|
|
|
@ -396,3 +396,59 @@ div.multi-response-buttons {
|
|||
.white_table_graph_header {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.container-massive-events-response {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.container-massive-events-response-cell {
|
||||
margin-bottom: 10px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
align-content: flex-start;
|
||||
}
|
||||
|
||||
.container-massive-events-response-command > span {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.container-massive-events-response-output {
|
||||
/*border: 2px dashed #ddd;*/
|
||||
/*padding: 10px;*/
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.container-massive-events-response-execute {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#massive-parameters-response {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#massive-parameters-response > div {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
#massive-parameters-response > div h5 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#massive-parameters-response > div div {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
|
|
@ -398,7 +398,6 @@ li > input[type="email"],
|
|||
border: none;
|
||||
border-radius: 0;
|
||||
border-bottom: 1px solid #ccc;
|
||||
font-weight: lighter;
|
||||
padding: 0px 0px 2px 0px;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 4px;
|
||||
|
|
|
@ -9119,3 +9119,37 @@ div#err_msg_centralised {
|
|||
margin-right: -110px;
|
||||
margin-top: 13px;
|
||||
}
|
||||
|
||||
.tag-editor {
|
||||
padding: 0.5em !important;
|
||||
}
|
||||
|
||||
.tag-editor div {
|
||||
float: right !important;
|
||||
}
|
||||
|
||||
.tag-editor .tag-editor-tag {
|
||||
padding: 5px !important;
|
||||
color: #fff !important;
|
||||
background: #82b92e !important;
|
||||
border-radius: 0 2px 2px 0 !important;
|
||||
}
|
||||
|
||||
.tag-editor .tag-editor-delete {
|
||||
padding: 5px !important;
|
||||
line-height: 16px !important;
|
||||
background: #82b92e !important;
|
||||
border-radius: 2px 0 0 2px !important;
|
||||
}
|
||||
|
||||
.tag-editor .tag-editor-delete i {
|
||||
line-height: 16pt !important;
|
||||
}
|
||||
|
||||
.tag-editor .tag-editor-delete i:before {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.tag-editor .tag-editor-delete:hover i:before {
|
||||
color: #ccc !important;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.765';
|
||||
$build = '221013';
|
||||
$build = '221027';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -357,10 +357,10 @@ class Events
|
|||
);
|
||||
|
||||
if (isset($group_rep) === false) {
|
||||
$group_rep = 0;
|
||||
$group_rep = EVENT_GROUP_REP_ALL;
|
||||
}
|
||||
|
||||
if ((int) $group_rep !== 0) {
|
||||
if ((int) $group_rep !== EVENT_GROUP_REP_ALL) {
|
||||
if ($event['event_rep'] <= 1) {
|
||||
$event['event_repeated'] = '<i>'.__('No').'</i>';
|
||||
} else {
|
||||
|
@ -1068,7 +1068,7 @@ class Events
|
|||
$filters['id_agent'] = $this->id_agent;
|
||||
}
|
||||
|
||||
$filters['group_rep'] = 1;
|
||||
$filters['group_rep'] = EVENT_GROUP_REP_EVENTS;
|
||||
|
||||
if (isset($this->limit) === true
|
||||
&& $this->limit !== -1
|
||||
|
|
|
@ -564,7 +564,10 @@ for ($i = 0; $i < $custom_fields_count; $i++) {
|
|||
$columns = array_merge($first_column, $second_column);
|
||||
} else {
|
||||
$columns = $first_column;
|
||||
$filas = count($table_data->data);
|
||||
if ($table_data->data !== null) {
|
||||
$filas = count($table_data->data);
|
||||
}
|
||||
|
||||
$table_data->colspan[$filas][1] = 3;
|
||||
}
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ if (is_ajax()) {
|
|||
$id_agents,
|
||||
$selection,
|
||||
$select_mode,
|
||||
true
|
||||
(bool) !$select_mode
|
||||
);
|
||||
|
||||
// Clean double safe input.
|
||||
|
@ -480,6 +480,7 @@ if (is_ajax()) {
|
|||
$serialized = get_parameter('serialized', '');
|
||||
$id_server = (int) get_parameter('id_server', 0);
|
||||
$status_modulo = (int) get_parameter('status_module', -1);
|
||||
$id_group_selected = (int) get_parameter('id_group', 0);
|
||||
$metaconsole_server_name = null;
|
||||
if (!empty($id_server)) {
|
||||
$metaconsole_server_name = db_get_value(
|
||||
|
@ -707,14 +708,18 @@ if (is_ajax()) {
|
|||
// Get all user's groups.
|
||||
$id_group = array_keys(users_get_groups($config['id_user']));
|
||||
|
||||
if (is_array($id_group)) {
|
||||
if (is_array($id_group) && empty($id_group_selected) === true) {
|
||||
$id_group = implode(',', $id_group);
|
||||
} else {
|
||||
if (in_array($id_group_selected, $id_group) === true) {
|
||||
$id_group = $id_group_selected;
|
||||
}
|
||||
}
|
||||
|
||||
$where_tags .= ' AND tagente.id_grupo IN ('.$id_group.')';
|
||||
|
||||
if ($selection_mode == 'common') {
|
||||
$sql_agent_total = 'SELECT count(*) FROM tagente WHERE disabled=0';
|
||||
$sql_agent_total = 'SELECT count(*) FROM tagente WHERE disabled=0'.$where_tags;
|
||||
$agent_total = db_get_value_sql($sql_agent_total);
|
||||
$sql = sprintf(
|
||||
"SELECT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1
|
||||
|
|
|
@ -84,7 +84,7 @@ ui_require_javascript_file('pandora_events');
|
|||
$default_filter = [
|
||||
'status' => EVENT_NO_VALIDATED,
|
||||
'event_view_hr' => $config['event_view_hr'],
|
||||
'group_rep' => 1,
|
||||
'group_rep' => EVENT_GROUP_REP_EVENTS,
|
||||
'tag_with' => [],
|
||||
'tag_without' => [],
|
||||
'history' => false,
|
||||
|
@ -173,6 +173,10 @@ $search_secondary_groups = get_parameter(
|
|||
'filter[search_secondary_groups]',
|
||||
0
|
||||
);
|
||||
$search_recursive_groups = get_parameter(
|
||||
'filter[search_recursive_groups]',
|
||||
0
|
||||
);
|
||||
$id_group_filter = get_parameter(
|
||||
'filter[id_group_filter]',
|
||||
($filter['id_group'] ?? '')
|
||||
|
@ -356,6 +360,10 @@ if (is_ajax() === true) {
|
|||
$order['field'] = 'agent_name';
|
||||
break;
|
||||
|
||||
case 'if(te.ack_utimestamp > 0, from_unixtime(te.ack_utimestamp),"") as ack_utimestamp':
|
||||
$order['field'] = 'ack_utimestamp';
|
||||
break;
|
||||
|
||||
default:
|
||||
$order['field'] = $field;
|
||||
break;
|
||||
|
@ -1090,6 +1098,7 @@ if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false
|
|||
|
||||
$filter_only_alert = $filter['filter_only_alert'];
|
||||
$search_secondary_groups = ($filter['search_secondary_groups'] ?? 0);
|
||||
$search_recursive_groups = ($filter['search_recursive_groups'] ?? 0);
|
||||
$id_group_filter = $filter['id_group_filter'];
|
||||
$date_from = $filter['date_from'];
|
||||
$time_from = $filter['time_from'];
|
||||
|
@ -1440,7 +1449,7 @@ if ($pure) {
|
|||
).'</a>';
|
||||
|
||||
// If the user has administrator permission display manage tab.
|
||||
if ($event_w || $event_m) {
|
||||
if ($event_w === true || $event_m === true) {
|
||||
// Manage events.
|
||||
$manage_events['active'] = false;
|
||||
$manage_events['text'] = '<a href="index.php?sec=eventos&sec2=godmode/events/events&section=filter&pure='.$config['pure'].'">'.html_print_image(
|
||||
|
@ -1475,7 +1484,9 @@ if ($pure) {
|
|||
}
|
||||
|
||||
// If the history event is not enabled, dont show the history tab.
|
||||
if (isset($config['metaconsole_events_history']) === false || $config['metaconsole_events_history'] != 1) {
|
||||
if (isset($config['history_db_enabled']) === false
|
||||
|| (bool) $config['history_db_enabled'] === false
|
||||
) {
|
||||
unset($onheader['history']);
|
||||
}
|
||||
|
||||
|
@ -1658,9 +1669,10 @@ $inputs[] = $in;
|
|||
// Duplicates group { events | agents }.
|
||||
$data = html_print_select(
|
||||
[
|
||||
0 => __('All events'),
|
||||
1 => __('Group events'),
|
||||
2 => __('Group agents'),
|
||||
EVENT_GROUP_REP_ALL => __('All events'),
|
||||
EVENT_GROUP_REP_EVENTS => __('Group events'),
|
||||
EVENT_GROUP_REP_AGENTS => __('Group agents'),
|
||||
EVENT_GROUP_REP_EXTRAIDS => __('Group extra id'),
|
||||
],
|
||||
'group_rep',
|
||||
$group_rep,
|
||||
|
@ -1708,6 +1720,28 @@ $in = '<div class="filter_input"><label>'.__('Severity').'</label>';
|
|||
$in .= $data.'</div>';
|
||||
$inputs[] = $in;
|
||||
|
||||
// Search recursive groups.
|
||||
$data = html_print_checkbox_switch(
|
||||
'search_recursive_groups',
|
||||
$search_recursive_groups,
|
||||
$search_recursive_groups,
|
||||
true,
|
||||
false,
|
||||
'search_in_secondary_groups(this);',
|
||||
true
|
||||
);
|
||||
|
||||
$in = '<div class="filter_input filter_input_switch"><label>';
|
||||
$in .= __('Group recursion');
|
||||
$in .= ui_print_help_tip(
|
||||
__('WARNING: This could cause a performace impact.'),
|
||||
true
|
||||
);
|
||||
$in .= '</label>';
|
||||
$in .= $data;
|
||||
$in .= '</div>';
|
||||
$inputs[] = $in;
|
||||
|
||||
// Search secondary groups.
|
||||
$data = html_print_checkbox_switch(
|
||||
'search_secondary_groups',
|
||||
|
@ -1719,8 +1753,15 @@ $data = html_print_checkbox_switch(
|
|||
true
|
||||
);
|
||||
|
||||
$in = '<div class="filter_input filter_input_switch"><label>'.__('Search in secondary groups').'</label>';
|
||||
$in .= $data.'</div>';
|
||||
$in = '<div class="filter_input filter_input_switch"><label>';
|
||||
$in .= __('Search in secondary groups');
|
||||
$in .= ui_print_help_tip(
|
||||
__('WARNING: This could cause a performace impact.'),
|
||||
true
|
||||
);
|
||||
$in .= '</label>';
|
||||
$in .= $data;
|
||||
$in .= '</div>';
|
||||
$inputs[] = $in;
|
||||
|
||||
// Trick view in table.
|
||||
|
@ -1735,7 +1776,7 @@ $buttons[] = [
|
|||
'onclick' => '',
|
||||
];
|
||||
|
||||
if ($event_w || $event_m) {
|
||||
if ($event_w === true || $event_m === true) {
|
||||
$buttons[] = [
|
||||
'id' => 'save-filter',
|
||||
'class' => 'float-left margin-right-2 sub wand',
|
||||
|
@ -2264,12 +2305,14 @@ try {
|
|||
$active_filters_div .= '<div>';
|
||||
$active_filters_div .= '<div class="label box-shadow">'.__('Duplicated').'</div>';
|
||||
$active_filters_div .= '<div id="summary_duplicates" class="content">';
|
||||
if ($group_rep == 0) {
|
||||
if ($group_rep == EVENT_GROUP_REP_ALL) {
|
||||
$active_filters_div .= __('All events.');
|
||||
} else if ($group_rep == 1) {
|
||||
} else if ($group_rep == EVENT_GROUP_REP_EVENTS) {
|
||||
$active_filters_div .= __('Group events');
|
||||
} else if ($group_rep == 2) {
|
||||
} else if ($group_rep == EVENT_GROUP_REP_AGENTS) {
|
||||
$active_filters_div .= __('Group agents.');
|
||||
} else if ($group_rep == EVENT_GROUP_REP_EXTRAIDS) {
|
||||
$active_filters_div .= __('Group extra id.');
|
||||
}
|
||||
|
||||
$active_filters_div .= '</div>';
|
||||
|
@ -2359,6 +2402,16 @@ if (is_user_admin($config['id_user'])) {
|
|||
);
|
||||
}
|
||||
|
||||
$array_events_actions = [];
|
||||
if ($event_w === true && $readonly === false) {
|
||||
$array_events_actions['in_progress_selected'] = __('In progress selected');
|
||||
$array_events_actions['validate_selected'] = __('Validate selected');
|
||||
}
|
||||
|
||||
if ($event_m === true && $readonly === false) {
|
||||
$array_events_actions['delete_selected'] = __('Delete selected');
|
||||
}
|
||||
|
||||
foreach ($event_responses as $val) {
|
||||
$array_events_actions[$val['id']] = $val['name'];
|
||||
}
|
||||
|
|
|
@ -91,6 +91,10 @@ if ($is_ajax === false && $pure === false) {
|
|||
|
||||
$header_name = __('Heatmap view');
|
||||
switch ($type) {
|
||||
case 3:
|
||||
$header_name .= ' - '.__('Agents');
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (current($filter) == 0) {
|
||||
$header_name .= ' - '.__('Module group').': '.__('Not assigned');
|
||||
|
|
|
@ -410,7 +410,7 @@ if ($access_console_node === true) {
|
|||
$user_event_filter = [
|
||||
'status' => EVENT_NO_VALIDATED,
|
||||
'event_view_hr' => $config['event_view_hr'],
|
||||
'group_rep' => 1,
|
||||
'group_rep' => EVENT_GROUP_REP_EVENTS,
|
||||
'tag_with' => [],
|
||||
'tag_without' => [],
|
||||
'history' => false,
|
||||
|
|
|
@ -211,7 +211,7 @@ if (isset($_GET['modified']) && !$view_mode) {
|
|||
$user_info = $upd_info;
|
||||
} else {
|
||||
if (!$error_msg) {
|
||||
$error_msg = __('Error updating passwords: ');
|
||||
$error_msg = __('Error updating passwords: ').($config['auth_error'] ?? '');
|
||||
}
|
||||
|
||||
$user_auth_error = $config['auth_error'];
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.765
|
||||
%define release 221013
|
||||
%define release 221027
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.765
|
||||
%define release 221013
|
||||
%define release 221027
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.765
|
||||
%define release 221013
|
||||
%define release 221027
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -1245,6 +1245,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
|
|||
`tag_without` TEXT,
|
||||
`filter_only_alert` INT NOT NULL DEFAULT -1,
|
||||
`search_secondary_groups` INT NOT NULL DEFAULT 0,
|
||||
`search_recursive_groups` INT NOT NULL DEFAULT 0,
|
||||
`date_from` date DEFAULT NULL,
|
||||
`date_to` date DEFAULT NULL,
|
||||
`source` TINYTEXT,
|
||||
|
@ -1308,6 +1309,7 @@ CREATE TABLE IF NOT EXISTS `tusuario` (
|
|||
`integria_user_level_pass` VARCHAR(45),
|
||||
`allowed_ip_active` TINYINT UNSIGNED DEFAULT 0,
|
||||
`allowed_ip_list` TEXT,
|
||||
`auth_token_secret` VARCHAR(45) DEFAULT NULL,
|
||||
CONSTRAINT `fk_filter_id` FOREIGN KEY (`id_filter`) REFERENCES tevent_filter (`id_filter`) ON DELETE SET NULL,
|
||||
UNIQUE KEY `id_user` (`id_user`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.765-221013
|
||||
Version: 7.0NG.765-221027
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.765-221013"
|
||||
pandora_version="7.0NG.765-221027"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# Tentacle have IANA assigned port tpc/41121 as official port.
|
||||
##########################################################################
|
||||
# Copyright (c) 2007-2008 Ramon Novoa <rnovoa@artica.es>
|
||||
# Copyright (c) 2005-2010 Artica Soluciones Tecnologicas S.L
|
||||
# Copyright (c) 2005-2022 Artica Soluciones Tecnologicas S.L
|
||||
#
|
||||
# tentacle_server.pl Tentacle Server. See https://pandorafms.com/docs/ for
|
||||
# protocol description.
|
||||
|
@ -1740,6 +1740,19 @@ sub callback_stop {
|
|||
Win32::Daemon::StopService();
|
||||
}
|
||||
|
||||
|
||||
################################################################################
|
||||
## SUB check_ssleay_version
|
||||
## Print a message if the installed version of Net::SSLeay may leak memory.
|
||||
################################################################################
|
||||
sub check_ssleay_version {
|
||||
eval {
|
||||
require Net::SSLeay;
|
||||
return unless defined($Net::SSLeay::VERSION) && $Net::SSLeay::VERSION =~ m/^(\d+)\.(\d+)/ && $1 <= 1 && $2 < 88;
|
||||
print_log ("Net::SSLeay version $Net::SSLeay::VERSION detected. Versions prior to 1.88 may leak memory. To upgrade it see: https://metacpan.org/pod/Net::SSLeay");
|
||||
};
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Main
|
||||
################################################################################
|
||||
|
@ -1753,12 +1766,20 @@ if ($> == 0 && $^O ne 'MSWin32') {
|
|||
# Parse command line options
|
||||
parse_options ();
|
||||
|
||||
# Try to open the log file.
|
||||
if (defined($log_file)) {
|
||||
open(my $fh, ">>", $log_file) || die("Error opening the log file '$log_file': $!.\n");
|
||||
close($fh);
|
||||
}
|
||||
|
||||
# Check command line arguments
|
||||
if ($#ARGV != -1) {
|
||||
print_help ();
|
||||
exit 1;
|
||||
}
|
||||
|
||||
check_ssleay_version() if $t_ssl == 1;
|
||||
|
||||
# Show IPv6 status
|
||||
if ($SOCKET_MODULE eq 'IO::Socket::INET') {
|
||||
print_log ("IO::Socket::INET6 is not found. IPv6 is disabled.");
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# Tentacle have IANA assigned port tpc/41121 as official port.
|
||||
##########################################################################
|
||||
# Copyright (c) 2007-2008 Ramon Novoa <rnovoa@artica.es>
|
||||
# Copyright (c) 2005-2010 Artica Soluciones Tecnologicas S.L
|
||||
# Copyright (c) 2005-2022 Artica Soluciones Tecnologicas S.L
|
||||
#
|
||||
# tentacle_server.pl Tentacle Server. See https://pandorafms.com/docs/ for
|
||||
# protocol description.
|
||||
|
@ -1766,6 +1766,12 @@ if ($> == 0 && $^O ne 'MSWin32') {
|
|||
# Parse command line options
|
||||
parse_options ();
|
||||
|
||||
# Try to open the log file.
|
||||
if (defined($log_file)) {
|
||||
open(my $fh, ">>", $log_file) || die("Error opening the log file '$log_file': $!.\n");
|
||||
close($fh);
|
||||
}
|
||||
|
||||
# Check command line arguments
|
||||
if ($#ARGV != -1) {
|
||||
print_help ();
|
||||
|
|
|
@ -46,7 +46,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.765";
|
||||
my $pandora_build = "221013";
|
||||
my $pandora_build = "221027";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.765";
|
||||
my $pandora_build = "221013";
|
||||
my $pandora_build = "221027";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.765
|
||||
%define release 221013
|
||||
%define release 221027
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.765
|
||||
%define release 221013
|
||||
%define release 221027
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|