Merge remote-tracking branch 'origin/develop' into ent-7960-filtros-de-alertas-sonoras-sound-events-2

Conflicts:
	pandora_console/include/javascript/pandora.js
This commit is contained in:
Daniel Barbero Martin 2022-06-13 17:10:19 +02:00
commit 5968febd04
86 changed files with 100374 additions and 78928 deletions

View File

@ -4,7 +4,7 @@
# define variables # define variables
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='2021100601' S_VERSION='2022052301'
LOGFILE="/tmp/pandora-agent-deploy-$(date +%F).log" LOGFILE="/tmp/pandora-agent-deploy-$(date +%F).log"
# Ansi color code variables # Ansi color code variables
@ -49,7 +49,6 @@ check_cmd_status () {
} }
check_repo_connection () { check_repo_connection () {
execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection"
execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo" execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo"
} }
@ -79,10 +78,15 @@ echo "Starting PandoraFMS Agent deployment ver. $S_VERSION"
execute_cmd "[ $PANDORA_SERVER_IP ]" 'Check Server IP Address' 'Please define env variable PANDORA_SERVER_IP' execute_cmd "[ $PANDORA_SERVER_IP ]" 'Check Server IP Address' 'Please define env variable PANDORA_SERVER_IP'
#Detect OS
os_name=$(grep ^PRETTY_NAME= /etc/os-release | cut -d '=' -f2 | tr -d '"')
execute_cmd "echo $os_name" "OS detected: ${os_name}"
# Check OS. # Check OS.
OS=$([[ $(grep '^ID_LIKE=' /etc/os-release) ]] && grep ^ID_LIKE= /etc/os-release | cut -d '=' -f2 | tr -d '"' || grep ^ID= /etc/os-release | cut -d '=' -f2 | tr -d '"') OS=$([[ $(grep '^ID_LIKE=' /etc/os-release) ]] && grep ^ID_LIKE= /etc/os-release | cut -d '=' -f2 | tr -d '"' || grep ^ID= /etc/os-release | cut -d '=' -f2 | tr -d '"')
[[ $OS =~ 'rhel' ]] && OS_RELEASE=$OS [[ $OS =~ 'rhel' ]] && OS_RELEASE=$OS
[[ $OS =~ 'fedora' ]] && OS_RELEASE=$OS
[[ $OS =~ 'debian' ]] && OS_RELEASE=$OS [[ $OS =~ 'debian' ]] && OS_RELEASE=$OS
#[[ $OS == 'rhel fedora' ]] && OS_RELEASE=$OS #[[ $OS == 'rhel fedora' ]] && OS_RELEASE=$OS
#[[ $OS == 'centos rhel fedora' ]] && OS_RELEASE=$OS #[[ $OS == 'centos rhel fedora' ]] && OS_RELEASE=$OS
@ -113,17 +117,40 @@ execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_d
# Downloading and installing packages # Downloading and installing packages
if [[ $OS_RELEASE =~ 'rhel' ]]; then if [[ $OS_RELEASE =~ 'rhel' ]] || [[ $OS_RELEASE =~ 'fedora' ]]; then
yum install -y perl wget curl perl-Sys-Syslog unzip &>> $LOGFILE ## Extra steps on redhat
echo -e "${cyan}Instaling agent dependencies...${reset}" ${green}OK${reset} if [ "$(grep -Ei 'Red Hat Enterprise' /etc/redhat-release)" ]; then
## In case REDHAT
# Check susbscription manager status:
echo -en "${cyan}Checking Red Hat Enterprise subscription... ${reset}"
subscription-manager list &>> "$LOGFILE"
subscription-manager status &>> "$LOGFILE"
check_cmd_status 'Error checking subscription status, make sure your server is activated and suscribed to Red Hat Enterprise repositories'
fi
# Check rh version
if [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '8' ] ; then
package_manager_cmd=dnf
elif [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '7' ] ; then
package_manager_cmd=yum
fi
# Install dependencies
$package_manager_cmd install -y perl wget curl perl-Sys-Syslog unzip &>> $LOGFILE
echo -e "${cyan}Installing agent dependencies...${reset}" ${green}OK${reset}
# Insatall pandora agent
$package_manager_cmd install -y http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm &>> $LOGFILE
echo -en "${cyan}Installing Pandora FMS agent...${reset}"
check_cmd_status 'Error installing Pandora FMS agent'
yum install -y http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm &>> $LOGFILE
echo -e "${cyan}Instaling Pandora FMS agent...${reset}" ${green}OK${reset}
fi fi
if [[ $OS_RELEASE == 'debian' ]]; then if [[ $OS_RELEASE == 'debian' ]]; then
execute_cmd "apt update" 'Updating repos' execute_cmd "apt update" 'Updating repos'
execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Instaling agent dependencies' execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Installing agent dependencies'
execute_cmd 'wget http://firefly.artica.es/pandorafms/latest/Debian_Ubuntu/pandorafms.agent_unix_7.0NG.deb' 'Downloading Pandora FMS agent dependencies' execute_cmd 'wget http://firefly.artica.es/pandorafms/latest/Debian_Ubuntu/pandorafms.agent_unix_7.0NG.deb' 'Downloading Pandora FMS agent dependencies'
execute_cmd 'apt install -y ./pandorafms.agent_unix_7.0NG.deb' 'Installing Pandora FMS agent' execute_cmd 'apt install -y ./pandorafms.agent_unix_7.0NG.deb' 'Installing Pandora FMS agent'
fi fi

View File

@ -11,7 +11,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='2022020801' S_VERSION='2022050901'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables # define default variables
@ -82,7 +82,6 @@ check_pre_pandora () {
} }
check_repo_connection () { check_repo_connection () {
execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection"
execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo" execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo"
execute_cmd "ping -c 2 support.pandorafms.com" "Checking Enterprise repo" execute_cmd "ping -c 2 support.pandorafms.com" "Checking Enterprise repo"
} }

View File

@ -14,7 +14,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='2022050501' S_VERSION='2022052501'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables # define default variables
@ -86,7 +86,6 @@ check_pre_pandora () {
} }
check_repo_connection () { check_repo_connection () {
execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection"
execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo" execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo"
execute_cmd "ping -c 2 support.pandorafms.com" "Checking Enterprise repo" execute_cmd "ping -c 2 support.pandorafms.com" "Checking Enterprise repo"
} }
@ -420,7 +419,9 @@ echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support." check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support."
echo "CREATE USER \"$DBUSER\"@'%' IDENTIFIED BY \"$DBPASS\";" | mysql -uroot -P$DBPORT -h$DBHOST echo "CREATE USER \"$DBUSER\"@'%' IDENTIFIED BY \"$DBPASS\";" | mysql -uroot -P$DBPORT -h$DBHOST
echo "ALTER USER \"$DBUSER\"@'%' IDENTIFIED WITH mysql_native_password BY \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%'" | mysql -uroot -P$DBPORT -h$DBHOST echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%'" | mysql -uroot -P$DBPORT -h$DBHOST
export MYSQL_PWD=$DBPASS export MYSQL_PWD=$DBPASS
#Generating my.cnf #Generating my.cnf

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.762-220531 Version: 7.0NG.762-220613
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.762 %define version 7.0NG.762
%define release 220531 %define release 220613
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.762 %define version 7.0NG.762
%define release 220531 %define release 220613
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.762" PI_VERSION="7.0NG.762"
PI_BUILD="220531" PI_BUILD="220613"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{220531} {220613}
ViewReadme ViewReadme
{Yes} {Yes}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.762-220531 Version: 7.0NG.762-220613
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -0,0 +1,7 @@
START TRANSACTION;
ALTER TABLE `tservice` ADD COLUMN `enable_sunburst` tinyint(1) NOT NULL default 0;
ALTER TABLE `tdashboard` MODIFY `name` TEXT NOT NULL DEFAULT '';
COMMIT;

View File

@ -37,7 +37,7 @@ ui_require_css_file('first_task');
ui_print_info_message(['no_close' => true, 'message' => __('There are no HA clusters defined yet.') ]); ui_print_info_message(['no_close' => true, 'message' => __('There are no HA clusters defined yet.') ]);
?> ?>
<div class="new_task_cluster"> <div class="new_task">
<div class="image_task_cluster"> <div class="image_task_cluster">
<?php echo html_print_image('images/first_task/slave-mode.png', true, ['title' => __('Clusters')]); ?> <?php echo html_print_image('images/first_task/slave-mode.png', true, ['title' => __('Clusters')]); ?>
</div> </div>

View File

