Merge branch 'develop' into ent-11490-nuevo-widget-group-status-map

This commit is contained in:
Daniel Cebrian 2023-08-11 12:26:24 +02:00
commit 3b0d15b41c
289 changed files with 14437 additions and 2294 deletions

View File

@ -19,10 +19,10 @@ LOGFILE="/tmp/deploy-ext-db-$(date +%F).log"
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPASS" ] || DBPASS='Pandor4!'
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTUSER" ] || DBROOTUSER=root
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
[ "$DBROOTPASS" ] || DBROOTPASS='Pandor4!'
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=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")
@ -79,6 +79,53 @@ check_root_permissions () {
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
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 "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
rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$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)
if [ "$MYVER" -eq '80' ] ; then
echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = 'Pandor4!';
UNINSTALL COMPONENT 'file://component_validate_password';
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = '$DBROOTPASS';
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"
fi
if [ "$MYVER" -ne '80' ] ; then
echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('Pandor4!');
UNINSTALL PLUGIN validate_password;
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('$DBROOTPASS');
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"fi
fi

View File

@ -26,9 +26,9 @@ rm -f $LOGFILE &> /dev/null # remove last log before start
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPASS" ] || DBPASS='Pandor4!'
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
[ "$DBROOTPASS" ] || DBROOTPASS='Pandor4!'
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=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")
@ -86,6 +86,53 @@ check_root_permissions () {
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
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 "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
rm -rf "$WORKDIR" &>> "$LOGFILE"
mkdir -p "$WORKDIR" &>> "$LOGFILE"
@ -170,6 +221,7 @@ if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
""" | mysql -uroot &>> "$LOGFILE"
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 "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."

View File

@ -11,7 +11,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='2023050901'
S_VERSION='2023062901'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables
@ -285,8 +285,7 @@ console_dependencies=" \
mod_ssl \
libzstd \
openldap-clients \
chromium \
http://firefly.pandorafms.com/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
chromium"
execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
# Server dependencies
@ -313,7 +312,6 @@ server_dependencies=" \
bind-utils \
whois \
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 \
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"
@ -341,7 +339,6 @@ execute_cmd "yum install -y $oracle_dependencies || yum reinstall -y $oracle_dep
#ipam dependencies
ipam_dependencies=" \
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
perl(NetAddr::IP) \
perl(Sys::Syslog) \
perl(DBI) \
@ -719,6 +716,9 @@ echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cro
systemctl enable pandora_agent_daemon &>> $LOGFILE
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
# Enable postrix
systemctl enable postfix --now &>> "$LOGFILE"
#SSH banner
[ "$(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
S_VERSION='2023050901'
S_VERSION='2023062901'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables
@ -24,10 +24,10 @@ LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPASS" ] || DBPASS='Pandor4!'
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTUSER" ] || DBROOTUSER=root
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
[ "$DBROOTPASS" ] || DBROOTPASS='Pandor4!'
[ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
@ -125,6 +125,52 @@ installing_docker () {
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
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 "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
rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$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-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/centos7/wmic-1.4-1.el7.x86_64.rpm \
http://firefly.pandorafms.com/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm"
execute_cmd "dnf install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
# Server dependencies
@ -371,7 +420,7 @@ server_dependencies=" \
java \
bind-utils \
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 \
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"
@ -399,7 +448,6 @@ execute_cmd "dnf install -y $oracle_dependencies" "Installing Oracle Instant cli
#ipam dependencies
ipam_dependencies=" \
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
perl(NetAddr::IP) \
perl(Sys::Syslog) \
perl(DBI) \
@ -439,7 +487,6 @@ if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
if [ "$MYVER" -eq '80' ] ; then
echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = 'Pandor4!';
UNINSTALL COMPONENT 'file://component_validate_password';
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = '$DBROOTPASS';
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"
fi
@ -447,7 +494,6 @@ if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
if [ "$MYVER" -ne '80' ] ; then
echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('Pandor4!');
UNINSTALL PLUGIN validate_password;
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('$DBROOTPASS');
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"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/.*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 'ProxyTimeout 300' >> /etc/httpd/conf.d/timeout.conf
cat > /var/www/html/index.html << EOF_INDEX
<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"
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
# Enable postfix
systemctl enable postfix --now &>> "$LOGFILE"
#SSH banner
[ "$(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
S_VERSION='2023050901'
S_VERSION='2023062901'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
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
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPASS" ] || DBPASS='Pandor4!'
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
[ "$DBROOTPASS" ] || DBROOTPASS='Pandor4!'
[ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
@ -113,6 +113,53 @@ check_root_permissions () {
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 for debug
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 "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
rm -rf "$WORKDIR" &>> "$LOGFILE"
mkdir -p "$WORKDIR" &>> "$LOGFILE"
@ -265,7 +316,6 @@ server_dependencies=" \
openssh-client \
postfix \
unzip \
xprobe \
coreutils \
libio-compress-perl \
libmoosex-role-timer-perl \
@ -287,6 +337,8 @@ server_dependencies=" \
libgeo-ip-perl \
arping \
snmp-mibs-downloader \
snmptrapd \
libnsl2 \
openjdk-8-jdk "
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" && \
cp -a wmic /usr/bin/ &>> "$LOGFILE" && \
cp -a pandorawmic /usr/bin/ &>> "$LOGFILE"
check_cmd_status "Error Installing phanromjs"
# 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"
check_cmd_status "Error Installing pandorawmic/wmic"
# create symlink for fping
rm -f /usr/sbin/fping &>> "$LOGFILE"
@ -370,7 +412,6 @@ source '/root/.profile' &>> "$LOGFILE"
#ipam dependencies
ipam_dependencies=" \
xprobe \
libnetaddr-ip-perl \
coreutils \
libdbd-mysql-perl \
@ -413,6 +454,7 @@ if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
""" | mysql -uroot &>> "$LOGFILE"
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 "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."
@ -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/^disable_functions/;disable_functions/" /etc/php.ini
#adding 900s to httpd timeout
#echo 'TimeOut 900' > /etc/httpd/conf.d/timeout.conf
#adding 900s to httpd timeout and 300 to ProxyTimeout
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
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">
@ -792,6 +835,13 @@ systemctl enable pandora_agent_daemon &>> "$LOGFILE"
#fix path phantomjs
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
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)

View File

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

View File

@ -4,7 +4,7 @@ Architecture: all
Priority: optional
Section: admin
Installed-Size: 260
Maintainer: ÁRTICA ST <info@artica.es>
Maintainer: Pandora FMS <info@pandorafms.com>
Homepage: https://pandorafms.org/
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.

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.772, FreeBSD Version
# Version 7.0NG.773, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.772, Solaris Version
# Version 7.0NG.773, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@ Architecture: all
Priority: optional
Section: admin
Installed-Size: 260
Maintainer: ÁRTICA ST <info@artica.es>
Maintainer: Pandora FMS <info@pandorafms.com>
Homepage: http://pandorafms.org/
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.

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.772
# Version 7.0NG.773
# Licensed under GPL license v2,
# (c) 2003-2023 Pandora FMS
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.772
# Version 7.0NG.773
# Licensed under GPL license v2,
# (c) 2003-2023 Pandora FMS
# please visit http://pandora.sourceforge.net

View File

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

View File

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

View File

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

View File

