Merge branch 'develop' into ent-11710-fallo-en-la-paginacion-de-el-apartado-de-alert-commands-en-nodos-con-metaconsola

This commit is contained in:
Jonathan 2023-08-04 09:27:24 +02:00
commit 9dabecffce
254 changed files with 15072 additions and 2717 deletions

View File

@ -19,10 +19,10 @@ LOGFILE="/tmp/deploy-ext-db-$(date +%F).log"
[ "$DBHOST" ] || DBHOST=127.0.0.1 [ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora [ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora [ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora [ "$DBPASS" ] || DBPASS='Pandor4!'
[ "$DBPORT" ] || DBPORT=3306 [ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTUSER" ] || DBROOTUSER=root [ "$DBROOTUSER" ] || DBROOTUSER=root
[ "$DBROOTPASS" ] || DBROOTPASS=pandora [ "$DBROOTPASS" ] || DBROOTPASS='Pandor4!'
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0 [ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0 [ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g") [ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
@ -79,6 +79,53 @@ check_root_permissions () {
fi fi
} }
# Function to check if a password meets the MySQL secure password requirements
is_mysql_secure_password() {
local password=$1
# Check password length (at least 8 characters)
if [[ ${#password} -lt 8 ]]; then
echo "Password length should be at least 8 characters."
return 1
fi
# Check if password contains at least one uppercase letter
if [[ $password == ${password,,} ]]; then
echo "Password should contain at least one uppercase letter."
return 1
fi
# Check if password contains at least one lowercase letter
if [[ $password == ${password^^} ]]; then
echo "Password should contain at least one lowercase letter."
return 1
fi
# Check if password contains at least one digit
if ! [[ $password =~ [0-9] ]]; then
echo "Password should contain at least one digit."
return 1
fi
# Check if password contains at least one special character
if ! [[ $password =~ [[:punct:]] ]]; then
echo "Password should contain at least one special character."
return 1
fi
# Check if password is not a common pattern (e.g., "password", "123456")
local common_patterns=("password" "123456" "qwerty")
for pattern in "${common_patterns[@]}"; do
if [[ $password == *"$pattern"* ]]; then
echo "Password should not contain common patterns."
return 1
fi
done
# If all checks pass, the password is MySQL secure compliant
return 0
}
## Main ## Main
echo "Starting PandoraFMS External DB deployment EL8 ver. $S_VERSION" echo "Starting PandoraFMS External DB deployment EL8 ver. $S_VERSION"
@ -128,6 +175,10 @@ execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed' execute_cmd "sed --version" 'Checking needed tools: sed'
execute_cmd "dnf --version" 'Checking needed tools: dnf' execute_cmd "dnf --version" 'Checking needed tools: dnf'
#Check mysql pass
execute_cmd "is_mysql_secure_password $DBROOTPASS" "Checking DBROOTPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
execute_cmd "is_mysql_secure_password $DBPASS" "Checking DBPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
# Creating working directory # Creating working directory
rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE" rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE"
mkdir "$HOME"/pandora_deploy_tmp &>> "$LOGFILE" mkdir "$HOME"/pandora_deploy_tmp &>> "$LOGFILE"
@ -207,16 +258,12 @@ if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
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)
if [ "$MYVER" -eq '80' ] ; then if [ "$MYVER" -eq '80' ] ; then
echo """ echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = 'Pandor4!';
UNINSTALL COMPONENT 'file://component_validate_password';
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = '$DBROOTPASS'; SET PASSWORD FOR '$DBROOTUSER'@'localhost' = '$DBROOTPASS';
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE" """ | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"
fi fi
if [ "$MYVER" -ne '80' ] ; then if [ "$MYVER" -ne '80' ] ; then
echo """ echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('Pandor4!');
UNINSTALL PLUGIN validate_password;
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('$DBROOTPASS'); SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('$DBROOTPASS');
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"fi """ | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"fi
fi fi

View File

@ -26,9 +26,9 @@ rm -f $LOGFILE &> /dev/null # remove last log before start
[ "$DBHOST" ] || DBHOST=127.0.0.1 [ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora [ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora [ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora [ "$DBPASS" ] || DBPASS='Pandor4!'
[ "$DBPORT" ] || DBPORT=3306 [ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTPASS" ] || DBROOTPASS=pandora [ "$DBROOTPASS" ] || DBROOTPASS='Pandor4!'
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0 [ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0 [ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g") [ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
@ -86,6 +86,53 @@ check_root_permissions () {
fi fi
} }
# Function to check if a password meets the MySQL secure password requirements
is_mysql_secure_password() {
local password=$1
# Check password length (at least 8 characters)
if [[ ${#password} -lt 8 ]]; then
echo "Password length should be at least 8 characters."
return 1
fi
# Check if password contains at least one uppercase letter
if [[ $password == ${password,,} ]]; then
echo "Password should contain at least one uppercase letter."
return 1
fi
# Check if password contains at least one lowercase letter
if [[ $password == ${password^^} ]]; then
echo "Password should contain at least one lowercase letter."
return 1
fi
# Check if password contains at least one digit
if ! [[ $password =~ [0-9] ]]; then
echo "Password should contain at least one digit."
return 1
fi
# Check if password contains at least one special character
if ! [[ $password =~ [[:punct:]] ]]; then
echo "Password should contain at least one special character."
return 1
fi
# Check if password is not a common pattern (e.g., "password", "123456")
local common_patterns=("password" "123456" "qwerty")
for pattern in "${common_patterns[@]}"; do
if [[ $password == *"$pattern"* ]]; then
echo "Password should not contain common patterns."
return 1
fi
done
# If all checks pass, the password is MySQL secure compliant
return 0
}
## Main ## Main
echo "Starting PandoraFMS External DB deployment Ubuntu 22.04 ver. $S_VERSION" echo "Starting PandoraFMS External DB deployment Ubuntu 22.04 ver. $S_VERSION"
@ -137,6 +184,10 @@ execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed' execute_cmd "sed --version" 'Checking needed tools: sed'
execute_cmd "apt --version" 'Checking needed tools: apt' execute_cmd "apt --version" 'Checking needed tools: apt'
#Check mysql pass
execute_cmd "is_mysql_secure_password $DBROOTPASS" "Checking DBROOTPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
execute_cmd "is_mysql_secure_password $DBPASS" "Checking DBPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
# Creating working directory # Creating working directory
rm -rf "$WORKDIR" &>> "$LOGFILE" rm -rf "$WORKDIR" &>> "$LOGFILE"
mkdir -p "$WORKDIR" &>> "$LOGFILE" mkdir -p "$WORKDIR" &>> "$LOGFILE"
@ -170,6 +221,7 @@ if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
""" | mysql -uroot &>> "$LOGFILE" """ | mysql -uroot &>> "$LOGFILE"
export MYSQL_PWD=$DBROOTPASS export MYSQL_PWD=$DBROOTPASS
echo "INSTALL COMPONENT 'file://component_validate_password';" | mysql -uroot -P$DBPORT -h$DBHOST &>> "$LOGFILE"
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."

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='2023050901' S_VERSION='2023062901'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables # define default variables
@ -285,8 +285,7 @@ console_dependencies=" \
mod_ssl \ mod_ssl \
libzstd \ libzstd \
openldap-clients \ openldap-clients \
chromium \ chromium"
http://firefly.pandorafms.com/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"
# Server dependencies # Server dependencies
@ -313,7 +312,6 @@ server_dependencies=" \
bind-utils \ bind-utils \
whois \ whois \
cpanminus \ cpanminus \
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \ http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \
https://firefly.pandorafms.com/centos7/pandorawmic-1.0.0-1.x86_64.rpm" https://firefly.pandorafms.com/centos7/pandorawmic-1.0.0-1.x86_64.rpm"
execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies" execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
@ -341,7 +339,6 @@ execute_cmd "yum install -y $oracle_dependencies || yum reinstall -y $oracle_dep
#ipam dependencies #ipam dependencies
ipam_dependencies=" \ ipam_dependencies=" \
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
perl(NetAddr::IP) \ perl(NetAddr::IP) \
perl(Sys::Syslog) \ perl(Sys::Syslog) \
perl(DBI) \ perl(DBI) \
@ -719,6 +716,9 @@ echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cro
systemctl enable pandora_agent_daemon &>> $LOGFILE systemctl enable pandora_agent_daemon &>> $LOGFILE
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent" execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
# Enable postrix
systemctl enable postfix --now &>> "$LOGFILE"
#SSH banner #SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me) [ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)

View File

@ -14,7 +14,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='2023050901' S_VERSION='2023062901'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables # define default variables
@ -24,10 +24,10 @@ LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
[ "$DBHOST" ] || DBHOST=127.0.0.1 [ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora [ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora [ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora [ "$DBPASS" ] || DBPASS='Pandor4!'
[ "$DBPORT" ] || DBPORT=3306 [ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTUSER" ] || DBROOTUSER=root [ "$DBROOTUSER" ] || DBROOTUSER=root
[ "$DBROOTPASS" ] || DBROOTPASS=pandora [ "$DBROOTPASS" ] || DBROOTPASS='Pandor4!'
[ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0 [ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0 [ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0 [ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
@ -125,6 +125,52 @@ installing_docker () {
echo "End installig docker" &>> "$LOGFILE" echo "End installig docker" &>> "$LOGFILE"
} }
# Function to check if a password meets the MySQL secure password requirements
is_mysql_secure_password() {
local password=$1
# Check password length (at least 8 characters)
if [[ ${#password} -lt 8 ]]; then
echo "Password length should be at least 8 characters."
return 1
fi
# Check if password contains at least one uppercase letter
if [[ $password == ${password,,} ]]; then
echo "Password should contain at least one uppercase letter."
return 1
fi
# Check if password contains at least one lowercase letter
if [[ $password == ${password^^} ]]; then
echo "Password should contain at least one lowercase letter."
return 1
fi
# Check if password contains at least one digit
if ! [[ $password =~ [0-9] ]]; then
echo "Password should contain at least one digit."
return 1
fi
# Check if password contains at least one special character
if ! [[ $password =~ [[:punct:]] ]]; then
echo "Password should contain at least one special character."
return 1
fi
# Check if password is not a common pattern (e.g., "password", "123456")
local common_patterns=("password" "123456" "qwerty")
for pattern in "${common_patterns[@]}"; do
if [[ $password == *"$pattern"* ]]; then
echo "Password should not contain common patterns."
return 1
fi
done
# If all checks pass, the password is MySQL secure compliant
return 0
}
## Main ## Main
echo "Starting PandoraFMS Community deployment EL8 ver. $S_VERSION" echo "Starting PandoraFMS Community deployment EL8 ver. $S_VERSION"
@ -189,6 +235,10 @@ execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed' execute_cmd "sed --version" 'Checking needed tools: sed'
execute_cmd "dnf --version" 'Checking needed tools: dnf' execute_cmd "dnf --version" 'Checking needed tools: dnf'
#Check mysql pass
execute_cmd "is_mysql_secure_password $DBROOTPASS" "Checking DBROOTPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
execute_cmd "is_mysql_secure_password $DBPASS" "Checking DBPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
# Creating working directory # Creating working directory
rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE" rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE"
mkdir "$HOME"/pandora_deploy_tmp &>> "$LOGFILE" mkdir "$HOME"/pandora_deploy_tmp &>> "$LOGFILE"
@ -344,8 +394,7 @@ console_dependencies=" \
http://firefly.pandorafms.com/centos8/chromium-110.0.5481.177-1.el7.x86_64.rpm \ http://firefly.pandorafms.com/centos8/chromium-110.0.5481.177-1.el7.x86_64.rpm \
http://firefly.pandorafms.com/centos8/chromium-common-110.0.5481.177-1.el7.x86_64.rpm \ http://firefly.pandorafms.com/centos8/chromium-common-110.0.5481.177-1.el7.x86_64.rpm \
http://firefly.pandorafms.com/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \ http://firefly.pandorafms.com/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \ http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm"
http://firefly.pandorafms.com/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
execute_cmd "dnf install -y $console_dependencies" "Installing Pandora FMS Console dependencies" execute_cmd "dnf install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
# Server dependencies # Server dependencies
@ -371,7 +420,7 @@ server_dependencies=" \
java \ java \
bind-utils \ bind-utils \
whois \ whois \
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \ libnsl \
http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \ http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \
https://firefly.pandorafms.com/centos8/pandorawmic-1.0.0-1.x86_64.rpm" https://firefly.pandorafms.com/centos8/pandorawmic-1.0.0-1.x86_64.rpm"
execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies" execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
@ -399,7 +448,6 @@ execute_cmd "dnf install -y $oracle_dependencies" "Installing Oracle Instant cli
#ipam dependencies #ipam dependencies
ipam_dependencies=" \ ipam_dependencies=" \
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
perl(NetAddr::IP) \ perl(NetAddr::IP) \
perl(Sys::Syslog) \ perl(Sys::Syslog) \
perl(DBI) \ perl(DBI) \
@ -439,7 +487,6 @@ if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
if [ "$MYVER" -eq '80' ] ; then if [ "$MYVER" -eq '80' ] ; then
echo """ echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = 'Pandor4!'; SET PASSWORD FOR '$DBROOTUSER'@'localhost' = 'Pandor4!';
UNINSTALL COMPONENT 'file://component_validate_password';
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = '$DBROOTPASS'; SET PASSWORD FOR '$DBROOTUSER'@'localhost' = '$DBROOTPASS';
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE" """ | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"
fi fi
@ -447,7 +494,6 @@ if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
if [ "$MYVER" -ne '80' ] ; then if [ "$MYVER" -ne '80' ] ; then
echo """ echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('Pandor4!'); SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('Pandor4!');
UNINSTALL PLUGIN validate_password;
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('$DBROOTPASS'); SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('$DBROOTPASS');
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"fi """ | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"fi
fi fi
@ -622,8 +668,9 @@ sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini
sed -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini sed -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini
sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
#adding 900s to httpd timeout #adding 900s to httpd timeout and 300 to ProxyTimeout
echo 'TimeOut 900' > /etc/httpd/conf.d/timeout.conf echo 'TimeOut 900' > /etc/httpd/conf.d/timeout.conf
echo 'ProxyTimeout 300' >> /etc/httpd/conf.d/timeout.conf
cat > /var/www/html/index.html << EOF_INDEX cat > /var/www/html/index.html << EOF_INDEX
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/"> <meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">
@ -787,6 +834,9 @@ echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cro
systemctl enable pandora_agent_daemon &>> "$LOGFILE" systemctl enable pandora_agent_daemon &>> "$LOGFILE"
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent" execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
# Enable postfix
systemctl enable postfix --now &>> "$LOGFILE"
#SSH banner #SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me) [ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)

View File

@ -17,7 +17,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
WORKDIR=/opt/pandora/deploy WORKDIR=/opt/pandora/deploy
S_VERSION='2023050901' S_VERSION='2023062901'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
rm -f $LOGFILE &> /dev/null # remove last log before start rm -f $LOGFILE &> /dev/null # remove last log before start
@ -27,9 +27,9 @@ rm -f $LOGFILE &> /dev/null # remove last log before start
[ "$DBHOST" ] || DBHOST=127.0.0.1 [ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora [ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora [ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora [ "$DBPASS" ] || DBPASS='Pandor4!'
[ "$DBPORT" ] || DBPORT=3306 [ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTPASS" ] || DBROOTPASS=pandora [ "$DBROOTPASS" ] || DBROOTPASS='Pandor4!'
[ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0 [ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0 [ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0 [ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
@ -113,6 +113,53 @@ check_root_permissions () {
fi fi
} }
# Function to check if a password meets the MySQL secure password requirements
is_mysql_secure_password() {
local password=$1
# Check password length (at least 8 characters)
if [[ ${#password} -lt 8 ]]; then
echo "Password length should be at least 8 characters."
return 1
fi
# Check if password contains at least one uppercase letter
if [[ $password == ${password,,} ]]; then
echo "Password should contain at least one uppercase letter."
return 1
fi
# Check if password contains at least one lowercase letter
if [[ $password == ${password^^} ]]; then
echo "Password should contain at least one lowercase letter."
return 1
fi
# Check if password contains at least one digit
if ! [[ $password =~ [0-9] ]]; then
echo "Password should contain at least one digit."
return 1
fi
# Check if password contains at least one special character
if ! [[ $password =~ [[:punct:]] ]]; then
echo "Password should contain at least one special character."
return 1
fi
# Check if password is not a common pattern (e.g., "password", "123456")
local common_patterns=("password" "123456" "qwerty")
for pattern in "${common_patterns[@]}"; do
if [[ $password == *"$pattern"* ]]; then
echo "Password should not contain common patterns."
return 1
fi
done
# If all checks pass, the password is MySQL secure compliant
return 0
}
installing_docker () { installing_docker () {
#Installing docker for debug #Installing docker for debug
echo "Start installig docker" &>> "$LOGFILE" echo "Start installig docker" &>> "$LOGFILE"
@ -194,6 +241,10 @@ execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed' execute_cmd "sed --version" 'Checking needed tools: sed'
execute_cmd "apt --version" 'Checking needed tools: apt' execute_cmd "apt --version" 'Checking needed tools: apt'
#Check mysql pass
execute_cmd "is_mysql_secure_password $DBROOTPASS" "Checking DBROOTPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
execute_cmd "is_mysql_secure_password $DBPASS" "Checking DBPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
# Creating working directory # Creating working directory
rm -rf "$WORKDIR" &>> "$LOGFILE" rm -rf "$WORKDIR" &>> "$LOGFILE"
mkdir -p "$WORKDIR" &>> "$LOGFILE" mkdir -p "$WORKDIR" &>> "$LOGFILE"
@ -265,7 +316,6 @@ server_dependencies=" \
openssh-client \ openssh-client \
postfix \ postfix \
unzip \ unzip \
xprobe \
coreutils \ coreutils \
libio-compress-perl \ libio-compress-perl \
libmoosex-role-timer-perl \ libmoosex-role-timer-perl \
@ -287,6 +337,8 @@ server_dependencies=" \
libgeo-ip-perl \ libgeo-ip-perl \
arping \ arping \
snmp-mibs-downloader \ snmp-mibs-downloader \
snmptrapd \
libnsl2 \
openjdk-8-jdk " openjdk-8-jdk "
execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server dependencies" execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
@ -299,17 +351,7 @@ echo -en "${cyan}Installing wmic and pandorawmic...${reset}"
chmod +x pandorawmic wmic &>> "$LOGFILE" && \ chmod +x pandorawmic wmic &>> "$LOGFILE" && \
cp -a wmic /usr/bin/ &>> "$LOGFILE" && \ cp -a wmic /usr/bin/ &>> "$LOGFILE" && \
cp -a pandorawmic /usr/bin/ &>> "$LOGFILE" cp -a pandorawmic /usr/bin/ &>> "$LOGFILE"
check_cmd_status "Error Installing phanromjs" check_cmd_status "Error Installing pandorawmic/wmic"
# phantomjs
echo -en "${cyan}Installing phantomjs...${reset}"
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
export OPENSSL_CONF=/etc/ssl
curl -LSs -O "https://firefly.pandorafms.com/pandorafms/utils/$PHANTOM_JS.tar.bz2" &>> "$LOGFILE" && \
tar xvjf "$PHANTOM_JS.tar.bz2" &>> "$LOGFILE" && \
mv $PHANTOM_JS/bin/phantomjs /usr/bin &>> "$LOGFILE" && \
/usr/bin/phantomjs --version &>> "$LOGFILE"
check_cmd_status "Error Installing phanromjs"
# create symlink for fping # create symlink for fping
rm -f /usr/sbin/fping &>> "$LOGFILE" rm -f /usr/sbin/fping &>> "$LOGFILE"
@ -370,7 +412,6 @@ source '/root/.profile' &>> "$LOGFILE"
#ipam dependencies #ipam dependencies
ipam_dependencies=" \ ipam_dependencies=" \
xprobe \
libnetaddr-ip-perl \ libnetaddr-ip-perl \
coreutils \ coreutils \
libdbd-mysql-perl \ libdbd-mysql-perl \
@ -413,6 +454,7 @@ if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
""" | mysql -uroot &>> "$LOGFILE" """ | mysql -uroot &>> "$LOGFILE"
export MYSQL_PWD=$DBROOTPASS export MYSQL_PWD=$DBROOTPASS
echo "INSTALL COMPONENT 'file://component_validate_password';" | mysql -uroot -P$DBPORT -h$DBHOST &>> "$LOGFILE"
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."
@ -619,8 +661,9 @@ sed --follow-symlinks -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.i
sed --follow-symlinks -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini sed --follow-symlinks -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
sed --follow-symlinks -i -e "s/^disable_functions/;disable_functions/" /etc/php.ini sed --follow-symlinks -i -e "s/^disable_functions/;disable_functions/" /etc/php.ini
#adding 900s to httpd timeout #adding 900s to httpd timeout and 300 to ProxyTimeout
#echo 'TimeOut 900' > /etc/httpd/conf.d/timeout.conf echo 'TimeOut 900' > /etc/apache2/conf-enabled/timeout.conf
echo 'ProxyTimeout 300' >> /etc/apache2/conf-enabled/timeout.conf
cat > /var/www/html/index.html << EOF_INDEX cat > /var/www/html/index.html << EOF_INDEX
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/"> <meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">
@ -792,6 +835,13 @@ systemctl enable pandora_agent_daemon &>> "$LOGFILE"
#fix path phantomjs #fix path phantomjs
sed --follow-symlinks -i -e "s/^openssl_conf = openssl_init/#openssl_conf = openssl_init/g" /etc/ssl/openssl.cnf &>> "$LOGFILE" sed --follow-symlinks -i -e "s/^openssl_conf = openssl_init/#openssl_conf = openssl_init/g" /etc/ssl/openssl.cnf &>> "$LOGFILE"
# Enable postfix
systemctl enable postfix --now &>> "$LOGFILE"
# Disable snmptrapd
systemctl disable --now snmptrapd &>> "$LOGFILE"
systemctl disable --now snmptrapd.socket &>> "$LOGFILE"
#SSH banner #SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me) [ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)

View File

@ -4,7 +4,7 @@ Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin
Installed-Size: 260 Installed-Size: 260
Maintainer: ÁRTICA ST <info@artica.es> Maintainer: Pandora FMS <info@pandorafms.com>
Homepage: https://pandorafms.org/ Homepage: https://pandorafms.org/
Depends: coreutils, perl, unzip Depends: coreutils, perl, unzip
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. Its possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file. Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. Its possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.

View File

@ -4,7 +4,7 @@ Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin
Installed-Size: 260 Installed-Size: 260
Maintainer: ÁRTICA ST <info@artica.es> Maintainer: Pandora FMS <info@pandorafms.com>
Homepage: http://pandorafms.org/ Homepage: http://pandorafms.org/
Depends: coreutils, perl Depends: coreutils, perl
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. Its possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file. Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. Its possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.

View File

@ -1,10 +1,10 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.772-230712 Version: 7.0NG.772-230804
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin
Installed-Size: 260 Installed-Size: 260
Maintainer: ÁRTICA ST <info@artica.es> Maintainer: Pandora FMS <info@pandorafms.com>
Homepage: http://pandorafms.org/ Homepage: http://pandorafms.org/
Depends: coreutils, perl, unzip Depends: coreutils, perl, unzip
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. Its possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file. Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. Its possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.

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.772-230712" pandora_version="7.0NG.772-230804"
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

@ -6,7 +6,7 @@
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string> <key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
<key>CFBundleVersion</key> <string>7.0NG.772</string> <key>CFBundleVersion</key> <string>7.0NG.772</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.772 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string> <key>CFBundleGetInfoString</key> <string>7.0NG.772 Pandora FMS on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.772</string> <key>CFBundleShortVersionString</key> <string>7.0NG.772</string>
<key>NSPrincipalClass</key><string>NSApplication</string> <key>NSPrincipalClass</key><string>NSApplication</string>

View File

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

View File

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

View File

@ -0,0 +1,168 @@
#
#Pandora FMS Linux Agent
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.772
%define release 230725
Summary: Pandora FMS Linux agent, binary version
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: ArticaST <http://www.artica.es>
Source0: %{source_name}-%{version}.tar.gz
URL: http://pandorafms.org
Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: noarch
Requires(pre): shadow-utils
Requires(post): chkconfig /bin/ln
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: coreutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl(Sys::Syslog) perl(IO::Compress::Zip)
# Required by plugins
#Requires: sh-utils sed passwd net-tools rpm
AutoReq: 0
Provides: %{name}-%{version}
%description
Pandora FMS agent for unix. Pandora FMS is an OpenSource full-featured monitoring software.
%prep
rm -rf $RPM_BUILD_ROOT
%setup -q -n unix
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
install -m 0644 pandora_agent_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_agent
if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then
rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec
fi
%clean
rm -Rf $RPM_BUILD_ROOT
%pre
getent passwd pandora >/dev/null || \
/usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora
exit 0
chown pandora:root /var/log/pandora
%post
if [ ! -d /etc/pandora ] ; then
mkdir -p /etc/pandora
fi
if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
fi
if [ ! -f /etc/pandora/pandora_agent.conf ] ; then
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
else
[[ ! -f /etc/pandora/pandora_agent.conf.rpmnew ]] && ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
fi
if [ ! -e /etc/pandora/plugins ]; then
ln -s /usr/share/pandora_agent/plugins /etc/pandora
fi
if [ ! -e /etc/pandora/collections ]; then
mkdir -p /usr/share/pandora_agent/collections
ln -s /usr/share/pandora_agent/collections /etc/pandora
fi
if [ ! -e /etc/pandora/commands ]; then
mkdir -p /usr/share/pandora_agent/commands
ln -s /usr/share/pandora_agent/commands /etc/pandora
fi
mkdir -p /var/spool/pandora/data_out
if [ ! -d /var/log/pandora ]; then
mkdir -p /var/log/pandora
fi
if [ `command -v systemctl` ];
then
echo "Copying new version of pandora_agent_daemon service"
cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/
chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service
# Enable the services on SystemD
systemctl enable pandora_agent_daemon.service
else
/sbin/chkconfig --add pandora_agent_daemon
/sbin/chkconfig pandora_agent_daemon on
fi
if [ "$1" -gt 1 ]
then
echo "If Pandora Agent daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
%preun
# Upgrading
if [ "$1" = "1" ]; then
exit 0
fi
/sbin/chkconfig --del pandora_agent_daemon
/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
# Remove symbolic links
pushd /etc/pandora
for f in pandora_agent.conf plugins collections
do
[ -L $f ] && rm -f $f
done
exit 0
%files
%defattr(750,root,root)
/usr/bin/pandora_agent
%defattr(755,pandora,root)
%{prefix}/pandora_agent
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/etc/rc.d/init.d/pandora_agent_daemon
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent

View File

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

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.772" PI_VERSION="7.0NG.772"
PI_BUILD="230712" PI_BUILD="230804"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0
@ -541,8 +541,17 @@ install () {
then then
echo "Define 'pandora_agent=\"YES\"' in /etc/rc.conf to enable the daemon." echo "Define 'pandora_agent=\"YES\"' in /etc/rc.conf to enable the daemon."
else else
echo "Check your startup configuration to be sure Pandora FMS Agent is ready " # Enable startup service
echo "to start automatically when system restarts": if [ `command -v systemctl` ]
then
systemctl enable pandora_agent_daemon
elif [ `command -v chkconfig` ]
then
chkconfig pandora_agent_daemon on
else
echo "Check your startup configuration to be sure Pandora FMS Agent is ready "
echo "to start automatically when system restarts":
fi
fi fi
# Restore the daemon script # Restore the daemon script

View File

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

View File

@ -6,12 +6,12 @@ BEGIN
BEGIN BEGIN
BLOCK "080904E4" BLOCK "080904E4"
BEGIN BEGIN
VALUE "CompanyName", "Artica ST" VALUE "CompanyName", "Pandora FMS"
VALUE "FileDescription", "Pandora FMS Agent for Windows Platform" VALUE "FileDescription", "Pandora FMS Agent for Windows Platform"
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.772(Build 230712))" VALUE "ProductVersion", "(7.0NG.772(Build 230804))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,10 +1,10 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.772-230712 Version: 7.0NG.772-230804
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin
Installed-Size: 42112 Installed-Size: 42112
Maintainer: Artica ST <deptec@artica.es> Maintainer: Pandora FMS <info@pandorafms.com>
Homepage: https://pandorafms.com/ Homepage: https://pandorafms.com/
Depends: php, php-snmp, php-gd, php-mysqlnd, php-db, php-xmlrpc, php-curl, graphviz, dbconfig-common, php-ldap, mysql-client | virtual-mysql-client, php-xmlrpc, php-zip, php-mbstring Depends: php, php-snmp, php-gd, php-mysqlnd, php-db, php-xmlrpc, php-curl, graphviz, dbconfig-common, php-ldap, mysql-client | virtual-mysql-client, php-xmlrpc, php-zip, php-mbstring
Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process. Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process.

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.772-230712" pandora_version="7.0NG.772-230804"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1
@ -163,7 +163,7 @@ if [ $package_pear -eq 1 ]
then then
echo "Make the package \"php-xml-rpc\"." echo "Make the package \"php-xml-rpc\"."
cd temp_package cd temp_package
dh-make-pear --maintainer "ÁRTICA ST <info@artica.es>" XML_RPC dh-make-pear --maintainer "Pandora FMS <info@pandorafms.com>" XML_RPC
cd php-xml-rpc-* cd php-xml-rpc-*
dpkg-buildpackage -rfakeroot dpkg-buildpackage -rfakeroot
cd .. cd ..

View File

@ -609,7 +609,7 @@
} }
], ],
"description": "PHP library for ChartJS", "description": "PHP library for ChartJS",
"homepage": "https://artica.es/", "homepage": "https://pandorafms.com/",
"keywords": [ "keywords": [
"chartjs", "chartjs",
"graph", "graph",

View File

@ -1692,3 +1692,14 @@ enterprise/godmode/modules/manage_inventory_modules_form.php
enterprise/operation/inventory/inventory.php enterprise/operation/inventory/inventory.php
include/test.js include/test.js
include/web2image.js include/web2image.js
enterprise/meta/monitoring/wizard/wizard.agent.php
enterprise/meta/monitoring/wizard/wizard.create_agent.php
enterprise/meta/monitoring/wizard/wizard.create_module.php
enterprise/meta/monitoring/wizard/wizard.main.php
enterprise/meta/monitoring/wizard/wizard.manage_alert.php
enterprise/meta/monitoring/wizard/wizard.module.local.php
enterprise/meta/monitoring/wizard/wizard.module.network.php
enterprise/meta/monitoring/wizard/wizard.module.web.php
enterprise/meta/monitoring/wizard/wizard.php
enterprise/meta/monitoring/wizard/wizard.update_agent.php
enterprise/meta/monitoring/wizard/wizard.update_module.php

View File

@ -1,5 +1,67 @@
START TRANSACTION; START TRANSACTION;
CREATE TABLE IF NOT EXISTS `tdiscovery_apps` (
`id_app` int(10) auto_increment,
`short_name` varchar(250) NOT NULL DEFAULT '',
`name` varchar(250) NOT NULL DEFAULT '',
`section` varchar(250) NOT NULL DEFAULT 'custom',
`description` varchar(250) NOT NULL DEFAULT '',
`version` varchar(250) NOT NULL DEFAULT '',
PRIMARY KEY (`id_app`),
UNIQUE (`short_name`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tdiscovery_apps_scripts` (
`id_app` int(10),
`macro` varchar(250) NOT NULL DEFAULT '',
`value` text NOT NULL DEFAULT '',
PRIMARY KEY (`id_app`, `macro`),
FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tdiscovery_apps_executions` (
`id` int(10) unsigned NOT NULL auto_increment,
`id_app` int(10),
`execution` text NOT NULL DEFAULT '',
PRIMARY KEY (`id`, `id_app`),
FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tdiscovery_apps_tasks_macros` (
`id_task` int(10) unsigned NOT NULL,
`macro` varchar(250) NOT NULL DEFAULT '',
`type` varchar(250) NOT NULL DEFAULT 'custom',
`value` text NOT NULL DEFAULT '',
`temp_conf` tinyint unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id_task`, `macro`),
FOREIGN KEY (`id_task`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `trecon_task`
ADD COLUMN `id_app` int(10),
ADD COLUMN `setup_complete` tinyint unsigned NOT NULL DEFAULT 0,
ADD COLUMN `executions_timeout` int unsigned NOT NULL DEFAULT 60,
ADD FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE;
CREATE TABLE IF NOT EXISTS `tnetwork_explorer_filter` (
`id` INT NOT NULL,
`filter_name` VARCHAR(45) NULL,
`top` VARCHAR(45) NULL,
`action` VARCHAR(45) NULL,
`advanced_filter` TEXT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tnetwork_usage_filter` (
`id` INT NOT NULL auto_increment,
`filter_name` VARCHAR(45) NULL,
`top` VARCHAR(45) NULL,
`action` VARCHAR(45) NULL,
`advanced_filter` TEXT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `tlayout` ALTER TABLE `tlayout`
ADD COLUMN `grid_color` VARCHAR(45) NOT NULL DEFAULT '#cccccc' AFTER `maintenance_mode`, ADD COLUMN `grid_color` VARCHAR(45) NOT NULL DEFAULT '#cccccc' AFTER `maintenance_mode`,
ADD COLUMN `grid_size` VARCHAR(45) NOT NULL DEFAULT '10' AFTER `grid_color`; ADD COLUMN `grid_size` VARCHAR(45) NOT NULL DEFAULT '10' AFTER `grid_color`;
@ -8,6 +70,7 @@ ALTER TABLE `tlayout_template`
ADD COLUMN `grid_color` VARCHAR(45) NOT NULL DEFAULT '#cccccc' AFTER `maintenance_mode`, ADD COLUMN `grid_color` VARCHAR(45) NOT NULL DEFAULT '#cccccc' AFTER `maintenance_mode`,
ADD COLUMN `grid_size` VARCHAR(45) NOT NULL DEFAULT '10' AFTER `grid_color`; ADD COLUMN `grid_size` VARCHAR(45) NOT NULL DEFAULT '10' AFTER `grid_color`;
DELETE FROM tconfig WHERE token = 'refr'; DELETE FROM tconfig WHERE token = 'refr';
INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`) VALUES (37,2,'CPU','CPU','','Brand;Clock;Model','',0,2); INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`) VALUES (37,2,'CPU','CPU','','Brand;Clock;Model','',0,2);
@ -20,4 +83,32 @@ INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `descri
ALTER TABLE `treport_content` ADD COLUMN `period_range` INT NULL DEFAULT 0 AFTER `period`; ALTER TABLE `treport_content` ADD COLUMN `period_range` INT NULL DEFAULT 0 AFTER `period`;
CREATE TABLE IF NOT EXISTS `tevent_comment` (
`id` serial PRIMARY KEY,
`id_event` BIGINT UNSIGNED NOT NULL,
`utimestamp` BIGINT NOT NULL DEFAULT 0,
`comment` TEXT,
`id_user` VARCHAR(255) DEFAULT NULL,
`action` TEXT,
FOREIGN KEY (`id_event`) REFERENCES `tevento`(`id_evento`)
ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`id_user`) REFERENCES tusuario(`id_user`)
ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
INSERT INTO `tevent_comment` (`id_event`, `utimestamp`, `comment`, `id_user`, `action`)
SELECT * FROM (
SELECT tevento.id_evento AS `id_event`,
JSON_UNQUOTE(JSON_EXTRACT(tevento.user_comment, CONCAT('$[',n.num,'].utimestamp'))) AS `utimestamp`,
JSON_UNQUOTE(JSON_EXTRACT(tevento.user_comment, CONCAT('$[',n.num,'].comment'))) AS `comment`,
JSON_UNQUOTE(JSON_EXTRACT(tevento.user_comment, CONCAT('$[',n.num,'].id_user'))) AS `id_user`,
JSON_UNQUOTE(JSON_EXTRACT(tevento.user_comment, CONCAT('$[',n.num,'].action'))) AS `action`
FROM tevento
INNER JOIN (SELECT 0 num UNION ALL SELECT 1 UNION ALL SELECT 2) n
ON n.num < JSON_LENGTH(tevento.user_comment)
WHERE tevento.user_comment != ""
) t order by utimestamp DESC;
ALTER TABLE tevento DROP COLUMN user_comment;
COMMIT; COMMIT;

View File

@ -34,6 +34,22 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$notifications_numbers['notifications'], $notifications_numbers['notifications'],
$notifications_numbers['last_id'] $notifications_numbers['last_id']
).'</div>'; ).'</div>';
$header_welcome = '';
if (check_acl($config['id_user'], $group, 'AW')) {
$header_welcome .= '<div id="welcome-icon-header">';
$header_welcome .= html_print_image(
'images/wizard@svg.svg',
true,
[
'class' => 'main_menu_icon invert_filter',
'title' => __('Welcome dialog'),
'id' => 'Welcome-dialog',
'alt' => __('Welcome dialog'),
'style' => 'cursor: pointer;',
]
);
$header_welcome .= '</div>';
}
// ======= Servers List =============================================== // ======= Servers List ===============================================
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) { if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
@ -212,16 +228,15 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
); );
$autorefresh_list = json_decode( $autorefresh_list = json_decode(
$select[0]['autorefresh_white_list'] (empty($select[0]['autorefresh_white_list']) === false)
? $select[0]['autorefresh_white_list']
: ''
); );
$header_autorefresh = ''; $header_autorefresh = '';
$header_autorefresh_counter = ''; $header_autorefresh_counter = '';
if ($config['legacy_vc']
|| ($_GET['sec2'] !== 'operation/visual_console/render_view') if (($_GET['sec2'] !== 'operation/visual_console/render_view')) {
|| (($_GET['sec2'] !== 'operation/visual_console/render_view')
&& $config['legacy_vc'])
) {
if ($autorefresh_list !== null if ($autorefresh_list !== null
&& array_search($_GET['sec2'], $autorefresh_list) !== false && array_search($_GET['sec2'], $autorefresh_list) !== false
) { ) {
@ -461,7 +476,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
} else { } else {
echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div> echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div>
<div class="header_center">'.$header_searchbar.'</div> <div class="header_center">'.$header_searchbar.'</div>
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $servers_list, $header_feedback, $header_support, $header_docu, $header_user, $header_logout.'</div>'; <div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $header_welcome, $servers_list, $header_feedback, $header_support, $header_docu, $header_user, $header_logout.'</div>';
} }
?> ?>
</div> <!-- Closes #table_header_inner --> </div> <!-- Closes #table_header_inner -->
@ -904,6 +919,44 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$("#agent_access").css("display",""); $("#agent_access").css("display","");
}); });
$("#welcome-icon-header").click(function () {
if (!$('#welcome_modal_window').length){
$(document.body).append('<div id="welcome_modal_window"></div>');
$(document.body).append( $('<link rel="stylesheet" type="text/css" />').attr('href', 'include/styles/new_installation_welcome_window.css') );
}
// Clean DOM.
load_modal({
target: $('#welcome_modal_window'),
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
modal: {
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
cancel: '<?php echo __('Do not show anymore'); ?>',
ok: '<?php echo __('Close'); ?>'
},
onshow: {
page: 'include/ajax/welcome_window',
method: 'loadWelcomeWindow',
},
oncancel: {
page: 'include/ajax/welcome_window',
title: "<?php echo __('Cancel Configuration Window'); ?>",
method: 'cancelWelcome',
confirm: function (fn) {
confirmDialog({
title: '<?php echo __('Are you sure?'); ?>',
message: '<?php echo __('Are you sure you want to cancel this tutorial?'); ?>',
ok: '<?php echo __('OK'); ?>',
cancel: '<?php echo __('Cancel'); ?>',
onAccept: function() {
// Continue execution.
fn();
}
})
}
}
});
});
<?php if (enterprise_installed()) { ?> <?php if (enterprise_installed()) { ?>
// Feedback. // Feedback.
$("#feedback-header").click(function () { $("#feedback-header").click(function () {

View File

@ -185,6 +185,10 @@ echo '</div>';
$(`#sub${this.id}`).hide(); $(`#sub${this.id}`).hide();
}) })
} else if ($('#menu_full').hasClass('menu_full_collapsed')) { } else if ($('#menu_full').hasClass('menu_full_collapsed')) {
$(".arrow_menu_right").each(function() {
$(this).removeClass('arrow_menu_right');
$(this).addClass('arrow_menu_down');
});
localStorage.setItem("menuType", "classic"); localStorage.setItem("menuType", "classic");
$('ul.submenu').css('left', '280px'); $('ul.submenu').css('left', '280px');
var menuType_val = localStorage.getItem("menuType"); var menuType_val = localStorage.getItem("menuType");
@ -273,6 +277,14 @@ echo '</div>';
$('.menu_icon').mouseenter(function() { $('.menu_icon').mouseenter(function() {
var menuType_val = localStorage.getItem("menuType"); var menuType_val = localStorage.getItem("menuType");
if (!click_display && menuType_val === 'collapsed') { if (!click_display && menuType_val === 'collapsed') {
$(".arrow_menu_down").each(function() {
$(this).removeClass('arrow_menu_down');
$(this).addClass('arrow_menu_right');
});
$(".arrow_menu_up").each(function() {
$(this).removeClass('arrow_menu_up');
$(this).addClass('arrow_menu_right');
});
table_hover = $(this); table_hover = $(this);
handsIn = 1; handsIn = 1;
openTime = new Date().getTime(); openTime = new Date().getTime();
@ -305,6 +317,7 @@ echo '</div>';
table_hover2 = $(this); table_hover2 = $(this);
handsIn2 = 1; handsIn2 = 1;
openTime2 = new Date().getTime(); openTime2 = new Date().getTime();
$("#sub" + table_hover2[0].id).attr('style', 'display: none; position: fixed; left: 340px;');
$("#sub" + table_hover2[0].id).show(); $("#sub" + table_hover2[0].id).show();
if (typeof(table_noHover2) != 'undefined') { if (typeof(table_noHover2) != 'undefined') {
if ("ul#sub" + table_hover2[0].id != "ul#sub" + table_noHover2[0].id) { if ("ul#sub" + table_hover2[0].id != "ul#sub" + table_noHover2[0].id) {
@ -315,6 +328,7 @@ echo '</div>';
}).mouseleave(function() { }).mouseleave(function() {
var menuType_val = localStorage.getItem("menuType"); var menuType_val = localStorage.getItem("menuType");
if (!click_display && menuType_val === 'collapsed') { if (!click_display && menuType_val === 'collapsed') {
$("#sub" + $(this)[0].id).attr('style', 'display: none;');
table_noHover2 = table_hover2; table_noHover2 = table_hover2;
handsIn2 = 0; handsIn2 = 0;
setTimeout(function() { setTimeout(function() {

View File

@ -100,21 +100,23 @@ if ($initial && users_is_admin()) {
); );
} }
$welcome = !$initial; if (check_acl($config['id_user'], 0, 'AW')) {
try { $welcome = !$initial;
$welcome_window = new WelcomeWindow($welcome); try {
if ($welcome_window !== null) { $welcome_window = new WelcomeWindow($welcome);
$welcome_window->run(); if ($welcome_window !== null) {
$welcome_window->run();
}
} catch (Exception $e) {
$welcome = false;
} }
} catch (Exception $e) {
$welcome = false;
} }
try { try {
if (isset($_SESSION['showed_tips_window']) === false) { if (isset($_SESSION['showed_tips_window']) === false) {
$tips_window = new TipsWindow(); $tips_window = new TipsWindow();
if ($tips_window !== null) { if ($tips_window !== null) {
$tips_window->run(); $tips_window->run();
} }
} }
} catch (Exception $e) { } catch (Exception $e) {

View File

@ -212,7 +212,7 @@ $groups = users_get_groups($config['id_user'], 'AR', false);
// Get modules. // Get modules.
$modules = db_get_all_rows_sql( $modules = db_get_all_rows_sql(
'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo 'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
WHERE id_agente = '.$id_parent WHERE id_agente = '.$id_agente
); );
$modules_values = []; $modules_values = [];
$modules_values[0] = __('Any'); $modules_values[0] = __('Any');
@ -300,7 +300,7 @@ if (enterprise_installed() === true) {
// Parent agents. // Parent agents.
$paramsParentAgent = []; $paramsParentAgent = [];
$paramsParentAgent['return'] = true; $paramsParentAgent['return'] = true;
$paramsParentAgent['show_helptip'] = false; $paramsParentAgent['show_helptip'] = true;
$paramsParentAgent['input_name'] = 'id_parent'; $paramsParentAgent['input_name'] = 'id_parent';
$paramsParentAgent['print_hidden_input_idagent'] = true; $paramsParentAgent['print_hidden_input_idagent'] = true;
$paramsParentAgent['hidden_input_idagent_name'] = 'id_agent_parent'; $paramsParentAgent['hidden_input_idagent_name'] = 'id_agent_parent';
@ -646,7 +646,7 @@ if (enterprise_installed() === true) {
// Parent agent. // Parent agent.
$tableAdvancedAgent->data['parent_agent'][] = html_print_label_input_block( $tableAdvancedAgent->data['parent_agent'][] = html_print_label_input_block(
__('Parent'), __('Agent parent'),
ui_print_agent_autocomplete_input($paramsParentAgent) ui_print_agent_autocomplete_input($paramsParentAgent)
); );
@ -931,7 +931,7 @@ foreach ($fields as $field) {
// Filling the data. // Filling the data.
$combo = []; $combo = [];
$combo = $field['combo_values']; $combo = $field['combo_values'];
$combo = explode(',', $combo); $combo = explode(',', (empty($combo) === true) ? [] : $combo);
$combo_values = []; $combo_values = [];
foreach ($combo as $value) { foreach ($combo as $value) {
$combo_values[$value] = $value; $combo_values[$value] = $value;
@ -1205,15 +1205,30 @@ ui_require_jquery_file('bgiframe');
$("#cascade_protection_module").attr("disabled", 'disabled'); $("#cascade_protection_module").attr("disabled", 'disabled');
} }
$("#checkbox-cascade_protection").change(function () { $("#text-id_parent").change(function(){
var checked = $("#checkbox-cascade_protection").is(":checked"); const parent = $("#text-id_parent").val();
if (parent != '') {
if (checked) { $("#checkbox-cascade_protection").prop('checked', true);
$("#cascade_protection_module").removeAttr("disabled"); $("#cascade_protection_module").removeAttr("disabled");
} }
else { else {
$("#cascade_protection_module").val(0); $("#cascade_protection_module").val(0);
$("#cascade_protection_module").attr("disabled", 'disabled'); $("#cascade_protection_module").attr("disabled", 'disabled');
$("#text-id_parent").removeAttr("required");
$("#cascade_protection_module").empty();
$("#checkbox-cascade_protection").prop('checked', false);
}
});
$("#checkbox-cascade_protection").change(function () {
var checked = $("#checkbox-cascade_protection").is(":checked"); if (checked) {
$("#cascade_protection_module").removeAttr("disabled");
$("#text-id_parent").attr("required", "required");
}
else {
$("#cascade_protection_module").val(0);
$("#cascade_protection_module").attr("disabled", 'disabled');
$("#text-id_parent").removeAttr("required");
} }
}); });

View File

@ -80,7 +80,7 @@ if (isset($_POST['template_id']) === true) {
$values = [ $values = [
'id_agente' => $id_agente, 'id_agente' => $id_agente,
'id_tipo_modulo' => $row2['type'], 'id_tipo_modulo' => $row2['type'],
'descripcion' => __('Created by template ').$name_template.' . '.$row2['description'], 'descripcion' => $row2['description'],
'max' => $row2['max'], 'max' => $row2['max'],
'min' => $row2['min'], 'min' => $row2['min'],
'module_interval' => $row2['module_interval'], 'module_interval' => $row2['module_interval'],

View File

@ -460,6 +460,18 @@ if ($id_agente) {
$templatetab['active'] = ($tab === 'template'); $templatetab['active'] = ($tab === 'template');
// Policy tab.
$policyTab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=policy&amp;id_agente='.$id_agente,
'image' => 'images/policy@svg.svg',
'title' => __('Manage policy'),
],
true
);
$policyTab['active'] = ($tab === 'policy');
// Inventory. // Inventory.
$inventorytab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'">'.html_print_image( $inventorytab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'">'.html_print_image(
'images/hardware-software-component@svg.svg', 'images/hardware-software-component@svg.svg',
@ -638,6 +650,7 @@ if ($id_agente) {
'template' => $templatetab, 'template' => $templatetab,
'inventory' => $inventorytab, 'inventory' => $inventorytab,
'pluginstab' => $pluginstab, 'pluginstab' => $pluginstab,
'policy' => (enterprise_installed() === true) ? $policyTab : '',
'collection' => $collectiontab, 'collection' => $collectiontab,
'group' => $grouptab, 'group' => $grouptab,
'gis' => $gistab, 'gis' => $gistab,
@ -654,11 +667,11 @@ if ($id_agente) {
'template' => $templatetab, 'template' => $templatetab,
'inventory' => $inventorytab, 'inventory' => $inventorytab,
'pluginstab' => $pluginstab, 'pluginstab' => $pluginstab,
'policy' => (enterprise_installed() === true) ? $policyTab : '',
'collection' => $collectiontab, 'collection' => $collectiontab,
'group' => $grouptab, 'group' => $grouptab,
'gis' => $gistab, 'gis' => $gistab,
'agent_wizard' => $agent_wizard, 'agent_wizard' => $agent_wizard,
]; ];
} }
@ -725,6 +738,11 @@ if ($id_agente) {
$tab_name = __('Inventory'); $tab_name = __('Inventory');
break; break;
case 'policy':
$help_header = 'policy_tab';
$tab_name = __('Policies');
break;
case 'plugins': case 'plugins':
$help_header = 'plugins_tab'; $help_header = 'plugins_tab';
$tab_name = __('Agent plugins'); $tab_name = __('Agent plugins');
@ -2428,6 +2446,10 @@ switch ($tab) {
include 'inventory_manager.php'; include 'inventory_manager.php';
break; break;
case 'policy':
enterprise_include('operation/agentes/policy_manager.php');
break;
default: default:
if (enterprise_hook('switch_agent_tab', [$tab])) { if (enterprise_hook('switch_agent_tab', [$tab])) {
// This will make sure that blank pages will have at least some // This will make sure that blank pages will have at least some

View File

@ -996,6 +996,8 @@ if ($agents !== false) {
$tableAgents->data[$key][6] = $actionButtonsColumn; $tableAgents->data[$key][6] = $actionButtonsColumn;
} }
$total_items = '<div class="total_pages">'.sprintf(__('Total items: %s'), $total_agents).'</div>';
echo $total_items;
html_print_table($tableAgents); html_print_table($tableAgents);
$tablePagination = ui_pagination( $tablePagination = ui_pagination(
@ -1072,16 +1074,20 @@ if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
function () { function () {
$(".actions", this).css ("visibility", "hidden"); $(".actions", this).css ("visibility", "hidden");
}); });
$("#ag_group").click ( $("#ag_group").click (
function () { function () {
$(this).css ("width", "auto"); $(this).css ("width", "auto");
$(this).css ("min-width", "100px"); $(this).css ("min-width", "100px");
}); });
$("#ag_group").blur (function () { $("#ag_group").blur (function () {
$(this).css ("width", "100px"); $(this).css ("width", "100px");
}); });
var show_deploy_agent = "<?php echo get_parameter('show_deploy_agent', 0); ?>";
if (show_deploy_agent !== '0'){
$('#button-modal_deploy_agent').click();
}
}); });
</script> </script>

View File

@ -1847,6 +1847,22 @@ $(document).ready (function () {
setModuleType(type_name_selected); setModuleType(type_name_selected);
}); });
$('#checkbox-warning_inverse_string').change( function () {
if ($(this).prop('checked') === true) {
$('input[name="warning_thresholds_checks"]').val('warning_inverse');
} else {
$('input[name="warning_thresholds_checks"]').val('normal_warning');
}
});
$('#checkbox-critical_inverse_string').change( function () {
if ($(this).prop('checked') === true) {
$('input[name="critical_thresholds_checks"]').val('critical_inverse');
} else {
$('input[name="critical_thresholds_checks"]').val('normal_critical');
}
});
function setModuleType(type_name_selected) { function setModuleType(type_name_selected) {
if (type_name_selected.match(/_string$/) == null) { if (type_name_selected.match(/_string$/) == null) {
// Hide string fields. // Hide string fields.

View File

@ -171,6 +171,8 @@ foreach ($password_fields as $k => $p) {
} }
$(document).ready(function () { $(document).ready(function () {
changePluginSelect(); if ($("#id_plugin").val() === 0) {
changePluginSelect();
}
}); });
</script> </script>

View File

@ -89,7 +89,7 @@ if (is_ajax() === true) {
[ [
'id' => 'agent_modules_affected_planned_downtime', 'id' => 'agent_modules_affected_planned_downtime',
'class' => 'info_table', 'class' => 'info_table',
'style' => 'width: 99%', 'style' => 'width: 100%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $column_names, 'column_names' => $column_names,
'ajax_url' => 'godmode/agentes/planned_downtime.list', 'ajax_url' => 'godmode/agentes/planned_downtime.list',

View File

@ -796,12 +796,12 @@ foreach ($commands as $command) {
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group. // (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.
if ($is_management_allowed === true && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) { if ($is_management_allowed === true && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) {
if (is_user_admin($config['id_user']) === true) { if (is_user_admin($config['id_user']) === true) {
$data['action'] = '<span class="inline_flex">'; $data['action'] = '<span class="inline_flex">';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'&offset='.$offset.'" $data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'&offset='.$offset.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.svg', true, ['class' => 'main_menu_icon invert_filter']).'</a>'; onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.svg', true, ['class' => 'main_menu_icon invert_filter ', 'title' => 'Duplicate']).'</a>';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'&offset='.$offset_delete.'" $data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'&offset='.$offset_delete.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).'</a>'; onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter', 'title' => 'Delete']).'</a>';
$data['action'] .= '</span>'; $data['action'] .= '</span>';
} }
} }

View File

@ -40,6 +40,8 @@ $table->size = [];
$table->style[0] = 'width: 50%'; $table->style[0] = 'width: 50%';
$table->style[1] = 'width: 50%'; $table->style[1] = 'width: 50%';
$modules = [];
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$params = []; $params = [];
$params['return'] = true; $params['return'] = true;
@ -79,8 +81,6 @@ if (is_metaconsole() === true) {
} }
} }
$modules = [];
$table->data[0][1] = html_print_label_input_block( $table->data[0][1] = html_print_label_input_block(
__('Module'), __('Module'),
html_print_select( html_print_select(

View File

@ -912,7 +912,10 @@ foreach ($simple_alerts as $alert) {
1, 1,
'padding:0px; width: 22px; height: 22px;', 'padding:0px; width: 22px; height: 22px;',
true, true,
['class' => 'invert_filter main_menu_icon'] [
'class' => 'invert_filter main_menu_icon',
'title' => __('Enable'),
]
); );
$data[4] .= html_print_input_hidden('enable_alert', 1, true); $data[4] .= html_print_input_hidden('enable_alert', 1, true);
} else { } else {
@ -922,7 +925,10 @@ foreach ($simple_alerts as $alert) {
1, 1,
'padding:0px; width: 22px; height: 22px;', 'padding:0px; width: 22px; height: 22px;',
true, true,
['class' => 'main_menu_icon'] [
'class' => 'invert filter main_menu_icon',
'title' => __('Disable'),
]
); );
$data[4] .= html_print_input_hidden('disable_alert', 1, true); $data[4] .= html_print_input_hidden('disable_alert', 1, true);
} }
@ -940,7 +946,10 @@ foreach ($simple_alerts as $alert) {
1, 1,
'padding:0px; width: 22px; height: 22px;', 'padding:0px; width: 22px; height: 22px;',
true, true,
['class' => 'invert_filter main_menu_icon'] [
'class' => 'invert_filter main_menu_icon',
'title' => __('Standby off'),
]
); );
$data[4] .= html_print_input_hidden('standbyon_alert', 1, true); $data[4] .= html_print_input_hidden('standbyon_alert', 1, true);
} else { } else {
@ -950,7 +959,10 @@ foreach ($simple_alerts as $alert) {
1, 1,
'padding:0px; width: 22px; height: 22px;', 'padding:0px; width: 22px; height: 22px;',
true, true,
['class' => 'invert_filter main_menu_icon'] [
'class' => 'invert_filter main_menu_icon',
'title' => __('Standby on'),
]
); );
$data[4] .= html_print_input_hidden('standbyoff_alert', 1, true); $data[4] .= html_print_input_hidden('standbyoff_alert', 1, true);
} }
@ -1139,8 +1151,7 @@ if (! $id_agente) {
return false; return false;
}); });
$("input[name=disable]").attr ("title", "<?php echo __('Disable'); ?>") $("input[name=disable]").hover (function () {
.hover (function () {
$(this).attr ("src", $(this).attr ("src",
<?php <?php
echo '"'.html_print_image( echo '"'.html_print_image(
@ -1166,8 +1177,7 @@ if (! $id_agente) {
} }
); );
$("input[name=enable]").attr ("title", "<?php echo __('Enable'); ?>") $("input[name=enable]").hover (function () {
.hover (function () {
$(this).attr ("src", $(this).attr ("src",
<?php <?php
echo '"'.html_print_image( echo '"'.html_print_image(
@ -1193,8 +1203,7 @@ if (! $id_agente) {
} }
); );
$("input[name=standby_on]").attr ("title", "<?php echo __('Set off standby'); ?>") $("input[name=standby_on]").hover (function () {
.hover (function () {
$(this).attr ("src", $(this).attr ("src",
<?php <?php
echo '"'.html_print_image( echo '"'.html_print_image(
@ -1220,8 +1229,7 @@ if (! $id_agente) {
} }
); );
$("input[name=standby_off]").attr ("title", "<?php echo __('Set standby'); ?>") $("input[name=standby_off]").hover (function () {
.hover (function () {
$(this).attr ("src", $(this).attr ("src",
<?php <?php
echo '"'.html_print_image( echo '"'.html_print_image(

View File

@ -184,7 +184,7 @@ if (empty($result) === false) {
] ]
).'</a>&nbsp;&nbsp;'; ).'</a>&nbsp;&nbsp;';
$data[1] .= '<a href="index.php?sec=advanced&sec2=godmode/category/category&delete_category='.$category['id'].'&pure='.(int) $config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image( $data[1] .= '<a href="index.php?sec=advanced&sec2=godmode/category/category&delete_category='.$category['id'].'&pure='.(int) $config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image(
'images/delet.svg', 'images/delete.svg',
true, true,
[ [
'title' => __('Delete'), 'title' => __('Delete'),

View File

@ -187,7 +187,7 @@ try {
[ [
'id' => 'list_agents_tactical', 'id' => 'list_agents_tactical',
'class' => 'info_table', 'class' => 'info_table',
'style' => 'width: 99%', 'style' => 'width: 100%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $columnNames, 'column_names' => $columnNames,
'return' => true, 'return' => true,

View File

@ -86,31 +86,39 @@ if ($do_operation) {
$groups = users_get_groups(); $groups = users_get_groups();
$table = new stdClass(); $table = new stdClass();
$table->class = 'databox filters';
$table->width = '100%';
$table->data = [];
$table->style = [];
$table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold';
$table->style[4] = 'font-weight: bold';
$table->style[6] = 'font-weight: bold';
// Source selection
$table->id = 'source_table'; $table->id = 'source_table';
$table->data[0][0] = __('Group'); $table->class = 'databox filters filter-table-adv';
$table->data[0][1] = html_print_select_groups( $table->width = '100%';
false, $table->size[0] = '50%';
'AW', $table->size[1] = '50%';
true, $table->data = [];
'source_id_group',
$source_id_group, // Source selection.
false, $table->data[0][0] = html_print_label_input_block(
'', __('Group'),
'', html_print_select_groups(
true false,
'AW',
true,
'source_id_group',
$source_id_group,
false,
'',
'',
true,
false,
false,
'w100p',
false,
'width:100%'
)
); );
$table->data[0][2] = __('Group recursion');
$table->data[0][3] = html_print_checkbox('source_recursion', 1, $source_recursion, true, false); $table->data[0][1] = html_print_label_input_block(
__('Group recursion'),
html_print_checkbox('source_recursion', 1, $source_recursion, true, false)
);
$status_list = []; $status_list = [];
$status_list[AGENT_STATUS_NORMAL] = __('Normal'); $status_list[AGENT_STATUS_NORMAL] = __('Normal');
$status_list[AGENT_STATUS_WARNING] = __('Warning'); $status_list[AGENT_STATUS_WARNING] = __('Warning');
@ -118,37 +126,52 @@ $status_list[AGENT_STATUS_CRITICAL] = __('Critical');
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown'); $status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); $status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init'); $status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
$table->data[0][4] = __('Status');
$table->data[0][5] = html_print_select( $table->data[1][0] = html_print_label_input_block(
$status_list, __('Status'),
'status_agents_source', html_print_select(
'selected', $status_list,
'', 'status_agents_source',
__('All'), 'selected',
AGENT_STATUS_ALL, '',
true __('All'),
AGENT_STATUS_ALL,
true,
false,
true,
'w100p'
)
); );
$table->data[0][6] = __('Agent');
$table->data[0][6] .= ' <span id="source_agent_loading" class="invisible">';
$table->data[0][6] .= html_print_image('images/spinner.png', true);
$table->data[0][6] .= '</span>';
// $table->data[0][7] = html_print_select (agents_get_group_agents ($source_id_group, false, "none"),
// 'source_id_agent', $source_id_agent, false, __('Select'), 0, true);
$agents = ( $source_id_group ? agents_get_group_agents($source_id_group, false, 'none') : agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false))) ); $agents = ( $source_id_group ? agents_get_group_agents($source_id_group, false, 'none') : agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false))) );
$table->data[0][7] = html_print_select($agents, 'source_id_agent', $source_id_agent, false, __('Select'), 0, true); $table->data[1][1] = html_print_label_input_block(
__('Agent').' <span id="source_agent_loading" class="invisible">'.html_print_image('images/spinner.png', true).'</span>',
echo '<form '.'action="index.php?'.'sec=gmassive&'.'sec2=godmode/massive/massive_operations&'.'option=copy_modules" '.'id="manage_config_form" '.'method="post">'; html_print_select(
$agents,
'source_id_agent',
$source_id_agent,
false,
__('Select'),
0,
true
)
);
echo '<form action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=copy_modules" id="manage_config_form" method="post" class="max_floating_element_size">';
echo '<fieldset id="fieldset_source">'; echo '<fieldset id="fieldset_source">';
echo '<legend>'; echo '<legend><span>'.__('Source').'</span></legend>';
echo '<span>'.__('Source');
echo '</legend>';
html_print_table($table); html_print_table($table);
echo '</fieldset>'; echo '</fieldset>';
// Target selection
unset($table);
// Target selection.
$table = new stdClass();
$table->id = 'target_table'; $table->id = 'target_table';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->width = '100%';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = []; $table->data = [];
$modules = []; $modules = [];
@ -169,66 +192,64 @@ foreach ($agent_alerts as $alert) {
} }
$tags = tags_get_user_tags(); $tags = tags_get_user_tags();
$table->data['tags'][0] = __('Tags'); $table->colspan[0][0] = 2;
$table->data['tags'][1] = html_print_select( $table->data[0][0] = html_print_label_input_block(
$tags, __('Tags'),
'tags[]', html_print_select(
$tags_name, $tags,
false, 'tags[]',
__('Any'), $tags_name,
-1, false,
true, __('Any'),
true, -1,
true true,
true,
true,
'',
false,
'overflow-x: hidden;white-space: nowrap;max-width: 1136px;'
)
); );
$table->data['operations'][0] = __('Operations'); $table->data[1][0] = html_print_label_input_block(
$table->data['operations'][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">'; __('Operations'),
$table->data['operations'][1] .= html_print_checkbox('copy_modules', 1, true, true); '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">'.html_print_checkbox('copy_modules', 1, true, true).html_print_label(__('Copy modules'), 'checkbox-copy_modules', true).'</span><span class="with_alerts'.(empty($alerts) ? ' invisible' : '').'">'.html_print_checkbox('copy_alerts', 1, true, true).html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true).'</span>'
$table->data['operations'][1] .= html_print_label(__('Copy modules'), 'checkbox-copy_modules', true);
$table->data['operations'][1] .= '</span><br />';
$table->data['operations'][1] .= '<span class="with_alerts'.(empty($alerts) ? ' invisible' : '').'">';
$table->data['operations'][1] .= html_print_checkbox('copy_alerts', 1, true, true);
$table->data['operations'][1] .= html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true);
$table->data['operations'][1] .= '</span>';
$table->data['form_modules_filter'][0] = __('Filter Modules');
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
$table->data[1][0] = __('Modules');
$table->data[1][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">';
$table->data[1][1] .= html_print_select(
$modules,
'target_modules[]',
0,
false,
'',
'',
true,
true
); );
$table->data[1][1] .= '</span>';
$table->data[1][1] .= '<span class="without_modules'.(! empty($modules) ? ' invisible' : '').'">';
$table->data[1][1] .= '<em>'.__('No modules for this agent').'</em>';
$table->data[1][1] .= '</span>';
$table->data[2][0] = __('Alerts'); $table->data[1][1] = html_print_label_input_block(
$table->data[2][1] = '<span class="with_alerts'.(empty($alerts) ? ' invisible' : '').'">'; __('Filter Modules'),
$table->data[2][1] .= html_print_select( html_print_input_text('filter_modules', '', '', 20, 255, true)
$alerts, );
'target_alerts[]',
0, $table->colspan[2][0] = 2;
false, $table->data[2][0] = html_print_label_input_block(
'', __('Modules'),
'', '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">'.html_print_select(
true, $modules,
true 'target_modules[]',
0,
false,
'',
'',
true,
true
).'</span><span class="without_modules'.(! empty($modules) ? ' invisible' : '').'"><em>'.__('No modules for this agent').'</em></span>'
);
$table->colspan[3][0] = 2;
$table->data[3][0] = html_print_label_input_block(
__('Alerts'),
'<span class="with_alerts'.(empty($alerts) ? ' invisible' : '').'">'.html_print_select(
$alerts,
'target_alerts[]',
0,
false,
'',
'',
true,
true
).'</span><span class="without_alerts'.(! empty($modules) ? ' invisible' : '').'"><em>'.__('No alerts for this agent').'</em></span>'
); );
$table->data[2][1] .= '</span>';
$table->data[2][1] .= '<span class="without_alerts'.(! empty($modules) ? ' invisible' : '').'">';
$table->data[2][1] .= '<em>'.__('No alerts for this agent').'</em>';
$table->data[2][1] .= '</span>';
echo '<div id="modules_loading" class="loading invisible">'; echo '<div id="modules_loading" class="loading invisible">';
html_print_image('images/spinner.png'); html_print_image('images/spinner.png');
@ -240,35 +261,50 @@ echo '<legend><span>'.__('Targets').'</span></legend>';
html_print_table($table); html_print_table($table);
echo '</fieldset>'; echo '</fieldset>';
unset($table);
// Destiny selection // Destiny selection.
$table = new stdClass();
$table->id = 'destiny_table'; $table->id = 'destiny_table';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->width = '100%';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = []; $table->data = [];
$table->size[0] = '20%';
$table->size[1] = '30%';
$table->size[2] = '20%';
$table->size[3] = '30%';
$table->data[0][0] = __('Group'); $table->data[0][0] = html_print_label_input_block(
$table->data[0][1] = html_print_select_groups( __('Group'),
false, html_print_select_groups(
'AW', false,
true, 'AW',
'destiny_id_group', true,
$destiny_id_group, 'destiny_id_group',
false, $destiny_id_group,
'', false,
'', '',
true '',
true,
false,
false,
'w100p',
false,
'width:100%'
)
); );
$table->data[0][2] = __('Group recursion');
$table->data[0][3] = html_print_checkbox( $table->data[0][1] = html_print_label_input_block(
'destiny_recursion', __('Group recursion'),
1, html_print_checkbox(
$destiny_recursion, 'destiny_recursion',
true, 1,
false $destiny_recursion,
true,
false
)
);
$table->data[1][0] = html_print_label_input_block(
__('Filter Agents'),
html_print_input_text('filter_agents', '', '', 20, 255, true)
); );
$status_list = []; $status_list = [];
@ -278,32 +314,30 @@ $status_list[AGENT_STATUS_CRITICAL] = __('Critical');
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown'); $status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); $status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init'); $status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
$table->data[1][0] = __('Status'); $table->data[1][1] = html_print_label_input_block(
$table->data[1][1] = html_print_select( __('Status'),
$status_list, html_print_select(
'status_agents_destiny', $status_list,
'selected', 'status_agents_destiny',
'', 'selected',
__('All'), '',
AGENT_STATUS_ALL, __('All'),
true AGENT_STATUS_ALL,
true
)
); );
$table->data['form_agents_filter'][0] = __('Filter Agents');
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
$table->data[2][0] = __('Agent');
$table->data[2][0] .= '<span id="destiny_agent_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true);
$table->data[2][0] .= '</span>';
$agents = []; $agents = [];
if ($source_id_agent) { if ($source_id_agent) {
$agents = ( $destiny_id_group ? agents_get_group_agents($destiny_id_group, false, 'none') : agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false))) ); $agents = ( $destiny_id_group ? agents_get_group_agents($destiny_id_group, false, 'none') : agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false))) );
unset($agents[$source_id_agent]); unset($agents[$source_id_agent]);
} }
$table->data[2][1] = html_print_select($agents, 'destiny_id_agent[]', 0, false, '', '', true, true); $table->colspan[2][0] = 2;
$table->data[2][0] = html_print_label_input_block(
__('Agent').'<span id="destiny_agent_loading" class="invisible">'.html_print_image('images/spinner.png', true).'</span>',
html_print_select($agents, 'destiny_id_agent[]', 0, false, '', '', true, true)
);
echo '<fieldset id="fieldset_destiny"'.($source_id_agent ? '' : ' class="invisible"').'>'; echo '<fieldset id="fieldset_destiny"'.($source_id_agent ? '' : ' class="invisible"').'>';
echo '<legend><span>'.__('To agent(s)').'</span></legend>'; echo '<legend><span>'.__('To agent(s)').'</span></legend>';

View File

@ -189,6 +189,14 @@ echo get_table_inputs_masive_agents($params);
if (is_metaconsole() === true || is_management_allowed() === true) { if (is_metaconsole() === true || is_management_allowed() === true) {
attachActionButton('delete', 'delete', '100%', false, $SelectAction); attachActionButton('delete', 'delete', '100%', false, $SelectAction);
} else {
html_print_action_buttons(
'',
[
'right_content' => $SelectAction,
'class' => 'pdd_t_15px_important pdd_b_15px_important',
]
);
} }
echo '</form>'; echo '</form>';

View File

@ -310,45 +310,47 @@ foreach ($module_types as $type) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = []; $table->data = [];
$table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold';
$table->data['selection_mode'][0] = __('Selection mode'); $table->data[0][0] = html_print_label_input_block(
$table->data['selection_mode'][1] = '<span class="massive_span">'.__('Select modules first ').'</span>'.html_print_radio_button_extended('selection_mode', 'modules', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true).'<br>'; __('Selection mode'),
$table->data['selection_mode'][1] .= '<span class="massive_span">'.__('Select agents first ').'</span>'.html_print_radio_button_extended('selection_mode', 'agents', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true); '<div class="flex"><span class="massive_span">'.__('Select modules first ').'</span>'.html_print_radio_button_extended('selection_mode', 'modules', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true).'<br><span class="massive_span">'.__('Select agents first ').'</span>'.html_print_radio_button_extended('selection_mode', 'agents', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true).'</div>'
$table->rowclass['form_modules_1'] = 'select_modules_row';
$table->data['form_modules_1'][0] = __('Module type');
$table->data['form_modules_1'][0] .= '<span id="module_loading" class="invisible">';
$table->data['form_modules_1'][0] .= html_print_image('images/spinner.png', true);
$table->data['form_modules_1'][0] .= '</span>';
$types[0] = __('All');
$table->colspan['form_modules_1'][1] = 2;
$table->data['form_modules_1'][1] = html_print_select(
$types,
'module_type',
'',
false,
__('Select'),
-1,
true,
false,
true,
'',
false,
'width:100%'
); );
$table->data['form_modules_1'][3] = __('Select all modules of this type').' '.html_print_checkbox_extended(
'force_type', $table->rowclass[1] = 'select_modules_row';
'type', $types[0] = __('All');
'', $table->data[1][0] = html_print_label_input_block(
'', __('Module type').'<span id="module_loading" class="invisible">'.html_print_image('images/spinner.png', true).'</span>',
false, html_print_select(
'class="mrgn_right_40px"', $types,
true, 'module_type',
'' '',
false,
__('Select'),
-1,
true,
false,
true,
'',
false,
'width:100%'
)
);
$table->data[1][1] = html_print_label_input_block(
__('Select all modules of this type'),
html_print_checkbox_extended(
'force_type',
'type',
'',
'',
false,
'class="mrgn_right_40px"',
true,
''
)
); );
$modules = []; $modules = [];
@ -368,52 +370,59 @@ foreach ($names as $name) {
$modules[$name['nombre']] = $name['nombre']; $modules[$name['nombre']] = $name['nombre'];
} }
$table->rowclass['form_agents_1'] = 'select_agents_row'; $table->rowclass[2] = 'select_agents_row';
$table->data['form_agents_1'][0] = __('Agent group');
$groups = users_get_groups($config['id_user'], 'AW', false); $groups = users_get_groups($config['id_user'], 'AW', false);
$groups[0] = __('All'); $groups[0] = __('All');
$table->colspan['form_agents_1'][1] = 2; $table->data[2][0] = html_print_label_input_block(
$table->data['form_agents_1'][1] = html_print_select_groups( __('Agent group'),
false, html_print_select_groups(
'AW', false,
true, 'AW',
'groups_select', true,
'', 'groups_select',
false, '',
'', false,
'', '',
true '',
).' '.__('Group recursion').' '.html_print_checkbox('recursion', 1, false, true, false); true
$table->data['form_agents_1'][3] = __('Select all modules of this group').' '.html_print_checkbox_extended( ).' '.__('Group recursion').' '.html_print_checkbox('recursion', 1, false, true, false)
'force_group', );
'group',
'', $table->data[2][1] = html_print_label_input_block(
'', __('Select all modules of this group'),
false, html_print_checkbox_extended(
'', 'force_group',
'class="mrgn_right_40px"', 'group',
true '',
'',
false,
'',
'class="mrgn_right_40px"',
true
)
); );
$tags = tags_get_user_tags(); $tags = tags_get_user_tags();
$table->rowstyle['form_modules_4'] = 'vertical-align: top;'; $table->rowclass[3] = 'select_modules_row select_modules_row_2';
$table->rowclass['form_modules_4'] = 'select_modules_row select_modules_row_2'; $table->colspan[3][0] = 2;
$table->data['form_modules_4'][0] = __('Tags'); $table->data[3][0] = html_print_label_input_block(
$table->data['form_modules_4'][1] = html_print_select( __('Tags'),
$tags, html_print_select(
'tags[]', $tags,
$tags_name, 'tags[]',
false, $tags_name,
__('Any'), false,
-1, __('Any'),
true, -1,
true, true,
true true,
true,
'',
false,
'overflow-x: hidden;white-space: nowrap;max-width: 1136px;'
)
); );
$table->rowclass['form_agents_2'] = 'select_agents_row';
$table->data['form_agents_2'][0] = __('Status');
$table->colspan['form_agents_2'][1] = 2;
$status_list = []; $status_list = [];
$status_list[AGENT_STATUS_NORMAL] = __('Normal'); $status_list[AGENT_STATUS_NORMAL] = __('Normal');
$status_list[AGENT_STATUS_WARNING] = __('Warning'); $status_list[AGENT_STATUS_WARNING] = __('Warning');
@ -421,166 +430,194 @@ $status_list[AGENT_STATUS_CRITICAL] = __('Critical');
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown'); $status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); $status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init'); $status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
$table->data['form_agents_2'][1] = html_print_select( $table->data[4][0] = html_print_label_input_block(
$status_list, __('Module Status'),
'status_agents', html_print_select(
'selected', $status_list,
'', 'status_module',
__('All'), 'selected',
AGENT_STATUS_ALL, '',
true __('All'),
AGENT_MODULE_STATUS_ALL,
true,
false,
true,
'w100p',
false,
'width: 100%'
)
); );
$table->data['form_agents_2'][3] = '';
$table->rowclass['form_modules_3'] = ''; $table->cellclass[4][1] = 'select_agents_row';
$table->data['form_modules_3'][0] = __('Module Status'); $table->data[4][1] = html_print_label_input_block(
$table->colspan['form_modules_3'][1] = 2; __('Status'),
$status_list = []; html_print_select(
$status_list[AGENT_MODULE_STATUS_NORMAL] = __('Normal'); $status_list,
$status_list[AGENT_MODULE_STATUS_WARNING] = __('Warning'); 'status_agents',
$status_list[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical'); 'selected',
$status_list[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown'); '',
$status_list[AGENT_MODULE_STATUS_NOT_NORMAL] = __('Not normal'); __('All'),
$status_list[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init'); AGENT_STATUS_ALL,
$table->data['form_modules_3'][1] = html_print_select( true,
$status_list, false,
'status_module', true,
'selected', 'w100p',
'', false,
__('All'), 'width: 100%'
AGENT_MODULE_STATUS_ALL, )
true
); );
$table->data['form_modules_3'][3] = '';
$table->rowstyle['form_modules_filter'] = 'vertical-align: top;'; $table->rowclass[5] = 'select_modules_row select_modules_row_2';
$table->rowclass['form_modules_filter'] = 'select_modules_row select_modules_row_2'; $table->data[5][0] = html_print_label_input_block(
$table->data['form_modules_filter'][0] = __('Filter Modules'); __('Filter Modules'),
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true); html_print_input_text('filter_modules', '', '', 20, 255, true)
$table->rowstyle['form_modules_2'] = 'vertical-align: top;';
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_2'][0] = __('Modules');
$table->data['form_modules_2'][1] = html_print_select(
$modules,
'module_name[]',
$module_name,
false,
__('Select'),
-1,
true,
true,
true,
'',
false,
'width:100%'
).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'");
$table->data['form_modules_2'][2] = __('When select modules');
$table->data['form_modules_2'][2] .= '<br>';
$table->data['form_modules_2'][2] .= html_print_select(
[
'common' => __('Show common agents'),
'all' => __('Show all agents'),
],
'agents_selection_mode',
'common',
false,
'',
'',
true,
false,
true,
'',
false
); );
$table->data['form_modules_2'][3] = html_print_select(
[], $table->data[5][1] = html_print_label_input_block(
'agents[]', __('When select modules'),
$agents_select, html_print_select(
false, [
__('None'), 'common' => __('Show common agents'),
0, 'all' => __('Show all agents'),
true, ],
true, 'agents_selection_mode',
false, 'common',
'', false,
false, '',
'width:100%' '',
true,
false,
true,
'w100p',
false,
'width:100%'
)
);
$table->rowclass[6] = 'select_modules_row select_modules_row_2';
$table->data[6][0] = html_print_label_input_block(
__('Modules'),
html_print_select(
$modules,
'module_name[]',
$module_name,
false,
__('Select'),
-1,
true,
true,
true,
'',
false,
'width:100%'
).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'")
);
$table->data[6][1] = html_print_label_input_block(
__('Agents'),
html_print_select(
[],
'agents[]',
$agents_select,
false,
__('None'),
0,
true,
true,
false,
'',
false,
'width:100%'
)
); );
$tags = tags_get_user_tags(); $tags = tags_get_user_tags();
$table->rowstyle['form_agents_4'] = 'vertical-align: top;'; $table->rowclass[7] = 'select_agents_row select_agents_row_2';
$table->rowclass['form_agents_4'] = 'select_agents_row select_agents_row_2'; $table->colspan[7][0] = 2;
$table->data['form_agents_4'][0] = __('Tags'); $table->data[7][0] = html_print_label_input_block(
$table->data['form_agents_4'][1] = html_print_select( __('Tags'),
$tags, html_print_select(
'tags[]', $tags,
$tags_name, 'tags[]',
false, $tags_name,
__('Any'), false,
-1, __('Any'),
true, -1,
true, true,
true true,
true,
'',
false,
'overflow-x: hidden;white-space: nowrap;max-width: 1136px;'
)
); );
$table->rowstyle['form_agents_filter'] = 'vertical-align: top;'; $table->rowclass[8] = 'select_agents_row select_agents_row_2';
$table->rowclass['form_agents_filter'] = 'select_agents_row select_agents_row_2'; $table->data[8][0] = html_print_label_input_block(
$table->data['form_agents_filter'][0] = __('Filter Agents'); __('Filter Agents'),
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true); html_print_input_text('filter_agents', '', '', 20, 255, true)
$table->rowstyle['form_agents_3'] = 'vertical-align: top;';
$table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_3'][0] = __('Agents');
$table->data['form_agents_3'][1] = html_print_select(
$agents,
'id_agents[]',
$agents_id,
false,
'',
'',
true,
true,
false,
'',
false,
'width:100%'
).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'");
$table->data['form_agents_3'][2] = __('When select agents');
$table->data['form_agents_3'][2] .= '<br>';
$table->data['form_agents_3'][2] .= html_print_select(
[
'common' => __('Show common modules'),
'all' => __('Show all modules'),
'unknown' => __('Show unknown and not init modules'),
],
'modules_selection_mode',
'common',
false,
'',
'',
true
);
$table->data['form_agents_3'][3] = html_print_select(
[],
'module[]',
$modules_select,
false,
'',
'',
true,
true,
false,
'',
false,
'width:100%'
); );
$table->data[8][1] = html_print_label_input_block(
__('When select agents'),
html_print_select(
[
'common' => __('Show common modules'),
'all' => __('Show all modules'),
'unknown' => __('Show unknown and not init modules'),
],
'modules_selection_mode',
'common',
false,
'',
'',
true,
false,
true,
'w100p',
false,
'width: 100%'
)
);
$table->rowclass[9] = 'select_agents_row select_agents_row_2';
$table->data[9][0] = html_print_label_input_block(
__('Agents'),
html_print_select(
$agents,
'id_agents[]',
$agents_id,
false,
'',
'',
true,
true,
false,
'',
false,
'width:100%;white-space: nowrap;max-width: 1136px;'
).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'")
);
echo '<form method="post" id="form_modules" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_modules" >'; $table->data[9][1] = html_print_label_input_block(
__('Modules'),
html_print_select(
[],
'module[]',
$modules_select,
false,
'',
'',
true,
true,
false,
'w100p',
false,
'width:100%'
)
);
echo '<form method="post" class="max_floating_element_size" id="form_modules" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_modules" >';
html_print_table($table); html_print_table($table);
attachActionButton('delete', 'delete', $table->width, false, $SelectAction); attachActionButton('delete', 'delete', $table->width, false, $SelectAction);
@ -617,7 +654,9 @@ $(document).ready (function () {
$("#module_name").trigger('change'); $("#module_name").trigger('change');
} else { } else {
$("#module_name option").prop('selected', false); $("#module_name option").prop('selected', false);
$("#module_name").trigger('change'); if ($('#agents_selection_mode :selected').val() === 'all'){
$("#module_name").trigger('change');
}
} }
}); });
@ -760,14 +799,6 @@ $(document).ready (function () {
else if (this.id == "checkbox-recursion") { else if (this.id == "checkbox-recursion") {
$("#groups_select").trigger("change"); $("#groups_select").trigger("change");
} }
else {
if (this.checked) {
$(".select_agents_row_2").css('display', 'none');
}
else {
$(".select_agents_row_2").css('display', '');
}
}
} }
); );

View File

@ -67,8 +67,27 @@ if (is_ajax()) {
if ($get_users) { if ($get_users) {
$id_group = get_parameter('id_group'); $id_group = get_parameter('id_group');
$id_profile = get_parameter('id_profile'); $id_profile = get_parameter('id_profile');
$get_all_groups = get_parameter('get_all_groups', '0');
if ($get_all_groups !== '0') {
$profile_data = db_get_all_rows_sql(
'SELECT *
FROM tusuario_perfil
WHERE `id_perfil` = "'.$id_profile[0].'"
GROUP BY id_usuario'
);
} else {
if (strlen($id_profile[0]) > 0 && strlen($id_group[0]) > 0) {
$profile_data = db_get_all_rows_filter(
'tusuario_perfil',
[
'id_perfil' => $id_profile[0],
'id_grupo' => $id_group[0],
]
);
}
}
$profile_data = db_get_all_rows_filter('tusuario_perfil', ['id_perfil' => $id_profile[0], 'id_grupo' => $id_group[0]]);
if (!users_is_admin()) { if (!users_is_admin()) {
foreach ($profile_data as $user => $values) { foreach ($profile_data as $user => $values) {
if (users_is_admin($values['id_usuario'])) { if (users_is_admin($values['id_usuario'])) {
@ -243,6 +262,21 @@ $data[2] .= html_print_select(
); );
array_push($table->data, $data); array_push($table->data, $data);
$table->data[1][0] = '';
$table->data[1][1] = html_print_label_input_block(
__('Show all groups'),
html_print_checkbox_switch(
'get_all_groups',
1,
$get_all_groups,
true,
false,
'',
false,
' float-right'
),
['div_class' => 'center_align']
);
html_print_table($table); html_print_table($table);
@ -273,7 +307,8 @@ $(document).ready (function () {
{"page" : "godmode/massive/massive_delete_profiles", {"page" : "godmode/massive/massive_delete_profiles",
"get_users" : 1, "get_users" : 1,
"id_group[]" : $("#groups_id").val(), "id_group[]" : $("#groups_id").val(),
"id_profile[]" : $("#profiles_id").val() "id_profile[]" : $("#profiles_id").val(),
"get_all_groups" : $('#checkbox-get_all_groups').is(':checked') ? 1 : 0
}, },
function (data, status) { function (data, status) {
options = ""; options = "";
@ -295,6 +330,10 @@ $(document).ready (function () {
$("#profiles_id").change (function () { $("#profiles_id").change (function () {
update_users(); update_users();
}); });
$("#checkbox-get_all_groups").change (function () {
update_users();
});
}); });
/* ]]> */ /* ]]> */
</script> </script>

View File

@ -30,6 +30,7 @@
// Begin. // Begin.
require_once 'include/config.php'; require_once 'include/config.php';
require_once 'include/functions_menu.php'; require_once 'include/functions_menu.php';
require_once $config['homedir'].'/godmode/wizards/ManageExtensions.class.php';
check_login(); check_login();
@ -78,15 +79,97 @@ if ((bool) check_acl($config['id_user'], 0, 'AR') === true
} }
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) { if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
enterprise_hook('applications_menu'); // Applications.
enterprise_hook('cloud_menu'); $sub2 = [];
} if (enterprise_installed() === true) {
$sub2['godmode/servers/discovery&wiz=app&mode=MicrosoftSQLServer']['text'] = __('Microsoft SQL Server');
$sub2['godmode/servers/discovery&wiz=app&mode=mysql']['text'] = __('Mysql');
$sub2['godmode/servers/discovery&wiz=app&mode=oracle']['text'] = __('Oracle');
$sub2['godmode/servers/discovery&wiz=app&mode=vmware']['text'] = __('VMware');
$sub2['godmode/servers/discovery&wiz=app&mode=SAP']['text'] = __('SAP');
$sub2['godmode/servers/discovery&wiz=app&mode=DB2']['text'] = __('DB2');
}
if ((bool) check_acl($config['id_user'], 0, 'RW') === true $extensions = ManageExtensions::getExtensionBySection('app');
|| (bool) check_acl($config['id_user'], 0, 'RM') === true if ($extensions !== false) {
|| (bool) check_acl($config['id_user'], 0, 'PM') === true foreach ($extensions as $key => $extension) {
) { $url = sprintf(
enterprise_hook('console_task_menu'); 'godmode/servers/discovery&wiz=app&mode=%s',
$extension['short_name']
);
$sub2[$url]['text'] = __($extension['name']);
}
}
if ($extensions !== false || enterprise_installed() === true) {
$sub['godmode/servers/discovery&wiz=app']['text'] = __('Applications');
$sub['godmode/servers/discovery&wiz=app']['id'] = 'app';
$sub['godmode/servers/discovery&wiz=app']['type'] = 'direct';
$sub['godmode/servers/discovery&wiz=app']['subtype'] = 'nolink';
$sub['godmode/servers/discovery&wiz=app']['sub2'] = $sub2;
}
// Cloud.
$sub2 = [];
if (enterprise_installed() === true) {
$sub2['godmode/servers/discovery&wiz=cloud&mode=amazonws']['text'] = __('Amazon Web Services');
$sub2['godmode/servers/discovery&wiz=cloud&mode=azure']['text'] = __('Microsoft Azure');
$sub2['godmode/servers/discovery&wiz=cloud&mode=gcp']['text'] = __('Google Compute Platform');
}
$extensions = ManageExtensions::getExtensionBySection('cloud');
if ($extensions !== false) {
foreach ($extensions as $key => $extension) {
$url = sprintf(
'godmode/servers/discovery&wiz=cloud&mode=%s',
$extension['short_name']
);
$sub2[$url]['text'] = __($extension['name']);
}
}
if ($extensions !== false || enterprise_installed() === true) {
$sub['godmode/servers/discovery&wiz=cloud']['text'] = __('Cloud');
$sub['godmode/servers/discovery&wiz=cloud']['id'] = 'cloud';
$sub['godmode/servers/discovery&wiz=cloud']['type'] = 'direct';
$sub['godmode/servers/discovery&wiz=cloud']['subtype'] = 'nolink';
$sub['godmode/servers/discovery&wiz=cloud']['sub2'] = $sub2;
}
// Custom.
$sub2 = [];
$extensions = ManageExtensions::getExtensionBySection('custom');
if ($extensions !== false) {
foreach ($extensions as $key => $extension) {
$url = sprintf(
'godmode/servers/discovery&wiz=custom&mode=%s',
$extension['short_name']
);
$sub2[$url]['text'] = __($extension['name']);
}
$sub['godmode/servers/discovery&wiz=custom']['text'] = __('Custom');
$sub['godmode/servers/discovery&wiz=custom']['id'] = 'customExt';
$sub['godmode/servers/discovery&wiz=custom']['type'] = 'direct';
$sub['godmode/servers/discovery&wiz=custom']['subtype'] = 'nolink';
$sub['godmode/servers/discovery&wiz=custom']['sub2'] = $sub2;
}
if (check_acl($config['id_user'], 0, 'RW')
|| check_acl($config['id_user'], 0, 'RM')
|| check_acl($config['id_user'], 0, 'PM')
) {
$sub['godmode/servers/discovery&wiz=magextensions']['text'] = __('Manage disco packages');
$sub['godmode/servers/discovery&wiz=magextensions']['id'] = 'mextensions';
}
if ((bool) check_acl($config['id_user'], 0, 'RW') === true
|| (bool) check_acl($config['id_user'], 0, 'RM') === true
|| (bool) check_acl($config['id_user'], 0, 'PM') === true
) {
enterprise_hook('console_task_menu');
}
} }
} }
@ -174,6 +257,13 @@ if ($access_console_node === true) {
} }
$sub = []; $sub = [];
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$sub['wizard']['text'] = __('Configuration wizard');
$sub['wizard']['id'] = 'conf_wizard';
$sub['wizard']['type'] = 'direct';
$sub['wizard']['subtype'] = 'nolink_no_arrow';
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$sub['templates']['text'] = __('Templates'); $sub['templates']['text'] = __('Templates');
$sub['templates']['id'] = 'Templates'; $sub['templates']['id'] = 'Templates';
@ -495,9 +585,13 @@ if ($access_console_node === true) {
$sub2[$extmenu['sec2']]['refr'] = 0; $sub2[$extmenu['sec2']]['refr'] = 0;
} else { } else {
if (is_array($extmenu) === true && array_key_exists('fatherId', $extmenu) === true) { if (is_array($extmenu) === true && array_key_exists('fatherId', $extmenu) === true) {
if (strlen($extmenu['fatherId']) > 0) { if (empty($extmenu['fatherId']) === false
&& strlen($extmenu['fatherId']) > 0
) {
if (array_key_exists('subfatherId', $extmenu) === true) { if (array_key_exists('subfatherId', $extmenu) === true) {
if (strlen($extmenu['subfatherId']) > 0) { if (empty($extmenu['subfatherId']) === false
&& strlen($extmenu['subfatherId']) > 0
) {
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['text'] = __($extmenu['name']); $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['text'] = __($extmenu['name']);
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['id'] = str_replace(' ', '_', $extmenu['name']); $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['id'] = str_replace(' ', '_', $extmenu['name']);
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['refr'] = 0; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['refr'] = 0;
@ -620,3 +714,55 @@ if ((bool) $config['pure'] === false) {
} }
echo '<div id="about-div"></div>'; echo '<div id="about-div"></div>';
// Need to be here because the translate string.
if (check_acl($config['id_user'], $group, 'AW')) {
?>
<script type="text/javascript">
$("#conf_wizard").click(function() {
$("#conf_wizard").addClass("selected");
if (!$("#welcome_modal_window").length) {
$(document.body).append('<div id="welcome_modal_window"></div>');
$(document.body).append(
$('<link rel="stylesheet" type="text/css" />').attr(
"href",
"include/styles/new_installation_welcome_window.css"
)
);
}
load_modal({
target: $('#welcome_modal_window'),
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
modal: {
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
cancel: '<?php echo __('Do not show anymore'); ?>',
ok: '<?php echo __('Close'); ?>'
},
onshow: {
page: 'include/ajax/welcome_window',
method: 'loadWelcomeWindow',
},
oncancel: {
page: 'include/ajax/welcome_window',
title: "<?php echo __('Cancel Configuration Window'); ?>",
method: 'cancelWelcome',
confirm: function (fn) {
confirmDialog({
title: '<?php echo __('Are you sure?'); ?>',
message: '<?php echo __('Are you sure you want to cancel this tutorial?'); ?>',
ok: '<?php echo __('OK'); ?>',
cancel: '<?php echo __('Cancel'); ?>',
onAccept: function() {
// Continue execution.
fn();
}
})
}
}
});
});
</script>
<?php
}

View File

@ -261,8 +261,8 @@ $table->data['first_line'][] = html_print_label_input_block(
'assign_group', 'assign_group',
$assign_group, $assign_group,
'', '',
'', __('All'),
-1, 0,
true, true,
false, false,
false, false,

View File

@ -488,14 +488,38 @@ if (!empty($graphs)) {
true true
); );
$ActionButtons[] = '</form>'; $ActionButtons[] = '</form>';
$offset = (int) get_parameter('offset', 0);
$block_size = (int) $config['block_size'];
$tablePagination = ui_pagination(
count($graphs),
false,
$offset,
$block_size,
true,
'offset',
false
);
} }
// FALTA METER EL PRINT TABLE. // FALTA METER EL PRINT TABLE.
html_print_table($table); html_print_table($table);
html_print_action_buttons(
implode('', $ActionButtons), if (is_metaconsole() === true) {
['type' => 'form_action'] html_print_action_buttons(
); implode('', $ActionButtons),
['type' => 'form_action']
);
} else {
html_print_action_buttons(
implode('', $ActionButtons),
[
'type' => 'form_action',
'right_content' => $tablePagination,
]
);
}
} }
echo '</div>'; echo '</div>';

View File

@ -38,6 +38,9 @@ require_once $config['homedir'].'/include/db/oracle.php';
// Login check. // Login check.
check_login(); check_login();
// Validate enterprise.
$is_enterprise = enterprise_installed();
if (! check_acl($config['id_user'], 0, 'RW') if (! check_acl($config['id_user'], 0, 'RW')
&& ! check_acl($config['id_user'], 0, 'RM') && ! check_acl($config['id_user'], 0, 'RM')
) { ) {
@ -3682,25 +3685,28 @@ $class = 'databox filters';
?> ?>
</td> </td>
</tr> </tr>
<?php
<tr id="row_landscape" class="datos"> if ($is_enterprise) {
<td class="bolder">
<?php
echo __('Show item in landscape format (only PDF)');
?> ?>
</td> <tr id="row_landscape" class="datos">
<td><?php html_print_checkbox_switch('landscape', 1, $landscape); ?></td> <td class="bolder">
</tr> <?php
echo __('Show item in landscape format (only PDF)');
<tr id="row_pagebreak" class="datos"> ?>
<td class="bolder"> </td>
<td><?php html_print_checkbox_switch('landscape', 1, $landscape); ?></td>
</tr>
<tr id="row_pagebreak" class="datos">
<td class="bolder">
<?php
echo __('Page break at the end of the item (only PDF)');
?>
</td>
<td><?php html_print_checkbox_switch('pagebreak', 1, $pagebreak); ?></td>
</tr>
<?php <?php
echo __('Page break at the end of the item (only PDF)'); }
?> ?>
</td>
<td><?php html_print_checkbox_switch('pagebreak', 1, $pagebreak); ?></td>
</tr>
<tr id="row_agents_inventory_display_options" class="datos"> <tr id="row_agents_inventory_display_options" class="datos">
<td class="bolder"> <td class="bolder">
<?php <?php
@ -6714,6 +6720,8 @@ function chooseType() {
$("#row_agent").show(); $("#row_agent").show();
$("#row_module").show(); $("#row_module").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
period_set_value($("#hidden-period").attr('class'), 3600);
$("#row_period").find('select').val('3600').trigger('change');
break; break;
case 'SLA_monthly': case 'SLA_monthly':

View File

@ -116,10 +116,13 @@ if (!$report_r && !$report_w && !$report_m) {
} }
require_once $config['homedir'].'/include/functions_reports.php'; require_once $config['homedir'].'/include/functions_reports.php';
require_once $config['homedir'].'/godmode/wizards/DiscoveryTaskList.class.php';
// Load enterprise extensions. // Load enterprise extensions.
enterprise_include('operation/reporting/custom_reporting.php'); enterprise_include('operation/reporting/custom_reporting.php');
enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_metaconsole.php');
enterprise_include_once('include/functions_tasklist.php');
enterprise_include_once('include/functions_cron.php');
@ -782,7 +785,7 @@ switch ($action) {
'<span class="subsection_header_title">'.__('Filters').'</span>', '<span class="subsection_header_title">'.__('Filters').'</span>',
'filter_form', 'filter_form',
'', '',
false, true,
false, false,
'', '',
'white-box-content', 'white-box-content',
@ -1251,7 +1254,12 @@ switch ($action) {
array_push($table->data, $data); array_push($table->data, $data);
} }
html_print_table($table); $reports_table = '<div class="white_box">';
$reports_table .= '<span class="white_table_graph_header">'.__('Reports').'</span>';
$reports_table .= html_print_table($table, true);
$reports_table .= '<br></div>';
echo $reports_table;
$tablePagination = ui_pagination( $tablePagination = ui_pagination(
$total_reports, $total_reports,
$url, $url,
@ -1259,7 +1267,7 @@ switch ($action) {
$pagination, $pagination,
true, true,
'offset', 'offset',
false, false
); );
} else { } else {
ui_print_info_message( ui_print_info_message(
@ -1270,6 +1278,21 @@ switch ($action) {
); );
} }
$discovery_tasklist = new DiscoveryTaskList();
$report_task_data = $discovery_tasklist->showListConsoleTask(true);
if (is_array($report_task_data) === true || strpos($report_task_data, 'class="nf"') === false) {
$task_table = '<div class="mrgn_top_15px white_box">';
$task_table .= '<span class="white_table_graph_header">'.__('Report tasks');
$task_table .= ui_print_help_tip(__('To schedule a report, do it from the editing view of each report.'), true);
$task_table .= '</span><div>';
$task_table .= $report_task_data;
$task_table .= '</div></div>';
echo $task_table;
} else {
ui_print_info_message($report_task_data.__('To schedule a report, do it from the editing view of each report.'));
}
if (check_acl($config['id_user'], 0, 'RW') if (check_acl($config['id_user'], 0, 'RW')
|| check_acl($config['id_user'], 0, 'RM') || check_acl($config['id_user'], 0, 'RM')
) { ) {
@ -3860,7 +3883,7 @@ if ($resultOperationDB !== null) {
break; break;
case 'SLA': case 'SLA':
$err .= 'You must enter some character in SLA limit field'; $err .= 'No changes found.';
default: default:
$err .= ''; $err .= '';
break; break;
@ -3869,7 +3892,7 @@ if ($resultOperationDB !== null) {
ui_print_result_message( ui_print_result_message(
$resultOperationDB, $resultOperationDB,
__('Successfull action'), __('Successfull action'),
__('Unsuccessful action<br><br>'.$err) __($err)
); );
} }

View File

@ -837,12 +837,6 @@ $buttons['wizard'] = [
'active' => false, 'active' => false,
'text' => '<a href="'.$url_base.$action.'&tab=wizard&id_visual_console='.$idVisualConsole.'">'.html_print_image('images/wizard@svg.svg', true, ['title' => __('Wizard'), 'class' => 'invert_filter']).'</a>', 'text' => '<a href="'.$url_base.$action.'&tab=wizard&id_visual_console='.$idVisualConsole.'">'.html_print_image('images/wizard@svg.svg', true, ['title' => __('Wizard'), 'class' => 'invert_filter']).'</a>',
]; ];
if ($config['legacy_vc']) {
$buttons['editor'] = [
'active' => false,
'text' => '<a href="'.$url_base.$action.'&tab=editor&id_visual_console='.$idVisualConsole.'">'.html_print_image('images/builder@svg.svg', true, ['title' => __('Builder'), 'class' => 'invert_filter']).'</a>',
];
}
$buttons['view'] = [ $buttons['view'] = [
'active' => false, 'active' => false,

View File

@ -53,6 +53,12 @@ function get_wiz_class($str)
case 'deploymentCenter': case 'deploymentCenter':
return 'DeploymentCenter'; return 'DeploymentCenter';
case 'magextensions':
return 'ManageExtensions';
case 'custom':
return 'Custom';
default: default:
// Main, show header. // Main, show header.
ui_print_standard_header( ui_print_standard_header(
@ -161,7 +167,7 @@ if ($classname_selected === null) {
$wiz_data = []; $wiz_data = [];
foreach ($classes as $classpath) { foreach ($classes as $classpath) {
if (is_reporting_console_node() === true) { if (is_reporting_console_node() === true) {
if ($classpath !== '/var/www/html/pandora_console/godmode/wizards/DiscoveryTaskList.class.php') { if ($classpath !== $config['homedir'].'/godmode/wizards/DiscoveryTaskList.class.php') {
continue; continue;
} }
} }
@ -169,6 +175,12 @@ if ($classname_selected === null) {
$classname = basename($classpath, '.class.php'); $classname = basename($classpath, '.class.php');
$obj = new $classname(); $obj = new $classname();
if (method_exists($obj, 'isEmpty') === true) {
if ($obj->isEmpty() === true) {
continue;
}
}
$button = $obj->load(); $button = $obj->load();
if ($button === false) { if ($button === false) {

View File

@ -45,9 +45,120 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
if (isset($_GET['server']) === true) { if (isset($_GET['server']) === true) {
$id_server = get_parameter_get('server'); $id_server = get_parameter_get('server');
$title = __('Update').' ';
$sql = sprintf('SELECT name, ip_address, description, server_type, exec_proxy, port FROM tserver WHERE id_server = %d', $id_server);
$row = db_get_row_sql($sql);
switch ($row['server_type']) {
case SERVER_TYPE_DATA:
$title .= __('Data server').' ID: '.$id_server;
break;
case SERVER_TYPE_NETWORK:
$title .= __('Network server').' ID: '.$id_server;
break;
case SERVER_TYPE_SNMP:
$title .= __('SNMP Trap server').' ID: '.$id_server;
break;
case SERVER_TYPE_DISCOVERY:
$title .= __('Discovery server').' ID: '.$id_server;
break;
case SERVER_TYPE_PLUGIN:
$title .= __('Plugin server').' ID: '.$id_server;
break;
case SERVER_TYPE_PREDICTION:
$title .= __('Prediction server').' ID: '.$id_server;
break;
case SERVER_TYPE_WMI:
$title .= __('WMI server').' ID: '.$id_server;
break;
case SERVER_TYPE_EXPORT:
$title .= __('Export server').' ID: '.$id_server;
$id_modulo = 0;
break;
case SERVER_TYPE_INVENTORY:
$title .= __('Inventory server').' ID: '.$id_server;
break;
case SERVER_TYPE_WEB:
$title .= __('Web server').' ID: '.$id_server;
break;
case SERVER_TYPE_EVENT:
$title .= __('Event server').' ID: '.$id_server;
break;
case SERVER_TYPE_CORRELATION:
$title .= __('Correlation server').' ID: '.$id_server;
break;
case SERVER_TYPE_ENTERPRISE_ICMP:
$title .= __('Enterprise ICMP server').' ID: '.$id_server;
break;
case SERVER_TYPE_ENTERPRISE_SNMP:
$title .= __('Enterprise SNMP server').' ID: '.$id_server;
break;
case SERVER_TYPE_ENTERPRISE_SATELLITE:
$title .= __('Enterprise Satellite server').' ID: '.$id_server;
break;
case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL:
$title .= __('Enterprise Transactional server').' ID: '.$id_server;
break;
case SERVER_TYPE_MAINFRAME:
$title .= __('Mainframe server').' ID: '.$id_server;
break;
case SERVER_TYPE_SYNC:
$title .= __('Sync server').' ID: '.$id_server;
break;
case SERVER_TYPE_WUX:
$title .= __('Wux server').' ID: '.$id_server;
break;
case SERVER_TYPE_SYSLOG:
$title .= __('Log server').' ID: '.$id_server;
break;
case SERVER_TYPE_NCM:
$title .= __('NCM server').' ID: '.$id_server;
break;
case SERVER_TYPE_AUTOPROVISION:
$title .= __('Autoprovision server').' ID: '.$id_server;
break;
case SERVER_TYPE_MIGRATION:
$title .= __('Migration server').' ID: '.$id_server;
break;
case SERVER_TYPE_ALERT:
$title .= __('Alert server').' ID: '.$id_server;
break;
case SERVER_TYPE_NETFLOW:
$title .= __('Netflow server').' ID: '.$id_server;
break;
default:
$title = __('Update server').' ID: '.$id_server;
break;
}
// Headers. // Headers.
ui_print_standard_header( ui_print_standard_header(
__('Update Server'), $title,
'images/gm_servers.png', 'images/gm_servers.png',
false, false,
'', '',
@ -65,8 +176,6 @@ if (isset($_GET['server']) === true) {
] ]
); );
$sql = sprintf('SELECT name, ip_address, description, server_type, exec_proxy, port FROM tserver WHERE id_server = %d', $id_server);
$row = db_get_row_sql($sql);
echo '<form name="servers" method="POST" action="index.php?sec=gservers&sec2=godmode/servers/modificar_server&update=1">'; echo '<form name="servers" method="POST" action="index.php?sec=gservers&sec2=godmode/servers/modificar_server&update=1">';
html_print_input_hidden('server', $id_server); html_print_input_hidden('server', $id_server);
@ -212,7 +321,7 @@ if (isset($_GET['server']) === true) {
false, false,
'servers', 'servers',
true, true,
[], $buttons,
[ [
[ [
'link' => '', 'link' => '',

View File

@ -0,0 +1,71 @@
<?php
/**
* Pending alerts list view.
*
* @category Pending alerts list
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config;
require_once $config['homedir'].'/include/class/AlertsList.class.php';
$ajaxPage = 'godmode/servers/pending_alerts_list';
// Control call flow.
try {
// User access and validation is being processed on class constructor.
$adw = new AlertsList($ajaxPage);
} catch (Exception $e) {
if (is_ajax()) {
echo json_encode(['error' => '[PendingAlertsList]'.$e->getMessage() ]);
exit;
} else {
echo '[PendingAlertsList]'.$e->getMessage();
}
// Stop this execution, but continue 'globally'.
return;
}
// AJAX controller.
if (is_ajax()) {
$method = get_parameter('method');
if (method_exists($adw, $method) === true) {
if ($adw->ajaxMethod($method) === true) {
$adw->{$method}();
} else {
$adw->error('Unavailable method.');
}
} else {
$adw->error('Method not found. ['.$method.']');
}
// Stop any execution.
exit;
} else {
// Run.
$adw->run();
}

View File

@ -560,7 +560,14 @@ if (empty($create) === false || empty($view) === false) {
// $data[0] = html_print_div(['id' => 'command_preview', 'class' => 'mono'], true); // $data[0] = html_print_div(['id' => 'command_preview', 'class' => 'mono'], true);
$data[0] = html_print_label_input_block( $data[0] = html_print_label_input_block(
__('Command preview'), __('Command preview'),
html_print_div(['id' => 'command_preview', 'class' => 'mono'], true) html_print_div(
[
'id' => 'command_preview',
'class' => 'mono',
'style' => 'max-width: 1050px;overflow-wrap: break-word;',
],
true
)
); );
$table->data['plugin_preview_inputs'] = $data; $table->data['plugin_preview_inputs'] = $data;
$table->colspan['plugin_preview_inputs'][0] = 2; $table->colspan['plugin_preview_inputs'][0] = 2;

View File

@ -28,6 +28,7 @@
// Begin. // Begin.
require_once 'include/functions_clippy.php'; require_once 'include/functions_clippy.php';
require_once 'pending_alerts_list.php';
global $config; global $config;
@ -101,6 +102,13 @@ foreach ($servers as $server) {
} }
} }
$ext = '';
// Check for any data-type server present in servers list. If none, enable server access for first server.
if (array_search('data', array_column($servers, 'type')) === false) {
$ext = '_server';
}
foreach ($servers as $server) { foreach ($servers as $server) {
$data = []; $data = [];
@ -185,14 +193,12 @@ foreach ($servers as $server) {
$data[7] = ui_print_timestamp($server['keepalive'], true); $data[7] = ui_print_timestamp($server['keepalive'], true);
if ($server['type'] === 'data') {
$ext = '_server'; $ext = '_server';
if ($server['type'] != 'data') {
$ext = '';
} }
$safe_server_name = servers_get_name($server['id_server']); $safe_server_name = servers_get_name($server['id_server']);
if (($server['type'] == 'data' || $server['type'] == 'enterprise satellite')) { if (($ext === '_server' || $server['type'] == 'enterprise satellite')) {
if (servers_check_remote_config($safe_server_name.$ext) && enterprise_installed()) { if (servers_check_remote_config($safe_server_name.$ext) && enterprise_installed()) {
$names_servers[$safe_server_name] = true; $names_servers[$safe_server_name] = true;
} else { } else {
@ -242,6 +248,19 @@ foreach ($servers as $server) {
$data[8] .= '</a>'; $data[8] .= '</a>';
} }
if ($server['type'] === 'event' && (bool) check_acl($config['id_user'], 0, 'LM') === true) {
$data[8] .= '<a class="open-alerts-list-modal" href="">';
$data[8] .= html_print_image(
'images/alert@svg.svg',
true,
[
'title' => __('Pending alerts list'),
'class' => 'main_menu_icon invert_filter',
]
);
$data[8] .= '</a>';
}
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server']).'">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server']).'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/edit.svg', 'images/edit.svg',
@ -253,7 +272,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) && ($ext === '_server' || $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.'&tab=agent_editor').'">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'&tab=agent_editor').'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/agents@svg.svg', 'images/agents@svg.svg',
@ -298,6 +317,8 @@ foreach ($servers as $server) {
unset($data[8]); unset($data[8]);
} }
$ext = '';
array_push($table->data, $data); array_push($table->data, $data);
} }

View File

@ -210,7 +210,10 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) {
echo '<td class="'.$tdcolor.' table_action_buttons"><a href="index.php?sec=gsetup&sec2=godmode/setup/links&id_link='.$row['id_link'].'&borrar='.$row['id_link'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image( echo '<td class="'.$tdcolor.' table_action_buttons"><a href="index.php?sec=gsetup&sec2=godmode/setup/links&id_link='.$row['id_link'].'&borrar='.$row['id_link'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
'images/delete.svg', 'images/delete.svg',
true, true,
['class' => 'invert_filter'] [
'class' => 'invert_filter main_menu_icon',
'title' => __('Delete'),
]
).'</a></td></tr>'; ).'</a></td></tr>';
} }

View File

@ -419,6 +419,9 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript
// Include tiny for wysiwyg editor. // Include tiny for wysiwyg editor.
ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/'); ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/');
ui_require_javascript_file('pandora'); ui_require_javascript_file('pandora');
if ($config['style'] === 'pandora_black') {
html_print_input_hidden('selected_style_theme', 'pandora_black');
}
?> ?>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
@ -443,8 +446,12 @@ ui_require_javascript_file('pandora');
changeYear: true, changeYear: true,
showAnim: "slideDown"} showAnim: "slideDown"}
); );
var consoleStyle = $("#hidden-selected_style_theme").val();
defineTinyMCE('#textarea_text'); if (consoleStyle == "pandora_black") {
defineTinyMCEDark('#textarea_text');
} else {
defineTinyMCE('#textarea_text');
}
$("#checkbox-expire").click(function() { $("#checkbox-expire").click(function() {
check_expire(); check_expire();
@ -462,5 +469,4 @@ ui_require_javascript_file('pandora');
$('#news-0-4').css('visibility', 'hidden'); $('#news-0-4').css('visibility', 'hidden');
} }
} }
</script> </script>

View File

@ -132,7 +132,15 @@ foreach ($osList as $os) {
$data[] = html_print_anchor( $data[] = html_print_anchor(
[ [
'href' => $hrefDelete, 'href' => $hrefDelete,
'content' => html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']), 'content' => html_print_image(
'images/delete.svg',
true,
[
'alt' => __('Delete'),
'title' => __('Delete'),
'class' => 'main_menu_icon invert_filter',
]
),
], ],
true true
); );

View File

@ -545,23 +545,8 @@ $table->data[6][0] = html_print_label_input_block(
) )
); );
$table->data[6][1] = html_print_label_input_block(
__('Max. days before delete old network matrix data'),
html_print_input(
[
'type' => 'number',
'size' => 5,
'max' => $performance_variables_control['delete_old_network_matrix']->max,
'name' => 'delete_old_network_matrix',
'value' => $config['delete_old_network_matrix'],
'return' => true,
'min' => $performance_variables_control['delete_old_network_matrix']->min,
]
)
);
if (enterprise_installed()) { if (enterprise_installed()) {
$table->data[7][0] = html_print_label_input_block( $table->data[6][1] = html_print_label_input_block(
__('Max. days before delete inventory data'), __('Max. days before delete inventory data'),
html_print_input_text( html_print_input_text(
'inventory_purge', 'inventory_purge',
@ -574,6 +559,18 @@ if (enterprise_installed()) {
); );
} }
$table->data[7][1] = html_print_label_input_block(
__('Max. days before disabled agents are deleted'),
html_print_input_text(
'delete_disabled_agents',
$config['delete_disabled_agents'],
'',
false,
0,
true
)
);
$table_other = new stdClass(); $table_other = new stdClass();
$table_other->width = '100%'; $table_other->width = '100%';
$table_other->class = 'filter-table-adv'; $table_other->class = 'filter-table-adv';

View File

@ -210,7 +210,7 @@ if (is_ajax() === true) {
// Ldapsearch timeout. // Ldapsearch timeout.
// Default Ldapsearch timeout. // Default Ldapsearch timeout.
set_when_empty($config['ldap_searh_timeout'], 5); set_when_empty($config['ldap_search_timeout'], 5);
$row = []; $row = [];
$row['name'] = __('Ldap search timeout (secs)'); $row['name'] = __('Ldap search timeout (secs)');
$row['control'] = html_print_input_text( $row['control'] = html_print_input_text(
@ -558,7 +558,13 @@ echo '</form>';
if ($('input[type=checkbox][name=secondary_ldap_enabled]:checked').val() == 1) { if ($('input[type=checkbox][name=secondary_ldap_enabled]:checked').val() == 1) {
$("tr[id*='ldap_'][id$='_secondary']").show(); $("tr[id*='ldap_'][id$='_secondary']").show();
} else { } else {
$( "tr[id*='ldap_'][id$='_secondary']" ).hide(); $( "tr[id*='ldap_'][id$='_secondary']" ).hide();
}
if ($('input[type=checkbox][name=secondary_active_directory]:checked').val() == 1) {
$("tr[id*='ad_'][id$='_secondary']").show();
} else {
$( "tr[id*='ad_'][id$='_secondary']" ).hide();
} }
} }
$( document ).ready(function() { $( document ).ready(function() {

View File

@ -681,15 +681,19 @@ $table->data[$i++][] = html_print_label_input_block(
) )
); );
$help_tip = ui_print_help_tip(
__('This log is recommended to be DISABLED by default due to the large amount of debug data it generates.'),
true
);
$table->data[$i][] = html_print_label_input_block( $table->data[$i][] = html_print_label_input_block(
__('Enable console log'), __('Enable console log').$help_tip,
html_print_checkbox_switch( html_print_checkbox_switch(
'console_log_enabled', 'console_log_enabled',
1, 1,
$config['console_log_enabled'], $config['console_log_enabled'],
true true
).ui_print_input_placeholder( ).ui_print_input_placeholder(
__('Log location').': pandora_console/log/console.log', __('Log location').': /var/log/php-fpm/error.log',
true true
) )
); );
@ -743,6 +747,26 @@ $table->data[$i][] = html_print_label_input_block(
) )
); );
$table->data[$i++][] = html_print_label_input_block(
__('Max. hours old events comments'),
html_print_input_number(
[
'name' => 'max_hours_old_event_comment',
'min' => 0,
'value' => $config['max_hours_old_event_comment'],
]
)
);
$table->data[$i][] = html_print_label_input_block(
__('Show experimental features'),
html_print_checkbox_switch(
'show_experimental_features',
1,
$config['show_experimental_features'],
true
)
);
echo '<form class="max_floating_element_size" id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">'; echo '<form class="max_floating_element_size" id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';
echo '<fieldset class="margin-bottom-10">'; echo '<fieldset class="margin-bottom-10">';

View File

@ -1344,17 +1344,6 @@ $table_vc->style[0] = 'font-weight: bold';
$table_vc->size[0] = '50%'; $table_vc->size[0] = '50%';
$table_vc->data = []; $table_vc->data = [];
// Remove when the new view reaches rock solid stability.
$table_vc->data[$row][] = html_print_label_input_block(
__('Legacy Visual Console View'),
html_print_checkbox_switch(
'legacy_vc',
1,
(bool) $config['legacy_vc'],
true
)
);
$table_vc->data[$row][] = html_print_label_input_block( $table_vc->data[$row][] = html_print_label_input_block(
__('Default cache expiration'), __('Default cache expiration'),
html_print_extended_select_for_time( html_print_extended_select_for_time(
@ -1372,7 +1361,6 @@ $table_vc->data[$row][] = html_print_label_input_block(
$intervals $intervals
) )
); );
$row++;
$table_vc->data[$row][] = html_print_label_input_block( $table_vc->data[$row][] = html_print_label_input_block(
__('Default interval for refresh on Visual Console'), __('Default interval for refresh on Visual Console'),
@ -1388,6 +1376,7 @@ $table_vc->data[$row][] = html_print_label_input_block(
false false
) )
); );
$row++;
$table_vc->data[$row][] = html_print_label_input_block( $table_vc->data[$row][] = html_print_label_input_block(
__('Type of view of visual consoles'), __('Type of view of visual consoles'),
@ -1401,12 +1390,12 @@ $table_vc->data[$row][] = html_print_label_input_block(
true true
) )
); );
$row++;
$table_vc->data[$row][] = html_print_label_input_block( $table_vc->data[$row][] = html_print_label_input_block(
__('Number of favorite visual consoles to show in the menu'), __('Number of favorite visual consoles to show in the menu'),
"<input ' value=".$config['vc_menu_items']." size='5' name='vc_menu_items' min='0' max='25'>" "<input ' value=".$config['vc_menu_items']." size='5' name='vc_menu_items' min='0' max='25'>"
); );
$row++;
$table_vc->data[$row][] = html_print_label_input_block( $table_vc->data[$row][] = html_print_label_input_block(
__('Default line thickness for the Visual Console'), __('Default line thickness for the Visual Console'),
@ -1419,7 +1408,6 @@ $table_vc->data[$row][] = html_print_label_input_block(
true true
) )
); );
$row++;
$table_vc->data[$row][] = html_print_label_input_block( $table_vc->data[$row][] = html_print_label_input_block(
__('Lock screen orientation when viewing on mobile devices'), __('Lock screen orientation when viewing on mobile devices'),
@ -1430,6 +1418,7 @@ $table_vc->data[$row][] = html_print_label_input_block(
true true
) )
); );
$row++;
$table_vc->data[$row][] = html_print_label_input_block( $table_vc->data[$row][] = html_print_label_input_block(
__('Display item frame on alert triggered'), __('Display item frame on alert triggered'),
@ -1783,7 +1772,9 @@ $table_other->data[$row][] = html_print_label_input_block(
100, 100,
true true
).ui_print_input_placeholder( ).ui_print_input_placeholder(
__('Example').': '.date($config['date_format']), __('Example').': '.date(
str_replace('&#x20;', ' ', $config['date_format'])
),
true true
) )
); );

View File

@ -786,7 +786,7 @@ if ($create_alert || $update_alert) {
2, 2,
2, 2,
$custom_value, $custom_value,
'class="w100p"', 'class="w100p" required="required"',
true true
) )
); );
@ -804,6 +804,8 @@ if ($create_alert || $update_alert) {
'', '',
50, 50,
255, 255,
true,
false,
true true
) )
); );
@ -818,6 +820,8 @@ if ($create_alert || $update_alert) {
'', '',
20, 20,
255, 255,
true,
false,
true true
) )
); );
@ -2002,6 +2006,7 @@ if ($create_alert || $update_alert) {
'alt' => __('Update'), 'alt' => __('Update'),
'border' => 0, 'border' => 0,
'class' => 'main_menu_icon', 'class' => 'main_menu_icon',
'title' => __('Edit'),
] ]
), ),
], ],
@ -2170,24 +2175,11 @@ if ($create_alert || $update_alert) {
echo '</form>'; echo '</form>';
} }
echo '<div class="right">'; $legend = '<table id="legend_snmp_alerts"class="w100p"><td><div class="snmp_view_div w100p legend_white">';
echo '<form name="agente" method="post" action="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_alert">'; $legend .= '<div class="display-flex"><div class="flex-50">';
html_print_input_hidden('create_alert', 1); $priorities = get_priorities();
$submitButton = html_print_submit_button( $half = (count($priorities) / 2);
__('Create'), $count = 0;
'alert',
false,
['icon' => 'wand'],
true
);
html_print_action_buttons($submitButton.$deleteButton, ['right_content' => $pagination]);
echo '</form></div>';
$legend = '<table id="legend_snmp_alerts"class="w100p"><td><div class="snmp_view_div w100p legend_white">';
$legend .= '<div class="display-flex"><div class="flex-50">';
$priorities = get_priorities();
$half = (count($priorities) / 2);
$count = 0;
foreach ($priorities as $num => $name) { foreach ($priorities as $num => $name) {
if ($count == $half) { if ($count == $half) {
$legend .= '</div><div class="mrgn_lft_5px flex-50">'; $legend .= '</div><div class="mrgn_lft_5px flex-50">';
@ -2198,11 +2190,24 @@ if ($create_alert || $update_alert) {
$count++; $count++;
} }
$legend .= '</div></div></div></td>'; $legend .= '</div></div></div></td></tr></table>';
ui_toggle($legend, __('Legend')); ui_toggle($legend, __('Legend'));
unset($table); unset($table);
echo '<div class="right">';
echo '<form name="agente" method="post" action="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_alert">';
html_print_input_hidden('create_alert', 1);
$submitButton = html_print_submit_button(
__('Create'),
'alert',
false,
['icon' => 'wand'],
true
);
html_print_action_buttons($submitButton.$deleteButton, ['right_content' => $pagination]);
echo '</form></div>';
} }
ui_require_javascript_file('pandora', 'include/javascript/', true); ui_require_javascript_file('pandora', 'include/javascript/', true);

View File

@ -50,7 +50,7 @@ try {
[ [
'id' => $tableId, 'id' => $tableId,
'class' => 'info_table', 'class' => 'info_table',
'style' => 'width: 99%', 'style' => 'width: 100%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $column_names, 'column_names' => $column_names,
'ajax_url' => 'include/ajax/update_manager', 'ajax_url' => 'include/ajax/update_manager',

View File

@ -784,10 +784,12 @@ $userManagementTable->data['fields_addSettings'][1] .= html_print_div(
if (isset($CodeQRTable) === true || isset($apiTokenContent) === true) { if (isset($CodeQRTable) === true || isset($apiTokenContent) === true) {
// QR Code and API Token advice. // QR Code and API Token advice.
$titleQr = '<span class="font-title-font">'.__('Contact details (QR)').'</span>';
$titleApi = '<span class="font-title-font margin-top-10">'.__('API Token credentials').'</span>';
html_print_div( html_print_div(
[ [
'id' => 'api_qrcode_display', 'id' => 'api_qrcode_display',
'content' => $CodeQRTable.$apiTokenContent, 'content' => $titleQr.$CodeQRTable.$titleApi.$apiTokenContent,
] ]
); );
} }

View File

@ -0,0 +1,221 @@
<?php
/**
* Applications wizard manager.
*
* @category Wizard
* @package Pandora FMS
* @subpackage Applications
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2007-2021 Artica Soluciones Tecnologicas, http://www.artica.es
* This code is NOT free software. This code is NOT licenced under GPL2 licence
* You cannnot redistribute it without written permission of copyright holder.
* ============================================================================
*/
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/class/ExtensionsDiscovery.class.php';
/**
* Implements Wizard to provide generic Applications wizard.
*/
class Applications extends Wizard
{
/**
* Sub-wizard to be launch (vmware,oracle...).
*
* @var string
*/
public $mode;
/**
* Constructor.
*
* @param integer $page Start page, by default 0.
* @param string $msg Default message to show to users.
* @param string $icon Target icon to be used.
* @param string $label Target label to be displayed.
*
* @return mixed
*/
public function __construct(
int $page=0,
string $msg='Default message. Not set.',
string $icon='images/wizard/applications.png',
string $label='Applications'
) {
$this->setBreadcrum([]);
$this->access = 'AW';
$this->task = [];
$this->msg = $msg;
$this->icon = $icon;
$this->class = $class_style;
$this->label = $label;
$this->page = $page;
$this->url = ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=app'
);
return $this;
}
/**
* Run wizard manager.
*
* @return mixed Returns null if wizard is ongoing. Result if done.
*/
public function run()
{
global $config;
// Load styles.
parent::run();
// Load current wiz. sub-styles.
ui_require_css_file(
'application',
ENTERPRISE_DIR.'/include/styles/wizards/'
);
$mode = get_parameter('mode', null);
// Load application wizards.
$enterprise_classes = glob(
$config['homedir'].'/'.ENTERPRISE_DIR.'/include/class/*.app.php'
);
$extensions = new ExtensionsDiscovery('app', $mode);
foreach ($enterprise_classes as $classpath) {
enterprise_include_once(
'include/class/'.basename($classpath)
);
}
switch ($mode) {
case 'DB2':
$classname_selected = 'DB2';
break;
case 'SAP':
$classname_selected = 'SAP';
break;
case 'vmware':
$classname_selected = 'VMware';
break;
case 'mysql':
$classname_selected = 'MySQL';
break;
case 'oracle':
$classname_selected = 'Oracle';
break;
case 'MicrosoftSQLServer':
$classname_selected = 'MicrosoftSQLServer';
break;
default:
$classname_selected = null;
break;
}
// Else: class not found pseudo exception.
if ($classname_selected !== null) {
$wiz = new $classname_selected($this->page);
$result = $wiz->run();
if (is_array($result) === true) {
return $result;
}
}
if ($classname_selected === null) {
if ($mode !== null) {
// Load extension if exist.
$extensions->run();
return;
}
// Load classes and print selector.
$wiz_data = [];
foreach ($enterprise_classes as $classpath) {
$classname = basename($classpath, '.app.php');
$obj = new $classname();
$wiz_data[] = $obj->load();
}
$wiz_data = array_merge($wiz_data, $extensions->loadExtensions());
$this->prepareBreadcrum(
[
[
'link' => ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery'
),
'label' => __('Discovery'),
],
[
'link' => ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=app'
),
'label' => __('Applications'),
'selected' => true,
],
]
);
// Header.
ui_print_page_header(
__('Applications'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
$this->printHeader(true)
);
Wizard::printBigButtonsList($wiz_data);
echo '<div class="app_mssg"><i>*'.__('All company names used here are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.').'</i></div>';
}
return $result;
}
/**
* Check if section have extensions.
*
* @return boolean Return true if section is empty.
*/
public function isEmpty()
{
$extensions = new ExtensionsDiscovery('app');
$listExtensions = $extensions->getExtensionsApps();
if ($listExtensions > 0 || enterprise_installed() === true) {
return false;
} else {
return true;
}
}
}

View File

@ -0,0 +1,661 @@
<?php
/**
* Cloud wizard manager.
*
* @category Wizard
* @package Pandora FMS
* @subpackage Cloud
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2007-2021 Artica Soluciones Tecnologicas, http://www.artica.es
* This code is NOT free software. This code is NOT licenced under GPL2 licence
* You cannnot redistribute it without written permission of copyright holder.
* ============================================================================
*/
global $config;
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/class/CredentialStore.class.php';
/**
* Implements Wizard to provide generic Cloud wizard.
*/
class Cloud extends Wizard
{
/**
* Sub-wizard to be launch (vmware,oracle...).
*
* @var string
*/
public $mode;
/**
* Discovery task data.
*
* @var array.
*/
public $task;
/**
* General maxPages.
*
* @var integer
*/
public $maxPages;
/**
* Product string.
*
* @var string
*/
protected $product = '';
/**
* Credentials store identifier.
*
* @var string
*/
protected $keyIdentifier = null;
/**
* Credentials store product identifier.
*
* @var string
*/
protected $keyStoreType = null;
/**
* Constructor.
*
* @param integer $page Start page, by default 0.
* @param string $msg Default message to show to users.
* @param string $icon Target icon to be used.
* @param string $label Target label to be displayed.
*
* @return mixed
*/
public function __construct(
int $page=0,
string $msg='Default message. Not set.',
string $icon='images/wizard/cloud.png',
string $label='Cloud'
) {
$this->setBreadcrum([]);
$this->access = 'AW';
$this->task = [];
$this->msg = $msg;
$this->icon = $icon;
$this->label = $label;
$this->page = $page;
$this->url = ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=cloud'
);
return $this;
}
/**
* Run wizard manager.
*
* @return mixed Returns null if wizard is ongoing. Result if done.
*/
public function run()
{
global $config;
// Load styles.
parent::run();
// Load current wiz. sub-styles.
ui_require_css_file(
'cloud',
ENTERPRISE_DIR.'/include/styles/wizards/'
);
$mode = get_parameter('mode', null);
// Load cloud wizards.
$enterprise_classes = glob(
$config['homedir'].'/'.ENTERPRISE_DIR.'/include/class/*.cloud.php'
);
$extensions = new ExtensionsDiscovery('cloud', $mode);
foreach ($enterprise_classes as $classpath) {
enterprise_include_once(
'include/class/'.basename($classpath)
);
}
switch ($mode) {
case 'amazonws':
$classname_selected = 'Aws';
break;
case 'azure':
$classname_selected = 'Azure';
break;
case 'gcp':
$classname_selected = 'Google';
break;
default:
$classname_selected = null;
break;
}
// Else: class not found pseudo exception.
if ($classname_selected !== null) {
$wiz = new $classname_selected($this->page);
$result = $wiz->run();
if (is_array($result) === true) {
return $result;
}
}
if ($classname_selected === null) {
if ($mode !== null) {
// Load extension if exist.
$extensions->run();
return;
}
// Load classes and print selector.
$wiz_data = [];
foreach ($enterprise_classes as $classpath) {
$classname = basename($classpath, '.cloud.php');
$obj = new $classname();
$wiz_data[] = $obj->load();
}
$wiz_data = array_merge($wiz_data, $extensions->loadExtensions());
$this->prepareBreadcrum(
[
[
'link' => ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery'
),
'label' => __('Discovery'),
],
[
'link' => $this->url,
'label' => __('Cloud'),
'selected' => true,
],
],
true
);
// Header.
ui_print_page_header(
__('Cloud'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
$this->printHeader(true)
);
Wizard::printBigButtonsList($wiz_data);
echo '<div class="app_mssg"><i>*'.__('All company names used here are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.').'</i></div>';
}
return $result;
}
/**
* Run credentials wizard.
*
* @return boolean True if credentials wizard is displayed and false if not.
*/
public function runCredentials()
{
global $config;
if ($this->status === false) {
$empty_account = true;
}
// Checks credentials. If check not passed. Show the form to fill it.
if ($this->checkCredentials()) {
return true;
}
// Add breadcrum and print header.
$this->prepareBreadcrum(
[
[
'link' => $this->url.'&credentials=1',
'label' => __('%s credentials', $this->product),
'selected' => true,
],
],
true
);
// Header.
ui_print_page_header(
__('%s credentials', $this->product),
'',
false,
$this->product.'_credentials_tab',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
$this->printHeader(true)
);
if ($this->product === 'Aws') {
ui_print_warning_message(
__(
'If a task with the selected credentials is already running, it will be edited. To create a new one, another account from the credential store must be selected.'
)
);
}
if ($this->status === true) {
ui_print_success_message($this->msg);
} else if ($this->status === false) {
ui_print_error_message($this->msg);
}
if ($empty_account === true) {
ui_print_error_message($this->msg);
}
$link_to_cs = '';
if (check_acl($config['id_user'], 0, 'UM')) {
$link_to_cs = '<a class="ext_link" href="'.ui_get_full_url(
'index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox'
).'" >';
$link_to_cs .= __('Manage accounts').'</a>';
}
$this->getCredentials();
$this->printFormAsList(
[
'form' => [
'action' => $this->url,
'method' => 'POST',
'id' => 'form-credentials',
],
'inputs' => [
[
'label' => __('Cloud tool full path'),
'arguments' => [
'name' => 'cloud_util_path',
'value' => isset($config['cloud_util_path']) ? io_safe_output($config['cloud_util_path']) : '/usr/bin/pandora-cm-api',
'type' => 'text',
],
],
[
'label' => __('Account'),
'extra' => $link_to_cs,
'arguments' => [
'name' => 'account_identifier',
'type' => 'select',
'fields' => CredentialStore::getKeys($this->keyStoreType),
'selected' => $this->keyIdentifier,
'return' => true,
],
],
[
'arguments' => [
'name' => 'parse_credentials',
'value' => 1,
'type' => 'hidden',
'return' => true,
],
],
],
]
);
$buttons_form = $this->printInput(
[
'name' => 'submit',
'label' => __('Validate'),
'type' => 'submit',
'attributes' => [
'icon' => 'wand',
'form' => 'form-credentials',
],
'return' => true,
'width' => 'initial',
]
);
$buttons_form .= $this->printGoBackButton(
ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=cloud'
),
true
);
html_print_action_buttons($buttons_form);
return false;
}
/**
* Check credentials.
*
* @return boolean True if credentials are OK.
*/
public function checkCredentials()
{
global $config;
$pandora = io_safe_output($config['cloud_util_path']);
if (isset($pandora) === false) {
config_update_value('cloud_util_path', '/usr/bin/pandora-cm-api');
}
if ((bool) get_parameter('disconnect_account', false) === true) {
$this->status = null;
return false;
}
if ($this->keyIdentifier === null) {
// Ask user for available credentials.
$this->msg = __('Select a set of credentials from the list');
$this->status = null;
return false;
}
$credentials = $this->getCredentials($this->keyIdentifier);
if (empty($credentials['username']) === true
|| empty($credentials['password']) === true
|| isset($pandora) === false
|| is_executable($pandora) === false
) {
if (is_executable($pandora) === false) {
$this->msg = (__('Path %s is not executable.', $pandora));
$this->status = false;
} else {
$this->msg = __('Invalid username or password');
$this->status = false;
}
return false;
}
try {
$value = $this->executeCMCommand('--get availability');
} catch (Exception $e) {
$this->msg = $e->getMessage();
$this->status = false;
return false;
}
if ($value == '1') {
return true;
}
$this->status = false;
// Error message directly from pandora-cm-api.
$this->msg = str_replace('"', '', $value);
return false;
}
/**
* Handle the click on disconnect account link.
*
* @return void But it prints some info to user.
*/
protected function parseDisconnectAccount()
{
// Check if disconection account link is pressed.
if ((bool) get_parameter('disconnect_account') === false) {
return;
}
$ret = $this->setCredentials(null);
if ($ret) {
$this->msg = __('Account disconnected');
} else {
$this->msg = __('Failed disconnecting account');
}
$this->status = $ret;
$this->page = 0;
}
/**
* Build an array with Product credentials.
*
* @return array with credentials (pass and id).
*/
public function getCredentials()
{
return CredentialStore::getKey($this->keyIdentifier);
}
/**
* Set Product credentials.
*
* @param string|null $identifier Credential store identifier.
*
* @return boolean True if success.
*/
public function setCredentials($identifier)
{
if ($identifier === null) {
unset($this->keyIdentifier);
return true;
}
if (isset($identifier) === false) {
return false;
}
$all = CredentialStore::getKeys($this->type);
if (in_array($identifier, $all) === true) {
$this->keyIdentifier = $identifier;
return true;
}
return false;
}
/**
* Parse credentials form.
*
* @return void But it prints a message.
*/
protected function parseCredentials()
{
global $config;
if (!$this->keyIdentifier) {
$this->setCredentials(get_parameter('ki', null));
}
// Check if credentials form is submitted.
if ((bool) get_parameter('parse_credentials') === false) {
return;
}
$this->page = 0;
$ret = $this->setCredentials(
get_parameter('account_identifier')
);
$path = get_parameter('cloud_util_path');
$ret_path = config_update_value('cloud_util_path', $path);
if ($ret_path) {
$config['cloud_util_path'] = $path;
}
if ($ret && $ret_path) {
$this->msg = __('Credentials successfully updated');
} else {
$this->msg = __('Failed updating credentials process');
}
$this->status = ($ret && $ret_path);
}
/**
* This method must be implemented.
*
* Execute a pandora-cm-api request.
*
* @param string $command Command to execute.
*
* @return void But must return string STDOUT of executed command.
* @throws Exception If not implemented.
*/
protected function executeCMCommand($command)
{
throw new Exception('executeCMCommand must be implemented.');
}
/**
* Get a recon token value
*
* @param string $token The recon key to retrieve.
*
* @return string String with the value.
*/
protected function getConfigReconElement($token)
{
if ($this->reconConfig === false
|| isset($this->reconConfig[0][$token]) === false
) {
if (is_array($this->task) === true
&& isset($this->task[$token]) === true
) {
return $this->task[$token];
} else {
return '';
}
} else {
return $this->reconConfig[0][$token];
}
}
/**
* Print global inputs
*
* @param boolean $last True if is last element.
*
* @return array Array with all global inputs.
*/
protected function getGlobalInputs(bool $last=false)
{
$task_id = $this->task['id_rt'];
if (!$task_id) {
$task_id = $this->getConfigReconElement('id_rt');
}
return [
[
'arguments' => [
'name' => 'page',
'value' => ($this->page + 1),
'type' => 'hidden',
'return' => true,
],
],
[
'arguments' => [
'name' => 'submit',
'label' => ($last) ? __('Finish') : __('Next'),
'type' => 'submit',
'attributes' => 'class="sub '.(($last) ? 'wand' : 'next').'"',
'return' => true,
],
],
[
'arguments' => [
'name' => 'task',
'value' => $task_id,
'type' => 'hidden',
'return' => true,
],
],
[
'arguments' => [
'name' => 'parse_form',
'value' => 1,
'type' => 'hidden',
'return' => true,
],
],
];
}
/**
* Print required css in some points.
*
* @return string With js code.
*/
protected function cloudJS()
{
return '
function toggleCloudSubmenu(curr_elem, id_csm){
if (document.getElementsByName(curr_elem)[0].checked){
$("#li-"+id_csm).show();
} else {
$("#li-"+id_csm).hide();
}
};
';
}
/**
* Check if section have extensions.
*
* @return boolean Return true if section is empty.
*/
public function isEmpty()
{
$extensions = new ExtensionsDiscovery('cloud');
$listExtensions = $extensions->getExtensionsApps();
if ($listExtensions > 0 || enterprise_installed() === true) {
return false;
} else {
return true;
}
}
}

View File

@ -0,0 +1,160 @@
<?php
/**
* Custom wizard manager.
*
* @category Wizard
* @package Pandora FMS
* @subpackage Custom
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2007-2021 Artica Soluciones Tecnologicas, http://www.artica.es
* This code is NOT free software. This code is NOT licenced under GPL2 licence
* You cannnot redistribute it without written permission of copyright holder.
* ============================================================================
*/
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/class/ExtensionsDiscovery.class.php';
/**
* Implements Wizard to provide generic Custom wizard.
*/
class Custom extends Wizard
{
/**
* Sub-wizard to be launch (vmware,oracle...).
*
* @var string
*/
public $mode;
/**
* Constructor.
*
* @param integer $page Start page, by default 0.
* @param string $msg Default message to show to users.
* @param string $icon Target icon to be used.
* @param string $label Target label to be displayed.
*
* @return mixed
*/
public function __construct(
int $page=0,
string $msg='Default message. Not set.',
string $icon='/images/wizard/Custom_apps@svg.svg',
string $label='Custom'
) {
$this->setBreadcrum([]);
$this->access = 'AW';
$this->task = [];
$this->msg = $msg;
$this->icon = $icon;
$this->class = $class_style;
$this->label = $label;
$this->page = $page;
$this->url = ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=custom'
);
return $this;
}
/**
* Run wizard manager.
*
* @return mixed Returns null if wizard is ongoing. Result if done.
*/
public function run()
{
global $config;
// Load styles.
parent::run();
// Load current wiz. sub-styles.
ui_require_css_file(
'custom',
ENTERPRISE_DIR.'/include/styles/wizards/'
);
$mode = get_parameter('mode', null);
$extensions = new ExtensionsDiscovery('custom', $mode);
if ($mode !== null) {
// Load extension if exist.
$extensions->run();
return;
}
// Load classes and print selector.
$wiz_data = $extensions->loadExtensions();
$this->prepareBreadcrum(
[
[
'link' => ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery'
),
'label' => __('Discovery'),
],
[
'link' => ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=custom'
),
'label' => __('Custom'),
'selected' => true,
],
]
);
// Header.
ui_print_page_header(
__('Custom'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
$this->printHeader(true)
);
Wizard::printBigButtonsList($wiz_data);
echo '<div class="app_mssg"><i>*'.__('All company names used here are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.').'</i></div>';
return $result;
}
/**
* Check if section have extensions.
*
* @return boolean Return true if section is empty.
*/
public function isEmpty()
{
$extensions = new ExtensionsDiscovery('custom');
$listExtensions = $extensions->getExtensionsApps();
if ($listExtensions > 0) {
return false;
} else {
return true;
}
}
}

View File

@ -129,6 +129,11 @@ class DiscoveryTaskList extends HTML
} }
$delete_console_task = (bool) get_parameter('delete_console_task'); $delete_console_task = (bool) get_parameter('delete_console_task');
$report_task = (bool) get_parameter('report_task', 0);
if ($report_task === true) {
$this->url = ui_get_full_url('index.php?sec=reporting&sec2=godmode/reporting/reporting_builder');
}
if ($delete_console_task === true) { if ($delete_console_task === true) {
return $this->deleteConsoleTask(); return $this->deleteConsoleTask();
} }
@ -163,7 +168,10 @@ class DiscoveryTaskList extends HTML
} }
if (is_reporting_console_node() === false) { if (is_reporting_console_node() === false) {
$ret2 = $this->showList(); $ret2 = $this->showList(__('Host & devices tasks'), [0, 1]);
$ret2 .= $this->showList(__('Applications tasks'), [3, 4, 5, 10, 11, 12], 'app');
$ret2 .= $this->showList(__('Cloud tasks'), [6, 7, 8, 13, 14], 'cloud');
$ret2 .= $this->showList(__('Custom tasks'), [-1], 'custom');
} }
if ($ret === false && $ret2 === false) { if ($ret === false && $ret2 === false) {
@ -287,6 +295,10 @@ class DiscoveryTaskList extends HTML
} }
$id_console_task = (int) get_parameter('id_console_task'); $id_console_task = (int) get_parameter('id_console_task');
$report_task = (bool) get_parameter('report_task', 0);
if ($report_task === true) {
$this->url = ui_get_full_url('index.php?sec=reporting&sec2=godmode/reporting/reporting_builder');
}
if ($id_console_task != null) { if ($id_console_task != null) {
// -------------------------------- // --------------------------------
@ -352,6 +364,10 @@ class DiscoveryTaskList extends HTML
} }
$id_console_task = (int) get_parameter('id_console_task'); $id_console_task = (int) get_parameter('id_console_task');
$report_task = (bool) get_parameter('report_task', 0);
if ($report_task === true) {
$this->url = ui_get_full_url('index.php?sec=reporting&sec2=godmode/reporting/reporting_builder');
}
if ($id_console_task > 0) { if ($id_console_task > 0) {
$result = db_process_sql_update( $result = db_process_sql_update(
@ -505,9 +521,13 @@ class DiscoveryTaskList extends HTML
/** /**
* Show complete list of running tasks. * Show complete list of running tasks.
* *
* @param string $titleTable Title of section.
* @param array $filter Ids array from apps for filter.
* @param boolean $extension_section Extension to add in table.
*
* @return boolean Success or not. * @return boolean Success or not.
*/ */
public function showList() public function showList($titleTable, $filter, $extension_section=false)
{ {
global $config; global $config;
@ -531,7 +551,16 @@ class DiscoveryTaskList extends HTML
include_once $config['homedir'].'/include/functions_network_profiles.php'; include_once $config['homedir'].'/include/functions_network_profiles.php';
if (users_is_admin()) { if (users_is_admin()) {
$recon_tasks = db_get_all_rows_sql('SELECT * FROM trecon_task'); $recon_tasks = db_get_all_rows_sql(
sprintf(
'SELECT tasks.*, apps.section AS section, apps.short_name AS short_name
FROM trecon_task tasks
LEFT JOIN tdiscovery_apps apps ON tasks.id_app = apps.id_app
WHERE type IN (%s) OR section = "%s"',
implode(',', $filter),
$extension_section
)
);
} else { } else {
$user_groups = implode( $user_groups = implode(
',', ',',
@ -539,9 +568,14 @@ class DiscoveryTaskList extends HTML
); );
$recon_tasks = db_get_all_rows_sql( $recon_tasks = db_get_all_rows_sql(
sprintf( sprintf(
'SELECT * FROM trecon_task 'SELECT tasks.*, apps.section AS section, apps.short_name AS short_name
WHERE id_group IN (%s)', FROM trecon_task
$user_groups LEFT JOIN tdiscovery_apps apps ON tasks.id_app = apps.id_app
WHERE id_group IN (%s) AND
(type IN (%s) OR section = "%s")',
$user_groups,
implode(',', $filter),
$extension_section
) )
); );
} }
@ -658,7 +692,9 @@ class DiscoveryTaskList extends HTML
$recon_script_name = false; $recon_script_name = false;
} }
if ($task['disabled'] == 0 && $server_name !== '') { if (($task['disabled'] == 0 && $server_name !== '' && (int) $task['type'] !== DISCOVERY_EXTENSION)
|| ((int) $task['type'] === DISCOVERY_EXTENSION && (int) $task['setup_complete'] === 1)
) {
if (check_acl($config['id_user'], 0, 'AW')) { if (check_acl($config['id_user'], 0, 'AW')) {
$data[0] = '<span class="link" onclick="force_task(\''; $data[0] = '<span class="link" onclick="force_task(\'';
$data[0] .= ui_get_full_url( $data[0] .= ui_get_full_url(
@ -682,7 +718,9 @@ class DiscoveryTaskList extends HTML
); );
$data[0] .= '</span>'; $data[0] .= '</span>';
} }
} else if ($task['disabled'] == 2) { } else if ($task['disabled'] == 2
|| ((int) $task['type'] === DISCOVERY_EXTENSION && (int) $task['setup_complete'] === 0)
) {
$data[0] = ui_print_help_tip( $data[0] = ui_print_help_tip(
__('This task has not been completely defined, please edit it'), __('This task has not been completely defined, please edit it'),
true true
@ -843,6 +881,19 @@ class DiscoveryTaskList extends HTML
$data[6] .= __('Discovery.App.Microsoft SQL Server'); $data[6] .= __('Discovery.App.Microsoft SQL Server');
break; break;
case DISCOVERY_EXTENSION:
// Discovery NetScan.
$data[6] = html_print_image(
'images/cluster@os.svg',
true,
[
'title' => $task['short_name'],
'class' => 'main_menu_icon invert_filter',
]
).'&nbsp;&nbsp;';
$data[6] .= $task['short_name'];
break;
case DISCOVERY_HOSTDEVICES: case DISCOVERY_HOSTDEVICES:
default: default:
if ($task['id_recon_script'] == 0) { if ($task['id_recon_script'] == 0) {
@ -941,7 +992,7 @@ class DiscoveryTaskList extends HTML
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS && $task['type'] != DISCOVERY_CLOUD_AWS_RDS
&& $task['type'] != DISCOVERY_CLOUD_AWS_S3 && $task['type'] != DISCOVERY_CLOUD_AWS_S3
) { ) {
if (check_acl($config['id_user'], 0, 'MR')) { if (check_acl($config['id_user'], 0, 'MR') && (int) $task['type'] !== 15) {
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">'; $data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image( $data[9] .= html_print_image(
'images/web@groups.svg', 'images/web@groups.svg',
@ -999,13 +1050,24 @@ class DiscoveryTaskList extends HTML
).'</a>'; ).'</a>';
} }
} else { } else {
$url_edit = sprintf(
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
$this->getTargetWiz($task, $recon_script_data),
$task['id_rt']
);
if ((int) $task['type'] === DISCOVERY_EXTENSION) {
$url_edit = sprintf(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=%s&mode=%s&id_task=%s',
$task['section'],
$task['short_name'],
$task['id_rt'],
);
}
// Check if is a H&D, Cloud or Application or IPAM. // Check if is a H&D, Cloud or Application or IPAM.
$data[9] .= '<a href="'.ui_get_full_url( $data[9] .= '<a href="'.ui_get_full_url(
sprintf( $url_edit
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
$this->getTargetWiz($task, $recon_script_data),
$task['id_rt']
)
).'">'.html_print_image( ).'">'.html_print_image(
'images/edit.svg', 'images/edit.svg',
true, true,
@ -1069,7 +1131,7 @@ class DiscoveryTaskList extends HTML
$return = true; $return = true;
} }
ui_toggle($content, __('Server Tasks'), '', '', false); ui_toggle($content, $titleTable, '', '', false);
// Div neccesary for modal map task. // Div neccesary for modal map task.
echo '<div id="map_task" class="invisible"></div>'; echo '<div id="map_task" class="invisible"></div>';
@ -1096,9 +1158,9 @@ class DiscoveryTaskList extends HTML
* *
* @return boolean Success or not. * @return boolean Success or not.
*/ */
public function showListConsoleTask() public function showListConsoleTask($report_task=false)
{ {
return enterprise_hook('tasklist_showListConsoleTask', [$this]); return enterprise_hook('tasklist_showListConsoleTask', [$this, $report_task]);
} }
@ -1137,6 +1199,9 @@ class DiscoveryTaskList extends HTML
case DISCOVERY_CLOUD_AWS_S3: case DISCOVERY_CLOUD_AWS_S3:
return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&sub=s3&page=0'; return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&sub=s3&page=0';
case DISCOVERY_CLOUD_GCP_COMPUTE_ENGINE:
return 'wiz=cloud&mode=gcp&ki='.$task['auth_strings'].'&sub=compute&page=0';
default: default:
return 'wiz=cloud'; return 'wiz=cloud';
} }
@ -1224,7 +1289,7 @@ class DiscoveryTaskList extends HTML
($task['status'] < 0) ? 100 : $task['status'], ($task['status'] < 0) ? 100 : $task['status'],
150, 150,
150, 150,
'#3A3A3A', '#14524f',
'%', '%',
'', '',
'#ececec', '#ececec',
@ -1294,7 +1359,7 @@ class DiscoveryTaskList extends HTML
$task['stats']['c_network_percent'], $task['stats']['c_network_percent'],
150, 150,
150, 150,
'#3A3A3A', '#14524f',
'%', '%',
'', '',
'#ececec', '#ececec',
@ -1337,14 +1402,14 @@ class DiscoveryTaskList extends HTML
$output = ''; $output = '';
if (is_array($task['stats']) === false) { if (is_array($task['stats']) === false && (int) $task['type'] !== DISCOVERY_EXTENSION) {
$task['stats'] = json_decode($task['summary'], true); $task['stats'] = json_decode(io_safe_output($task['summary']), true);
if (json_last_error() !== JSON_ERROR_NONE) { if (json_last_error() !== JSON_ERROR_NONE) {
return $task['summary']; return $task['summary'];
} }
} }
if (is_array($task['stats'])) { if (is_array($task['stats']) || (int) $task['type'] === DISCOVERY_EXTENSION) {
$i = 0; $i = 0;
$table = new StdClasS(); $table = new StdClasS();
$table->class = 'databox data'; $table->class = 'databox data';
@ -1402,6 +1467,65 @@ class DiscoveryTaskList extends HTML
$table->data[$i][1] = '<span id="alive">'; $table->data[$i][1] = '<span id="alive">';
$table->data[$i][1] .= ($total - $agents); $table->data[$i][1] .= ($total - $agents);
$table->data[$i++][1] .= '</span>'; $table->data[$i++][1] .= '</span>';
} else if ((int) $task['type'] === DISCOVERY_EXTENSION) {
// Content.
$countSummary = 1;
if (is_array($task['stats']) === true && count(array_filter(array_keys($task['stats']), 'is_numeric')) === count($task['stats'])) {
foreach ($task['stats'] as $key => $summary) {
$table->data[$i][0] = '<b>'.__('Summary').' '.$countSummary.'</b>';
$table->data[$i][1] = '';
$countSummary++;
$i++;
if (is_array($summary) === true) {
if (empty($summary['summary']) === true && empty($summary['info']) === true) {
$table->data[$i][0] = json_encode($summary, JSON_PRETTY_PRINT);
$table->data[$i][1] = '';
$i++;
continue;
}
$unknownJson = $summary;
foreach ($summary as $k2 => $v) {
if (is_array($v) === true) {
if ($k2 === 'summary') {
foreach ($v as $k3 => $v2) {
$table->data[$i][0] = $k3;
$table->data[$i][1] = $v2;
$i++;
}
unset($unknownJson[$k2]);
}
} else {
if ($k2 === 'info') {
$table->data[$i][0] = $v;
$table->data[$i][1] = '';
$i++;
unset($unknownJson[$k2]);
}
}
}
if (empty($unknownJson) === false) {
$table->data[$i][0] = json_encode($unknownJson, JSON_PRETTY_PRINT);
$table->data[$i][1] = '';
$i++;
}
} else {
$table->data[$i][0] = $summary;
$table->data[$i][1] = '';
$i++;
}
}
} else {
$table->data[$i][0] = '<b>'.__('Summary').'</b>';
$table->data[$i][1] = '';
$i++;
$table->data[$i][0] = $task['summary'];
$table->data[$i][1] = '';
$i++;
}
} else { } else {
// Content. // Content.
if (is_array($task['stats']['summary']) === true) { if (is_array($task['stats']['summary']) === true) {
@ -1463,7 +1587,7 @@ class DiscoveryTaskList extends HTML
} }
$task = db_get_row('trecon_task', 'id_rt', $id_task); $task = db_get_row('trecon_task', 'id_rt', $id_task);
$task['stats'] = json_decode($task['summary'], true); $task['stats'] = json_decode(io_safe_output($task['summary']), true);
$summary = $this->progressTaskSummary($task); $summary = $this->progressTaskSummary($task);
$output = ''; $output = '';
@ -1856,7 +1980,11 @@ class DiscoveryTaskList extends HTML
if ($task['status'] <= 0 if ($task['status'] <= 0
&& empty($task['summary']) === false && empty($task['summary']) === false
) { ) {
$status = __('Done'); if ($task['status'] == -2) {
$status = __('Failed');
} else {
$status = __('Done');
}
} else if ($task['utimestamp'] == 0 } else if ($task['utimestamp'] == 0
&& empty($task['summary']) && empty($task['summary'])
) { ) {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Netflow@svg</title>
<g id="Netflow" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M10,2.27373675e-13 C15.5228475,2.27373675e-13 20,4.4771525 20,10 C20,15.5228475 15.5228475,20 10,20 C4.4771525,20 2.27373675e-13,15.5228475 2.27373675e-13,10 C2.27373675e-13,4.4771525 4.4771525,2.27373675e-13 10,2.27373675e-13 Z M9.99843461,11.9965254 C9.67625255,11.9965254 9.41507239,12.2577056 9.41507239,12.5798876 L9.41552125,15.4995254 L8.25074832,15.5046308 L8.28675386,15.5766508 C8.29955582,15.6022579 8.31555828,15.6342668 8.33476123,15.6726774 L8.44277783,15.8887373 C8.47158226,15.9463533 8.50358718,16.0103711 8.53879259,16.0807906 L8.86284238,16.7289703 L9.11488111,17.2331101 C9.27703936,17.5574667 9.46195666,17.927347 9.66963302,18.3427511 L9.99821684,19 L11.7485213,15.4998295 L10.5825213,15.4995254 L10.5817968,12.5798876 C10.5817968,12.2577056 10.3206167,11.9965254 9.99843461,11.9965254 Z M15.4966959,8.25147875 L11.9965254,10.0017832 C12.5726852,10.2898274 13.0777141,10.5423107 13.5116122,10.7592329 L14.2675551,11.1371576 C14.3699835,11.1883655 14.4660101,11.2363729 14.555635,11.2811798 L14.9157348,11.4612074 C14.9861544,11.4964128 15.0501721,11.5284177 15.1077881,11.5572222 L15.323848,11.6652388 C15.3622586,11.6844417 15.3942675,11.7004442 15.4198746,11.7132461 L15.4918946,11.7492517 L15.497,10.5844787 L18.4166378,10.5849276 C18.7388198,10.5849276 19,10.3237475 19,10.0015654 C19,9.67938334 18.7388198,9.41820318 18.4166378,9.41820318 L15.497,9.41747875 L15.4966959,8.25147875 Z M4.50330409,8.24834796 L4.503,9.41434796 L1.58336222,9.41507239 C1.26118016,9.41507239 1,9.67625255 1,9.99843461 C1,10.3206167 1.26118016,10.5817968 1.58336222,10.5817968 L4.503,10.581348 L4.50811371,11.7461209 L4.69807376,11.6513162 C4.7221881,11.6392813 4.74854163,11.6261289 4.77713435,11.6118589 L4.97556093,11.5128288 C5.20085777,11.4003884 5.5067654,11.247717 5.89328383,11.0548147 L6.23957636,10.8819881 C6.42234187,10.7907741 6.61953623,10.692359 6.83115944,10.5867427 L7.50931565,10.2482907 C7.66963626,10.1682784 7.8363697,10.0850656 8.00951597,9.99865237 L4.50330409,8.24834796 Z M10.0013476,1 L9.75170927,1.50020032 L9.41325727,2.17835653 C9.30764104,2.38997974 9.20922591,2.5871741 9.1180119,2.76993961 L8.94518534,3.11623214 C8.65583179,3.69600978 8.45699793,4.09441314 8.34868376,4.31144221 L8.25387911,4.50140226 L9.41865204,4.50651597 L9.41820318,7.42615375 C9.41820318,7.74833581 9.67938334,8.00951597 10.0015654,8.00951597 C10.3237475,8.00951597 10.5849276,7.74833581 10.5849276,7.42615375 L10.585652,4.50651597 L11.751652,4.50621188 L10.0013476,1 Z" id="Oval-2" fill="#3F3F3F"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>EB094270-FB38-4A58-BE94-D40EA44EA568</title>
<g id="Agentes" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="1.a1-Agentes---Listado" transform="translate(-362.500000, -268.000000)" fill="#C1CCDC">
<g id="Contenido" transform="translate(310.000000, 188.000000)">
<g transform="translate(20.000000, 20.000000)" id="Agentes">
<g id="Content" transform="translate(29.308511, 20.000000)">
<g id="Top" transform="translate(0.191489, 0.000000)">
<g id="Icons/Light/24/example" transform="translate(3.000000, 40.000000)">
<circle id="Oval" cx="6" cy="6" r="6"></circle>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Reportes programados@svg</title>
<g id="Reportes-programados" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M8.00059781,0 C8.54059781,0 9.00059781,0.363636364 9.00059781,0.909090909 L9.00059781,4.07934284 C9.00059781,5.35207011 9.69059781,6 10.9505978,6 L14.1005978,6 C14.6405978,6 15.0005978,6.45454545 15.0005978,7 L15.0005978,16.3636364 C15.0005978,18.3636364 13.3805978,20 11.4005978,20 L5.24310254,20.0009635 C7.48899044,18.7052484 9.00059781,16.2791516 9.00059781,13.5 C9.00059781,9.35786438 5.64273343,6 1.50059781,6 C0.986687841,6 0.484850221,6.05168787 -2.12052598e-14,6.15014855 L0.000597808993,3.63636364 C0.000597808993,1.63636364 1.62059781,0 3.60059781,0 Z M10.0001439,1 L14.0005978,5 L11.0001439,5 C10.4478591,5 10.0001439,4.55228475 10.0001439,4 L10.0001439,1 Z" id="Shape" fill="#3F3F3F" transform="translate(7.500299, 10.000482) scale(-1, 1) translate(-7.500299, -10.000482) "></path>
<path d="M13.5,7 C17.0898509,7 20,9.91014913 20,13.5 C20,17.0898509 17.0898509,20 13.5,20 C9.91014913,20 7,17.0898509 7,13.5 C7,9.91014913 9.91014913,7 13.5,7 Z M14.0002191,9 C13.4873832,9 13.0647119,9.38604019 13.0069468,9.88337887 L13.0002191,10 L13.0002191,13.382 L11.4068856,14.2067645 C10.9481913,14.4361116 10.742785,14.9704208 10.9135349,15.4410874 L10.959672,15.5484052 C11.1890192,16.0070996 11.7233284,16.2125059 12.193995,16.0417559 L12.3013128,15.9956188 L14.4474327,14.8944272 C14.748574,14.7438565 14.9511225,14.4535358 14.9924154,14.1248553 L15.0002191,14 L15.0002191,10 C15.0002191,9.44771525 14.5525038,9 14.0002191,9 Z" id="Oval-2" fill="#3F3F3F"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="462px" height="462px" viewBox="0 0 462 462" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 61.2 (89653) - https://sketch.com -->
<title>Configurar app@svg</title>
<desc>Created with Sketch.</desc>
<defs>
<path d="M170.651341,0 L170.651,0.004 L172.111579,0.00817671226 C263.146802,0.548182735 340,27.8694245 340,92.0575424 L340,247.942458 C340,312.77894 261.586371,340 169.348659,340 L170.651,339.996 L170.651341,340 L170,339.998 L169.348659,340 L169.348659,340 L169.348,339.996 L167.888421,339.991823 C128.247423,339.756679 91.2955334,334.44344 62.2073113,323.219366 L161.855602,223.57095 C187.013424,231.95857 215.800358,226.422038 235.828233,206.394148 C254.435585,187.786783 260.775236,161.559784 254.857225,137.762234 C253.732853,133.229606 248.060798,131.693633 244.757955,134.996478 L207.432822,172.321638 L173.360336,166.644559 L167.683262,132.572049 L205.008395,95.2468889 C208.331316,91.9239659 206.73009,86.2619459 202.167348,85.1275341 C178.384873,79.2346161 152.19805,85.5843105 133.610776,104.166578 C113.713408,124.06396 108.237114,152.90613 116.519318,178.053931 L10.1129522,284.45776 C3.58111026,273.936239 0,261.798287 0,247.942458 L0,92.0575424 C0,27.2210597 78.4136287,0 170.651341,0 L169.348,0.004 L169.348659,0 L170,0.002 L170.651341,0 L170.651341,0 Z" id="path-1"></path>
</defs>
<g id="Configurar-app" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Rectangle" transform="translate(61.000000, 61.000000)">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="Mask" stroke="#555555" stroke-width="14" stroke-linejoin="round" xlink:href="#path-1"></use>
</g>
<g id="Group" transform="translate(107.000000, 136.000000)" stroke="#555555" stroke-width="7">
<circle id="Oval" cx="14.5" cy="14.5" r="14.5"></circle>
<circle id="Oval-Copy" cx="14.5" cy="61.5" r="14.5"></circle>
<circle id="Oval-Copy-2" cx="142.5" cy="208.5" r="14.5"></circle>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="462px" height="462px" viewBox="0 0 462 462" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 61.2 (89653) - https://sketch.com -->
<title>Custom apps@svg</title>
<desc>Created with Sketch.</desc>
<g id="Custom-apps" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group" transform="translate(61.000000, 61.000000)" stroke="#555555">
<path d="M0,315.724835 L0,274.275165 C0,257.178072 20.6773253,250 45,250 L45,250 C69.3226747,250 90,257.178072 90,274.275165 L90,315.724835 C90,332.821928 69.3226747,340 45,340 L45,340 C20.6773253,340 0,332.821928 0,315.724835 Z" id="Mask" stroke-width="14" stroke-linejoin="round"></path>
<path d="M0,190.724835 L0,149.275165 C0,132.178072 20.6773253,125 45,125 L45,125 C69.3226747,125 90,132.178072 90,149.275165 L90,190.724835 C90,207.821928 69.3226747,215 45,215 L45,215 C20.6773253,215 0,207.821928 0,190.724835 Z" id="Mask-Copy" stroke-width="14" stroke-linejoin="round"></path>
<path d="M0,65.7248353 L0,24.2751647 C0,7.17807242 20.6773253,0 45,0 L45,0 C69.3226747,0 90,7.17807242 90,24.2751647 L90,65.7248353 C90,82.8219276 69.3226747,90 45,90 L45,90 C20.6773253,90 0,82.8219276 0,65.7248353 Z" id="Mask-Copy-2" stroke-width="14" stroke-linejoin="round"></path>
<path d="M125,315.724835 L125,274.275165 C125,257.178072 145.677325,250 170,250 L170,250 C194.322675,250 215,257.178072 215,274.275165 L215,315.724835 C215,332.821928 194.322675,340 170,340 L170,340 C145.677325,340 125,332.821928 125,315.724835 Z" id="Mask" stroke-width="14" stroke-linejoin="round"></path>
<path d="M125,190.724835 L125,149.275165 C125,132.178072 145.677325,125 170,125 L170,125 C194.322675,125 215,132.178072 215,149.275165 L215,190.724835 C215,207.821928 194.322675,215 170,215 L170,215 C145.677325,215 125,207.821928 125,190.724835 Z" id="Mask-Copy" stroke-width="14" stroke-linejoin="round"></path>
<path d="M125,65.7248353 L125,24.2751647 C125,7.17807242 145.677325,0 170,0 L170,0 C194.322675,0 215,7.17807242 215,24.2751647 L215,65.7248353 C215,82.8219276 194.322675,90 170,90 L170,90 C145.677325,90 125,82.8219276 125,65.7248353 Z" id="Mask-Copy-2" stroke-width="14" stroke-linejoin="round"></path>
<path d="M250,190.724835 L250,149.275165 C250,132.178072 270.677325,125 295,125 L295,125 C319.322675,125 340,132.178072 340,149.275165 L340,190.724835 C340,207.821928 319.322675,215 295,215 L295,215 C270.677325,215 250,207.821928 250,190.724835 Z" id="Mask-Copy" stroke-width="14" stroke-linejoin="round"></path>
<path d="M250,65.7248353 L250,24.2751647 C250,7.17807242 270.677325,0 295,0 L295,0 C319.322675,0 340,7.17807242 340,24.2751647 L340,65.7248353 C340,82.8219276 319.322675,90 295,90 L295,90 C270.677325,90 250,82.8219276 250,65.7248353 Z" id="Mask-Copy-2" stroke-width="14" stroke-linejoin="round"></path>
<circle id="Oval" stroke-width="7" cx="45" cy="45" r="15"></circle>
<polygon id="Polygon" stroke-width="7" points="295 155 309.265848 165.364745 303.816779 182.135255 286.183221 182.135255 280.734152 165.364745"></polygon>
<rect id="Rectangle" stroke-width="7" x="155" y="280" width="30" height="30"></rect>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="462px" height="462px" viewBox="0 0 462 462" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 61.2 (89653) - https://sketch.com -->
<title>App genérico@svg</title>
<desc>Created with Sketch.</desc>
<defs>
<path d="M340,247.942458 C340,312.77894 261.586371,340 169.348659,340 L170.651,339.996 L170.651341,340 L170,339.998 L169.348659,340 L169.348659,340 L169.348,339.996 L167.888421,339.991823 C76.8531975,339.451817 0,312.130576 0,247.942458 L0,92.0575424 C0,27.2210597 78.4136287,0 170.651341,0 L169.348,0.004 L169.348659,0 L170,0.002 L170.651341,0 L170.651341,0 L170.651,0.004 L172.111579,0.00817671226 C263.146802,0.548182735 340,27.8694245 340,92.0575424 Z" id="path-1"></path>
</defs>
<g id="App-genérico" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Rectangle" transform="translate(61.000000, 61.000000)">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="Mask" stroke="#555555" stroke-width="14" stroke-linejoin="round" xlink:href="#path-1"></use>
<path d="M243.089632,66.6385397 C255.811455,68.1348967 268.474117,71.8213332 276.910371,78.4128805 C279.780827,80.6195335 283.214489,83.0345401 285.04609,85.6744737 C286.108609,87.2039779 287.599447,90.7246786 286.747539,92.8105813 C285.689754,95.3439706 281.820673,95.5831036 278.614186,95.5168093 C267.669538,95.2682057 257.661988,94.0985848 247.077034,95.3534412 C232.071625,97.1623285 219.643237,101.345972 208.921031,105.81847 C186.274482,115.196745 166.808389,130.69067 151.450385,146.338491 C135.966961,162.071549 121.652544,181.903015 110.248812,202.274305 C97.5530192,224.954058 87.9619574,248.876829 80.0344822,274 C62.0000677,250.340039 50.8566406,221.118459 50,189.124358 L50,189.079372 L50,189.079372 C67.1635754,162.156784 86.968065,137.803101 110.459422,117.133486 C126.655136,102.842329 145.730771,90.113824 166.841519,80.8823431 C170.384035,79.3102211 173.820063,77.3284952 177.646549,76.1044183 C181.43044,74.8637679 185.379979,73.6325881 189.417075,72.3019668 C204.850804,67.2470266 226.07514,64.7278433 243.089632,66.6385397 Z M249.443746,111.548575 C251.871655,112.938928 254.490313,115.160583 256.507696,116.816952 C263.206733,122.210025 268.91885,129.801891 273.814061,136.838864 C280.819956,146.997376 286.722822,158.745753 288.862533,171.957223 C294.066675,204.579596 280.685187,228.427576 263.552985,242.99199 C254.774364,250.4841 243.209143,256.901753 230.756521,260.222805 C216.819372,263.942882 201.165478,264.946679 186.253848,262.930771 C158.17014,259.167051 132.95804,241.350168 116,224.649308 C117.944815,220.058442 118.525357,218.38129 120.519932,213.865241 C123.851827,217.348397 129.769207,221.999533 132.402378,223.828397 C150.61895,236.584729 174.427383,247.587012 205.998488,245.822573 C221.986194,244.978802 236.82733,239.450643 247.36209,231.008769 C257.579625,222.849539 266.134322,211.117788 265.976747,194.763997 C265.812951,177.460443 257.372288,163.326228 248.149968,153.85354 C244.990162,150.594836 241.573259,147.109602 238.121109,144.540878 C232.659869,140.477889 226.584914,137.325176 220.476785,134.344958 C214.262915,131.264983 207.879029,128.18293 200.468828,126.561891 C212.714113,118.797529 245.558263,109.318607 249.443746,111.548575 Z" id="Path-3" stroke="#555555" stroke-width="7" stroke-linecap="round" stroke-linejoin="round" mask="url(#mask-2)"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -84,7 +84,7 @@ if ($save_log_filter) {
if ($recover_aduit_log_select) { if ($recover_aduit_log_select) {
echo json_encode(audit_get_audit_filter_select()); echo json_encode(audit_get_audit_filter_select_fix_order());
} }
if ($update_log_filter) { if ($update_log_filter) {
@ -190,7 +190,7 @@ function show_filter() {
draggable: true, draggable: true,
modal: false, modal: false,
closeOnEscape: true, closeOnEscape: true,
width: 380 width: "auto"
}); });
} }
@ -207,12 +207,13 @@ function load_filter_values() {
}, },
success: function(data) { success: function(data) {
var options = ""; var options = "";
console.log(data);
$.each(data,function(i,value){ $.each(data,function(i,value){
if (i == 'text'){ if (i == 'text'){
$("#text-filter_text").val(value); $("#text-filter_text").val(value);
} }
if (i == 'period'){ if (i == 'period'){
$("#text-filter_period").val(value); $("#filter_period").val(value).change();
} }
if (i == 'ip'){ if (i == 'ip'){
$("#text-filter_ip").val(value); $("#text-filter_ip").val(value);
@ -265,19 +266,31 @@ if ($save_filter_modal) {
$data = []; $data = [];
$table->rowid[0] = 'update_save_selector'; $table->rowid[0] = 'update_save_selector';
$data[0] = html_print_radio_button( $data[0] = html_print_div(
'filter_mode', [
'new', 'style' => 'display: flex;',
__('New filter'), 'content' => html_print_radio_button(
true, 'filter_mode',
'new',
__('New filter'),
true,
true
),
],
true true
); );
$data[1] = html_print_radio_button( $data[1] = html_print_div(
'filter_mode', [
'update', 'style' => 'display: flex;',
__('Update filter'), 'content' => html_print_radio_button(
false, 'filter_mode',
'update',
__('Update filter'),
false,
true
),
],
true true
); );
@ -395,7 +408,7 @@ function save_new_filter() {
"save_log_filter" : 1, "save_log_filter" : 1,
"id_name" : $("#text-id_name").val(), "id_name" : $("#text-id_name").val(),
"text" : $("#text-filter_text").val(), "text" : $("#text-filter_text").val(),
"period" : $("#text-filter_period").val(), "period" : $("#filter_period :selected").val(),
"ip" : $('#text-filter_ip').val(), "ip" : $('#text-filter_ip').val(),
"type" : $('#filter_type :selected').val(), "type" : $('#filter_type :selected').val(),
"user" : $('#filter_user :selected').val(), "user" : $('#filter_user :selected').val(),
@ -431,7 +444,7 @@ function save_update_filter() {
"update_log_filter" : 1, "update_log_filter" : 1,
"id" : $("#overwrite_filter :selected").val(), "id" : $("#overwrite_filter :selected").val(),
"text" : $("#text-filter_text").val(), "text" : $("#text-filter_text").val(),
"period" : $("#text-filter_period").val(), "period" : $("#filter_period :selected").val(),
"ip" : $('#text-filter_ip').val(), "ip" : $('#text-filter_ip').val(),
"type" : $('#filter_type :selected').val(), "type" : $('#filter_type :selected').val(),
"user" : $('#filter_user :selected').val(), "user" : $('#filter_user :selected').val(),

View File

@ -90,86 +90,38 @@ $get_comments = (bool) get_parameter('get_comments', false);
$get_events_fired = (bool) get_parameter('get_events_fired'); $get_events_fired = (bool) get_parameter('get_events_fired');
$get_id_source_event = get_parameter('get_id_source_event'); $get_id_source_event = get_parameter('get_id_source_event');
$node_id = (int) get_parameter('node_id', 0); $node_id = (int) get_parameter('node_id', 0);
$settings_modal = get_parameter('settings', 0);
$parameters_modal = get_parameter('parameters', 0);
if ($get_comments === true) { if ($get_comments === true) {
$event = get_parameter('event', false); global $config;
$event_rep = (int) get_parameter_post('event')['event_rep']; $event = json_decode(io_safe_output(base64_decode(get_parameter('event', ''))), true);
$group_rep = (int) get_parameter_post('event')['group_rep']; $filter = json_decode(io_safe_output(base64_decode(get_parameter('filter', ''))), true);
$default_hour = (int) $filter['event_view_hr'];
if (isset($config['max_hours_old_event_comment']) === true
&& empty($config['max_hours_old_event_comment']) === false
) {
$default_hour = (int) $config['max_hours_old_event_comment'];
}
$custom_event_view_hr = (int) get_parameter('custom_event_view_hr', 0);
if (empty($custom_event_view_hr) === false) {
if ($custom_event_view_hr === -2) {
$filter['event_view_hr_cs'] = ($default_hour * 3600);
} else {
$filter['event_view_hr_cs'] = $custom_event_view_hr;
}
} else {
$filter['event_view_hr_cs'] = ($default_hour * 3600);
}
if ($event === false) { if ($event === false) {
return __('Failed to retrieve comments'); return __('Failed to retrieve comments');
} }
$eventsGrouped = []; $eventsGrouped = event_get_comment($event, $filter);
// Consider if the event is grouped. echo events_page_comments($event, $eventsGrouped, $filter);
$whereGrouped = '1=1';
if ($group_rep === EVENT_GROUP_REP_EVENTS && $event_rep > 1) {
// Default grouped message filtering (evento and estado).
$whereGrouped = sprintf(
'`evento` = "%s"',
$event['evento']
);
// If id_agente is reported, filter the messages by them as well.
if ((int) $event['id_agente'] > 0) {
$whereGrouped .= sprintf(
' AND `id_agente` = %d',
(int) $event['id_agente']
);
}
if ((int) $event['id_agentmodule'] > 0) {
$whereGrouped .= sprintf(
' AND `id_agentmodule` = %d',
(int) $event['id_agentmodule']
);
}
} else if ($group_rep === EVENT_GROUP_REP_EXTRAIDS) {
$whereGrouped = sprintf(
'`id_extra` = "%s"',
io_safe_output($event['id_extra'])
);
} else {
$whereGrouped = sprintf('`id_evento` = %d', $event['id_evento']);
}
try {
if (is_metaconsole() === true
&& $event['server_id'] > 0
) {
$node = new Node($event['server_id']);
$node->connect();
}
$sql = sprintf(
'SELECT `user_comment`
FROM tevento
WHERE %s',
$whereGrouped
);
// Get grouped comments.
$eventsGrouped = db_get_all_rows_sql($sql);
} catch (\Exception $e) {
// Unexistent agent.
if (is_metaconsole() === true
&& $event['server_id'] > 0
) {
$node->disconnect();
}
$eventsGrouped = [];
} finally {
if (is_metaconsole() === true
&& $event['server_id'] > 0
) {
$node->disconnect();
}
}
// End of get_comments.
echo events_page_comments($event, true, $eventsGrouped);
return; return;
} }
@ -562,8 +514,13 @@ if ($load_filter_modal) {
false false
); );
$action = 'index.php?sec=eventos&sec2=operation/events/events&pure=';
if ($settings_modal !== 0 && $parameters_modal !== 0) {
$action .= '&settings='.$settings_modal.'&parameters='.$parameters_modal;
}
echo '<div id="load-filter-select" class="load-filter-modal">'; echo '<div id="load-filter-select" class="load-filter-modal">';
echo '<form method="post" id="form_load_filter" action="index.php?sec=eventos&sec2=operation/events/events&pure=">'; echo '<form method="post" id="form_load_filter" action="'.$action.'">';
$table = new StdClass; $table = new StdClass;
$table->id = 'load_filter_form'; $table->id = 'load_filter_form';
@ -1003,7 +960,7 @@ function save_new_filter() {
} }
else { else {
id_filter_save = data; id_filter_save = data;
$("#info_box").filter(function(i, item) { $("#info_box").filter(function(i, item) {
if ($(item).data('type_info_box') == "success_create_filter") { if ($(item).data('type_info_box') == "success_create_filter") {
return true; return true;
@ -2003,23 +1960,7 @@ if ($get_extended_event) {
$js .= '});'; $js .= '});';
$js .= ' $js .= '$("#link_comments").click(get_table_events_tabs(\''.base64_encode(json_encode($event)).'\',\''.base64_encode(json_encode($filter)).'\'));';
$("#link_comments").click(function (){
$.post ({
url : "ajax.php",
data : {
page: "include/ajax/events",
get_comments: 1,
event: '.json_encode($event).',
event_rep: '.$event_rep.'
},
dataType : "html",
success: function (data) {
$("#extended_event_comments_page").empty();
$("#extended_event_comments_page").html(data);
}
});
});';
if (events_has_extended_info($event['id_evento']) === true) { if (events_has_extended_info($event['id_evento']) === true) {
$js .= ' $js .= '
@ -2525,7 +2466,7 @@ if ($drawConsoleSound === true) {
'label' => __('Start'), 'label' => __('Start'),
'type' => 'button', 'type' => 'button',
'name' => 'start-search', 'name' => 'start-search',
'attributes' => [ 'class' => 'play' ], 'attributes' => [ 'class' => 'play secondary' ],
'return' => true, 'return' => true,
], ],
'div', 'div',
@ -2651,23 +2592,24 @@ if ($get_events_fired) {
$return[] = array_merge( $return[] = array_merge(
$event, $event,
[ [
'fired' => $event['id_evento'], 'fired' => $event['id_evento'],
'message' => ui_print_string_substr( 'message' => ui_print_string_substr(
strip_tags(io_safe_output($event['evento'])), strip_tags(io_safe_output($event['evento'])),
75, 75,
true, true,
'9' '9'
), ),
'priority' => ui_print_event_priority($event['criticity'], true, true), 'priority' => ui_print_event_priority($event['criticity'], true, true),
'type' => events_print_type_img( 'type' => events_print_type_img(
$event['event_type'], $event['event_type'],
true true
), ),
'timestamp' => ui_print_timestamp( 'timestamp' => ui_print_timestamp(
$event['timestamp'], $event['timestamp'],
true, true,
['style' => 'font-size: 9pt; letter-spacing: 0.3pt;'] ['style' => 'font-size: 9pt; letter-spacing: 0.3pt;']
), ),
'event_timestamp' => $event['timestamp'],
] ]
); );
} }

View File

@ -17,6 +17,8 @@ $save_custom_graph = (bool) get_parameter('save_custom_graph');
$print_custom_graph = (bool) get_parameter('print_custom_graph', false); $print_custom_graph = (bool) get_parameter('print_custom_graph', false);
$print_sparse_graph = (bool) get_parameter('print_sparse_graph'); $print_sparse_graph = (bool) get_parameter('print_sparse_graph');
$get_graphs = (bool) get_parameter('get_graphs_container'); $get_graphs = (bool) get_parameter('get_graphs_container');
$width = get_parameter('width', 0);
$height = get_parameter('height', 0);
if ($save_custom_graph) { if ($save_custom_graph) {
$return = []; $return = [];
@ -25,8 +27,6 @@ if ($save_custom_graph) {
$name = get_parameter('name', ''); $name = get_parameter('name', '');
$description = get_parameter('description', ''); $description = get_parameter('description', '');
$stacked = get_parameter('stacked', CUSTOM_GRAPH_LINE); $stacked = get_parameter('stacked', CUSTOM_GRAPH_LINE);
$width = get_parameter('width', 0);
$height = get_parameter('height', 0);
$events = get_parameter('events', 0); $events = get_parameter('events', 0);
$period = get_parameter('period', 0); $period = get_parameter('period', 0);
$fullscale = get_parameter('fullscale', 0); $fullscale = get_parameter('fullscale', 0);
@ -126,6 +126,8 @@ if ($print_sparse_graph) {
'force_interval' => '', 'force_interval' => '',
'time_interval' => 300, 'time_interval' => 300,
'array_data_create' => 0, 'array_data_create' => 0,
'height' => $height,
'width' => $width,
]; ];
echo grafico_modulo_sparse($params); echo grafico_modulo_sparse($params);

View File

@ -0,0 +1,60 @@
<?php
/**
* Manager extensions ajax
*
* @category Ajax library.
* @package Pandora FMS
* @subpackage Modules.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* 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.
* ============================================================================
*/
// Begin.
global $config;
require_once $config['homedir'].'/godmode/wizards/ManageExtensions.class.php';
if (is_ajax() === false) {
exit;
}
// Control call flow.
try {
// User access and validation is being processed on class constructor.
$actions = new ManageExtensions();
} catch (Exception $e) {
exit;
}
// Ajax controller.
$method = get_parameter('method', '');
if (method_exists($actions, $method) === true) {
if ($actions->ajaxMethod($method) === true) {
$actions->{$method}();
} else {
$actions->errorAjax('Unavailable method.');
}
} else {
$actions->errorAjax('Method not found. ['.$method.']');
}
// Stop any execution.
exit;

View File

@ -97,6 +97,21 @@ if (check_login()) {
return; return;
} }
$id_plugin = get_parameter('id_plugin', 0);
if ($id_plugin !== 0) {
$id_module_plugin = db_get_value(
'id_plugin',
'tagente_modulo',
'id_agente_modulo',
$get_module_macros
);
if ($id_plugin !== $id_module_plugin) {
$get_plugin_macros = true;
$get_module_macros = 0;
}
}
if ($get_plugin_macros) { if ($get_plugin_macros) {
if (https_is_running()) { if (https_is_running()) {
header('Content-type: application/json'); header('Content-type: application/json');
@ -606,7 +621,7 @@ if (check_login()) {
} }
if (empty($table->data)) { if (empty($table->data)) {
ui_print_error_message(__('No available data to show')); ui_print_empty_data(__('No available data to show'), '', false);
} else { } else {
ui_pagination( ui_pagination(
count($count), count($count),

View File

@ -182,6 +182,7 @@ try {
if ($method == 'snmp_browser_create_modules') { if ($method == 'snmp_browser_create_modules') {
// Get target ids from form. // Get target ids from form.
$use_agent_ip = get_parameter('use_agent_ip', '');
$id_items = get_parameter('id_item2', null); $id_items = get_parameter('id_item2', null);
$id_target = null; $id_target = null;
if (empty($id_items) === false) { if (empty($id_items) === false) {
@ -209,7 +210,8 @@ try {
$module_target, $module_target,
$snmp_conf_values, $snmp_conf_values,
$id_target, $id_target,
$server_to_exec $server_to_exec,
$use_agent_ip
); );
// Return fail modules for error/success message. // Return fail modules for error/success message.

View File

@ -0,0 +1,190 @@
<?php
/**
* Extension to schedule tasks on Pandora FMS Console
*
* @category Wizard
* @package Pandora FMS
* @subpackage Host&Devices
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 PandoraFMS S.L.
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
require_once '../functions.php';
require_once '../functions_welcome_wizard.php';
global $config;
$check_web = get_parameter('check_web', 0);
$check_connectivity = get_parameter('check_connectivity', 0);
$create_net_scan = get_parameter('create_net_scan', 0);
$create_mail_alert = get_parameter('create_mail_alert', 0);
$create_unknown_template_alert = get_parameter('create_unknown_template_alert', 0);
// Begin.
global $config;
if ($check_web) {
include_once '../functions_api.php';
include_once '../functions_servers.php';
$status_webserver = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_WEB], 'status')['status'];
if ($status_webserver === '1') {
$name = array_keys(servers_get_names())[0];
$id_group = get_parameter('id_group', 4);
$array_other['data'] = [
'Web monitoring',
'',
2,
$id_group,
0,
30,
30,
9,
$name,
0,
0,
0,
__('Agent Web monitoring created on welcome'),
];
$id_agent = api_set_new_agent(0, '', $array_other, '', true);
if ($id_agent > 0) {
$module_name = get_parameter('module_name', 'Web_monitoring_module');
$text_to_search = get_parameter('text_to_search', '');
$url_goliat = get_parameter('url_goliat', 'https://pandorafms.com/en/');
$module_latency = create_module_latency_goliat($id_agent, $module_name, $id_group, $url_goliat, $text_to_search);
$module_status = create_module_status_goliat($id_agent, $module_name, $id_group, $url_goliat, $text_to_search);
if ($module_latency > 0 && $module_status > 0) {
ui_print_success_message(__('Your check has been created, <a href='.ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agent).'>click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
}
} else {
ui_print_error_message(__('The Name is not valid for the modules.'));
}
} else {
ui_print_error_message(__('Web server is not enabled.'));
}
}
if ($check_connectivity) {
include_once '../functions_api.php';
include_once '../functions_servers.php';
$status_newtwork = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_NETWORK], 'status')['status'];
$status_pluggin = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_PLUGIN], 'status')['status'];
if ($status_newtwork === '1' && $status_pluggin === '1') {
$name = array_keys(servers_get_names())[0];
$id_group = get_parameter('id_group', 4);
$agent_name = get_parameter('agent_name', __('Agent check connectivity'));
$array_other['data'] = [
$agent_name,
'',
2,
$id_group,
0,
30,
30,
9,
$name,
0,
0,
0,
__('Basic connectivity'),
];
$id_agent = api_set_new_agent(0, '', $array_other, '', true);
if ($id_agent > 0) {
$ip_target = get_parameter('ip_target', '127.0.0.1');
$basic_network = create_module_basic_network($id_agent, $id_group, $ip_target);
$latency_network = create_module_latency_network($id_agent, $id_group, $ip_target);
$packet_lost = create_module_packet_lost($id_agent, $id_group, $ip_target);
if ($basic_network > 0 && $latency_network > 0 && $packet_lost > 0) {
ui_print_success_message(__('Your check has been created, <a href='.ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agent).'>click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
}
} else {
ui_print_error_message(__('The Name is not valid for the modules.'));
}
} else {
ui_print_error_message(__('Web server is not enabled.'));
}
}
if ($create_net_scan) {
$ip_target = get_parameter('ip_target', '192.168.10.0/24');
$id_net_scan = create_net_scan($ip_target);
if ($id_net_scan > 0) {
$id_recon_server = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_DISCOVERY], 'id_server')['id_server'];
ui_print_success_message(__('Basic net created and scan in progress. <a href='.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_recon_server.'&force='.$id_net_scan).'>Click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
} else {
ui_print_error_message(__('Basic net already exists. <a href='.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist').'>Click here to view the data</a>'));
}
}
if ($create_mail_alert) {
include_once '../functions_alerts.php';
$id_action = db_get_row_filter('talert_actions', ['name' => 'Email to '.$config['id_user']], 'id')['id'];
if (!$id_action) {
$al_action = alerts_get_alert_action($id);
$id_action = alerts_clone_alert_action(1, $al_action['id_group'], 'Email to '.$config['id_user']);
}
$id_alert_template = get_parameter('id_condition', 0);
$id_agent_module = get_parameter('id_agent_module', 0);
$exist = db_get_value_sql(
sprintf(
'SELECT COUNT(id)
FROM talert_template_modules
WHERE id_agent_module = %d
AND id_alert_template = %d
AND id_policy_alerts = 0
',
$id_agent_module,
$id_alert_template
)
);
if ($exist > 0) {
ui_print_error_message(__('Alert already exists. <a href='.ui_get_full_url('index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&pure=0').'>Click here to view the data</a>'));
} else {
$id = alerts_create_alert_agent_module($id_agent_module, $id_alert_template);
if ($id !== false) {
$values = [];
$values['fires_min'] = (int) get_parameter('fires_min');
$values['fires_max'] = (int) get_parameter('fires_max');
$values['module_action_threshold'] = (int) 300;
$alert_created = alerts_add_alert_agent_module_action($id, $id_action, $values);
}
}
if ($alert_created === true) {
ui_print_success_message(__('Congratulations, you have already created a simple alert. <a href='.ui_get_full_url('index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&pure=0').'>You can see it.</a> Pandora FMS alerts are very flexible, you can do many more things with them, we recommend you to read the <a href="https://pandorafms.com/manual/start?id=en/documentation/04_using/01_alerts">documentation</a> for more information. You can create advanced alerts from <a href='.ui_get_full_url('index.php?sec=galertas&sec2=godmode/alerts/alert_actions').'>here</a>.'));
}
}
if ($create_unknown_template_alert) {
if (is_array(alerts_get_alert_templates(['name' => io_safe_input('Unknown condition')]))) {
echo 1;
} else {
echo create_template_alert_unknown();
}
}

View File

@ -35,6 +35,13 @@ if (is_ajax() === false) {
} }
$ajaxPage = 'include/ajax/welcome_window'; $ajaxPage = 'include/ajax/welcome_window';
// Ajax controller.
$method = get_parameter('method', '');
if ($method === 'loadWelcomeWindow') {
unset($config['welcome_state']);
}
// Control call flow. // Control call flow.
try { try {
@ -44,9 +51,6 @@ try {
exit; exit;
} }
// Ajax controller.
$method = get_parameter('method', '');
if (method_exists($welcome_actions, $method) === true) { if (method_exists($welcome_actions, $method) === true) {
if ($welcome_actions->ajaxMethod($method) === true) { if ($welcome_actions->ajaxMethod($method) === true) {
$welcome_actions->{$method}(); $welcome_actions->{$method}();

View File

@ -129,6 +129,14 @@ if (empty($apiPassword) === true
// Compat. // Compat.
$config['id_user'] = 'admin'; $config['id_user'] = 'admin';
$correctLogin = true; $correctLogin = true;
// Bypass credentials if server-auth and api-pass are correct.
} else if (($config['server_unique_identifier'] === get_parameter('server_auth'))
&& ($api_password === $apiPassword)
&& ((bool) isInACL($ipOrigin) === true)
) {
$config['id_usuario'] = 'admin';
$config['id_user'] = 'admin';
$correctLogin = true;
} else if ((bool) isInACL($ipOrigin) === true) { } else if ((bool) isInACL($ipOrigin) === true) {
// External access. // External access.
// Token is valid. Bypass the credentials. // Token is valid. Bypass the credentials.
@ -320,7 +328,6 @@ if ($correctLogin === true) {
break; break;
default: default:
return false;
// Ignore. // Ignore.
break; break;
} }

View File

@ -237,8 +237,13 @@ function process_user_login_remote($login, $pass, $api=false)
// Active Directory. // Active Directory.
case 'ad': case 'ad':
if (enterprise_hook('ad_process_user_login', [$login, $pass]) === false) { $sr = enterprise_hook('ad_process_user_login', [$login, $pass]);
$config['auth_error'] = 'User not found in database or incorrect password'; // Try with secondary server.
if ($sr === false && (bool) $config['secondary_active_directory'] === true) {
$sr = enterprise_hook('ad_process_user_login', [$login, $pass, true]);
}
if ($sr === false) {
return false; return false;
} }
break; break;

View File

@ -165,6 +165,9 @@ $hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.symbol.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script> <script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.symbol.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.exportdata.pandora.js'); ?>?v=<?php echo $config['current_package']; ?>"></script> <script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.exportdata.pandora.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.axislabels.js'); ?>?v=<?php echo $config['current_package']; ?>"></script> <script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.axislabels.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script type="text/javascript">
var phpTimezone = "<?php echo date_default_timezone_get(); ?>";
</script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/pandora.flot.js'); ?>?v=<?php echo $config['current_package']; ?>"></script> <script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/pandora.flot.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chart.js'); ?>?v=<?php echo $config['current_package']; ?>"></script> <script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chart.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chartjs-plugin-datalabels.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script> <script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chartjs-plugin-datalabels.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>

View File

@ -0,0 +1,485 @@
<?php
/**
* Pending lerts list class
*
* @category Class
* @package Pandora FMS
* @subpackage Alerts list
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
global $config;
/**
* Provides functionality for pending alerts list.
*/
class AlertsList
{
/**
* Url of controller.
*
* @var string
*/
public $ajaxController;
/**
* References datatables object identifier.
*
* @var string
*/
public $tableId;
/**
* Allowed methods to be called using AJAX request.
*
* @var array
*/
public $AJAXMethods = ['loadModal', 'drawTable'];
/**
* Checks if target method is available to be called using AJAX.
*
* @param string $method Target method.
*
* @return boolean True allowed, false not.
*/
public function ajaxMethod($method)
{
return in_array($method, $this->AJAXMethods);
}
/**
* Generates a JSON error.
*
* @param string $msg Error message.
*
* @return void
*/
public function error($msg)
{
echo json_encode(
['error' => $msg]
);
}
/**
* Minor function to dump json message as ajax response.
*
* @param string $type Type: result || error.
* @param string $msg Message.
* @param boolean $delete Deletion messages.
*
* @return void
*/
private function ajaxMsg($type, $msg, $delete=false)
{
if ($type === 'error') {
$msg_title = ($delete === true) ? 'Failed while removing' : 'Failed while saving';
} else {
$msg_title = ($delete === true) ? 'Successfully deleted' : 'Successfully saved into keystore';
}
echo json_encode(
[ $type => __($msg_title).':<br>'.$msg ]
);
exit;
}
/**
* Initializes object and validates user access.
*
* @param string $ajax_controller Path of ajaxController, is the 'page'
* variable sent in ajax calls.
*
* @return object
*/
public function __construct($ajax_controller)
{
global $config;
// Check access.
check_login();
if ((bool) check_acl($config['id_user'], 0, 'LM') === false) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access pending alerts list'
);
if (is_ajax()) {
echo json_encode(['error' => 'noaccess']);
} else {
include 'general/noaccess.php';
}
exit;
}
$this->ajaxController = $ajax_controller;
return $this;
}
/**
* Prints inputs for modal "Pending alerts list".
*
* @return void
*/
public function loadModal()
{
ob_start();
echo '<div id="pending_alerts_modal">';
echo $this->getModalContent();
echo '</div>';
echo ob_get_clean();
}
/**
* Run.
*
* @return void
*/
public function run()
{
global $config;
ui_require_css_file('tables');
if ((bool) check_acl($config['id_user'], 0, 'LM') === false) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access pending alerts list.'
);
include 'general/noaccess.php';
return;
}
// Auxiliar div for modal.
echo '<div id="alerts_list_modal" class="invisible"></div>';
echo $this->loadJS();
}
/**
* Draw table.
*
* @return void
*/
public function drawTable()
{
global $config;
$start = get_parameter('start', 0);
$length = get_parameter('length', $config['block_size']);
$order = get_datatable_order(true);
try {
ob_start();
$order_by_clause = '';
if (in_array($order['field'], ['agentAlias', 'moduleName', 'alertType']) === false) {
$order_by_clause = 'ORDER BY id '.$order['direction'];
}
if ($length !== '-1') {
$sql = sprintf(
'SELECT *
FROM talert_execution_queue %s
LIMIT %d, %d',
$order_by_clause,
$start,
$length
);
} else {
$sql = sprintf(
'SELECT * FROM talert_execution_queue %s',
$order_by_clause
);
}
// Retrieve data and count.
$data = db_get_all_rows_sql($sql);
$count = (int) db_get_sql('SELECT COUNT(*) FROM talert_execution_queue');
if ($data) {
$data = array_reduce(
$data,
function ($carry, $item) {
// Check if the item is an array before proceeding.
if (is_array($item) === true) {
// Transforms array of arrays $data into an array
// of objects, making a post-process of certain fields.
$tmp = (object) $item;
$decoded_data = base64_decode($tmp->data);
$decoded_data = json_decode($decoded_data, true);
if (is_array($decoded_data) === true) {
// Access the second element of $decoded_data (index 1) to get 'alias' and 'type'.
$tmp->agentAlias = isset($decoded_data[1]['alias']) ? $decoded_data[1]['alias'] : null;
$tmp->alertType = isset($decoded_data[3]['type']) ? $decoded_data[3]['type'] : null;
// Access the third element of $decoded_data (index 2) to get 'nombre'.
$tmp->moduleName = isset($decoded_data[2]['nombre']) ? $decoded_data[2]['nombre'] : null;
$carry[] = $tmp;
}
}
return $carry;
}
);
}
echo json_encode(
[
'data' => $data,
'recordsTotal' => $count,
'recordsFiltered' => $count,
]
);
// Capture output.
$response = ob_get_clean();
} catch (Exception $e) {
echo json_encode(['error' => $e->getMessage()]);
exit;
}
// If not valid, show error with issue.
json_decode($response);
if (json_last_error() == JSON_ERROR_NONE) {
// If valid dump.
echo $response;
} else {
echo json_encode(
['error' => $response]
);
}
exit;
}
/**
* Generates content of modal.
*
* @return string Modal content.
*/
public function getModalContent()
{
global $config;
ob_start();
try {
$columns = [
'id',
'agentAlias',
'moduleName',
'alertType',
];
$column_names = [
__('ID'),
__('Agent'),
__('Module'),
__('Type'),
];
$this->tableId = 'pending_alerts';
ui_print_datatable(
[
'id' => $this->tableId,
'class' => 'info_table',
'style' => 'width: 99%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,
'default_pagination' => 7,
'dom_elements' => 'pfti',
'ajax_data' => ['method' => 'drawTable'],
'no_sortable_columns' => [
1,
2,
3,
],
'order' => [
'field' => 'id',
'direction' => 'asc',
],
]
);
} catch (Exception $e) {
echo $e->getMessage();
}
return ob_get_clean();
}
/**
* Loads JS content.
*
* @return string JS content.
*/
public function loadJS()
{
ob_start();
ui_require_javascript_file('stepper', 'include/javascript/', true);
// Javascript content.
?>
<script type="text/javascript">
/**
* Cleanup current dom entries.
*/
function cleanupDOM() {
$('#div-identifier').empty();
$('#div-product').empty();
$('#div-username').empty();
$('#div-password').empty();
$('#div-extra_1').empty();
$('#div-extra_2').empty();
}
/**
* Process ajax responses and shows a dialog with results.
*/
function showMsg(data) {
var title = "<?php echo __('Success'); ?>";
var text = '';
var failed = 0;
try {
data = JSON.parse(data);
text = data['result'];
} catch (err) {
title = "<?php echo __('Failed'); ?>";
text = err.message;
failed = 1;
}
if (!failed && data['error'] != undefined) {
title = "<?php echo __('Failed'); ?>";
text = data['error'];
failed = 1;
}
if (data['report'] != undefined) {
data['report'].forEach(function (item){
text += '<br>'+item;
});
}
$('#msg').empty();
$('#msg').html(text);
$('#msg').dialog({
width: 450,
position: {
my: 'center',
at: 'center',
of: window,
collision: 'fit'
},
title: title,
buttons: [
{
class: "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
text: 'OK',
click: function(e) {
if (!failed) {
$(".ui-dialog-content").dialog("close");
$('.info').hide();
cleanupDOM();
dt_keystore.draw(false);
} else {
$(this).dialog('close');
}
}
}
]
});
}
/**
* Loads modal from AJAX.
*/
function show_agent_install_modal() {
var btn_close_text = '<?php echo __('Close'); ?>';
var title = '<?php echo __('Alerts pending to be executed'); ?>';
load_modal({
target: $('#alerts_list_modal'),
form: 'modal_form',
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
ajax_callback: showMsg,
cleanup: cleanupDOM,
modal: {
title: title,
cancel: btn_close_text,
},
extradata: [
{
name: 'identifier'
}
],
onshow: {
page: '<?php echo $this->ajaxController; ?>',
method: 'loadModal'
},
onload: function() {
$('#pending_alerts_paginate').css('margin-bottom','15px');
},
});
}
$(document).ready(function() {
var page = 0;
$("#button-modal_pending_alerts").on('click', function() {
show_agent_install_modal();
});
const alertsListBtn = document.querySelectorAll('.open-alerts-list-modal');
alertsListBtn.forEach(link => {
link.addEventListener('click', function (event) {
event.preventDefault();
show_agent_install_modal();
});
});
});
</script>
<?php
// EOF Javascript content.
return ob_get_clean();
}
}

View File

@ -178,7 +178,7 @@ class AuditLog extends HTML
[ [
'id' => $this->tableId, 'id' => $this->tableId,
'class' => 'info_table', 'class' => 'info_table',
'style' => 'width: 99%', 'style' => 'width: 100%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $column_names, 'column_names' => $column_names,
'ajax_url' => $this->ajaxController, 'ajax_url' => $this->ajaxController,
@ -469,7 +469,7 @@ class AuditLog extends HTML
success: function(data) { success: function(data) {
var options = ""; var options = "";
$.each(data,function(key,value){ $.each(data,function(key,value){
options += "<option value='"+key+"'>"+value+"</option>"; options += "<option value='"+value+"'>"+key+"</option>";
}); });
$('#overwrite_filter').html(options); $('#overwrite_filter').html(options);
$('#overwrite_filter').select2(); $('#overwrite_filter').select2();
@ -509,8 +509,12 @@ class AuditLog extends HTML
/* Filter management */ /* Filter management */
$('#button-load-filter').click(function (){ $('#button-load-filter').click(function (){
if($('#load-filter-select').length) { if($('#load-filter-select').length) {
$('#load-filter-select').dialog({width: "20%", $('#load-filter-select').dialog({
maxWidth: "25%", resizable: true,
draggable: true,
modal: false,
closeOnEscape: true,
width: "auto",
title: "<?php echo __('Load filter'); ?>" title: "<?php echo __('Load filter'); ?>"
}); });
$.ajax({ $.ajax({
@ -523,8 +527,9 @@ class AuditLog extends HTML
}, },
success: function(data) { success: function(data) {
var options = ""; var options = "";
console.log(data)
$.each(data,function(key,value){ $.each(data,function(key,value){
options += "<option value='"+key+"'>"+value+"</option>"; options += "<option value='"+value+"'>"+key+"</option>";
}); });
$('#filter_id').html(options); $('#filter_id').html(options);
$('#filter_id').select2(); $('#filter_id').select2();

View File

@ -701,7 +701,7 @@ class CalendarManager
true, true,
[ [
'title' => __('Edit'), 'title' => __('Edit'),
'class' => 'invert_filter', 'class' => 'invert_filter main_menu_icon',
] ]
); );
$tmp->options .= '</a>'; $tmp->options .= '</a>';
@ -735,7 +735,7 @@ class CalendarManager
true, true,
[ [
'title' => __('Delete'), 'title' => __('Delete'),
'class' => 'invert_filter', 'class' => 'invert_filter main_menu_icon',
] ]
); );
$tmp->options .= '</a>'; $tmp->options .= '</a>';
@ -1040,7 +1040,7 @@ class CalendarManager
'id' => 'templates_alerts_special_days', 'id' => 'templates_alerts_special_days',
'return' => true, 'return' => true,
'class' => 'info_table', 'class' => 'info_table',
'style' => 'width: 99%', 'style' => 'width: 100%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $column_names, 'column_names' => $column_names,
'ajax_url' => 'godmode/alerts/alert_special_days', 'ajax_url' => 'godmode/alerts/alert_special_days',

View File

@ -612,7 +612,7 @@ class ConfigPEN extends HTML
'id' => $tableId, 'id' => $tableId,
'return' => true, 'return' => true,
'class' => 'info_table', 'class' => 'info_table',
'style' => 'width: 99%', 'style' => 'width: 100%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $column_names, 'column_names' => $column_names,
'ajax_url' => $this->ajaxController, 'ajax_url' => $this->ajaxController,

View File

@ -595,7 +595,6 @@ class ConsoleSupervisor
'days_delete_unknown' => 'Max. days before unknown modules are deleted', 'days_delete_unknown' => 'Max. days before unknown modules are deleted',
'days_delete_not_initialized' => 'Max. days before delete not initialized modules', 'days_delete_not_initialized' => 'Max. days before delete not initialized modules',
'days_autodisable_deletion' => 'Max. days before autodisabled agents are deleted', 'days_autodisable_deletion' => 'Max. days before autodisabled agents are deleted',
'delete_old_network_matrix' => 'Max. days before delete old network matrix data',
'report_limit' => 'Item limit for real-time reports', 'report_limit' => 'Item limit for real-time reports',
'event_view_hr' => 'Default hours for event view', 'event_view_hr' => 'Default hours for event view',
'big_operation_step_datos_purge' => 'Big Operation Step to purge old data', 'big_operation_step_datos_purge' => 'Big Operation Step to purge old data',
@ -1807,7 +1806,8 @@ class ConsoleSupervisor
$this->cleanNotifications('NOTIF.PHP.SERIALIZE_PRECISION'); $this->cleanNotifications('NOTIF.PHP.SERIALIZE_PRECISION');
} }
if (version_compare('8.1', PHP_VERSION) >= 0) { // If PHP_VERSION is lower than 8.0.27 version_compare() returns 1.
if (version_compare('8.0.27', PHP_VERSION) === 1) {
$url = 'https://www.php.net/supported-versions.php'; $url = 'https://www.php.net/supported-versions.php';
$this->notify( $this->notify(
[ [

View File

@ -827,7 +827,7 @@ class CredentialStore extends Wizard
[ [
'id' => $this->tableId, 'id' => $this->tableId,
'class' => 'info_table', 'class' => 'info_table',
'style' => 'width: 99%', 'style' => 'width: 100%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $column_names, 'column_names' => $column_names,
'ajax_url' => $this->ajaxController, 'ajax_url' => $this->ajaxController,

View File

@ -1579,7 +1579,7 @@ class Diagnostics extends Wizard
[ [
'id' => $tableId, 'id' => $tableId,
'class' => 'info_table caption_table', 'class' => 'info_table caption_table',
'style' => 'width: 99%', 'style' => 'width: 100%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $columnNames, 'column_names' => $columnNames,
'ajax_data' => [ 'ajax_data' => [
@ -1591,6 +1591,7 @@ class Diagnostics extends Wizard
'no_sortable_columns' => [-1], 'no_sortable_columns' => [-1],
'caption' => $title, 'caption' => $title,
'print' => true, 'print' => true,
'mini_csv' => true,
] ]
); );
} else { } else {

View File

@ -320,7 +320,7 @@ class EventSound extends HTML
[ [
'id' => $this->tableId, 'id' => $this->tableId,
'class' => 'info_table', 'class' => 'info_table',
'style' => 'width: 99%', 'style' => 'width: 100%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $column_names, 'column_names' => $column_names,
'ajax_url' => $this->ajaxController, 'ajax_url' => $this->ajaxController,

File diff suppressed because it is too large Load Diff

View File

@ -2392,7 +2392,9 @@ class NetworkMap
unlink($filename_dot); unlink($filename_dot);
if (function_exists($this->customParser)) { if (empty($this->customParser) === false
&& function_exists($this->customParser)
) {
try { try {
if (empty($this->customParserArgs)) { if (empty($this->customParserArgs)) {
$graph = call_user_func( $graph = call_user_func(

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