adding mssqlobdc and java discovery dependencies to installer
This commit is contained in:
parent
3c46271816
commit
727d6e6690
|
@ -1,20 +1,30 @@
|
|||
#!/bin/bash
|
||||
#######################################################
|
||||
# PandoraFMS Community online installation script
|
||||
#######################################################
|
||||
## Tested versions ##
|
||||
# Centos 7.9
|
||||
|
||||
# define variables
|
||||
#Constants
|
||||
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'
|
||||
|
||||
S_VERSION='2022012401'
|
||||
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
||||
|
||||
# define default variables
|
||||
[ "$TZ" ] || TZ="Europe/Madrid"
|
||||
[ "$DBHOST" ] || DBHOST=127.0.0.1
|
||||
[ "$DBNAME" ] || DBNAME=pandora
|
||||
[ "$DBUSER" ] || DBUSER=pandora
|
||||
[ "$DBPASS" ] || DBPASS=pandora
|
||||
[ "$DBPORT" ] || DBPORT=3306
|
||||
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
|
||||
[ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0
|
||||
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
|
||||
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
|
||||
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
|
||||
|
||||
# Ansi color code variables
|
||||
red="\e[0;91m"
|
||||
green="\e[0;92m"
|
||||
|
@ -60,7 +70,7 @@ check_pre_pandora () {
|
|||
|
||||
echo -en "${cyan}Checking environment ... ${reset}"
|
||||
rpm -qa | grep pandora &>> /dev/null && local fail=true
|
||||
[ -d "$CONSOLE_PATH" ] && local fail=true
|
||||
[ -d "$PANDORA_CONSOLE" ] && 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
|
||||
|
||||
|
@ -111,7 +121,7 @@ echo "Community installer version: $S_VERSION" >> $LOGFILE
|
|||
check_root_permissions
|
||||
|
||||
# Pre installed pandora
|
||||
check_pre_pandora
|
||||
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
|
||||
|
||||
# Connectivity
|
||||
check_repo_connection
|
||||
|
@ -125,6 +135,9 @@ execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]"
|
|||
# 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
|
||||
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'
|
||||
|
@ -151,7 +164,7 @@ execute_cmd "yum install -y $extra_repos" "Installing extra repositories"
|
|||
execute_cmd "yum-config-manager --enable remi-php74" "Configuring PHP"
|
||||
|
||||
# Install percona Database
|
||||
[ -f /etc/my.cnf ] && rm -rf /etc/my.cnf
|
||||
#[ -f /etc/my.cnf ] && rm -rf /etc/my.cnf
|
||||
execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server"
|
||||
|
||||
# Console dependencies
|
||||
|
@ -256,6 +269,7 @@ server_dependencies=" \
|
|||
perl(XML::Twig) \
|
||||
expect \
|
||||
openssh-clients \
|
||||
java \
|
||||
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
||||
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm"
|
||||
execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
|
||||
|
@ -277,30 +291,49 @@ oracle_dependencies=" \
|
|||
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 $oracle_dependencies" "Installing Oracle Instant client"
|
||||
|
||||
#ipam dependencies
|
||||
ipam_dependencies=" \
|
||||
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
||||
perl(NetAddr::IP) \
|
||||
perl(Sys::Syslog) \
|
||||
perl(DBI) \
|
||||
perl(XML::Simple) \
|
||||
perl(Geo::IP) \
|
||||
perl(IO::Socket::INET6) \
|
||||
perl(XML::Twig)"
|
||||
execute_cmd "dnf install -y $ipam_dependencies" "Installing IPAM Instant client"
|
||||
|
||||
# MSSQL dependencies el7
|
||||
execute_cmd "curl https://packages.microsoft.com/config/rhel/7/prod.repo -o /etc/yum.repos.d/mssql-release.repo" "Configuring Microsoft repositories"
|
||||
execute_cmd "yum remove unixODBC-utf16 unixODBC-utf16-devel" "Removing default unixODBC packages"
|
||||
execute_cmd "env ACCEPT_EULA=Y yum install -y msodbcsql17" "Installing ODBC Driver for Microsoft(R) SQL Server(R)"
|
||||
MS_ID=$(head -1 /etc/odbcinst.ini | tr -d '[]') &>> "$LOGFILE"
|
||||
#yum config-manager --set-disable packages-microsoft-com-prod
|
||||
|
||||
# Disabling SELINUX and firewalld
|
||||
setenforce 0
|
||||
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
|
||||
systemctl disable firewalld --now &>> $LOGFILE
|
||||
|
||||
|
||||
#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)
|
||||
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
|
||||
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('$DBROOTPASS');
|
||||
""" | mysql --connect-expired-password -uroot &>> "$LOGFILE"
|
||||
fi
|
||||
export MYSQL_PWD=$DBROOTPASS
|
||||
echo -en "${cyan}Creating Pandora FMS database...${reset}"
|
||||
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
|
||||
check_cmd_status 'Error creating database pandora, is this an empty node? if you have a previus installation please contact with support.'
|
||||
check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support."
|
||||
|
||||
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%' identified by \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST
|
||||
export MYSQL_PWD=$DBPASS
|
||||
|
||||
#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
|
||||
|
@ -374,13 +407,13 @@ mysql -u$DBUSER -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb_data.sq
|
|||
check_cmd_status 'Error Loading database schema data'
|
||||
|
||||
# Configure console
|
||||
cat > $CONSOLE_PATH/include/config.php << EO_CONFIG_F
|
||||
cat > $PANDORA_CONSOLE/include/config.php << EO_CONFIG_F
|
||||
<?php
|
||||
\$config["dbtype"] = "mysql";
|
||||
\$config["dbname"]="$DBNAME";
|
||||
\$config["dbuser"]="$DBUSER";
|
||||
\$config["dbpass"]="$DBPASS";
|
||||
\$config["dbhost"]="localhost";
|
||||
\$config["dbhost"]="$DBHOST";
|
||||
\$config["homedir"]="$PANDORA_CONSOLE";
|
||||
\$config["homeurl"]="/pandora_console";
|
||||
error_reporting(0);
|
||||
|
@ -420,9 +453,9 @@ 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
|
||||
chmod 600 $PANDORA_CONSOLE/include/config.php
|
||||
chown apache. $PANDORA_CONSOLE/include/config.php
|
||||
mv $PANDORA_CONSOLE/install.php $PANDORA_CONSOLE/install.done
|
||||
|
||||
# Prepare php.ini
|
||||
sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini
|
||||
|
@ -449,6 +482,7 @@ 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
|
||||
|
||||
# Set Oracle environment for pandora_server
|
||||
cat > /etc/pandora/pandora_server.env << 'EOF_ENV'
|
||||
|
@ -459,7 +493,7 @@ 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
|
||||
if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then
|
||||
cat >> /etc/sysctl.conf <<EO_KO
|
||||
# Pandora FMS Optimization
|
||||
|
||||
|
@ -487,6 +521,7 @@ net.core.optmem_max = 81920
|
|||
EO_KO
|
||||
|
||||
[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
|
||||
fi
|
||||
|
||||
# Fix pandora_server.{log,error} permissions to allow Console check them
|
||||
chown pandora:apache /var/log/pandora
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
PANDORA_CONSOLE=/var/www/html/pandora_console
|
||||
PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
|
||||
|
||||
S_VERSION='2021121401'
|
||||
S_VERSION='2022012401'
|
||||
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
||||
|
||||
# define default variables
|
||||
|
@ -26,6 +26,7 @@ LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
|||
[ "$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")
|
||||
|
||||
# Ansi color code variables
|
||||
red="\e[0;91m"
|
||||
|
@ -199,7 +200,7 @@ execute_cmd "dnf module install -y php:remi-7.4" "Configuring PHP"
|
|||
|
||||
# Install percona Database
|
||||
execute_cmd "dnf module disable -y mysql" "Disabiling mysql module"
|
||||
rm -rf /etc/my.cnf
|
||||
#rm -rf /etc/my.cnf
|
||||
execute_cmd "dnf install -y Percona-Server-server-57" "Installing Percona Server"
|
||||
|
||||
# Console dependencies
|
||||
|
@ -306,7 +307,8 @@ server_dependencies=" \
|
|||
perl(IO::Socket::INET6) \
|
||||
perl(XML::Twig) \
|
||||
expect \
|
||||
openssh-clients \
|
||||
openssh-clients \
|
||||
java \
|
||||
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
||||
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm"
|
||||
execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
|
||||
|
@ -332,6 +334,7 @@ oracle_dependencies=" \
|
|||
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm"
|
||||
execute_cmd "dnf install -y $oracle_dependencies" "Installing Oracle Instant client"
|
||||
|
||||
#ipam dependencies
|
||||
ipam_dependencies=" \
|
||||
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
||||
perl(NetAddr::IP) \
|
||||
|
@ -341,15 +344,22 @@ ipam_dependencies=" \
|
|||
perl(Geo::IP) \
|
||||
perl(IO::Socket::INET6) \
|
||||
perl(XML::Twig)"
|
||||
execute_cmd "dnf install -y $ipam_dependencies" "Installing Oracle Instant client"
|
||||
execute_cmd "dnf install -y $ipam_dependencies" "Installing IPAM Instant client"
|
||||
|
||||
# MSSQL dependencies el8
|
||||
execute_cmd "curl https://packages.microsoft.com/config/rhel/8/prod.repo -o /etc/yum.repos.d/mssql-release.repo" "Configuring Microsoft repositories"
|
||||
execute_cmd "dnf remove unixODBC-utf16 unixODBC-utf16-devel" "Removing default unixODBC packages"
|
||||
execute_cmd "env ACCEPT_EULA=Y dnf install -y msodbcsql17" "Installing ODBC Driver for Microsoft(R) SQL Server(R)"
|
||||
MS_ID=$(head -1 /etc/odbcinst.ini | tr -d '[]') &>> "$LOGFILE"
|
||||
#dnf config-manager --set-disable packages-microsoft-com-prod
|
||||
|
||||
# Disabling SELINUX and firewalld
|
||||
setenforce 0 &>> "$LOGFILE"
|
||||
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config &>> "$LOGFILE"
|
||||
systemctl disable firewalld --now &>> "$LOGFILE"
|
||||
|
||||
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
|
||||
#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)
|
||||
echo """
|
||||
|
@ -367,7 +377,6 @@ echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%' identified by \"$DBPA
|
|||
export MYSQL_PWD=$DBPASS
|
||||
|
||||
#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
|
||||
|
@ -518,6 +527,7 @@ 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
|
||||
|
||||
# Set Oracle environment for pandora_server
|
||||
cat > /etc/pandora/pandora_server.env << 'EOF_ENV'
|
||||
|
@ -528,8 +538,9 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/$VERSION/client64/lib
|
|||
export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64
|
||||
EOF_ENV
|
||||
|
||||
if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then
|
||||
# Kernel optimization
|
||||
|
||||
if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then
|
||||
cat >> /etc/sysctl.conf <<EO_KO
|
||||
# Pandora FMS Optimization
|
||||
|
||||
|
|
Loading…
Reference in New Issue