Merge branch 'ent-8217-Comando-Accion-de-alerta-para-enviar-informes' of brutus.artica.es:artica/pandorafms into ent-8217-Comando-Accion-de-alerta-para-enviar-informes

This commit is contained in:
alejandro.campos@artica.es 2022-09-23 13:00:40 +02:00
commit 520a820625
57 changed files with 1011 additions and 147 deletions

View File

@ -282,6 +282,8 @@ server_dependencies=" \
expect \ expect \
openssh-clients \ openssh-clients \
java \ java \
bind-utils \
whois \
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \ http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \ http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \
https://firefly.artica.es/centos7/pandorawmic-1.0.0-1.x86_64.rpm" https://firefly.artica.es/centos7/pandorawmic-1.0.0-1.x86_64.rpm"

View File

@ -338,6 +338,8 @@ server_dependencies=" \
expect \ expect \
openssh-clients \ openssh-clients \
java \ java \
bind-utils \
whois \
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \ http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \ http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \
https://firefly.artica.es/centos8/pandorawmic-1.0.0-1.x86_64.rpm" https://firefly.artica.es/centos8/pandorawmic-1.0.0-1.x86_64.rpm"

View File

@ -0,0 +1,743 @@
#!/bin/bash
##############################################################################################################
# PandoraFMS Community online installation script for Ubuntu 22.04
##############################################################################################################
## Tested versions ##
# Ubuntu 22.04.1
#avoid promps
export DEBIAN_FRONTEND=noninteractive
export NEEDRESTART_SUSPEND=1
#Constants
PANDORA_CONSOLE=/var/www/html/pandora_console
PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
WORKDIR=/opt/pandora/deploy
S_VERSION='2022052501'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables
[ "$TZ" ] || TZ="Europe/Madrid"
[ "$PHPVER" ] || PHPVER=7.4
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
[ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0
[ "$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")
[ "$PANDORA_BETA" ] || PANDORA_BETA=0
# Ansi color code variables
red="\e[0;91m"
green="\e[0;92m"
cyan="\e[0;36m"
reset="\e[0m"
# Functions
execute_cmd () {
local cmd="$1"
local msg="$2"
echo -e "${cyan}$msg...${reset}"
$cmd &>> "$LOGFILE"
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[ "$3" ] && echo "$3"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
rm -rf "$WORKDIR" &>> "$LOGFILE"
exit 1
else
echo -e "\e[1A\e ${cyan}$msg...${reset} ${green}OK${reset}"
return 0
fi
}
check_cmd_status () {
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[ "$1" ] && echo "$1"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
rm -rf "$WORKDIR" &>> "$LOGFILE"
exit 1
else
echo -e "${green}OK${reset}"
return 0
fi
}
check_pre_pandora () {
export MYSQL_PWD=$DBPASS
echo -en "${cyan}Checking environment ... ${reset}"
[ -d "$PANDORA_CONSOLE" ] && local fail=true
[ -f /usr/bin/pandora_server ] && local fail=true
echo "use $DBNAME" | mysql -u$DBUSER -P$DBPORT -h$DBHOST &>> /dev/null && local fail=true
[ ! $fail ]
check_cmd_status 'Error there is a current Pandora FMS installation on this node, please remove it to execute a clean install'
}
check_repo_connection () {
execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo"
execute_cmd "ping -c 2 support.pandorafms.com" "Checking Enterprise repo"
}
check_root_permissions () {
echo -en "${cyan}Checking root account... ${reset}"
if [ "$(whoami)" != "root" ]; then
echo -e "${red}Fail${reset}"
echo "Please use a root account or sudo for installing Pandora FMS"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
exit 1
else
echo -e "${green}OK${reset}"
fi
}
## Main
echo "Starting PandoraFMS Community deployment Ubuntu 22.04 ver. $S_VERSION"
# Ubuntu Version
if [ ! "$(grep -Ei 'Ubuntu' /etc/lsb-release)" ]; then
printf "\n ${red}Error this is not a Ubuntu system, this installer is compatible with Ubuntu systems only${reset}\n"
exit 1
fi
echo -en "${cyan}Check Ubuntu Version...${reset}"
[ $(sed -nr 's/VERSION_ID+=\s*"([0-9][0-9].[0-9][0-9])"$/\1/p' /etc/os-release) == "22.04" ]
check_cmd_status 'Error OS version, Ubuntu 22.04 is expected'
#Detect OS
os_name=$(grep ^PRETTY_NAME= /etc/os-release | cut -d '=' -f2 | tr -d '"')
execute_cmd "echo $os_name" "OS detected: ${os_name}"
# initialice logfile
execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE"
echo "Community installer version: $S_VERSION" >> "$LOGFILE"
# Pre checks
# Root permisions
check_root_permissions
# Pre installed pandora
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
#advicing BETA PROGRAM
[ "$PANDORA_BETA" -ne '0' ] && echo -e "${red}BETA version enable using nightly PandoraFMS packages${reset}"
# Connectivity
check_repo_connection
# Systemd
execute_cmd "systemctl --version" "Checking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env please check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8'
# Check memomry greather or equal to 2G
execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)'
# Check disk size at least 10 Gb free space
execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)'
# Setting timezone
rm -rf /etc/localtime &>> "$LOGFILE"
execute_cmd "timedatectl set-timezone $TZ" "Setting Timezone $TZ"
# Execute tools check
execute_cmd "awk --version" 'Checking needed tools: awk'
execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed'
execute_cmd "apt --version" 'Checking needed tools: dnf'
# Creating working directory
rm -rf "$WORKDIR" &>> "$LOGFILE"
mkdir -p "$WORKDIR" &>> "$LOGFILE"
execute_cmd "cd $WORKDIR" "Moving to workdir: $WORKDIR"
## Install utils
execute_cmd "apt update" "Updating repos"
execute_cmd "apt install -y net-tools vim curl wget software-properties-common apt-transport-https" "Installing utils"
#Installing Apache and php-fpm
[ -e "/etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list" ] || execute_cmd "add-apt-repository ppa:ondrej/php -y" "Enable ppa:ondrej/php repo"
execute_cmd "apt update" "Updating repos"
execute_cmd "apt install -y php$PHPVER-fpm php$PHPVER-common libapache2-mod-fcgid php$PHPVER-cli apache2" "Installing apache and php-fpm"
#execute_cmd "a2enmod proxy_fcgi setenvif && a2enconf php$PHPVER-fpm" "Enabling php-fpm"
echo -en "${cyan}Enabling php$PHPVER-fpm...${reset}"
a2enmod proxy_fcgi setenvif &>> "$LOGFILE" && a2enconf php$PHPVER-fpm &>> "$LOGFILE"
check_cmd_status "Error enabling php$PHPVER-fpm "
systemctl restart php$PHPVER-fpm &>> "$LOGFILE"
# Console dependencies
console_dependencies=" \
ldap-utils \
postfix \
wget \
graphviz \
xfonts-75dpi \
xfonts-100dpi \
xfonts-ayu \
xfonts-intl-arabic \
xfonts-intl-asian \
xfonts-intl-phonetic \
xfonts-intl-japanese-big \
xfonts-intl-european \
xfonts-intl-chinese \
xfonts-intl-japanese \
xfonts-intl-chinese-big \
libzstd1 \
gir1.2-atk-1.0 \
libavahi-common-data \
cairo-perf-utils \
libfribidi-bin \
php$PHPVER-mcrypt \
php$PHPVER-gd \
php$PHPVER-curl \
php$PHPVER-mysql \
php$PHPVER-ldap \
php$PHPVER-fileinfo \
php$PHPVER-gettext \
php$PHPVER-snmp \
php$PHPVER-mbstring \
php$PHPVER-zip \
php$PHPVER-xmlrpc \
php$PHPVER-xml \
php$PHPVER-yaml \
libnet-telnet-perl \
whois"
execute_cmd "apt install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
# Server dependencies
server_dependencies=" \
perl \
nmap \
fping \
sudo \
net-tools \
nfdump \
expect \
openssh-client \
postfix \
unzip \
xprobe \
coreutils \
libio-compress-perl \
libmoosex-role-timer-perl \
libdbd-mysql-perl \
libcrypt-mysql-perl \
libhttp-request-ascgi-perl \
liblwp-useragent-chicaching-perl \
liblwp-protocol-https-perl \
snmp \
libnetaddr-ip-perl \
libio-socket-ssl-perl \
libio-socket-socks-perl \
libio-socket-ip-perl \
libio-socket-inet6-perl \
libnet-telnet-perl \
libjson-perl \
libencode-perl \
libgeo-ip-perl \
openjdk-8-jdk "
execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
# wmic and pandorawmic
execute_cmd "curl -O https://firefly.artica.es/pandorafms/utils/bin/wmic" "Downloading wmic"
execute_cmd "curl -O https://firefly.artica.es/pandorafms/utils/bin/pandorawmic" "Downloading pandorawmic"
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.artica.es/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"
# SDK VMware perl dependencies
vmware_dependencies=" \
lib32z1 \
lib32z1 \
build-essential \
uuid uuid-dev \
libssl-dev \
perl-doc \
libxml-libxml-perl \
libcrypt-ssleay-perl \
libsoap-lite-perl \
libmodule-build-perl"
execute_cmd "apt install -y $vmware_dependencies" "Installing VMware SDK dependencies"
execute_cmd "wget https://firefly.artica.es/pandorafms/utils/VMware-vSphere-Perl-SDK-7.0.0-16453907.x86_64.tar.gz" "Downloading VMware SDK"
echo -en "${cyan}Installing VMware SDK...${reset}"
tar xvzf VMware-vSphere-Perl-SDK-7.0.0-16453907.x86_64.tar.gz &>> "$LOGFILE"
cd vmware-vsphere-cli-distrib/ &>> "$LOGFILE"
sed --follow-symlinks -i -e "s/[^#].*show_EULA().*/ #show_EULA();/g" vmware-install.pl &>> "$LOGFILE"
./vmware-install.pl --default &>> "$LOGFILE"
check_cmd_status "Error Installing VMware SDK"
execute_cmd "cpan Crypt::OpenSSL::AES" "Installing extra vmware dependencie"
cd $WORKDIR &>> "$LOGFILE"
# Instant client Oracle
execute_cmd "mkdir -p /opt/oracle" "Creating Oracle instant client directory /opt/oracle"
execute_cmd "wget https://download.oracle.com/otn_software/linux/instantclient/19800/instantclient-basic-linux.x64-19.8.0.0.0dbru.zip" "Downloading Oracle instant client"
execute_cmd "wget https://download.oracle.com/otn_software/linux/instantclient/19800/instantclient-sqlplus-linux.x64-19.8.0.0.0dbru.zip" "Downloading Oracle sqlplus"
echo -en "${cyan}Installing Oracle instant client...${reset}"
rm -fr /opt/oracle/* &>> "$LOGFILE"
unzip instantclient-basic-linux.x64-19.8.0.0.0dbru.zip -d /opt/oracle/ &>> "$LOGFILE"
unzip instantclient-sqlplus-linux.x64-19.8.0.0.0dbru.zip -d /opt/oracle/ &>> "$LOGFILE"
check_cmd_status "Error Installing Oracle instant client"
#Configuring env variables
cat >> /root/.profile << 'EOF_ENV'
#!/bin/bash
VERSION=19.8
export PATH=$PATH:/opt/oracle/instantclient_19_8
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/oracle/instantclient_19_8
export ORACLE_HOME=/opt/oracle/instantclient_19_8
EOF_ENV
source '/root/.profile' &>> "$LOGFILE"
#ipam dependencies
ipam_dependencies=" \
xprobe \
libnetaddr-ip-perl \
coreutils \
libdbd-mysql-perl \
libxml-simple-perl \
libgeo-ip-perl \
libio-socket-inet6-perl \
libxml-twig-perl \
libnetaddr-ip-perl"
execute_cmd "apt install -y $ipam_dependencies" "Installing IPAM Dependencies"
# MSSQL dependencies el8
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc &>> "$LOGFILE"
curl -sSL https://packages.microsoft.com/config/ubuntu/20.04/prod.list | tee /etc/apt/sources.list.d/microsoft-prod.list &>> "$LOGFILE"
apt update &>> "$LOGFILE"
execute_cmd "env ACCEPT_EULA=Y apt install -y msodbcsql17" "Installing ODBC Driver for Microsoft(R) SQL Server(R)"
MS_ID=$(head -1 /etc/odbcinst.ini | tr -d '[]') &>> "$LOGFILE"
# Disabling apparmor and ufw
systemctl stop ufw.service &>> "$LOGFILE"
systemctl disable ufw &>> "$LOGFILE"
systemctl stop apparmor &>> "$LOGFILE"
systemctl disable apparmor &>> "$LOGFILE"
#install mysql
debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password password $DBROOTPASS") &>> "$LOGFILE"
debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password_again password $DBROOTPASS") &>> "$LOGFILE"
echo -en "${cyan}Installing MySql Server...${reset}"
env DEBIAN_FRONTEND=noninteractive apt install -y mysql-server &>> "$LOGFILE"
check_cmd_status "Error Installing MySql Server"
#Configuring Database
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
execute_cmd "systemctl start mysql" "Starting database engine"
export MYSQL_PWD=$DBROOTPASS
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."
echo "CREATE USER \"$DBUSER\"@'%' IDENTIFIED BY \"$DBPASS\";" | mysql -uroot -P$DBPORT -h$DBHOST
echo "ALTER USER \"$DBUSER\"@'%' IDENTIFIED WITH mysql_native_password BY \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%'" | mysql -uroot -P$DBPORT -h$DBHOST
fi
export MYSQL_PWD=$DBPASS
#Generating my.cnf
cat > /etc/mysql/my.cnf << EOF_DB
[mysqld]
datadir=/var/lib/mysql
user=mysql
character-set-server=utf8
skip-character-set-client-handshake
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Mysql optimizations for Pandora FMS
# Please check the documentation in http://pandorafms.com for better results
max_allowed_packet = 64M
innodb_buffer_pool_size = $POOL_SIZE
innodb_lock_wait_timeout = 90
innodb_file_per_table
innodb_flush_log_at_trx_commit = 0
innodb_flush_method = O_DIRECT
innodb_log_file_size = 64M
innodb_log_buffer_size = 16M
innodb_io_capacity = 100
thread_cache_size = 8
thread_stack = 256K
max_connections = 100
key_buffer_size=4M
read_buffer_size=128K
read_rnd_buffer_size=128K
sort_buffer_size=128K
join_buffer_size=4M
sql_mode=""
log-error=/var/log/mysql/error.log
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
EOF_DB
execute_cmd "systemctl restart mysql" "Configuring and restarting database engine"
#Define packages
if [ "$PANDORA_BETA" -eq '0' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_server-7.0NG.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_console-7.0NG.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_unix-7.0NG.tar.gz"
elif [ "$PANDORA_BETA" -ne '0' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest_x86_64.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_console-latest.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_unix-7.0NG.tar.gz"
fi
# Downloading Pandora Packages
cd $WORKDIR &>> "$LOGFILE"
curl -LSs --output pandorafms_console-7.0NG.tar.gz "${PANDORA_CONSOLE_PACKAGE}" &>> "$LOGFILE"
curl -LSs --output pandorafms_server-7.0NG.tar.gz "${PANDORA_SERVER_PACKAGE}" &>> "$LOGFILE"
curl -LSs --output pandorafms_agent_unix-7.0NG.tar.gz "${PANDORA_AGENT_PACKAGE}" &>> "$LOGFILE"
# Install PandoraFMS Console
echo -en "${cyan}Installing PandoraFMS Console...${reset}"
tar xvzf pandorafms_console-7.0NG.tar.gz &>> "$LOGFILE" && cp -Ra pandora_console /var/www/html/ &>> "$LOGFILE"
check_cmd_status "Error installing PandoraFMS Console"
rm -f $PANDORA_CONSOLE/*.spec &>> "$LOGFILE"
# Install Pandora FMS Server
echo -en "${cyan}Installing PandoraFMS Server...${reset}"
useradd pandora &>> "$LOGFILE"
tar xvfz $WORKDIR/pandorafms_server-7.0NG.tar.gz &>> $LOGFILE && cd pandora_server && ./pandora_server_installer --install &>> $LOGFILE && cd $WORKDIR &>> $LOGFILE
check_cmd_status "Error installing PandoraFMS Server"
#Install agent:
execute_cmd "apt install -y libyaml-tiny-perl perl coreutils wget curl unzip procps python3 python3-pip" "Installing PandoraFMS Agent Dependencies"
echo -en "${cyan}Installing PandoraFMS Agent...${reset}"
tar xvzf $WORKDIR/pandorafms_agent_unix-7.0NG.tar.gz &>> "$LOGFILE" && cd unix && ./pandora_agent_installer --install &>> $LOGFILE && cp -a tentacle_client /usr/local/bin/ &>> $LOGFILE && cd $WORKDIR
check_cmd_status "Error installing PandoraFMS Agent"
# Copy gotty utility
cd $WORKDIR &>> "$LOGFILE"
execute_cmd "wget https://pandorafms.com/library/wp-content/uploads/2019/11/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
# Config servicesa
#Configure apache2
#Enable SSL connections
cat > /etc/apache2/conf-available/ssl-params.conf << EOF_PARAM
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLHonorCipherOrder On
Header always set X-Frame-Options DENY
Header always set X-Content-Type-Options nosniff
# Requires Apache >= 2.4
SSLCompression off
SSLUseStapling on
SSLStaplingCache "shmcb:logs/stapling-cache(150000)"
# Requires Apache >= 2.4.11
SSLSessionTickets Off
EOF_PARAM
a2enmod ssl &>> "$LOGFILE"
a2enmod headers &>> "$LOGFILE"
a2enconf ssl-params &>> "$LOGFILE"
a2ensite default-ssl &>> "$LOGFILE"
a2enconf ssl-params &>> "$LOGFILE"
apache2ctl configtest &>> "$LOGFILE"
execute_cmd "systemctl restart apache2" "Enable SSL mod and Restarting Apache2"
execute_cmd "systemctl enable mysql --now" "Enabling Database service"
execute_cmd "systemctl enable apache2 --now" "Enabling Apache2 service"
execute_cmd "systemctl enable php$PHPVER-fpm --now" "Enabling php$PHPVER-fpm service"
# Populate Database
echo -en "${cyan}Loading pandoradb.sql to $DBNAME database...${reset}"
mysql -u$DBUSER -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb.sql &>> "$LOGFILE"
check_cmd_status 'Error Loading database schema'
echo -en "${cyan}Loading pandoradb_data.sql to $DBNAME database...${reset}"
mysql -u$DBUSER -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb_data.sql &>> "$LOGFILE"
check_cmd_status 'Error Loading database schema data'
# Configure console
# Set console config file
cat > $PANDORA_CONSOLE/include/config.php << EO_CONFIG_F
<?php
\$config["dbtype"] = "mysql";
\$config["dbname"]="$DBNAME";
\$config["dbuser"]="$DBUSER";
\$config["dbpass"]="$DBPASS";
\$config["dbhost"]="$DBHOST";
\$config["homedir"]="$PANDORA_CONSOLE";
\$config["homeurl"]="/pandora_console";
error_reporting(0);
\$ownDir = dirname(__FILE__) . '/';
include (\$ownDir . "config_process.php");
EO_CONFIG_F
#Enable allow Override
cat > /etc/apache2/conf-enabled/pandora_security.conf << EO_CONFIG_F
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
EO_CONFIG_F
#Enable quickshell proxy
cat >> /etc/apache2/mods-enabled/00-proxy.conf << 'EO_HTTPD_WSTUNNEL'
ProxyRequests Off
<Proxy *>
Require all granted
</Proxy>
ProxyPass /ws ws://127.0.0.1:8080
ProxyPassReverse /ws ws://127.0.0.1:8080
EO_HTTPD_WSTUNNEL
# Fixing console permissions
chmod 600 $PANDORA_CONSOLE/include/config.php &>> "$LOGFILE"
chown -R www-data:www-data $PANDORA_CONSOLE &>> "$LOGFILE"
mv $PANDORA_CONSOLE/install.php $PANDORA_CONSOLE/install.done &>> "$LOGFILE"
# Prepare php.ini
## Prepare php config
ln -s /etc/php/$PHPVER/fpm/php.ini /etc/
sed --follow-symlinks -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini
sed --follow-symlinks -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini
sed --follow-symlinks -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini
sed --follow-symlinks -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini
sed --follow-symlinks -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
sed --follow-symlinks -i -e "s/^disable_functions/;disable_functions/" /etc/php.ini
#adding 900s to httpd timeout
#echo 'TimeOut 900' > /etc/httpd/conf.d/timeout.conf
cat > /var/www/html/index.html << EOF_INDEX
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">
EOF_INDEX
execute_cmd "systemctl restart apache2" "Restarting apache2 after configuration"
execute_cmd "systemctl restart php$PHPVER-fpm" "Restarting php$PHPVER-fpm after configuration"
# prepare snmptrapd
cat > /etc/snmp/snmptrapd.conf << EOF
authCommunity log public
disableAuthorization yes
EOF
# Prepare Server conf
sed -i -e "s/^dbhost.*/dbhost $DBHOST/g" $PANDORA_SERVER_CONF
sed -i -e "s/^dbname.*/dbname $DBNAME/g" $PANDORA_SERVER_CONF
sed -i -e "s/^dbuser.*/dbuser $DBUSER/g" $PANDORA_SERVER_CONF
sed -i -e "s|^dbpass.*|dbpass $DBPASS|g" $PANDORA_SERVER_CONF
sed -i -e "s/^dbport.*/dbport $DBPORT/g" $PANDORA_SERVER_CONF
sed -i -e "s/^#.mssql_driver.*/mssql_driver $MS_ID/g" $PANDORA_SERVER_CONF
# Adding group www-data to pandora server conf.
grep -q "group www-data" $PANDORA_SERVER_CONF || \
cat >> $PANDORA_SERVER_CONF << EOF_G
#Adding group www-data to assing remote-config permission correctly for ubuntu 22.04
group www-data
EOF_G
# Enable agent remote config
sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF
# Set Oracle environment for pandora_server
cat > /etc/pandora/pandora_server.env << 'EOF_ENV'
#!/bin/bash
VERSION=19.8
export PATH=$PATH:/opt/oracle/instantclient_19_8
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/oracle/instantclient_19_8
export ORACLE_HOME=/opt/oracle/instantclient_19_8
export OPENSSL_CONF=/etc/ssl
EOF_ENV
# Kernel optimization
if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then
cat >> /etc/sysctl.conf <<EO_KO
# Pandora FMS Optimization
# default=5
net.ipv4.tcp_syn_retries = 3
# default=5
net.ipv4.tcp_synack_retries = 3
# default=1024
net.ipv4.tcp_max_syn_backlog = 65536
# default=124928
net.core.wmem_max = 8388608
# default=131071
net.core.rmem_max = 8388608
# default = 128
net.core.somaxconn = 1024
# default = 20480
net.core.optmem_max = 81920
EO_KO
[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
fi
# Fix pandora_server.{log,error} permissions to allow Console check them
chown pandora:www-data /var/log/pandora
chmod g+s /var/log/pandora
cat > /etc/logrotate.d/pandora_server <<EO_LR
/var/log/pandora/pandora_server.log
/var/log/pandora/web_socket.log
/var/log/pandora/pandora_server.error {
su root apache
weekly
missingok
size 300000
rotate 3
maxage 90
compress
notifempty
copytruncate
create 660 pandora apache
}
/var/log/pandora/pandora_snmptrap.log {
su root apache
weekly
missingok
size 500000
rotate 1
maxage 30
notifempty
copytruncate
create 660 pandora apache
}
EO_LR
cat > /etc/logrotate.d/pandora_agent <<EO_LRA
/var/log/pandora/pandora_agent.log {
su root apache
weekly
missingok
size 300000
rotate 3
maxage 90
compress
notifempty
copytruncate
}
EO_LRA
chmod 0644 /etc/logrotate.d/pandora_server
chmod 0644 /etc/logrotate.d/pandora_agent
# Add websocket engine start script.
mv /var/www/html/pandora_console/pandora_websocket_engine /etc/init.d/ &>> "$LOGFILE"
chmod +x /etc/init.d/pandora_websocket_engine
# Start Websocket engine
/etc/init.d/pandora_websocket_engine start &>> "$LOGFILE"
# Configure websocket to be started at start.
systemctl enable pandora_websocket_engine &>> "$LOGFILE"
# Enable pandora ha service
execute_cmd "/etc/init.d/pandora_server start" "Starting Pandora FMS Server"
systemctl enable pandora_server &>> "$LOGFILE"
# starting tentacle server
execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
systemctl enable tentacle_serverd &>> "$LOGFILE"
# Enabling condole cron
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
## Enabling agent adn configuring Agente
sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF &>> "$LOGFILE"
execute_cmd "/etc/init.d/pandora_agent_daemon start" "Starting PandoraFSM Agent"
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"
#SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)
cat > /etc/issue.net << EOF_banner
Welcome to Pandora FMS appliance on CentOS
------------------------------------------
Go to Public http://$ipplublic/pandora_console$to to login web console
$(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to Local http://"$1"/pandora_console to login web console"}')
You can find more information at http://pandorafms.com
EOF_banner
rm -f /etc/issue
ln -s /etc/issue.net /etc/issue
echo 'Banner /etc/issue.net' >> /etc/ssh/sshd_config
# Remove temporary files
execute_cmd "echo done" "Pandora FMS Community installed"
cd "$HOME"
execute_cmd "rm -rf $WORKDIR" "Removing temporary files"
# Print nice finish message
GREEN='\033[01;32m'
NONE='\033[0m'
printf " -> Go to Public ${green}http://"$ipplublic"/pandora_console${reset} to manage this server"
ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v -e "172.1[0-9].0.1" | awk '{print $2}' | awk -v g=$GREEN -v n=$NONE -F '/' '{printf "\n -> Go to Local "g"http://"$1"/pandora_console"n" to manage this server \n -> Use these credentials to log in Pandora Console "g"[ User: admin / Password: pandora ]"n" \n"}'

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.764-220907 Version: 7.0NG.764-220923
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.764" PI_VERSION="7.0NG.764"
PI_BUILD="220907" PI_BUILD="220923"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{220907} {220923}
ViewReadme ViewReadme
{Yes} {Yes}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.764-220907 Version: 7.0NG.764-220923
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

File diff suppressed because one or more lines are too long

View File

@ -1052,9 +1052,10 @@ if ($update_agent) {
$exists_ip = db_get_row_sql($sql); $exists_ip = db_get_row_sql($sql);
} }
$old_group = agents_get_agent_group($id_agente);
if ($grupo <= 0) { if ($grupo <= 0) {
ui_print_error_message(__('The group id %d is incorrect.', $grupo)); ui_print_error_message(__('The group id %d is incorrect.', $grupo));
} else if (group_allow_more_agents($grupo, true, 'update') === false) { } else if ($old_group !== $grupo && group_allow_more_agents($grupo, true, 'update') === false) {
ui_print_error_message(__('Agent cannot be updated due to the maximum agent limit for this group')); ui_print_error_message(__('Agent cannot be updated due to the maximum agent limit for this group'));
} else if ($exists_ip) { } else if ($exists_ip) {
ui_print_error_message(__('Duplicate main IP address')); ui_print_error_message(__('Duplicate main IP address'));

View File

@ -880,7 +880,7 @@ $table->data[4][1] = html_print_select(
[ [
'once' => __('Once'), 'once' => __('Once'),
'periodically' => __('Periodically'), 'periodically' => __('Periodically'),
'cron' => __('Cron from/to'), 'cron' => __('Cron from/to'),
], ],
'type_execution', 'type_execution',
$type_execution, $type_execution,

View File

@ -114,11 +114,6 @@ if ($satellite_options != ENTERPRISE_NOT_HOOK) {
$options_satellite = array_merge($options_satellite, $satellite_options); $options_satellite = array_merge($options_satellite, $satellite_options);
} }
$options_services = enterprise_hook('massive_services_options');
if ($options_services === ENTERPRISE_NOT_HOOK) {
$options_services = [];
}
if (in_array($option, array_keys($options_alerts)) === true) { if (in_array($option, array_keys($options_alerts)) === true) {
$tab = 'massive_alerts'; $tab = 'massive_alerts';
@ -136,8 +131,6 @@ if (in_array($option, array_keys($options_alerts)) === true) {
$tab = 'massive_satellite'; $tab = 'massive_satellite';
} else if (in_array($option, array_keys($options_plugins)) === true) { } else if (in_array($option, array_keys($options_plugins)) === true) {
$tab = 'massive_plugins'; $tab = 'massive_plugins';
} else if (in_array($option, array_keys($options_services)) === true) {
$tab = 'massive_services';
} }
if ($tab === 'massive_agents' && empty($option) === true) { if ($tab === 'massive_agents' && empty($option) === true) {
@ -206,10 +199,6 @@ switch ($tab) {
$options = $options_plugins; $options = $options_plugins;
break; break;
case 'massive_services':
$options = $options_services;
break;
default: default:
// Default. // Default.
break; break;
@ -298,12 +287,6 @@ if ($satellitetab == ENTERPRISE_NOT_HOOK) {
$satellitetab = ''; $satellitetab = '';
} }
$servicestab = enterprise_hook('massive_services_tab');
if ($servicestab == ENTERPRISE_NOT_HOOK) {
$servicestab = '';
}
$onheader = []; $onheader = [];
$onheader['massive_agents'] = $agentstab; $onheader['massive_agents'] = $agentstab;
$onheader['massive_modules'] = $modulestab; $onheader['massive_modules'] = $modulestab;

View File

@ -211,7 +211,6 @@ if ($access_console_node === true) {
enterprise_hook('massivepolicies_submenu'); enterprise_hook('massivepolicies_submenu');
enterprise_hook('massivesnmp_submenu'); enterprise_hook('massivesnmp_submenu');
enterprise_hook('massivesatellite_submenu'); enterprise_hook('massivesatellite_submenu');
enterprise_hook('massiveservices_submenu');
$sub['gmassive']['sub2'] = $sub2; $sub['gmassive']['sub2'] = $sub2;
$sub2 = []; $sub2 = [];

View File

@ -3874,6 +3874,7 @@ $class = 'databox filters';
} else { } else {
$rows_select = modules_get_modulegroups(); $rows_select = modules_get_modulegroups();
} }
html_print_select($rows_select, 'modulegroup', $modulegroup, '', __($is_none), -1, true, false, true, '', false, 'width: 120px;'); html_print_select($rows_select, 'modulegroup', $modulegroup, '', __($is_none), -1, true, false, true, '', false, 'width: 120px;');
html_print_select( html_print_select(
$rows_select, $rows_select,

View File

@ -34,7 +34,7 @@ check_login();
if (is_ajax()) { if (is_ajax()) {
$test_address = get_parameter('test_address', ''); $test_address = get_parameter('test_address', '');
$params = get_parameter('params', ''); $params = io_safe_output(get_parameter('params', ''));
$res = send_test_email( $res = send_test_email(
$test_address, $test_address,

View File

@ -914,7 +914,7 @@ class HostDevices extends Wizard
'hidden' => (($this->task['subnet_csv'] == '1') ? 1 : 0), 'hidden' => (($this->task['subnet_csv'] == '1') ? 1 : 0),
'id' => 'std_subnet', 'id' => 'std_subnet',
'label' => '<b>'.__('Network').':</b>'.ui_print_help_tip( 'label' => '<b>'.__('Network').':</b>'.ui_print_help_tip(
__('You can specify several networks, separated by commas, for example: 192.168.50.0/24,192.168.60.0/24'), __('You can specify networks or fully qualified domain names of a specific host, separated by commas, for example: 192.168.50.0/24,192.168.60.0/24, hostname.artica.es'),
true true
), ),
'arguments' => [ 'arguments' => [

View File

@ -2215,7 +2215,9 @@ class ConsoleSupervisor
'type' => 'NOTIF.MISC.FONTPATH', 'type' => 'NOTIF.MISC.FONTPATH',
'title' => __('Default font doesn\'t exist'), 'title' => __('Default font doesn\'t exist'),
'message' => __('Your defined font doesn\'t exist or is not defined. Please, check font parameters in your config'), 'message' => __('Your defined font doesn\'t exist or is not defined. Please, check font parameters in your config'),
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup&section=vis', 'url' => is_metaconsole() === false
? '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup&section=vis'
: '__url__/index.php?sec=advanced&sec2=advanced/metasetup&tab=visual',
] ]
); );
} else { } else {

View File

@ -651,6 +651,12 @@ class ExternalTools extends HTML
} }
break; break;
case 'whois':
if (empty($snmpget_path) === false) {
return $snmpget_path;
}
break;
default: default:
return null; return null;
} }
@ -829,6 +835,7 @@ class ExternalTools extends HTML
if (empty($dig) === true) { if (empty($dig) === true) {
ui_print_error_message(__('Dig executable does not exist.')); ui_print_error_message(__('Dig executable does not exist.'));
} else { } else {
$dig .= ' '.$ip;
$this->performExecution($dig); $this->performExecution($dig);
} }
@ -837,6 +844,7 @@ class ExternalTools extends HTML
if (empty($whois) === true) { if (empty($whois) === true) {
ui_print_error_message(__('Whois executable does not exist.')); ui_print_error_message(__('Whois executable does not exist.'));
} else { } else {
$whois .= ' '.$ip;
$this->performExecution($whois); $this->performExecution($whois);
} }

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Configuraton sample file. * Configuraton sample file.
* *
@ -38,6 +39,11 @@
* $config["homedir"]="/var/www/pandora_console/"; * $config["homedir"]="/var/www/pandora_console/";
* $config["homeurl"]="/pandora_console/"; * $config["homeurl"]="/pandora_console/";
* $config["auth"]["scheme"] = "mysql"; * $config["auth"]["scheme"] = "mysql";
*
* This is used to configure MySQL SSL console connection
* $config["dbssl"]=0;
* $config["dbsslcafile"]="/path/ca-cert.pem";
* $config["sslverifyservercert"]=1;
*/ */
// By default report any error but notices. // By default report any error but notices.

View File

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

View File

@ -31,7 +31,9 @@ function mysql_connect_db(
$user=null, $user=null,
$pass=null, $pass=null,
$port=null, $port=null,
$charset=null $charset=null,
$ssl=null,
$verify=null
) { ) {
global $config; global $config;
@ -55,6 +57,14 @@ function mysql_connect_db(
$port = $config['dbport']; $port = $config['dbport'];
} }
if ($ssl === null && (bool) $config['dbssl'] === true) {
$ssl = $config['dbsslcafile'];
}
if ($verify === null && (bool) $config['sslverifyservercert'] === true) {
$verify = 'verified';
}
// Check if mysqli is available // Check if mysqli is available
if (!isset($config['mysqli'])) { if (!isset($config['mysqli'])) {
$config['mysqli'] = extension_loaded(mysqli); $config['mysqli'] = extension_loaded(mysqli);
@ -63,22 +73,39 @@ function mysql_connect_db(
// Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems // Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems
// If you want persistent connections change it to mysql_pconnect(). // If you want persistent connections change it to mysql_pconnect().
if ($config['mysqli']) { if ($config['mysqli']) {
$connect_id = mysqli_connect($host, $user, $pass, $db, $port); if (empty($ssl)) {
if (mysqli_connect_errno() > 0) { $connect_id = mysqli_connect($host, $user, $pass, $db, $port);
include 'general/mysqlerr.php'; if (mysqli_connect_errno() > 0) {
return false; include 'general/mysqlerr.php';
return false;
}
db_change_cache_id($db, $host);
if (isset($charset)) {
mysqli_set_charset($connect_id, $charset);
}
mysqli_select_db($connect_id, $db);
} else {
$connect_id = mysqli_init();
mysqli_ssl_set($connect_id, null, null, $ssl, null, null);
if ($verify === 'verified') {
mysqli_real_connect($connect_id, $host, $user, $pass, $db, $port, null, MYSQLI_CLIENT_SSL);
} else {
mysqli_real_connect($connect_id, $host, $user, $pass, $db, $port, null, MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT);
}
if (mysqli_connect_errno() > 0) {
include 'general/mysqlerr.php';
return false;
}
} }
db_change_cache_id($db, $host);
if (isset($charset)) {
mysqli_set_charset($connect_id, $charset);
}
mysqli_select_db($connect_id, $db);
} else { } else {
$connect_id = @mysql_connect($host.':'.$port, $user, $pass, true); $connect_id = @mysql_connect($host.':'.$port, $user, $pass, true);
if (! $connect_id) { if (!$connect_id) {
return false; return false;
} }
@ -117,7 +144,7 @@ function mysql_db_get_all_rows_sql($sql, $search_history_db=false, $cache=true,
$history = false; $history = false;
// Connect to the history DB // Connect to the history DB
if (! isset($config['history_db_connection']) || $config['history_db_connection'] === false) { if (!isset($config['history_db_connection']) || $config['history_db_connection'] === false) {
$config['history_db_connection'] = db_connect($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_port'], false); $config['history_db_connection'] = db_connect($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_port'], false);
} }
@ -142,13 +169,13 @@ function mysql_db_get_all_rows_sql($sql, $search_history_db=false, $cache=true,
} }
// Append result to the history DB data // Append result to the history DB data
if (! empty($return)) { if (!empty($return)) {
foreach ($return as $row) { foreach ($return as $row) {
array_push($history, $row); array_push($history, $row);
} }
} }
if (! empty($history)) { if (!empty($history)) {
return $history; return $history;
} }
@ -240,7 +267,7 @@ function mysql_db_get_row($table, $field_search, $condition, $fields=false, $cac
} else { } else {
if (is_array($fields)) { if (is_array($fields)) {
$fields = implode(',', $fields); $fields = implode(',', $fields);
} else if (! is_string($fields)) { } else if (!is_string($fields)) {
return false; return false;
} }
} }
@ -403,7 +430,7 @@ function mysql_db_process_sql($sql, $rettype='affected_rows', $dbconnection='',
$cache = $config['dbcache']; $cache = $config['dbcache'];
} }
if ($cache && ! empty($sql_cache[$sql_cache['id']][$sql])) { if ($cache && !empty($sql_cache[$sql_cache['id']][$sql])) {
$retval = $sql_cache[$sql_cache['id']][$sql]; $retval = $sql_cache[$sql_cache['id']][$sql];
$sql_cache['saved'][$sql_cache['id']]++; $sql_cache['saved'][$sql_cache['id']]++;
db_add_database_debug_trace($sql); db_add_database_debug_trace($sql);
@ -518,7 +545,7 @@ function mysql_db_process_sql($sql, $rettype='affected_rows', $dbconnection='',
} }
} }
if (! empty($retval)) { if (!empty($retval)) {
return $retval; return $retval;
} }
@ -594,7 +621,7 @@ function mysql_encapsule_fields_with_same_name_to_instructions($field)
*/ */
function mysql_db_get_value_filter($field, $table, $filter, $where_join='AND', $search_history_db=false) function mysql_db_get_value_filter($field, $table, $filter, $where_join='AND', $search_history_db=false)
{ {
if (! is_array($filter) || empty($filter)) { if (!is_array($filter) || empty($filter)) {
return false; return false;
} }
@ -693,7 +720,7 @@ function mysql_db_format_array_where_clause_sql($values, $join='AND', $prefix=fa
{ {
$fields = []; $fields = [];
if (! is_array($values)) { if (!is_array($values)) {
return ''; return '';
} }
@ -863,7 +890,7 @@ function mysql_db_format_array_where_clause_sql($values, $join='AND', $prefix=fa
$i++; $i++;
} }
return (! empty($query) ? $prefix : '').$query.$group.$order.$limit.$offset; return (!empty($query) ? $prefix : '').$query.$group.$order.$limit.$offset;
} }
@ -945,7 +972,7 @@ function mysql_db_get_row_filter($table, $filter, $fields=false, $where_join='AN
} else { } else {
if (is_array($fields)) { if (is_array($fields)) {
$fields = implode(',', $fields); $fields = implode(',', $fields);
} else if (! is_string($fields)) { } else if (!is_string($fields)) {
return false; return false;
} }
} }
@ -995,7 +1022,7 @@ function mysql_db_get_all_rows_filter($table, $filter=[], $fields=false, $where_
$fields = '*'; $fields = '*';
} else if (is_array($fields)) { } else if (is_array($fields)) {
$fields = implode(',', $fields); $fields = implode(',', $fields);
} else if (! is_string($fields)) { } else if (!is_string($fields)) {
return false; return false;
} }

View File

@ -789,7 +789,7 @@ function agents_get_agents_selected($group)
); );
$all = array_reduce( $all = array_reduce(
$all, (empty($all) === true) ? [] : $all,
function ($carry, $item) { function ($carry, $item) {
$carry[$item['id_agente']] = $item['alias']; $carry[$item['id_agente']] = $item['alias'];
return $carry; return $carry;

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Main configuration of Pandora FMS * Main configuration of Pandora FMS
* *
@ -30,6 +31,7 @@
require_once __DIR__.'/../vendor/autoload.php'; require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/functions.php'; require_once __DIR__.'/functions.php';
enterprise_include_once('include/functions_config.php'); enterprise_include_once('include/functions_config.php');
use PandoraFMS\Core\DBMaintainer; use PandoraFMS\Core\DBMaintainer;
use PandoraFMS\Core\Config; use PandoraFMS\Core\Config;
@ -146,7 +148,7 @@ function config_update_config()
return false; return false;
} }
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (!check_acl($config['id_user'], 0, 'PM') && !is_user_admin($config['id_user'])) {
$config['error_config_update_config'] = []; $config['error_config_update_config'] = [];
$config['error_config_update_config']['correct'] = false; $config['error_config_update_config']['correct'] = false;
$config['error_config_update_config']['message'] = __('Failed updated: User is not admin.'); $config['error_config_update_config']['message'] = __('Failed updated: User is not admin.');
@ -1570,6 +1572,18 @@ function config_update_config()
$error_update[] = __('Days'); $error_update[] = __('Days');
} }
if (config_update_value('history_db_adv', get_parameter_switch('history_db_adv', 0), true) === false) {
$error_update[] = __('Enable history database advanced');
}
$history_db_string_days = get_parameter('history_db_string_days');
if (is_numeric($history_db_string_days) === false
|| $history_db_string_days <= 0
|| config_update_value('history_db_string_days', $history_db_string_days) === false
) {
$error_update[] = __('String Days');
}
$history_event_days = get_parameter('history_event_days'); $history_event_days = get_parameter('history_event_days');
if (is_numeric($history_event_days) === false if (is_numeric($history_event_days) === false
|| $history_event_days <= 0 || $history_event_days <= 0
@ -2241,9 +2255,9 @@ function config_process_config()
config_update_value('2Fa_auth', ''); config_update_value('2Fa_auth', '');
} }
/* /*
* Parse the ACL IP list for access API * Parse the ACL IP list for access API
*/ */
$temp_list_ACL_IPs_for_API = []; $temp_list_ACL_IPs_for_API = [];
if (isset($config['list_ACL_IPs_for_API'])) { if (isset($config['list_ACL_IPs_for_API'])) {
@ -2500,6 +2514,14 @@ function config_process_config()
config_update_value('history_db_days', 0); config_update_value('history_db_days', 0);
} }
if (!isset($config['history_db_adv'])) {
config_update_value('history_db_adv', false);
}
if (!isset($config['history_db_string_days'])) {
config_update_value('history_db_string_days', 0);
}
if (!isset($config['history_event_days'])) { if (!isset($config['history_event_days'])) {
config_update_value('history_event_days', 90); config_update_value('history_event_days', 90);
} }
@ -2799,7 +2821,7 @@ function config_process_config()
$temp_ad_adv_perms = $config['ad_adv_perms']; $temp_ad_adv_perms = $config['ad_adv_perms'];
} }
config_update_value('ad_adv_perms', $temp_ad_adv_perms); config_update_value('ad_adv_perms', $temp_ad_adv_perms);
} }
if (!isset($config['ldap_adv_perms'])) { if (!isset($config['ldap_adv_perms'])) {
@ -3399,7 +3421,6 @@ function config_check()
$supervisor = new ConsoleSupervisor(false); $supervisor = new ConsoleSupervisor(false);
$supervisor->runBasic(); $supervisor->runBasic();
} }
} }
@ -3424,7 +3445,6 @@ function get_um_url()
} }
return $url; return $url;
} }
@ -3440,7 +3460,7 @@ function config_return_in_bytes($val)
$last = strtolower($val[(strlen($val) - 1)]); $last = strtolower($val[(strlen($val) - 1)]);
$val = (int) trim($val); $val = (int) trim($val);
switch ($last) { switch ($last) {
// The 'G' modifier is available since PHP 5.1.0. // The 'G' modifier is available since PHP 5.1.0.
case 'g': case 'g':
$val *= 1024; $val *= 1024;
case 'm': case 'm':

View File

@ -1205,7 +1205,12 @@ function events_get_all(
$tags = json_decode($tag_without, true); $tags = json_decode($tag_without, true);
if (is_array($tags) === true && in_array('0', $tags) === false) { if (is_array($tags) === true && in_array('0', $tags) === false) {
if (!$user_is_admin) { if (!$user_is_admin) {
$user_tags = array_flip(tags_get_tags_for_module_search()); $tags_module_search = tags_get_tags_for_module_search();
if ($tags_module_search === false) {
$tags_module_search = [];
}
$user_tags = array_flip($tags_module_search);
if ($user_tags != null) { if ($user_tags != null) {
foreach ($tags as $key_tag => $id_tag) { foreach ($tags as $key_tag => $id_tag) {
// User cannot filter with those tags. // User cannot filter with those tags.
@ -4948,6 +4953,8 @@ function events_clean_tags($tags)
} }
$event_tags = tags_get_tags_formatted($tags, false); $event_tags = tags_get_tags_formatted($tags, false);
$event_tags = io_safe_input($event_tags);
return explode(',', str_replace(' ', '', $event_tags)); return explode(',', str_replace(' ', '', $event_tags));
} }

View File

@ -656,7 +656,7 @@ function menu_get_sec_pages($sec, $menu_hash=false)
foreach ($menu[$sec]['sub'] as $k => $v) { foreach ($menu[$sec]['sub'] as $k => $v) {
// Avoid special cases of standalone windows. // Avoid special cases of standalone windows.
if (preg_match('/^javascript:/', $k) || preg_match('/\.php/', $k)) { if (preg_match('/^javascript:/', $k) || preg_match('/\.php/', $k)) {
if ($sec !== 'links') { if ($sec !== 'links' && $sec !== 'eventos') {
continue; continue;
} }
} }

View File

@ -7746,15 +7746,7 @@ function reporting_advanced_sla(
} }
if (isset($max_value) === false || (int) $max_value === 0) { if (isset($max_value) === false || (int) $max_value === 0) {
if ($max_value === '0' $max_value = null;
&& $max_value < $min_value
&& isset($min_value_warning) === true
&& $min_value_warning > $max_value
) {
$max_value = $min_value_warning;
} else {
$max_value = null;
}
} }
if (isset($max_value) === false && isset($min_value) === false) { if (isset($max_value) === false && isset($min_value) === false) {
@ -8309,18 +8301,21 @@ function reporting_advanced_sla(
$inverse_interval $inverse_interval
); );
// Warning SLA check. $sla_check_value_warning = false;
$sla_check_value_warning = sla_check_value( if ($sla_check_value === true) {
$current_data['datos'], // Warning SLA check.
$min_value_warning, $sla_check_value_warning = sla_check_value(
$max_value_warning, $current_data['datos'],
$inverse_interval_warning, $min_value_warning,
1 $max_value_warning,
); $inverse_interval_warning,
1
);
}
} }
// Not unknown nor not init values. // Not unknown nor not init values.
if ($sla_check_value_warning && $sla_check_warning === true) { if ($sla_check_value_warning === true && $sla_check_warning === true) {
if (isset($current_data['type']) === false if (isset($current_data['type']) === false
|| ((int) $current_data['type'] === 0 || ((int) $current_data['type'] === 0
&& $i !== 0) && $i !== 0)

View File

@ -1756,7 +1756,8 @@ function reporting_html_modules_inventory($table, $item, $pdf=0)
} else if ($data_field_key === 'group_id') { } else if ($data_field_key === 'group_id') {
$column_value = groups_get_name($data_field_value[0]); $column_value = groups_get_name($data_field_value[0]);
} else if ($data_field_key === 'sec_group_id') { } else if ($data_field_key === 'sec_group_id') {
$sec_groups_names = array_map(function ($group_id) { $sec_groups_names = array_map(
function ($group_id) {
return groups_get_name($group_id); return groups_get_name($group_id);
}, },
$data_field_value $data_field_value
@ -4224,7 +4225,7 @@ function reporting_html_availability($table, $item, $pdf=0)
} else { } else {
$table_row[] = $row['agent']; $table_row[] = $row['agent'];
$item_name = $row['availability_item']; $item_name = $row['availability_item'];
if ((bool) $row['compare'] === true) { if ((bool) $row['compare'] === false) {
$item_name .= ' ('.__('24 x 7').')'; $item_name .= ' ('.__('24 x 7').')';
} }

View File

@ -416,7 +416,7 @@ function tactical_get_data(
} else { } else {
$result_list = db_get_all_rows_sql( $result_list = db_get_all_rows_sql(
sprintf( sprintf(
'SELECT COUNT(*) as contado, estado 'SELECT COUNT(DISTINCT(tam.id_agente_modulo)) as contado, estado
FROM tagente_estado tae FROM tagente_estado tae
INNER JOIN tagente ta INNER JOIN tagente ta
ON tae.id_agente = ta.id_agente ON tae.id_agente = ta.id_agente

View File

@ -1334,7 +1334,7 @@ function tags_checks_event_acl($id_user, $id_group, $access, $tags=[], $children
WHERE ".get_acl_column($access).' = 1)'; WHERE ".get_acl_column($access).' = 1)';
if (isset($id_group)) { if (isset($id_group)) {
$sql .= 'AND id_grupo = '.$id_group; $sql .= ' AND id_grupo = '.$id_group;
} }
$user_has_perm_without_tags = db_get_all_rows_sql($sql); $user_has_perm_without_tags = db_get_all_rows_sql($sql);
@ -1343,6 +1343,7 @@ function tags_checks_event_acl($id_user, $id_group, $access, $tags=[], $children
return true; return true;
} }
$tags_aux = [];
$tags_str = ''; $tags_str = '';
if (!empty($tags)) { if (!empty($tags)) {
foreach ($tags as $tag) { foreach ($tags as $tag) {

View File

@ -4101,17 +4101,20 @@ function ui_toggle(
// JQuery Toggle. // JQuery Toggle.
$output .= '<script type="text/javascript">'."\n"; $output .= '<script type="text/javascript">'."\n";
$output .= ' var hide_tgl_ctrl_'.$uniqid.' = '.(int) $hidden_default.";\n"; $output .= ' var hide_tgl_ctrl_'.$uniqid.' = '.(int) $hidden_default.";\n";
$output .= ' var is_metaconsole = '.(int) is_metaconsole().";\n";
$output .= ' /* <![CDATA[ */'."\n"; $output .= ' /* <![CDATA[ */'."\n";
$output .= " $(document).ready (function () {\n"; $output .= " $(document).ready (function () {\n";
$output .= " $('#checkbox-".$switch_name."').click(function() {\n"; $output .= " $('#checkbox-".$switch_name."').click(function() {\n";
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n"; $output .= ' if (is_metaconsole == 0) {';
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n"; $output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n"; $output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
$output .= " }\n"; $output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " else {\n"; $output .= " }\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n"; $output .= " else {\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n"; $output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n";
$output .= " }\n"; $output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " }\n";
$output .= " }\n";
$output .= " });\n"; $output .= " });\n";
$output .= " $('#tgl_ctrl_".$uniqid."').click(function() {\n"; $output .= " $('#tgl_ctrl_".$uniqid."').click(function() {\n";
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n"; $output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";

View File

@ -73,7 +73,7 @@ final class Config
$config['history_db_user'], $config['history_db_user'],
io_output_password($config['history_db_pass']), io_output_password($config['history_db_pass']),
$config['history_db_name'], $config['history_db_name'],
$config['history_db_port'] (int) $config['history_db_port']
); );
if ($rc === false) { if ($rc === false) {
@ -84,7 +84,7 @@ final class Config
$config['history_db_name'], $config['history_db_name'],
$config['history_db_user'], $config['history_db_user'],
io_output_password($config['history_db_pass']), io_output_password($config['history_db_pass']),
$config['history_db_port'], (int) $config['history_db_port'],
false false
); );
} }

View File

@ -135,9 +135,9 @@ final class DBMaintainer
$this->user = $params['user']; $this->user = $params['user'];
$this->pass = io_output_password($params['pass']); $this->pass = io_output_password($params['pass']);
$this->host = $params['host']; $this->host = $params['host'];
$this->port = $params['port']; $this->port = (int) $params['port'];
$this->name = $params['name']; $this->name = $params['name'];
$this->charset = $params['charset']; $this->charset = (isset($params['charset']) === true) ? $params['charset'] : '';
// Try to connect. // Try to connect.
$this->connect(); $this->connect();
@ -170,7 +170,10 @@ final class DBMaintainer
if ($rc === false) { if ($rc === false) {
$this->dbh = null; $this->dbh = null;
$this->connected = false; $this->connected = false;
$this->lastError = __('Connection problems'); $this->lastError = __(
'Connection problems: %s',
mysqli_connect_error()
);
} else { } else {
$dbc = new \mysqli( $dbc = new \mysqli(
$this->host, $this->host,

View File

@ -239,6 +239,10 @@ class SystemGroupStatusWidget extends Widget
$values['groupId'] = $decoder['groupId']; $values['groupId'] = $decoder['groupId'];
} }
if (isset($decoder['groupRecursion']) === true) {
$values['groupRecursion'] = $decoder['groupRecursion'];
}
return $values; return $values;
} }
@ -326,6 +330,16 @@ class SystemGroupStatusWidget extends Widget
], ],
]; ];
$inputs[] = [
'label' => __('Group recursion'),
'arguments' => [
'name' => 'groupRecursion',
'id' => 'groupRecursion',
'type' => 'switch',
'value' => $values['groupRecursion'],
],
];
return $inputs; return $inputs;
} }
@ -342,6 +356,7 @@ class SystemGroupStatusWidget extends Widget
$values['groupId'] = \get_parameter('groupId', []); $values['groupId'] = \get_parameter('groupId', []);
$values['status'] = \get_parameter('status', []); $values['status'] = \get_parameter('status', []);
$values['groupRecursion'] = (bool) \get_parameter_switch('groupRecursion', 0);
return $values; return $values;
} }
@ -381,6 +396,14 @@ class SystemGroupStatusWidget extends Widget
$selected_groups = explode(',', $this->values['groupId'][0]); $selected_groups = explode(',', $this->values['groupId'][0]);
// Recursion.
if ($this->values['groupRecursion'] === true) {
foreach ($selected_groups as $father) {
$children = \groups_get_children_ids($father);
$selected_groups = ($selected_groups + $children);
}
}
if ($selected_groups[0] === '') { if ($selected_groups[0] === '') {
return false; return false;
} }
@ -450,7 +473,7 @@ class SystemGroupStatusWidget extends Widget
$result_groups[0] = $all_counters; $result_groups[0] = $all_counters;
} }
$this->values['groupId'] = explode(',', $this->values['groupId'][0]); $this->values['groupId'] = $selected_groups;
$this->values['status'] = explode(',', $this->values['status'][0]); $this->values['status'] = explode(',', $this->values['status'][0]);
$style = 'font-size: 12px; text-align: center;'; $style = 'font-size: 12px; text-align: center;';

View File

@ -437,7 +437,7 @@ div#dashboard-controls {
z-index: 1; z-index: 1;
top: 10px; top: 10px;
right: 10px; right: 10px;
width: 600px; width: 800px;
height: 70px; height: 70px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -446,7 +446,7 @@ div#dashboard-controls {
align-items: center; align-items: center;
background-color: #f2f6f7; background-color: #f2f6f7;
border-radius: 15px; border-radius: 15px;
padding: 10px; padding: 0px 10px;
} }
div#dashboard-controls div { div#dashboard-controls div {
@ -455,13 +455,24 @@ div#dashboard-controls div {
} }
div#dashboard-controls div#dashboard-slides-form-countdown { div#dashboard-controls div#dashboard-slides-form-countdown {
flex: 4; flex: 7;
} }
div#dashboard-controls div#dashboard-slides-name { div#dashboard-controls div#dashboard-slides-name {
flex: 3; flex: 3;
} }
div#dashboard-controls div.dashboard-mode {
flex: 1;
display: flex;
flex-direction: row;
justify-content: center;
}
div#dashboard-controls div.dashboard-mode a {
margin: 0px;
}
div#view-slides-cell-mode { div#view-slides-cell-mode {
min-height: 100vh; min-height: 100vh;
width: 100vw; width: 100vw;
@ -490,6 +501,13 @@ div#main_pure {
margin: 0 auto; margin: 0 auto;
margin-top: 30px; margin-top: 30px;
} }
.dashboard-refr {
display: flex;
flex-direction: row-reverse;
flex-wrap: nowrap;
justify-content: center;
align-items: center;
}
#form-config-widget .info_box, #form-config-widget .info_box,
.content-widget .info_box { .content-widget .info_box {

View File

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

View File

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

View File

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

View File

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

View File

@ -820,7 +820,7 @@ CREATE TABLE IF NOT EXISTS `tlink` (
-- Table `tmodule_group` -- Table `tmodule_group`
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tmodule_group` ( CREATE TABLE IF NOT EXISTS `tmodule_group` (
`id_mg` TINYINT UNSIGNED NOT NULL AUTO_INCREMENT, `id_mg` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(150) NOT NULL DEFAULT '', `name` VARCHAR(150) NOT NULL DEFAULT '',
PRIMARY KEY (`id_mg`) PRIMARY KEY (`id_mg`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;

View File

@ -395,6 +395,7 @@ function formatFileSize(bytes) {
* @param {boolean} serverUpdate * @param {boolean} serverUpdate
*/ */
function install_package(url, auth, packageId, version, serverUpdate) { function install_package(url, auth, packageId, version, serverUpdate) {
var processed = 0;
umConfirm({ umConfirm({
message: message:
(serverUpdate ? texts.ensureServerUpdate : texts.ensureUpdate) + (serverUpdate ? texts.ensureServerUpdate : texts.ensureUpdate) +
@ -427,6 +428,11 @@ function install_package(url, auth, packageId, version, serverUpdate) {
$("#input-progress") $("#input-progress")
.val(100) .val(100)
.change(); .change();
$("#result li").removeClass("error");
$("#result li")
.find("p")
.text(response.result);
}, },
error: function(e, request) { error: function(e, request) {
clearInterval(progressInterval); clearInterval(progressInterval);
@ -437,7 +443,10 @@ function install_package(url, auth, packageId, version, serverUpdate) {
}); });
}, },
onDeny: function() { onDeny: function() {
cancelUpdate(); if (processed >= 1) {
cancelUpdate();
}
processed += 1;
} }
}); });
} }

View File

@ -243,23 +243,30 @@ $output .= '</a>';
$output .= '</div>'; $output .= '</div>';
// Cell slides button view. // Cell slides button view.
$output .= '<div>'; $output .= '<div class="dashboard-mode">';
$output .= '<a id="cell-slides-btn" href="'.$cell_slides_url.'">'; $output .= '<a id="cell-slides-btn" href="'.$cell_slides_url.'">';
if ($cellModeSlides === 0) { if ($cellModeSlides === 0) {
$output .= html_print_image( $output .= html_print_image(
'images/tag_red.png', 'images/visual_console.png',
true, true,
['title' => __('Mode Cell')] ['title' => __('Boxed mode')]
); );
$msg_tooltip = __('This mode will show the dashboard with all the widgets in the screen. Click to change to single screen mode.');
} else { } else {
$output .= html_print_image( $output .= html_print_image(
'images/rosette.png', 'images/dashboard.png',
true, true,
['title' => __('Mode Layout')] ['title' => __('Single screen')]
); );
$msg_tooltip = __('This mode will show each widget in a screen, rotating between elements in each dashboard. Click to change to boxed mode.');
} }
$output .= '</a>'; $output .= '</a>';
$output .= ui_print_help_tip(
$msg_tooltip,
true
);
$output .= '</div>'; $output .= '</div>';
// Dashboard name. // Dashboard name.

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.764-220907 Version: 7.0NG.764-220923
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

@ -2136,12 +2136,12 @@ sub pandora_process_module ($$$$$$$$$;$) {
if ($last_known_status == $new_status) { if ($last_known_status == $new_status) {
# Avoid overflows # Avoid overflows
$status_changes = $min_ff_event if ($status_changes > $min_ff_event && $module->{'ff_type'} == 0); $status_changes = $min_ff_event if ($status_changes > $min_ff_event && $module->{'ff_type'} == 0);
$status_changes++; $status_changes++;
if ($module_type =~ m/async/ && $min_ff_event != 0 && $ff_timeout != 0 && ($utimestamp - $ff_start_utimestamp) > $ff_timeout) { if ($module_type =~ m/async/ && $min_ff_event != 0 && $ff_timeout != 0 && ($utimestamp - $ff_start_utimestamp) > $ff_timeout) {
# Only type ff with counters. # Only type ff with counters.
$status_changes = 0 if ($module->{'ff_type'} == 0); $status_changes = 0 if ($module->{'ff_type'} == 0);
$ff_start_utimestamp = $utimestamp; $ff_start_utimestamp = $utimestamp;
# Reset counters because expired timeout. # Reset counters because expired timeout.
@ -2153,16 +2153,16 @@ sub pandora_process_module ($$$$$$$$$;$) {
else { else {
# Only type ff with counters. # Only type ff with counters.
$status_changes = 0 if ($module->{'ff_type'} == 0); $status_changes = 0 if ($module->{'ff_type'} == 0);
$ff_start_utimestamp = $utimestamp if ($module_type =~ m/async/); $ff_start_utimestamp = $utimestamp if ($module_type =~ m/async/);
} }
if ($module->{'ff_type'} == 0) { if ($module->{'ff_type'} == 0) {
# Active ff interval. # Active ff interval.
if ($module->{'module_ff_interval'} != 0 && $status_changes < $min_ff_event) { if ($module->{'module_ff_interval'} != 0 && $status_changes < $min_ff_event) {
$current_interval = $module->{'module_ff_interval'}; $current_interval = $module->{'module_ff_interval'};
} }
# Change status. # Change status.
if ($status_changes >= $min_ff_event && $known_status != $new_status) { if ($status_changes >= $min_ff_event && $known_status != $new_status) {
generate_status_event ($pa_config, $processed_data, $agent, $module, $new_status, $status, $known_status, $dbh); generate_status_event ($pa_config, $processed_data, $agent, $module, $new_status, $status, $known_status, $dbh);
@ -2174,6 +2174,11 @@ sub pandora_process_module ($$$$$$$$$;$) {
# Update module status count. # Update module status count.
$mark_for_update = 1; $mark_for_update = 1;
# Safe mode execution.
if ($agent->{'safe_mode_module'} == $module->{'id_agente_modulo'}) {
safe_mode($pa_config, $agent, $module, $new_status, $known_status, $dbh);
}
} elsif ($status_changes >= $min_ff_event && $known_status == $new_status && $new_status == 1) {
# Safe mode execution. # Safe mode execution.
if ($agent->{'safe_mode_module'} == $module->{'id_agente_modulo'}) { if ($agent->{'safe_mode_module'} == $module->{'id_agente_modulo'}) {
safe_mode($pa_config, $agent, $module, $new_status, $known_status, $dbh); safe_mode($pa_config, $agent, $module, $new_status, $known_status, $dbh);
@ -5160,17 +5165,14 @@ sub get_module_status ($$$$) {
} }
# (-inf, critical_min), [critical_max, +inf) # (-inf, critical_min), [critical_max, +inf)
else { else {
if ($critical_min == 0) { if ($critical_max < $critical_min) {
return 1 if ($data > $critical_max); return 1 if ($data < $critical_min);
}elsif ($critical_max == 0) {
return 1 if ($data <= $critical_min);
} else { } else {
return 1 if ($data < $critical_min || $data >= $critical_max); return 1 if ($data < $critical_min || $data >= $critical_max);
return 1 if ($data <= $critical_max && $critical_max < $critical_min);
} }
} }
} }
# Warning # Warning
if ($warning_min ne $warning_max) { if ($warning_min ne $warning_max) {
# [warning_min, warning_max) # [warning_min, warning_max)
@ -5180,13 +5182,10 @@ sub get_module_status ($$$$) {
} }
# (-inf, warning_min), [warning_max, +inf) # (-inf, warning_min), [warning_max, +inf)
else { else {
if ($warning_min == 0) { if ($warning_max < $warning_min) {
return 2 if ($data > $warning_max); return 2 if ($data < $warning_min);
}elsif ($warning_max == 0) {
return 2 if ($data <= $warning_min);
} else { } else {
return 2 if ($data < $warning_min || $data >= $warning_max); return 2 if ($data < $warning_min || $data >= $warning_max);
return 2 if ($data <= $warning_max && $warning_max < $warning_min);
} }
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.764 Build 220907"; my $version = "7.0NG.764 Build 220923";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;
@ -644,6 +644,8 @@ sub pandora_load_config_pdb ($) {
$conf->{'_history_db_user'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_user'"); $conf->{'_history_db_user'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_user'");
$conf->{'_history_db_pass'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_pass'"); $conf->{'_history_db_pass'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_pass'");
$conf->{'_history_db_days'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_days'"); $conf->{'_history_db_days'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_days'");
$conf->{'_history_db_adv'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_adv'");
$conf->{'_history_db_string_days'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_string_days'");
$conf->{'_history_event_days'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_event_days'"); $conf->{'_history_event_days'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_event_days'");
$conf->{'_history_db_step'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_step'"); $conf->{'_history_db_step'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_step'");
$conf->{'_history_db_delay'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_delay'"); $conf->{'_history_db_delay'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_delay'");
@ -1128,7 +1130,7 @@ sub pandoradb_main ($$$;$) {
# Move old data to the history DB # Move old data to the history DB
if (defined ($history_dbh)) { if (defined ($history_dbh)) {
undef ($history_dbh) unless defined (enterprise_hook ('pandora_historydb', [$dbh, $history_dbh, $conf->{'_history_db_days'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}])); undef ($history_dbh) unless defined (enterprise_hook ('pandora_historydb', [$dbh, $history_dbh, $conf->{'_history_db_days'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}, $conf->{'_history_db_string_days'}, $conf->{'_history_db_adv'}]));
if (defined($conf{'_history_event_enabled'}) && $conf->{'_history_event_enabled'} ne "" && $conf->{'_history_event_enabled'} == 1) { if (defined($conf{'_history_event_enabled'}) && $conf->{'_history_event_enabled'} ne "" && $conf->{'_history_event_enabled'} == 1) {
undef ($history_dbh) unless defined (enterprise_hook ('pandora_history_event', [$dbh, $history_dbh, $conf->{'_history_event_days'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}])); undef ($history_dbh) unless defined (enterprise_hook ('pandora_history_event', [$dbh, $history_dbh, $conf->{'_history_event_days'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}]));
} }

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.764 Build 220907"; my $version = "7.0NG.764 Build 220923";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);