mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
Merge remote-tracking branch 'origin/develop' into ent-4755-base-de-datos-historico-revision
Conflicts: pandora_console/extras/delete_files/delete_files.txt
This commit is contained in:
commit
dbc48852aa
579
extras/deploy-scripts/pandora_deploy_community.sh
Normal file
579
extras/deploy-scripts/pandora_deploy_community.sh
Normal file
@ -0,0 +1,579 @@
|
||||
#!/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.artica.es" "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 $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 #S_VERSION' > $LOGFILE" "All installer activity is logged on $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}') -le 2000000 ]" '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/sysconfig/selinux
|
||||
systemctl disable firewalld --now &>> $LOGFILE
|
||||
|
||||
cat > /etc/issue.net << EOF_banner
|
||||
|
||||
Welcome to Pandora FMS appliance on CentOS
|
||||
------------------------------------------
|
||||
$(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 http://"$1"/pandora_console to manage this server"}')
|
||||
|
||||
You can find more information at http://pandorafms.com
|
||||
|
||||
EOF_banner
|
||||
|
||||
rm -f /etc/issue
|
||||
ln -s /etc/issue.net /etc/issue
|
||||
|
||||
execute_cmd "echo 'Banner /etc/issue.net' >> /etc/ssh/sshd_config" "Adding SSH banner"
|
||||
|
||||
#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
|
||||
<?php
|
||||
\$config["dbtype"] = "mysql";
|
||||
\$config["dbname"]="$DBNAME";
|
||||
\$config["dbuser"]="$DBUSER";
|
||||
\$config["dbpass"]="$DBPASS";
|
||||
\$config["dbhost"]="localhost";
|
||||
\$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
|
||||
|
||||
# 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
|
||||
<Proxy *>
|
||||
Require all granted
|
||||
</Proxy>
|
||||
|
||||
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
|
||||
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">
|
||||
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 <<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
|
||||
|
||||
execute_cmd "sysctl --system" "Applying Kernel optimization"
|
||||
|
||||
# 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
|
||||
|
||||
# Add websocket engine start script.
|
||||
mv /var/www/html/pandora_console/pandora_websocket_engine /etc/init.d/
|
||||
chmod +x /etc/init.d/pandora_websocket_engine
|
||||
|
||||
# Start Websocket engine
|
||||
/etc/init.d/pandora_websocket_engine start &>> $LOGFILE
|
||||
|
||||
# Configure websocket to be started at start.
|
||||
systemctl enable pandora_websocket_engine &>> $LOGFILE
|
||||
|
||||
# Enable pandora ha service
|
||||
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"
|
||||
|
||||
execute_cmd "echo done" "Pandora FMS Community installed"
|
||||
cd
|
||||
execute_cmd "rm -rf $HOME/pandora_deploy_tmp" "Removing temporary files"
|
||||
|
||||
GREEN='\033[01;32m'
|
||||
NONE='\033[0m'
|
||||
|
||||
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)
|
||||
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"}'
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.752-210127
|
||||
Version: 7.0NG.752-210128
|
||||
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.752-210127"
|
||||
pandora_version="7.0NG.752-210128"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -1016,7 +1016,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.752';
|
||||
use constant AGENT_BUILD => '210127';
|
||||
use constant AGENT_BUILD => '210128';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.752
|
||||
%define release 210127
|
||||
%define release 210128
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.752
|
||||
%define release 210127
|
||||
%define release 210128
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.752"
|
||||
PI_BUILD="210127"
|
||||
PI_BUILD="210128"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{210127}
|
||||
{210128}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.752(Build 210127)")
|
||||
#define PANDORA_VERSION ("7.0NG.752(Build 210128)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.752(Build 210127))"
|
||||
VALUE "ProductVersion", "(7.0NG.752(Build 210128))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.752-210127
|
||||
Version: 7.0NG.752-210128
|
||||
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.752-210127"
|
||||
pandora_version="7.0NG.752-210128"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -1,5 +1,6 @@
|
||||
operation/servers/recon_view.php
|
||||
operation/users/webchat.php
|
||||
operation/events/event_statistics.php
|
||||
include/javascript/webchat.js
|
||||
attachment/pandora_chat.log.json.txt
|
||||
attachment/pandora_chat.user_list.json.txt
|
||||
@ -69,6 +70,8 @@ enterprise/extensions/ipam/include/javascript/IpamMapController.js
|
||||
enterprise/extensions/ipam/ipam_action.php
|
||||
enterprise/extensions/ipam.php
|
||||
enterprise/extensions/ipam
|
||||
enterprise/extensions/disabled/visual_console_manager.php
|
||||
enterprise/extensions/visual_console_manager.php
|
||||
include/lib/WSManager.php
|
||||
include/lib/WebSocketServer.php
|
||||
include/lib/WebSocketUser.php
|
@ -135,6 +135,21 @@ UPDATE `trecon_script` SET `description`='Specific Pandora FMS In
|
||||
|
||||
ALTER TABLE `trecon_task` MODIFY COLUMN `review_mode` TINYINT(1) UNSIGNED DEFAULT 1;
|
||||
|
||||
DELETE FROM `tuser_task` WHERE id = 6;
|
||||
|
||||
UPDATE `tuser_task` SET `parameters`='a:4:{i:0;a:6:{s:11:"description";s:28:"Report pending to be created";s:5:"table";s:7:"treport";s:8:"field_id";s:9:"id_report";s:10:"field_name";s:4:"name";s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_group";}i:1;a:2:{s:11:"description";s:426:"Save to disk in path<a href="javascript:" class="tip" style="" ><img src="http://172.16.0.2/pandora_console/images/tip_help.png" data-title="The Apache user should have read-write access on this folder. E.g. /var/www/html/pandora_console/attachment" data-use_title_for_force_title="1" class="forced_title" alt="The Apache user should have read-write access on this folder. E.g. /var/www/html/pandora_console/attachment" /></a>";s:4:"type";s:6:"string";}i:2;a:2:{s:11:"description";s:16:"File nane prefix";s:4:"type";s:6:"string";}i:3;a:2:{s:11:"description";s:11:"Report Type";s:4:"type";s:11:"report_type";}}' WHERE `id`=3;
|
||||
|
||||
UPDATE `tuser_task_scheduled` SET
|
||||
`args` = REPLACE (`args`, 'a:3', 'a:5'),
|
||||
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:3;s:3:"PDF";s:15:"first_execution"')
|
||||
WHERE `id_user_task` = 3;
|
||||
|
||||
UPDATE `tuser_task_scheduled` SET
|
||||
`id_user_task` = 3,
|
||||
`args` = REPLACE (`args`, 'a:3', 'a:5'),
|
||||
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:3;s:3:"XML";s:15:"first_execution"')
|
||||
WHERE `id_user_task` = 6;
|
||||
|
||||
ALTER TABLE `ttag` MODIFY COLUMN `name` text NOT NULL default '';
|
||||
|
||||
COMMIT;
|
||||
|
@ -2526,6 +2526,20 @@ ALTER TABLE `tnetflow_filter` MODIFY COLUMN `router_ip` text NOT NULL;
|
||||
-- ----------------------------------------------------------------------
|
||||
UPDATE tuser_task set parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report";
|
||||
INSERT IGNORE INTO tuser_task VALUES (8, 'cron_task_generate_csv_log', 'a:1:{i:0;a:2:{s:11:"description";s:14:"Send to e-mail";s:4:"type";s:4:"text";}}', 'Send csv log');
|
||||
UPDATE `tuser_task` SET `parameters`='a:4:{i:0;a:6:{s:11:"description";s:28:"Report pending to be created";s:5:"table";s:7:"treport";s:8:"field_id";s:9:"id_report";s:10:"field_name";s:4:"name";s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_group";}i:1;a:2:{s:11:"description";s:426:"Save to disk in path<a href="javascript:" class="tip" style="" ><img src="http://172.16.0.2/pandora_console/images/tip_help.png" data-title="The Apache user should have read-write access on this folder. E.g. /var/www/html/pandora_console/attachment" data-use_title_for_force_title="1" class="forced_title" alt="The Apache user should have read-write access on this folder. E.g. /var/www/html/pandora_console/attachment" /></a>";s:4:"type";s:6:"string";}i:2;a:2:{s:11:"description";s:16:"File nane prefix";s:4:"type";s:6:"string";}i:3;a:2:{s:11:"description";s:11:"Report Type";s:4:"type";s:11:"report_type";}}' WHERE `id`=3;
|
||||
DELETE FROM `tuser_task` WHERE id = 6;
|
||||
|
||||
-- Migrate old tasks
|
||||
UPDATE `tuser_task_scheduled` SET
|
||||
`args` = REPLACE (`args`, 'a:3', 'a:5'),
|
||||
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:3;s:3:"PDF";s:15:"first_execution"')
|
||||
WHERE `id_user_task` = 3;
|
||||
|
||||
UPDATE `tuser_task_scheduled` SET
|
||||
`id_user_task` = 3,
|
||||
`args` = REPLACE (`args`, 'a:3', 'a:5'),
|
||||
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:3;s:3:"XML";s:15:"first_execution"')
|
||||
WHERE `id_user_task` = 6;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- ADD message in table 'tnews'
|
||||
@ -3970,3 +3984,4 @@ SELECT `id_recon_script`,`type`, `name`, `description`, `script`, `macros` FROM
|
||||
DELETE FROM `tconfig` WHERE `token` = 'ipam_installed';
|
||||
|
||||
DELETE FROM `tconfig` WHERE `token` = 'ipam_recon_script_id';
|
||||
|
||||
|
@ -42,7 +42,6 @@ if (!$is_metaconsole) {
|
||||
$url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite';
|
||||
$url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template';
|
||||
$url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard';
|
||||
$url_visual_console_manager = 'index.php?sec=screen&sec2=enterprise/extensions/visual_console_manager';
|
||||
}
|
||||
|
||||
$pure = (int) get_parameter('pure', 0);
|
||||
|
@ -41,7 +41,6 @@ if (!$is_metaconsole) {
|
||||
$url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite';
|
||||
$url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template';
|
||||
$url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard';
|
||||
$url_visual_console_manager = 'index.php?sec=screen&sec2=enterprise/extensions/visual_console_manager';
|
||||
}
|
||||
|
||||
$buttons['visual_console'] = [
|
||||
|
@ -409,7 +409,7 @@ class DiscoveryTaskList extends HTML
|
||||
// Status.
|
||||
$table->headstyle[5] .= 'min-width: 50px; width: 100px;';
|
||||
// Task type.
|
||||
$table->headstyle[6] .= 'min-width: 150px; width: 150px;';
|
||||
$table->headstyle[6] .= 'min-width: 200px; width: 200px;';
|
||||
// Progress.
|
||||
$table->headstyle[7] .= 'min-width: 50px; width: 150px;';
|
||||
// Updated at.
|
||||
@ -552,6 +552,15 @@ class DiscoveryTaskList extends HTML
|
||||
true
|
||||
);
|
||||
} else if ($task['review_mode'] == DISCOVERY_STANDARD) {
|
||||
if ($task['type'] == DISCOVERY_APP_VMWARE) {
|
||||
if ($task['status'] <= 0 && $task['utimestamp'] != 0) {
|
||||
$data[5] = __('Done');
|
||||
} else if ($task['status'] > 0) {
|
||||
$data[5] = __('Pending');
|
||||
} else {
|
||||
$data[5] = __('Not started');
|
||||
}
|
||||
} else {
|
||||
if ($task['status'] <= 0
|
||||
&& empty($task['summary']) === false
|
||||
) {
|
||||
@ -563,6 +572,7 @@ class DiscoveryTaskList extends HTML
|
||||
} else {
|
||||
$data[5] = __('Pending');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($task['status'] <= 0
|
||||
&& empty($task['summary']) === false
|
||||
@ -1207,12 +1217,15 @@ class DiscoveryTaskList extends HTML
|
||||
$output = '';
|
||||
|
||||
// Header information.
|
||||
if ((int) $task['status'] <= 0
|
||||
&& empty($summary)
|
||||
&& $task['id_recon_script'] == 0
|
||||
) {
|
||||
if ((int) $task['status'] <= 0 && empty($summary)) {
|
||||
if ($task['type'] == DISCOVERY_APP_VMWARE && $task['utimestamp'] != 0) {
|
||||
$outputMessage = __('Task completed.');
|
||||
} else {
|
||||
$outputMessage = __('This task has never executed');
|
||||
}
|
||||
|
||||
$output .= ui_print_info_message(
|
||||
__('This task has never executed'),
|
||||
$outputMessage,
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC210127';
|
||||
$build_version = 'PC210128';
|
||||
$pandora_version = 'v7.0NG.752';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -1557,23 +1557,14 @@ function config_update_config()
|
||||
}
|
||||
|
||||
if (Config::set(
|
||||
'days_compact',
|
||||
get_parameter('history_dbh_days_compact'),
|
||||
'history_partitions_auto',
|
||||
get_parameter_switch('history_partitions_auto'),
|
||||
true
|
||||
) !== true
|
||||
) {
|
||||
$error_update[] = __('Historical database days compact');
|
||||
}
|
||||
|
||||
if (Config::set(
|
||||
'step_compact',
|
||||
get_parameter('history_dbh_step_compact'),
|
||||
true
|
||||
) !== true
|
||||
) {
|
||||
$error_update[] = __('Historical database step compact');
|
||||
}
|
||||
|
||||
if (Config::set(
|
||||
'event_purge',
|
||||
get_parameter('history_dbh_events_purge'),
|
||||
|
@ -600,42 +600,6 @@ function cron_list_table()
|
||||
$data[0] = '';
|
||||
}
|
||||
|
||||
$data[1] = $task['id_usuario'];
|
||||
$data[2] = db_get_value(
|
||||
'name',
|
||||
'tuser_task',
|
||||
'id',
|
||||
$task['id_user_task']
|
||||
);
|
||||
|
||||
$args = unserialize($task['args']);
|
||||
$report = reports_get_report($args[0]);
|
||||
|
||||
// Check ACL in reports_get_report return false.
|
||||
if ($report === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$path = $args[1];
|
||||
$data[2] .= '<br>- '.__('Report').": <a href='index.php?sec=reporting&sec2=operation/reporting/reporting_viewer";
|
||||
$data[2] .= '&id='.$args[0]."'>".$report['name'].'</a>';
|
||||
$data[2] .= '<br>- '.__('Path').': '.$path.'</a>';
|
||||
break;
|
||||
|
||||
case 'cron_task_save_xml_report_to_disk':
|
||||
if ($write_perms || $manage_pandora) {
|
||||
$data[0] = '<a href="'.$url;
|
||||
$data[0] .= 'force_run=1&id_user_task='.$task['id'].'">';
|
||||
$data[0] .= html_print_image(
|
||||
'images/target.png',
|
||||
true,
|
||||
['title' => __('Force run')]
|
||||
);
|
||||
$data[0] .= '</a>';
|
||||
} else {
|
||||
$data[0] = '';
|
||||
}
|
||||
|
||||
$data[1] = $task['id_usuario'];
|
||||
$data[2] = db_get_value('name', 'tuser_task', 'id', $task['id_user_task']);
|
||||
$args = unserialize($task['args']);
|
||||
@ -647,9 +611,12 @@ function cron_list_table()
|
||||
}
|
||||
|
||||
$path = $args[1];
|
||||
$report_type = $args[3];
|
||||
$data[2] .= '<br>- '.__('Report').": <a href='index.php?sec=reporting&sec2=operation/reporting/reporting_viewer";
|
||||
$data[2] .= '&id='.$args[0]."'>".$report['name'].'</a>';
|
||||
$data[2] .= '<br>- '.__('Path').': '.$path.'</a>';
|
||||
$data[2] .= '<br>- '.__('Report type').': '.$report_type;
|
||||
|
||||
break;
|
||||
|
||||
case 'cron_task_do_backup':
|
||||
|
@ -4127,13 +4127,17 @@ function ui_get_url_refresh($params=false, $relative=true, $add_post=true)
|
||||
function ui_forced_public_url()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$exclusions = [];
|
||||
if (empty($config['public_url_exclusions']) === false) {
|
||||
$exclusions = preg_split("/[\n\s,]+/", io_safe_output($config['public_url_exclusions']));
|
||||
}
|
||||
|
||||
if (in_array($_SERVER['REMOTE_ADDR'], $exclusions)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool) $config['force_public_url'];
|
||||
return isset($config['force_public_url']) && (bool) $config['force_public_url'];
|
||||
}
|
||||
|
||||
|
||||
|
@ -187,8 +187,7 @@ function load_modal(settings) {
|
||||
var formdata = new FormData();
|
||||
if (settings.extradata) {
|
||||
settings.extradata.forEach(function(item) {
|
||||
if (item.value != undefined)
|
||||
formdata.append(item.name, item.value);
|
||||
if (item.value != undefined) formdata.append(item.name, item.value);
|
||||
});
|
||||
}
|
||||
formdata.append("page", settings.onsubmit.page);
|
||||
@ -304,14 +303,17 @@ function load_modal(settings) {
|
||||
document.getElementById(settings.form).submit();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
required_buttons.push({
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
||||
text: settings.modal.ok,
|
||||
click: function() {
|
||||
if (settings.onsubmit != undefined && settings.onsubmit.onConfirmSubmit != undefined) {
|
||||
if (
|
||||
settings.onsubmit != undefined &&
|
||||
settings.onsubmit.onConfirmSubmit != undefined
|
||||
) {
|
||||
settings.onsubmit.onConfirmSubmit(btnClickHandler, $(this));
|
||||
} else {
|
||||
btnClickHandler($(this));
|
||||
|
@ -61,12 +61,12 @@ abstract class Entity
|
||||
/**
|
||||
* Instances a new object using array definition.
|
||||
*
|
||||
* @param string $class_str Class name.
|
||||
* @param array $data Fields data.
|
||||
* @param string $class_str Class name.
|
||||
*
|
||||
* @return object With current definition.
|
||||
*/
|
||||
public static function build(string $class_str, array $data=[])
|
||||
public static function build(array $data=[], string $class_str=__CLASS__)
|
||||
{
|
||||
$obj = new $class_str();
|
||||
// Set values.
|
||||
|
@ -137,12 +137,15 @@ class Module extends Entity
|
||||
* Creates a module object from given data. Avoid query duplication.
|
||||
*
|
||||
* @param array $data Module information.
|
||||
* @param string $class_str Class type.
|
||||
*
|
||||
* @return PandoraFMS\Module Object.
|
||||
*/
|
||||
public static function build(array $data=[])
|
||||
{
|
||||
$obj = new Module();
|
||||
public static function build(
|
||||
array $data=[],
|
||||
string $class_str='\PandoraFMS\Module'
|
||||
) {
|
||||
$obj = new $class_str();
|
||||
|
||||
// Set values.
|
||||
foreach ($data as $k => $v) {
|
||||
|
@ -13,3 +13,8 @@ span.subtitle-2 {
|
||||
.no-borders {
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
input[type="number"] {
|
||||
width: 220px;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.752';
|
||||
$build = '210127';
|
||||
$build = '210128';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
@ -1,108 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Event statistics.
|
||||
*
|
||||
* @category Statistics view.
|
||||
* @package Pandora FMS
|
||||
* @subpackage Events.
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_graph.php';
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'ER')
|
||||
&& ! check_acl($config['id_user'], 0, 'EW')
|
||||
&& ! check_acl($config['id_user'], 0, 'EM')
|
||||
) {
|
||||
db_pandora_audit('ACL Violation', 'Trying to access event viewer');
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
// Header.
|
||||
ui_print_page_header(__('Statistics'), 'images/op_events.png', false, false);
|
||||
echo '<table width=95%>';
|
||||
|
||||
echo '<tr>';
|
||||
echo "<td valign='top'>";
|
||||
echo '<h3>'.__('Event graph').'</h3>';
|
||||
echo '</td>';
|
||||
|
||||
echo "<td valign='top'>";
|
||||
echo '<h3>'.__('Event graph by user').'</h3>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo "<td valign='top'>";
|
||||
echo grafico_eventos_total();
|
||||
echo '</td>';
|
||||
|
||||
echo "<td valign='top'>";
|
||||
echo grafico_eventos_usuario(320, 280);
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo "<td valign='top'>";
|
||||
echo '<h3>'.__('Event graph by agent').'</h3>';
|
||||
echo '</td>';
|
||||
|
||||
echo "<td valign='top'>";
|
||||
echo '<h3>'.__('Amount events validated').'</h3>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
$where = '';
|
||||
if (!users_is_admin()) {
|
||||
$where = 'AND event_type NOT IN (\'recon_host_detected\', \'system\',\'error\', \'new_agent\', \'configuration_change\')';
|
||||
}
|
||||
|
||||
echo '<tr>';
|
||||
echo "<td valign='top'>";
|
||||
echo grafico_eventos_grupo(300, 250, $where);
|
||||
echo '</td>';
|
||||
|
||||
echo "<td valign='top'>";
|
||||
$extra_filter = [];
|
||||
if (!users_is_admin()) {
|
||||
$extra_filter['event_type'] = [
|
||||
'unknown',
|
||||
'alert_fired',
|
||||
'alert_recovered',
|
||||
'alert_ceased',
|
||||
'alert_manual_validation',
|
||||
'critical',
|
||||
'warning',
|
||||
'normal',
|
||||
];
|
||||
}
|
||||
|
||||
echo graph_events_validated(320, 250, $extra_filter);
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '</table>';
|
@ -393,8 +393,6 @@ if (check_acl($config['id_user'], 0, 'ER')
|
||||
$sub['operation/events/events']['text'] = __('View events');
|
||||
$sub['operation/events/events']['id'] = 'View events';
|
||||
$sub['operation/events/events']['pages'] = ['godmode/events/events'];
|
||||
$sub['operation/events/event_statistics']['text'] = __('Statistics');
|
||||
$sub['operation/events/event_statistics']['id'] = 'Statistics';
|
||||
|
||||
// If ip doesn't is in list of allowed IP, isn't show this options.
|
||||
include_once 'include/functions_api.php';
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.752
|
||||
%define release 210127
|
||||
%define release 210128
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.752
|
||||
%define release 210127
|
||||
%define release 210128
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.752
|
||||
%define release 210127
|
||||
%define release 210128
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-server
|
||||
Version: 7.0NG.752-210127
|
||||
Version: 7.0NG.752-210128
|
||||
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.752-210127"
|
||||
pandora_version="7.0NG.752-210128"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.752";
|
||||
my $pandora_build = "210127";
|
||||
my $pandora_build = "210128";
|
||||
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.752";
|
||||
my $pandora_build = "210127";
|
||||
my $pandora_build = "210128";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.752
|
||||
%define release 210127
|
||||
%define release 210128
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.752
|
||||
%define release 210127
|
||||
%define release 210128
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -9,7 +9,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.752"
|
||||
PI_BUILD="210127"
|
||||
PI_BUILD="210128"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
||||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.752 PS210127";
|
||||
my $version = "7.0NG.752 PS210128";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
||||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.752 PS210127";
|
||||
my $version = "7.0NG.752 PS210128";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user