@ -523,7 +523,6 @@ if (enterprise_installed()) {
$table_adv_cascade .= $cps_html; $table_adv_cascade .= $cps_html;
} }
$table_adv_parent = '<div class="label_select"><label class="input_label">'.__('Parent').'</label>'; $table_adv_parent = '<div class="label_select"><label class="input_label">'.__('Parent').'</label>';
$params = []; $params = [];
$params['return'] = true; $params['return'] = true;
@ -536,6 +535,11 @@ $params['value'] = db_get_value('alias', 'tagente', 'id_agente', $id_parent);
$params['selectbox_id'] = 'cascade_protection_module'; $params['selectbox_id'] = 'cascade_protection_module';
$params['javascript_is_function_select'] = true; $params['javascript_is_function_select'] = true;
$params['cascade_protection'] = true; $params['cascade_protection'] = true;
if ($id_agente !== 0) {
// Deletes the agent's offspring.
$params['delete_offspring_agents'] = $id_agente;
}
$table_adv_parent .= '<div class="label_simple_items">'; $table_adv_parent .= '<div class="label_simple_items">';
$table_adv_parent .= ui_print_agent_autocomplete_input($params); $table_adv_parent .= ui_print_agent_autocomplete_input($params);
if (enterprise_installed()) { if (enterprise_installed()) {

View File

@ -315,7 +315,20 @@ html_print_select_groups(
'', '',
false false
); );
echo '</div>'; echo '</div></td>';
// Recursion checkbox.
echo '<td>';
echo __('Recursion').'&nbsp;';
html_print_checkbox(
'recursion',
1,
$recursion,
false,
false,
'this.form.submit()'
);
echo '</td>';
echo '<td>'; echo '<td>';
echo __('Show Agents').'&nbsp;'; echo __('Show Agents').'&nbsp;';
$fields = [ $fields = [
@ -346,19 +359,6 @@ foreach ($pre_fields as $key => $value) {
html_print_select($fields, 'os', $os, 'this.form.submit()', 'All', 0); html_print_select($fields, 'os', $os, 'this.form.submit()', 'All', 0);
echo '</td>';
echo '<td>';
echo __('Recursion').'&nbsp;';
html_print_checkbox(
'recursion',
1,
$recursion,
false,
false,
'this.form.submit()'
);
echo '</td><td>'; echo '</td><td>';
echo __('Search').'&nbsp;'; echo __('Search').'&nbsp;';
html_print_input_text('search', $search, '', 12); html_print_input_text('search', $search, '', 12);

View File

@ -539,6 +539,12 @@ if ($id_downtime > 0) {
// only action to postpone on once type is enabled and the other are disabled. // only action to postpone on once type is enabled and the other are disabled.
$disabled_in_execution = (int) $running; $disabled_in_execution = (int) $running;
$return_all_group = false;
if (users_can_manage_group_all('AW') === true || $disabled) {
$return_all_group = true;
}
$table = new StdClass(); $table = new StdClass();
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';
@ -557,7 +563,7 @@ $table->data[1][0] = __('Group');
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups( $table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
false, false,
$access, $access,
true, $return_all_group,
'id_group', 'id_group',
$id_group, $id_group,
'', '',
@ -793,7 +799,7 @@ $table->width = '100%';
$table->data = []; $table->data = [];
$table->data[0][0] = __('Group filter'); $table->data[0][0] = __('Group filter');
$table->data[0][1] = html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', true, false, true, '', false, 'min-width:180px;margin-right:15px;'); $table->data[0][1] = html_print_select_groups(false, $access, $return_all_group, 'filter_group', $filter_group, '', '', '', true, false, true, '', false, 'min-width:180px;margin-right:15px;');
$table->data[0][2] = __('Recursion').'&nbsp&nbsp'.html_print_checkbox('recursion', 1, $recursion, true, false, ''); $table->data[0][2] = __('Recursion').'&nbsp&nbsp'.html_print_checkbox('recursion', 1, $recursion, true, false, '');
$table->data[1][0] = __('Available agents'); $table->data[1][0] = __('Available agents');

View File

@ -261,7 +261,7 @@ $table->data[2][1] = html_print_select_from_sql(
'id_command', 'id_command',
$id_command, $id_command,
'', '',
__('None'), '',
0, 0,
true, true,
false, false,

View File

@ -140,7 +140,7 @@ function process_manage_delete($id_agents)
} }
$id_group = (int) get_parameter('id_group'); $id_group = (is_metaconsole() === true) ? get_parameter('id_group', '') : (int) get_parameter('id_group');
$id_agents = get_parameter('id_agents'); $id_agents = get_parameter('id_agents');
$recursion = get_parameter('recursion'); $recursion = get_parameter('recursion');
$delete = (bool) get_parameter_post('delete'); $delete = (bool) get_parameter_post('delete');
@ -282,15 +282,15 @@ $table->data[3][0] .= '<span id="agent_loading" class="invisible">';
$table->data[3][0] .= html_print_image('images/spinner.png', true); $table->data[3][0] .= html_print_image('images/spinner.png', true);
$table->data[3][0] .= '</span>'; $table->data[3][0] .= '</span>';
$agents = [];
if (is_metaconsole() === false) {
$agents = agents_get_group_agents( $agents = agents_get_group_agents(
array_keys(users_get_groups($config['id_user'], 'AW', false)), array_keys(users_get_groups($config['id_user'], 'AW', false)),
['disabled' => 2], ['disabled' => 2],
'none', 'none'
false,
false,
is_metaconsole(),
'|'
); );
}
$table->data[3][1] = html_print_select( $table->data[3][1] = html_print_select(
$agents, $agents,

View File

@ -258,9 +258,9 @@ $table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold;'; $table->style[2] = 'font-weight: bold;';
$table->size = []; $table->size = [];
$table->size[0] = '15%'; $table->size[0] = '15%';
$table->size[1] = '40%'; $table->size[1] = '35%';
$table->size[2] = '15%'; $table->size[2] = '15%';
$table->size[3] = '40%'; $table->size[3] = '35%';
$table->data = []; $table->data = [];
@ -276,7 +276,12 @@ $table->data[0][1] = html_print_select(
false, false,
__('Select'), __('Select'),
0, 0,
true true,
false,
true,
'',
false,
'width: 100%;'
); );
$table->data[0][2] = ''; $table->data[0][2] = '';
$table->data[0][3] = ''; $table->data[0][3] = '';
@ -295,7 +300,8 @@ $table->data[1][1] = html_print_select_groups(
false, false,
true, true,
'', '',
$id_alert_template == 0 $id_alert_template == 0,
'width: 100%;'
); );
$table->data[0][2] = __('Show alerts on disabled modules'); $table->data[0][2] = __('Show alerts on disabled modules');

View File

@ -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 * Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -89,9 +89,9 @@ if ($update) {
$agents_ = []; $agents_ = [];
} }
// If the option to select all of one group or module type is checked // If the option to select all of one group or module type is checked.
if ($force) { if ($force) {
if ($force == 'type') { if ($force === 'type') {
$type_condition = ''; $type_condition = '';
if ($module_type != 0) { if ($module_type != 0) {
$type_condition = "AND tam.id_tipo_modulo = $module_type"; $type_condition = "AND tam.id_tipo_modulo = $module_type";
@ -109,7 +109,7 @@ if ($update) {
$agents_ = []; $agents_ = [];
} }
// Create an array of agent ids // Create an array of agent ids.
$agents_ = extract_column($agents_, 'id_agente'); $agents_ = extract_column($agents_, 'id_agente');
foreach ($agents_ as $id_agent) { foreach ($agents_ as $id_agent) {
@ -136,7 +136,7 @@ if ($update) {
if ($success == 0) { if ($success == 0) {
$error_msg = __('Error updating the modules from a module type'); $error_msg = __('Error updating the modules from a module type');
} }
} else if ($force == 'group') { } else if ($force === 'group') {
$agents_ = array_keys(agents_get_group_agents($group_select, false, 'none')); $agents_ = array_keys(agents_get_group_agents($group_select, false, 'none'));
foreach ($agents_ as $id_agent) { foreach ($agents_ as $id_agent) {
@ -2226,28 +2226,30 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
$values['quiet'] = get_parameter('quiet_select'); $values['quiet'] = get_parameter('quiet_select');
} }
$filter_modules = false; // Whether to update module tag info.
if (!is_numeric($module_name) or ($module_name != 0)) {
$filter_modules['nombre'] = $module_name;
}
// Whether to update module tag info
$update_tags = get_parameter('id_tag', false); $update_tags = get_parameter('id_tag', false);
if (array_search(0, $agents_select) !== false) { if (array_search(0, $agents_select) !== false) {
// Apply at All agents. if (is_numeric($module_name) === false || ($module_name !== 0)) {
$modules = db_get_all_rows_filter( $filterModules = sprintf('AND tam.nombre = \'%s\'', $module_name);
'tagente_modulo', } else {
$filter_modules, $filterModules = '';
[ }
'id_agente_modulo',
'id_tipo_modulo', // Apply at All agents (within valid groups).
] $modules = db_get_all_rows_sql(
sprintf(
'SELECT tam.id_agente_modulo, tam.id_tipo_modulo
FROM tagente_modulo tam INNER JOIN tagente ta
ON ta.id_agente = tam.id_agente
WHERE ta.id_grupo IN (%s) %s;',
implode(',', array_keys(users_get_groups())),
$filterModules
)
); );
} else { } else {
if ($module_name == '0') { if ($module_name === '0') {
// Any module // Any module.
$modules = db_get_all_rows_filter( $modules = db_get_all_rows_filter(
'tagente_modulo', 'tagente_modulo',
['id_agente' => $agents_select], ['id_agente' => $agents_select],
@ -2275,12 +2277,12 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
return false; return false;
} }
if (($module_status == 'unknown') && ($module_name == '0')) { if (($module_status === 'unknown') && ($module_name == '0')) {
$modules_to_delete = []; $modules_to_delete = [];
foreach ($modules as $mod_id) { foreach ($modules as $mod_id) {
$mod_status = (int) db_get_value_filter('estado', 'tagente_estado', ['id_agente_modulo' => $mod_id]); $mod_status = (int) db_get_value_filter('estado', 'tagente_estado', ['id_agente_modulo' => $mod_id]);
// Unknown, not init and no data modules // Unknown, not init and no data modules.
if ($mod_status == 3 || $mod_status == 4 || $mod_status == 5) { if ($mod_status == 3 || $mod_status == 4 || $mod_status == 5) {
$modules_to_delete[$mod_id] = $mod_id; $modules_to_delete[$mod_id] = $mod_id;
} }

View File

@ -606,6 +606,7 @@ switch ($action) {
$event_graph_by_criticity = $style['event_graph_by_criticity']; $event_graph_by_criticity = $style['event_graph_by_criticity'];
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated']; $event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
$include_extended_events = $item['show_extended_events']; $include_extended_events = $item['show_extended_events'];
$custom_data_events = $style['custom_data_events'];
$filter_search = $style['event_filter_search']; $filter_search = $style['event_filter_search'];
$filter_exclude = $style['event_filter_exclude']; $filter_exclude = $style['event_filter_exclude'];
@ -631,6 +632,7 @@ switch ($action) {
$include_extended_events = $item['show_extended_events']; $include_extended_events = $item['show_extended_events'];
$custom_data_events = $style['custom_data_events'];
break; break;
case 'event_report_module': case 'event_report_module':
@ -665,6 +667,7 @@ switch ($action) {
$include_extended_events = $item['show_extended_events']; $include_extended_events = $item['show_extended_events'];
$custom_data_events = $style['custom_data_events'];
break; break;
case 'general': case 'general':
@ -2911,6 +2914,23 @@ $class = 'databox filters';
</td> </td>
</tr> </tr>
<tr id="row_custom_data_events" class="datos">
<td class="bolder">
<?php
echo __('Show custom data');
?>
</td>
<td>
<?php
html_print_checkbox_switch(
'custom_data_events',
true,
$custom_data_events
);
?>
</td>
</tr>
<tr id="row_event_graphs" class="datos"> <tr id="row_event_graphs" class="datos">
<td class="bolder"><?php echo __('Event graphs'); ?></td> <td class="bolder"><?php echo __('Event graphs'); ?></td>
<td> <td>
@ -5974,6 +5994,7 @@ function chooseType() {
$("#row_event_graph_by_criticity").hide(); $("#row_event_graph_by_criticity").hide();
$("#row_event_graph_by_validated").hide(); $("#row_event_graph_by_validated").hide();
$("#row_extended_events").hide(); $("#row_extended_events").hide();
$("#row_custom_data_events").hide();
$("#row_netflow_filter").hide(); $("#row_netflow_filter").hide();
$("#row_max_values").hide(); $("#row_max_values").hide();
$("#row_resolution").hide(); $("#row_resolution").hide();
@ -6044,6 +6065,7 @@ function chooseType() {
$("#row_event_graph_by_criticity").show(); $("#row_event_graph_by_criticity").show();
$("#row_event_graph_by_validated").show(); $("#row_event_graph_by_validated").show();
$("#row_extended_events").show(); $("#row_extended_events").show();
$("#row_custom_data_events").show();
$("#row_filter_search").show(); $("#row_filter_search").show();
$("#row_filter_exclude").show(); $("#row_filter_exclude").show();
@ -6371,6 +6393,7 @@ function chooseType() {
$("#row_event_graph_by_validated").show(); $("#row_event_graph_by_validated").show();
$("#row_event_type").show(); $("#row_event_type").show();
$("#row_extended_events").show(); $("#row_extended_events").show();
$("#row_custom_data_events").show();
$("#row_filter_search").show(); $("#row_filter_search").show();
$("#row_filter_exclude").show(); $("#row_filter_exclude").show();
@ -6389,7 +6412,7 @@ function chooseType() {
$("#row_event_graphs").show(); $("#row_event_graphs").show();
$("#row_event_type").show(); $("#row_event_type").show();
$("#row_extended_events").show(); $("#row_extended_events").show();
$("#row_extended_events").show(); $("#row_custom_data_events").show();
$("#row_event_graph_by_user").show(); $("#row_event_graph_by_user").show();
$("#row_event_graph_by_criticity").show(); $("#row_event_graph_by_criticity").show();
@ -6414,6 +6437,7 @@ function chooseType() {
$("#row_event_graphs").show(); $("#row_event_graphs").show();
$("#row_event_type").show(); $("#row_event_type").show();
$("#row_extended_events").show(); $("#row_extended_events").show();
$("#row_custom_data_events").show();
$("#row_event_graph_by_user").show(); $("#row_event_graph_by_user").show();
$("#row_event_graph_by_criticity").show(); $("#row_event_graph_by_criticity").show();

View File

@ -2224,12 +2224,18 @@ switch ($action) {
$filter_event_status $filter_event_status
); );
$custom_data_events = get_parameter_switch(
'custom_data_events',
0
);
$style['event_graph_by_agent'] = $event_graph_by_agent; $style['event_graph_by_agent'] = $event_graph_by_agent;
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator; $style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
$style['event_graph_by_criticity'] = $event_graph_by_criticity; $style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated; $style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
$style['event_filter_search'] = $event_filter_search; $style['event_filter_search'] = $event_filter_search;
$style['event_filter_exclude'] = $event_filter_exclude; $style['event_filter_exclude'] = $event_filter_exclude;
$style['custom_data_events'] = $custom_data_events;
if ($label != '') { if ($label != '') {
@ -2957,6 +2963,11 @@ switch ($action) {
'' ''
); );
$custom_data_events = get_parameter_switch(
'custom_data_events',
0
);
// Added for events items. // Added for events items.
$style['show_summary_group'] = $show_summary_group; $style['show_summary_group'] = $show_summary_group;
@ -2976,6 +2987,7 @@ switch ($action) {
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated; $style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
$style['event_filter_search'] = $event_filter_search; $style['event_filter_search'] = $event_filter_search;
$style['event_filter_exclude'] = $event_filter_exclude; $style['event_filter_exclude'] = $event_filter_exclude;
$style['custom_data_events'] = $custom_data_events;
if ($label != '') { if ($label != '') {
$style['label'] = $label; $style['label'] = $label;

View File

@ -256,16 +256,18 @@ $table->style[0] = 'font-weight: bold';
$table->size[0] = '70%'; $table->size[0] = '70%';
$table->size[1] = '30%'; $table->size[1] = '30%';
// enterprise_hook('enterprise_warnings_history_days');
$table->data[1][0] = __('Max. days before delete events'); $table->data[1][0] = __('Max. days before delete events');
$table->data[1][1] = html_print_input(
$table->data[1][1] = html_print_input_text( [
'event_purge', 'type' => 'number',
$config['event_purge'], 'size' => 5,
'', 'max' => 99999,
5, 'name' => 'event_purge',
5, 'value' => $config['event_purge'],
true 'return' => true,
'min' => ((((bool) $config['history_event_enabled'] === true) && $config['history_event_days'] > 0) ? $config['history_event_days'] + 1 : null),
'style' => 'width:43px',
]
); );
$table->data[2][0] = __('Max. days before delete traps'); $table->data[2][0] = __('Max. days before delete traps');

View File

@ -274,7 +274,7 @@ $table->data[$i++][1] = html_print_input_text(
$url_update_manager, $url_update_manager,
__('URL update manager'), __('URL update manager'),
80, 80,
60, 255,
true true
); );

View File

@ -713,7 +713,7 @@ class DiscoveryTaskList extends HTML
} }
if ($task['id_recon_script'] == 0 || $ipam === true) { if ($task['id_recon_script'] == 0 || $ipam === true) {
$data[4] = $subnet; $data[4] = ui_print_truncate_text($subnet, 50, true, true, true, '[&hellip;]');
} else { } else {
$data[4] = '-'; $data[4] = '-';
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -86,6 +86,8 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
$addedItems = json_decode($addedItems); $addedItems = json_decode($addedItems);
$all = (string) get_parameter('all', 'all'); $all = (string) get_parameter('all', 'all');
$delete_offspring_agents = (int) get_parameter('delete_offspring_agents', 0);
if ($addedItems != null) { if ($addedItems != null) {
foreach ($addedItems as $item) { foreach ($addedItems as $item) {
echo $item."|\n"; echo $item."|\n";
@ -111,21 +113,9 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
} }
$data = []; $data = [];
// Get agents for only the alias // Get agents for only the alias.
$filter_alias = $filter; $filter_alias = $filter;
switch ($config['dbtype']) {
case 'mysql':
$filter_alias[] = '(UPPER(alias) LIKE "%'.$string.'%")'; $filter_alias[] = '(UPPER(alias) LIKE "%'.$string.'%")';
break;
case 'postgresql':
$filter_alias[] = '(UPPER(alias) LIKE \'%'.$string.'%\')';
break;
case 'oracle':
$filter_alias[] = '(UPPER(alias) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = agents_get_agents($filter_alias, ['id_agente', 'nombre', 'direccion', 'alias']); $agents = agents_get_agents($filter_alias, ['id_agente', 'nombre', 'direccion', 'alias']);
if ($agents !== false) { if ($agents !== false) {
@ -142,19 +132,7 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
// Get agents for only the name. // Get agents for only the name.
$filter_agents = $filter; $filter_agents = $filter;
switch ($config['dbtype']) {
case 'mysql':
$filter_agents[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) LIKE "%'.$string.'%")'; $filter_agents[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) LIKE "%'.$string.'%")';
break;
case 'postgresql':
$filter_agents[] = '(UPPER(alias) NOT LIKE \'%'.$string.'%\' AND UPPER(nombre) LIKE \'%'.$string.'%\')';
break;
case 'oracle':
$filter_agents[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = agents_get_agents($filter_agents, ['id_agente', 'nombre', 'direccion', 'alias']); $agents = agents_get_agents($filter_agents, ['id_agente', 'nombre', 'direccion', 'alias']);
if ($agents !== false) { if ($agents !== false) {
@ -169,21 +147,9 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
} }
} }
// Get agents for only the address // Get agents for only the address.
$filter_address = $filter; $filter_address = $filter;
switch ($config['dbtype']) {
case 'mysql':
$filter_address[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) NOT LIKE "%'.$string.'%" AND UPPER(direccion) LIKE "%'.$string.'%")'; $filter_address[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) NOT LIKE "%'.$string.'%" AND UPPER(direccion) LIKE "%'.$string.'%")';
break;
case 'postgresql':
$filter_address[] = '(UPPER(alias) NOT LIKE \'%'.$string.'%\' AND UPPER(nombre) NOT LIKE \'%'.$string.'%\' AND UPPER(direccion) LIKE \'%'.$string.'%\')';
break;
case 'oracle':
$filter_address[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = agents_get_agents($filter_address, ['id_agente', 'nombre', 'direccion', 'alias']); $agents = agents_get_agents($filter_address, ['id_agente', 'nombre', 'direccion', 'alias']);
if ($agents !== false) { if ($agents !== false) {
@ -198,21 +164,9 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
} }
} }
// Get agents for only the description // Get agents for only the description.
$filter_description = $filter; $filter_description = $filter;
switch ($config['dbtype']) {
case 'mysql':
$filter_description[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) NOT LIKE "%'.$string.'%" AND UPPER(direccion) NOT LIKE "%'.$string.'%" AND UPPER(comentarios) LIKE "%'.$string.'%")'; $filter_description[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) NOT LIKE "%'.$string.'%" AND UPPER(direccion) NOT LIKE "%'.$string.'%" AND UPPER(comentarios) LIKE "%'.$string.'%")';
break;
case 'postgresql':
$filter_description[] = '(UPPER(alias) NOT LIKE \'%'.$string.'%\' AND UPPER(nombre) NOT LIKE \'%'.$string.'%\' AND UPPER(direccion) NOT LIKE \'%'.$string.'%\' AND UPPER(comentarios) LIKE \'%'.$string.'%\')';
break;
case 'oracle':
$filter_description[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(comentarios) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = agents_get_agents($filter_description, ['id_agente', 'nombre', 'direccion', 'alias']); $agents = agents_get_agents($filter_description, ['id_agente', 'nombre', 'direccion', 'alias']);
if ($agents !== false) { if ($agents !== false) {
@ -227,6 +181,18 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
} }
} }
if (empty($data) === false && $delete_offspring_agents !== 0) {
// Gets offspring and deletes them, including himself.
$agents_offspring = agents_get_offspring($delete_offspring_agents);
if (empty($agents_offspring) === false) {
foreach ($data as $key => $value) {
if (isset($agents_offspring[$value['id']]) === true) {
unset($data[$key]);
}
}
}
}
echo json_encode($data); echo json_encode($data);
return; return;
} else if ($search_agents && is_metaconsole()) { } else if ($search_agents && is_metaconsole()) {

View File

@ -136,7 +136,7 @@ if ($get_comments === true) {
// Default grouped message filtering (evento and estado). // Default grouped message filtering (evento and estado).
$whereGrouped = sprintf( $whereGrouped = sprintf(
'`evento` = "%s" AND `estado` = "%s"', '`evento` = "%s" AND `estado` = "%s"',
io_safe_output($event['evento']), $event['evento'],
$event['estado'] $event['estado']
); );
// If id_agente is reported, filter the messages by them as well. // If id_agente is reported, filter the messages by them as well.

View File

@ -245,7 +245,7 @@ class AgentsAlerts extends HTML
); );
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->id = 'table_agent_module'; $table->id = 'table_agent_module';
$table->data = []; $table->data = [];
@ -537,7 +537,7 @@ class AgentsAlerts extends HTML
'alerts_agents' 'alerts_agents'
); );
echo '<table cellpadding="4" cellspacing="4" border="0" class="agents_modules_table table">'; echo '<table cellpadding="4" cellspacing="4" border="0" class="info_table">';
echo '<tr>'; echo '<tr>';
echo '<th class="header_table_principal_cell">'.__('Agents').' / '.__('Alerts').'</th>'; echo '<th class="header_table_principal_cell">'.__('Agents').' / '.__('Alerts').'</th>';
@ -576,10 +576,11 @@ class AgentsAlerts extends HTML
'images/arrow_left_green.png', 'images/arrow_left_green.png',
true, true,
[ [
'style' => 'float: right;', 'style' => 'display:flex;justify-content: center',
'title' => __('Previous alerts'), 'title' => __('Previous alerts'),
] ]
), ),
'style' => 'display:flex;justify-content: center',
] ]
); );
echo '</th>'; echo '</th>';
@ -612,9 +613,9 @@ class AgentsAlerts extends HTML
$outputLine = html_print_div( $outputLine = html_print_div(
[ [
'id' => 'line_header_'.$id, 'id' => 'line_header_'.$id,
'class' => 'rotate_text_module position_text_module', 'class' => 'position_text_module',
'style' => '', 'style' => '',
'content' => '<div title="'.io_safe_output($name).'">'.ui_print_truncate_text(io_safe_output($name), 20).'</div>', 'content' => '<div style="font-size: 7.5pt !important" title="'.io_safe_output($name).'">'.ui_print_truncate_text(io_safe_output($name), 20).'</div>',
], ],
true true
); );
@ -657,7 +658,7 @@ class AgentsAlerts extends HTML
$alias = db_get_row('tagente', 'id_agente', $agent['id_agente']); $alias = db_get_row('tagente', 'id_agente', $agent['id_agente']);
echo '<tr>'; echo '<tr>';
// Name of the agent. // Name of the agent.
echo '<td class="bolder" style="text-align: right" >'.$alias['alias'].'</td>'; echo '<td style="text-align: left;font-weight: bold;color: #3f3f3f;">'.$alias['alias'].'</td>';
// Alerts of the agent. // Alerts of the agent.
foreach ($templates as $tid => $tname) { foreach ($templates as $tid => $tname) {
$anyfired = 0; $anyfired = 0;
@ -669,18 +670,6 @@ class AgentsAlerts extends HTML
echo '<td class="center">'; echo '<td class="center">';
if (isset($agent_alerts[$alias['alias']][$tid])) { if (isset($agent_alerts[$alias['alias']][$tid])) {
foreach ($agent_alerts[$alias['alias']][$tid] as $alert) {
if ((int) $alert['times_fired'] > 0) {
$anyfired = true;
}
}
if ($anyfired) {
$cellstyle = 'background:'.COL_ALERTFIRED.';';
} else {
$cellstyle = 'background:'.COL_NORMAL.';';
}
$uniqid = uniqid(); $uniqid = uniqid();
html_print_anchor( html_print_anchor(
@ -689,8 +678,7 @@ class AgentsAlerts extends HTML
'content' => html_print_div( 'content' => html_print_div(
[ [
'id' => 'line_header_'.$temp['id'], 'id' => 'line_header_'.$temp['id'],
'class' => 'status_rounded_rectangles text_inside', 'style' => 'font-size: 13pt;',
'style' => $cellstyle,
'content' => count($agent_alerts[$alias['alias']][$tid]), 'content' => count($agent_alerts[$alias['alias']][$tid]),
], ],
true true

View File

@ -523,6 +523,14 @@ class TreeService extends Tree
continue 2; continue 2;
} }
$title = get_parameter('title', '');
if (empty($title) === true) {
$tmp['title'] = '';
} else {
$tmp['title'] = $title.'/';
}
$tmp['title'] .= $service->name();
$tmp['id'] = (int) $item->service()->id(); $tmp['id'] = (int) $item->service()->id();
$tmp['name'] = $item->service()->name(); $tmp['name'] = $item->service()->name();
$tmp['alias'] = $item->service()->name(); $tmp['alias'] = $item->service()->name();
@ -530,6 +538,20 @@ class TreeService extends Tree
$tmp['elementDescription'] = $item->description(); $tmp['elementDescription'] = $item->description();
$tmp['disabled'] = $item->service()->disabled(); $tmp['disabled'] = $item->service()->disabled();
$counters = [
'total_modules' => 0,
'total_agents' => 0,
'total_services' => 0,
'total_dynamic' => 0,
'total' => 0,
];
if (is_metaconsole() === false
|| (isset($config['realtimestats']) === true
&& $config['realtimestats'] === true
&& $tmp['metaID'] > 0)
) {
// Look for counters.
if ($this->connectedToNode === false if ($this->connectedToNode === false
&& is_metaconsole() === true && is_metaconsole() === true
&& $tmp['metaID'] > 0 && $tmp['metaID'] > 0
@ -557,14 +579,6 @@ class TreeService extends Tree
\enterprise_hook('metaconsole_restore_db'); \enterprise_hook('metaconsole_restore_db');
} }
$counters = [
'total_modules' => 0,
'total_agents' => 0,
'total_services' => 0,
'total_dynamic' => 0,
'total' => 0,
];
if (is_array($grandchildren) === true) { if (is_array($grandchildren) === true) {
$counters = array_reduce( $counters = array_reduce(
$grandchildren, $grandchildren,
@ -590,6 +604,10 @@ class TreeService extends Tree
if ($counters['total'] > 0) { if ($counters['total'] > 0) {
$tmp['searchChildren'] = 1; $tmp['searchChildren'] = 1;
} }
} else {
// Always search for.
$tmp['searchChildren'] = 1;
}
$tmp['type'] = 'services'; $tmp['type'] = 'services';
$tmp['rootType'] = 'services'; $tmp['rootType'] = 'services';

View File

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

View File

@ -5986,6 +5986,56 @@ function send_test_email(
} }
/**
* Return array of ancestors of item, given array.
*
* @param integer $item From index.
* @param array $data Array data.
* @param string $key Pivot key (identifies the parent).
* @param string|null $extract Extract certain column or index.
* @param array $visited Cycle detection.
*
* @return array Array of ancestors.
*/
function get_ancestors(
int $item,
array $data,
string $key,
?string $extract=null,
array &$visited=[]
) :array {
if (isset($visited[$item]) === true) {
return [];
}
$visited[$item] = 1;
if (isset($data[$item]) === false) {
return [];
}
if (isset($data[$item][$key]) === false) {
if ($extract !== null) {
return [$data[$item][$extract]];
}
return [$item];
}
if ($extract !== null) {
return array_merge(
get_ancestors($data[$item][$key], $data, $key, $extract, $visited),
[$data[$item][$extract]]
);
}
return array_merge(
get_ancestors($data[$item][$key], $data, $key, $extract, $visited),
[$item]
);
}
if (function_exists('str_contains') === false) { if (function_exists('str_contains') === false) {

View File

@ -4268,3 +4268,30 @@ function get_status_data_agent_modules($id_group, $agents=[], $modules=[])
return $res; return $res;
} }
function agents_get_offspring(int $id_agent)
{
$return = [];
// Get parent.
$agents = db_get_all_rows_filter(
'tagente',
[
'id_parent' => $id_agent,
'disabled' => 0,
],
'id_agente'
);
if ($agents !== false) {
foreach ($agents as $agent) {
if ((int) $agent['id_agente'] !== 0) {
$return += agents_get_offspring((int) $agent['id_agente']);
}
}
}
$return += [$id_agent => 0];
return $return;
}

View File

@ -118,6 +118,9 @@ function alerts_get_alerts($id_group=0, $free_search='', $status='all', $standby
$sql .= ' AND t3.id_agente = '.$id_agent; $sql .= ' AND t3.id_agente = '.$id_agent;
} }
// Only enabled agent.
$sql .= ' AND t3.disabled = 0';
$row_alerts = db_get_all_rows_sql($sql); $row_alerts = db_get_all_rows_sql($sql);
if ($total) { if ($total) {

View File

@ -1469,22 +1469,22 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3)
// Check parameters. // Check parameters.
if ($idGroup == 0) { if ($idGroup == 0) {
$agent_update_error = __('The agent could not be modified. For security reasons, use a group other than 0.'); $agent_update_error = __('The agent could not be modified. For security reasons, use a group other than 0.');
returnError('generic error', $agent_update_error); returnError($agent_update_error);
return; return;
} }
$server_name = db_get_value_sql('SELECT name FROM tserver WHERE BINARY name LIKE "'.$nameServer.'"'); $server_name = db_get_value_sql('SELECT name FROM tserver WHERE BINARY name LIKE "'.$nameServer.'"');
if ($alias == '' && $alias_as_name === 0) { if ($alias == '' && $alias_as_name === 0) {
returnError('alias_not_specified', 'No agent alias specified'); returnError('No agent alias specified');
return; return;
} else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$idGroup) === false) { } else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$idGroup) === false) {
returnError('id_grupo_not_exist', 'The group doesn`t exist.'); returnError('The group doesn`t exist.');
return; return;
} else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$idOS) === false) { } else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$idOS) === false) {
returnError('id_os_not_exist', 'The OS doesn`t exist.'); returnError('The OS doesn`t exist.');
return; return;
} else if ($server_name === false) { } else if ($server_name === false) {
returnError('server_not_exist', 'The '.get_product_name().' Server doesn`t exist.'); returnError('The '.get_product_name().' Server doesn`t exist.');
return; return;
} }
@ -1525,6 +1525,14 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3)
returnError('The user cannot access to parent agent.'); returnError('The user cannot access to parent agent.');
return; return;
} }
$agents_offspring = agents_get_offspring($id_agent);
if (empty($agents_offspring) === false) {
if (isset($agents_offspring[$idParent]) === true) {
returnError('The parent cannot be a offspring');
return;
}
}
} }
$values_old = db_get_row_filter( $values_old = db_get_row_filter(
@ -1751,6 +1759,14 @@ function api_set_update_agent_field($id_agent, $use_agent_alias, $params)
returnError('The user cannot access to parent agent.'); returnError('The user cannot access to parent agent.');
return; return;
} }
$agents_offspring = agents_get_offspring($id_agent);
if (empty($agents_offspring) === false) {
if (isset($agents_offspring[$data]) === true) {
returnError('The parent cannot be a offspring');
return;
}
}
break; break;
default: default:
@ -1855,7 +1871,19 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
return; return;
} }
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $other['data'][0]))); $alias = io_safe_input(
trim(
preg_replace(
'/[\/\\\|%#&$]/',
'',
preg_replace(
'/x20;/',
' ',
$other['data'][0]
)
)
)
);
$direccion_agente = io_safe_input($other['data'][1]); $direccion_agente = io_safe_input($other['data'][1]);
$nombre_agente = hash('sha256', $direccion_agente.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000))); $nombre_agente = hash('sha256', $direccion_agente.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
$id_parent = (int) $other['data'][2]; $id_parent = (int) $other['data'][2];

View File

@ -2096,6 +2096,10 @@ function config_process_config()
config_update_value('metaconsole_events_history', 0); config_update_value('metaconsole_events_history', 0);
} }
if (!isset($config['realtimestats'])) {
config_update_value('realtimestats', 1);
}
if (!isset($config['trap_purge'])) { if (!isset($config['trap_purge'])) {
config_update_value('trap_purge', 7); config_update_value('trap_purge', 7);
} }

View File

@ -2297,6 +2297,7 @@ function events_comment(
$comments_format = 'new'; $comments_format = 'new';
} else { } else {
// If comments are not stored in json, the format is old. // If comments are not stored in json, the format is old.
$event_comments[0]['user_comment'] = str_replace(["\n", '&#x0a;'], '<br>', $event_comments[0]['user_comment']);
$event_comments_array = json_decode($event_comments[0]['user_comment']); $event_comments_array = json_decode($event_comments[0]['user_comment']);
if (empty($event_comments_array) === true) { if (empty($event_comments_array) === true) {
@ -5227,6 +5228,8 @@ function events_page_comments($event, $ajax=false, $groupedComments=[])
$comm = $comm['user_comment']; $comm = $comm['user_comment'];
} }
$comm = str_replace(["\n", '&#x0a;'], '<br>', $comm);
$comments_array[] = io_safe_output(json_decode($comm, true)); $comments_array[] = io_safe_output(json_decode($comm, true));
} }

View File

@ -1133,7 +1133,7 @@ function modules_get_table_data(?int $id_agent_module, ?int $id_type)
function modules_get_raw_data($id_agent_module, $date_init, $date_end) function modules_get_raw_data($id_agent_module, $date_init, $date_end)
{ {
$table = modules_get_table_data($id_agent_module); $table = modules_get_table_data($id_agent_module, null);
$datelimit = ($date_init - $date_end); $datelimit = ($date_init - $date_end);
$search_in_history_db = db_search_in_history_db($datelimit); $search_in_history_db = db_search_in_history_db($datelimit);
@ -4213,7 +4213,7 @@ function modules_get_min_max_data($id_agent_module, $time_init=0)
$data[0]['max'] = $min_max['max']; $data[0]['max'] = $min_max['max'];
} else { } else {
// Search limits of the last two days. // Search limits of the last two days.
$table = modules_get_table_data($id_agent_module); $table = modules_get_table_data($id_agent_module, null);
$data = db_get_all_rows_sql( $data = db_get_all_rows_sql(
'SELECT min(datos) as min, max(datos) as max 'SELECT min(datos) as min, max(datos) as max
FROM '.$table.' FROM '.$table.'

View File

@ -14,54 +14,190 @@
// Get critical agents by using the status code in modules. // Get critical agents by using the status code in modules.
function os_agents_critical($id_os) function os_agents_critical($id_os)
{ {
// TODO REVIEW ORACLE AND POSTGRES global $config;
$table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
if (users_is_admin() === true) {
return db_get_sql( return db_get_sql(
" sprintf(
SELECT COUNT(*) 'SELECT COUNT(*)
FROM tagente FROM %s
WHERE tagente.disabled=0 AND WHERE tagente.disabled=0 AND
critical_count>0 AND id_os=$id_os" critical_count>0 AND id_os=%d',
$table,
$id_os
)
); );
} else {
$groups = array_keys(users_get_groups($config['id_user'], 'AR', false));
return db_get_sql(
sprintf(
'SELECT COUNT(*)
FROM %s
WHERE tagente.disabled=0 AND
critical_count>0 AND
id_os=%d AND id_grupo IN (%s)',
$table,
$id_os,
implode(',', $groups)
)
);
}
} }
// Get ok agents by using the status code in modules. // Get ok agents by using the status code in modules.
function os_agents_ok($id_os) function os_agents_ok($id_os)
{ {
global $config;
$table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
if (users_is_admin() === true) {
return db_get_sql( return db_get_sql(
" sprintf(
SELECT COUNT(*) 'SELECT COUNT(*)
FROM tagente FROM %s
WHERE tagente.disabled=0 AND WHERE tagente.disabled=0 AND
normal_count=total_count AND id_os=$id_os" normal_count=total_count AND id_os=%d',
$table,
$id_os
)
); );
} else {
$groups = array_keys(users_get_groups($config['id_user'], 'AR', false));
return db_get_sql(
sprintf(
'SELECT COUNT(*)
FROM %s
WHERE tagente.disabled=0 AND
normal_count=total_count AND
id_os=%d AND id_grupo IN (%s)',
$table,
$id_os,
implode(',', $groups)
)
);
}
} }
// Get warning agents by using the status code in modules. // Get warning agents by using the status code in modules.
function os_agents_warning($id_os) function os_agents_warning($id_os)
{ {
global $config;
$table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
if (users_is_admin() === true) {
return db_get_sql( return db_get_sql(
" sprintf(
SELECT COUNT(*) 'SELECT COUNT(*)
FROM tagente FROM %s
WHERE tagente.disabled=0 AND WHERE tagente.disabled=0 AND
critical_count=0 AND warning_count>0 AND id_os=$id_os" critical_count=0 AND warning_count>0
AND id_os=%d',
$table,
$id_os
)
); );
} else {
$groups = array_keys(users_get_groups($config['id_user'], 'AR', false));
return db_get_sql(
sprintf(
'SELECT COUNT(*)
FROM %s
WHERE tagente.disabled=0 AND
critical_count=0 AND warning_count>0 AND
id_os=%d AND id_grupo IN (%s)',
$table,
$id_os,
implode(',', $groups)
)
);
}
} }
// Get unknown agents by using the status code in modules. // Get unknown agents by using the status code in modules.
function os_agents_unknown($id_os) function os_agents_unknown($id_os)
{ {
global $config;
$table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
if (users_is_admin() === true) {
return db_get_sql( return db_get_sql(
" sprintf(
SELECT COUNT(*) 'SELECT COUNT(*)
FROM tagente FROM %s
WHERE tagente.disabled=0 AND WHERE tagente.disabled=0 AND
critical_count=0 AND warning_count=0 AND critical_count=0 AND warning_count=0 AND
unknown_count>0 AND id_os=$id_os" unknown_count>0 AND id_os=%d',
$table,
$id_os
)
); );
} else {
$groups = array_keys(users_get_groups($config['id_user'], 'AR', false));
return db_get_sql(
sprintf(
'SELECT COUNT(*)
FROM %s
WHERE tagente.disabled=0 AND
critical_count=0 AND warning_count=0 AND
unknown_count>0 AND id_os=%d AND id_grupo IN (%s)',
$table,
$id_os,
implode(',', $groups)
)
);
}
}
/**
* Get total agents
*
* @param integer $id_os OS id.
*
* @return array|boolean
*/
function os_agents_total(int $id_os)
{
global $config;
$table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
if (users_is_admin() === true) {
return db_get_sql(
sprintf(
'SELECT COUNT(*)
FROM %s
WHERE tagente.disabled=0 AND id_os=%d',
$table,
$id_os
)
);
} else {
$groups = array_keys(users_get_groups($config['id_user'], 'AR', false));
return db_get_sql(
sprintf(
'SELECT COUNT(*)
FROM %s
WHERE tagente.disabled=0 AND id_os=%d AND id_grupo IN (%s)',
$table,
$id_os,
implode(',', $groups)
)
);
}
} }

View File

@ -1943,6 +1943,8 @@ function reporting_event_report_group(
$event_filter = $content['style']; $event_filter = $content['style'];
$return['show_summary_group'] = $event_filter['show_summary_group']; $return['show_summary_group'] = $event_filter['show_summary_group'];
$return['show_custom_data'] = (isset($event_filter['custom_data_events']) === true) ? (bool) $event_filter['custom_data_events'] : false;
// Filter. // Filter.
$show_summary_group = $event_filter['show_summary_group']; $show_summary_group = $event_filter['show_summary_group'];
$filter_event_severity = json_decode($event_filter['filter_event_severity'], true); $filter_event_severity = json_decode($event_filter['filter_event_severity'], true);
@ -2246,6 +2248,8 @@ function reporting_event_report_module(
$event_filter = $content['style']; $event_filter = $content['style'];
$return['show_summary_group'] = $event_filter['show_summary_group']; $return['show_summary_group'] = $event_filter['show_summary_group'];
$return['show_custom_data'] = (isset($event_filter['custom_data_events']) === true) ? (bool) $event_filter['custom_data_events'] : false;
// Filter. // Filter.
$show_summary_group = $event_filter['show_summary_group']; $show_summary_group = $event_filter['show_summary_group'];
$filter_event_severity = json_decode( $filter_event_severity = json_decode(
@ -3779,6 +3783,8 @@ function reporting_event_report_agent(
$filter_event_status = json_decode($style['filter_event_status'], true); $filter_event_status = json_decode($style['filter_event_status'], true);
$filter_event_filter_search = $style['event_filter_search']; $filter_event_filter_search = $style['event_filter_search'];
$filter_event_filter_exclude = $style['event_filter_exclude']; $filter_event_filter_exclude = $style['event_filter_exclude'];
$show_custom_data = (isset($style['custom_data_events']) === true) ? (bool) $style['custom_data_events'] : false;
$return['show_custom_data'] = $show_custom_data;
// Graph. // Graph.
$event_graph_by_user_validator = $style['event_graph_by_user_validator']; $event_graph_by_user_validator = $style['event_graph_by_user_validator'];
@ -3798,7 +3804,8 @@ function reporting_event_report_agent(
$filter_event_status, $filter_event_status,
$filter_event_filter_search, $filter_event_filter_search,
$filter_event_filter_exclude, $filter_event_filter_exclude,
$id_server $id_server,
$show_custom_data
); );
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
@ -6954,7 +6961,7 @@ function sla_truncate($num, $accurancy=2)
* *
* @param integer $value Value. * @param integer $value Value.
* @param integer $min Treshold min SLA. * @param integer $min Treshold min SLA.
* @param boolean $max Treshold max SLA. * @param integer $max Treshold max SLA.
* @param boolean $inverse_interval Treshold inverse SLA. * @param boolean $inverse_interval Treshold inverse SLA.
* *
* @return boolean Returns the interval in downtime (false if no matches). * @return boolean Returns the interval in downtime (false if no matches).
@ -10594,7 +10601,8 @@ function reporting_get_agents_detailed_event(
$filter_event_status=false, $filter_event_status=false,
$filter_event_filter_search=false, $filter_event_filter_search=false,
$filter_event_filter_exclude=false, $filter_event_filter_exclude=false,
$id_server=0 $id_server=0,
$show_custom_data=false
) { ) {
global $config; global $config;
@ -10651,6 +10659,7 @@ function reporting_get_agents_detailed_event(
'validated_by' => $e['id_usuario'], 'validated_by' => $e['id_usuario'],
'timestamp' => $e['timestamp_rep'], 'timestamp' => $e['timestamp_rep'],
'id_evento' => $e['id_evento'], 'id_evento' => $e['id_evento'],
'custom_data' => ($show_custom_data === true) ? $e['custom_data'] : '',
]; ];
} else { } else {
$return_data[] = [ $return_data[] = [
@ -10661,6 +10670,7 @@ function reporting_get_agents_detailed_event(
'validated_by' => $e['id_usuario'], 'validated_by' => $e['id_usuario'],
'timestamp' => $e['timestamp'], 'timestamp' => $e['timestamp'],
'id_evento' => $e['id_evento'], 'id_evento' => $e['id_evento'],
'custom_data' => ($show_custom_data === true) ? $e['custom_data'] : '',
]; ];
} }
} }
@ -14739,9 +14749,11 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
if ($modules_is_string === false) { if ($modules_is_string === false) {
if ($agentmodule_info['max_critical'] == 0) { if ($agentmodule_info['max_critical'] == 0) {
$max_value_critical = null; $max_value_critical = null;
if ($agentmodule_info['min_critical'] == 0) {
if ((bool) $content['dinamic_proc'] === true) { if ((bool) $content['dinamic_proc'] === true) {
$max_value_critical = 0.01; $max_value_critical = 0.01;
} }
}
} else { } else {
$max_value_critical = $agentmodule_info['max_critical']; $max_value_critical = $agentmodule_info['max_critical'];
} }

View File

@ -1025,6 +1025,7 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
global $config; global $config;
$show_extended_events = $item['show_extended_events']; $show_extended_events = $item['show_extended_events'];
$show_custom_data = (bool) $item['show_custom_data'];
if ($item['total_events']) { if ($item['total_events']) {
$table1 = new stdClass(); $table1 = new stdClass();
@ -1060,6 +1061,10 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
$table1->head[6] = __('Timestamp'); $table1->head[6] = __('Timestamp');
} }
if ($show_custom_data === true) {
$table1->head[8] = __('Custom data');
}
foreach ($item['data'] as $k => $event) { foreach ($item['data'] as $k => $event) {
// First pass along the class of this row. // First pass along the class of this row.
if ($item['show_summary_group']) { if ($item['show_summary_group']) {
@ -1132,6 +1137,16 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
$data[] = '<font class="font_6pt">'.date($config['date_format'], strtotime($event['timestamp'])).'</font>'; $data[] = '<font class="font_6pt">'.date($config['date_format'], strtotime($event['timestamp'])).'</font>';
} }
if ($show_custom_data === true) {
$custom_data = json_decode($event['custom_data'], true);
$custom_data_text = '';
foreach ($custom_data as $key => $value) {
$custom_data_text .= $key.' = '.$value.'<br>';
}
$data[] = $custom_data_text;
}
array_push($table1->data, $data); array_push($table1->data, $data);
if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) { if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) {
@ -1246,10 +1261,10 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
function reporting_html_event_report_module($table, $item, $pdf=0) function reporting_html_event_report_module($table, $item, $pdf=0)
{ {
global $config; global $config;
$show_extended_events = $item['show_extended_events']; $show_extended_events = $item['show_extended_events'];
$show_summary_group = $item['show_summary_group']; $show_summary_group = $item['show_summary_group'];
$show_custom_data = (bool) $item['show_custom_data'];
if ($item['total_events']) { if ($item['total_events']) {
if (!empty($item['failed'])) { if (!empty($item['failed'])) {
$table->colspan['events']['cell'] = 3; $table->colspan['events']['cell'] = 3;
@ -1279,6 +1294,10 @@ function reporting_html_event_report_module($table, $item, $pdf=0)
$table1->style[0] = 'text-align: center;'; $table1->style[0] = 'text-align: center;';
} }
if ($show_custom_data === true) {
$table1->head[6] = __('Custom data');
}
if (is_array($item['data']) || is_object($item['data'])) { if (is_array($item['data']) || is_object($item['data'])) {
$item_data = array_reverse($item['data']); $item_data = array_reverse($item['data']);
} }
@ -1331,6 +1350,16 @@ function reporting_html_event_report_module($table, $item, $pdf=0)
$data[4] = date($config['date_format'], strtotime($event['timestamp'])); $data[4] = date($config['date_format'], strtotime($event['timestamp']));
} }
if ($show_custom_data === true) {
$custom_data = json_decode($event['custom_data'], true);
$custom_data_text = '';
foreach ($custom_data as $key => $value) {
$custom_data_text .= $key.' = '.$value.'<br>';
}
$data[6] = $custom_data_text;
}
$table1->data[] = $data; $table1->data[] = $data;
if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) { if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) {
@ -2341,6 +2370,13 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
$table1->align[0] = 'center'; $table1->align[0] = 'center';
$table1->align[1] = 'center'; $table1->align[1] = 'center';
$table1->align[3] = 'center'; $table1->align[3] = 'center';
if ((bool) $item['show_custom_data'] === true) {
if ($item['show_summary_group']) {
$table1->align[7] = 'left';
} else {
$table1->align[6] = 'left';
}
}
$table1->data = []; $table1->data = [];
@ -2355,6 +2391,9 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
$table1->head[4] = __('Severity'); $table1->head[4] = __('Severity');
$table1->head[5] = __('Val. by'); $table1->head[5] = __('Val. by');
$table1->head[6] = __('Timestamp'); $table1->head[6] = __('Timestamp');
if ((bool) $item['show_custom_data'] === true) {
$table1->head[7] = __('Custom data');
}
foreach ($item['data'] as $i => $event) { foreach ($item['data'] as $i => $event) {
if ($item['show_summary_group']) { if ($item['show_summary_group']) {
@ -2420,6 +2459,16 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
$data[] = '<font class="font_6pt">'.date($config['date_format'], strtotime($event['timestamp'])).'</font>'; $data[] = '<font class="font_6pt">'.date($config['date_format'], strtotime($event['timestamp'])).'</font>';
} }
if ((bool) $item['show_custom_data'] === true) {
$custom_data = json_decode($event['custom_data'], true);
$custom_data_text = '';
foreach ($custom_data as $key => $value) {
$custom_data_text .= $key.' = '.$value.'<br>';
}
$data[] = $custom_data_text;
}
array_push($table1->data, $data); array_push($table1->data, $data);
if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) { if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) {

View File

@ -5448,6 +5448,10 @@ function ui_print_agent_autocomplete_input($parameters)
'q' => 'term', 'q' => 'term',
]; ];
if (isset($parameters['delete_offspring_agents']) === true) {
$javascript_change_ajax_params_original['delete_offspring_agents'] = $parameters['delete_offspring_agents'];
}
if (!$metaconsole_enabled) { if (!$metaconsole_enabled) {
$javascript_change_ajax_params_original['force_local'] = 1; $javascript_change_ajax_params_original['force_local'] = 1;
} }

View File

@ -15,6 +15,8 @@ function pandoraFlotPie(
colors, colors,
hide_labels hide_labels
) { ) {
height = parseInt(height);
labels = labels.split(separator); labels = labels.split(separator);
var data = values.split(separator); var data = values.split(separator);
@ -79,11 +81,22 @@ function pandoraFlotPie(
break; break;
} }
var discount = 20;
if (water_mark) {
discount = 40;
}
var plot = $.plot($("#" + graph_id), data, conf_pie); var plot = $.plot($("#" + graph_id), data, conf_pie);
var legends = $("#" + graph_id + " .legendLabel"); var legends = $("#" + graph_id + " .legendLabel");
legends.css("font-size", font_size + "pt"); legends.css("font-size", font_size + "pt");
var tableDiv = $("#" + graph_id + " .legend > div");
tableDiv.css("max-height", height - discount + "px");
var tableLegend = $("#" + graph_id + " .legend table");
tableLegend.css("max-height", height - discount + "px");
// Events // Events
$("#" + graph_id).bind("plothover", pieHover); $("#" + graph_id).bind("plothover", pieHover);
//$("#" + graph_id).bind("plotclick", pieClick); //$("#" + graph_id).bind("plotclick", pieClick);
@ -443,14 +456,15 @@ function pandoraFlotHBars(
"pt !important;" + "pt !important;" +
"margin: 0; max-width: 200px;" + "margin: 0; max-width: 200px;" +
"margin-right:5px;" + "margin-right:5px;" +
"margin-left: -1.5em" + "margin-left: -1.5em;" +
"text-align: right" + "text-align: right;" +
"text-overflow: ellipsis;" + "text-overflow: ellipsis;" +
"overflow: hidden;" + "overflow: hidden;" +
"white-space: pre;"; "white-space: pre;";
if (label.indexOf("<br>") != -1) { if (label.indexOf("<br>") != -1) {
div_attributes += "min-height: 2.5em;"; var label_array = label.split("<br>");
label = label_array[0] + label_array[1];
} }
div_attributes += '" title="' + label + '" style="overflow: hidden;"'; div_attributes += '" title="' + label + '" style="overflow: hidden;"';

View File

@ -150,7 +150,7 @@ function d3_tree_map_graph($data, $width=700, $height=700, $return=false)
} }
function d3_sunburst_graph($data, $width=700, $height=700, $return=false) function d3_sunburst_graph($data, $width=700, $height=700, $return=false, $tooltip=true)
{ {
global $config; global $config;
@ -167,7 +167,7 @@ function d3_sunburst_graph($data, $width=700, $height=700, $return=false)
} }
</style>'; </style>';
$output .= "<script language=\"javascript\" type=\"text/javascript\"> $output .= "<script language=\"javascript\" type=\"text/javascript\">
sunburst('#sunburst', $data, '$width', '$height'); sunburst('#sunburst', $data, '$width', '$height', '$tooltip');
</script>"; </script>";
if (!$return) { if (!$return) {

View File

@ -796,7 +796,7 @@ function treeMap(recipient, data, width, height) {
// The area (or angle, depending on implementation) of each arc corresponds to its value. // The area (or angle, depending on implementation) of each arc corresponds to its value.
// Sunburst design by John Stasko. Data courtesy Jeff Heer. // Sunburst design by John Stasko. Data courtesy Jeff Heer.
// http://bl.ocks.org/mbostock/4348373 // http://bl.ocks.org/mbostock/4348373
function sunburst(recipient, data, width, height) { function sunburst(recipient, data, width, height, tooltip = true) {
if (width === "auto") { if (width === "auto") {
width = $(recipient).innerWidth(); width = $(recipient).innerWidth();
} }
@ -858,11 +858,14 @@ function sunburst(recipient, data, width, height) {
}) })
.style("cursor", "pointer") .style("cursor", "pointer")
.on("click", click) .on("click", click)
.on("mouseover", over_user) .on("mouseover", tooltip === "1" ? over_user : "")
.on("mouseout", out_user) .on("mouseout", out_user)
.on("mousemove", move_tooltip); .on("mousemove", move_tooltip);
function computeTextRotation(d) { function computeTextRotation(d) {
if (d.type === "central_service") {
return 0;
}
var ang = ((x(d.x + d.dx / 2) - Math.PI / 2) / Math.PI) * 180; var ang = ((x(d.x + d.dx / 2) - Math.PI / 2) / Math.PI) * 180;
return ang > 90 ? 180 + ang : ang; return ang > 90 ? 180 + ang : ang;
} }
@ -882,9 +885,18 @@ function sunburst(recipient, data, width, height) {
return computeTextRotation(d) > 180 ? -40 : -30; return computeTextRotation(d) > 180 ? -40 : -30;
}) })
.attr("dx", "6") // margin .attr("dx", "6") // margin
.attr("dy", ".35em") // vertical-align .attr("dy", function(d) {
if (d.type === "central_service") {
return "-7em";
}
return ".35em";
}) // vertical-align
.attr("opacity", function(d) { .attr("opacity", function(d) {
if (typeof d.show_name != "undefined" && d.show_name) return 1; if (
(typeof d.show_name != "undefined" && d.show_name) ||
d.type === "central_service"
)
return 1;
else return 0; else return 0;
}) })
.text(function(d) { .text(function(d) {
@ -899,7 +911,11 @@ function sunburst(recipient, data, width, height) {
window.location.href = d.link; window.location.href = d.link;
} else { } else {
// fade out all text elements // fade out all text elements
if (d.type === "central_service") {
text.transition().attr("opacity", 1);
} else {
text.transition().attr("opacity", 0); text.transition().attr("opacity", 0);
}
path path
.transition() .transition()
@ -965,8 +981,8 @@ function sunburst(recipient, data, width, height) {
} }
function move_tooltip(d) { function move_tooltip(d) {
var x = d3.event.pageX + 10; var x = d3.event.pageX + 10 - $("#menu_full").width();
var y = d3.event.pageY + 10; var y = d3.event.pageY - 90;
$("#tooltip").css("left", x + "px"); $("#tooltip").css("left", x + "px");
$("#tooltip").css("top", y + "px"); $("#tooltip").css("top", y + "px");
@ -1017,10 +1033,10 @@ function sunburst(recipient, data, width, height) {
"-moz-box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.75);" + "-moz-box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.75);" +
"box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.75);" + "box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.75);" +
"left: " + "left: " +
x + 100 +
"px;" + "px;" +
"top: " + "top: " +
y + 100 +
"px;" "px;"
); );
} }

View File

@ -2081,3 +2081,33 @@ function progressTimeBar(id, interval, iteration, callback) {
return controls; return controls;
} }
/**
* Filter selector item by text based on a text input.
*
* @param {string} textbox Text input.
*
* @return {void}
*/
$.fn.filterByText = function(textbox) {
var select = this;
$(textbox).bind("change keyup", function() {
var search = $.trim($(textbox).val());
var regex = new RegExp(search, "gi");
$(select)
.find("option")
.each(function() {
if (
$(this)
.text()
.match(regex) !== null
) {
$(this).show();
} else {
$(this).hide();
}
});
});
};

View File

@ -849,7 +849,8 @@ function add_macro_field(macro, row_model_id, type_copy, k) {
$macro_field $macro_field
.find("input") .find("input")
.first() .first()
.attr("name", macro_macro); .attr("name", macro_macro)
.val(macro_value);
$macro_field.attr("class", "macro_field"); $macro_field.attr("class", "macro_field");

View File

@ -861,7 +861,7 @@ var TreeController = {
'<span><img class="invert_filter" src="' + '<span><img class="invert_filter" src="' +
(controller.baseURL.length > 0 ? controller.baseURL : "") + (controller.baseURL.length > 0 ? controller.baseURL : "") +
'images/help.png" class="img_help" title="' + 'images/help.png" class="img_help" title="' +
element.name + (element.title ? element.title : element.name) +
'" alt="' + '" alt="' +
element.name + element.name +
'"/></span> '; '"/></span> ';
@ -1314,6 +1314,7 @@ var TreeController = {
serverID: element.serverID, serverID: element.serverID,
rootType: element.rootType, rootType: element.rootType,
metaID: element.metaID, metaID: element.metaID,
title: element.title,
filter: controller.filter, filter: controller.filter,
auth_class: controller.auth_class, auth_class: controller.auth_class,
id_user: controller.id_user, id_user: controller.id_user,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -412,6 +412,10 @@ class Widget
$className .= '\WuxWidget'; $className .= '\WuxWidget';
break; break;
case 'os_quick_report':
$className .= '\OsQuickReportWidget';
break;
default: default:
$className = false; $className = false;
break; break;

View File

@ -0,0 +1,350 @@
<?php
/**
* Widget Tree view Pandora FMS Console
*
* @category Console Class
* @package Pandora FMS
* @subpackage Widget Tree view
* @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.
* ============================================================================
*/
namespace PandoraFMS\Dashboard;
/**
* OS quick report Widgets.
*/
class OsQuickReportWidget extends Widget
{
/**
* Name widget.
*
* @var string
*/
protected $name;
/**
* Title widget.
*
* @var string
*/
protected $title;
/**
* Page widget;
*
* @var string
*/
protected $page;
/**
* Class name widget.
*
* @var [type]
*/
protected $className;
/**
* Values options for each widget.
*
* @var [type]
*/
protected $values;
/**
* Configuration required.
*
* @var boolean
*/
protected $configurationRequired;
/**
* Error load widget.
*
* @var boolean
*/
protected $loadError;
/**
* Width.
*
* @var integer
*/
protected $width;
/**
* Heigth.
*
* @var integer
*/
protected $height;
/**
* Dashboard ID.
*
* @var integer
*/
protected $dashboardId;
/**
* Cell ID.
*
* @var integer
*/
protected $cellId;
/**
* Construct.
*
* @param integer $cellId Cell ID.
* @param integer $dashboardId Dashboard ID.
* @param integer $widgetId Widget ID.
* @param integer|null $width New width.
* @param integer|null $height New height.
*/
public function __construct(
int $cellId,
int $dashboardId=0,
int $widgetId=0,
?int $width=0,
?int $height=0
) {
global $config;
// Includes.
enterprise_include_once('/include/functions_services.php');
enterprise_include_once('/include/functions_servicemap.php');
// WARNING: Do not edit. This chunk must be in the constructor.
parent::__construct(
$cellId,
$dashboardId,
$widgetId
);
// Width.
$this->width = $width;
// Height.
$this->height = $height;
// Cell Id.
$this->cellId = $cellId;
// Widget ID.
$this->widgetId = $widgetId;
// Dashboard ID.
$this->dashboardId = $dashboardId;
// Options.
$this->values = $this->decoders($this->getOptionsWidget());
// Positions.
$this->position = $this->getPositionWidget();
// Page.
$this->page = basename(__FILE__);
// ClassName.
$class = new \ReflectionClass($this);
$this->className = $class->getShortName();
// Title.
$this->title = __('OS quick report');
// Name.
if (empty($this->name) === true) {
$this->name = 'os_quick_report';
}
$this->overflow_scrollbars = false;
}
/**
* Decoders hack for retrocompability.
*
* @param array $decoder Values.
*
* @return array Returns the values with the correct key.
*/
public function decoders(array $decoder): array
{
$values = [];
// Retrieve global - common inputs.
$values = parent::decoders($decoder);
return $values;
}
/**
* Generates inputs for form (specific).
*
* @return array Of inputs.
*
* @throws Exception On error.
*/
public function getFormInputs(): array
{
// Retrieve global - common inputs.
$inputs = parent::getFormInputs();
return $inputs;
}
/**
* Get Post for widget.
*
* @return array
*/
public function getPost():array
{
// Retrieve global - common inputs.
$values = parent::getPost();
return $values;
}
/**
* Draw widget.
*
* @return string;
*/
public function load()
{
global $config;
$values = $this->values;
$result = [];
$os_array = os_get_os();
foreach ($os_array as $os) {
$id_os = (int) $os['id_os'];
$total = os_agents_total($id_os);
if ((int) $total === 0) {
continue;
}
$result[$id_os]['name'] = $os['name'];
$result[$id_os]['total'] = (int) $total;
$result[$id_os]['normal'] = (int) os_agents_ok($id_os);
$result[$id_os]['critical'] = (int) os_agents_critical($id_os);
$result[$id_os]['unknown'] = (int) os_agents_unknown($id_os);
}
$output = '';
if (empty($result) === false) {
$table = new \stdClass();
$table->class = 'info_table';
$table->width = '100%';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->size = [];
$table->size[0] = '10%';
$table->size[1] = '10%';
$table->size[2] = '20%';
$table->size[3] = '20%';
$table->size[4] = '20%';
$table->size[5] = '20%';
$table->align = [];
$table->align[0] = 'center';
$table->align[1] = 'left';
$table->align[2] = 'center';
$table->align[3] = 'center';
$table->align[4] = 'center';
$table->align[5] = 'center';
$table->head = [];
$table->head[0] = __('OS');
$table->head[1] = __('OS name');
$table->head[2] = ucfirst(__('total agents'));
$table->head[3] = ucfirst(__('normal agents'));
$table->head[4] = ucfirst(__('critical agents'));
$table->head[5] = ucfirst(__('unknown agents'));
$table->headstyle = [];
$table->headstyle[0] = 'text-align:center;background-color: '.$values['background'];
$table->headstyle[1] = 'background-color: '.$values['background'];
$table->headstyle[2] = 'text-align:center;background-color: '.$values['background'];
$table->headstyle[3] = 'text-align:center;background-color: '.$values['background'];
$table->headstyle[4] = 'text-align:center;background-color: '.$values['background'];
$table->headstyle[5] = 'text-align:center;background-color: '.$values['background'];
$table->style = [];
$table->style[0] = 'background-color: '.$values['background'];
$table->style[1] = 'background-color: '.$values['background'];
$table->style[2] = 'font-size: 22px;background-color: '.$values['background'];
$table->style[3] = 'font-size: 22px;background-color: '.$values['background'];
$table->style[4] = 'font-size: 22px;background-color: '.$values['background'];
$table->style[5] = 'font-size: 22px;background-color: '.$values['background'];
foreach ($result as $id => $os) {
$data = [];
$data[0] = ui_print_os_icon($id, false, true);
$data[1] = $os['name'];
$data[2] = $os['total'];
$data[3] = $os['normal'];
$data[4] = $os['critical'];
$data[5] = $os['unknown'];
$table->data[] = $data;
}
$output = html_print_table($table, true);
} else {
$output = 'No data available';
}
return $output;
}
/**
* Get description.
*
* @return string.
*/
public static function getDescription()
{
return __('OS quick report');
}
/**
* Get Name.
*
* @return string.
*/
public static function getName()
{
return 'os_quick_report';
}
}

View File

@ -235,6 +235,10 @@ class ServiceMapWidget extends Widget
$values['showLegend'] = $decoder['showLegend']; $values['showLegend'] = $decoder['showLegend'];
} }
if (isset($decoder['sunburst']) === true) {
$values['sunburst'] = $decoder['sunburst'];
}
return $values; return $values;
} }
@ -268,7 +272,20 @@ class ServiceMapWidget extends Widget
$fields = array_reduce( $fields = array_reduce(
$services_res, $services_res,
function ($carry, $item) { function ($carry, $item) {
$carry[$item['id']] = $item['name']; $parents = '';
if (class_exists('\PandoraFMS\Enterprise\Service') === true) {
try {
$service = new \PandoraFMS\Enterprise\Service($item['id']);
$ancestors = $service->getAncestors();
if (empty($ancestors) === false) {
$parents = '('.join('/', $ancestors).')';
}
} catch (\Exception $e) {
$parents = '';
}
}
$carry[$item['id']] = $item['name'].' '.$parents;
return $carry; return $carry;
}, },
[] []
@ -296,19 +313,16 @@ class ServiceMapWidget extends Widget
], ],
]; ];
// TODO refactoriced services: Hidden legend.
/*
// Show legend.
$inputs[] = [ $inputs[] = [
'label' => __('Show legend'), 'label' => __('Enable sunburst'),
'arguments' => [ 'arguments' => [
'name' => 'showLegend',
'id' => 'showLegend',
'type' => 'switch', 'type' => 'switch',
'value' => $values['showLegend'], 'name' => 'sunburst',
'class' => 'event-widget-input',
'value' => $values['sunburst'],
'return' => true,
], ],
]; ];
*/
return $inputs; return $inputs;
} }
@ -325,7 +339,9 @@ class ServiceMapWidget extends Widget
$values = parent::getPost(); $values = parent::getPost();
$values['serviceId'] = \get_parameter('serviceId', 0); $values['serviceId'] = \get_parameter('serviceId', 0);
// $values['showLegend'] = \get_parameter_switch('showLegend');
$values['sunburst'] = \get_parameter_switch('sunburst', 0);
return $values; return $values;
} }
@ -341,6 +357,7 @@ class ServiceMapWidget extends Widget
$size = parent::getSize(); $size = parent::getSize();
$output = '';
if (check_acl($config['id_user'], 0, 'AR') === 0) { if (check_acl($config['id_user'], 0, 'AR') === 0) {
$output .= '<div class="container-center">'; $output .= '<div class="container-center">';
$output .= \ui_print_error_message( $output .= \ui_print_error_message(
@ -367,42 +384,6 @@ class ServiceMapWidget extends Widget
$style = 'position: relative; text-align: center;'; $style = 'position: relative; text-align: center;';
$output .= "<div id='".$containerId."' style='".$style."'>"; $output .= "<div id='".$containerId."' style='".$style."'>";
// TODO refactoriced services: Hidden legend.
/*
if ($this->values['showLegend'] === 1) {
$output .= "<div id='container_servicemap_legend".$this->values['serviceId'].'_'.$this->cellId."'>";
$output .= '<table>';
$output .= "<tr class='legend_servicemap_title'><td colspan='3' style='padding-bottom: 10px; min-width: 177px;'><b>".__('Legend').'</b></td>';
$output .= "<td><img class='legend_servicemap_toggle' style='padding-bottom: 10px;' src='images/darrowup.png'></td></tr>";
$output .= "<tr class='legend_servicemap_item'><td>";
$output .= "<img src='images/service.png'>";
$output .= '</td><td>'.__('Services').'</td>';
// Coulour legend.
$output .= "<td rowspan='3'>";
$output .= '<table>';
$output .= "<tr><td class='legend_square'><div style='background-color: ".COL_CRITICAL.";'></div></td><td>".__('Critical').'</td></tr>';
$output .= "<tr><td class='legend_square'><div style='background-color: ".COL_WARNING.";'></div></td><td>".__('Warning').'</td></tr>';
$output .= "<tr><td class='legend_square'><div style='background-color: ".COL_NORMAL.";'></div></td><td>".__('Ok').'</td></tr>';
$output .= "<tr><td class='legend_square'><div style='background-color: ".COL_UNKNOWN.";'></div></td><td>".__('Unknown').'</td></tr>';
$output .= '</table>';
$output .= '</td></tr>';
$output .= "<tr class='legend_servicemap_item'><td>";
$output .= "<img src='images/agent.png'>";
$output .= '</td><td>'.__('Agents').'</td>';
$output .= '</tr>';
$output .= "<tr class='legend_servicemap_item'><td>";
$output .= "<img src='images/module.png'>";
$output .= '</td><td>'.__('Modules').'</td>';
$output .= '</tr>';
$output .= '</table>';
$output .= '</div>';
}
*/
// TODO: removed refactoriced services. Only 1 widget Zoom. // TODO: removed refactoriced services. Only 1 widget Zoom.
$sql = sprintf( $sql = sprintf(
'SELECT COUNT(*) 'SELECT COUNT(*)
@ -425,6 +406,8 @@ class ServiceMapWidget extends Widget
); );
// TODO:XXX fix draw service map. // TODO:XXX fix draw service map.
ob_start(); ob_start();
if ($this->values['sunburst'] === 0) {
servicemap_print_servicemap( servicemap_print_servicemap(
$this->values['serviceId'], $this->values['serviceId'],
false, false,
@ -433,6 +416,11 @@ class ServiceMapWidget extends Widget
$this->cellId, $this->cellId,
$disableZoom $disableZoom
); );
} else {
include_once $config['homedir'].'/include/graphs/functions_d3.php';
servicemap_print_sunburst($this->values['serviceId'], $size['width'], $size['height'], false);
}
$output .= ob_get_clean(); $output .= ob_get_clean();
$output .= '</div>'; $output .= '</div>';
return $output; return $output;

View File

@ -5,18 +5,18 @@
table-layout: fixed; table-layout: fixed;
} }
.agents_modules_table .next_previous_step { .next_previous_step {
width: 0.1%; width: 0.1%;
} }
.agents_modules_table .header_table_principal_cell { .header_table_principal_cell {
text-align: right !important; text-align: left !important;
padding-right: 13px; padding-right: 13px;
width: 20%; width: 5%;
} }
.agents_modules_table .header_table_caption_cell { .header_table_caption_cell {
height: 200px; text-align: center !important;
} }
.agents_modules_table .position_text_module { .agents_modules_table .position_text_module {

View File

@ -33,7 +33,6 @@ form.flex-row ul {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
flex-wrap: wrap;
align-content: center; align-content: center;
justify-content: space-between; justify-content: space-between;
flex: 1; flex: 1;
@ -316,3 +315,31 @@ div.multi-response-buttons {
.event_detail_tab_menu li { .event_detail_tab_menu li {
max-width: 160px; max-width: 160px;
} }
.select_tags {
width: 200px;
}
@media screen and (max-width: 1400px) {
.select_tags {
width: 165px;
}
}
@media screen and (max-width: 1250px) {
.select_tags {
width: 125px;
}
}
@media screen and (max-width: 1100px) {
.select_tags {
width: 100px;
}
form.flex-row div.filter_input.large {
flex: 1;
min-width: 600px;
max-width: 100%;
}
}

View File

@ -6048,9 +6048,9 @@ table.table_modal_alternate tr td:first-child {
font-family: "lato" !important; font-family: "lato" !important;
} }
.flot-text { .flot-text .flot-x-axis div {
width: 100%; white-space: normal;
font-family: inherit !important; word-break: break-all;
} }
/*Font header feedback*/ /*Font header feedback*/
@ -6226,6 +6226,9 @@ div.graph td.legendLabel {
div.graph div.legend div, div.graph div.legend div,
div.graph div.legend table { div.graph div.legend table {
top: 25px !important; top: 25px !important;
display: block;
overflow: auto;
text-align: left;
} }
.rotate_text_module { .rotate_text_module {
@ -9018,3 +9021,29 @@ div#err_msg_centralised {
#reset-styles var { #reset-styles var {
font-style: italic; font-style: italic;
} }
.div-col {
width: 33%;
display: flex;
flex-direction: row;
align-items: center;
padding-top: 15px;
}
.div-span {
width: 25%;
}
.div-input {
width: 75%;
}
@media screen and (max-width: 1369px) {
.div-col {
width: 50%;
display: flex;
flex-direction: row;
align-items: center;
padding-top: 15px;
}
}

View File

@ -340,8 +340,8 @@ a.pandora_pagination {
/* firts_task.css */ /* firts_task.css */
.new_task, .new_task,
div.new_task_cluster, div.new_task,
div.new_task_cluster > div { div.new_task > div {
background-color: #222; background-color: #222;
} }

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.762'; $version = '7.0NG.762';
$build = '220531'; $build = '220613';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -249,26 +249,21 @@ echo '<form method="post" action="?sec=view&sec2=operation/agentes/estado_agente
echo '<table cellpadding="4" cellspacing="4" class="databox filters bolder mrgn_btn_10px" width="100%">'; echo '<table cellpadding="4" cellspacing="4" class="databox filters bolder mrgn_btn_10px" width="100%">';
echo '<tr><td class="nowrap mw180px padding-right-2-imp">'; echo '<tr><td class="nowrap w100px padding-right-2-imp">';
echo __('Group').'&nbsp;'; echo __('Group').'&nbsp;'.'&nbsp;'.'&nbsp;';
$groups = users_get_groups(false, $access); $groups = users_get_groups(false, $access);
html_print_select_groups(false, $access, true, 'group_id', $group_id, 'this.form.submit()', '', '', false, false, true, '', false); html_print_select_groups(false, $access, true, 'group_id', $group_id, 'this.form.submit()', '', '', false, false, true, '', false);
echo '</td><td class="nowrap">'; echo '</td><td class="nowrap">'.'&nbsp;'.'&nbsp;'.'&nbsp;'.'&nbsp;'.'&nbsp;';
echo __('Recursion').'&nbsp;'; echo __('Recursion').'&nbsp;'.'&nbsp;'.'&nbsp;';
html_print_checkbox('recursion', 1, $recursion, false, false, 'this.form.submit()'); html_print_checkbox('recursion', 1, $recursion, false, false, 'this.form.submit()');
echo '</td><td class="nowrap">'; echo '</td><td class="nowrap">';
echo __('Search').'&nbsp;';
html_print_input_text('search', $search, '', 15);
echo '</td><td class="nowrap">';
$fields = []; $fields = [];
$fields[AGENT_STATUS_NORMAL] = __('Normal'); $fields[AGENT_STATUS_NORMAL] = __('Normal');
$fields[AGENT_STATUS_WARNING] = __('Warning'); $fields[AGENT_STATUS_WARNING] = __('Warning');
@ -277,12 +272,17 @@ $fields[AGENT_STATUS_UNKNOWN] = __('Unknown');
$fields[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); $fields[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$fields[AGENT_STATUS_NOT_INIT] = __('Not init'); $fields[AGENT_STATUS_NOT_INIT] = __('Not init');
echo __('Status').'&nbsp;'; echo __('Status').'&nbsp;'.'&nbsp;'.'&nbsp;';
html_print_select($fields, 'status', $status, 'this.form.submit()', __('All'), AGENT_STATUS_ALL, false, false, true, '', false, 'width: 90px;'); html_print_select($fields, 'status', $status, 'this.form.submit()', __('All'), AGENT_STATUS_ALL, false, false, true, '', false, 'width: 90px;');
echo '</td><td class="nowrap">'; echo '</td><td class="nowrap w100px">';
echo __('Search in custom fields').'&nbsp;'; echo __('Search').'&nbsp;'.'&nbsp;'.'&nbsp;';
html_print_input_text('search', $search, '', 15);
echo '</td><td class="nowrap w100px">';
echo __('Search in custom fields').'&nbsp;'.'&nbsp;'.'&nbsp;';
html_print_input_text('search_custom', $search_custom, '', 15); html_print_input_text('search_custom', $search_custom, '', 15);
echo '</td><td class="nowrap">'; echo '</td><td class="nowrap">';

View File

@ -533,15 +533,6 @@ if (!$is_metaconsole) {
$table->data[0][5] = html_print_select($rows_select, 'modulegroup', $modulegroup, '', __($is_none), -1, true, false, true, '', false, 'width: 120px;'); $table->data[0][5] = html_print_select($rows_select, 'modulegroup', $modulegroup, '', __($is_none), -1, true, false, true, '', false, 'width: 120px;');
$table->rowspan[0][6] = 3;
$table->data[0][6] = html_print_submit_button(
__('Show'),
'uptbutton',
false,
'class="sub search mgn_tp_0"',
true
);
$table->data[1][0] = __('Module name'); $table->data[1][0] = __('Module name');
$table->data[1][1] = html_print_autocomplete_modules( $table->data[1][1] = html_print_autocomplete_modules(
'ag_modulename', 'ag_modulename',
@ -579,7 +570,12 @@ if (empty($tags)) {
); );
} }
$table2 = new StdClass();
$table2->width = '100%';
$table2->class = 'filters';
$table2->style = [];
$table2->style[0] = 'font-weight: bold;';
$table2->style[1] = 'font-weight: bold;';
$network_available = db_get_sql( $network_available = db_get_sql(
'SELECT count(*) 'SELECT count(*)
@ -647,9 +643,9 @@ if (enterprise_installed()) {
} }
$table->data[2][0] = '<span>'.__('Server type').'</span>'; $table2->data[0][0] = '<span>'.__('Server type').'</span>';
$table->data[2][1] = html_print_select($typemodules, 'moduletype', $moduletype, '', __($is_none), '', true, false, true, '', false, 'width: 150px;'); $table2->data[0][1] = html_print_select($typemodules, 'moduletype', $moduletype, '', __($is_none), '', true, false, true, '', false, 'width: 150px;');
$monitor_options = [ $monitor_options = [
0 => __('All'), 0 => __('All'),
@ -657,21 +653,18 @@ $monitor_options = [
2 => __('Only disabled'), 2 => __('Only disabled'),
]; ];
$table->data[2][2] = '<span>'.__('Show monitors...').'</span>'; $table2->data[0][2] = '<span>'.__('Show monitors...').'</span>';
$table->data[2][3] = html_print_select($monitor_options, 'module_option', $module_option, '', '', '', true, false, true, '', false, 'width: 150px;'); $table2->data[0][3] = html_print_select($monitor_options, 'module_option', $module_option, '', '', '', true, false, true, '', false, 'width: 150px;');
$min_hours_val = empty($min_hours_status) ? '' : (int) $min_hours_status; $min_hours_val = empty($min_hours_status) ? '' : (int) $min_hours_status;
$table->data[2][4] = '<span>'.__('Min. hours in current status').'</span>'; $table2->data[0][4] = '<span>'.__('Min. hours in current status').'</span>';
$table->data[2][5] = html_print_input_text('min_hours_status', $min_hours_val, '', 12, 20, true); $table2->data[0][5] = html_print_input_text('min_hours_status', $min_hours_val, '', 12, 20, true);
$table->data[3][0] = '<span id="datatypetittle"'; $table2->data[1][0] = '<span id="datatypetittle"';
$table2->data[1][0] .= '>'.__('Data type').'</span>';
$table->data[3][0] .= '>'.__('Data type').'</span>'; $table2->data[1][1] .= '<div id="datatypebox">';
$table->data[3][1] .= '<div id="datatypebox">';
switch ($moduletype) { switch ($moduletype) {
@ -744,37 +737,33 @@ switch ($moduletype) {
} }
$a = db_get_all_rows_sql($sql); $a = db_get_all_rows_sql($sql);
$table->data[3][1] .= '<select id="datatype" name="datatype" '; $table2->data[1][1] .= '<select id="datatype" name="datatype" style="height: 28px;" ';
$table->data[3][1] .= '>'; $table2->data[1][1] .= '>';
$table->data[3][1] .= '<option name="datatype" value="">'.__($is_none).'</option>'; $table2->data[1][1] .= '<option name="datatype" value="">'.__($is_none).'</option>';
foreach ($a as $valor) { foreach ($a as $valor) {
$table->data[3][1] .= '<option name="datatype" value="'.$valor['id_tipo'].'" '; $table2->data[1][1] .= '<option name="datatype" value="'.$valor['id_tipo'].'" ';
if ($valor['id_tipo'] == $datatype) { if ($valor['id_tipo'] == $datatype) {
$table->data[3][1] .= 'selected'; $table2->data[1][1] .= 'selected';
} }
$table->data[3][1] .= '>'.$valor['descripcion'].'</option>'; $table2->data[1][1] .= '>'.$valor['descripcion'].'</option>';
} }
$table->data[3][1] .= '</select>'; $table2->data[1][1] .= '</select>';
$table2->data[1][1] .= '</div>';
$table->data[3][1] .= '</div>';
$check_not_condition = ''; $check_not_condition = '';
if ($not_condition !== '') { if ($not_condition !== '') {
$check_not_condition = true; $check_not_condition = true;
} }
$table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you check this option, those elements that do NOT meet any of the requirements will be shown'), true); $table2->data[1][2] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you check this option, those elements that do NOT meet any of the requirements will be shown'), true);
$table->data[4][1] = html_print_div( $table2->data[1][3] = html_print_div(
[ [
'class' => 'w120px mrgn_5px mrgn_lft_0px mrgn_right_0px', 'class' => 'w120px mrgn_5px mrgn_lft_0px mrgn_right_0px',
'content' => html_print_input( 'content' => html_print_input(
@ -792,35 +781,13 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
true true
); );
$table_custom_fields = new stdClass();
$table_custom_fields->class = 'filters';
$table_custom_fields->width = '100%';
$table_custom_fields->style = [];
$table_custom_fields->style[0] = 'font-weight: bold;';
// Style is different in metaconsole.
if ($is_metaconsole === false) {
$table_custom_fields->style[0] = 'font-weight: bold; width: 150px;';
}
if ($is_metaconsole === true) {
$table_custom_fields->styleTable = 'margin-left:0px; margin-top:15px;';
$table_custom_fields->cellpadding = '0';
$table_custom_fields->cellspacing = '0';
}
$table_custom_fields->colspan = [];
$table_custom_fields->data = [];
$custom_fields = db_get_all_fields_in_table('tagent_custom_fields'); $custom_fields = db_get_all_fields_in_table('tagent_custom_fields');
if ($custom_fields === false) { if ($custom_fields === false) {
$custom_fields = []; $custom_fields = [];
} }
$div_custom_fields = '<div class="flex-row">';
foreach ($custom_fields as $custom_field) { foreach ($custom_fields as $custom_field) {
$row = [];
$row[0] = $custom_field['name'];
$custom_field_value = ''; $custom_field_value = '';
if (empty($ag_custom_fields) === false) { if (empty($ag_custom_fields) === false) {
$custom_field_value = $ag_custom_fields[$custom_field['id_field']]; $custom_field_value = $ag_custom_fields[$custom_field['id_field']];
@ -829,37 +796,38 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
} }
} }
$row[1] = html_print_input_text('ag_custom_fields['.$custom_field['id_field'].']', $custom_field_value, '', 100, 300, true); $div_custom_fields .= '<div class="div-col">';
$table_custom_fields->data[] = $row; $div_custom_fields .= '<div class="div-span">';
$div_custom_fields .= '<span >'.$custom_field['name'].'</span>';
$div_custom_fields .= '</div>';
$div_custom_fields .= '<div class="div-input">';
$div_custom_fields .= html_print_input_text(
'ag_custom_fields['.$custom_field['id_field'].']',
$custom_field_value,
'',
0,
300,
true,
false,
false,
'',
'div-input'
);
$div_custom_fields .= '</div>';
$div_custom_fields .= '</div>';
} }
$div_custom_fields .= '</div>';
$filters = '<form method="post" action="index.php?sec='.$section.'&sec2=operation/agentes/status_monitor&refr='.$refr.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&module_option='.$module_option.'&ag_modulename='.$ag_modulename.'&moduletype='.$moduletype.'&datatype='.$datatype.'&status='.$status.'&sort_field='.$sortField.'&sort='.$sort.'&pure='.$config['pure'].$ag_custom_fields_params.'">'; $filters = '<form method="post" action="index.php?sec='.$section.'&sec2=operation/agentes/status_monitor&refr='.$refr.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&module_option='.$module_option.'&ag_modulename='.$ag_modulename.'&moduletype='.$moduletype.'&datatype='.$datatype.'&status='.$status.'&sort_field='.$sortField.'&sort='.$sort.'&pure='.$config['pure'].$ag_custom_fields_params.'">';
$table2->colspan[2][0] = 7;
if (is_metaconsole() === true) { $table2->cellstyle[2][0] = 'padding-left: 10px;';
$table->colspan[5][0] = 7; $table2->data[2][0] = ui_toggle(
$table->cellstyle[5][0] = 'padding: 10px;'; $div_custom_fields,
$table->data[5][0] = ui_toggle(
html_print_table($table_custom_fields, true),
__('Advanced Options'),
'',
'',
true,
true
);
$filters .= html_print_table($table, true);
$filters .= '</form>';
ui_toggle($filters, __('Show filters'), '', '', false);
} else {
$table->colspan[5][0] = 7;
$table->cellstyle[5][0] = 'padding-left: 10px;';
$table->data[5][0] = ui_toggle(
html_print_table(
$table_custom_fields,
true
),
__('Agent custom fields'), __('Agent custom fields'),
'', '',
'', '',
@ -870,8 +838,39 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
'white_table_graph' 'white_table_graph'
); );
$table->colspan[3][0] = 7;
$table->cellstyle[3][0] = 'padding-left: 10px;padding-bottom: 0px;';
$table->data[3][0] = ui_toggle(
html_print_table(
$table2,
true
),
__('Advanced options'),
'',
'',
true,
true,
'',
'white-box-content',
'white_table_graph'
);
$table->colspan[4][0] = 7;
$table->cellstyle[4][0] = 'padding-top: 0px;';
$table->data[4][0] = html_print_submit_button(
__('Show'),
'uptbutton',
false,
'class="sub search mgn_tp_0 right"',
true
);
$filters .= html_print_table($table, true); $filters .= html_print_table($table, true);
$filters .= '</form>'; $filters .= '</form>';
if (is_metaconsole() === true) {
ui_toggle($filters, __('Show filters'), '', '', false);
} else {
echo $filters; echo $filters;
} }

View File

@ -697,6 +697,15 @@ if (is_ajax()) {
asort($result); asort($result);
} else { } else {
if ($idAgents[0] < 0) { if ($idAgents[0] < 0) {
// Get all user's groups.
$id_group = array_keys(users_get_groups($config['id_user']));
if (is_array($id_group)) {
$id_group = implode(',', $id_group);
}
$where_tags .= ' AND tagente.id_grupo IN ('.$id_group.')';
if ($selection_mode == 'common') { if ($selection_mode == 'common') {
$sql_agent_total = 'SELECT count(*) FROM tagente WHERE disabled=0'; $sql_agent_total = 'SELECT count(*) FROM tagente WHERE disabled=0';
$agent_total = db_get_value_sql($sql_agent_total); $agent_total = db_get_value_sql($sql_agent_total);
@ -705,13 +714,13 @@ if (is_ajax()) {
JOIN (SELECT COUNT(*) AS num_names, nombre FROM tagente_modulo JOIN (SELECT COUNT(*) AS num_names, nombre FROM tagente_modulo
WHERE disabled=0 AND delete_pending=0 GROUP BY nombre) AS tj WHERE disabled=0 AND delete_pending=0 GROUP BY nombre) AS tj
ON tj.num_names = $agent_total AND tj.nombre = t1.nombre %s %s", ON tj.num_names = $agent_total AND tj.nombre = t1.nombre %s %s",
$sql_tags_join, ($sql_tags_join === '') ? 'INNER JOIN tagente ON tagente.id_agente = t1.id_agente' : '',
(empty($where_tags)) ? '' : " WHERE 1=1 $where_tags" (empty($where_tags)) ? '' : " WHERE 1=1 $where_tags"
); );
} else { } else {
$sql = sprintf( $sql = sprintf(
'SELECT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1 %s %s', 'SELECT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1 %s %s',
$sql_tags_join, ($sql_tags_join === '') ? 'INNER JOIN tagente ON tagente.id_agente = t1.id_agente' : '',
(empty($where_tags)) ? '' : " WHERE 1=1 $where_tags" (empty($where_tags)) ? '' : " WHERE 1=1 $where_tags"
); );
} }
@ -1403,7 +1412,7 @@ if ($agent_interfaces_count > 0) {
] ]
).'</a>'; ).'</a>';
if ($tab == 'interface') { if ($tab === 'interface') {
$interfacetab['active'] = true; $interfacetab['active'] = true;
} else { } else {
$interfacetab['active'] = false; $interfacetab['active'] = false;
@ -1420,19 +1429,19 @@ $alerttab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_ag
] ]
).'</a>'; ).'</a>';
if ($tab == 'alert') { if ($tab === 'alert') {
$alerttab['active'] = true; $alerttab['active'] = true;
} else { } else {
$alerttab['active'] = false; $alerttab['active'] = false;
} }
// Inventory. // Inventory.
$inventoryCount = db_get_num_rows('SELECT id_agent_module_inventory FROM tagent_module_inventory WHERE id_agente = '.$agent['id_agente']);
$inventorytab = enterprise_hook('inventory_tab'); $inventorytab = enterprise_hook('inventory_tab');
if ($inventorytab == -1) { if ($inventorytab == -1 || $inventoryCount === 0) {
$inventorytab = ''; $inventorytab = '';
} }
// Collection. // Collection.
$collectiontab = enterprise_hook('collection_tab'); $collectiontab = enterprise_hook('collection_tab');
if ($collectiontab == -1) { if ($collectiontab == -1) {

View File

@ -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 * Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -46,19 +46,19 @@ check_login();
enterprise_include_once('/include/class/CommandCenter.class.php'); enterprise_include_once('/include/class/CommandCenter.class.php');
$event_a = check_acl($config['id_user'], 0, 'ER'); $event_a = (bool) check_acl($config['id_user'], 0, 'ER');
$event_w = check_acl($config['id_user'], 0, 'EW'); $event_w = (bool) check_acl($config['id_user'], 0, 'EW');
$event_m = check_acl($config['id_user'], 0, 'EM'); $event_m = (bool) check_acl($config['id_user'], 0, 'EM');
if (! $event_a if ($event_a === false
&& ! $event_w && $event_w === false
&& ! $event_m && $event_m === false
) { ) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
'Trying to access event viewer' 'Trying to access event viewer'
); );
if (is_ajax()) { if (is_ajax() === true) {
return ['error' => 'noaccess']; return ['error' => 'noaccess'];
} }
@ -67,14 +67,14 @@ if (! $event_a
} }
$access = ($event_a == true) ? 'ER' : (($event_w == true) ? 'EW' : (($event_m == true) ? 'EM' : 'ER')); $access = ($event_a === true) ? 'ER' : (($event_w === true) ? 'EW' : (($event_m === true) ? 'EM' : 'ER'));
$readonly = false; $readonly = false;
if (is_metaconsole() === false if (is_metaconsole() === false
&& isset($config['event_replication']) && isset($config['event_replication']) === true
&& $config['event_replication'] == 1 && (int) $config['event_replication'] === 1
&& $config['show_events_in_local'] == 1 && (int) $config['show_events_in_local'] === 1
) { ) {
$readonly = true; $readonly = true;
} }
@ -100,7 +100,7 @@ $default_filter = [
]; ];
$fb64 = get_parameter('fb64', null); $fb64 = get_parameter('fb64', null);
if (isset($fb64)) { if (isset($fb64) === true) {
$filter = json_decode(base64_decode($fb64), true); $filter = json_decode(base64_decode($fb64), true);
$filter['tag_with'] = []; $filter['tag_with'] = [];
$filter['tag_without'] = []; $filter['tag_without'] = [];
@ -238,20 +238,20 @@ $custom_data = get_parameter(
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
// Connect to node database. // Connect to node database.
$id_node = $server_id; $id_node = (int) $server_id;
if ($id_node != 0) { if ($id_node !== 0) {
if (metaconsole_connect(null, $id_node) != NOERR) { if (metaconsole_connect(null, $id_node) !== NOERR) {
return false; return false;
} }
} }
} }
if (empty($text_agent) && empty($id_agent) === false) { if (empty($text_agent) === true && empty($id_agent) === false) {
$text_agent = agents_get_alias($id_agent); $text_agent = agents_get_alias($id_agent);
} }
if (empty($text_module) && empty($id_agent_module) === false) { if (empty($text_module) === true && empty($id_agent_module) === false) {
$text_module = modules_get_agentmodule_name($id_agent_module); $text_module = modules_get_agentmodule_name($id_agent_module);
$text_agent = agents_get_alias(modules_get_agentmodule_agent($id_agent_module)); $text_agent = agents_get_alias(modules_get_agentmodule_agent($id_agent_module));
} }
@ -501,7 +501,7 @@ if ($load_filter_id === 0) {
// Do not load the user filter if we come from the 24h event graph. // Do not load the user filter if we come from the 24h event graph.
$from_event_graph = get_parameter('filter[from_event_graph]', $filter['from_event_graph']); $from_event_graph = get_parameter('filter[from_event_graph]', $filter['from_event_graph']);
if ($loaded_filter !== false && $from_event_graph != 1 && !isset($fb64)) { if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false) {
$filter = events_get_event_filter($loaded_filter['id_filter']); $filter = events_get_event_filter($loaded_filter['id_filter']);
if ($filter !== false) { if ($filter !== false) {
$id_group = $filter['id_group']; $id_group = $filter['id_group'];
@ -611,9 +611,8 @@ $data[0] = html_print_select(
true, true,
true, true,
true, true,
'', 'select_tags',
false, false
'width: 200px;'
); );
$data[1] = html_print_image( $data[1] = html_print_image(
@ -654,9 +653,8 @@ $data[2] = html_print_select(
true, true,
true, true,
true, true,
'', 'select_tags',
false, false
'width: 200px;'
); );
$tabletags_with->data[] = $data; $tabletags_with->data[] = $data;
@ -688,9 +686,8 @@ $data[0] = html_print_select(
true, true,
true, true,
true, true,
'', 'select_tags',
false, false
'width: 200px;'
); );
$data[1] = html_print_image( $data[1] = html_print_image(
'images/darrowright.png', 'images/darrowright.png',
@ -727,9 +724,8 @@ $data[2] = html_print_select(
true, true,
true, true,
true, true,
'', 'select_tags',
false, false
'width: 200px;'
); );
$tabletags_without->data[] = $data; $tabletags_without->data[] = $data;
$tabletags_without->rowclass[] = ''; $tabletags_without->rowclass[] = '';
@ -1144,15 +1140,19 @@ $in = '<div class="filter_input"><label>'.__('Free search').'</label>';
$in .= $data.'</div>'; $in .= $data.'</div>';
$inputs[] = $in; $inputs[] = $in;
if (is_array($severity) === false) {
if (empty($severity) === true && $severity !== '0') { if (empty($severity) === true && $severity !== '0') {
$severity = -1; $severity = -1;
} else {
$severity = explode(',', $severity);
}
} }
// Criticity - severity. // Criticity - severity.
$data = html_print_select( $data = html_print_select(
get_priorities(), get_priorities(),
'severity', 'severity',
explode(',', $severity), $severity,
'', '',
__('All'), __('All'),
-1, -1,
@ -1160,7 +1160,10 @@ $data = html_print_select(
true, true,
true, true,
'', '',
false false,
false,
false,
3
); );
$in = '<div class="filter_input"><label>'.__('Severity').'</label>'; $in = '<div class="filter_input"><label>'.__('Severity').'</label>';
$in .= $data.'</div>'; $in .= $data.'</div>';

View File

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

View File

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

View File

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

View File

@ -2578,7 +2578,7 @@ CREATE TABLE IF NOT EXISTS `tpolicy_group_agents` (
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tdashboard` ( CREATE TABLE IF NOT EXISTS `tdashboard` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(60) NOT NULL DEFAULT '', `name` TEXT NOT NULL DEFAULT '',
`id_user` VARCHAR(60) NOT NULL DEFAULT '', `id_user` VARCHAR(60) NOT NULL DEFAULT '',
`id_group` INT NOT NULL DEFAULT 0, `id_group` INT NOT NULL DEFAULT 0,
`active` TINYINT NOT NULL DEFAULT 0, `active` TINYINT NOT NULL DEFAULT 0,
@ -2817,6 +2817,7 @@ CREATE TABLE IF NOT EXISTS `tservice` (
`cascade_protection` TINYINT NOT NULL DEFAULT 0, `cascade_protection` TINYINT NOT NULL DEFAULT 0,
`evaluate_sla` INT NOT NULL DEFAULT 0, `evaluate_sla` INT NOT NULL DEFAULT 0,
`is_favourite` TINYINT NOT NULL DEFAULT 0, `is_favourite` TINYINT NOT NULL DEFAULT 0,
`enable_sunburst` TINYINT NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB ) ENGINE=InnoDB
COMMENT = 'Table to define services to monitor' COMMENT = 'Table to define services to monitor'

View File

@ -219,7 +219,7 @@ INSERT INTO `tlink` VALUES
(1,'Documentation','https://pandorafms.com/manual'), (1,'Documentation','https://pandorafms.com/manual'),
(2,'Enterprise Edition','http://pandorafms.com'), (2,'Enterprise Edition','http://pandorafms.com'),
(3,'Report a bug','https://github.com/pandorafms/pandorafms/issues'), (3,'Report a bug','https://github.com/pandorafms/pandorafms/issues'),
(4,'Suggest new feature','http://forums.pandorafms.com/index.php?board=22.0'), (4,'Suggest new feature','https://pandorafms.com/community/beta-program/'),
(5,'Module library','http://library.pandorafms.com/'); (5,'Module library','http://library.pandorafms.com/');
UNLOCK TABLES; UNLOCK TABLES;

View File

@ -2077,7 +2077,8 @@ class Client
'status' => $status, 'status' => $status,
'message' => $msg, 'message' => $msg,
'extra' => $extra, 'extra' => $extra,
] ],
JSON_UNESCAPED_UNICODE
); );
if ($field_exists === false) { if ($field_exists === false) {

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.762-220531 Version: 7.0NG.762-220613
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -68,10 +68,6 @@ dbhost 127.0.0.1
#dbport 3306 #dbport 3306
# By default, parent agent will not be updated
#update_parent 0
# verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy) # verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy)
# -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and # -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and
# set to 1 or 3 on production enviroments. # set to 1 or 3 on production enviroments.

View File

@ -68,10 +68,6 @@ dbhost 127.0.0.1
#dbport 3306 #dbport 3306
# By default, parent agent will not be updated
#update_parent 0
# verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy) # verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy)
# -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and # -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and
# set to 1 or 3 on production enviroments. # set to 1 or 3 on production enviroments.

View File

@ -79,10 +79,6 @@ dbssl 0
# dbsslcapath # dbsslcapath
# By default, parent agent will not be updated
#update_parent 0
# verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy) # verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy)
# -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and # -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and
# set to 1 or 3 on production enviroments. # set to 1 or 3 on production enviroments.
@ -434,6 +430,7 @@ sample_agent_interval 600
# Update parent from the agent xml # Update parent from the agent xml
update_parent 1 update_parent 1
# #
# #
# This enable realtime reverse geocoding using Google Maps public api. # This enable realtime reverse geocoding using Google Maps public api.

View File

@ -68,10 +68,6 @@ dbhost 192.168.55.1
#dbport 3306 #dbport 3306
# By default, parent agent will not be updated
#update_parent 0
# verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy) # verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy)
# -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and # -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and
# set to 1 or 3 on production enviroments. # set to 1 or 3 on production enviroments.

View File

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

View File

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

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.762 %define version 7.0NG.762
%define release 220531 %define release 220613
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.762 %define version 7.0NG.762
%define release 220531 %define release 220613
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

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

View File

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

View File

@ -21,7 +21,7 @@ use JSON qw(decode_json encode_json);
use MIME::Base64; use MIME::Base64;
use Encode qw(decode encode_utf8); use Encode qw(decode encode_utf8);
use LWP::Simple; use LWP::Simple;
use Data::Dumper; #use Data::Dumper;
# Default lib dir for RPM and DEB packages # Default lib dir for RPM and DEB packages
BEGIN { push @INC, '/usr/lib/perl5'; } BEGIN { push @INC, '/usr/lib/perl5'; }
@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.762 Build 220531"; my $version = "7.0NG.762 Build 220613";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);
@ -375,19 +375,42 @@ sub pandora_disable_group ($$$) {
exit; exit;
} }
if(is_metaconsole($conf) == 1) {
my $servers = enterprise_hook('get_metaconsole_setup_servers',[$dbh]);
my @servers_id = split(',',$servers);
foreach my $server (@servers_id) {
my $dbh_metaconsole = enterprise_hook('get_node_dbh',[$conf, $server, $dbh]);
if ($group == 0){
# Extract all the names of the pandora agents if it is for all = 0.
@agents_bd = get_db_rows ($dbh_metaconsole, 'SELECT id_agente FROM tagente');
}
else {
# Extract all the names of the pandora agents if it is for group.
@agents_bd = get_db_rows ($dbh_metaconsole, 'SELECT id_agente FROM tagente WHERE id_grupo = ?', $group);
}
foreach my $id_agent (@agents_bd) {
# Call the API.
$result += api_call(
$conf, 'set', 'disabled_and_standby', $id_agent->{'id_agente'}, $server, '1|1'
);
}
}
} else {
if ($group == 0){ if ($group == 0){
# Extract all the names of the pandora agents if it is for all = 0. # Extract all the names of the pandora agents if it is for all = 0.
@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente'); @agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente');
# Update bbdd. # Update bbdd.
db_do ($dbh, "UPDATE tagente SET disabled = 1"); $result = db_update ($dbh, "UPDATE tagente SET disabled = 1");
} }
else { else {
# Extract all the names of the pandora agents if it is for group. # Extract all the names of the pandora agents if it is for group.
@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente WHERE id_grupo = ?', $group); @agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente WHERE id_grupo = ?', $group);
# Update bbdd. # Update bbdd.
db_do ($dbh, "UPDATE tagente SET disabled = 1 WHERE id_grupo = $group"); $result = db_update ($dbh, "UPDATE tagente SET disabled = 1 WHERE id_grupo = $group");
} }
foreach my $name_agent (@agents_bd) { foreach my $name_agent (@agents_bd) {
@ -399,6 +422,7 @@ sub pandora_disable_group ($$$) {
'1' '1'
); );
} }
}
return $result; return $result;
} }
@ -1138,7 +1162,8 @@ sub cli_disable_group() {
print_log "[INFO] Disabling group '$group_name'\n\n"; print_log "[INFO] Disabling group '$group_name'\n\n";
} }
pandora_disable_group ($conf, $dbh, $id_group); my $result = pandora_disable_group ($conf, $dbh, $id_group);
print_log "[INFO] Disabled ".$result." agents from group ".$group_name."\n\n";
} }
############################################################################## ##############################################################################
@ -3078,7 +3103,7 @@ sub cli_user_update() {
$new_value = md5($new_value); $new_value = md5($new_value);
} }
else { else {
print_log "[ERROR] Field '$field' doesnt exist\n\n"; print_log "[ERROR] Field '$field' doesn't exist\n\n";
exit; exit;
} }
@ -3107,7 +3132,7 @@ sub cli_agent_update_custom_fields() {
my $found = 0; my $found = 0;
if($agent_name eq '') { if($agent_name eq '') {
print_log "[ERROR] Agent '$id_agent' doesnt exist\n\n"; print_log "[ERROR] Agent '$id_agent' doesn't exist\n\n";
exit; exit;
} }
@ -3116,7 +3141,7 @@ sub cli_agent_update_custom_fields() {
if($custom_field eq '') { if($custom_field eq '') {
print_log "[ERROR] Field '$field' doesnt exist\n\n"; print_log "[ERROR] Field '$field' doesn't exist\n\n";
exit; exit;
} }
@ -3142,7 +3167,7 @@ sub cli_agent_update_custom_fields() {
if($result == "0E0"){ if($result == "0E0"){
print_log "[ERROR] Error updating field '$field'\n\n"; print_log "[ERROR] Error updating field '$field'\n\n";
} else { } else {
print_log "[INFO] Field '$field' updated succesfully!\n\n"; print_log "[INFO] Field '$field' updated successfully!\n\n";
} }
exit; exit;
@ -3210,7 +3235,7 @@ sub cli_agent_update() {
# Check if the address already exist # Check if the address already exist
my $address_id = get_addr_id($dbh,$new_value); my $address_id = get_addr_id($dbh,$new_value);
# If the addres doesnt exist, we add it to the addresses list # If the addres doesn't exist, we add it to the addresses list
if($address_id == -1) { if($address_id == -1) {
$address_id = add_address($dbh,$new_value); $address_id = add_address($dbh,$new_value);
} }
@ -3233,7 +3258,7 @@ sub cli_agent_update() {
$field = 'direccion'; $field = 'direccion';
} }
else { else {
print_log "[ERROR] Field '$field' doesnt exist\n\n"; print_log "[ERROR] Field '$field' doesn't exist\n\n";
exit; exit;
} }
@ -3299,7 +3324,7 @@ sub cli_alert_template_update() {
$field = 'id_group'; $field = 'id_group';
} }
else { else {
print_log "[ERROR] Field '$field' doesnt exist\n\n"; print_log "[ERROR] Field '$field' doesn't exist\n\n";
exit; exit;
} }
@ -3346,7 +3371,7 @@ sub pandora_check_network_module_fields($) {
# Check if the address already exist # Check if the address already exist
my $address_id = get_addr_id($dbh,$field_value->{'new_value'}); my $address_id = get_addr_id($dbh,$field_value->{'new_value'});
# If the addres doesnt exist, we add it to the addresses list # If the addres doesn't exist, we add it to the addresses list
if($address_id == -1) { if($address_id == -1) {
$address_id = add_address($dbh,$field_value->{'new_value'}); $address_id = add_address($dbh,$field_value->{'new_value'});
} }
@ -3419,7 +3444,7 @@ sub pandora_check_snmp_module_fields($) {
# Check if the address already exist # Check if the address already exist
my $address_id = get_addr_id($dbh,$field_value->{'new_value'}); my $address_id = get_addr_id($dbh,$field_value->{'new_value'});
# If the addres doesnt exist, we add it to the addresses list # If the addres doesn't exist, we add it to the addresses list
if($address_id == -1) { if($address_id == -1) {
$address_id = add_address($dbh,$field_value->{'new_value'}); $address_id = add_address($dbh,$field_value->{'new_value'});
} }
@ -3482,7 +3507,7 @@ sub pandora_check_plugin_module_fields($) {
# Check if the address already exist # Check if the address already exist
my $address_id = get_addr_id($dbh,$field_value->{'new_value'}); my $address_id = get_addr_id($dbh,$field_value->{'new_value'});
# If the addres doesnt exist, we add it to the addresses list # If the addres doesn't exist, we add it to the addresses list
if($address_id == -1) { if($address_id == -1) {
$address_id = add_address($dbh,$field_value->{'new_value'}); $address_id = add_address($dbh,$field_value->{'new_value'});
} }
@ -3584,7 +3609,7 @@ sub cli_module_update() {
my $module_group_id = get_module_group_id($dbh,$new_value); my $module_group_id = get_module_group_id($dbh,$new_value);
if ($module_group_id == -1) { if ($module_group_id == -1) {
print_log "[ERROR] Module group '$new_value' doesnt exist\n\n"; print_log "[ERROR] Module group '$new_value' doesn't exist\n\n";
exit; exit;
} }
$field = 'id_module_group'; $field = 'id_module_group';
@ -3728,7 +3753,7 @@ sub cli_module_update() {
my $module_group_id = get_module_group_id($dbh,$new_value); my $module_group_id = get_module_group_id($dbh,$new_value);
if ($module_group_id == -1) { if ($module_group_id == -1) {
print_log "[ERROR] Module group '$new_value' doesnt exist\n\n"; print_log "[ERROR] Module group '$new_value' doesn't exist\n\n";
exit; exit;
} }
$field = 'id_module_group'; $field = 'id_module_group';
@ -4749,7 +4774,7 @@ if($result == 0) {
print_log "[ERROR] Alert could not be validated\n\n"; print_log "[ERROR] Alert could not be validated\n\n";
} }
else { else {
print_log "[INFO] Alert succesfully validated\n\n"; print_log "[INFO] Alert successfully validated\n\n";
; ;
} }
@ -5539,8 +5564,6 @@ sub cli_get_agents() {
my $head_print = 0; my $head_print = 0;
# use Data::Dumper;
foreach my $agent (@agents) { foreach my $agent (@agents) {
if($status ne '') { if($status ne '') {
@ -5589,7 +5612,7 @@ sub cli_delete_conf_file() {
} }
if($conf_deleted == 1 || $md5_deleted == 1) { if($conf_deleted == 1 || $md5_deleted == 1) {
print_log "[INFO] Local conf files of the agent '$agent_name' has been deleted succesfully\n\n"; print_log "[INFO] Local conf files of the agent '$agent_name' has been deleted successfully\n\n";
} }
else { else {
print_log "[ERROR] Local conf file of the agent '$agent_name' was not found\n\n"; print_log "[ERROR] Local conf file of the agent '$agent_name' was not found\n\n";
@ -5607,7 +5630,7 @@ sub cli_delete_conf_file() {
} }
if($conf_deleted == 1 || $md5_deleted == 1) { if($conf_deleted == 1 || $md5_deleted == 1) {
print_log "[INFO] Local conf files of the agent '$agent_name' has been deleted succesfully\n\n"; print_log "[INFO] Local conf files of the agent '$agent_name' has been deleted successfully\n\n";
} }
else { else {
print_log "[ERROR] Local conf file of the agent '$agent_name' was not found\n\n"; print_log "[ERROR] Local conf file of the agent '$agent_name' was not found\n\n";
@ -5913,7 +5936,7 @@ sub cli_create_group() {
$parent_group_id, 0, 0, '', 0, $description); $parent_group_id, 0, 0, '', 0, $description);
}; };
if ($@) { if ($@) {
print_log "[ERROR] Problems with IDS and doesnt created group\n\n"; print_log "[ERROR] Problems with IDS and doesn't created group\n\n";
$count_error++; $count_error++;
next; next;
} }
@ -5953,6 +5976,24 @@ sub cli_delete_group() {
$group_id = db_do ($dbh, 'DELETE FROM tgrupo WHERE nombre=?', safe_input($group_name)); $group_id = db_do ($dbh, 'DELETE FROM tgrupo WHERE nombre=?', safe_input($group_name));
# Delete on nodes too if metaconsole.
if(is_metaconsole($conf) == 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
my $servers = enterprise_hook('get_metaconsole_setup_servers',[$dbh]);
my @servers_id = split(',',$servers);
foreach my $server (@servers_id) {
my $dbh_node = enterprise_hook('get_node_dbh',[$conf, $server, $dbh]);
my $group_id = get_group_id($dbh_node,$group_name);
exist_check($group_id, 'group name', $group_name);
$group_id = db_do ($dbh_node, 'DELETE FROM tgrupo WHERE nombre=?', safe_input($group_name));
}
}
if($group_id == -1) { if($group_id == -1) {
print_log "[ERROR] A problem has been ocurred deleting group '$group_name'\n\n"; print_log "[ERROR] A problem has been ocurred deleting group '$group_name'\n\n";
}else{ }else{
@ -6563,7 +6604,7 @@ sub cli_update_special_day() {
$field = 'id_group'; $field = 'id_group';
} }
else { else {
print_log "[ERROR] Field '$field' doesnt exist\n\n"; print_log "[ERROR] Field '$field' doesn't exist\n\n";
exit; exit;
} }