diff --git a/.gitignore b/.gitignore index 3de8a8ebac..261b3d161e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,11 @@ -pandora_console/attachment/agents +.vstags +MYMETA.json +MYMETA.yml +.vscode +.vscode* +.vstags +**/blib +**/PandoraFMS-Enterprise/Makefile +**/PandoraFMS-Enterprise/pm_to_blib +**/pandora_console/attachment/cache +**/pandora_console/attachment/agents diff --git a/extras/deploy-scripts/pandora_deploy_community.sh b/extras/deploy-scripts/pandora_deploy_community.sh new file mode 100644 index 0000000000..aa858eec3a --- /dev/null +++ b/extras/deploy-scripts/pandora_deploy_community.sh @@ -0,0 +1,585 @@ +#!/bin/bash + +# define variables +PANDORA_CONSOLE=/var/www/html/pandora_console +CONSOLE_PATH=/var/www/html/pandora_console +PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf +PANDORA_SERVER_BIN=/usr/bin/pandora_server +PANDORA_HA_BIN=/usr/bin/pandora_ha +PANDORA_TABLES_MIN=160 +DBHOST=127.0.0.1 +DBNAME=pandora +DBUSER=pandora +DBPASS=pandora +DBPORT=3306 +S_VERSION='2021012801' +LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" + +# Ansi color code variables +red="\e[0;91m" +green="\e[0;92m" +bold="\e[1m" +cyan="\e[0;36m" +reset="\e[0m" + +# Functions + +execute_cmd () { + local cmd="$1" + local msg="$2" + + echo -e "${cyan}$msg...${reset}" + $cmd &>> $LOGFILE + if [ $? -ne 0 ]; then + echo -e "${red}Fail${reset}" + [ "$3" ] && echo "$3" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + rm -rf $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 () { + export MYSQL_PWD=$DBPASS + + echo -en "${cyan}Checking environment ... ${reset}" + rpm -qa | grep pandora &>> /dev/null && local fail=true + [ -d "$CONSOLE_PATH" ] && local fail=true + [ -f /usr/bin/pandora_server ] && local fail=true + echo "use $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST &>> /dev/null && local fail=true + + [ ! $fail ] + check_cmd_status 'Error there is a current Pandora FMS installation on this node, please remove it to execute a clean install' +} + +check_repo_connection () { + execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection" + execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo" + execute_cmd "ping -c 2 support.pandorafms.com" "Checking Enterprise repo" +} + +check_root_permissions () { + echo -en "${cyan}Checking root account... ${reset}" + if [ "$(whoami)" != "root" ]; then + echo -e "${red}Fail${reset}" + echo "Please use a root account or sudo for installing PandoraFMS" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + exit 1 + + else + echo -e "${green}OK${reset}" + fi +} + +## Main +echo "Starting PandoraFMS Community deployment ver. $S_VERSION" + +# Centos Version +if [ ! "$(grep -i centos /etc/redhat-release)" ]; then + printf "${red}Error this is not a Centos Base system, this installer is compatible with Centos systems only${reset}\n" + exit 1 +fi + +execute_cmd "grep -i centos /etc/redhat-release" "Checking Centos" 'Error This is not a Centos Base system' + +echo -en "${cyan}Check Centos Version...${reset}" +[ $(sed -nr 's/VERSION_ID+=\s*"([0-9])"$/\1/p' /etc/os-release) -eq '7' ] +check_cmd_status 'Error OS version, Centos 7 is expected' + +# 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 +check_pre_pandora + +# Connectivity +check_repo_connection + +# Systemd +execute_cmd "systemctl status" "Cheking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env plese 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)' + +# 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 "yum --version" 'Checking needed tools: yum' + +# 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" + +#Installing wget +execute_cmd "yum install -y wget" "Installing wget" + +#Installing extra repositiries +extra_repos=" \ +tar \ +yum-utils \ +https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ +http://rpms.remirepo.net/enterprise/remi-release-7.rpm \ +https://repo.percona.com/yum/percona-release-latest.noarch.rpm" + +execute_cmd "yum install -y $extra_repos" "Installing extra repositories" +execute_cmd "yum-config-manager --enable remi-php73" "Configuring PHP" + +# Install percona Database +[ -f /etc/resolv.conf ] && rm -rf /etc/my.cnf +execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server" + +# 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 \ + libcroco \ + 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 \ + http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm" +execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies" + +# Server dependencies +server_dependencies=" \ + perl \ + vim \ + fping \ + perl-IO-Compress \ + nmap \ + sudo \ + perl-Time-HiRes \ + nfdump \ + net-snmp-utils \ + http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/wmi-1.3.14-4.el7.art.x86_64.rpm" +execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies" + +# SDK VMware perl dependencies +vmware_dependencies=" \ + http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm \ + perl-JSON \ + perl-Archive-Zip \ + openssl-devel \ + perl-Crypt-CBC \ + perl-Digest-SHA \ + http://firefly.artica.es/centos7/perl-Crypt-OpenSSL-AES-0.02-1.el7.x86_64.rpm" +execute_cmd "yum install -y $vmware_dependencies" "Installing SDK VMware perl dependencies" + +# Instant client Oracle +oracle_dependencier=" \ + https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm \ + https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm" +execute_cmd "yum install -y $vmware_dependencies" "Installing Oracle Instant client" + +# Disabling SELINUX and firewalld +setenforce 0 +sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config +systemctl disable firewalld --now &>> $LOGFILE + + +#Configuring Database +execute_cmd "systemctl start mysqld" "Starting database engine" +export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev) +echo """ + SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Pandor4!'); + UNINSTALL PLUGIN validate_password; + SET PASSWORD FOR 'root'@'localhost' = PASSWORD('pandora'); + """ | mysql --connect-expired-password -uroot + +export MYSQL_PWD=$DBPASS +echo -en "${cyan}Creating Pandora FMS database...${reset}" +echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST +check_cmd_status 'Error creating database pandora, is this an empty node? if you have a previus installation please contact with support.' + +echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%' identified by \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST + +#Generating my.cnf +POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g") +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 http://pandorafms.com for better results + +max_allowed_packet = 64M +innodb_buffer_pool_size = $POOL_SIZE +innodb_lock_wait_timeout = 90 +innodb_file_per_table +innodb_flush_log_at_trx_commit = 0 +innodb_flush_method = O_DIRECT +innodb_log_file_size = 64M +innodb_log_buffer_size = 16M +innodb_io_capacity = 100 +thread_cache_size = 8 +thread_stack = 256K +max_connections = 100 + +key_buffer_size=4M +read_buffer_size=128K +read_rnd_buffer_size=128K +sort_buffer_size=128K +join_buffer_size=4M + +query_cache_type = 1 +query_cache_size = 64M +query_cache_min_res_unit = 2k +query_cache_limit = 256K + +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" + +# Downloading Pandora Packages +execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" "Downloading Pandora FMS Server community" +execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" "Downloading Pandora FMS Console community" +execute_cmd "wget http://firefly.artica.es/centos7/pandorafms_agent_unix-7.0NG.751_x86_64.rpm" "Downloading Pandora FMS Agent community" + +# Install Pandora +execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages" + +# Copy gotty utility +execute_cmd "wget https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz" 'Dowloading gotty util' +tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE +execute_cmd "mv gotty /usr/bin/" 'Installing gotty util' + +# Enable Services +execute_cmd "systemctl enable mysqld --now" "Enabling Database service" +execute_cmd "systemctl enable httpd --now" "Enabling HTTPD 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 > $CONSOLE_PATH/include/config.php << EO_CONFIG_F + /etc/httpd/conf.d/pandora.conf << EO_CONFIG_F + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +EO_CONFIG_F + +# Add ws proxy options to apache. +cat >> /etc/httpd/conf.modules.d/00-proxy.conf << 'EO_HTTPD_MOD' +LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so + +EO_HTTPD_MOD + +cat >> /etc/httpd/conf.d/wstunnel.conf << 'EO_HTTPD_WSTUNNEL' +ProxyRequests Off + + Require all granted + + +ProxyPass /ws ws://127.0.0.1:8080 +ProxyPassReverse /ws ws://127.0.0.1:8080 + +EO_HTTPD_WSTUNNEL + +# 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 $CONSOLE_PATH/include/config.php +chown apache. $CONSOLE_PATH/include/config.php +mv $CONSOLE_PATH/install.php $CONSOLE_PATH/install.done + +# 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 = 500M/g" /etc/php.ini + +cat > /var/www/html/index.html << EOF_INDEX + +EOF_INDEX + +execute_cmd "systemctl restart httpd" "Restarting httpd 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 + +# Set Oracle environment for pandora_server +cat > /etc/pandora/pandora_server.env << 'EOF_ENV' +#!/bin/bash +VERSION=19.8 +export PATH=$PATH:$HOME/bin:/usr/lib/oracle/$VERSION/client64/bin +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/$VERSION/client64/lib +export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64 +EOF_ENV + +# Kernel optimization +cat >> /etc/sysctl.conf < /etc/logrotate.d/pandora_server < /etc/logrotate.d/pandora_agent <> $LOGFILE + +# Configure websocket to be started at start. +systemctl enable pandora_websocket_engine &>> $LOGFILE + +# Enable pandora ha service +systemctl enable pandora_server --now &>> $LOGFILE +execute_cmd "systemctl start pandora_server" "Starting Pandora FMS Server" + +# starting tentacle server +systemctl enable tentacle_serverd &>> $LOGFILE +execute_cmd "service tentacle_serverd start" "Starting Tentacle Server" + +# Enabling condole cron +execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron" +echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab +## Enabling agent +systemctl enable pandora_agent_daemon &>> $LOGFILE +execute_cmd "systemctl start pandora_agent_daemon" "starting Pandora FMS Agent" + +#SSH banner +[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me) + +cat > /etc/issue.net << EOF_banner + +Welcome to Pandora FMS appliance on CentOS +------------------------------------------ +Go to Public http://$ipplublic/pandora_console$to to login web console +$(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to Local http://"$1"/pandora_console to login web console"}') + +You can find more information at http://pandorafms.com + +EOF_banner + +rm -f /etc/issue +ln -s /etc/issue.net /etc/issue + +echo 'Banner /etc/issue.net' >> /etc/ssh/sshd_config + +# Remove temporary files +execute_cmd "echo done" "Pandora FMS Community installed" +cd +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 this credentials to login in the console "g"[ User: admin / Password: pandora ]"n" \n"}' \ No newline at end of file diff --git a/extras/docker/centos8/base/Dockerfile b/extras/docker/centos8/base/Dockerfile index 285f2f7ef8..a35aea2937 100644 --- a/extras/docker/centos8/base/Dockerfile +++ b/extras/docker/centos8/base/Dockerfile @@ -9,7 +9,7 @@ RUN dnf install -y --setopt=tsflags=nodocs \ http://rpms.remirepo.net/enterprise/remi-release-8.rpm RUN dnf module reset -y php && dnf module install -y php:remi-7.3 -RUN dnf config-manager --set-enabled PowerTools +RUN dnf config-manager --set-enabled powertools # Install console RUN dnf install -y --setopt=tsflags=nodocs \ @@ -88,7 +88,7 @@ RUN dnf install -y --setopt=tsflags=nodocs \ xorg-x11-fonts-75dpi \ xorg-x11-fonts-misc \ poppler-data \ - php-yaml; yum clean all + php-yaml RUN mkdir -p /run/php-fpm/ ; chown -R root:apache /run/php-fpm/ # not installed perl-Net-Telnet gtk-update-icon-cach ghostscript-fonts @@ -242,16 +242,31 @@ RUN dnf install -y --setopt=tsflags=nodocs \ perl-DBD-MySQL \ perl-DBI \ initscripts \ + vim \ + fping \ + perl-IO-Compress \ + perl-Time-HiRes \ + perl-Math-Complex \ + libnsl \ + mysql \ + java \ + net-snmp-utils \ net-tools \ nmap-ncat \ nmap \ net-snmp-utils \ sudo \ http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \ - http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/wmi-1.3.14-4.el7.art.x86_64.rpm + http://firefly.artica.es/centos8/wmi-1.3.14-4.el7.art.x86_64.rpm +# install utils +RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs +# SDK VMware perl dependencies +RUN dnf install -y http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm http://firefly.artica.es/centos8/perl-Crypt-SSLeay-0.73_07-1.gf.el8.x86_64.rpm perl-Net-HTTP perl-libwww-perl openssl-devel perl-Crypt-CBC perl-Bytes-Random-Secure perl-Crypt-Random-Seed perl-Math-Random-ISAAC perl-JSON http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm +# Instant client Oracle +RUN dnf install -y https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm -RUN dnf install -y supervisor crontabs mysql http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs +RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs EXPOSE 80 443 41121 162/udp diff --git a/extras/docker/centos8/build_image_el8.sh b/extras/docker/centos8/build_image_el8.sh index 00c50f6ff2..d4abd11eb8 100755 --- a/extras/docker/centos8/build_image_el8.sh +++ b/extras/docker/centos8/build_image_el8.sh @@ -64,6 +64,7 @@ wget $oconsoleurl wget $oserverurl if [ "$BASEBUILD" == 1 ] ; then + docker pull centos:8 # Open Base image echo "building Base el8 image" cd $DOCKER_PATH/base @@ -71,9 +72,12 @@ if [ "$BASEBUILD" == 1 ] ; then echo "Taging Open stack el8 latest image before upload" docker tag $OBASE_IMAGE:$VERSION $OBASE_IMAGE:latest echo -e ">>>> \n" +else + docker pull pandorafms/pandorafms-open-base-el8 fi if [ "$DBBUILD" == 1 ] ; then + docker pull percona:5.7 # Percona image echo "building Percona image" cd $OPEN/extras/docker/percona diff --git a/pandora_agents/pc/AIX/pandora_agent.conf b/pandora_agents/pc/AIX/pandora_agent.conf index 8fac8ed119..3df511bc34 100644 --- a/pandora_agents/pc/AIX/pandora_agent.conf +++ b/pandora_agents/pc/AIX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751, AIX version +# Version 7.0NG.752, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/FreeBSD/pandora_agent.conf b/pandora_agents/pc/FreeBSD/pandora_agent.conf index ce24564c69..67e18c61ce 100644 --- a/pandora_agents/pc/FreeBSD/pandora_agent.conf +++ b/pandora_agents/pc/FreeBSD/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751, FreeBSD Version +# Version 7.0NG.752, FreeBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/HP-UX/pandora_agent.conf b/pandora_agents/pc/HP-UX/pandora_agent.conf index 29a679bf67..73e4aa4cbd 100644 --- a/pandora_agents/pc/HP-UX/pandora_agent.conf +++ b/pandora_agents/pc/HP-UX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751, HP-UX Version +# Version 7.0NG.752, HP-UX Version # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/Linux/pandora_agent.conf b/pandora_agents/pc/Linux/pandora_agent.conf index 8b2745b7e5..251de4f671 100644 --- a/pandora_agents/pc/Linux/pandora_agent.conf +++ b/pandora_agents/pc/Linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751, GNU/Linux +# Version 7.0NG.752, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/NT4/pandora_agent.conf b/pandora_agents/pc/NT4/pandora_agent.conf index 0f416b06f1..4dcd110dc4 100644 --- a/pandora_agents/pc/NT4/pandora_agent.conf +++ b/pandora_agents/pc/NT4/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751, GNU/Linux +# Version 7.0NG.752, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/SunOS/pandora_agent.conf b/pandora_agents/pc/SunOS/pandora_agent.conf index 2563b1ef70..5f86dd5a56 100644 --- a/pandora_agents/pc/SunOS/pandora_agent.conf +++ b/pandora_agents/pc/SunOS/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751, Solaris Version +# Version 7.0NG.752, Solaris Version # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/Win32/pandora_agent.conf b/pandora_agents/pc/Win32/pandora_agent.conf index ccbc35f345..60d0bbde2c 100644 --- a/pandora_agents/pc/Win32/pandora_agent.conf +++ b/pandora_agents/pc/Win32/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (c) 2006-2021 Artica Soluciones Tecnologicas -# Version 7.0NG.751 +# Version 7.0NG.752 # This program is Free Software, you can redistribute it and/or modify it # under the terms of the GNU General Public Licence as published by the Free Software # Foundation; either version 2 of the Licence or any later version diff --git a/pandora_agents/shellscript/aix/pandora_agent.conf b/pandora_agents/shellscript/aix/pandora_agent.conf index 0deb3bdec9..5bc9d9ba56 100644 --- a/pandora_agents/shellscript/aix/pandora_agent.conf +++ b/pandora_agents/shellscript/aix/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.751, AIX version +# Version 7.0NG.752, AIX version # General Parameters # ================== diff --git a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf index 8597edec29..4183cef424 100644 --- a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf +++ b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.751 +# Version 7.0NG.752 # FreeBSD/IPSO version # Licenced under GPL licence, 2003-2007 Sancho Lerena diff --git a/pandora_agents/shellscript/hp-ux/pandora_agent.conf b/pandora_agents/shellscript/hp-ux/pandora_agent.conf index a54b49bac9..38030783ac 100644 --- a/pandora_agents/shellscript/hp-ux/pandora_agent.conf +++ b/pandora_agents/shellscript/hp-ux/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.751, HPUX Version +# Version 7.0NG.752, HPUX Version # General Parameters # ================== diff --git a/pandora_agents/shellscript/linux/pandora_agent.conf b/pandora_agents/shellscript/linux/pandora_agent.conf index 1d67fd1a96..bbf8fffcb6 100644 --- a/pandora_agents/shellscript/linux/pandora_agent.conf +++ b/pandora_agents/shellscript/linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751 +# Version 7.0NG.752 # Licensed under GPL license v2, # (c) 2003-2021 Artica Soluciones Tecnologicas # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/mac_osx/pandora_agent.conf b/pandora_agents/shellscript/mac_osx/pandora_agent.conf index 1d48a99f7c..e4e21da030 100644 --- a/pandora_agents/shellscript/mac_osx/pandora_agent.conf +++ b/pandora_agents/shellscript/mac_osx/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751 +# Version 7.0NG.752 # Licensed under GPL license v2, # (c) 2003-2021 Artica Soluciones Tecnologicas # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/openWRT/pandora_agent.conf b/pandora_agents/shellscript/openWRT/pandora_agent.conf index e1646612b2..f957a45b87 100644 --- a/pandora_agents/shellscript/openWRT/pandora_agent.conf +++ b/pandora_agents/shellscript/openWRT/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751 +# Version 7.0NG.752 # Licensed under GPL license v2, # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/solaris/pandora_agent.conf b/pandora_agents/shellscript/solaris/pandora_agent.conf index cccad45b4d..be2f3b22f3 100644 --- a/pandora_agents/shellscript/solaris/pandora_agent.conf +++ b/pandora_agents/shellscript/solaris/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.751, Solaris version +# Version 7.0NG.752, Solaris version # General Parameters # ================== diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf index 97c294f10d..1584ce4dc2 100644 --- a/pandora_agents/unix/AIX/pandora_agent.conf +++ b/pandora_agents/unix/AIX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751, AIX version +# Version 7.0NG.752, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 46ae44ff08..53f6c71331 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.751-210108 +Version: 7.0NG.752-210311 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 757a26d4b6..c7ac46ab2a 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.751-210108" +pandora_version="7.0NG.752-210311" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh b/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh index 48054e04c3..f21b4f0896 100644 --- a/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh +++ b/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh @@ -24,7 +24,7 @@ fi if [ "$#" -ge 2 ]; then VERSION="$2" else - VERSION="7.0NG.751" + VERSION="7.0NG.752" fi # Path for the generated DMG file diff --git a/pandora_agents/unix/Darwin/dmg/extras/distribution.xml b/pandora_agents/unix/Darwin/dmg/extras/distribution.xml index 0296ba0eb3..14e4b9ff7a 100644 --- a/pandora_agents/unix/Darwin/dmg/extras/distribution.xml +++ b/pandora_agents/unix/Darwin/dmg/extras/distribution.xml @@ -19,11 +19,11 @@ - pandorafms_src.pdk + pandorafms_src.pdk - pandorafms_uninstall.pdk + pandorafms_uninstall.pdk - + - + \ No newline at end of file diff --git a/pandora_console/godmode/alerts/alert_list.builder.php b/pandora_console/godmode/alerts/alert_list.builder.php index 4fa89805ce..73f22f8151 100644 --- a/pandora_console/godmode/alerts/alert_list.builder.php +++ b/pandora_console/godmode/alerts/alert_list.builder.php @@ -90,7 +90,7 @@ $table->data[0][1] = html_print_select( $table->data[0][1] .= ' '; $table->data[0][1] .= ' '; +$table->data[0][1] .= html_print_image('images/spinner.gif', true).''; $table->data[1][0] = __('Actions'); @@ -124,8 +124,8 @@ $table->data[1][1] .= html_print_input_text('fires_max', '', '', 4, 10, true); $table->data[1][1] .= ''; if (check_acl($config['id_user'], 0, 'LM')) { $table->data[1][1] .= ''; - $table->data[1][1] .= html_print_image('images/add.png', true); - $table->data[1][1] .= ''.__('Create Action').''; + $table->data[1][1] .= html_print_image('images/add.png', true, ['class' => 'invert_filter']); + $table->data[1][1] .= ''.__('Create Action').''; $table->data[1][1] .= ''; } @@ -157,8 +157,8 @@ if ($own_info['is_admin']) { $table->data[2][1] .= ' '; if (check_acl($config['id_user'], 0, 'LM')) { $table->data[2][1] .= ''; - $table->data[2][1] .= html_print_image('images/add.png', true); - $table->data[2][1] .= ''.__('Create Template').''; + $table->data[2][1] .= html_print_image('images/add.png', true, ['class' => 'invert_filter']); + $table->data[2][1] .= ''.__('Create Template').''; $table->data[2][1] .= ''; } @@ -190,7 +190,7 @@ if ($own_info['is_admin']) { if (!isset($step)) { if ($id_cluster) { - echo ""; + echo ""; } html_print_submit_button(__('Add alert'), 'add', false, 'class="sub wand"'); diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 8dde93e85f..6c6e6f66b3 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -50,9 +50,9 @@ if ($id_agente) { // Table for filter controls $form_filter = '
'; $form_filter .= ""; -$form_filter .= ''; +$form_filter .= '
'; $form_filter .= ''; -$form_filter .= "'; $temp = agents_get_agents(); @@ -65,7 +65,7 @@ if ($temp) { } } -$form_filter .= "'; -$form_filter .= "'; $form_filter .= ''; @@ -111,30 +111,34 @@ if (is_array($temp)) { } } -$form_filter .= "'; -$form_filter .= "'; -$form_filter .= ""; +$form_filter .= ""; $form_filter .= ''; $form_filter .= ''; -$form_filter .= "'; -$form_filter .= "'; + if (defined('METACONSOLE')) { $form_filter .= ''; $form_filter .= "
".__('Template name').''; +$form_filter .= "".__('Template name').''; $form_filter .= html_print_input_text('template_name', $templateName, '', 12, 255, true); $form_filter .= '".__('Agents').''; +$form_filter .= "".__('Agents').''; $params = []; $params['return'] = true; @@ -80,7 +80,7 @@ $form_filter .= ui_print_agent_autocomplete_input($params); $form_filter .= '".__('Module name').''; +$form_filter .= "".__('Module name').''; $form_filter .= html_print_input_text('module_name', $moduleName, '', 12, 255, true); $form_filter .= '
".__('Actions').''; +$form_filter .= "".__('Actions').''; $form_filter .= html_print_select($arrayActions, 'action_id', $actionID, '', __('All'), -1, true); $form_filter .= '".__('Field content').''; +$form_filter .= "".__('Field content').''; $form_filter .= html_print_input_text('field_content', $fieldContent, '', 12, 255, true); $form_filter .= '".__('Priority').''; +$form_filter .= "".__('Priority').''; $form_filter .= html_print_select(get_priorities(), 'priority', $priority, '', __('All'), -1, true); -$form_filter .= "
".__('Enabled / Disabled').''; +$form_filter .= "".__('Status').''; $ed_list = []; -$ed_list[0] = __('Enabled'); -$ed_list[1] = __('Disabled'); -$form_filter .= html_print_select($ed_list, 'enabledisable', $enabledisable, '', __('All'), -1, true); -$form_filter .= "".__('Standby').''; +$alert_status_filter = []; +$alert_status_filter['all_enabled'] = __('All (Enabled)'); +$alert_status_filter['all'] = __('All'); +$alert_status_filter['fired'] = __('Fired'); +$alert_status_filter['notfired'] = __('Not fired'); +$alert_status_filter['disabled'] = __('Disabled'); +$form_filter .= html_print_select($alert_status_filter, 'status_alert', $status_alert, '', '', '', true); +$form_filter .= "".__('Standby').''; $sb_list = []; $sb_list[1] = __('Standby on'); $sb_list[0] = __('Standby off'); $form_filter .= html_print_select($sb_list, 'standby', $standby, '', __('All'), -1, true); $form_filter .= '".__('Group').''; +$form_filter .= "".__('Group').''; $own_info = get_user_info($config['id_user']); if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_acl($config['id_user'], 0, 'AW')) { $return_all_group = false; @@ -144,6 +148,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_ $form_filter .= html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false); $form_filter .= '
"; @@ -153,7 +158,7 @@ if (defined('METACONSOLE')) { $form_filter .= '
'; } else { $form_filter .= ''; - $form_filter .= "
"; + $form_filter .= "
"; $form_filter .= html_print_submit_button(__('Update'), '', false, 'class="sub upd"', true); $form_filter .= '
'; } @@ -174,8 +179,15 @@ $simple_alerts = []; $total = 0; $where = ''; - if ($searchFlag) { + if ($status_alert === 'fired') { + $where .= ' AND talert_template_modules.times_fired > 0'; + } + + if ($status_alert === 'notfired') { + $where .= ' AND talert_template_modules.times_fired = 0'; + } + if ($priority != -1 && $priority != '') { $where .= ' AND id_alert_template IN (SELECT id FROM talert_templates WHERE priority = '.$priority.')'; } @@ -206,8 +218,12 @@ if ($searchFlag) { $where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.'))'; } - if ($enabledisable != -1 && $enabledisable != '') { - $where .= ' AND talert_template_modules.disabled ='.$enabledisable; + if ($status_alert === 'disabled') { + $where .= ' AND talert_template_modules.disabled = 1'; + } + + if ($status_alert === 'all_enabled') { + $where .= ' AND talert_template_modules.disabled = 0'; } if ($standby != -1 && $standby != '') { @@ -385,7 +401,7 @@ switch ($sortField) { break; } -$form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group; +$form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group.'&status_alert='.$status_alert; $sort_params = '&sort_field='.$sortField.'&sort='.$sort; if ($id_agente) { @@ -512,7 +528,7 @@ foreach ($simple_alerts as $alert) { $data[0] = ''; if ($alert['disabled']) { - $data[0] .= ''; + $data[0] .= ''; } $alias = db_get_value('alias', 'tagente', 'id_agente', $id_agent); @@ -563,7 +579,14 @@ foreach ($simple_alerts as $alert) { ); $data[2] .= ' '; - $data[2] .= html_print_image('images/zoom.png', true, ['id' => 'template-details-'.$alert['id_alert_template'], 'class' => 'img_help action_button_img']); + $data[2] .= html_print_image( + 'images/zoom.png', + true, + [ + 'id' => 'template-details-'.$alert['id_alert_template'], + 'class' => 'img_help action_button_img invert_filter', + ] + ); $data[2] .= ' '; if (check_acl($config['id_user'], $template_group, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) { @@ -572,7 +595,7 @@ foreach ($simple_alerts as $alert) { $actions = alerts_get_alert_agent_module_actions($alert['id']); - $data[3] = ""; + $data[3] = "
"; // Get and show default actions for this alert $default_action = db_get_sql( 'SELECT id_alert_action @@ -587,12 +610,12 @@ foreach ($simple_alerts as $alert) { } foreach ($actions as $action_id => $action) { - $data[3] .= ''; + $data[3] .= ''; $data[3] .= ''; - $data[3] .= ''; } - $data[3] .= '
'; - $data[3] .= '
    '; - $data[3] .= '
  • '; + $data[3] .= '
      '; + $data[3] .= '
    • '; if ($alert['disabled']) { - $data[3] .= ''; + $data[3] .= ''; } else { $data[3] .= ''; } @@ -626,12 +649,11 @@ foreach ($simple_alerts as $alert) { $data[3] .= '