@ -1,10 +1,10 @@
package: pandorafms-agent-unix
Version: 7.0NG.772-230717
Version: 7.0NG.773
Architecture: all
Priority: optional
Section: admin
Installed-Size: 260
Maintainer: ÁRTICA ST <info@artica.es>
Maintainer: Pandora FMS <info@pandorafms.com>
Homepage: http://pandorafms.org/
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.

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.772-230717"
pandora_version="7.0NG.773"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
@ -42,6 +42,7 @@ mkdir -p temp_package/usr/bin/
mkdir -p temp_package/usr/sbin/
mkdir -p temp_package/etc/pandora/plugins
mkdir -p temp_package/etc/pandora/collections
mkdir -p temp_package/etc/pandora/ref
mkdir -p temp_package/etc/pandora/trans
mkdir -p temp_package/etc/pandora/commands
mkdir -p temp_package/etc/init.d/

View File

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

View File

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

View File

@ -5,9 +5,9 @@
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</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>CFBundleShortVersionString</key> <string>7.0NG.772</string>
<key>CFBundleVersion</key> <string>7.0NG.773</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.773 Pandora FMS on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.773</string>
<key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string>

View File

@ -30,6 +30,7 @@ else
mkdir -p /usr/local/share/man/man1/
mkdir -p /usr/local/share/pandora_agent/collections/
mkdir -p /usr/local/share/pandora_agent/commands/
mkdir -p /usr/local/share/pandora_agent/ref/
mkdir -p /etc/pandora/
mkdir -p /var/spool/pandora/data_out/
mkdir -p /var/log/pandora/
@ -39,6 +40,7 @@ else
# Setting permissions to directories and files
chmod -R 700 /usr/local/share/pandora_agent/collections
chmod -R 700 /usr/local/share/pandora_agent/commands
chmod -R 700 /usr/local/share/pandora_agent/ref
chmod -R 755 /etc/pandora/
chmod -R 700 /var/spool/pandora/data_out
chmod -R 711 /var/log/pandora
@ -69,6 +71,7 @@ chown root:wheel /usr/local/bin/tentacle_client
ln -s /usr/local/share/pandora_agent/plugins /etc/pandora/plugins
ln -s /usr/local/share/pandora_agent/commands /etc/pandora/commands
ln -s /usr/local/share/pandora_agent/collections /etc/pandora/collections
ln -s /usr/local/share/pandora_agent/ref /etc/pandora/ref
# Copy manuals
@ -90,4 +93,4 @@ echo "/var/log/pandora/pandora_agent.log : 640 5 204
# Clean all install utilites
rm -Rf inst_utilities
exit 0
exit 0

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.772, FreeBSD Version
# Version 7.0NG.773, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.772
# Version 7.0NG.773
# Licensed under GPL license v2,
# Copyright (c) 2004-2023 Pandora FMS
# https://pandorafms.com
@ -310,3 +310,9 @@ module_plugin autodiscover --default
#module_description Zombies process on system
#module_group System
#module_end
#Hardening plugin for security compliance analysis. Enable to use it.
#module_begin
#module_plugin /usr/share/pandora_agent/plugins/pandora_sca
#module_absoluteinterval 7d
#module_end

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.772, NetBSD Version
# Version 7.0NG.773, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.772, Solaris Version
# Version 7.0NG.773, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

@ -1003,7 +1003,7 @@ use strict;
use warnings;
use Scalar::Util qw(looks_like_number);
use POSIX qw(strftime floor);
use POSIX qw(ceil floor strftime);
use Sys::Hostname;
use File::Basename;
use File::Copy;
@ -1030,8 +1030,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.772';
use constant AGENT_BUILD => '230717';
use constant AGENT_VERSION => '7.0NG.773';
use constant AGENT_BUILD => '230811';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -1121,6 +1121,7 @@ my %DefaultConf = (
'server_path_md5' => 'md5', #undocumented
'server_path_conf' => 'conf', #undocumented
'server_path_zip' => 'collections', #undocumented
'server_path_ref' => 'ref', #undocumented
'logfile' =>'/var/log/pandora/pandora_agent.log',
'logsize' => DEFAULT_MAX_LOG_SIZE,
'logrotate' => DEFAULT_LOG_ROTATE,
@ -1569,6 +1570,34 @@ sub parse_conf_modules($) {
$module->{'post_process'} = $1;
} elsif ($line =~ /^\s*module_interval\s+(\d+)\s*$/) {
$module->{'interval'} = $1;
} elsif ($line =~ /^\s*module_absoluteinterval\s+(.*)$/) {
my $absolute_interval = $1;
if ($absolute_interval eq 'once') {
$module->{'absoluteinterval'} = 0;
} elsif ($absolute_interval =~ /^(\d+)([smhd])?\s*$/) {
if (defined($2)) {
# Seconds.
if ($2 eq 's') {
$module->{'absoluteinterval'} = int($1);
}
# Minutes (convert to seconds).
elsif ($2 eq 'm') {
$module->{'absoluteinterval'} = int($1) * 60;
}
# Hours (convert to seconds).
elsif ($2 eq 'h') {
$module->{'absoluteinterval'} = int($1) * 3600;
}
# Days (convert to seconds).
elsif ($2 eq 'd') {
$module->{'absoluteinterval'} = int($1) * 86400;
}
} else {
$module->{'absoluteinterval'} = int($1) * $Conf{'interval'};
}
} else {
log_message ('setup', "Invalid value for module_absoluteinterval: $absolute_interval");
}
} elsif ($line =~ /^\s*module_timeout\s+(\d+)\s*$/) {
$module->{'timeout'} = $1;
} elsif ($line =~ /^\s*module_save\s+(\w+)$/) {
@ -1636,6 +1665,27 @@ sub parse_conf_modules($) {
next;
}
# Configure modules with an absolute interval.
if (defined($module->{'absoluteinterval'})) {
# Convert from seconds to actual agent intervals.
$module->{'interval'} = ceil($module->{'absoluteinterval'} / $Conf{'interval'});
# Make sure modules that run once are asynchronous.
if ($module->{'interval'} == 0) {
if ($module->{'type'} eq 'generic_data') {
$module->{'type'} = 'async_data';
} elsif ($module->{'type'} eq 'generic_proc') {
$module->{'type'} = 'async_proc';
} elsif ($module->{'type'} eq 'generic_data_string') {
$module->{'type'} = 'async_string';
}
}
# This file will be used for persistence.
$module->{'timestamp_file'} = $ConfDir . '/' . $Conf{'server_path_ref'} . '/' . md5($module->{'name'}) . '.ref';
}
# Set the intensive interval
if ($module->{'is_intensive'} == 1) {
$module->{'intensive_interval'} = $module->{'interval'};
@ -1643,9 +1693,9 @@ sub parse_conf_modules($) {
$module->{'intensive_interval'} = $module->{'interval'} * ($Conf{'interval'} / $Conf{'intensive_interval'});
}
# Make the module run the first time
$module->{'counter'} = $module->{'intensive_interval'};
# Initialize the module's execution counter.
init_counter($module);
# Replace macros
replace_macros ($module);
@ -2805,7 +2855,15 @@ sub exec_module {
}
}
if (++($module->{'counter'}) < $module->{'intensive_interval'}) {
# Modules that will run once.
if ($module->{'interval'} == 0) {
if ($module->{'counter'} == 0) {
$ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1);
return;
}
}
# Modules that will run periodically.
elsif (++($module->{'counter'}) < $module->{'intensive_interval'}) {
$ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1);
return;
}
@ -2862,6 +2920,9 @@ sub exec_module {
}
}
# Save the module's timestamp to disk.
save_module_timestamp($module);
$ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1);
}
@ -3547,6 +3608,44 @@ sub check_module_cron {
return 0;
}
################################################################################
# Initialize a module's internal execution counter.
################################################################################
sub init_counter($) {
my ($module) = @_;
# Open the timestamp file if available.
my $fh;
if (!defined($module->{'timestamp_file'}) ||
!open($fh, '<', $module->{'timestamp_file'})) {
# If intensive_interval is 0, setting counter to any value != 0 will make the module run.
$module->{'counter'} = $module->{'intensive_interval'} == 0 ? 1 : $module->{'intensive_interval'};
return;
}
# Read the timestamp from disk.
my $timestamp = int(<$fh>);
close($fh);
# Update the module's execution counter.
# If intensive_interval is 0, setting counter to 0 will prevent the module from running again.
$module->{'counter'} = $module->{'intensive_interval'} == 0 ? 0 : floor((time() - $timestamp) / $Conf{'interval'});
}
################################################################################
# Save a module's execution timestamp to disk for persistence.
################################################################################
sub save_module_timestamp($) {
my ($module) = @_;
return if (!defined($module->{'timestamp_file'}));
# Update the time reference.
open(my $fh, '>', $module->{'timestamp_file'}) or return;
print $fh time();
close($fh);
}
################################################################################
# Write module data in XML format.
################################################################################

