Merge remote-tracking branch 'origin/develop' into ent-8896-discovery-y-satelite-cuando-detectamos-equipos-de-red-faltan-datos-basicos

This commit is contained in:
Calvo 2022-06-16 11:12:32 +02:00
commit f03b76a3ad
160 changed files with 104067 additions and 79703 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}
yum install -y http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm &>> $LOGFILE # Insatall pandora agent
echo -e "${cyan}Instaling Pandora FMS agent...${reset}" ${green}OK${reset} $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'
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"
} }
@ -257,6 +256,8 @@ console_dependencies=" \
poppler-data \ poppler-data \
php-yaml \ php-yaml \
mod_ssl \ mod_ssl \
libzstd \
openldap-clients \
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm" http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies" execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
@ -422,7 +423,7 @@ execute_cmd "curl -LSs --output pandorafms_agent_unix-7.0NG.noarch.rpm ${PANDORA
execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages" execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages"
# Copy gotty utility # Copy gotty utility
execute_cmd "wget https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz" 'Dowloading gotty util' execute_cmd "wget https://pandorafms.com/library/wp-content/uploads/2019/11/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util' execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'

View File

@ -14,11 +14,13 @@ 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='2022052501'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables # define default variables
[ "$TZ" ] || TZ="Europe/Madrid" [ "$TZ" ] || TZ="Europe/Madrid"
[ "$MYVER" ] || MYVER=57
[ "$PHPVER" ] || PHPVER=7
[ "$DBHOST" ] || DBHOST=127.0.0.1 [ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora [ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora [ "$DBUSER" ] || DBUSER=pandora
@ -84,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"
} }
@ -203,15 +204,28 @@ fi
#Installing wget #Installing wget
execute_cmd "dnf install -y wget" "Installing wget" execute_cmd "dnf install -y wget" "Installing wget"
#Installing extra repositiries #Installing php
execute_cmd "dnf module reset -y php " "Disabling standard PHP module" execute_cmd "dnf module reset -y php " "Disabling standard PHP module"
execute_cmd "dnf module install -y php:remi-7.4" "Configuring PHP" if [ "$PHPVER" -ne '8' ] ; then
execute_cmd "dnf module install -y php:remi-7.4" "Configuring PHP 7"
fi
if [ "$PHPVER" -eq '8' ] ; then
execute_cmd "dnf module install -y php:remi-8.0" "Configuring PHP 8"
fi
# Install percona Database # Install percona Database
execute_cmd "dnf module disable -y mysql" "Disabiling mysql module" execute_cmd "dnf module disable -y mysql" "Disabiling mysql module"
#rm -rf /etc/my.cnf
execute_cmd "dnf install -y Percona-Server-server-57" "Installing Percona Server" if [ "$MYVER" -eq '80' ] ; then
execute_cmd "percona-release setup ps80 -y" "Enabling mysql80 module"
execute_cmd "dnf install -y percona-server-server percona-xtrabackup-24" "Installing Percona Server 80"
fi
if [ "$MYVER" -ne '80' ] ; then
execute_cmd "dnf install -y Percona-Server-server-57 percona-xtrabackup-24" "Installing Percona Server 57"
fi
# Console dependencies # Console dependencies
console_dependencies=" \ console_dependencies=" \
@ -293,6 +307,8 @@ console_dependencies=" \
poppler-data \ poppler-data \
php-yaml \ php-yaml \
mod_ssl \ mod_ssl \
libzstd \
openldap-clients \
http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \ http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \ http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm" http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
@ -381,20 +397,33 @@ EO_CONFIG_TMP
#Configuring Database #Configuring Database
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
execute_cmd "systemctl start mysqld" "Starting database engine" execute_cmd "systemctl start mysqld" "Starting database engine"
export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev) export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev)
echo """ if [ "$MYVER" -eq '80' ] ; then
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Pandor4!'); echo """
UNINSTALL PLUGIN validate_password; SET PASSWORD FOR 'root'@'localhost' = 'Pandor4!';
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('$DBROOTPASS'); UNINSTALL COMPONENT 'file://component_validate_password';
""" | mysql --connect-expired-password -uroot &>> "$LOGFILE" SET PASSWORD FOR 'root'@'localhost' = '$DBROOTPASS';
""" | mysql --connect-expired-password -uroot &>> "$LOGFILE"
fi
if [ "$MYVER" -ne '80' ] ; then
echo """
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Pandor4!');
UNINSTALL PLUGIN validate_password;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('$DBROOTPASS');
""" | mysql --connect-expired-password -uroot &>> "$LOGFILE"fi
fi
fi fi
export MYSQL_PWD=$DBROOTPASS export MYSQL_PWD=$DBROOTPASS
echo -en "${cyan}Creating Pandora FMS database...${reset}" echo -en "${cyan}Creating Pandora FMS database...${reset}"
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST 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 "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$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
export MYSQL_PWD=$DBPASS export MYSQL_PWD=$DBPASS
#Generating my.cnf #Generating my.cnf
@ -442,6 +471,10 @@ pid-file=/var/run/mysqld/mysqld.pid
EO_CONFIG_F EO_CONFIG_F
if [ "$MYVER" -eq '80' ] ; then
sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf
fi
execute_cmd "systemctl restart mysqld" "Configuring database engine" execute_cmd "systemctl restart mysqld" "Configuring database engine"
@ -465,7 +498,7 @@ execute_cmd "curl -LSs --output pandorafms_agent_unix-7.0NG.noarch.rpm ${PANDORA
execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "Installing Pandora FMS packages" execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "Installing Pandora FMS packages"
# Copy gotty utility # Copy gotty utility
execute_cmd "wget https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz" 'Dowloading gotty util' execute_cmd "wget https://pandorafms.com/library/wp-content/uploads/2019/11/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util' execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761, AIX version # Version 7.0NG.762, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761, FreeBSD Version # Version 7.0NG.762, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761, HP-UX Version # Version 7.0NG.762, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761, GNU/Linux # Version 7.0NG.762, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761, GNU/Linux # Version 7.0NG.762, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761, Solaris Version # Version 7.0NG.762, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas # (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.761 # Version 7.0NG.762
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version # Foundation; either version 2 of the Licence or any later version

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.761, AIX version # Version 7.0NG.762, AIX version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.761 # Version 7.0NG.762
# FreeBSD/IPSO version # FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena # Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.761, HPUX Version # Version 7.0NG.762, HPUX Version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761 # Version 7.0NG.762
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas # (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761 # Version 7.0NG.762
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas # (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761 # Version 7.0NG.762
# Licensed under GPL license v2, # Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.761, Solaris version # Version 7.0NG.762, Solaris version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761, AIX version # Version 7.0NG.762, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.761-220511 Version: 7.0NG.762-220616
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.761-220511" pandora_version="7.0NG.762-220616"
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

@ -31,7 +31,7 @@ fi
if [ "$#" -ge 2 ]; then if [ "$#" -ge 2 ]; then
VERSION="$2" VERSION="$2"
else else
VERSION="7.0NG.761" VERSION="7.0NG.762"
fi fi
# Path for the generated DMG file # Path for the generated DMG file

View File