'; + $data[3] .= ''; $data[3] .= ui_print_help_tip(__('The default actions will be executed every time that the alert is fired and no other action is executed'), true); // Is possible manage actions if have LW permissions in the agent group of the alert module if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW')) { - // ~ $data[2] .= ''; - $data[3] .= ''; + $data[3] .= ''; $data[3] .= html_print_input_image( 'delete', 'images/cross.png', @@ -640,7 +662,7 @@ foreach ($simple_alerts as $alert) { true, [ 'title' => __('Delete action'), - 'class' => 'action_button_img', + 'class' => 'action_button_img invert_filter', ] ); $data[3] .= html_print_input_hidden('delete_action', 1, true); @@ -655,7 +677,7 @@ foreach ($simple_alerts as $alert) { true, [ 'title' => __('Update action'), - 'class' => 'action_button_img', + 'class' => 'action_button_img invert_filter', 'onclick' => 'show_display_update_action(\''.$action['id'].'\',\''.$alert['id'].'\',\''.$alert['id_agent_module'].'\',\''.$action_id.'\',\''.$alert['id_agent_module'].'\')', ] ); @@ -666,7 +688,7 @@ foreach ($simple_alerts as $alert) { $data[3] .= '
'; // Is possible manage actions if have LW permissions in the agent group of the alert module @@ -684,15 +706,15 @@ foreach ($simple_alerts as $alert) { $actions = alerts_get_alert_actions_filter(true, 'id_group IN ('.$filter_groups.')'); } - $data[3] .= ''; - echo '
 
'; + echo '
 
'; echo '
'; echo ''; - echo '
 
'; + echo '
 
'; echo ''; echo '