View File

@ -3,8 +3,8 @@
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.772
%define release 230717
%define version 7.0NG.773
%define release 1
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
@ -100,6 +100,11 @@ if [ ! -e /etc/pandora/collections ]; then
ln -s /usr/share/pandora_agent/collections /etc/pandora
fi
if [ ! -e /etc/pandora/ref ]; then
mkdir -p /usr/share/pandora_agent/ref
ln -s /usr/share/pandora_agent/ref /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
@ -143,7 +148,7 @@ fi
# Remove symbolic links
pushd /etc/pandora
for f in pandora_agent.conf plugins collections
for f in pandora_agent.conf plugins collections ref
do
[ -L $f ] && rm -f $f
done

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: x86_64
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

@ -3,8 +3,8 @@
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.772
%define release 230717
%define version 7.0NG.773
%define release 1
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
@ -94,6 +94,10 @@ if [ ! -e /etc/pandora/collections ]; then
mkdir /etc/pandora/collections
fi
if [ ! -e /etc/pandora/ref ]; then
mkdir /etc/pandora/ref
fi
if [ ! -e /etc/pandora/commands ]; then
mkdir /etc/pandora/commands
fi

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.772"
PI_BUILD="230717"
PI_VERSION="7.0NG.773"
PI_BUILD="230811"
OS_NAME=`uname -s`
FORCE=0
@ -408,6 +408,11 @@ install () {
chmod -R 700 $PANDORA_BASE$PANDORA_HOME/commands
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/commands $PANDORA_BASE$PANDORA_CFG
echo "Creating the ref directory in to $PANDORA_BASE$PANDORA_HOME/ref..."
mkdir -p $PANDORA_BASE$PANDORA_HOME/ref
chmod -R 700 $PANDORA_BASE$PANDORA_HOME/ref
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/ref $PANDORA_BASE$PANDORA_CFG
if [ $WITHOUT_TENTACLE_SERVER -eq 0 ]
then
echo "Copying tentacle server to $PANDORA_BASE$TENTACLE_SERVER"
@ -541,8 +546,17 @@ install () {
then
echo "Define 'pandora_agent=\"YES\"' in /etc/rc.conf to enable the daemon."
else
echo "Check your startup configuration to be sure Pandora FMS Agent is ready "
echo "to start automatically when system restarts":
# Enable startup service
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
# Restore the daemon script

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2023 Pandora FMS
# Version 7.0NG.772
# Version 7.0NG.773
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version
@ -522,5 +522,4 @@ module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default
#module_type generic_data_string
#module_exec echo Bordón
#module_native_encoding OEM
#module_end
#module_end

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v7.0NG.772}
{Pandora FMS Windows Agent v7.0NG.773}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{230717}
{230811}
ViewReadme
{Yes}
@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
{No}
Windows,Executable
{<%AppName%>-<%Version%>-Setup<%Ext%>}
{<%AppName%>-Setup<%Ext%>}
Windows,FileDescription
{<%AppName%> <%Version%> Setup}

View File

@ -31,6 +31,10 @@ using namespace std;
* File operations.
*/
namespace Pandora_File {
/* Size of a buffer that will be passed to Pandora_File::md5. */
const int MD5_BUF_SIZE = 33;
/**
* File super-class exception.
*/

View File

@ -19,11 +19,14 @@
*/
#include "pandora_module.h"
#include "pandora_windows_service.h"
#include "../misc/pandora_file.h"
#include "../pandora_strutils.h"
#include "../pandora.h"
#include <iostream>
#include <sstream>
#include <cmath>
#define BUFSIZE 4096
@ -472,18 +475,27 @@ Pandora_Module::setNoOutput () {
*/
void
Pandora_Module::run () {
/* Check the interval */
if (this->executions % this->intensive_interval != 0) {
// Run once.
if (this->intensive_interval == 0) {
if (this->executions == 0) {
has_output = false;
throw Interval_Not_Fulfilled ();
}
}
// Run periodically.
else if (++this->executions < this->intensive_interval) {
pandoraDebug ("%s: Interval is not fulfilled", this->module_name.c_str ());
this->executions++;
has_output = false;
throw Interval_Not_Fulfilled ();
}
/* Increment the executions after check. This is done to execute the
first time */
this->executions++;
// Reset the execution counter.
this->executions = 0;
has_output = true;
// Update the execution timestamp.
this->updateTimestampFile();
}
/**
@ -1663,6 +1675,63 @@ Pandora_Module::getTimestamp () {
return this->timestamp;
}
/**
* Sets the module timestamp file.
*
* @param file_name The name of the timestamp file.
*/
void
Pandora_Module::setTimestampFile (string file_name) {
this->timestamp_file = file_name;
}
/**
* Gets the module timestamp file.
*
* @return The name of the timestamp file.
*/
string
Pandora_Module::getTimestampFile () {
return this->timestamp_file;
}
/**
* Update the timestamp file with the current time.
*
*/
void
Pandora_Module::updateTimestampFile () {
try {
Pandora_File::writeFile(this->timestamp_file, std::to_string(std::time(NULL)));
} catch (...) {
/* Ignore errors. */
}
}
/**
* Initialize the module's internal execution counter.
*
*/
void
Pandora_Module::initExecutions () {
string timestamp;
try {
if (this->timestamp_file != "" && Pandora_File::readFile(this->timestamp_file, timestamp) != FILE_NOT_FOUND) {
// If the interval is 0, setting executions to 0 will prevent the module from running.
this->executions = this->intensive_interval == 0 ?
0 :
floor((1000.0 * (std::time(NULL) - strtoint(timestamp))) / Pandora_Windows_Service::getInstance()->getInterval());
return;
}
} catch (...) {
// Ignore errors.
}
// If the interval is 0, setting executions to any value != 0 will make the module run.
this->executions = this->intensive_interval == 0 ? 1 : this->intensive_interval;
}
/**
* Sets the value of intensive_match.
*

View File

@ -171,6 +171,7 @@ namespace Pandora_Modules {
Cron *cron;
list<Condition *> *intensive_condition_list;
time_t timestamp;
string timestamp_file;
unsigned char intensive_match;
int intensive_interval;
string unit, custom_id, str_warning, str_critical;
@ -238,6 +239,7 @@ namespace Pandora_Modules {
bool getAsync ();
void setExecutions(long executions=0);
long getExecutions();
void initExecutions ();
virtual string getXml ();
@ -303,6 +305,9 @@ namespace Pandora_Modules {
int hasOutput ();
void setTimestamp (time_t timestamp);
time_t getTimestamp ();
void setTimestampFile (string file_name);
string getTimestampFile ();
void updateTimestampFile ();
void setIntensiveMatch (unsigned char intensive_match);
unsigned char getIntensiveMatch ();
bool isIntensive ();

View File

@ -41,7 +41,10 @@
#include "pandora_module_snmpget.h"
#include "../windows/pandora_wmi.h"
#include "../pandora_strutils.h"
#include "../misc/pandora_file.h"
#include "../pandora.h"
#include <list>
#include <cmath>
using namespace Pandora;
using namespace Pandora_Modules;
@ -50,6 +53,7 @@ using namespace Pandora_Strutils;
#define TOKEN_NAME ("module_name ")
#define TOKEN_TYPE ("module_type ")
#define TOKEN_INTERVAL ("module_interval ")
#define TOKEN_ABSOLUTEINTERVAL ("module_absoluteinterval ")
#define TOKEN_EXEC ("module_exec ")
#define TOKEN_PROC ("module_proc ")
#define TOKEN_SERVICE ("module_service ")
@ -156,7 +160,8 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
list<string>::iterator iter;
string module_name, module_type, module_exec;
string module_min, module_max, module_description;
string module_interval, module_proc, module_service;
string module_interval, module_absoluteinterval;
string module_proc, module_service;
string module_freedisk, module_cpuusage, module_inventory;
string module_freedisk_percent, module_freememory_percent;
string module_dsn, module_freememory;
@ -196,6 +201,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_max = "";
module_description = "";
module_interval = "";
module_absoluteinterval = "";
module_exec = "";
module_proc = "";
module_service = "";
@ -290,6 +296,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_interval == "") {
module_interval = parseLine (line, TOKEN_INTERVAL);
}
if (module_absoluteinterval == "") {
module_absoluteinterval = parseLine (line, TOKEN_ABSOLUTEINTERVAL);
}
if (module_exec == "") {
module_exec = parseLine (line, TOKEN_EXEC);
}
@ -603,6 +612,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
}
}
if (module_absoluteinterval != "") {
pos_macro = module_absoluteinterval.find(macro_name);
if (pos_macro != string::npos){
module_absoluteinterval.replace(pos_macro, macro_name.size(), macro_value);
}
}
if (module_exec != "") {
pos_macro = module_exec.find(macro_name);
if (pos_macro != string::npos){
@ -1323,6 +1339,61 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
}
}
/* Set the module absolute interval */
if (module_absoluteinterval != "") {
int interval;
try {
service = Pandora_Windows_Service::getInstance();
// Run once.
if (module_absoluteinterval == "once") {
interval = 0;
}
// Seconds.
else if (module_absoluteinterval.back() == 's') {
interval = strtoint (module_absoluteinterval.substr(0, module_absoluteinterval.size() - 1));
}
// Minutes.
else if (module_absoluteinterval.back() == 'm') {
interval = strtoint (module_absoluteinterval.substr(0, module_absoluteinterval.size() - 1)) * 60;
}
// Hours.
else if (module_absoluteinterval.back() == 'h') {
interval = strtoint (module_absoluteinterval.substr(0, module_absoluteinterval.size() - 1)) * 3600;
}
// Days.
else if (module_absoluteinterval.back() == 'd') {
interval = strtoint (module_absoluteinterval.substr(0, module_absoluteinterval.size() - 1)) * 86400;
}
// Number of agent intervals.
else {
interval = strtoint(module_absoluteinterval) * (service->getIntervalSec());
}
// Convert from seconds to agent executions.
interval = ceil(interval / double(service->getIntervalSec()));
// Set the module interval.
module->setInterval (interval);
module->setIntensiveInterval (interval);
// Compute the MD5 hash of the module's name.
char module_name_md5[Pandora_File::MD5_BUF_SIZE];
Pandora_File::md5(module_name.c_str(), module_name.size(), module_name_md5);
// Set the timestamp file.
module->setTimestampFile(Pandora::getPandoraInstallDir().append("/ref/").append(module_name_md5).append(".ref"));
} catch (Invalid_Conversion e) {
pandoraLog ("Invalid absolute interval value \"%s\" for module %s",
module_absoluteinterval.c_str (),
module_name.c_str ());
}
catch (...) {
// Should not happen. Ignore errors.
}
}
/* Module intensive condition */
if (intensive_condition_list.size () > 0) {
intensive_condition_iter = intensive_condition_list.begin ();
@ -1337,6 +1408,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module->setIntensiveInterval (module->getInterval () * (service->getInterval () / service->getIntensiveInterval ()));
}
/* Initialize the module's execution counter. */
module->initExecutions ();
/* Module cron */
module->setCron (module_crontab);
@ -1374,6 +1448,18 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
numeric = false;
}
// Make sure modules that run once are asynchronous.
if (module->getInterval() == 0) {
type = module->getTypeInt();
if (type == TYPE_GENERIC_DATA) {
module->setType("async_data");
} else if (type == TYPE_GENERIC_PROC) {
module->setType("async_proc");
} else if (type == TYPE_GENERIC_DATA_STRING) {
module->setType("async_string");
}
}
if (numeric) {
if (module_max != "") {
try {

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.772 Build 230717")
#define PANDORA_VERSION ("7.0NG.773 Build 230811")
string pandora_path;
string pandora_dir;

View File

@ -2197,6 +2197,11 @@ Pandora_Windows_Service::getInterval () {
return this->interval;
}
long
Pandora_Windows_Service::getIntervalSec () {
return this->interval_sec;
}
long
Pandora_Windows_Service::getIntensiveInterval () {
return this->intensive_interval;

View File

@ -122,6 +122,7 @@ namespace Pandora {
Pandora_Agent_Conf *getConf ();
string getEHKey (string ehorus_conf);
long getInterval ();
long getIntervalSec ();
long getIntensiveInterval ();
string generateAgentName ();
bool writeToBuffer (string temporal);

View File

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

View File

@ -1,10 +1,10 @@
package: pandorafms-console
Version: 7.0NG.772-230717
Version: 7.0NG.773
Architecture: all
Priority: optional
Section: admin
Installed-Size: 42112
Maintainer: Artica ST <deptec@artica.es>
Maintainer: Pandora FMS <info@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
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
# GNU General Public License for more details.
pandora_version="7.0NG.772-230717"
pandora_version="7.0NG.773"
package_pear=0
package_pandora=1
@ -163,7 +163,7 @@ if [ $package_pear -eq 1 ]
then
echo "Make the package \"php-xml-rpc\"."
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-*
dpkg-buildpackage -rfakeroot
cd ..

View File

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

View File

@ -157,7 +157,6 @@ function extension_api_checker()
}
$url = io_safe_output(get_parameter('url', ''));
$ip = io_safe_output(get_parameter('ip', '127.0.0.1'));
$pandora_url = io_safe_output(get_parameter('pandora_url', $config['homeurl_static']));
$apipass = io_safe_output(get_parameter('apipass', ''));
@ -175,6 +174,17 @@ function extension_api_checker()
$api_execute = (bool) get_parameter('api_execute', false);
if ($url !== '') {
$validate_url = parse_url($url);
if ($validate_url['scheme'] === 'http' || $validate_url['scheme'] === 'https') {
ui_print_success_message(__('Request successfully processed'));
} else {
ui_print_error_message(__('Incorrect URL'));
$url = '';
$api_execute = false;
}
}
$return_call_api = '';
if ($api_execute === true) {
$return_call_api = api_execute(

View File

@ -453,7 +453,7 @@ function resource_exportation_extension_main()
true
)
);
$table->data[0][] = html_print_button(__('Export'), '', false, 'export_to_ptr("report");', ['mode' => 'link'], true);
$table->data[0][] = html_print_button(__('Export'), '', false, 'export_to_ptr("report");', '', true);
$table->data[1][] = html_print_label_input_block(
__('Visual console'),
@ -465,7 +465,7 @@ function resource_exportation_extension_main()
true
)
);
$table->data[1][] = html_print_button(__('Export'), '', false, 'export_to_ptr("visual_console");', ['mode' => 'link'], true);
$table->data[1][] = html_print_button(__('Export'), '', false, 'export_to_ptr("visual_console");', '', true);
if ($hook_enterprise === true) {
add_rows_for_enterprise($table->data);

View File

@ -1692,3 +1692,19 @@ enterprise/godmode/modules/manage_inventory_modules_form.php
enterprise/operation/inventory/inventory.php
include/test.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
enterprise/godmode/wizards/Applications.class.php
enterprise/godmode/wizards/Cloud.class.php
enterprise/images/wizard/applications.png
enterprise/images/wizard/cloud.png
enterprise/images/wizard/consoletasks.png

File diff suppressed because one or more lines are too long

View File

@ -228,16 +228,15 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
);
$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_counter = '';
if ($config['legacy_vc']
|| ($_GET['sec2'] !== 'operation/visual_console/render_view')
|| (($_GET['sec2'] !== 'operation/visual_console/render_view')
&& $config['legacy_vc'])
) {
if (($_GET['sec2'] !== 'operation/visual_console/render_view')) {
if ($autorefresh_list !== null
&& array_search($_GET['sec2'], $autorefresh_list) !== false
) {

View File

@ -185,6 +185,10 @@ echo '</div>';
$(`#sub${this.id}`).hide();
})
} 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");
$('ul.submenu').css('left', '280px');
var menuType_val = localStorage.getItem("menuType");
@ -273,6 +277,14 @@ echo '</div>';
$('.menu_icon').mouseenter(function() {
var menuType_val = localStorage.getItem("menuType");
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);
handsIn = 1;
openTime = new Date().getTime();
@ -305,6 +317,7 @@ echo '</div>';
table_hover2 = $(this);
handsIn2 = 1;
openTime2 = new Date().getTime();
$("#sub" + table_hover2[0].id).attr('style', 'display: none; position: fixed; left: 340px;');
$("#sub" + table_hover2[0].id).show();
if (typeof(table_noHover2) != 'undefined') {
if ("ul#sub" + table_hover2[0].id != "ul#sub" + table_noHover2[0].id) {
@ -315,6 +328,7 @@ echo '</div>';
}).mouseleave(function() {
var menuType_val = localStorage.getItem("menuType");
if (!click_display && menuType_val === 'collapsed') {
$("#sub" + $(this)[0].id).attr('style', 'display: none;');
table_noHover2 = table_hover2;
handsIn2 = 0;
setTimeout(function() {
@ -474,4 +488,10 @@ echo '</div>';
return height_logo + height_tabs + padding_menu + height_position;
}
});
<?php
if (get_user_language($config['id_user']) == 'es') {
?>
$('#icon_god-extensions').find('span').attr('style', 'white-space: nowrap;');
<?php } ?>
</script>

View File

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

@ -1758,7 +1758,10 @@ if ($update_module) {
];
if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) {
if ($id_module_type === 30 || $id_module_type === 31
|| $id_module_type === 32 || $id_module_type === 33
|| $id_module_type === 38
) {
$plugin_parameter_split = explode('&#x0a;', $values['plugin_parameter']);
$values['plugin_parameter'] = '';
@ -1954,7 +1957,10 @@ if ($create_module) {
'warning_time' => $warning_time,
];
if ($id_module_type === 30 || $id_module_type === 31 || $id_module_type === 32 || $id_module_type === 33) {
if ($id_module_type === 30 || $id_module_type === 31
|| $id_module_type === 32 || $id_module_type === 33
|| $id_module_type === 38
) {
$plugin_parameter_split = explode('&#x0a;', $values['plugin_parameter']);
$values['plugin_parameter'] = '';

View File

@ -996,6 +996,8 @@ if ($agents !== false) {
$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);
$tablePagination = ui_pagination(

View File

@ -407,8 +407,7 @@ if ($edit_module === true) {
$help_header = 'local_module';
}
if ($id_module_type === 6 || $id_module_type === 7
) {
if ($id_module_type === 6 || $id_module_type === 7) {
$help_header = 'icmp_module_tab';
}
@ -420,7 +419,7 @@ if ($edit_module === true) {
$help_header = 'tcp_module_tab';
}
if ($id_module_type >= 30 && $id_module_type <= 33) {
if (($id_module_type >= 30 && $id_module_type <= 33) || $id_module_type === 38) {
$help_header = 'webserver_module_tab';
}
}
@ -1847,6 +1846,22 @@ $(document).ready (function () {
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) {
if (type_name_selected.match(/_string$/) == null) {
// Hide string fields.

View File

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

View File

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

View File

@ -725,17 +725,17 @@ if ($copy_command) {
$is_management_allowed = is_management_allowed();
if ($is_management_allowed === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
$url_redirect = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/alert_commands&tab=command&pure=0'
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
$url_redirect = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All alert commands information is read only. Go to %s to manage it.',
$url
$url_redirect
)
);
}
@ -807,12 +807,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.
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) {
$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.'"
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.'"
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>';
}
}

View File

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

View File

@ -262,7 +262,7 @@ $data[1] = '';
$table_conditions->data[] = $data;
$data[0] = __('Use special days list');
$data[1] = (isset($alert['special_day']) && $alert['special_day'] == 1) ? __('Yes') : __('No');
$data[1] = (isset($template['special_day']) && (int) $template['special_day'] !== 0) ? __('Yes') : __('No');
$table_conditions->data[] = $data;
$data[0] = __('Time threshold');
@ -678,6 +678,23 @@ ui_require_javascript_file('pandora_fullcalendar');
<script language="javascript" type="text/javascript">
$(document).ready (function () {
$('li#icon_oper-agents').addClass('selected');
$('ul#subicon_oper-agents').show();
$('#title_menu').children().last().removeClass('arrow_menu_down');
$('#title_menu').children().last().addClass('arrow_menu_up');
$('#title_menu').children().first().next().addClass('span_selected');
$('li#Views').show();
$('li#Views').children().first().children().last().removeClass('arrow_menu_down');
$('li#Views').children().first().children().last().addClass('arrow_menu_up');
$('li#Views').children().first().children().first().addClass('span_selected');
$('li#Views').addClass('submenu_selected');
$('li#Views').removeClass('submenu_not_selected');
$('ul#subViews').show();
var parent = $('div[title="Alert details"]').parent().parent();
parent.addClass('selected');
$('.sub_subMenu.selected').prepend(`<div class="element_submenu_selected left_3"></div>`);
var calendarEl = document.getElementById('calendar_map');
if(calendarEl){
var eventsBBDD = $("#hidden-schedule").val();

View File

@ -184,7 +184,7 @@ if (empty($result) === false) {
]
).'</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(
'images/delet.svg',
'images/delete.svg',
true,
[
'title' => __('Delete'),

View File

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

View File

@ -189,6 +189,14 @@ echo get_table_inputs_masive_agents($params);
if (is_metaconsole() === true || is_management_allowed() === true) {
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>';

View File

@ -67,8 +67,27 @@ if (is_ajax()) {
if ($get_users) {
$id_group = get_parameter('id_group');
$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()) {
foreach ($profile_data as $user => $values) {
if (users_is_admin($values['id_usuario'])) {
@ -243,6 +262,21 @@ $data[2] .= html_print_select(
);
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);
@ -273,7 +307,8 @@ $(document).ready (function () {
{"page" : "godmode/massive/massive_delete_profiles",
"get_users" : 1,
"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) {
options = "";
@ -295,6 +330,10 @@ $(document).ready (function () {
$("#profiles_id").change (function () {
update_users();
});
$("#checkbox-get_all_groups").change (function () {
update_users();
});
});
/* ]]> */
</script>

View File

@ -30,6 +30,7 @@
// Begin.
require_once 'include/config.php';
require_once 'include/functions_menu.php';
require_once $config['homedir'].'/godmode/wizards/ManageExtensions.class.php';
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) {
enterprise_hook('applications_menu');
enterprise_hook('cloud_menu');
}
// Applications.
$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
|| (bool) check_acl($config['id_user'], 0, 'RM') === true
|| (bool) check_acl($config['id_user'], 0, 'PM') === true
) {
enterprise_hook('console_task_menu');
$extensions = ManageExtensions::getExtensionBySection('app');
if ($extensions !== false) {
foreach ($extensions as $key => $extension) {
$url = sprintf(
'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');
}
}
}
@ -502,9 +585,13 @@ if ($access_console_node === true) {
$sub2[$extmenu['sec2']]['refr'] = 0;
} else {
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 (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']]['id'] = str_replace(' ', '_', $extmenu['name']);
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['refr'] = 0;

View File

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

View File

@ -488,14 +488,38 @@ if (!empty($graphs)) {
true
);
$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.
html_print_table($table);
html_print_action_buttons(
implode('', $ActionButtons),
['type' => 'form_action']
);
if (is_metaconsole() === true) {
html_print_action_buttons(
implode('', $ActionButtons),
['type' => 'form_action']
);
} else {
html_print_action_buttons(
implode('', $ActionButtons),
[
'type' => 'form_action',
'right_content' => $tablePagination,
]
);
}
}
echo '</div>';

View File

@ -6720,6 +6720,8 @@ function chooseType() {
$("#row_agent").show();
$("#row_module").show();
$("#row_historical_db_check").hide();
period_set_value($("#hidden-period").attr('class'), 3600);
$("#row_period").find('select').val('3600').trigger('change');
break;
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'].'/godmode/wizards/DiscoveryTaskList.class.php';
// Load enterprise extensions.
enterprise_include('operation/reporting/custom_reporting.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>',
'filter_form',
'',
false,
true,
false,
'',
'white-box-content',
@ -1251,7 +1254,12 @@ switch ($action) {
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(
$total_reports,
$url,
@ -1259,7 +1267,7 @@ switch ($action) {
$pagination,
true,
'offset',
false,
false
);
} else {
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')
|| check_acl($config['id_user'], 0, 'RM')
) {
@ -3860,7 +3883,7 @@ if ($resultOperationDB !== null) {
break;
case 'SLA':
$err .= 'You must enter some character in SLA limit field';
$err .= 'No changes found.';
default:
$err .= '';
break;
@ -3869,7 +3892,7 @@ if ($resultOperationDB !== null) {
ui_print_result_message(
$resultOperationDB,
__('Successfull action'),
__('Unsuccessful action<br><br>'.$err)
__($err)
);
}

View File

@ -182,7 +182,7 @@ if ($layoutDatas === false) {
$alternativeStyle = true;
$parents = visual_map_get_items_parents($idVisualConsole);
$x = 0;
foreach ($layoutDatas as $layoutData) {
$idLayoutData = $layoutData['id'];
@ -537,7 +537,8 @@ foreach ($layoutDatas as $layoutData) {
$table->data[($i + 1)][5] = '';
$table->data[($i + 1)][5] .= html_print_checkbox('multiple_delete_items', $idLayoutData, false, true);
$table->data[($i + 1)][5] .= '<a href="'.$url_delete.'" '.'onclick="javascript: if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).'</a>';
$table->data[($i + 1)][5] .= '<a href="'.$url_delete.'"onclick="javascript: if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).'</a>';
$table->data[($i + 1)][5] .= html_print_input_hidden('updated_'.$idLayoutData, '0', true);
// Second row
$table->data[($i + 2)]['icon'] = '';
@ -778,6 +779,12 @@ foreach ($layoutDatas as $layoutData) {
$alternativeStyle = !$alternativeStyle;
$i = ($i + 3);
$x++;
}
$x = (($x * 13) + 14);
if ($x > ini_get('max_input_vars')) {
ui_print_warning_message(__('You have to change the <b>"max_input_vars"</b> and set bigger value on <b>php.ini</b> for update, there is too much elements to update'));
}
$pure = get_parameter('pure', 0);
@ -888,6 +895,16 @@ ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/');
return false;
});
$('select[id^="image_"], input[name^="width_"], input[name^="height"], input[name^="left_"], input[name^="top_"], select[id^="parent_"], input[id^="agent_"], select[id^="module_"]').change(function(){
var id = $(this).attr('id').split('_')[1];
$('#hidden-updated_'+id).val('1');
});
$('select[id^="map_linked"]').change(function(){
var id = $(this).attr('id').split('_')[2];
$('#hidden-updated_'+id).val('1');
});
defineTinyMCE('#tinyMCE_editor');
$("#dialog_label_editor").hide ()

View File

@ -418,7 +418,6 @@ switch ($activeTab) {
case 'update':
// Update background
$background = get_parameter('background');
$background_color = get_parameter('background_color');
$width = get_parameter('width');
$height = get_parameter('height');
@ -433,10 +432,9 @@ switch ($activeTab) {
db_process_sql_update(
'tlayout',
[
'background' => $background,
'background_color' => $background_color,
'width' => $width,
'height' => $height,
'background' => $background,
'width' => $width,
'height' => $height,
],
['id' => $idVisualConsole]
);
@ -463,62 +461,65 @@ switch ($activeTab) {
foreach ($idsElements as $idElement) {
$id = $idElement['id'];
$values = [];
$values['label'] = get_parameter('label_'.$id, '');
$values['image'] = get_parameter('image_'.$id, '');
$values['width'] = get_parameter('width_'.$id, 0);
$values['height'] = get_parameter('height_'.$id, 0);
$values['pos_x'] = get_parameter('left_'.$id, 0);
$values['pos_y'] = get_parameter('top_'.$id, 0);
switch ($idElement['type']) {
case NETWORK_LINK:
case LINE_ITEM:
continue 2;
$update = get_parameter('updated_'.$id, 0);
if ($update === '1') {
$values = [];
$values['label'] = get_parameter('label_'.$id, '');
$values['image'] = get_parameter('image_'.$id, '');
$values['width'] = get_parameter('width_'.$id, 0);
$values['height'] = get_parameter('height_'.$id, 0);
$values['pos_x'] = get_parameter('left_'.$id, 0);
$values['pos_y'] = get_parameter('top_'.$id, 0);
switch ($idElement['type']) {
case NETWORK_LINK:
case LINE_ITEM:
continue 2;
break;
break;
case SIMPLE_VALUE_MAX:
case SIMPLE_VALUE_MIN:
case SIMPLE_VALUE_AVG:
$values['period'] = get_parameter('period_'.$id, 0);
break;
case SIMPLE_VALUE_MAX:
case SIMPLE_VALUE_MIN:
case SIMPLE_VALUE_AVG:
$values['period'] = get_parameter('period_'.$id, 0);
break;
case MODULE_GRAPH:
$values['period'] = get_parameter('period_'.$id, 0);
unset($values['image']);
break;
case MODULE_GRAPH:
$values['period'] = get_parameter('period_'.$id, 0);
unset($values['image']);
break;
case GROUP_ITEM:
$values['id_group'] = get_parameter('group_'.$id, 0);
break;
case GROUP_ITEM:
$values['id_group'] = get_parameter('group_'.$id, 0);
break;
case CIRCULAR_PROGRESS_BAR:
case CIRCULAR_INTERIOR_PROGRESS_BAR:
case PERCENTILE_BUBBLE:
case PERCENTILE_BAR:
unset($values['height']);
break;
case CIRCULAR_PROGRESS_BAR:
case CIRCULAR_INTERIOR_PROGRESS_BAR:
case PERCENTILE_BUBBLE:
case PERCENTILE_BAR:
unset($values['height']);
break;
}
$agentName = get_parameter('agent_'.$id, '');
if (defined('METACONSOLE')) {
$values['id_metaconsole'] = (int) get_parameter('id_server_id_'.$id, '');
$values['id_agent'] = (int) get_parameter('id_agent_'.$id, 0);
} else {
$agent_id = (int) get_parameter('id_agent_'.$id, 0);
$values['id_agent'] = $agent_id;
}
$values['id_agente_modulo'] = get_parameter('module_'.$id, 0);
$values['id_custom_graph'] = get_parameter('custom_graph_'.$id, 0);
$values['parent_item'] = get_parameter('parent_'.$id, 0);
$values['id_layout_linked'] = get_parameter('map_linked_'.$id, 0);
if (enterprise_installed()) {
enterprise_visual_map_update_action_from_list_elements($type, $values, $id);
}
db_process_sql_update('tlayout_data', $values, ['id' => $id]);
}
$agentName = get_parameter('agent_'.$id, '');
if (defined('METACONSOLE')) {
$values['id_metaconsole'] = (int) get_parameter('id_server_id_'.$id, '');
$values['id_agent'] = (int) get_parameter('id_agent_'.$id, 0);
} else {
$agent_id = (int) get_parameter('id_agent_'.$id, 0);
$values['id_agent'] = $agent_id;
}
$values['id_agente_modulo'] = get_parameter('module_'.$id, 0);
$values['id_custom_graph'] = get_parameter('custom_graph_'.$id, 0);
$values['parent_item'] = get_parameter('parent_'.$id, 0);
$values['id_layout_linked'] = get_parameter('map_linked_'.$id, 0);
if (enterprise_installed()) {
enterprise_visual_map_update_action_from_list_elements($type, $values, $id);
}
db_process_sql_update('tlayout_data', $values, ['id' => $id]);
}
break;
@ -837,12 +838,6 @@ $buttons['wizard'] = [
'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>',
];
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'] = [
'active' => false,

View File

@ -53,6 +53,12 @@ function get_wiz_class($str)
case 'deploymentCenter':
return 'DeploymentCenter';
case 'magextensions':
return 'ManageExtensions';
case 'custom':
return 'Custom';
default:
// Main, show header.
ui_print_standard_header(
@ -161,7 +167,7 @@ if ($classname_selected === null) {
$wiz_data = [];
foreach ($classes as $classpath) {
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;
}
}
@ -169,6 +175,12 @@ if ($classname_selected === null) {
$classname = basename($classpath, '.class.php');
$obj = new $classname();
if (method_exists($obj, 'isEmpty') === true) {
if ($obj->isEmpty() === true) {
continue;
}
}
$button = $obj->load();
if ($button === false) {

View File

@ -45,9 +45,120 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
if (isset($_GET['server']) === true) {
$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.
ui_print_standard_header(
__('Update Server'),
$title,
'images/gm_servers.png',
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">';
html_print_input_hidden('server', $id_server);
@ -212,7 +321,7 @@ if (isset($_GET['server']) === true) {
false,
'servers',
true,
[],
$buttons,
[
[
'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_label_input_block(
__('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->colspan['plugin_preview_inputs'][0] = 2;

View File

@ -28,6 +28,7 @@
// Begin.
require_once 'include/functions_clippy.php';
require_once 'pending_alerts_list.php';
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) {
$data = [];
@ -185,14 +193,12 @@ foreach ($servers as $server) {
$data[7] = ui_print_timestamp($server['keepalive'], true);
$ext = '_server';
if ($server['type'] != 'data') {
$ext = '';
if ($server['type'] === 'data') {
$ext = '_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()) {
$names_servers[$safe_server_name] = true;
} else {
@ -242,6 +248,19 @@ foreach ($servers as $server) {
$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] .= html_print_image(
'images/edit.svg',
@ -253,7 +272,7 @@ foreach ($servers as $server) {
);
$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] .= html_print_image(
'images/agents@svg.svg',
@ -298,6 +317,8 @@ foreach ($servers as $server) {
unset($data[8]);
}
$ext = '';
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(
'images/delete.svg',
true,
['class' => 'invert_filter']
[
'class' => 'invert_filter main_menu_icon',
'title' => __('Delete'),
]
).'</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.
ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/');
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">
@ -443,8 +446,12 @@ ui_require_javascript_file('pandora');
changeYear: true,
showAnim: "slideDown"}
);
defineTinyMCE('#textarea_text');
var consoleStyle = $("#hidden-selected_style_theme").val();
if (consoleStyle == "pandora_black") {
defineTinyMCEDark('#textarea_text');
} else {
defineTinyMCE('#textarea_text');
}
$("#checkbox-expire").click(function() {
check_expire();
@ -462,5 +469,4 @@ ui_require_javascript_file('pandora');
$('#news-0-4').css('visibility', 'hidden');
}
}
</script>

View File

@ -132,7 +132,15 @@ foreach ($osList as $os) {
$data[] = html_print_anchor(
[
'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
);

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()) {
$table->data[7][0] = html_print_label_input_block(
$table->data[6][1] = html_print_label_input_block(
__('Max. days before delete inventory data'),
html_print_input_text(
'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->width = '100%';
$table_other->class = 'filter-table-adv';

View File

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

View File

@ -747,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 '<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->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(
__('Default cache expiration'),
html_print_extended_select_for_time(
@ -1372,7 +1361,6 @@ $table_vc->data[$row][] = html_print_label_input_block(
$intervals
)
);
$row++;
$table_vc->data[$row][] = html_print_label_input_block(
__('Default interval for refresh on Visual Console'),
@ -1388,6 +1376,7 @@ $table_vc->data[$row][] = html_print_label_input_block(
false
)
);
$row++;
$table_vc->data[$row][] = html_print_label_input_block(
__('Type of view of visual consoles'),
@ -1401,12 +1390,12 @@ $table_vc->data[$row][] = html_print_label_input_block(
true
)
);
$row++;
$table_vc->data[$row][] = html_print_label_input_block(
__('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'>"
);
$row++;
$table_vc->data[$row][] = html_print_label_input_block(
__('Default line thickness for the Visual Console'),
@ -1419,7 +1408,6 @@ $table_vc->data[$row][] = html_print_label_input_block(
true
)
);
$row++;
$table_vc->data[$row][] = html_print_label_input_block(
__('Lock screen orientation when viewing on mobile devices'),
@ -1430,6 +1418,7 @@ $table_vc->data[$row][] = html_print_label_input_block(
true
)
);
$row++;
$table_vc->data[$row][] = html_print_label_input_block(
__('Display item frame on alert triggered'),
@ -1783,7 +1772,9 @@ $table_other->data[$row][] = html_print_label_input_block(
100,
true
).ui_print_input_placeholder(
__('Example').': '.date($config['date_format']),
__('Example').': '.date(
str_replace('&#x20;', ' ', $config['date_format'])
),
true
)
);
@ -1936,7 +1927,7 @@ $table_other->data[$row][] = html_print_label_input_block(
).html_print_div(
[
'class' => '',
'content' => __('Interval').html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false, '', false, 'width: 100%'),
'content' => __('Interval').html_print_select($units, 'interval_unit', '', '', '', '', true, false, false, '', false, 'width: 100%'),
],
true
).html_print_button(
@ -1984,7 +1975,7 @@ $table_other->data[$row][] = html_print_label_input_block(
).html_print_button(
__('Delete'),
'interval_del_btn',
empty($config['interval_values']),
false,
'',
[
'mode' => 'link',
@ -2018,7 +2009,7 @@ $table_other->data[$row][] = html_print_label_input_block(
).html_print_div(
[
'class' => '',
'content' => __('Interval').html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false, '', false, 'width: 100%'),
'content' => __('Interval').html_print_select($units, 'module_interval_unit', 1, '', '', '', true, false, false, '', false, 'width: 100%'),
],
true
).html_print_button(
@ -2325,9 +2316,15 @@ $(document).ready (function () {
// CUSTOM INTERVAL VALUES
//------------------------------------------------------------------
$("#button-interval_del_btn").click( function() {
var interval_selected = $('#intervals option:selected').val();
$('#hidden-interval_to_delete').val(interval_selected);
$('#submit-update_button').trigger('click');
confirmDialog({
title: "<?php echo __('Delete interval'); ?>",
message: "<?php echo __('This action is not reversible. Are you sure'); ?>",
onAccept: function() {
var interval_selected = $('#intervals option:selected').val();
$('#hidden-interval_to_delete').val(interval_selected);
$('#button-update_button').trigger('click');
}
});
});
$("#button-interval_add_btn").click( function() {

View File

@ -786,7 +786,7 @@ if ($create_alert || $update_alert) {
2,
2,
$custom_value,
'class="w100p"',
'class="w100p" required="required"',
true
)
);
@ -804,6 +804,8 @@ if ($create_alert || $update_alert) {
'',
50,
255,
true,
false,
true
)
);
@ -818,6 +820,8 @@ if ($create_alert || $update_alert) {
'',
20,
255,
true,
false,
true
)
);
@ -2002,6 +2006,7 @@ if ($create_alert || $update_alert) {
'alt' => __('Update'),
'border' => 0,
'class' => 'main_menu_icon',
'title' => __('Edit'),
]
),
],
@ -2170,24 +2175,11 @@ if ($create_alert || $update_alert) {
echo '</form>';
}
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>';
$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;
$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) {
if ($count == $half) {
$legend .= '</div><div class="mrgn_lft_5px flex-50">';
@ -2198,11 +2190,24 @@ if ($create_alert || $update_alert) {
$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);

View File

@ -50,7 +50,7 @@ try {
[
'id' => $tableId,
'class' => 'info_table',
'style' => 'width: 99%',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'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) {
// 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(
[
'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');
$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) {
return $this->deleteConsoleTask();
}
@ -163,7 +168,10 @@ class DiscoveryTaskList extends HTML
}
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) {
@ -287,6 +295,10 @@ class DiscoveryTaskList extends HTML
}
$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) {
// --------------------------------
@ -352,6 +364,10 @@ class DiscoveryTaskList extends HTML
}
$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) {
$result = db_process_sql_update(
@ -505,9 +521,13 @@ class DiscoveryTaskList extends HTML
/**
* 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.
*/
public function showList()
public function showList($titleTable, $filter, $extension_section=false)
{
global $config;
@ -531,7 +551,16 @@ class DiscoveryTaskList extends HTML
include_once $config['homedir'].'/include/functions_network_profiles.php';
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 {
$user_groups = implode(
',',
@ -539,9 +568,14 @@ class DiscoveryTaskList extends HTML
);
$recon_tasks = db_get_all_rows_sql(
sprintf(
'SELECT * FROM trecon_task
WHERE id_group IN (%s)',
$user_groups
'SELECT tasks.*, apps.section AS section, apps.short_name AS short_name
FROM trecon_task
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;
}
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')) {
$data[0] = '<span class="link" onclick="force_task(\'';
$data[0] .= ui_get_full_url(
@ -682,7 +718,9 @@ class DiscoveryTaskList extends HTML
);
$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(
__('This task has not been completely defined, please edit it'),
true
@ -843,6 +881,19 @@ class DiscoveryTaskList extends HTML
$data[6] .= __('Discovery.App.Microsoft SQL Server');
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:
default:
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_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] .= html_print_image(
'images/web@groups.svg',
@ -999,13 +1050,24 @@ class DiscoveryTaskList extends HTML
).'</a>';
}
} 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.
$data[9] .= '<a href="'.ui_get_full_url(
sprintf(
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
$this->getTargetWiz($task, $recon_script_data),
$task['id_rt']
)
$url_edit
).'">'.html_print_image(
'images/edit.svg',
true,
@ -1069,7 +1131,7 @@ class DiscoveryTaskList extends HTML
$return = true;
}
ui_toggle($content, __('Server Tasks'), '', '', false);
ui_toggle($content, $titleTable, '', '', false);
// Div neccesary for modal map task.
echo '<div id="map_task" class="invisible"></div>';
@ -1096,9 +1158,9 @@ class DiscoveryTaskList extends HTML
*
* @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]);
}
@ -1227,7 +1289,7 @@ class DiscoveryTaskList extends HTML
($task['status'] < 0) ? 100 : $task['status'],
150,
150,
'#3A3A3A',
'#14524f',
'%',
'',
'#ececec',
@ -1297,7 +1359,7 @@ class DiscoveryTaskList extends HTML
$task['stats']['c_network_percent'],
150,
150,
'#3A3A3A',
'#14524f',
'%',
'',
'#ececec',
@ -1340,14 +1402,14 @@ class DiscoveryTaskList extends HTML
$output = '';
if (is_array($task['stats']) === false) {
$task['stats'] = json_decode($task['summary'], true);
if (is_array($task['stats']) === false && (int) $task['type'] !== DISCOVERY_EXTENSION) {
$task['stats'] = json_decode(io_safe_output($task['summary']), true);
if (json_last_error() !== JSON_ERROR_NONE) {
return $task['summary'];
}
}
if (is_array($task['stats'])) {
if (is_array($task['stats']) || (int) $task['type'] === DISCOVERY_EXTENSION) {
$i = 0;
$table = new StdClasS();
$table->class = 'databox data';
@ -1405,6 +1467,65 @@ class DiscoveryTaskList extends HTML
$table->data[$i][1] = '<span id="alive">';
$table->data[$i][1] .= ($total - $agents);
$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 {
// Content.
if (is_array($task['stats']['summary']) === true) {
@ -1466,7 +1587,7 @@ class DiscoveryTaskList extends HTML
}
$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);
$output = '';
@ -1859,7 +1980,11 @@ class DiscoveryTaskList extends HTML
if ($task['status'] <= 0
&& empty($task['summary']) === false
) {
$status = __('Done');
if ($task['status'] == -2) {
$status = __('Failed');
} else {
$status = __('Done');
}
} else if ($task['utimestamp'] == 0
&& 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

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