Merge branch 'develop' into ent-12997-eliminar-sistema-de-skins
This commit is contained in:
commit
5848142fcb
extras/deploy-scripts
pandora_agents
unix
DEBIAN
pandora_agentpandora_agent.redhat.specpandora_agent.redhat_bin.el8.specpandora_agent.redhat_bin.el9.specpandora_agent.redhat_bin.specpandora_agent.specpandora_agent_installerwin32
pandora_console
DEBIAN
extensions
extras
godmode
images
include
install.phpoperation/agentes
pandora_console.redhat.specpandora_console.rhel7.specpandora_console.specpandoradb_data.sqlupdate_manager_client/lib/UpdateManager
pandora_server
visual_console_client/src
|
@ -0,0 +1,782 @@
|
|||
#!/bin/bash
|
||||
#######################################################
|
||||
# PandoraFMS Community online installation script
|
||||
#######################################################
|
||||
## Tested versions ##
|
||||
# Rockylinux 9.3
|
||||
# RHEL 9.3
|
||||
|
||||
#Constants
|
||||
PANDORA_CONSOLE=/var/www/html/pandora_console
|
||||
PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
|
||||
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
|
||||
|
||||
|
||||
S_VERSION='2024021301'
|
||||
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
||||
|
||||
# define default variables
|
||||
[ "$TZ" ] || TZ="Europe/Madrid"
|
||||
[ "$MYVER" ] || MYVER=80
|
||||
[ "$PHPVER" ] || PHPVER=8
|
||||
[ "$DBHOST" ] || DBHOST=127.0.0.1
|
||||
[ "$DBNAME" ] || DBNAME=pandora
|
||||
[ "$DBUSER" ] || DBUSER=pandora
|
||||
[ "$DBPASS" ] || DBPASS='Pandor4!'
|
||||
[ "$DBPORT" ] || DBPORT=3306
|
||||
[ "$DBROOTUSER" ] || DBROOTUSER=root
|
||||
[ "$DBROOTPASS" ] || DBROOTPASS='Pandor4!'
|
||||
[ "$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_LTS" ] || PANDORA_LTS=1
|
||||
[ "$PANDORA_BETA" ] || PANDORA_BETA=0
|
||||
[ "$RHEL_CHECK_SUBSCRIPTION" ] || RHEL_CHECK_SUBSCRIPTION=1
|
||||
|
||||
#Check if possible to get os version
|
||||
if [ ! -e /etc/os-release ]; then
|
||||
echo ' > Imposible to determinate the OS version for this machine, please make sure you are intalling in a compatible OS'
|
||||
echo ' > More info: https://pandorafms.com/manual/en/documentation/02_installation/01_installing#minimum_software_requirements'
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Ansi color code variables
|
||||
red="\e[0;91m"
|
||||
green="\e[0;92m"
|
||||
cyan="\e[0;36m"
|
||||
yellow="\e[33m"
|
||||
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 "$HOME"/pandora_deploy_tmp &>> "$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 "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${green}OK${reset}"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
check_pre_pandora () {
|
||||
|
||||
echo -en "${cyan}Checking environment ... ${reset}"
|
||||
rpm -qa | grep 'pandorafms_' | grep -v pandorafms_agent_* | grep -v "pandorawmic" | grep -v "pandorafms_made" &>> /dev/null && local fail=true
|
||||
[ -d "$PANDORA_CONSOLE" ] && local fail=true
|
||||
[ -f /usr/bin/pandora_server ] && local fail=true
|
||||
|
||||
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ]; then
|
||||
export MYSQL_PWD=$DBPASS
|
||||
echo "use $DBNAME" | mysql -u$DBUSER -P$DBPORT -h$DBHOST &>> /dev/null && local fail=true
|
||||
fi
|
||||
|
||||
[ ! $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.pandorafms.com" "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
|
||||
}
|
||||
|
||||
installing_docker () {
|
||||
#Installing docker for debug
|
||||
echo "Start installig docker" &>> "$LOGFILE"
|
||||
dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo &>> "$LOGFILE"
|
||||
dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin &>> "$LOGFILE"
|
||||
systemctl disable --now docker &>> "$LOGFILE"
|
||||
systemctl disable docker.socket --now &>> "$LOGFILE"
|
||||
echo "End installig docker" &>> "$LOGFILE"
|
||||
}
|
||||
|
||||
# Function to check if a password meets the MySQL secure password requirements
|
||||
is_mysql_secure_password() {
|
||||
local password=$1
|
||||
|
||||
# Check password length (at least 8 characters)
|
||||
if [[ ${#password} -lt 8 ]]; then
|
||||
echo "Password length should be at least 8 characters."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check if password contains at least one uppercase letter
|
||||
if [[ $password == ${password,,} ]]; then
|
||||
echo "Password should contain at least one uppercase letter."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check if password contains at least one lowercase letter
|
||||
if [[ $password == ${password^^} ]]; then
|
||||
echo "Password should contain at least one lowercase letter."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check if password contains at least one digit
|
||||
if ! [[ $password =~ [0-9] ]]; then
|
||||
echo "Password should contain at least one digit."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check if password contains at least one special character
|
||||
if ! [[ $password =~ [[:punct:]] ]]; then
|
||||
echo "Password should contain at least one special character."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check if password is not a common pattern (e.g., "password", "123456")
|
||||
local common_patterns=("password" "123456" "qwerty")
|
||||
for pattern in "${common_patterns[@]}"; do
|
||||
if [[ $password == *"$pattern"* ]]; then
|
||||
echo "Password should not contain common patterns."
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
# If all checks pass, the password is MySQL secure compliant
|
||||
return 0
|
||||
}
|
||||
|
||||
## Main
|
||||
echo "Starting PandoraFMS Community deployment EL8 ver. $S_VERSION"
|
||||
|
||||
#check tools
|
||||
if ! grep --version &>> $LOGFILE ; then echo 'Error grep is not detected on the system, grep tool is needed for installation.'; exit -1 ;fi
|
||||
if ! sed --version &>> $LOGFILE ; then echo 'Error sed is not detected on the system, sed tool is needed for installation.'; exit -1 ;fi
|
||||
if ! curl --version &>> $LOGFILE ; then echo 'Error curl is not detected on the system, curl tool is needed for installation.'; exit -1 ;fi
|
||||
if ! ping -V &>> $LOGFILE ; then echo 'Error ping is not detected on the system, ping tool is needed for installation.'; exit -1 ;fi
|
||||
|
||||
# Centos Version
|
||||
if [ ! "$(grep -Ei 'centos|rocky|Almalinux|Red Hat Enterprise' /etc/redhat-release)" ]; then
|
||||
printf "\n ${red}Error this is not a Centos/Rocky/Almalinux Base system, this installer is compatible with RHEL/Almalinux/Centos/Rockylinux systems only${reset}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo -en "${cyan}Check Centos Version...${reset}"
|
||||
[[ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '9' ]]
|
||||
check_cmd_status 'Error OS version, RHEL/Almalinux/Centos/Rockylinux 8.x 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
|
||||
INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}"
|
||||
[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}"
|
||||
[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}"
|
||||
echo -e $INSTALLING_VER
|
||||
|
||||
# Connectivity
|
||||
check_repo_connection
|
||||
|
||||
# Systemd
|
||||
execute_cmd "systemctl status" "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 "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"
|
||||
execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_deploy_tmp"
|
||||
|
||||
## Extra steps on redhat envs
|
||||
if [ "$(grep -Ei 'Red Hat Enterprise' /etc/redhat-release)" ]; then
|
||||
## In case REDHAT
|
||||
if [ "$RHEL_CHECK_SUBSCRIPTION" -eq '1' ] ; then
|
||||
|
||||
# Check susbscription manager status:
|
||||
echo -en "${cyan}Checking Red Hat Enterprise subscription... ${reset}"
|
||||
subscription-manager list &>> "$LOGFILE"
|
||||
subscription-manager status &>> "$LOGFILE"
|
||||
check_cmd_status 'Error checking subscription status, make sure your server is activated and suscribed to Red Hat Enterprise repositories'
|
||||
|
||||
# Ckeck repolist
|
||||
dnf repolist &>> "$LOGFILE"
|
||||
echo -en "${cyan}Checking Red Hat Enterprise repolist... ${reset}"
|
||||
dnf repolist | grep 'rhel-9-for-x86_64-baseos-rpms' &>> "$LOGFILE"
|
||||
check_cmd_status 'Error checking repositories status, could try a subscription-manager attach command or contact sysadmin'
|
||||
fi
|
||||
#install extra repos
|
||||
extra_repos=" \
|
||||
tar \
|
||||
dnf-utils \
|
||||
https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \
|
||||
https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm \
|
||||
https://rpms.remirepo.net/enterprise/remi-release-9.rpm \
|
||||
https://repo.percona.com/yum/percona-release-latest.noarch.rpm"
|
||||
|
||||
execute_cmd "dnf install -y $extra_repos" "Installing extra repositories"
|
||||
execute_cmd "subscription-manager repos --enable codeready-builder-for-rhel-9-x86_64-rpms" "Enabling subscription to codeready-builder"
|
||||
else
|
||||
# For alma/rocky/centos
|
||||
extra_repos=" \
|
||||
tar \
|
||||
dnf-utils \
|
||||
https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \
|
||||
https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm \
|
||||
https://rpms.remirepo.net/enterprise/remi-release-9.rpm \
|
||||
https://repo.percona.com/yum/percona-release-latest.noarch.rpm"
|
||||
|
||||
execute_cmd "dnf install -y $extra_repos" "Installing extra repositories"
|
||||
execute_cmd "dnf config-manager --enable crb" "Configuring crb"
|
||||
fi
|
||||
|
||||
execute_cmd "installing_docker" "Installing Docker for debug"
|
||||
|
||||
#Installing wget
|
||||
execute_cmd "dnf install -y wget" "Installing wget"
|
||||
|
||||
#Installing php
|
||||
execute_cmd "dnf module reset -y php " "Disabling standard PHP module"
|
||||
|
||||
if [ "$PHPVER" -eq '8' ] ; then
|
||||
PHPVER=8.2
|
||||
fi
|
||||
execute_cmd "dnf module install -y php:remi-$PHPVER" "Configuring PHP $PHPVER"
|
||||
|
||||
|
||||
|
||||
if [ "$MYVER" -eq '80' ] ; then
|
||||
execute_cmd "percona-release setup ps80 -y" "Enabling mysql80 module"
|
||||
execute_cmd "dnf install -y percona-server-server percona-xtrabackup-80" "Installing Percona Server 80"
|
||||
fi
|
||||
|
||||
# Console dependencies
|
||||
console_dependencies=" \
|
||||
php \
|
||||
postfix \
|
||||
php-mcrypt \
|
||||
php-cli \
|
||||
php-gd \
|
||||
php-curl \
|
||||
php-session \
|
||||
php-mysqlnd \
|
||||
php-ldap \
|
||||
php-zip \
|
||||
php-zlib \
|
||||
php-fileinfo \
|
||||
php-gettext \
|
||||
php-snmp \
|
||||
php-mbstring \
|
||||
php-pecl-zip \
|
||||
php-xmlrpc \
|
||||
libxslt \
|
||||
wget \
|
||||
php-xml \
|
||||
httpd \
|
||||
mod_php \
|
||||
atk \
|
||||
avahi-libs \
|
||||
cairo \
|
||||
cups-libs \
|
||||
fribidi \
|
||||
gd \
|
||||
gdk-pixbuf2 \
|
||||
ghostscript \
|
||||
graphite2 \
|
||||
graphviz \
|
||||
gtk2 \
|
||||
harfbuzz \
|
||||
hicolor-icon-theme \
|
||||
hwdata \
|
||||
jasper-libs \
|
||||
lcms2 \
|
||||
libICE \
|
||||
libSM \
|
||||
libXaw \
|
||||
libXcomposite \
|
||||
libXcursor \
|
||||
libXdamage \
|
||||
libXext \
|
||||
libXfixes \
|
||||
libXft \
|
||||
libXi \
|
||||
libXinerama \
|
||||
libXmu \
|
||||
libXrandr \
|
||||
libXrender \
|
||||
libXt \
|
||||
libXxf86vm \
|
||||
libdrm \
|
||||
libfontenc \
|
||||
libglvnd \
|
||||
libglvnd-egl \
|
||||
libglvnd-glx \
|
||||
libpciaccess \
|
||||
librsvg2 \
|
||||
libthai \
|
||||
libtool-ltdl \
|
||||
libwayland-client \
|
||||
libwayland-server \
|
||||
libxshmfence \
|
||||
mesa-libEGL \
|
||||
mesa-libGL \
|
||||
mesa-libgbm \
|
||||
mesa-libglapi \
|
||||
pango \
|
||||
pixman \
|
||||
xorg-x11-fonts-75dpi \
|
||||
xorg-x11-fonts-misc \
|
||||
poppler-data \
|
||||
php-yaml \
|
||||
mod_ssl \
|
||||
libzstd \
|
||||
openldap-clients \
|
||||
https://firefly.pandorafms.com/centos8/chromium-110.0.5481.177-1.el7.x86_64.rpm \
|
||||
https://firefly.pandorafms.com/centos8/chromium-common-110.0.5481.177-1.el7.x86_64.rpm \
|
||||
https://firefly.pandorafms.com/centos8/pandora_gotty-1.0-1.el8.x86_64.rpm \
|
||||
https://firefly.pandorafms.com/centos8/pandorafms_made-0.1.0-1.el8.x86_64.rpm "
|
||||
execute_cmd "dnf install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
|
||||
|
||||
# Server dependencies
|
||||
server_dependencies=" \
|
||||
perl \
|
||||
vim \
|
||||
fping \
|
||||
perl-IO-Compress \
|
||||
nmap \
|
||||
sudo \
|
||||
perl-Time-HiRes \
|
||||
nfdump \
|
||||
net-snmp-utils \
|
||||
perl(NetAddr::IP) \
|
||||
perl(Sys::Syslog) \
|
||||
perl(DBI) \
|
||||
perl(XML::Simple) \
|
||||
perl(IO::Socket::INET6) \
|
||||
perl(XML::Twig) \
|
||||
perl-JSON \
|
||||
expect \
|
||||
openssh-clients \
|
||||
java \
|
||||
bind-utils \
|
||||
whois \
|
||||
libnsl \
|
||||
libxcrypt-compat \
|
||||
https://firefly.pandorafms.com/pandorafms-el9/perl-Geo-IP-1.51-1.el9.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"
|
||||
|
||||
#ipam dependencies
|
||||
ipam_dependencies=" \
|
||||
perl(NetAddr::IP) \
|
||||
perl(Sys::Syslog) \
|
||||
perl(DBI) \
|
||||
perl(XML::Simple) \
|
||||
perl(IO::Socket::INET6) \
|
||||
perl(XML::Twig)"
|
||||
execute_cmd "dnf install -y $ipam_dependencies" "Installing IPAM Instant client"
|
||||
|
||||
# Disabling SELINUX and firewalld
|
||||
setenforce 0 &>> "$LOGFILE"
|
||||
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config &>> "$LOGFILE"
|
||||
systemctl disable firewalld --now &>> "$LOGFILE"
|
||||
|
||||
|
||||
# Adding standar cnf for initial setup.
|
||||
cat > /etc/my.cnf << EO_CONFIG_TMP
|
||||
[mysqld]
|
||||
datadir=/var/lib/mysql
|
||||
socket=/var/lib/mysql/mysql.sock
|
||||
symbolic-links=0
|
||||
log-error=/var/log/mysqld.log
|
||||
pid-file=/var/run/mysqld/mysqld.pid
|
||||
EO_CONFIG_TMP
|
||||
|
||||
#Configuring Database
|
||||
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
|
||||
execute_cmd "systemctl start mysqld" "Starting database engine"
|
||||
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!';
|
||||
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!');
|
||||
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('$DBROOTPASS');
|
||||
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"fi
|
||||
fi
|
||||
|
||||
export MYSQL_PWD=$DBROOTPASS
|
||||
echo -en "${cyan}Creating Pandora FMS database...${reset}"
|
||||
echo "create database $DBNAME" | mysql -u$DBROOTUSER -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 -u$DBROOTUSER -P$DBPORT -h$DBHOST
|
||||
echo "ALTER USER \"$DBUSER\"@'%' IDENTIFIED WITH mysql_native_password BY \"$DBPASS\"" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST
|
||||
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%'" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST
|
||||
|
||||
#Generating my.cnf
|
||||
cat > /etc/my.cnf << EO_CONFIG_F
|
||||
[mysqld]
|
||||
datadir=/var/lib/mysql
|
||||
socket=/var/lib/mysql/mysql.sock
|
||||
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 https://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 = 300
|
||||
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
|
||||
|
||||
#skip-log-bin
|
||||
|
||||
sql_mode=""
|
||||
|
||||
[mysqld_safe]
|
||||
log-error=/var/log/mysqld.log
|
||||
pid-file=/var/run/mysqld/mysqld.pid
|
||||
|
||||
EO_CONFIG_F
|
||||
|
||||
execute_cmd "systemctl restart mysqld" "Configuring database engine"
|
||||
execute_cmd "systemctl enable mysqld --now" "Enabling Database service"
|
||||
fi
|
||||
export MYSQL_PWD=$DBPASS
|
||||
|
||||
#Define packages
|
||||
if [ "$PANDORA_LTS" -eq '1' ] ; then
|
||||
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_server-7.0NG.noarch.rpm"
|
||||
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_console-7.0NG.noarch.rpm"
|
||||
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm"
|
||||
elif [ "$PANDORA_LTS" -ne '1' ] ; then
|
||||
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.x86_64.rpm"
|
||||
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.x86_64.rpm"
|
||||
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm"
|
||||
fi
|
||||
|
||||
# if beta is enable
|
||||
if [ "$PANDORA_BETA" -eq '1' ] ; then
|
||||
PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm"
|
||||
PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_console-latest.x86_64.rpm"
|
||||
PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm"
|
||||
fi
|
||||
|
||||
# Downloading Pandora Packages
|
||||
execute_cmd "curl -LSs --output pandorafms_server-7.0NG.noarch.rpm ${PANDORA_SERVER_PACKAGE}" "Downloading Pandora FMS Server community"
|
||||
execute_cmd "curl -LSs --output pandorafms_console-7.0NG.noarch.rpm ${PANDORA_CONSOLE_PACKAGE}" "Downloading Pandora FMS Console community"
|
||||
execute_cmd "curl -LSs --output pandorafms_agent_linux-7.0NG.noarch.rpm ${PANDORA_AGENT_PACKAGE}" "Downloading Pandora FMS Agent community"
|
||||
|
||||
# Install Pandora
|
||||
execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms_console*.rpm $HOME/pandora_deploy_tmp/pandorafms_agent*.rpm" "Installing Pandora FMS packages"
|
||||
execute_cmd "rpm -i --nodeps $HOME/pandora_deploy_tmp/pandorafms_server-7.0NG.noarch.rpm " "Installing Pandora FMS Server package"
|
||||
|
||||
# Enable Services
|
||||
execute_cmd "systemctl enable httpd --now" "Enabling HTTPD service"
|
||||
execute_cmd "systemctl enable php-fpm --now" "Enabling PHP-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
|
||||
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
|
||||
|
||||
cat > /etc/httpd/conf.d/pandora.conf << EO_CONFIG_F
|
||||
<Directory "/var/www/html">
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
EO_CONFIG_F
|
||||
|
||||
# Temporal quitar htaccess
|
||||
sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/images/.htaccess
|
||||
sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/attachment/.htaccess
|
||||
|
||||
# Fixing console permissions
|
||||
chmod 600 $PANDORA_CONSOLE/include/config.php
|
||||
chown apache. $PANDORA_CONSOLE/include/config.php
|
||||
mv $PANDORA_CONSOLE/install.php $PANDORA_CONSOLE/install.done &>> "$LOGFILE"
|
||||
|
||||
# Prepare php.ini
|
||||
sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini
|
||||
sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini
|
||||
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 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/">
|
||||
EOF_INDEX
|
||||
|
||||
execute_cmd "systemctl restart httpd" "Restarting httpd after configuration"
|
||||
execute_cmd "systemctl restart php-fpm" "Restarting php-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
|
||||
|
||||
#check fping
|
||||
fping_bin=$(which fping)
|
||||
execute_cmd "[ $fping_bin ]" "Check fping location: $fping_bin"
|
||||
if [ "$fping_bin" != "" ]; then
|
||||
sed -i -e "s|^fping.*|fping $fping_bin|g" $PANDORA_SERVER_CONF
|
||||
fi
|
||||
|
||||
# Enable agent remote config
|
||||
sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF
|
||||
|
||||
# Kernel optimization
|
||||
if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then
|
||||
|
||||
old_sysctl_file=$(cat /etc/sysctl.conf)
|
||||
|
||||
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
|
||||
|
||||
echo -en "${cyan}Applying Kernel optimization... ${reset}"
|
||||
sysctl --system &>> $LOGFILE
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${red}Fail${reset}"
|
||||
echo -e "${yellow}Your kernel could not be optimized, you may be running this script in a virtualized environment with no support for accessing the kernel.${reset}"
|
||||
echo -e "${yellow}This system can be used for testing but is not recommended for a production environment.${reset}"
|
||||
echo "$old_sysctl_file" > old_sysctl_file
|
||||
else
|
||||
echo -e "${green}OK${reset}"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Fix pandora_server.{log,error} permissions to allow Console check them
|
||||
chown pandora:apache /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
|
||||
|
||||
# Enable pandora ha service
|
||||
systemctl enable pandora_server --now &>> "$LOGFILE"
|
||||
execute_cmd "/etc/init.d/pandora_server start" "Starting Pandora FMS Server"
|
||||
|
||||
# starting tentacle server
|
||||
systemctl enable tentacle_serverd &>> "$LOGFILE"
|
||||
execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
|
||||
|
||||
# Enabling console cron
|
||||
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
|
||||
echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
|
||||
## Enabling agent
|
||||
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)
|
||||
|
||||
cat > /etc/issue.net << EOF_banner
|
||||
|
||||
Welcome to Pandora FMS appliance on RHEL/Rocky Linux 8
|
||||
------------------------------------------
|
||||
Go to Public http://$ipplublic/pandora_console 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
|
||||
execute_cmd "rm -rf $HOME/pandora_deploy_tmp" "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"}'
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.776-240319
|
||||
Version: 7.0NG.776-240325
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.776-240319"
|
||||
pandora_version="7.0NG.776-240325"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1039,7 +1039,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.776';
|
||||
use constant AGENT_BUILD => '240319';
|
||||
use constant AGENT_BUILD => '240325';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.776
|
||||
%define release 240319
|
||||
%define release 240325
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.776
|
||||
%define release 240319
|
||||
%define release 240325
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.776
|
||||
%define release 240319
|
||||
%define release 240325
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.776
|
||||
%define release 240319
|
||||
%define release 240325
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
Name: %{name}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.776
|
||||
%define release 240319
|
||||
%define release 240325
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.776"
|
||||
PI_BUILD="240319"
|
||||
PI_BUILD="240325"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{240319}
|
||||
{240325}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.776 Build 240319")
|
||||
#define PANDORA_VERSION ("7.0NG.776 Build 240325")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Pandora FMS"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.776(Build 240319))"
|
||||
VALUE "ProductVersion", "(7.0NG.776(Build 240325))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.776-240319
|
||||
Version: 7.0NG.776-240325
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.776-240319"
|
||||
pandora_version="7.0NG.776-240325"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -299,7 +299,7 @@ function agents_modules_load_js()
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function mainAgentsModules()
|
||||
function mainAgentsModules($params=[], $post_data=[])
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
@ -352,29 +352,39 @@ function mainAgentsModules()
|
|||
|
||||
$updated_time = $updated_info;
|
||||
|
||||
$modulegroup = get_parameter('modulegroup', 0);
|
||||
if ($post_data === []) {
|
||||
$show_type = (int) get_parameter('show_type', 0);
|
||||
$group_id = (int) get_parameter('group_id', 0);
|
||||
$recursion = get_parameter('recursion', 0);
|
||||
$modulegroup = get_parameter('modulegroup', 0);
|
||||
if (get_parameter('modulegroup') != null) {
|
||||
$agents_id = (array) get_parameter('id_agents2', null);
|
||||
}
|
||||
|
||||
$selection_a_m = (int) get_parameter('selection_agent_module');
|
||||
$modules_selected = (array) get_parameter('module', 0);
|
||||
} else {
|
||||
$show_type = (int) ($post_data['show_type'] ?? 0);
|
||||
$group_id = (int) ($post_data['group_id'] ?? 0);
|
||||
$recursion = ($post_data['recursion'] ?? 0);
|
||||
$modulegroup = ($post_data['modulegroup'] ?? 0);
|
||||
if ($modulegroup !== 0) {
|
||||
$agents_id = (array) ($post_data['id_agents2'] ?? []);
|
||||
}
|
||||
|
||||
$selection_a_m = ($post_data['selection_agent_module'] ?? '');
|
||||
$modules_selected = ($post_data['module'] ?? []);
|
||||
}
|
||||
|
||||
$refr = (int) get_parameter('refresh', 0);
|
||||
// By default 30 seconds.
|
||||
$recursion = get_parameter('recursion', 0);
|
||||
$group_id = (int) get_parameter('group_id', 0);
|
||||
$offset = (int) get_parameter('offset', 0);
|
||||
$hor_offset = (int) get_parameter('hor_offset', 0);
|
||||
$block = $config['block_size'];
|
||||
if (intval($block) > 15) {
|
||||
$block = '15';
|
||||
}
|
||||
|
||||
if (get_parameter('modulegroup') != null) {
|
||||
$agents_id = (array) get_parameter('id_agents2', null);
|
||||
}
|
||||
|
||||
$selection_a_m = (int) get_parameter('selection_agent_module');
|
||||
$modules_selected = (array) get_parameter('module', 0);
|
||||
$block = (string) ($params['block_size'] ?? $hor_offset);
|
||||
$update_item = (string) get_parameter('edit_item', '');
|
||||
$save_serialize = (int) get_parameter('save_serialize', 0);
|
||||
$full_modules_selected = explode(';', get_parameter('full_modules_selected', 0));
|
||||
$full_agents_id = explode(';', get_parameter('full_agents_id', 0));
|
||||
$show_type = (int) get_parameter('show_type', 0);
|
||||
|
||||
// In full screen there is no pagination neither filters.
|
||||
if (( ($config['pure'] == 0 && $save_serialize) && $update_item == '' ) || ( ($config['pure'] == 1 && $save_serialize == 0) && $update_item == '' )) {
|
||||
|
@ -572,6 +582,7 @@ function mainAgentsModules()
|
|||
*/
|
||||
|
||||
if ($config['pure'] == 0) {
|
||||
include_once 'include/class/HTML.class.php';
|
||||
// Header.
|
||||
ui_print_standard_header(
|
||||
__('Agents/Modules'),
|
||||
|
@ -895,7 +906,9 @@ function mainAgentsModules()
|
|||
return;
|
||||
}
|
||||
|
||||
echo '<table cellpadding="4" cellspacing="4" border="0" class="info_table mrgn_btn_20px" id="agents_modules_table">';
|
||||
echo '<div id="div-agents-modules-table">';
|
||||
echo '<div id="agents-modules-spinner" class="spinner-fixed"><span></span><span></span><span></span><span></span></div>';
|
||||
echo '<table cellpadding="4" cellspacing="4" border="0" class="info_table mrgn_btn_20px invisible" id="agents_modules_table">';
|
||||
|
||||
echo '<tr>';
|
||||
|
||||
|
@ -1084,6 +1097,7 @@ function mainAgentsModules()
|
|||
}
|
||||
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
|
||||
if ($show_type === 0) {
|
||||
$show_legend = "<div class='legend_white'>";
|
||||
|
@ -1114,4 +1128,66 @@ function mainAgentsModules()
|
|||
|
||||
|
||||
extensions_add_operation_menu_option(__('Agents/Modules view'), 'estado', 'agents_modules/icon_menu.png', 'v1r1', 'view');
|
||||
extensions_add_main_function('mainAgentsModules');
|
||||
|
||||
$pure = (int) get_parameter('pure', 0);
|
||||
$hor_offset = (int) get_parameter('hor_offset', 0);
|
||||
$offset = (int) get_parameter('offset', 0);
|
||||
|
||||
$sec2 = get_parameter('sec2');
|
||||
|
||||
if ($pure !== 0) {
|
||||
extensions_add_main_function('mainAgentsModules');
|
||||
if ($sec2 === 'extensions/agents_modules') {
|
||||
echo '<script>
|
||||
$(document).ready(function () {
|
||||
$("#agents-modules-spinner").hide();
|
||||
$("#agents_modules_table").show();
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($pure === 0) {
|
||||
if (is_ajax()) {
|
||||
$params = [];
|
||||
$post_data = get_parameter('post_data', []);
|
||||
$items_offset = get_parameter('items_offset', 15);
|
||||
$params['block_size'] = $items_offset;
|
||||
$params['offset'] = $offset;
|
||||
$params['hor_offset'] = $hor_offset;
|
||||
mainAgentsModules($params, $post_data);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($sec2 === 'extensions/agents_modules') {
|
||||
echo '<script>
|
||||
$(document).ready(function () {
|
||||
// Calc items per page.
|
||||
const mainWidth = $("#page #main").width();
|
||||
const itemsOffset = Math.floor((mainWidth - 240) / 46);
|
||||
|
||||
$.ajax({
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: "extensions/agents_modules",
|
||||
post_data: '.json_encode($_POST).',
|
||||
items_offset: itemsOffset,
|
||||
offset: '.$offset.',
|
||||
hor_offset: '.$hor_offset.',
|
||||
},
|
||||
dataType: "html",
|
||||
success: function (data) {
|
||||
$("#page > #main").html(data);
|
||||
$("#agents-modules-spinner").hide();
|
||||
$("#agents_modules_table").show();
|
||||
menuActionButtonResizing();
|
||||
},
|
||||
error: function (error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
}
|
|
@ -196,6 +196,15 @@ function pandora_realtime_graphs()
|
|||
[
|
||||
'class' => 'action-buttons',
|
||||
'content' => html_print_submit_button(
|
||||
__('Filter'),
|
||||
'filterbutton',
|
||||
false,
|
||||
[
|
||||
'icon' => 'search',
|
||||
'mode' => 'mini',
|
||||
],
|
||||
true
|
||||
).html_print_submit_button(
|
||||
__('Clear graph'),
|
||||
'srcbutton',
|
||||
false,
|
||||
|
|
|
@ -160,10 +160,6 @@
|
|||
return +(Math.round(num + "e+2") + "e-2");
|
||||
}
|
||||
|
||||
$("#graph").change(function() {
|
||||
$("form#realgraph").submit();
|
||||
});
|
||||
|
||||
$("#refresh").change(function() {
|
||||
refresh = parseInt($("#refresh").val());
|
||||
resetDataPooling();
|
||||
|
|
|
@ -1738,3 +1738,12 @@ extensions/files_repo/sql/files_repo.sql
|
|||
extensions/files_repo
|
||||
extensions/resource_exportation.php
|
||||
extensions/resource_registration.php
|
||||
enterprise/include/class/Aws.cloud.php
|
||||
enterprise/include/class/Azure.cloud.php
|
||||
enterprise/include/class/DB2.app.php
|
||||
enterprise/include/class/Google.cloud.php
|
||||
enterprise/include/class/MicrosoftSQLServer.app.php
|
||||
enterprise/include/class/MySQL.app.php
|
||||
enterprise/include/class/Oracle.app.php
|
||||
enterprise/include/class/SAP.app.php
|
||||
enterprise/include/class/VMware.app.php
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
pandorafms.vmware=a272ee00a9b5f201bb708bef72bbe276
|
||||
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
|
||||
pandorafms.mysql=33d470c7492214d4b384ed307e81adf4
|
||||
pandorafms.vmware=1deafce1d55d3574645d8b136104e9ad
|
||||
pandorafms.mysql=ca7dd8b80a1a03a25eb0fb077818ad63
|
||||
pandorafms.mssql=1cc215409741d19080269ffba112810e
|
||||
|
@ -10,4 +10,4 @@ pandorafms.gcp.ce=6743d39452f8e1ad85d0d56a30843973
|
|||
pandorafms.aws.ec2=07416081f11d92a7d5d9441dabb5c5cb
|
||||
pandorafms.aws.s3=eff053a212ea112e2a37efd9debbe6a0
|
||||
pandorafms.aws.rds=47d7b02019329e1698f96db4959f9516
|
||||
pandorafms.azure.mc=04a1072d1ece8583645ad88204fbeed3
|
||||
pandorafms.azure.mc=04a1072d1ece8583645ad88204fbeed3
|
|
@ -125,7 +125,7 @@ UPDATE `tncm_agent_data_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FRO
|
|||
-- Update version for plugin oracle
|
||||
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle';
|
||||
-- Update version for plugin mysql
|
||||
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.mysql';
|
||||
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.mysql';
|
||||
|
||||
|
||||
SET @widget_id = NULL;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1514,6 +1514,7 @@ if ($update_module === true || $create_module === true) {
|
|||
$old_configuration_data = (string) get_parameter('old_configuration_data');
|
||||
$new_configuration_data = '';
|
||||
|
||||
|
||||
$custom_string_1_default = '';
|
||||
$custom_string_2_default = '';
|
||||
$custom_string_3_default = '';
|
||||
|
@ -1979,6 +1980,19 @@ if ($update_module) {
|
|||
}
|
||||
}
|
||||
|
||||
$def_msg = __('There was a problem updating module. Processing error');
|
||||
|
||||
if (preg_match('/module_type\s+([^\\n]+)/', io_safe_output($configuration_data), $matches)) {
|
||||
$config_module_type = $matches[1];
|
||||
|
||||
$type_id = (int) db_get_value('id_tipo', 'ttipo_modulo', 'nombre', $config_module_type);
|
||||
|
||||
if ($type_id !== $id_module_type) {
|
||||
$def_msg = __('There was a problem updating module: module type cannot be edited');
|
||||
$result = ERR_GENERIC;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_error($result) === true) {
|
||||
switch ($result) {
|
||||
case ERR_EXIST:
|
||||
|
@ -1996,7 +2010,7 @@ if ($update_module) {
|
|||
case ERR_DB:
|
||||
case ERR_GENERIC:
|
||||
default:
|
||||
$msg = __('There was a problem updating module. Processing error');
|
||||
$msg = $def_msg;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -318,7 +318,7 @@ $filterTable->data[0][0] = html_print_label_input_block(
|
|||
$return_all_group,
|
||||
'ag_group',
|
||||
$ag_group,
|
||||
'this.form.submit();',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
|
@ -337,7 +337,7 @@ $filterTable->data[0][1] = html_print_label_input_block(
|
|||
$recursion,
|
||||
true,
|
||||
false,
|
||||
'this.form.submit()'
|
||||
''
|
||||
).'</div>'
|
||||
);
|
||||
|
||||
|
@ -347,7 +347,7 @@ $filterTable->data[0][2] = html_print_label_input_block(
|
|||
$showAgentFields,
|
||||
'disabled',
|
||||
$disabled,
|
||||
'this.form.submit()',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
|
@ -365,7 +365,7 @@ $filterTable->data[0][3] = html_print_label_input_block(
|
|||
$fields,
|
||||
'os',
|
||||
$os,
|
||||
'this.form.submit()',
|
||||
'',
|
||||
'All',
|
||||
0,
|
||||
true,
|
||||
|
|
|
@ -1053,7 +1053,7 @@ if ($modules !== false) {
|
|||
$data[8] .= html_print_menu_button(
|
||||
[
|
||||
'href' => 'index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&duplicate_module='.$module['id_agente_modulo'],
|
||||
'onClick' => "if (!confirm(\' '.__('Are you sure?').'\')) return false;",
|
||||
'onClick' => "if (!confirm('".__('Are you sure?')."')) return false;",
|
||||
'image' => 'images/copy.svg',
|
||||
'title' => __('Duplicate'),
|
||||
],
|
||||
|
@ -1064,8 +1064,8 @@ if ($modules !== false) {
|
|||
$data[8] .= html_print_menu_button(
|
||||
[
|
||||
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&fix_module='.$module['id_agente_modulo'],
|
||||
'onClick' => "if (!confirm(\' '.__('Are you sure?').'\')) return false;",
|
||||
'image' => 'images/module-graph.svg',
|
||||
'onClick' => "if (!confirm('".__('Are you sure?')."')) return false;",
|
||||
'image' => 'images/normalization@svg.svg',
|
||||
'title' => __('Normalize'),
|
||||
'disabled' => (isset($numericModules[$type]) === false || $numericModules[$type] === false),
|
||||
'disabled_title' => ' ('.__('Disabled').')',
|
||||
|
@ -1077,7 +1077,7 @@ if ($modules !== false) {
|
|||
$data[8] .= html_print_menu_button(
|
||||
[
|
||||
'href' => 'index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&create_network_from_module=1&id_agente='.$id_agente.'&create_module_from='.$module['id_agente_modulo'],
|
||||
'onClick' => "if (!confirm(\' '.__('Are you sure?').'\')) return false;",
|
||||
'onClick' => "if (!confirm('".__('Are you sure?')."')) return false;",
|
||||
'image' => 'images/cluster@os.svg',
|
||||
'title' => __('Create network component'),
|
||||
'disabled' => ((is_user_admin($config['id_user']) === true) && (int) $module['id_modulo'] === MODULE_NETWORK) === false,
|
||||
|
|
|
@ -81,16 +81,6 @@ if ((bool) check_acl($config['id_user'], 0, 'AR') === true
|
|||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||
// Applications.
|
||||
$sub2 = [];
|
||||
// Check if app has been migrated.
|
||||
if (enterprise_installed() === true) {
|
||||
(ManageExtensions::isMigrated('pandorafms.mssql') === true) ?: ($sub2['godmode/servers/discovery&wiz=app&mode=MicrosoftSQLServer']['text'] = __('Microsoft SQL Server (legacy)'));
|
||||
(ManageExtensions::isMigrated('pandorafms.mysql') === true) ?: ($sub2['godmode/servers/discovery&wiz=app&mode=mysql']['text'] = __('Mysql (legacy)'));
|
||||
(ManageExtensions::isMigrated('pandorafms.oracle') === true) ?: ($sub2['godmode/servers/discovery&wiz=app&mode=oracle']['text'] = __('Oracle (legacy)'));
|
||||
(ManageExtensions::isMigrated('pandorafms.vmware') === true) ?: ($sub2['godmode/servers/discovery&wiz=app&mode=vmware']['text'] = __('VMware (legacy)'));
|
||||
(ManageExtensions::isMigrated('pandorafms.sap.desert') === true) ?: ($sub2['godmode/servers/discovery&wiz=app&mode=SAP']['text'] = __('SAP (legacy)'));
|
||||
(ManageExtensions::isMigrated('pandorafms.db2') === true) ?: ($sub2['godmode/servers/discovery&wiz=app&mode=DB2']['text'] = __('DB2 (legacy)'));
|
||||
}
|
||||
|
||||
$extensions = ManageExtensions::getExtensionBySection('app');
|
||||
if ($extensions !== false) {
|
||||
foreach ($extensions as $key => $extension) {
|
||||
|
@ -112,13 +102,6 @@ if ((bool) check_acl($config['id_user'], 0, 'AR') === true
|
|||
|
||||
// Cloud.
|
||||
$sub2 = [];
|
||||
if (enterprise_installed() === true) {
|
||||
(ManageExtensions::isMigrated('pandorafms.aws.ec2') === true) ?: (ManageExtensions::isMigrated('pandorafms.aws.s3') === true) ?: (ManageExtensions::isMigrated('pandorafms.aws.rds') === true) ?: ($sub2['godmode/servers/discovery&wiz=cloud&mode=amazonws']['text'] = __('Amazon Web Services (legacy)'));
|
||||
(ManageExtensions::isMigrated('pandorafms.azure.mc') === true) ?: ($sub2['godmode/servers/discovery&wiz=cloud&mode=azure']['text'] = __('Microsoft Azure (legacy)'));
|
||||
(ManageExtensions::isMigrated('pandorafms.azure.gcp.ce') === true) ?: ($sub2['godmode/servers/discovery&wiz=cloud&mode=gcp']['text'] = __('Google Compute Platform (legacy)'));
|
||||
}
|
||||
|
||||
|
||||
$extensions = ManageExtensions::getExtensionBySection('cloud');
|
||||
if ($extensions !== false) {
|
||||
foreach ($extensions as $key => $extension) {
|
||||
|
|
|
@ -366,12 +366,12 @@ $filterTable->data[0][] = html_print_label_input_block(
|
|||
|
||||
$filterTable->data[0][] = html_print_label_input_block(
|
||||
__('Group'),
|
||||
html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, 'this.form.submit();', '', 0, true, false, true, '', false)
|
||||
html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false)
|
||||
);
|
||||
|
||||
$filterTable->data[0][] = html_print_label_input_block(
|
||||
__('Group Recursion'),
|
||||
html_print_checkbox_switch('recursion', 1, $recursion, true, false, 'this.form.submit()')
|
||||
html_print_checkbox_switch('recursion', 1, $recursion, true, false, '')
|
||||
);
|
||||
|
||||
if (is_metaconsole() === false) {
|
||||
|
|
|
@ -643,6 +643,7 @@ foreach ($layoutDatas as $layoutData) {
|
|||
default:
|
||||
if ($layoutData['id_layout_linked'] != 0) {
|
||||
// It is a item that links with other visualmap
|
||||
$table->data[($i + 2)][1] = '';
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -756,7 +757,7 @@ foreach ($layoutDatas as $layoutData) {
|
|||
$layoutData['id_layout_linked'],
|
||||
'',
|
||||
'None',
|
||||
'',
|
||||
'0',
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
|
|
|
@ -632,7 +632,7 @@ if (empty($create) === false || empty($view) === false) {
|
|||
|
||||
$datam[1] = html_print_label_input_block(
|
||||
__('Default value').'<span class="normal_weight">('.$macro_name.')</span>',
|
||||
html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, false, '', "class='command_component command_macro text_input'", true)
|
||||
html_print_input_text_extended($macro_value_name, io_safe_input($macro_value_value), 'text-'.$macro_value_name, '', 30, 255, false, '', "class='command_component command_macro text_input'", true)
|
||||
);
|
||||
|
||||
$table->data['plugin_'.$next_name_number] = $datam;
|
||||
|
|
|
@ -82,9 +82,6 @@ class Applications extends Wizard
|
|||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=app'
|
||||
);
|
||||
|
||||
// Print Warning Message.
|
||||
$this->printWarningMessage();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -108,148 +105,71 @@ class Applications extends Wizard
|
|||
);
|
||||
|
||||
$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)
|
||||
);
|
||||
if ($mode !== null) {
|
||||
// Load extension if exist.
|
||||
$extensions->run();
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
// Check if app has been migrated.
|
||||
if (method_exists($wiz, 'isMigrated') === true) {
|
||||
if ($wiz->isMigrated() === true) {
|
||||
ui_print_info_message(__('This legacy app has been migrated to new discovery 2.0 system'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$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();
|
||||
|
||||
if (method_exists($obj, 'isMigrated') === true) {
|
||||
if ($obj->isMigrated() === true) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$wiz_data[] = $obj->load();
|
||||
}
|
||||
|
||||
$wiz_data = array_merge($wiz_data, $extensions->loadExtensions());
|
||||
|
||||
$this->prepareBreadcrum(
|
||||
$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);
|
||||
|
||||
$not_defined_extensions = $extensions->loadExtensions(true);
|
||||
|
||||
$output = html_print_div(
|
||||
[
|
||||
'class' => 'agent_details_line',
|
||||
'content' => ui_toggle(
|
||||
Wizard::printBigButtonsList($not_defined_extensions, true),
|
||||
'<span class="subsection_header_title">'.__('Not installed').'</span>',
|
||||
'not_defined_apps',
|
||||
'not_defined_apps',
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
'',
|
||||
'box-flat white_table_graph w100p'
|
||||
'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,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
echo $output;
|
||||
// Header.
|
||||
ui_print_page_header(
|
||||
__('Applications'),
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
GENERIC_SIZE_TEXT,
|
||||
'',
|
||||
$this->printHeader(true)
|
||||
);
|
||||
|
||||
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>';
|
||||
}
|
||||
Wizard::printBigButtonsList($extensions->loadExtensions());
|
||||
|
||||
$not_defined_extensions = $extensions->loadExtensions(true);
|
||||
|
||||
$output = html_print_div(
|
||||
[
|
||||
'class' => 'agent_details_line',
|
||||
'content' => ui_toggle(
|
||||
Wizard::printBigButtonsList($not_defined_extensions, true),
|
||||
'<span class="subsection_header_title">'.__('Not installed').'</span>',
|
||||
'not_defined_apps',
|
||||
'not_defined_apps',
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
'',
|
||||
'box-flat white_table_graph w100p'
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
echo $output;
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -114,8 +114,6 @@ class Cloud extends Wizard
|
|||
*/
|
||||
public function run()
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Load styles.
|
||||
parent::run();
|
||||
|
||||
|
@ -127,139 +125,71 @@ class Cloud extends Wizard
|
|||
|
||||
$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)
|
||||
);
|
||||
if ($mode !== null) {
|
||||
// Load extension if exist.
|
||||
$extensions->run();
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
// Check if app has been migrated.
|
||||
if (method_exists($wiz, 'isMigrated') === true) {
|
||||
if ($wiz->isMigrated() === true) {
|
||||
ui_print_info_message(__('This legacy app has been migrated to new discovery 2.0 system'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$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();
|
||||
// Check if legacy has been migrated.
|
||||
if (method_exists($obj, 'isMigrated') === true) {
|
||||
if ($obj->isMigrated() === true) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$wiz_data[] = $obj->load();
|
||||
}
|
||||
|
||||
$wiz_data = array_merge($wiz_data, $extensions->loadExtensions());
|
||||
|
||||
$this->prepareBreadcrum(
|
||||
// Load classes and print selector.
|
||||
$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);
|
||||
|
||||
$not_defined_extensions = $extensions->loadExtensions(true);
|
||||
|
||||
$output = html_print_div(
|
||||
[
|
||||
'class' => 'agent_details_line',
|
||||
'content' => ui_toggle(
|
||||
Wizard::printBigButtonsList($not_defined_extensions, true),
|
||||
'<span class="subsection_header_title">'.__('Not installed').'</span>',
|
||||
'not_defined_apps',
|
||||
'not_defined_apps',
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
'',
|
||||
'box-flat white_table_graph w100p'
|
||||
'link' => ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery'
|
||||
),
|
||||
'label' => __('Discovery'),
|
||||
],
|
||||
);
|
||||
[
|
||||
'link' => $this->url,
|
||||
'label' => __('Cloud'),
|
||||
'selected' => true,
|
||||
],
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
echo $output;
|
||||
// Header.
|
||||
ui_print_page_header(
|
||||
__('Cloud'),
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
GENERIC_SIZE_TEXT,
|
||||
'',
|
||||
$this->printHeader(true)
|
||||
);
|
||||
|
||||
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>';
|
||||
}
|
||||
Wizard::printBigButtonsList($extensions->loadExtensions());
|
||||
|
||||
// Print Warning Message.
|
||||
$this->printWarningMessage();
|
||||
$not_defined_extensions = $extensions->loadExtensions(true);
|
||||
|
||||
return $result;
|
||||
$output = html_print_div(
|
||||
[
|
||||
'class' => 'agent_details_line',
|
||||
'content' => ui_toggle(
|
||||
Wizard::printBigButtonsList($not_defined_extensions, true),
|
||||
'<span class="subsection_header_title">'.__('Not installed').'</span>',
|
||||
'not_defined_apps',
|
||||
'not_defined_apps',
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
'',
|
||||
'box-flat white_table_graph w100p'
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
echo $output;
|
||||
|
||||
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>';
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -222,10 +222,6 @@ class DiscoveryTaskList extends HTML
|
|||
html_print_action_buttons($this->printForm($form, true));
|
||||
}
|
||||
|
||||
// Warning Message.
|
||||
$wizar_main = new Wizard();
|
||||
$wizar_main->printWarningMessage();
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -767,24 +767,6 @@ class ManageExtensions extends HTML
|
|||
],
|
||||
);
|
||||
}
|
||||
|
||||
$migrationHash = $this->canMigrate($row['short_name']);
|
||||
if ($migrationHash !== false && empty($migrationHash) !== true) {
|
||||
// Migrate button.
|
||||
$data[$key]['actions'] .= html_print_input_image(
|
||||
'button_migrate-'.$row['short_name'],
|
||||
'images/reset.png',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
[
|
||||
'onclick' => 'show_migration_form(\''.$row['short_name'].'\',\''.$migrationHash.'\')',
|
||||
'title' => __('Migrate old discovery tasks.'),
|
||||
'alt' => __('Migrate old discovery tasks.'),
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($data) === true) {
|
||||
|
@ -1123,386 +1105,6 @@ class ManageExtensions extends HTML
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the discovery app can be migrated to .disco system.
|
||||
* If app is migrated or is not in .ini file, it cannot be migrated.
|
||||
*
|
||||
* @param string $shortName Short name of the discovery app.
|
||||
*
|
||||
* @return string App hash, false in case hash doesnt exist on ini file, or is already migraeted..
|
||||
*/
|
||||
private function canMigrate(string $shortName='')
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (empty($shortName) === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 1. Check if app is already migrated:
|
||||
// Get migrated Discovery Apps from config.
|
||||
$migratedAppsJson = db_get_value('value', 'tconfig', 'token', 'migrated_discovery_apps');
|
||||
|
||||
if ($migratedAppsJson === false || empty($migratedAppsJson) === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decode JSON migrated apps.
|
||||
$migrateApps = json_decode(io_safe_output($migratedAppsJson), true);
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check app migrated.
|
||||
if (array_key_exists($shortName, $migrateApps)) {
|
||||
if (empty($migrateApps[$shortName]) === false && (bool) $migrateApps[$shortName] === true) {
|
||||
// Already migrated.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. If app not migrated yet, check DiscoveryApplicationsMigrateCodes.ini
|
||||
// Path to the INI file
|
||||
$filePath = $config['homedir'].'/extras/discovery/DiscoveryApplicationsMigrateCodes.ini';
|
||||
|
||||
// Parse the INI file.
|
||||
$migrationCodes = parse_ini_file($filePath, true);
|
||||
|
||||
if ($migrationCodes === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check shortname in ini file.
|
||||
if (array_key_exists($shortName, $migrationCodes) === false) {
|
||||
return false;
|
||||
} else {
|
||||
return $migrationCodes[$shortName];
|
||||
}
|
||||
|
||||
// All checks ok, discovery app can be migrated.
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prints html for migrate modal
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loadMigrateModal()
|
||||
{
|
||||
$shortname = get_parameter('shortname', null);
|
||||
$hash = get_parameter('hash', null);
|
||||
|
||||
$form = [
|
||||
'action' => '#',
|
||||
'id' => 'modal_migrate_form',
|
||||
'onsubmit' => 'return false;',
|
||||
'class' => 'modal',
|
||||
'name' => 'migrate_form',
|
||||
];
|
||||
|
||||
$inputs = [];
|
||||
$migrateMessage = __(
|
||||
'All ‘legacy‘ tasks for this application will be migrated to the new ‘.disco’ package system. All configurations and executions will be managed with the new system. This process will not be reversible.</br></br>'
|
||||
);
|
||||
$migrateMessage .= _('Please check the migration code for the application before proceeding.');
|
||||
|
||||
$inputs[] = [
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_migrate_message',
|
||||
'class' => 'hole flex-row flex-items-center w98p',
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => $migrateMessage,
|
||||
'arguments' => [
|
||||
'class' => 'first_lbl w98p',
|
||||
'name' => 'lbl_migrate_message',
|
||||
'id' => 'lbl_migrate_message',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Applicattion hash'),
|
||||
'id' => 'div-hash',
|
||||
'arguments' => [
|
||||
'name' => 'hash',
|
||||
'type' => 'text',
|
||||
'value' => $hash,
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
$inputs[] = [
|
||||
'block_id' => 'migrate_buttons',
|
||||
'class' => 'flex-row flex-items-center w98p',
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'arguments' => [
|
||||
'name' => 'cancel',
|
||||
'label' => __('Cancel'),
|
||||
'type' => 'button',
|
||||
'attributes' => [
|
||||
'icon' => 'left',
|
||||
'mode' => 'secondary',
|
||||
'class' => 'sub cancel float-left',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'name' => 'migrate',
|
||||
'label' => __('Migrate'),
|
||||
'type' => 'submit',
|
||||
'attributes' => [
|
||||
'icon' => 'wand',
|
||||
'class' => 'sub wand float-right',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$spinner = '<div id="migration-spinner" class="invisible spinner-fixed"></div>';
|
||||
|
||||
$migration_form = $this->printForm(
|
||||
[
|
||||
'form' => $form,
|
||||
'inputs' => $inputs,
|
||||
],
|
||||
true,
|
||||
);
|
||||
|
||||
echo $migration_form.$spinner;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Migrate app to new .disco system
|
||||
*
|
||||
* @return true if success, false in case of error.
|
||||
*/
|
||||
public function migrateApp()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$hash = get_parameter('hash', false);
|
||||
$shortName = get_parameter('shortName', false);
|
||||
|
||||
if ($hash === false || $shortName === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 1. Gets md5
|
||||
try {
|
||||
$console_md5 = $this->calculateDirectoryMD5($shortName, false);
|
||||
$server_md5 = $this->calculateDirectoryMD5($shortName, true);
|
||||
} catch (Exception $e) {
|
||||
$return = [
|
||||
'error' => $e->getMessage(),
|
||||
];
|
||||
echo json_encode($return);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($console_md5 === false || $server_md5 === false) {
|
||||
$return = [
|
||||
'error' => __('Error calculating app MD5'),
|
||||
];
|
||||
echo json_encode($return);
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Checks MD5
|
||||
if ($hash === $console_md5 && $hash === $server_md5) {
|
||||
// Init migration script.
|
||||
$return = $this->executeMigrationScript($shortName);
|
||||
} else {
|
||||
$return = [
|
||||
'error' => __('App hash does not match.'),
|
||||
];
|
||||
}
|
||||
|
||||
// Add shotrname to return for showing messages.
|
||||
$return['shortname'] = $shortName;
|
||||
|
||||
echo \json_encode($return);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculates directory MD% and saves it into array
|
||||
*
|
||||
* @param string $shortName Shorname of app.
|
||||
* @param boolean $server If true, perform checks into server folder.
|
||||
*
|
||||
* @return $md5 Array of md5 of filess.
|
||||
*/
|
||||
private function calculateDirectoryMD5($shortName, $server)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$md5List = [];
|
||||
|
||||
$serverPath = $config['remote_config'].'/discovery/'.$shortName;
|
||||
$consolePath = $config['homedir'].'/'.$this->path.'/'.$shortName;
|
||||
|
||||
if ($server === true) {
|
||||
$directory = $serverPath;
|
||||
} else {
|
||||
$directory = $consolePath;
|
||||
}
|
||||
|
||||
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory));
|
||||
|
||||
foreach ($iterator as $file) {
|
||||
if ($file->isFile()) {
|
||||
$md5List[] = md5_file($file->getPathname());
|
||||
}
|
||||
}
|
||||
|
||||
if ($server === true) {
|
||||
$console_ini = $consolePath.'/discovery_definition.ini';
|
||||
$logo = $consolePath.'/logo.png';
|
||||
|
||||
if (file_exists($console_ini)) {
|
||||
$md5List[] = md5_file($console_ini);
|
||||
}
|
||||
|
||||
if (file_exists($logo)) {
|
||||
$md5List[] = md5_file($logo);
|
||||
}
|
||||
}
|
||||
|
||||
sort($md5List);
|
||||
$concatenatedChecksums = implode('', $md5List);
|
||||
return md5($concatenatedChecksums);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Executed migration script for app
|
||||
*
|
||||
* @param string $shortName Shortname of the app.
|
||||
*
|
||||
* @return true on success, false in case of error.
|
||||
*/
|
||||
private function executeMigrationScript(string $shortName)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$dblock = db_get_lock('migrate-working');
|
||||
// Try to get a lock from DB.
|
||||
if ($dblock !== 1) {
|
||||
// Locked!
|
||||
return false;
|
||||
}
|
||||
|
||||
$scriptName = preg_replace('/^pandorafms\.(\w+\.?\w*)$/m', 'migrate.$1.sql', $shortName);
|
||||
|
||||
$script_path = $config['homedir'].'/extras/discovery/migration_scripts/'.$scriptName;
|
||||
if (file_exists($script_path) === false) {
|
||||
$return = [
|
||||
'error' => __('Migration script '.$scriptName.' could not be found'),
|
||||
];
|
||||
} else {
|
||||
try {
|
||||
$res = db_process_file($script_path, false);
|
||||
} catch (\Exception $e) {
|
||||
$return = [
|
||||
'error' => $e->getMessage(),
|
||||
];
|
||||
} finally {
|
||||
db_release_lock('migrate_working');
|
||||
}
|
||||
|
||||
if ($res === true) {
|
||||
$migrateAppsJson = io_safe_output(
|
||||
db_get_value(
|
||||
'value',
|
||||
'tconfig',
|
||||
'token',
|
||||
'migrated_discovery_apps'
|
||||
)
|
||||
);
|
||||
|
||||
$migrateApps = json_decode(
|
||||
$migrateAppsJson,
|
||||
true
|
||||
);
|
||||
|
||||
$migrateApps[$shortName] = 1;
|
||||
|
||||
$migratedAppsJson = json_encode($migrateApps);
|
||||
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
config_update_value(
|
||||
'migrated_discovery_apps',
|
||||
$migratedAppsJson
|
||||
);
|
||||
} else {
|
||||
$return = [
|
||||
'error' => __('Error decoding migrated apps json.'),
|
||||
];
|
||||
}
|
||||
|
||||
$return = [
|
||||
'result' => __('App migrated successfully'),
|
||||
'shortName' => $shortName,
|
||||
];
|
||||
} else {
|
||||
$return = [
|
||||
'error' => __('Error migrating app'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if legacy app has been migrated.
|
||||
*
|
||||
* @param string $shortName Shorn name of the app.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
static public function isMigrated($shortName)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$migrateAppsJson = io_safe_output(
|
||||
db_get_value(
|
||||
'value',
|
||||
'tconfig',
|
||||
'token',
|
||||
'migrated_discovery_apps'
|
||||
)
|
||||
);
|
||||
|
||||
$migratedApps = json_decode($migrateAppsJson, true);
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (array_key_exists($shortName, $migratedApps) === true && empty($migratedApps[$shortName] === false)) {
|
||||
return (bool) $migratedApps[$shortName];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read metadata CSV from system and store data structure in memory.
|
||||
*
|
||||
|
|
|
@ -584,28 +584,4 @@ class Wizard
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates warning message.
|
||||
*
|
||||
* @return void Warning message.
|
||||
*/
|
||||
public function printWarningMessage()
|
||||
{
|
||||
return ui_print_warning_message(
|
||||
__(
|
||||
'Starting with version 773, the new modular system of discovery 2.0 has been implemented. The current
|
||||
discovery (1.0) and its defined tasks will continue to function normally until the next LTS version,
|
||||
in which migration to the new system will be mandatory.
|
||||
The tasks of the current discovery (1.0) will be marked as legacy although it will not affect their
|
||||
operation, it will only be a visual indicator to identify and differentiate the tasks of discovery 1.0
|
||||
from those of the new version 2.0.
|
||||
In the intermediate versions between the 773 and the next LTS version, more applications of the new
|
||||
discovery 2.0 will be added. Both new and those that will come to replace the applications of the
|
||||
current discovery 1.0. In addition, an automatic migration tool for legacy (1.0) tasks to the new 2.0
|
||||
model will be included.'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?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>normalizar extremos</title>
|
||||
<g id="normalizar-extremos" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Group" transform="translate(0, -0)" fill="#3F3F3F">
|
||||
<path d="M10,1 C10.5522847,1 11,0.55228475 11,0 C11,-0.55228475 10.5522847,-1 10,-1 C9.44771525,-1 9,-0.55228475 9,0 C9,0.55228475 9.44771525,1 10,1 Z M10,-2 C10.5522847,-2 11,-2.44771525 11,-3 C11,-3.55228475 10.5522847,-4 10,-4 C9.44771525,-4 9,-3.55228475 9,-3 C9,-2.44771525 9.44771525,-2 10,-2 Z M10,4 C10.5522847,4 11,3.55228475 11,3 C11,2.44771525 10.5522847,2 10,2 C9.44771525,2 9,2.44771525 9,3 C9,3.55228475 9.44771525,4 10,4 Z M10,5 C10.5522847,5 11,5.44771525 11,6 C11,6.18260372 10.9510565,6.35377607 10.8655723,6.5011143 C10.9512743,6.64698644 11,6.81780297 11,7 C11,7.55228475 10.5522847,8 10,8 C9.44771525,8 9,7.55228475 9,7 C9,6.81780297 9.04872573,6.64698644 9.13385712,6.4998705 C9.0489435,6.35377607 9,6.18260372 9,6 C9,5.44771525 9.44771525,5 10,5 Z M10,11 C10.5522847,11 11,10.5522847 11,10 C11,9.44771525 10.5522847,9 10,9 C9.44771525,9 9,9.44771525 9,10 C9,10.5522847 9.44771525,11 10,11 Z M10,15 C10.5522847,15 11,15.4477153 11,16 L9,16 L9.00672773,15.8833789 C9.06449284,15.3860402 9.48716416,15 10,15 Z" id="Oval-2" transform="translate(10, 6) rotate(90) translate(-10, -6)"></path>
|
||||
<path d="M10,9.00004336 C10.5522847,9.00004336 11,8.55232811 11,8.00004336 C11,7.44775861 10.5522847,7.00004336 10,7.00004336 C9.44771525,7.00004336 9,7.44775861 9,8.00004336 C9,8.55232811 9.44771525,9.00004336 10,9.00004336 Z M10,6.00004336 C10.5522847,6.00004336 11,5.55232811 11,5.00004336 C11,4.44775861 10.5522847,4.00004336 10,4.00004336 C9.44771525,4.00004336 9,4.44775861 9,5.00004336 C9,5.55232811 9.44771525,6.00004336 10,6.00004336 Z M10,12.0000434 C10.5522847,12.0000434 11,11.5523281 11,11.0000434 C11,10.4477586 10.5522847,10.0000434 10,10.0000434 C9.44771525,10.0000434 9,10.4477586 9,11.0000434 C9,11.5523281 9.44771525,12.0000434 10,12.0000434 Z M10,13.0000434 C10.5522847,13.0000434 11,13.4477586 11,14.0000434 C11,14.1826471 10.9510565,14.3538194 10.8655723,14.5011577 C10.9512743,14.6470298 11,14.8178463 11,15.0000434 C11,15.5523281 10.5522847,16.0000434 10,16.0000434 C9.44771525,16.0000434 9,15.5523281 9,15.0000434 C9,14.8178463 9.04872573,14.6470298 9.13385712,14.4999139 C9.0489435,14.3538194 9,14.1826471 9,14.0000434 C9,13.4477586 9.44771525,13.0000434 10,13.0000434 Z M10,19.0000434 C10.5522847,19.0000434 11,18.5523281 11,18.0000434 C11,17.4477586 10.5522847,17.0000434 10,17.0000434 C9.44771525,17.0000434 9,17.4477586 9,18.0000434 C9,18.5523281 9.44771525,19.0000434 10,19.0000434 Z M10,23.0000434 C10.5522847,23.0000434 11,23.4477586 11,24.0000434 L9,24.0000434 L9.00672773,23.8834222 C9.06449284,23.3860835 9.48716416,23.0000434 10,23.0000434 Z" id="Oval-2" transform="translate(10, 14) scale(-1, 1) rotate(90) translate(-10, -14)"></path>
|
||||
<path d="M11,5.00004336 L11,15.0000434 L9,15.0000434 L9,5.00004336 L11,5.00004336 Z M19,9.00004336 C19.5522847,9.00004336 20,9.44775861 20,10.0000434 C20,10.5523281 19.5522847,11.0000434 19,11.0000434 C18.4477153,11.0000434 18,11.4477586 18,12.0000434 L18,15.0000434 L16,15.0000434 L16,12.0000434 C16,10.3431891 17.3431458,9.00004336 19,9.00004336 Z M4,5.00004336 L4,8.00004336 C4,9.6568976 2.65685425,11.0000434 1,11.0000434 C0.44771525,11.0000434 0,10.5523281 0,10.0000434 C0,9.44775861 0.44771525,9.00004336 1,9.00004336 C1.55228475,9.00004336 2,8.55232811 2,8.00004336 L2,5.00004336 L4,5.00004336 Z" id="Path-95" fill-rule="nonzero"></path>
|
||||
<path d="M18,13.0000434 L18,15.5000434 C18,17.9853247 15.9852814,20.0000434 13.5,20.0000434 C11.0147186,20.0000434 9,17.9853247 9,15.5000434 L9,13.0000434 L11,13.0000434 L11,15.5000434 C11,16.8807552 12.1192881,18.0000434 13.5,18.0000434 C14.8807119,18.0000434 16,16.8807552 16,15.5000434 L16,13.0000434 L18,13.0000434 Z M6.5,4.3355222e-05 C8.98528137,4.3355222e-05 11,2.01476198 11,4.50004336 L11,7.00004336 L9,7.00004336 L9,4.50004336 C9,3.11933148 7.88071187,2.00004336 6.5,2.00004336 C5.11928813,2.00004336 4,3.11933148 4,4.50004336 L4,7.00004336 L2,7.00004336 L2,4.50004336 C2,2.01476198 4.01471863,4.3355222e-05 6.5,4.3355222e-05 Z" id="Path-95" fill-rule="nonzero" opacity="0.4"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After (image error) Size: 4.4 KiB |
|
@ -166,7 +166,18 @@ if ($delete_event === true) {
|
|||
return;
|
||||
}
|
||||
|
||||
$name = events_get_description($id_evento);
|
||||
$r = events_delete($id_evento, $filter, false, true);
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_EVENT,
|
||||
sprintf(
|
||||
'ID event %s deleted by %s - %s',
|
||||
$id_evento,
|
||||
$config['id_user'],
|
||||
$name
|
||||
),
|
||||
$config['id_user']
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// Unexistent agent.
|
||||
if (is_metaconsole() === true
|
||||
|
@ -224,6 +235,19 @@ if ($validate_event === true) {
|
|||
EVENT_VALIDATE,
|
||||
$filter
|
||||
);
|
||||
|
||||
$name = events_get_description($id_evento);
|
||||
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_EVENT,
|
||||
sprintf(
|
||||
'ID event %s validated by %s - %s',
|
||||
$id_evento,
|
||||
$config['id_user'],
|
||||
$name
|
||||
),
|
||||
$config['id_user']
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// Unexistent agent.
|
||||
if (is_metaconsole() === true
|
||||
|
|
|
@ -780,7 +780,7 @@ class AgentsAlerts extends HTML
|
|||
'nothing' => false,
|
||||
'selected' => $this->groupId,
|
||||
'return' => true,
|
||||
'script' => 'this.form.submit()',
|
||||
'script' => '',
|
||||
'size' => '100%',
|
||||
],
|
||||
];
|
||||
|
|
|
@ -22,7 +22,7 @@ use DI\ContainerBuilder;
|
|||
/*
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC240319';
|
||||
$build_version = 'PC240325';
|
||||
$pandora_version = 'v7.0NG.776';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -13489,6 +13489,19 @@ function api_set_validate_event_by_id($id, $trash1=null, $trash2=null, $returnTy
|
|||
'estado' => 1,
|
||||
];
|
||||
|
||||
$name = events_get_description($id);
|
||||
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_EVENT,
|
||||
sprintf(
|
||||
'ID event %s validated by %s - %s',
|
||||
$id,
|
||||
$config['id_user'],
|
||||
$name
|
||||
),
|
||||
$config['id_user']
|
||||
);
|
||||
|
||||
$result = db_process_sql_update('tevento', $values, ['id_evento' => $id]);
|
||||
|
||||
if ($result === false) {
|
||||
|
|
|
@ -2806,7 +2806,7 @@ function config_process_config()
|
|||
}
|
||||
|
||||
if (!isset($config['custom_splash_login'])) {
|
||||
config_update_value('custom_splash_login', 'none.png');
|
||||
config_update_value('custom_splash_login', 'default');
|
||||
}
|
||||
|
||||
if (!isset($config['custom_docs_logo'])) {
|
||||
|
|
|
@ -4082,6 +4082,11 @@ div.div_groups_status {
|
|||
border: 1px solid #e2e2e2;
|
||||
}
|
||||
|
||||
#agents_modules_table th:nth-child(1),
|
||||
#agents_modules_table td:nth-child(1) {
|
||||
max-width: 215px;
|
||||
}
|
||||
|
||||
.dashboard {
|
||||
top: 23px;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -131,7 +131,7 @@
|
|||
<div style='padding-bottom: 50px'>
|
||||
<?php
|
||||
$version = '7.0NG.776';
|
||||
$build = '240319';
|
||||
$build = '240325';
|
||||
$banner = "v$version Build $build";
|
||||
error_reporting(0);
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ $table->data['group'][0] = html_print_label_input_block(
|
|||
true,
|
||||
'group_id',
|
||||
$group_id,
|
||||
'this.form.submit()',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
|
@ -361,7 +361,7 @@ $table->data['group'][1] = html_print_label_input_block(
|
|||
$fields,
|
||||
'status',
|
||||
$status,
|
||||
'this.form.submit()',
|
||||
'',
|
||||
__('All'),
|
||||
AGENT_STATUS_ALL,
|
||||
true,
|
||||
|
@ -436,7 +436,7 @@ $table->data[2][1] = html_print_label_input_block(
|
|||
$fields,
|
||||
'policies',
|
||||
$policies,
|
||||
'this.form.submit()',
|
||||
'',
|
||||
__('All'),
|
||||
0,
|
||||
true,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
%define debug_package %{nil}
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.776
|
||||
%define release 240319
|
||||
%define release 240325
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
%define debug_package %{nil}
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.776
|
||||
%define release 240319
|
||||
%define release 240325
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.776
|
||||
%define release 240319
|
||||
%define release 240325
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -2879,7 +2879,7 @@ SET @short_name = 'pandorafms.mysql';
|
|||
SET @name = 'MySQL';
|
||||
SET @section = 'app';
|
||||
SET @description = 'Monitor MySQL databases';
|
||||
SET @version = '1.1';
|
||||
SET @version = '1.2';
|
||||
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
|
||||
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
|
||||
|
||||
|
|
|
@ -1498,6 +1498,45 @@ class Client
|
|||
if ($filepath !== null) {
|
||||
include $filepath;
|
||||
|
||||
if ((bool) $config['history_db_enabled'] === true) {
|
||||
if (isset($config['history_db_connection']) === false
|
||||
|| $config['history_db_connection'] === false
|
||||
) {
|
||||
ob_start();
|
||||
$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
|
||||
);
|
||||
ob_get_clean();
|
||||
}
|
||||
|
||||
if ($config['history_db_connection'] !== false) {
|
||||
$curr_mysql_version_hist = @mysql_db_process_sql(
|
||||
'SELECT VERSION() AS version',
|
||||
'affected_rows',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
|
||||
$curr_mysql_version_hist = $curr_mysql_version_hist[0]['version'];
|
||||
|
||||
if (is_string($curr_mysql_version_hist) === true
|
||||
&& empty($curr_mysql_version_hist) === false
|
||||
) {
|
||||
if (isset($mysql_version) === true
|
||||
&& is_string($mysql_version) === true
|
||||
&& $this->compareVersions($curr_mysql_version_hist, $mysql_version) < 0
|
||||
) {
|
||||
throw new \Exception('MySQL version (history database) >= '.$mysql_version.' is required');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$curr_php_version = phpversion();
|
||||
$curr_mysql_version = db_get_value_sql('SELECT VERSION() AS version');
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.776-240319
|
||||
Version: 7.0NG.776-240325
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.776-240319"
|
||||
pandora_version="7.0NG.776-240325"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -46,7 +46,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.776";
|
||||
my $pandora_build = "240319";
|
||||
my $pandora_build = "240325";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.776";
|
||||
my $pandora_build = "240319";
|
||||
my $pandora_build = "240325";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
%define debug_package %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.776
|
||||
%define release 240319
|
||||
%define release 240325
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.776
|
||||
%define release 240319
|
||||
%define release 240325
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.776"
|
||||
PI_BUILD="240319"
|
||||
PI_BUILD="240325"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -38,7 +38,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.776 Build 240319";
|
||||
my $version = "7.0NG.776 Build 240325";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.776 Build 240319";
|
||||
my $version = "7.0NG.776 Build 240325";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
|
@ -1,83 +1,115 @@
|
|||
#!/bin/bash
|
||||
# DNS Plugin Pandora FMS Server plugin
|
||||
# (c) Antonio Delgado, Sancho Lerena 2010
|
||||
|
||||
# Hint: Use this DNS servers as reference:
|
||||
# Google: 8.8.8.8
|
||||
# Telefonica: 194.179.1.101
|
||||
|
||||
function help {
|
||||
echo -e "DNS Plugin for Pandora FMS Plugin server. http://pandorafms.com"
|
||||
echo " "
|
||||
echo "This plugin is used to check if a specific domain return a specific IP "
|
||||
echo -e "address, and to check how time (milisecs) takes the DNS to answer. \n"
|
||||
echo -e "Syntax:"
|
||||
echo -e "\t\t-d domain to check"
|
||||
echo -e "\t\t-i IP address to check with domain"
|
||||
echo -e "\t\t-s DNS Server to check"
|
||||
echo -e "\t\t-t Do a DNS time response check instead DNS resolve test"
|
||||
echo -e "Samples:"
|
||||
echo " ./dns_plugin.sh -d artica.es -i 69.163.176.17 -s 8.8.8.8"
|
||||
echo " ./dns_plugin.sh -d artica.es -t -s 8.8.8.8"
|
||||
echo ""
|
||||
exit
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
help
|
||||
fi
|
||||
|
||||
TIMEOUT_CHECK=0
|
||||
DOMAIN_CHECK=""
|
||||
# Default variables
|
||||
TIMEOUT_DURATION=15
|
||||
IP_CHECK=""
|
||||
DNS_CHECK=""
|
||||
DOMAIN_CHECK=""
|
||||
TIME_CHECK=0
|
||||
|
||||
# Main parsing code
|
||||
while getopts ":htd:i:s:" optname
|
||||
do
|
||||
case "$optname" in
|
||||
"h")
|
||||
help
|
||||
;;
|
||||
"d")
|
||||
DOMAIN_CHECK=$OPTARG
|
||||
;;
|
||||
"t")
|
||||
TIMEOUT_CHECK=1
|
||||
;;
|
||||
"i")
|
||||
# Regular expression to validate IP address
|
||||
IP_REGEX="^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)$"
|
||||
|
||||
# Function to display help with command-line options
|
||||
function show_help {
|
||||
echo "DNS Plugin for Pandora FMS Plugin server. http://pandorafms.com"
|
||||
echo " "
|
||||
echo "This plugin is used to check if a specific domain returns a specific IP address,"
|
||||
echo "and to check how much time (in milliseconds) it takes the DNS to answer."
|
||||
echo " "
|
||||
echo "Syntax:"
|
||||
echo " -d domain to check"
|
||||
echo " -i IP address to check with the domain"
|
||||
echo " -s DNS Server to check"
|
||||
echo " -t Do a DNS time response check instead of a DNS resolve test"
|
||||
echo " "
|
||||
echo "Samples:"
|
||||
echo " ./dns_plugin.sh -d example.com -i 192.168.1.1 -s 8.8.8.8"
|
||||
echo " ./dns_plugin.sh -d example.com -t -s 8.8.8.8"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Function to perform DNS query and get IP addresses
|
||||
function do_dns_query {
|
||||
results=$(timeout "${TIMEOUT_DURATION}s" dig "@$DNS_CHECK" +nocmd "$DOMAIN_CHECK" +multiline +answer A)
|
||||
echo "$results"
|
||||
}
|
||||
|
||||
# Command-line argument processing with getopts
|
||||
while getopts ":htd:i:s:" opt; do
|
||||
case "$opt" in
|
||||
d)
|
||||
DOMAIN_CHECK=$OPTARG
|
||||
;;
|
||||
i)
|
||||
# Validate the provided IP address
|
||||
if [[ $OPTARG =~ $IP_REGEX ]]; then
|
||||
IP_CHECK=$OPTARG
|
||||
;;
|
||||
"s")
|
||||
else
|
||||
echo "The provided IP address is incorrect: $OPTARG" >&2
|
||||
echo "-1"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
s)
|
||||
# Validate the DNS server IP address
|
||||
if [[ $OPTARG =~ $IP_REGEX ]]; then
|
||||
DNS_CHECK=$OPTARG
|
||||
;;
|
||||
|
||||
?)
|
||||
help
|
||||
;;
|
||||
default)
|
||||
help
|
||||
;;
|
||||
|
||||
else
|
||||
echo "The provided DNS server IP address is incorrect: $OPTARG" >&2
|
||||
echo "-1"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
t)
|
||||
TIME_CHECK=1
|
||||
;;
|
||||
?)
|
||||
show_help
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$DNS_CHECK" ]
|
||||
then
|
||||
help
|
||||
# Check if all necessary values are provided
|
||||
if [ -z "$DOMAIN_CHECK" ] || ([ -z "$IP_CHECK" ] && [ $TIME_CHECK -eq 0 ]) || [ -z "$DNS_CHECK" ]; then
|
||||
echo "Missing or incomplete arguments." >&2
|
||||
echo "-1"
|
||||
show_help
|
||||
fi
|
||||
|
||||
# Check if time response check should be performed
|
||||
if [ $TIME_CHECK -eq 1 ]; then
|
||||
results=$(do_dns_query)
|
||||
RETURN_TIME=$(echo "$results" | awk '/Query time:/ {print $4}')
|
||||
echo "$RETURN_TIME"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
results=`dig @$DNS_CHECK +nocmd $DOMAIN_CHECK +multiline +noall +answer A`
|
||||
targets=`echo "$results"| awk '{print $5}'`
|
||||
# Check if IP address check should be performed
|
||||
if [ -n "$IP_CHECK" ]; then
|
||||
results=$(do_dns_query)
|
||||
targets=$(echo "$results" | awk '{print $5}')
|
||||
|
||||
for x in $targets; do
|
||||
found=0
|
||||
for x in $targets; do
|
||||
if [ "$x" == "$IP_CHECK" ]; then
|
||||
echo 1
|
||||
exit 0
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if [ "$found" -eq 0 ]; then
|
||||
echo "0"
|
||||
else
|
||||
echo "1"
|
||||
fi
|
||||
else
|
||||
# Show error if IP to check is not specified
|
||||
echo "No IP to check was specified for the domain: $DOMAIN_CHECK" >&2
|
||||
echo "-1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 0
|
||||
exit 0
|
||||
|
||||
|
|
|
@ -798,6 +798,33 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||
return prevProps !== newProps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare object.
|
||||
* @param previousObject Object 1.
|
||||
* @param currentObject Object 2.
|
||||
* @return Returns true if these are equal.
|
||||
*/
|
||||
public compareObjects(
|
||||
previousObject: Record<string, any>,
|
||||
currentObject: Record<string, any>
|
||||
): boolean {
|
||||
for (let key in previousObject) {
|
||||
if (key === "ratio") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (currentObject.hasOwnProperty(key)) {
|
||||
if (previousObject[key] !== currentObject[key]) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* To recreate or update the HTMLElement which represents the item into the DOM.
|
||||
* @param prevProps If exists it will be used to only perform DOM updates instead of a full replace.
|
||||
|
@ -816,13 +843,11 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||
this.elementRef.style.minHeight = "max-content";
|
||||
}
|
||||
|
||||
if (
|
||||
prevProps.type == ItemType.LINE_ITEM ||
|
||||
prevProps.type == ItemType.NETWORK_LINK
|
||||
) {
|
||||
if (this.compareObjects(prevProps, this.props) === true) {
|
||||
this.updateDomElement(this.childElementRef);
|
||||
}
|
||||
}
|
||||
|
||||
// Move box.
|
||||
if (!prevProps || this.positionChanged(prevProps, this.props)) {
|
||||
this.moveElement(this.props.x, this.props.y);
|
||||
|
|
Loading…
Reference in New Issue