@ -19,11 +19,11 @@
<choice id="com.pandorafms.pandorafms_src" visible="false"> <choice id="com.pandorafms.pandorafms_src" visible="false">
<pkg-ref id="com.pandorafms.pandorafms_src"/> <pkg-ref id="com.pandorafms.pandorafms_src"/>
</choice> </choice>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.761" onConclusion="none">pandorafms_src.pdk</pkg-ref> <pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.762" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications"> <choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/> <pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
</choice> </choice>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.761" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref> <pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.762" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<!-- <installation-check script="check()" /> <!-- <installation-check script="check()" />
<script> <script>
<![CDATA[ <![CDATA[

View File

@ -5,9 +5,9 @@
<key>CFBundleIconFile</key> <string>pandorafms.icns</string> <key>CFBundleIconFile</key> <string>pandorafms.icns</string>
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string> <key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
<key>CFBundleVersion</key> <string>7.0NG.761</string> <key>CFBundleVersion</key> <string>7.0NG.762</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.761 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string> <key>CFBundleGetInfoString</key> <string>7.0NG.762 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.761</string> <key>CFBundleShortVersionString</key> <string>7.0NG.762</string>
<key>NSPrincipalClass</key><string>NSApplication</string> <key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string> <key>NSMainNibFile</key><string>MainMenu</string>

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761, GNU/Linux # Version 7.0NG.762, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761, FreeBSD Version # Version 7.0NG.762, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761, HP-UX Version # Version 7.0NG.762, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761, GNU/Linux # Version 7.0NG.762, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761, GNU/Linux # Version 7.0NG.762, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761, NetBSD Version # Version 7.0NG.762, NetBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.761, Solaris Version # Version 7.0NG.762, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1014,8 +1014,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.761'; use constant AGENT_VERSION => '7.0NG.762';
use constant AGENT_BUILD => '220511'; use constant AGENT_BUILD => '220616';
# 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

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.761 %define version 7.0NG.762
%define release 220511 %define release 220616
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.761 %define version 7.0NG.762
%define release 220511 %define release 220616
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. # Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.761" PI_VERSION="7.0NG.762"
PI_BUILD="220511" PI_BUILD="220616"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas # (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.761 # Version 7.0NG.762
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version # Foundation; either version 2 of the Licence or any later version

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes} {Yes}
AppName AppName
{Pandora FMS Windows Agent v7.0NG.761} {Pandora FMS Windows Agent v7.0NG.762}
ApplicationID ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F} {17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{220511} {220616}
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.761 Build 220511") #define PANDORA_VERSION ("7.0NG.762 Build 220616")
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.761(Build 220511))" VALUE "ProductVersion", "(7.0NG.762(Build 220616))"
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.761-220511 Version: 7.0NG.762-220616
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.761-220511" pandora_version="7.0NG.762-220616"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -1665,3 +1665,4 @@ godmode/um_client/vendor/sebastian/object-enumerator/tests
godmode/um_client/vendor/sebastian/object-enumerator godmode/um_client/vendor/sebastian/object-enumerator
godmode/um_client/vendor/sebastian godmode/um_client/vendor/sebastian
godmode/um_client/vendor godmode/um_client/vendor
/update_manager_client/resources/styles/pandora.css

View File

@ -0,0 +1,5 @@
START TRANSACTION;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('lts_name', 'Akira');
COMMIT;

View File

@ -0,0 +1,51 @@
START TRANSACTION;
ALTER TABLE `tuser_double_auth` DROP FOREIGN KEY `tuser_double_auth_ibfk_1`, MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL;
ALTER TABLE `tnotification_user` DROP FOREIGN KEY `tnotification_user_ibfk_2`, MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL;
ALTER TABLE `tnotification_source_user` DROP FOREIGN KEY `tnotification_source_user_ibfk_2`, MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL;
ALTER TABLE `tnotification_source_group_user` DROP FOREIGN KEY `tnotification_source_group_user_ibfk_2`, MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL;
ALTER TABLE `tvisual_console_elements_cache` DROP FOREIGN KEY `tvisual_console_elements_cache_ibfk_3`, MODIFY COLUMN `user_id` VARCHAR(255) DEFAULT NULL;
ALTER TABLE `tusuario` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `tuser_double_auth` ADD CONSTRAINT `tuser_double_auth_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `tusuario` (`id_user`) ON DELETE CASCADE;
ALTER TABLE `tnotification_user` ADD CONSTRAINT `tnotification_user_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `tusuario` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `tnotification_source_user` ADD CONSTRAINT `tnotification_source_user_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `tusuario` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `tnotification_source_group_user` ADD CONSTRAINT `tnotification_source_group_user_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `tusuario` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `tvisual_console_elements_cache` ADD CONSTRAINT `tvisual_console_elements_cache_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `tusuario` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `tattachment` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tevento` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `tincidencia` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tnota` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `tsesion` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `ttrap` MODIFY COLUMN `id_usuario` VARCHAR(255) DEFAULT '';
ALTER TABLE `tusuario_perfil` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `treset_pass_history` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL;
ALTER TABLE `tmensajes` MODIFY COLUMN `id_usuario_origen` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tgraph` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `treport` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tplanned_downtime` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `tnetwork_map` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL;
ALTER TABLE `tpassword_history` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL;
ALTER TABLE `tupdate_journal` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tmap` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tdashboard` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `treport_template` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tmetaconsole_event` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `tmetaconsole_event_history` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `treset_pass` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tuser_task_scheduled` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `tbackup` MODIFY COLUMN `id_user` VARCHAR(255) DEFAULT '';
ALTER TABLE `tservice` ADD COLUMN `enable_sunburst` tinyint(1) NOT NULL default 0;
ALTER TABLE `tdashboard` MODIFY `name` TEXT NOT NULL DEFAULT '';
SET @st_oum763 = (SELECT IF(
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tautoconfig' AND table_schema = DATABASE() AND column_name = 'disabled') > 0,
"SELECT 1",
"ALTER TABLE `tautoconfig` ADD COLUMN `disabled` TINYINT DEFAULT 0"
));
PREPARE pr_oum763 FROM @st_oum763;
EXECUTE pr_oum763;
DEALLOCATE PREPARE pr_oum763;
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

@ -31,6 +31,10 @@ if (!$config['MR']) {
$config['MR'] = 0; $config['MR'] = 0;
} }
if (isset($config['lts_name']) === false) {
$config['lts_name'] = '';
}
echo '<a class="footer"target="_blank" href="'.$config['homeurl'].$license_file.'">'; echo '<a class="footer"target="_blank" href="'.$config['homeurl'].$license_file.'">';
require_once $config['homedir'].'/include/functions_update_manager.php'; require_once $config['homedir'].'/include/functions_update_manager.php';
@ -46,7 +50,7 @@ if ($current_package === null) {
echo __( echo __(
'%s %s - %s - MR %s', '%s %s - %s - MR %s',
get_product_name(), get_product_name(),
$pandora_version, $pandora_version.' '.$config['lts_name'],
$build_package_version, $build_package_version,
$config['MR'] $config['MR']
).'</a><br><span>'.__('Page generated on %s', date('Y-m-d H:i:s')).'</span><br>'; ).'</a><br><span>'.__('Page generated on %s', date('Y-m-d H:i:s')).'</span><br>';

View File

@ -256,7 +256,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$ignored_params['refr'] = ''; $ignored_params['refr'] = '';
$values = get_refresh_time_array(); $values = get_refresh_time_array();
$autorefresh_additional = '<span id="combo_refr" class="invisible">'; $autorefresh_additional = '<span id="combo_refr" class="invisible_events">';
$autorefresh_additional .= html_print_select( $autorefresh_additional .= html_print_select(
$values, $values,
'ref', 'ref',
@ -875,9 +875,9 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$('div#head').addClass('fixed_header'); $('div#head').addClass('fixed_header');
$('div#main').css('padding-top', $('div#head').innerHeight() + 'px'); $('div#main').css('padding-top', $('div#head').innerHeight() + 'px');
} }
/* Temporal fix to hide graphics when ui_dialog are displayed */ /* Temporal fix to hide graphics when ui_dialog are displayed */
$("#yougotalert").click(function () { $("#yougotalert").click(function () {
$("#agent_access").css("display", "none"); $("#agent_access").css("display", "none");
}); });
$("#ui_close_dialog_titlebar").click(function () { $("#ui_close_dialog_titlebar").click(function () {
@ -912,7 +912,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
var autorefresh_draw = '<?php echo $autorefresh_draw; ?>'; var autorefresh_draw = '<?php echo $autorefresh_draw; ?>';
$("#header_autorefresh").css('padding-right', '5px'); $("#header_autorefresh").css('padding-right', '5px');
if(autorefresh_draw == true) { if(autorefresh_draw == true) {
var refresh_interval = parseInt('<?php echo ($config['refr'] * 1000); ?>'); var refresh_interval = parseInt('<?php echo ($config['refr'] * 1000); ?>');
var until_time=''; var until_time='';
@ -921,7 +921,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
until_time.setTime (until_time.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>)); until_time.setTime (until_time.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
$("#refrcounter").countdown ({ $("#refrcounter").countdown ({
until: until_time, until: until_time,
layout: '%M%nn%M:%S%nn%S', layout: '%M%nn%M:%S%nn%S',
labels: ['', '', '', '', '', '', ''], labels: ['', '', '', '', '', '', ''],
onExpiry: function () { onExpiry: function () {
@ -936,9 +936,9 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
} else { } else {
var refr_time = <?php echo (int) get_parameter('refr', $config['refr']); ?>; var refr_time = <?php echo (int) get_parameter('refr', $config['refr']); ?>;
var t = new Date(); var t = new Date();
t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>)); t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
$("#refrcounter").countdown ({ $("#refrcounter").countdown ({
until: t, until: t,
layout: '%M%nn%M:%S%nn%S', layout: '%M%nn%M:%S%nn%S',
labels: ['', '', '', '', '', '', ''], labels: ['', '', '', '', '', '', ''],
onExpiry: function () { onExpiry: function () {
@ -954,10 +954,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$("a.autorefresh").click (function () { $("a.autorefresh").click (function () {
$("a.autorefresh_txt").toggle (); $("a.autorefresh_txt").toggle ();
$("#combo_refr").toggle (); $("#combo_refr").toggle();
$("select#ref").change (function () { $("select#ref").change (function () {
href = $("a.autorefresh").attr ("href"); href = $("a.autorefresh").attr ("href");
if(autorefresh_draw == true){ if(autorefresh_draw == true){
inputs = $("#events_form :input"); inputs = $("#events_form :input");
values = {}; values = {};
@ -965,17 +965,17 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
values[this.name] = $(this).val(); values[this.name] = $(this).val();
}) })
var newValue = btoa(JSON.stringify(values)); var newValue = btoa(JSON.stringify(values));
<?php <?php
// Check if the url has the parameter fb64. // Check if the url has the parameter fb64.
if (isset($_GET['fb64']) === true) { if (isset($_GET['fb64']) === true) {
$fb64 = $_GET['fb64']; $fb64 = $_GET['fb64'];
?> ?>
var fb64 = '<?php echo $fb64; ?>'; var fb64 = '<?php echo $fb64; ?>';
// Check if the filters have changed. // Check if the filters have changed.
if(fb64 !== newValue){ if(fb64 !== newValue){
href = href.replace(fb64, newValue); href = href.replace(fb64, newValue);
} }
$(document).attr("location", href+ '&refr=' + this.value); $(document).attr("location", href+ '&refr=' + this.value);
<?php <?php
@ -989,7 +989,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$(document).attr ("location", href + this.value); $(document).attr ("location", href + this.value);
} }
}); });
return false; return false;
}); });
}); });

View File

@ -278,11 +278,11 @@ foreach ($sessions as $session) {
true true
).human_time_comparation($session['utimestamp'], 'tiny'); ).human_time_comparation($session['utimestamp'], 'tiny');
$data[3] = $session_ip_origen; $data[3] = $session_ip_origen;
$description = str_replace([',', ', '], ', ', $session['descripcion']); $description = io_safe_output(str_replace([',', ', '], ', ', $session['descripcion']));
if (strlen($description) > 100) { if (strlen($description) > 100) {
$data[4] = '<div >'.io_safe_output(substr($description, 0, 150).'...').'</div>'; $data[4] = '<div >'.io_safe_input(substr($description, 0, 150)).'...</div>';
} else { } else {
$data[4] = '<div >'.io_safe_output($description).'</div>'; $data[4] = '<div >'.io_safe_input($description).'</div>';
} }
array_push($table->data, $data); array_push($table->data, $data);

View File

@ -26,6 +26,8 @@
* ============================================================================ * ============================================================================
*/ */
use function PHPSTORM_META\map;
// Begin. // Begin.
if (isset($config['id_user']) === false) { if (isset($config['id_user']) === false) {
include 'general/login_page.php'; include 'general/login_page.php';
@ -57,52 +59,22 @@ if (isset($config['autohidden_menu']) === true && (bool) $config['autohidden_men
// Start of full lateral menu. // Start of full lateral menu.
echo sprintf('<div id="menu_full" class="menu_full_%s">', $menuTypeClass); echo sprintf('<div id="menu_full" class="menu_full_%s">', $menuTypeClass);
$custom_logo = 'images/custom_logo/'.$config['custom_logo']; // Header logo.
$custom_logo_collapsed = 'images/custom_logo/'.$config['custom_logo_collapsed']; html_print_div(
[
if (defined('PANDORA_ENTERPRISE') === false) { 'class' => 'logo_green',
$logo_title = get_product_name().' Opensource'; 'content' => html_print_anchor(
$custom_logo = 'images/custom_logo/pandora_logo_head_3.png'; [
$custom_logo_collapsed = 'images/custom_logo/pandora_logo_green_collapsed.png'; 'href' => ui_get_full_url('index.php'),
} else { 'content' => html_print_header_logo_image(
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo) === true) { $menuCollapsed,
$custom_logo = ENTERPRISE_DIR.'/'.$custom_logo; true
} ),
],
$logo_title = get_product_name().' Enterprise'; true
} ),
]
echo '<div class="logo_green"><a href="index.php?sec=main">'; );
if (isset($config['custom_logo']) === true) {
echo html_print_image(
$custom_logo,
true,
[
'border' => '0',
'width' => '215',
'alt' => $logo_title,
'class' => 'logo_full',
'style' => ($menuCollapsed === true) ? 'display:none' : 'display:block',
]
);
}
if (isset($config['custom_logo_collapsed']) === true) {
echo html_print_image(
$custom_logo_collapsed,
true,
[
'border' => '0',
'width' => '60',
'alt' => $logo_title,
'class' => 'logo_icon',
'style' => ($menuCollapsed === true) ? 'display:block' : 'display:none',
]
);
}
echo '</a></div>';
require 'operation/menu.php'; require 'operation/menu.php';
require 'godmode/menu.php'; require 'godmode/menu.php';

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

@ -1156,7 +1156,7 @@ if (check_acl($config['id_user'], 0, 'PM')) {
); );
$table_advanced->colspan[16][1] = 6; $table_advanced->colspan[16][1] = 6;
} else { } else {
// Store in a hidden field if is not visible to avoid delete the value // Store in a hidden field if is not visible to avoid delete the value.
$table_advanced->data[15][4] .= html_print_input_hidden('id_category', $id_category, true); $table_advanced->data[15][4] .= html_print_input_hidden('id_category', $id_category, true);
} }
@ -1193,7 +1193,7 @@ if (!$in_policy) {
} }
// Advanced form part // Advanced form part.
$table_macros = new stdClass(); $table_macros = new stdClass();
$table_macros->id = 'module_macros'; $table_macros->id = 'module_macros';
$table_macros->width = '100%'; $table_macros->width = '100%';
@ -1398,7 +1398,7 @@ ui_require_jquery_file('json');
<script type="text/javascript"> <script type="text/javascript">
/* <![CDATA[ */ /* <![CDATA[ */
$(document).ready (function () { $(document).ready (function () {
var disabledBecauseInPolicy = <?php echo '\''.(empty($disabledBecauseInPolicy) === true ? '0' : '1').'\''; ?>; var disabledBecauseInPolicy = <?php echo '\''.((empty($disabledBecauseInPolicy) === true) ? '0' : '1').'\''; ?>;
$("#right").click (function () { $("#right").click (function () {
jQuery.each($("select[name='id_tag_available[]'] option:selected"), function (key, value) { jQuery.each($("select[name='id_tag_available[]'] option:selected"), function (key, value) {
tag_name = $(value).html(); tag_name = $(value).html();
@ -1407,12 +1407,16 @@ $(document).ready (function () {
$("#id_tag_available").find("option[value='" + tag_name + "']").remove(); $("#id_tag_available").find("option[value='" + tag_name + "']").remove();
$("#id_tag_selected").find("option[value='']").remove(); $("#id_tag_selected").find("option[value='']").remove();
if($("#id_tag_available option").length == 0) { if($("#id_tag_available option").length == 0) {
$("select[name='id_tag_available[]']").append(value); $("select[name='id_tag_available[]']").append(
$("<option></option>").val('').html(
'<i><?php echo __('None'); ?></i>'
)
);
} }
} }
}); });
}); });
$("#left").click (function () { $("#left").click (function () {
jQuery.each($("select[name='id_tag_selected[]'] option:selected"), function (key, value) { jQuery.each($("select[name='id_tag_selected[]'] option:selected"), function (key, value) {
tag_name = $(value).html(); tag_name = $(value).html();
@ -1422,7 +1426,11 @@ $(document).ready (function () {
$("#id_tag_selected").find("option[value='" + id_tag + "']").remove(); $("#id_tag_selected").find("option[value='" + id_tag + "']").remove();
$("#id_tag_available").find("option[value='']").remove(); $("#id_tag_available").find("option[value='']").remove();
if($("#id_tag_selected option").length == 0) { if($("#id_tag_selected option").length == 0) {
$("select[name='id_tag_selected[]']").append(value); $("select[name='id_tag_selected[]']").append(
$("<option></option>").val('').html(
'<i><?php echo __('None'); ?></i>'
)
);
} }
} }
}); });

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

@ -238,6 +238,9 @@ if ($searchFlag) {
} }
$id_agents = array_keys($agents); $id_agents = array_keys($agents);
if (empty($id_agents) === true) {
$id_agents[0] = 0;
}
$total = agents_get_alerts_simple( $total = agents_get_alerts_simple(
(empty($agent_id) === false) ? ['0' => $agent_id] : $id_agents, (empty($agent_id) === false) ? ['0' => $agent_id] : $id_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 = agents_get_group_agents( $agents = [];
array_keys(users_get_groups($config['id_user'], 'AW', false)), if (is_metaconsole() === false) {
['disabled' => 2], $agents = agents_get_group_agents(
'none', array_keys(users_get_groups($config['id_user'], 'AW', false)),
false, ['disabled' => 2],
false, 'none'
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

@ -525,21 +525,21 @@ $menu_godmode['links']['sub'] = $sub;
// Update Manager // Update Manager
if (check_acl($config['id_user'], 0, 'PM') && $config['enable_update_manager']) { if (check_acl($config['id_user'], 0, 'PM') && $config['enable_update_manager']) {
$menu_godmode['messages']['text'] = __('Update manager'); $menu_godmode['messages']['text'] = __('Warp Update');
$menu_godmode['messages']['id'] = 'god-um_messages'; $menu_godmode['messages']['id'] = 'god-um_messages';
$menu_godmode['messages']['sec2'] = ''; $menu_godmode['messages']['sec2'] = '';
$sub = []; $sub = [];
$sub['godmode/update_manager/update_manager&tab=offline']['text'] = __('Update Manager offline'); $sub['godmode/update_manager/update_manager&tab=offline']['text'] = __('Update offline');
$sub['godmode/update_manager/update_manager&tab=offline']['id'] = 'Offline'; $sub['godmode/update_manager/update_manager&tab=offline']['id'] = 'Offline';
$sub['godmode/update_manager/update_manager&tab=online']['text'] = __('Update Manager online'); $sub['godmode/update_manager/update_manager&tab=online']['text'] = __('Update online');
$sub['godmode/update_manager/update_manager&tab=online']['id'] = 'Online'; $sub['godmode/update_manager/update_manager&tab=online']['id'] = 'Online';
$sub['godmode/update_manager/update_manager&tab=setup']['text'] = __('Update Manager options'); $sub['godmode/update_manager/update_manager&tab=setup']['text'] = __('Options');
$sub['godmode/update_manager/update_manager&tab=setup']['id'] = 'Options'; $sub['godmode/update_manager/update_manager&tab=setup']['id'] = 'Options';
$sub['godmode/update_manager/update_manager&tab=history']['text'] = __('Update Manager journal'); $sub['godmode/update_manager/update_manager&tab=history']['text'] = __('Warp journal');
$sub['godmode/update_manager/update_manager&tab=history']['id'] = 'Journal'; $sub['godmode/update_manager/update_manager&tab=history']['id'] = 'Journal';
$menu_godmode['messages']['sub'] = $sub; $menu_godmode['messages']['sub'] = $sub;

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

@ -1,24 +1,39 @@
<?php <?php
/**
* Table builder for Servers View.
*
* @category View
* @package Pandora FMS
* @subpackage Monitoring.
* @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.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com // Begin.
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU 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.
// Load global vars
require_once 'include/functions_clippy.php'; require_once 'include/functions_clippy.php';
global $config; global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'AW')) { if ((bool) check_acl($config['id_user'], 0, 'AR') === false) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
'Trying to access Server Management' 'Trying to access Server Management'
@ -57,7 +72,6 @@ $table->headstyle[1] = 'text-align:center';
$table->headstyle[3] = 'text-align:center'; $table->headstyle[3] = 'text-align:center';
$table->headstyle[8] = 'text-align:right;width: 120px;'; $table->headstyle[8] = 'text-align:right;width: 120px;';
// $table->title = __('Tactical server information');
$table->titleclass = 'tabletitle'; $table->titleclass = 'tabletitle';
$table->titlestyle = 'text-transform:uppercase;'; $table->titlestyle = 'text-transform:uppercase;';
@ -69,11 +83,11 @@ $table->head[3] = __('Version');
$table->head[4] = __('Modules'); $table->head[4] = __('Modules');
$table->head[5] = __('Lag').ui_print_help_tip(__('Avg. Delay(sec)/Modules delayed'), true); $table->head[5] = __('Lag').ui_print_help_tip(__('Avg. Delay(sec)/Modules delayed'), true);
$table->head[6] = __('T/Q').ui_print_help_tip(__('Threads / Queued modules currently'), true); $table->head[6] = __('T/Q').ui_print_help_tip(__('Threads / Queued modules currently'), true);
// This will have a column of data such as "6 hours" // This will have a column of data such as "6 hours".
$table->head[7] = __('Updated'); $table->head[7] = __('Updated');
// Only Pandora Administrator can delete servers // Only Pandora Administrator can delete servers.
if (check_acl($config['id_user'], 0, 'PM')) { if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$table->head[8] = '<span title="Operations">'.__('Op.').'</span>'; $table->head[8] = '<span title="Operations">'.__('Op.').'</span>';
} }
@ -89,14 +103,14 @@ foreach ($servers as $server) {
foreach ($servers as $server) { foreach ($servers as $server) {
$data = []; $data = [];
// $table->cellclass[][3] = 'progress_bar';
$table->cellclass[] = [ $table->cellclass[] = [
3 => 'progress_bar', 3 => 'progress_bar',
8 => 'action_buttons', 8 => 'action_buttons',
]; ];
$data[0] = '<span title="'.$server['version'].'">'.strip_tags($server['name']).'</span>'; $data[0] = '<span title="'.$server['version'].'">'.strip_tags($server['name']).'</span>';
// Status // Status.
$data[1] = ui_print_status_image(STATUS_SERVER_OK, '', true); $data[1] = ui_print_status_image(STATUS_SERVER_OK, '', true);
if ($server['status'] == -1) { if ($server['status'] == -1) {
$data[1] = ui_print_status_image( $data[1] = ui_print_status_image(
@ -104,7 +118,7 @@ foreach ($servers as $server) {
__('Server has crashed.'), __('Server has crashed.'),
true true
); );
} else if (($server['status'] == 0) } else if ((int) ($server['status'] === 0)
|| (($date - time_w_fixed_tz($server['keepalive'])) > ($server['server_keepalive']) * 2) || (($date - time_w_fixed_tz($server['keepalive'])) > ($server['server_keepalive']) * 2)
) { ) {
$data[1] = ui_print_status_image( $data[1] = ui_print_status_image(
@ -114,13 +128,13 @@ foreach ($servers as $server) {
); );
} }
// Type // Type.
$data[2] = '<span class="nowrap">'.$server['img']; $data[2] = '<span class="nowrap">'.$server['img'];
if ($server['master'] == $master) { if ($server['master'] == $master) {
$data[2] .= ui_print_help_tip(__('This is a master server'), true); $data[2] .= ui_print_help_tip(__('This is a master server'), true);
} }
if ($server['exec_proxy'] == 1) { if ((int) $server['exec_proxy'] === 1) {
$data[2] .= html_print_image('images/star.png', true, ['title' => __('Exec server enabled')]); $data[2] .= html_print_image('images/star.png', true, ['title' => __('Exec server enabled')]);
} }
@ -169,11 +183,11 @@ foreach ($servers as $server) {
} }
} }
// Only Pandora Administrator can delete servers // Only Pandora Administrator can delete servers.
if (check_acl($config['id_user'], 0, 'PM')) { if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$data[8] = ''; $data[8] = '';
if ($server['type'] == 'recon') { if ($server['type'] === 'recon') {
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist').'">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist').'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/first_task/icono_grande_reconserver.png', 'images/first_task/icono_grande_reconserver.png',
@ -188,7 +202,7 @@ foreach ($servers as $server) {
$data[8] .= '</a>'; $data[8] .= '</a>';
} }
if ($server['type'] == 'data') { if ($server['type'] === 'data') {
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_counts='.$server['id_server']).'">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_counts='.$server['id_server']).'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/target.png', 'images/target.png',
@ -199,7 +213,7 @@ foreach ($servers as $server) {
] ]
); );
$data[8] .= '</a>'; $data[8] .= '</a>';
} else if ($server['type'] == 'enterprise snmp') { } else if ($server['type'] === 'enterprise snmp') {
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server']).'">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server']).'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/target.png', 'images/target.png',
@ -223,7 +237,7 @@ foreach ($servers as $server) {
); );
$data[8] .= '</a>'; $data[8] .= '</a>';
if (($names_servers[$safe_server_name] === true) && ($server['type'] == 'data' || $server['type'] == 'enterprise satellite')) { if (($names_servers[$safe_server_name] === true) && ($server['type'] === 'data' || $server['type'] === 'enterprise satellite')) {
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/remote_configuration.png', 'images/remote_configuration.png',

View File

@ -63,7 +63,7 @@ if (empty($directory) === true) {
$real_directory = realpath($config['homedir'].'/'.$directory); $real_directory = realpath($config['homedir'].'/'.$directory);
echo '<h4>'.__('Index of %s', $directory).'</h4>'; echo '<h4>'.__('Index of %s', io_safe_input($directory)).'</h4>';
$upload_file = (bool) get_parameter('upload_file'); $upload_file = (bool) get_parameter('upload_file');
$create_text_file = (bool) get_parameter('create_text_file'); $create_text_file = (bool) get_parameter('create_text_file');

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

@ -1,12 +1,20 @@
<?php <?php
/** /**
* Setup view for Netflow
*
* @category Setup
* @package Pandora FMS
* @subpackage Configuration
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________ * ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ | * | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
* *
* ============================================================================ * ============================================================================
* 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
@ -18,6 +26,7 @@
* ============================================================================ * ============================================================================
*/ */
// Begin.
global $config; global $config;
require_once 'include/functions_ui.php'; require_once 'include/functions_ui.php';
@ -26,6 +35,7 @@ check_login();
$update = (bool) get_parameter('update'); $update = (bool) get_parameter('update');
$table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->border = 0; $table->border = 0;
$table->cellspacing = 3; $table->cellspacing = 3;

View File

@ -313,7 +313,7 @@ if (is_array($config) === true) {
if ($mode === Manager::MODE_ONLINE if ($mode === Manager::MODE_ONLINE
&& ($puid === null || $puid === 'OFFLINE') && ($puid === null || $puid === 'OFFLINE')
) { ) {
ui_print_error_message(__('Update manager online requires registration.')); ui_print_error_message(__('Update online requires registration.'));
} }
if ($mode === Manager::MODE_OFFLINE) { if ($mode === Manager::MODE_OFFLINE) {

View File

@ -5,10 +5,11 @@ if ($argv === null) {
exit(0); exit(0);
} }
// UMC dependencies.
require_once __DIR__.'/vendor/autoload.php';
chdir(__DIR__.'/../../'); chdir(__DIR__.'/../../');
// UMC dependencies.
require_once 'vendor/autoload.php';
// Config file.
$cnf_file = 'include/config.php'; $cnf_file = 'include/config.php';
if (file_exists($cnf_file) === false) { if (file_exists($cnf_file) === false) {
@ -19,9 +20,6 @@ ini_set('display_errors', 1);
require_once $cnf_file; require_once $cnf_file;
// PandoraFMS dependencies.
require_once __DIR__.'/vendor/autoload.php';
use PandoraFMS\Core\Config; use PandoraFMS\Core\Config;
use PandoraFMS\Core\DBMaintainer; use PandoraFMS\Core\DBMaintainer;

View File

@ -1,21 +1,36 @@
<?php <?php
/**
* Update manager.
*
* @category Update Manager
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com // Begin.
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config; global $config;
check_login(); check_login();
// The ajax is in // The ajax is in include/ajax/update_manager.php.
// include/ajax/update_manager.php
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
@ -36,59 +51,65 @@ if ($php_version_array[0] < 7) {
$tab = get_parameter('tab', 'online'); $tab = get_parameter('tab', 'online');
$buttons['setup'] = [ $buttons['setup'] = [
'active' => ($tab == 'setup') ? true : false, 'active' => ($tab === 'setup') ? true : false,
'text' => '<a href="'.ui_get_full_url( 'text' => '<a href="'.ui_get_full_url(
'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=setup' 'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=setup'
).'">'.html_print_image('images/gm_setup.png', true, ['title' => __('Options'), 'class' => 'invert_filter']).'</a>', ).'">'.html_print_image('images/gm_setup.png', true, ['title' => __('Setup'), 'class' => 'invert_filter']).'</a>',
]; ];
$buttons['history'] = [ $buttons['history'] = [
'active' => ($tab == 'history') ? true : false, 'active' => ($tab === 'history') ? true : false,
'text' => '<a href="'.ui_get_full_url( 'text' => '<a href="'.ui_get_full_url(
'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=histo' 'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=histo'
).'ry">'.html_print_image('images/gm_db.png', true, ['title' => __('Journal'), 'class' => 'invert_filter']).'</a>', ).'ry">'.html_print_image('images/gm_db.png', true, ['title' => __('Journal'), 'class' => 'invert_filter']).'</a>',
]; ];
$buttons['offline'] = [ $buttons['offline'] = [
'active' => ($tab == 'offline') ? true : false, 'active' => ($tab === 'offline') ? true : false,
'text' => '<a href="'.ui_get_full_url( 'text' => '<a href="'.ui_get_full_url(
'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=offli' 'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=offli'
).'ne">'.html_print_image('images/box.png', true, ['title' => __('Offline update manager'), 'class' => 'invert_filter']).'</a>', ).'ne">'.html_print_image('images/box.png', true, ['title' => __('Offline update'), 'class' => 'invert_filter']).'</a>',
]; ];
$buttons['online'] = [ $buttons['online'] = [
'active' => ($tab == 'online') ? true : false, 'active' => ($tab === 'online') ? true : false,
'text' => '<a href="'.ui_get_full_url( 'text' => '<a href="'.ui_get_full_url(
'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=onlin' 'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=onlin'
).'e">'.html_print_image('images/op_gis.png', true, ['title' => __('Online update manager'), 'class' => 'invert_filter']).'</a>', ).'e">'.html_print_image('images/op_gis.png', true, ['title' => __('Online update'), 'class' => 'invert_filter']).'</a>',
]; ];
switch ($tab) { switch ($tab) {
case 'history': case 'history':
$title = __('Update manager » Journal'); $title = __('Journal');
break; break;
case 'setup': case 'setup':
$title = __('Update manager » Setup'); $title = __('Setup');
break; break;
case 'offline': case 'offline':
$title = __('Update manager » Offline'); $title = __('Offline');
break; break;
case 'online': case 'online':
default: default:
$title = __('Update manager » Online'); $title = __('Online');
break; break;
} }
ui_print_page_header( ui_print_standard_header(
$title, $title,
'images/gm_setup.png', 'images/gm_setup.png',
false, false,
'', '',
true, true,
$buttons $buttons,
[
[
'link' => '',
'label' => 'Warp Update',
],
]
); );
switch ($tab) { switch ($tab) {
@ -107,6 +128,39 @@ switch ($tab) {
case 'online': case 'online':
default: default:
if (is_metaconsole() === false && has_metaconsole() === true) {
$meta_puid = null;
$server_id = $config['metaconsole_node_id'];
$dbh = (object) $config['dbconnection'];
// Connect to metaconsole.
$result_code = metaconsole_load_external_db(
[
'dbhost' => $config['replication_dbhost'],
'dbuser' => $config['replication_dbuser'],
'dbpass' => io_output_password($config['replication_dbpass']),
'dbname' => $config['replication_dbname'],
]
);
if ($result_code < 0) {
break;
}
$value = db_get_value('value', 'tconfig', 'token', 'pandora_uid');
$meta_puid = $value;
// Return connection to node.
metaconsole_restore_db();
if ($meta_puid === false || $meta_puid === null) {
ui_print_warning_message(__('Please register on metaconsole first.'));
break;
}
}
$mode = \UpdateManager\UI\Manager::MODE_ONLINE; $mode = \UpdateManager\UI\Manager::MODE_ONLINE;
include $config['homedir'].'/godmode/um_client/index.php'; include $config['homedir'].'/godmode/um_client/index.php';
break; break;

View File

@ -268,17 +268,18 @@ $table->style[$i] = 'font-weight: bolder;width:250px';
$url_update_manager = update_manager_get_url(); $url_update_manager = update_manager_get_url();
$table->data[$i][0] = __('URL update manager:'); $table->data[$i][0] = __('Warp Update URL');
$table->data[$i++][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'url_update_manager', 'url_update_manager',
$url_update_manager, $url_update_manager,
__('URL update manager'), __('URL update manager'),
80, 80,
60, 255,
true,
true true
); );
$table->data[$i][0] = __('Use secured update manager:'); $table->data[$i][0] = __('Use secured Warp Update');
$table->data[$i++][1] = html_print_input( $table->data[$i++][1] = html_print_input(
[ [
'type' => 'switch', 'type' => 'switch',
@ -287,7 +288,7 @@ $table->data[$i++][1] = html_print_input(
] ]
); );
$table->data[$i][0] = __('Proxy server:'); $table->data[$i][0] = __('Proxy server');
$table->data[$i++][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'update_manager_proxy_server', 'update_manager_proxy_server',
$update_manager_proxy_server, $update_manager_proxy_server,
@ -297,7 +298,7 @@ $table->data[$i++][1] = html_print_input_text(
true true
); );
$table->data[$i][0] = __('Proxy port:'); $table->data[$i][0] = __('Proxy port');
$table->data[$i++][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'update_manager_proxy_port', 'update_manager_proxy_port',
$update_manager_proxy_port, $update_manager_proxy_port,
@ -307,7 +308,7 @@ $table->data[$i++][1] = html_print_input_text(
true true
); );
$table->data[$i][0] = __('Proxy user:'); $table->data[$i][0] = __('Proxy user');
$table->data[$i++][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'update_manager_proxy_user', 'update_manager_proxy_user',
$update_manager_proxy_user, $update_manager_proxy_user,
@ -317,7 +318,7 @@ $table->data[$i++][1] = html_print_input_text(
true true
); );
$table->data[$i][0] = __('Proxy password:'); $table->data[$i][0] = __('Proxy password');
$table->data[$i++][1] = html_print_input_password( $table->data[$i++][1] = html_print_input_password(
'update_manager_proxy_password', 'update_manager_proxy_password',
$update_manager_proxy_password, $update_manager_proxy_password,
@ -327,7 +328,7 @@ $table->data[$i++][1] = html_print_input_password(
true true
); );
$table->data[$i][0] = __('Allow no-consecutive patches:'); $table->data[$i][0] = __('Allow no-consecutive patches');
$table->data[$i++][1] = html_print_switch( $table->data[$i++][1] = html_print_switch(
[ [
'name' => 'allow_offline_patches', 'name' => 'allow_offline_patches',
@ -336,7 +337,7 @@ $table->data[$i++][1] = html_print_switch(
] ]
); );
$table->data[$i][0] = __('Limit to LTS updates:'); $table->data[$i][0] = __('Limit to LTS updates');
$table->data[$i++][1] = html_print_switch( $table->data[$i++][1] = html_print_switch(
[ [
'name' => 'lts_updates', 'name' => 'lts_updates',
@ -346,11 +347,11 @@ $table->data[$i++][1] = html_print_switch(
); );
$table->data[$i][0] = __('Registration ID:'); $table->data[$i][0] = __('Registration ID');
$table->data[$i++][1] = '<i>'.$config['pandora_uid'].'</i>'; $table->data[$i++][1] = '<i>'.($config['pandora_uid'] ?? __('Not registred yet')).'</i>';
if (update_manager_verify_registration() === true && users_is_admin()) { if (update_manager_verify_registration() === true && users_is_admin()) {
$table->data[$i][0] = __('Cancel registration:'); $table->data[$i][0] = __('Cancel registration');
$table->data[$i][1] = '<a href="'; $table->data[$i][1] = '<a href="';
if ((bool) is_metaconsole() === true) { if ((bool) is_metaconsole() === true) {
$table->data[$i][1] .= ui_get_full_url( $table->data[$i][1] .= ui_get_full_url(
@ -367,7 +368,7 @@ if (update_manager_verify_registration() === true && users_is_admin()) {
if (license_free()) { if (license_free()) {
$config['identification_reminder'] = isset($config['identification_reminder']) ? $config['identification_reminder'] : 1; $config['identification_reminder'] = isset($config['identification_reminder']) ? $config['identification_reminder'] : 1;
$table->data[$i][0] = __('Pandora FMS community reminder').ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this Pandora instance'), true); $table->data[$i][0] = __('%s community reminder', get_product_name()).ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this %s instance', get_product_name()), true);
$table->data[$i][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('identification_reminder', 1, '', $config['identification_reminder'], true).'&nbsp;&nbsp;'; $table->data[$i][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('identification_reminder', 1, '', $config['identification_reminder'], true).'&nbsp;&nbsp;';
$table->data[$i++][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('identification_reminder', 0, '', $config['identification_reminder'], true); $table->data[$i++][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('identification_reminder', 0, '', $config['identification_reminder'], true);
} }

View File

@ -860,7 +860,7 @@ if (!$new_user) {
'', '',
'', '',
20, 20,
100, 255,
!$new_user || $view_mode, !$new_user || $view_mode,
'', '',
[ [

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: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

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']) { $filter_alias[] = '(UPPER(alias) LIKE "%'.$string.'%")';
case 'mysql':
$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']) { $filter_agents[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) LIKE "%'.$string.'%")';
case 'mysql':
$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']) { $filter_address[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) NOT LIKE "%'.$string.'%" AND UPPER(direccion) LIKE "%'.$string.'%")';
case 'mysql':
$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']) { $filter_description[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) NOT LIKE "%'.$string.'%" AND UPPER(direccion) NOT LIKE "%'.$string.'%" AND UPPER(comentarios) LIKE "%'.$string.'%")';
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.'%")';
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

@ -4827,8 +4827,8 @@ class AgentWizard extends HTML
// SecurityName. // SecurityName.
$macros[6]['value'] = $this->authUserV3; $macros[6]['value'] = $this->authUserV3;
// SecurityContext. // SecurityContext. Empty by default.
$macros[7]['value'] = $this->community; $macros[7]['value'] = '';
// SecurityLevel. // SecurityLevel.
$macros[8]['value'] = $this->securityLevelV3; $macros[8]['value'] = $this->securityLevelV3;

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

@ -336,7 +336,7 @@ class OrderInterpreter extends Wizard
), ),
], ],
[ [
'name' => __('Update Manager'), 'name' => __('Warp Update'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/menu/um_messages.menu_gray.png' 'images/menu/um_messages.menu_gray.png'
), ),
@ -404,10 +404,10 @@ class OrderInterpreter extends Wizard
'.$value['name'].'</a><br>'; '.$value['name'].'</a><br>';
} }
$iterator ++; $iterator++;
if ($iterator > 10) { if ($iterator > 10) {
$more_results ++; $more_results++;
} }
} }
} }

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,33 +538,6 @@ class TreeService extends Tree
$tmp['elementDescription'] = $item->description(); $tmp['elementDescription'] = $item->description();
$tmp['disabled'] = $item->service()->disabled(); $tmp['disabled'] = $item->service()->disabled();
if ($this->connectedToNode === false
&& is_metaconsole() === true
&& $tmp['metaID'] > 0
) {
// Impersonate node.
\enterprise_include_once('include/functions_metaconsole.php');
\enterprise_hook(
'metaconsole_connect',
[
null,
$tmp['metaID'],
]
);
}
if (check_acl($config['id_user'], $item->service()->id_group(), 'AR')) {
$grandchildren = $item->service()->children();
}
if ($this->connectedToNode === false
&& is_metaconsole() === true
&& $tmp['metaID'] > 0
) {
// Restore connection.
\enterprise_hook('metaconsole_restore_db');
}
$counters = [ $counters = [
'total_modules' => 0, 'total_modules' => 0,
'total_agents' => 0, 'total_agents' => 0,
@ -565,29 +546,66 @@ class TreeService extends Tree
'total' => 0, 'total' => 0,
]; ];
if (is_array($grandchildren) === true) { if (is_metaconsole() === false
$counters = array_reduce( || (isset($config['realtimestats']) === true
$grandchildren, && $config['realtimestats'] === true
function ($carry, $item) { && $tmp['metaID'] > 0)
if ($item->type() === SERVICE_ELEMENT_MODULE) { ) {
$carry['total_modules']++; // Look for counters.
} else if ($item->type() === SERVICE_ELEMENT_AGENT) { if ($this->connectedToNode === false
$carry['total_agents']++; && is_metaconsole() === true
} else if ($item->type() === SERVICE_ELEMENT_SERVICE) { && $tmp['metaID'] > 0
$carry['total_services']++; ) {
} else if ($item->type() === SERVICE_ELEMENT_DYNAMIC) { // Impersonate node.
$carry['total_dynamic']++; \enterprise_include_once('include/functions_metaconsole.php');
} \enterprise_hook(
'metaconsole_connect',
[
null,
$tmp['metaID'],
]
);
}
$carry['total']++; if (check_acl($config['id_user'], $item->service()->id_group(), 'AR')) {
$grandchildren = $item->service()->children();
}
return $carry; if ($this->connectedToNode === false
}, && is_metaconsole() === true
$counters && $tmp['metaID'] > 0
); ) {
} // Restore connection.
\enterprise_hook('metaconsole_restore_db');
}
if ($counters['total'] > 0) { if (is_array($grandchildren) === true) {
$counters = array_reduce(
$grandchildren,
function ($carry, $item) {
if ($item->type() === SERVICE_ELEMENT_MODULE) {
$carry['total_modules']++;
} else if ($item->type() === SERVICE_ELEMENT_AGENT) {
$carry['total_agents']++;
} else if ($item->type() === SERVICE_ELEMENT_SERVICE) {
$carry['total_services']++;
} else if ($item->type() === SERVICE_ELEMENT_DYNAMIC) {
$carry['total_dynamic']++;
}
$carry['total']++;
return $carry;
},
$counters
);
}
if ($counters['total'] > 0) {
$tmp['searchChildren'] = 1;
}
} else {
// Always search for.
$tmp['searchChildren'] = 1; $tmp['searchChildren'] = 1;
} }

View File

@ -20,8 +20,8 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC220511'; $build_version = 'PC220616';
$pandora_version = 'v7.0NG.761'; $pandora_version = 'v7.0NG.762';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get(); $script_tz = @date_default_timezone_get();

View File

@ -294,7 +294,11 @@ define('SERVICE_ELEMENT_DYNAMIC', 'dynamic');
define('SERVICE_MODE_MANUAL', 0); define('SERVICE_MODE_MANUAL', 0);
define('SERVICE_MODE_SMART', 1); define('SERVICE_MODE_SMART', 1);
// New installation Product Logo.
define('HEADER_LOGO_DEFAULT_CLASSIC', 'logo-default-pandorafms.png');
define('HEADER_LOGO_DEFAULT_COLLAPSED', 'logo-default-pandorafms-collapsed.png');
define('HEADER_LOGO_BLACK_CLASSIC', 'logo-black-pandorafms.png');
define('HEADER_LOGO_BLACK_COLLAPSED', 'logo-default-pandorafms-collapsed.png');
// Status images. // Status images.
// For modules. // For modules.
@ -802,7 +806,7 @@ define('AUDIT_LOG_SNMP_MANAGEMENT', 'SNMP management');
define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management'); define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management');
define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management'); define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management');
define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management'); define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management');
define('AUDIT_LOG_UMC', 'Update Manager'); define('AUDIT_LOG_UMC', 'Warp Manager');
// MIMEs. // MIMEs.
define( define(

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];
@ -5088,7 +5116,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3)
function api_set_new_network_component($id, $thrash1, $other, $thrash2) function api_set_new_network_component($id, $thrash1, $other, $thrash2)
{ {
global $config; global $config;
if (is_metaconsole() === true) { if (defined('METACONSOLE')) {
return; return;
} }
@ -5190,7 +5218,7 @@ function api_set_new_plugin_component($id, $thrash1, $other, $thrash2)
{ {
global $config; global $config;
if (is_metaconsole() === true) { if (defined('METACONSOLE')) {
return; return;
} }
@ -5470,7 +5498,7 @@ function api_set_new_local_component($id, $thrash1, $other, $thrash2)
{ {
global $config; global $config;
if (is_metaconsole() === true) { if (defined('METACONSOLE')) {
return; return;
} }

View File

@ -556,7 +556,7 @@ function config_update_config()
$error_update[] = __('Autocreate profile group'); $error_update[] = __('Autocreate profile group');
} }
if (config_update_value('default_assign_tags', implode(',', get_parameter('default_assign_tags')), true) === false) { if (config_update_value('default_assign_tags', implode(',', get_parameter('default_assign_tags', [])), true) === false) {
$error_update[] = __('Autocreate profile tags'); $error_update[] = __('Autocreate profile tags');
} }
@ -1607,7 +1607,7 @@ function config_update_config()
'port' => $config['history_db_port'], 'port' => $config['history_db_port'],
'name' => $config['history_db_name'], 'name' => $config['history_db_name'],
'user' => $config['history_db_user'], 'user' => $config['history_db_user'],
'pass' => $config['history_db_pass'], 'pass' => io_output_password($config['history_db_pass']),
] ]
); );
@ -1619,48 +1619,47 @@ function config_update_config()
$dbm->process(); $dbm->process();
} else if ($dbm->check() !== true) { } else if ($dbm->check() !== true) {
$errors[] = $dbm->getLastError(); $errors[] = $dbm->getLastError();
config_update_value('history_db_enabled', false);
}
if ($dbm->check() === true) {
// Historical configuration tokens (stored in historical db).
if ($dbm->setConfigToken(
'days_purge',
get_parameter('history_dbh_purge')
) !== true
) {
$error_update[] = __('Historical database purge');
}
if ($dbm->setConfigToken(
'history_partitions_auto',
get_parameter_switch('history_partitions_auto', 0)
) !== true
) {
$error_update[] = __('Historical database partitions');
}
if ($dbm->setConfigToken(
'event_purge',
get_parameter('history_dbh_events_purge')
) !== true
) {
$error_update[] = __('Historical database events purge');
}
if ($dbm->setConfigToken(
'string_purge',
get_parameter('history_dbh_string_purge')
) !== true
) {
$error_update[] = __('Historical database string purge');
}
// Disable history db in history db.
$dbm->setConfigToken('history_db_enabled', 0);
} }
} }
// Historical configuration tokens (stored in historical db).
if (Config::set(
'days_purge',
get_parameter('history_dbh_purge'),
true
) !== true
) {
$error_update[] = __('Historical database purge');
}
if (Config::set(
'history_partitions_auto',
get_parameter_switch('history_partitions_auto', 0),
true
) !== true
) {
$error_update[] = __('Historical database partitions');
}
if (Config::set(
'event_purge',
get_parameter('history_dbh_events_purge'),
true
) !== true
) {
$error_update[] = __('Historical database events purge');
}
if (Config::set(
'string_purge',
get_parameter('history_dbh_string_purge'),
true
) !== true
) {
$error_update[] = __('Historical database string purge');
}
// Disable history db in history db.
Config::set('history_db_enabled', 0, true);
break; break;
case 'ehorus': case 'ehorus':
@ -2096,6 +2095,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);
} }
@ -2353,12 +2356,12 @@ function config_process_config()
config_update_value('custom_favicon', ''); config_update_value('custom_favicon', '');
} }
if (!isset($config['custom_logo'])) { if (isset($config['custom_logo']) === false) {
config_update_value('custom_logo', 'pandora_logo_head_4.png'); config_update_value('custom_logo', HEADER_LOGO_DEFAULT_CLASSIC);
} }
if (!isset($config['custom_logo_collapsed'])) { if (isset($config['custom_logo_collapsed']) === false) {
config_update_value('custom_logo_collapsed', 'pandora_logo_green_collapsed.png'); config_update_value('custom_logo_collapsed', HEADER_LOGO_DEFAULT_COLLAPSED);
} }
if (is_metaconsole()) { if (is_metaconsole()) {

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

@ -670,16 +670,16 @@ function filemanager_file_explorer(
} }
if ($fileinfo['is_dir']) { if ($fileinfo['is_dir']) {
$data[1] = '<a href="'.$url.'&directory='.$relative_directory.'/'.$fileinfo['name'].'&hash2='.md5($relative_directory.'/'.$fileinfo['name'].$config['server_unique_identifier']).'">'.$fileinfo['name'].'</a>'; $data[1] = '<a href="'.$url.'&directory='.$relative_directory.'/'.io_safe_input($fileinfo['name']).'&hash2='.md5($relative_directory.'/'.$fileinfo['name'].$config['server_unique_identifier']).'">'.io_safe_input($fileinfo['name']).'</a>';
} else if (empty($url_file) === false) { } else if (empty($url_file) === false) {
// Set the custom url file. // Set the custom url file.
$url_file_clean = str_replace('[FILE_FULLPATH]', $fileinfo['realpath'], $url_file); $url_file_clean = str_replace('[FILE_FULLPATH]', $fileinfo['realpath'], $url_file);
$data[1] = '<a href="'.$url_file_clean.'">'.$fileinfo['name'].'</a>'; $data[1] = '<a href="'.$url_file_clean.'">'.io_safe_input($fileinfo['name']).'</a>';
} else { } else {
$filename = base64_encode($relative_directory.'/'.$fileinfo['name']); $filename = base64_encode($relative_directory.'/'.$fileinfo['name']);
$hash = md5($filename.$config['server_unique_identifier']); $hash = md5($filename.$config['server_unique_identifier']);
$data[1] = '<a href="'.$hack_metaconsole.'include/get_file.php?file='.urlencode($filename).'&hash='.$hash.'">'.$fileinfo['name'].'</a>'; $data[1] = '<a href="'.$hack_metaconsole.'include/get_file.php?file='.urlencode($filename).'&hash='.$hash.'">'.io_safe_input($fileinfo['name']).'</a>';
} }
// Notice that uploaded php files could be dangerous. // Notice that uploaded php files could be dangerous.

View File

@ -4237,6 +4237,82 @@ function html_print_image(
} }
/**
* Function for print the logo in menu header.
*
* @param boolean $menuCollapsed If true, the menu is collapsed.
* @param boolean $return If true, the formed element is returned.
*
* @return mixed.
*/
function html_print_header_logo_image(bool $menuCollapsed, bool $return=false)
{
global $config;
if (defined('PANDORA_ENTERPRISE') === false) {
if ($config['style'] === 'pandora_black') {
$custom_logo = 'images/custom_logo/'.HEADER_LOGO_BLACK_CLASSIC;
$custom_logo_collapsed = 'images/custom_logo/'.HEADER_LOGO_DEFAULT_COLLAPSED;
} else if ($config['style'] === 'pandora') {
$custom_logo = 'images/custom_logo/'.HEADER_LOGO_DEFAULT_CLASSIC;
$custom_logo_collapsed = 'images/custom_logo/'.HEADER_LOGO_DEFAULT_COLLAPSED;
}
$logo_title = get_product_name().' Opensource';
} else {
// Handle default logos when change theme.
if ($config['style'] === 'pandora_black' && $config['custom_logo'] === HEADER_LOGO_DEFAULT_CLASSIC) {
$config['custom_logo'] = HEADER_LOGO_BLACK_CLASSIC;
} else if ($config['style'] === 'pandora' && $config['custom_logo'] === HEADER_LOGO_BLACK_CLASSIC) {
$config['custom_logo'] = HEADER_LOGO_DEFAULT_CLASSIC;
}
$logo_title = get_product_name().' Enterprise';
$custom_logo = 'images/custom_logo/'.$config['custom_logo'];
$custom_logo_collapsed = 'images/custom_logo/'.$config['custom_logo_collapsed'];
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo) === true) {
$custom_logo = ENTERPRISE_DIR.'/'.$custom_logo;
}
}
if (isset($config['custom_logo']) === true) {
$output = html_print_image(
$custom_logo,
true,
[
'border' => '0',
'width' => '215',
'alt' => $logo_title,
'class' => 'logo_full',
'style' => ($menuCollapsed === true) ? 'display:none' : 'display:block',
]
);
}
if (isset($config['custom_logo_collapsed']) === true) {
$output .= html_print_image(
$custom_logo_collapsed,
true,
[
'border' => '0',
'width' => '60',
'alt' => $logo_title,
'class' => 'logo_icon',
'style' => ($menuCollapsed === true) ? 'display:block' : 'display:none',
]
);
}
if ($return === false) {
echo $output;
} else {
return $output;
}
}
/** /**
* Render an input text element. Extended version, use html_print_input_text() to simplify. * Render an input text element. Extended version, use html_print_input_text() to simplify.
* *

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;
return db_get_sql(
" $table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
SELECT COUNT(*)
FROM tagente if (users_is_admin() === true) {
WHERE tagente.disabled=0 AND return db_get_sql(
critical_count>0 AND id_os=$id_os" sprintf(
); 'SELECT COUNT(*)
FROM %s
WHERE tagente.disabled=0 AND
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)
{ {
return db_get_sql( global $config;
"
SELECT COUNT(*) $table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
FROM tagente
WHERE tagente.disabled=0 AND if (users_is_admin() === true) {
normal_count=total_count AND id_os=$id_os" return db_get_sql(
); sprintf(
'SELECT COUNT(*)
FROM %s
WHERE tagente.disabled=0 AND
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)
{ {
return db_get_sql( global $config;
"
SELECT COUNT(*) $table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
FROM tagente
WHERE tagente.disabled=0 AND if (users_is_admin() === true) {
critical_count=0 AND warning_count>0 AND id_os=$id_os" 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',
$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)
{ {
return db_get_sql( global $config;
"
SELECT COUNT(*) $table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
FROM tagente
WHERE tagente.disabled=0 AND if (users_is_admin() === true) {
critical_count=0 AND warning_count=0 AND return db_get_sql(
unknown_count>0 AND id_os=$id_os" 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',
$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

@ -810,7 +810,7 @@ function reporting_make_reporting_data(
break; break;
} }
$report['contents'][] = $report_control; $report['contents'][] = $report_control;
break; break;
case 'event_report_module': case 'event_report_module':
@ -826,7 +826,7 @@ function reporting_make_reporting_data(
break; break;
} }
$report['contents'][] = $report_control; $report['contents'][] = $report_control;
break; break;
case 'event_report_group': case 'event_report_group':
@ -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,8 +14749,10 @@ 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 ((bool) $content['dinamic_proc'] === true) { if ($agentmodule_info['min_critical'] == 0) {
$max_value_critical = 0.01; if ((bool) $content['dinamic_proc'] === true) {
$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;"';
@ -2455,6 +2469,8 @@ function pandoraFlotArea(
number_format(value[x].max, 0, unit, short_data, divisor) + number_format(value[x].max, 0, unit, short_data, divisor) +
" Avg: " + " Avg: " +
number_format(value[x].avg, 0, unit, short_data, divisor); number_format(value[x].avg, 0, unit, short_data, divisor);
} else {
data_legend[index] = " Min: " + 0 + " Max: " + 0 + " Avg: " + 0;
} }
}); });

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
text.transition().attr("opacity", 0); if (d.type === "central_service") {
text.transition().attr("opacity", 1);
} else {
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

@ -2027,3 +2027,33 @@ function inArray(needle, haystack) {
} }
return false; return false;
} }
/**
* 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

@ -846,6 +846,11 @@ function add_macro_field(macro, row_model_id, type_copy, k) {
// Change attributes to be unique and with identificable class // Change attributes to be unique and with identificable class
$macro_field.attr("id", row_id); $macro_field.attr("id", row_id);
$macro_field
.find("input")
.first()
.attr("name", macro_macro)
.val(macro_value);
$macro_field.attr("class", "macro_field"); $macro_field.attr("class", "macro_field");

Some files were not shown because too many files have changed in this diff Show More