Merge remote-tracking branch 'origin/master' into ent-10450-no-funciona-rpm-server-enterprise-769
This commit is contained in:
commit
d637e1ed35
|
@ -0,0 +1,320 @@
|
|||
#!/bin/bash
|
||||
#######################################################
|
||||
# PandoraFMS Community online installation script
|
||||
#######################################################
|
||||
## Tested versions ##
|
||||
# Centos 8.4, 8.5
|
||||
# Rocky 8.4, 8.5, 8.6, 8.7
|
||||
# Almalinuz 8.4, 8.5
|
||||
# RedHat 8.5
|
||||
|
||||
#Constants
|
||||
S_VERSION='202302081'
|
||||
LOGFILE="/tmp/deploy-ext-db-$(date +%F).log"
|
||||
|
||||
|
||||
# define default variables
|
||||
[ "$TZ" ] || TZ="Europe/Madrid"
|
||||
[ "$MYVER" ] || MYVER=57
|
||||
[ "$DBHOST" ] || DBHOST=127.0.0.1
|
||||
[ "$DBNAME" ] || DBNAME=pandora
|
||||
[ "$DBUSER" ] || DBUSER=pandora
|
||||
[ "$DBPASS" ] || DBPASS=pandora
|
||||
[ "$DBPORT" ] || DBPORT=3306
|
||||
[ "$DBROOTUSER" ] || DBROOTUSER=root
|
||||
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
|
||||
[ "$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"
|
||||
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_root_permissions () {
|
||||
echo -en "${cyan}Checking root account... ${reset}"
|
||||
if [ "$(whoami)" != "root" ]; then
|
||||
echo -e "${red}Fail${reset}"
|
||||
echo "Please use a root account or sudo for installing Pandora FMS"
|
||||
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
|
||||
exit 1
|
||||
|
||||
else
|
||||
echo -e "${green}OK${reset}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Main
|
||||
echo "Starting PandoraFMS External DB deployment EL8 ver. $S_VERSION"
|
||||
|
||||
# Centos Version
|
||||
if [ ! "$(grep -Ei 'centos|rocky|Almalinux|Red Hat Enterprise' /etc/redhat-release)" ]; then
|
||||
printf "\n ${red}Error this is not a Centos/Rocky/Almalinux Base system, this installer is compatible with RHEL/Almalinux/Centos/Rockylinux systems only${reset}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo -en "${cyan}Check Centos Version...${reset}"
|
||||
[ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '8' ]
|
||||
check_cmd_status 'Error OS version, RHEL/Almalinux/Centos/Rockylinux 8+ is expected'
|
||||
|
||||
#Detect OS
|
||||
os_name=$(grep ^PRETTY_NAME= /etc/os-release | cut -d '=' -f2 | tr -d '"')
|
||||
execute_cmd "echo $os_name" "OS detected: ${os_name}"
|
||||
|
||||
# initialice logfile
|
||||
execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE"
|
||||
echo "Community installer version: $S_VERSION" >> "$LOGFILE"
|
||||
|
||||
# Pre checks
|
||||
# Root permisions
|
||||
check_root_permissions
|
||||
|
||||
# Systemd
|
||||
execute_cmd "systemctl status" "Checking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env please check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8'
|
||||
|
||||
# Check memomry greather or equal to 2G
|
||||
execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)'
|
||||
|
||||
# Check disk size at least 10 Gb free space
|
||||
execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)'
|
||||
|
||||
# Setting timezone
|
||||
rm -rf /etc/localtime &>> "$LOGFILE"
|
||||
execute_cmd "timedatectl set-timezone $TZ" "Setting Timezone $TZ"
|
||||
|
||||
# Execute tools check
|
||||
execute_cmd "awk --version" 'Checking needed tools: awk'
|
||||
execute_cmd "grep --version" 'Checking needed tools: grep'
|
||||
execute_cmd "sed --version" 'Checking needed tools: sed'
|
||||
execute_cmd "dnf --version" 'Checking needed tools: dnf'
|
||||
|
||||
# Creating working directory
|
||||
rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE"
|
||||
mkdir "$HOME"/pandora_deploy_tmp &>> "$LOGFILE"
|
||||
execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_deploy_tmp"
|
||||
|
||||
## Extra steps on redhat envs
|
||||
if [ "$(grep -Ei 'Red Hat Enterprise' /etc/redhat-release)" ]; then
|
||||
## In case REDHAT
|
||||
# Check susbscription manager status:
|
||||
echo -en "${cyan}Checking Red Hat Enterprise subscription... ${reset}"
|
||||
subscription-manager list &>> "$LOGFILE"
|
||||
subscription-manager status &>> "$LOGFILE"
|
||||
check_cmd_status 'Error checking subscription status, make sure your server is activated and suscribed to Red Hat Enterprise repositories'
|
||||
|
||||
# Ckeck repolist
|
||||
dnf repolist &>> "$LOGFILE"
|
||||
echo -en "${cyan}Checking Red Hat Enterprise repolist... ${reset}"
|
||||
dnf repolist | grep 'rhel-8-for-x86_64-baseos-rpms' &>> "$LOGFILE"
|
||||
check_cmd_status 'Error checking repositories status, could try a subscription-manager attach command or contact sysadmin'
|
||||
|
||||
#install extra repos
|
||||
extra_repos=" \
|
||||
tar \
|
||||
dnf-utils \
|
||||
https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
|
||||
https://repo.percona.com/yum/percona-release-latest.noarch.rpm"
|
||||
|
||||
execute_cmd "dnf install -y $extra_repos" "Installing extra repositories"
|
||||
execute_cmd "subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms" "Enabling subscription to codeready-builder"
|
||||
else
|
||||
# For alma/rocky/centos
|
||||
extra_repos=" \
|
||||
tar \
|
||||
dnf-utils \
|
||||
epel-release \
|
||||
https://repo.percona.com/yum/percona-release-latest.noarch.rpm"
|
||||
|
||||
execute_cmd "dnf install -y $extra_repos" "Installing extra repositories"
|
||||
execute_cmd "dnf config-manager --set-enabled powertools" "Configuring Powertools"
|
||||
fi
|
||||
|
||||
|
||||
#Installing wget
|
||||
execute_cmd "dnf install -y wget" "Installing wget"
|
||||
|
||||
|
||||
# Install percona Database
|
||||
execute_cmd "dnf module disable -y mysql" "Disabiling mysql module"
|
||||
|
||||
if [ "$MYVER" -eq '80' ] ; then
|
||||
execute_cmd "percona-release setup ps80 -y" "Enabling mysql80 module"
|
||||
execute_cmd "dnf install -y percona-server-server percona-xtrabackup-24" "Installing Percona Server 80"
|
||||
fi
|
||||
|
||||
if [ "$MYVER" -ne '80' ] ; then
|
||||
execute_cmd "dnf install -y Percona-Server-server-57 percona-xtrabackup-24" "Installing Percona Server 57"
|
||||
fi
|
||||
|
||||
# Disabling SELINUX and firewalld
|
||||
setenforce 0 &>> "$LOGFILE"
|
||||
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config &>> "$LOGFILE"
|
||||
systemctl disable firewalld --now &>> "$LOGFILE"
|
||||
|
||||
# Adding standar cnf for initial setup.
|
||||
cat > /etc/my.cnf << EO_CONFIG_TMP
|
||||
[mysqld]
|
||||
datadir=/var/lib/mysql
|
||||
socket=/var/lib/mysql/mysql.sock
|
||||
symbolic-links=0
|
||||
log-error=/var/log/mysqld.log
|
||||
pid-file=/var/run/mysqld/mysqld.pid
|
||||
EO_CONFIG_TMP
|
||||
|
||||
#Configuring Database
|
||||
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
|
||||
execute_cmd "systemctl start mysqld" "Starting database engine"
|
||||
export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev)
|
||||
if [ "$MYVER" -eq '80' ] ; then
|
||||
echo """
|
||||
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = 'Pandor4!';
|
||||
UNINSTALL COMPONENT 'file://component_validate_password';
|
||||
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = '$DBROOTPASS';
|
||||
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"
|
||||
fi
|
||||
|
||||
if [ "$MYVER" -ne '80' ] ; then
|
||||
echo """
|
||||
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('Pandor4!');
|
||||
UNINSTALL PLUGIN validate_password;
|
||||
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('$DBROOTPASS');
|
||||
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"fi
|
||||
fi
|
||||
|
||||
export MYSQL_PWD=$DBROOTPASS
|
||||
echo -en "${cyan}Creating Pandora FMS database...${reset}"
|
||||
echo "create database $DBNAME" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST
|
||||
check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support."
|
||||
|
||||
echo "CREATE USER \"$DBUSER\"@'%' IDENTIFIED BY \"$DBPASS\";" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST
|
||||
echo "ALTER USER \"$DBUSER\"@'%' IDENTIFIED WITH mysql_native_password BY \"$DBPASS\"" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST
|
||||
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%'" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST
|
||||
|
||||
#Generating my.cnf
|
||||
cat > /etc/my.cnf << EO_CONFIG_F
|
||||
[mysqld]
|
||||
datadir=/var/lib/mysql
|
||||
socket=/var/lib/mysql/mysql.sock
|
||||
user=mysql
|
||||
character-set-server=utf8
|
||||
skip-character-set-client-handshake
|
||||
# Disabling symbolic-links is recommended to prevent assorted security risks
|
||||
symbolic-links=0
|
||||
# Mysql optimizations for Pandora FMS
|
||||
# Please check the documentation in 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
|
||||
|
||||
#skip-log-bin
|
||||
|
||||
sql_mode=""
|
||||
|
||||
[mysqld_safe]
|
||||
log-error=/var/log/mysqld.log
|
||||
pid-file=/var/run/mysqld/mysqld.pid
|
||||
|
||||
EO_CONFIG_F
|
||||
|
||||
if [ "$MYVER" -eq '80' ] ; then
|
||||
sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf
|
||||
sed -i -e "s/#skip-log-bin/skip-log-bin/g" /etc/my.cnf
|
||||
fi
|
||||
|
||||
execute_cmd "systemctl restart mysqld" "Configuring database engine"
|
||||
execute_cmd "systemctl enable mysqld --now" "Enabling Database service"
|
||||
fi
|
||||
export MYSQL_PWD=$DBPASS
|
||||
|
||||
|
||||
# Kernel optimization
|
||||
|
||||
if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then
|
||||
cat >> /etc/sysctl.conf <<EO_KO
|
||||
# Pandora FMS Optimization
|
||||
|
||||
# default=5
|
||||
net.ipv4.tcp_syn_retries = 3
|
||||
|
||||
# default=5
|
||||
net.ipv4.tcp_synack_retries = 3
|
||||
|
||||
# default=1024
|
||||
net.ipv4.tcp_max_syn_backlog = 65536
|
||||
|
||||
# default=124928
|
||||
net.core.wmem_max = 8388608
|
||||
|
||||
# default=131071
|
||||
net.core.rmem_max = 8388608
|
||||
|
||||
# default = 128
|
||||
net.core.somaxconn = 1024
|
||||
|
||||
# default = 20480
|
||||
net.core.optmem_max = 81920
|
||||
|
||||
EO_KO
|
||||
|
||||
[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
|
||||
fi
|
||||
|
||||
execute_cmd "echo done" "Percona server installed"
|
||||
cd
|
||||
execute_cmd "rm -rf $HOME/pandora_deploy_tmp" "Removing temporary files"
|
|
@ -0,0 +1,257 @@
|
|||
#!/bin/bash
|
||||
##############################################################################################################
|
||||
# PandoraFMS Community online installation script for Ubuntu 22.04
|
||||
##############################################################################################################
|
||||
## Tested versions ##
|
||||
# Ubuntu 22.04.1
|
||||
|
||||
#avoid promps
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
export NEEDRESTART_SUSPEND=1
|
||||
|
||||
#Constants
|
||||
PANDORA_CONSOLE=/var/www/html/pandora_console
|
||||
PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
|
||||
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
|
||||
WORKDIR=/opt/pandora/deploy
|
||||
|
||||
|
||||
S_VERSION='202302081'
|
||||
LOGFILE="/tmp/deploy-ext-db-$(date +%F).log"
|
||||
rm -f $LOGFILE &> /dev/null # remove last log before start
|
||||
|
||||
# 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_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"
|
||||
cyan="\e[0;36m"
|
||||
reset="\e[0m"
|
||||
|
||||
# Functions
|
||||
|
||||
execute_cmd () {
|
||||
local cmd="$1"
|
||||
local msg="$2"
|
||||
|
||||
echo -e "${cyan}$msg...${reset}"
|
||||
$cmd &>> "$LOGFILE"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${red}Fail${reset}"
|
||||
[ "$3" ] && echo "$3"
|
||||
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
|
||||
rm -rf "$WORKDIR" &>> "$LOGFILE"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\e[1A\e ${cyan}$msg...${reset} ${green}OK${reset}"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
check_cmd_status () {
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${red}Fail${reset}"
|
||||
[ "$1" ] && echo "$1"
|
||||
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
|
||||
rm -rf "$WORKDIR" &>> "$LOGFILE"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${green}OK${reset}"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
check_root_permissions () {
|
||||
echo -en "${cyan}Checking root account... ${reset}"
|
||||
if [ "$(whoami)" != "root" ]; then
|
||||
echo -e "${red}Fail${reset}"
|
||||
echo "Please use a root account or sudo for installing Pandora FMS"
|
||||
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
|
||||
exit 1
|
||||
|
||||
else
|
||||
echo -e "${green}OK${reset}"
|
||||
fi
|
||||
}
|
||||
|
||||
## Main
|
||||
echo "Starting PandoraFMS External DB deployment Ubuntu 22.04 ver. $S_VERSION"
|
||||
|
||||
# Ubuntu Version
|
||||
if [ ! "$(grep -Ei 'Ubuntu' /etc/lsb-release)" ]; then
|
||||
printf "\n ${red}Error this is not a Ubuntu system, this installer is compatible with Ubuntu systems only${reset}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo -en "${cyan}Check Ubuntu Version...${reset}"
|
||||
[ $(sed -nr 's/VERSION_ID+=\s*"([0-9][0-9].[0-9][0-9])"$/\1/p' /etc/os-release) == "22.04" ]
|
||||
check_cmd_status 'Error OS version, Ubuntu 22.04 is expected'
|
||||
|
||||
#Detect OS
|
||||
os_name=$(grep ^PRETTY_NAME= /etc/os-release | cut -d '=' -f2 | tr -d '"')
|
||||
execute_cmd "echo $os_name" "OS detected: ${os_name}"
|
||||
|
||||
# initialice logfile
|
||||
execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE"
|
||||
echo "Community installer version: $S_VERSION" >> "$LOGFILE"
|
||||
|
||||
# Pre checks
|
||||
# Root permisions
|
||||
check_root_permissions
|
||||
|
||||
#Install awk, sed, grep if not present
|
||||
execute_cmd "apt install -y gawk sed grep" 'Installing needed tools'
|
||||
|
||||
# Systemd
|
||||
execute_cmd "systemctl --version" "Checking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env please check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8'
|
||||
|
||||
# Check memomry greather or equal to 2G
|
||||
execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)'
|
||||
|
||||
# Check disk size at least 10 Gb free space
|
||||
execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)'
|
||||
|
||||
# Setting timezone
|
||||
rm -rf /etc/localtime &>> "$LOGFILE"
|
||||
execute_cmd "timedatectl set-timezone $TZ" "Setting Timezone $TZ"
|
||||
|
||||
# Execute tools check
|
||||
execute_cmd "awk --version" 'Checking needed tools: awk'
|
||||
execute_cmd "grep --version" 'Checking needed tools: grep'
|
||||
execute_cmd "sed --version" 'Checking needed tools: sed'
|
||||
execute_cmd "apt --version" 'Checking needed tools: apt'
|
||||
|
||||
# Creating working directory
|
||||
rm -rf "$WORKDIR" &>> "$LOGFILE"
|
||||
mkdir -p "$WORKDIR" &>> "$LOGFILE"
|
||||
execute_cmd "cd $WORKDIR" "Moving to workdir: $WORKDIR"
|
||||
|
||||
## Install utils
|
||||
execute_cmd "apt update" "Updating repos"
|
||||
execute_cmd "apt install -y net-tools vim curl wget software-properties-common apt-transport-https" "Installing utils"
|
||||
|
||||
# Disabling apparmor and ufw
|
||||
systemctl stop ufw.service &>> "$LOGFILE"
|
||||
systemctl disable ufw &>> "$LOGFILE"
|
||||
systemctl stop apparmor &>> "$LOGFILE"
|
||||
systemctl disable apparmor &>> "$LOGFILE"
|
||||
|
||||
#install mysql
|
||||
execute_cmd "curl -O https://repo.percona.com/apt/percona-release_latest.generic_all.deb" "Downloading Percona repository for MySQL8"
|
||||
execute_cmd "apt install -y gnupg2 lsb-release ./percona-release_latest.generic_all.deb" "Installing Percona repository for MySQL8"
|
||||
execute_cmd "percona-release setup ps80" "Configuring Percona repository for MySQL8"
|
||||
|
||||
echo -en "${cyan}Installing Percona Server for MySQL8...${reset}"
|
||||
env DEBIAN_FRONTEND=noninteractive apt install -y percona-server-server &>> "$LOGFILE"
|
||||
check_cmd_status "Error Installing MySql Server"
|
||||
|
||||
#Configuring Database
|
||||
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
|
||||
execute_cmd "systemctl start mysql" "Starting database engine"
|
||||
|
||||
echo """
|
||||
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '$DBROOTPASS';
|
||||
""" | mysql -uroot &>> "$LOGFILE"
|
||||
|
||||
export MYSQL_PWD=$DBROOTPASS
|
||||
echo -en "${cyan}Creating Pandora FMS database...${reset}"
|
||||
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
|
||||
check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support."
|
||||
|
||||
echo "CREATE USER \"$DBUSER\"@'%' IDENTIFIED BY \"$DBPASS\";" | mysql -uroot -P$DBPORT -h$DBHOST
|
||||
echo "ALTER USER \"$DBUSER\"@'%' IDENTIFIED WITH mysql_native_password BY \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST
|
||||
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%'" | mysql -uroot -P$DBPORT -h$DBHOST
|
||||
fi
|
||||
export MYSQL_PWD=$DBPASS
|
||||
|
||||
#Generating my.cnf
|
||||
cat > /etc/mysql/my.cnf << EOF_DB
|
||||
[mysqld]
|
||||
datadir=/var/lib/mysql
|
||||
user=mysql
|
||||
character-set-server=utf8
|
||||
skip-character-set-client-handshake
|
||||
# Disabling symbolic-links is recommended to prevent assorted security risks
|
||||
symbolic-links=0
|
||||
# Mysql optimizations for Pandora FMS
|
||||
# Please check the documentation in http://pandorafms.com for better results
|
||||
|
||||
max_allowed_packet = 64M
|
||||
innodb_buffer_pool_size = $POOL_SIZE
|
||||
innodb_lock_wait_timeout = 90
|
||||
innodb_file_per_table
|
||||
innodb_flush_log_at_trx_commit = 0
|
||||
innodb_flush_method = O_DIRECT
|
||||
innodb_log_file_size = 64M
|
||||
innodb_log_buffer_size = 16M
|
||||
innodb_io_capacity = 100
|
||||
thread_cache_size = 8
|
||||
thread_stack = 256K
|
||||
max_connections = 100
|
||||
|
||||
key_buffer_size=4M
|
||||
read_buffer_size=128K
|
||||
read_rnd_buffer_size=128K
|
||||
sort_buffer_size=128K
|
||||
join_buffer_size=4M
|
||||
|
||||
skip-log-bin
|
||||
|
||||
sql_mode=""
|
||||
|
||||
log-error=/var/log/mysql/error.log
|
||||
[mysqld_safe]
|
||||
log-error=/var/log/mysqld.log
|
||||
pid-file=/var/run/mysqld/mysqld.pid
|
||||
|
||||
EOF_DB
|
||||
|
||||
execute_cmd "systemctl restart mysql" "Configuring and restarting database engine"
|
||||
|
||||
# Kernel optimization
|
||||
if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then
|
||||
cat >> /etc/sysctl.conf <<EO_KO
|
||||
# Pandora FMS Optimization
|
||||
|
||||
# default=5
|
||||
net.ipv4.tcp_syn_retries = 3
|
||||
|
||||
# default=5
|
||||
net.ipv4.tcp_synack_retries = 3
|
||||
|
||||
# default=1024
|
||||
net.ipv4.tcp_max_syn_backlog = 65536
|
||||
|
||||
# default=124928
|
||||
net.core.wmem_max = 8388608
|
||||
|
||||
# default=131071
|
||||
net.core.rmem_max = 8388608
|
||||
|
||||
# default = 128
|
||||
net.core.somaxconn = 1024
|
||||
|
||||
# default = 20480
|
||||
net.core.optmem_max = 81920
|
||||
|
||||
EO_KO
|
||||
|
||||
[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
|
||||
fi
|
||||
|
||||
# Remove temporary files
|
||||
execute_cmd "echo done" "Percona server installed"
|
||||
cd "$HOME"
|
||||
execute_cmd "rm -rf $WORKDIR" "Removing temporary files"
|
|
@ -639,8 +639,8 @@ 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
|
||||
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
|
||||
echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/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"
|
||||
|
|
|
@ -732,8 +732,8 @@ 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
|
||||
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
|
||||
echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/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"
|
||||
|
|
|
@ -732,8 +732,8 @@ execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
|
|||
systemctl enable tentacle_serverd &>> "$LOGFILE"
|
||||
|
||||
# Enabling condole cron
|
||||
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
|
||||
echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
|
||||
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
|
||||
echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
|
||||
|
||||
## Enabling agent adn configuring Agente
|
||||
sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF &>> "$LOGFILE"
|
||||
|
|
|
@ -277,8 +277,8 @@ export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64
|
|||
EOF_ENV
|
||||
|
||||
echo ">> Enable discovery cron: "
|
||||
#while true ; do wget -q -O - --no-check-certificate http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/pandora_console.log && sleep 60 ; done &
|
||||
echo "*/5 * * * * wget -q -O - --no-check-certificate http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/log/cron.log" >> /opt/pandora/crontasks
|
||||
#while true ; do wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/pandora_console.log && sleep 60 ; done &
|
||||
echo "*/5 * * * * wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/log/cron.log" >> /opt/pandora/crontasks
|
||||
|
||||
echo ">> Enable pandora_db cron: "
|
||||
/usr/bin/perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768, AIX version
|
||||
# Version 7.0NG.769, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768, FreeBSD Version
|
||||
# Version 7.0NG.769, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768, HP-UX Version
|
||||
# Version 7.0NG.769, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768, GNU/Linux
|
||||
# Version 7.0NG.769, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768, GNU/Linux
|
||||
# Version 7.0NG.769, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768, Solaris Version
|
||||
# Version 7.0NG.769, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.768
|
||||
# Version 7.0NG.769
|
||||
# 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
|
||||
|
|
|
@ -1,15 +1,8 @@
|
|||
#!/usr/bin/perl
|
||||
##########################################################################
|
||||
# pandora_agent_exec
|
||||
################################################################################
|
||||
# pandora_exec - Execute a command with a time limit.
|
||||
#
|
||||
# Executes the given command and prints its output to stdout. If the
|
||||
# execution times out or the command does not exist nothing is printed
|
||||
# to stdout. This is part of Pandora FMS Plugin server, do not delete!.
|
||||
#
|
||||
# Usage: pandora_agent_exec <timeout in seconds> <command>
|
||||
##########################################################################
|
||||
# Copyright (c) 2008-2010 Ramon Novoa, rnovoa@gmail.com
|
||||
# (c) 2008-2010 Artica Soluciones Tecnologicas S.L
|
||||
# Copyright (c) 2008-2023 Artica PFMS S.L.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -22,37 +15,41 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##########################################################################
|
||||
|
||||
################################################################################
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX qw(WEXITSTATUS WIFEXITED);
|
||||
|
||||
# Check command line parameters
|
||||
# Check command line arguments.
|
||||
if ($#ARGV < 1) {
|
||||
print("Usage: $0 <timeout in seconds> <command>\n");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my @opts = @ARGV;
|
||||
my $timeout = shift(@opts);
|
||||
my $command = join(' ', @opts);
|
||||
my $output = '';
|
||||
my $ReturnCode = 0;
|
||||
my $command = ($0 =~ m/_agent_exec$/) ? # For backward compatibility with pandora_agent.
|
||||
join(' ', @opts) :
|
||||
join(' ', map { quotemeta($_) } @opts);
|
||||
|
||||
# Execute the command
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "alarm\n" };
|
||||
alarm $timeout;
|
||||
|
||||
$output = `$command`;
|
||||
$ReturnCode = ($? >> 8) & 0xff;
|
||||
alarm 0;
|
||||
};
|
||||
|
||||
# Timeout
|
||||
if ($@ eq "alarm\n") {
|
||||
exit 3;
|
||||
# Fork:
|
||||
# * The child will run the command.
|
||||
# * The parent will timeout if needed
|
||||
# and exit with the appropriate exit status.
|
||||
my $pid = fork();
|
||||
if ($pid == 0) {
|
||||
setpgrp();
|
||||
exec($command);
|
||||
} else {
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { kill(9, -$pid); exit 1; };
|
||||
alarm $timeout;
|
||||
waitpid($pid, 0);
|
||||
alarm 0;
|
||||
if (WIFEXITED(${^CHILD_ERROR_NATIVE})) {
|
||||
exit WEXITSTATUS(${^CHILD_ERROR_NATIVE});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
print $output;
|
||||
|
||||
exit $ReturnCode;
|
||||
exit 1;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.768, AIX version
|
||||
# Version 7.0NG.769, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.768
|
||||
# Version 7.0NG.769
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.768, HPUX Version
|
||||
# Version 7.0NG.769, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768
|
||||
# Version 7.0NG.769
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768
|
||||
# Version 7.0NG.769
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768
|
||||
# Version 7.0NG.769
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.768, Solaris version
|
||||
# Version 7.0NG.769, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768, AIX version
|
||||
# Version 7.0NG.769, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.768-230206
|
||||
Version: 7.0NG.769
|
||||
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.768-230206"
|
||||
pandora_version="7.0NG.769"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -31,7 +31,7 @@ fi
|
|||
if [ "$#" -ge 2 ]; then
|
||||
VERSION="$2"
|
||||
else
|
||||
VERSION="7.0NG.768"
|
||||
VERSION="7.0NG.769"
|
||||
fi
|
||||
|
||||
# Path for the generated DMG file
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
<choice id="com.pandorafms.pandorafms_src" visible="false">
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src"/>
|
||||
</choice>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.768" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.769" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
|
||||
</choice>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.768" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.769" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<!-- <installation-check script="check()" />
|
||||
<script>
|
||||
<![CDATA[
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
|
||||
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
|
||||
|
||||
<key>CFBundleVersion</key> <string>7.0NG.768</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.768 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.768</string>
|
||||
<key>CFBundleVersion</key> <string>7.0NG.769</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.769 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.769</string>
|
||||
|
||||
<key>NSPrincipalClass</key><string>NSApplication</string>
|
||||
<key>NSMainNibFile</key><string>MainMenu</string>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768, GNU/Linux
|
||||
# Version 7.0NG.769, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768, FreeBSD Version
|
||||
# Version 7.0NG.769, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768, HP-UX Version
|
||||
# Version 7.0NG.769, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768, GNU/Linux
|
||||
# Version 7.0NG.769, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768, GNU/Linux
|
||||
# Version 7.0NG.769, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768, NetBSD Version
|
||||
# Version 7.0NG.769, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.768, Solaris Version
|
||||
# Version 7.0NG.769, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -556,30 +556,38 @@ BEGIN {
|
|||
sub runCommand {
|
||||
my ($self, $ref, $output_mode) = @_;
|
||||
|
||||
my $result;
|
||||
if($self->load_libraries()) {
|
||||
# Functionality possible.
|
||||
my $command = $self->{'commands'}->{$ref};
|
||||
my $result = $self->evaluate_command($ref);
|
||||
if (ref($result) eq "HASH") {
|
||||
# Process command result.
|
||||
if (defined($output_mode) && $output_mode eq 'xml') {
|
||||
my $output = '';
|
||||
$output .= "<cmd_report>\n";
|
||||
$output .= " <cmd_response>\n";
|
||||
$output .= " <cmd_name><![CDATA[".$result->{'name'}."]]></cmd_name>\n";
|
||||
$output .= " <cmd_key><![CDATA[".$ref."]]></cmd_key>\n";
|
||||
$output .= " <cmd_errorlevel><![CDATA[".$result->{'error_level'}."]]></cmd_errorlevel>\n";
|
||||
$output .= " <cmd_stdout><![CDATA[".$result->{'stdout'}."]]></cmd_stdout>\n";
|
||||
$output .= " <cmd_stderr><![CDATA[".$result->{'stderr'}."]]></cmd_stderr>\n";
|
||||
$output .= " </cmd_response>\n";
|
||||
$output .= "</cmd_report>\n";
|
||||
$result = $self->evaluate_command($ref);
|
||||
} else {
|
||||
$result = {
|
||||
'stderr' => 'Cannot use commands without YAML dependency, please install it.',
|
||||
'name' => 'YAML::Tiny',
|
||||
'error_level' => 2,
|
||||
};
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
return $result;
|
||||
} else {
|
||||
$self->set_last_error('Failed to process ['.$ref.']: '.$result);
|
||||
if (ref($result) eq "HASH") {
|
||||
# Process command result.
|
||||
if (defined($output_mode) && $output_mode eq 'xml') {
|
||||
my $output = '';
|
||||
$output .= "<cmd_report>\n";
|
||||
$output .= " <cmd_response>\n";
|
||||
$output .= " <cmd_name><![CDATA[".$result->{'name'}."]]></cmd_name>\n";
|
||||
$output .= " <cmd_key><![CDATA[".$ref."]]></cmd_key>\n";
|
||||
$output .= " <cmd_errorlevel><![CDATA[".$result->{'error_level'}."]]></cmd_errorlevel>\n";
|
||||
$output .= " <cmd_stdout><![CDATA[".$result->{'stdout'}."]]></cmd_stdout>\n";
|
||||
$output .= " <cmd_stderr><![CDATA[".$result->{'stderr'}."]]></cmd_stderr>\n";
|
||||
$output .= " </cmd_response>\n";
|
||||
$output .= "</cmd_report>\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
return $result;
|
||||
} else {
|
||||
$self->set_last_error('Failed to process ['.$ref.']: '.$result);
|
||||
}
|
||||
|
||||
return undef;
|
||||
|
@ -1014,8 +1022,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.768';
|
||||
use constant AGENT_BUILD => '230206';
|
||||
use constant AGENT_VERSION => '7.0NG.769';
|
||||
use constant AGENT_BUILD => '230216';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.768
|
||||
%define release 230206
|
||||
%define version 7.0NG.769
|
||||
%define release 1
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.768
|
||||
%define release 230206
|
||||
%define version 7.0NG.769
|
||||
%define release 1
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -1,15 +1,8 @@
|
|||
#!/usr/bin/perl
|
||||
##########################################################################
|
||||
# pandora_agent_exec
|
||||
################################################################################
|
||||
# pandora_exec - Execute a command with a time limit.
|
||||
#
|
||||
# Executes the given command and prints its output to stdout. If the
|
||||
# execution times out or the command does not exist nothing is printed
|
||||
# to stdout. This is part of Pandora FMS Plugin server, do not delete!.
|
||||
#
|
||||
# Usage: pandora_agent_exec <timeout in seconds> <command>
|
||||
##########################################################################
|
||||
# Copyright (c) 2008-2010 Ramon Novoa, rnovoa@gmail.com
|
||||
# (c) 2008-2010 Artica Soluciones Tecnologicas S.L
|
||||
# Copyright (c) 2008-2023 Artica PFMS S.L.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -22,37 +15,41 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##########################################################################
|
||||
|
||||
################################################################################
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX qw(WEXITSTATUS WIFEXITED);
|
||||
|
||||
# Check command line parameters
|
||||
# Check command line arguments.
|
||||
if ($#ARGV < 1) {
|
||||
print("Usage: $0 <timeout in seconds> <command>\n");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my @opts = @ARGV;
|
||||
my $timeout = shift(@opts);
|
||||
my $command = join(' ', @opts);
|
||||
my $output = '';
|
||||
my $ReturnCode = 0;
|
||||
my $command = ($0 =~ m/_agent_exec$/) ? # For backward compatibility with pandora_agent.
|
||||
join(' ', @opts) :
|
||||
join(' ', map { quotemeta($_) } @opts);
|
||||
|
||||
# Execute the command
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "alarm\n" };
|
||||
alarm $timeout;
|
||||
|
||||
$output = `$command`;
|
||||
$ReturnCode = ($? >> 8) & 0xff;
|
||||
alarm 0;
|
||||
};
|
||||
|
||||
# Timeout
|
||||
if ($@ eq "alarm\n") {
|
||||
exit 3;
|
||||
# Fork:
|
||||
# * The child will run the command.
|
||||
# * The parent will timeout if needed
|
||||
# and exit with the appropriate exit status.
|
||||
my $pid = fork();
|
||||
if ($pid == 0) {
|
||||
setpgrp();
|
||||
exec($command);
|
||||
} else {
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { kill(9, -$pid); exit 1; };
|
||||
alarm $timeout;
|
||||
waitpid($pid, 0);
|
||||
alarm 0;
|
||||
if (WIFEXITED(${^CHILD_ERROR_NATIVE})) {
|
||||
exit WEXITSTATUS(${^CHILD_ERROR_NATIVE});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
print $output;
|
||||
|
||||
exit $ReturnCode;
|
||||
exit 1;
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.768"
|
||||
PI_BUILD="230206"
|
||||
PI_VERSION="7.0NG.769"
|
||||
PI_BUILD="230216"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.768
|
||||
# Version 7.0NG.769
|
||||
# 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
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.768}
|
||||
{Pandora FMS Windows Agent v7.0NG.769}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{230206}
|
||||
{230216}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
|
|||
{No}
|
||||
|
||||
Windows,Executable
|
||||
{<%AppName%>-<%Version%>-Setup<%Ext%>}
|
||||
{<%AppName%>-Setup<%Ext%>}
|
||||
|
||||
Windows,FileDescription
|
||||
{<%AppName%> <%Version%> Setup}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.768 Build 230206")
|
||||
#define PANDORA_VERSION ("7.0NG.769 Build 230216")
|
||||
|
||||
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.768(Build 230206))"
|
||||
VALUE "ProductVersion", "(7.0NG.769(Build 230216))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.768-230206
|
||||
Version: 7.0NG.769
|
||||
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.768-230206"
|
||||
pandora_version="7.0NG.769"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -2,6 +2,28 @@ START TRANSACTION;
|
|||
|
||||
ALTER TABLE `tserver` ADD COLUMN `server_keepalive_utimestamp` BIGINT NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE `tmap` MODIFY COLUMN `id_group` TEXT NOT NULL default '';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tmonitor_filter` (
|
||||
`id_filter` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_name` VARCHAR(600) NOT NULL,
|
||||
`id_group_filter` INT NOT NULL DEFAULT 0,
|
||||
`ag_group` INT NOT NULL DEFAULT 0,
|
||||
`recursion` TEXT,
|
||||
`status` INT NOT NULL DEFAULT -1,
|
||||
`ag_modulename` TEXT,
|
||||
`ag_freestring` TEXT,
|
||||
`tag_filter` TEXT,
|
||||
`moduletype` TEXT,
|
||||
`module_option` INT DEFAULT 1,
|
||||
`modulegroup` INT NOT NULL DEFAULT -1,
|
||||
`min_hours_status` TEXT,
|
||||
`datatype` TEXT,
|
||||
`not_condition` TEXT,
|
||||
`ag_custom_fields` TEXT,
|
||||
PRIMARY KEY (`id_filter`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tsesion_filter` (
|
||||
`id_filter` INT NOT NULL AUTO_INCREMENT,
|
||||
`id_name` TEXT NULL,
|
||||
|
|
|
@ -498,10 +498,12 @@ if ($id_agente) {
|
|||
}
|
||||
|
||||
// Collection.
|
||||
$collectiontab = enterprise_hook('collection_tab');
|
||||
if ((int) $config['license_nms'] !== 1) {
|
||||
$collectiontab = enterprise_hook('collection_tab');
|
||||
|
||||
if ($collectiontab == -1) {
|
||||
$collectiontab = '';
|
||||
if ($collectiontab == -1) {
|
||||
$collectiontab = '';
|
||||
}
|
||||
}
|
||||
|
||||
// NetworkConfigManager tab.
|
||||
|
|
|
@ -141,11 +141,13 @@ if (isset($_GET['server'])) {
|
|||
|
||||
];
|
||||
|
||||
$buttons['collections'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$id_server.'&ext='.$ext.'&tab=collections&pure='.$pure.'">'.html_print_image('images/collection.png', true, ['title' => __('Collections')]).'</a>',
|
||||
if ((int) $config['license_nms'] !== 1) {
|
||||
$buttons['collections'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$id_server.'&ext='.$ext.'&tab=collections&pure='.$pure.'">'.html_print_image('images/collection.png', true, ['title' => __('Collections')]).'</a>',
|
||||
|
||||
];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$buttons[$tab]['active'] = true;
|
||||
|
|
|
@ -92,6 +92,9 @@ $node_id = (int) get_parameter('node_id', 0);
|
|||
if ($get_comments === true) {
|
||||
$event = get_parameter('event', false);
|
||||
$event_rep = (int) get_parameter('event_rep', 0);
|
||||
$event_rep = get_parameter_post('event')['event_rep'];
|
||||
$group_rep = get_parameter_post('event')['group_rep'];
|
||||
|
||||
if ($event === false) {
|
||||
return __('Failed to retrieve comments');
|
||||
}
|
||||
|
@ -99,7 +102,7 @@ if ($get_comments === true) {
|
|||
$eventsGrouped = [];
|
||||
// Consider if the event is grouped.
|
||||
$whereGrouped = '1=1';
|
||||
if ($event_rep === EVENT_GROUP_REP_EVENTS) {
|
||||
if ($group_rep === EVENT_GROUP_REP_EVENTS && $event_rep > 1) {
|
||||
// Default grouped message filtering (evento and estado).
|
||||
$whereGrouped = sprintf(
|
||||
'`evento` = "%s"',
|
||||
|
@ -120,7 +123,7 @@ if ($get_comments === true) {
|
|||
(int) $event['id_agentmodule']
|
||||
);
|
||||
}
|
||||
} else if ($event_rep === EVENT_GROUP_REP_EXTRAIDS) {
|
||||
} else if ($group_rep === EVENT_GROUP_REP_EXTRAIDS) {
|
||||
$whereGrouped = sprintf(
|
||||
'`id_extra` = "%s"',
|
||||
$event['id_extra']
|
||||
|
@ -1639,6 +1642,7 @@ if ($get_extended_event) {
|
|||
$comments = $event['comments'];
|
||||
|
||||
$event['similar_ids'] = $similar_ids;
|
||||
$event['group_rep'] = $group_rep;
|
||||
|
||||
if (isset($comments) === false) {
|
||||
$comments = $event['user_comment'];
|
||||
|
@ -2407,6 +2411,18 @@ if ($drawConsoleSound === true) {
|
|||
$output .= '</span>';
|
||||
$output .= '</div>';
|
||||
$output .= '<div class="elements-discovered-alerts"><ul></ul></div>';
|
||||
$output .= html_print_input_hidden(
|
||||
'ajax_file_sound_console',
|
||||
ui_get_full_url('ajax.php', false, false, false),
|
||||
true
|
||||
);
|
||||
$output .= html_print_input_hidden(
|
||||
'meta',
|
||||
is_metaconsole(),
|
||||
true
|
||||
);
|
||||
$output .= '<div id="sound_event_details_window"></div>';
|
||||
$output .= '<div id="sound_event_response_window"></div>';
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
|
||||
|
@ -2493,6 +2509,37 @@ if ($get_events_fired) {
|
|||
$filter = events_get_event_filter($filter_id);
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$servers = metaconsole_get_servers();
|
||||
if (is_array($servers) === true) {
|
||||
$servers = array_reduce(
|
||||
$servers,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['id']] = $item['server_name'];
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
} else {
|
||||
$servers = [];
|
||||
}
|
||||
|
||||
if ($filter['server_id'] === '') {
|
||||
$filter['server_id'] = array_keys($servers);
|
||||
} else {
|
||||
if (is_array($filter['server_id']) === false) {
|
||||
if (is_numeric($filter['server_id']) === true) {
|
||||
if ($filter['server_id'] !== 0) {
|
||||
$filter['server_id'] = [$filter['server_id']];
|
||||
} else {
|
||||
$filter['server_id'] = array_keys($servers);
|
||||
}
|
||||
} else {
|
||||
$filter['server_id'] = explode(',', $filter['server_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set time.
|
||||
$filter['event_view_hr'] = 0;
|
||||
|
||||
|
@ -2511,29 +2558,32 @@ if ($get_events_fired) {
|
|||
$return = [];
|
||||
if (empty($data) === false) {
|
||||
foreach ($data as $event) {
|
||||
$return[] = [
|
||||
'fired' => $event['id_evento'],
|
||||
'message' => ui_print_string_substr(
|
||||
strip_tags(io_safe_output($event['evento'])),
|
||||
75,
|
||||
true,
|
||||
'9'
|
||||
),
|
||||
'priority' => ui_print_event_priority($event['criticity'], true, true),
|
||||
'type' => events_print_type_img(
|
||||
$event['event_type'],
|
||||
true
|
||||
),
|
||||
'timestamp' => ui_print_timestamp(
|
||||
$event['timestamp'],
|
||||
true,
|
||||
['style' => 'font-size: 9pt; letter-spacing: 0.3pt;']
|
||||
),
|
||||
];
|
||||
$return[] = array_merge(
|
||||
$event,
|
||||
[
|
||||
'fired' => $event['id_evento'],
|
||||
'message' => ui_print_string_substr(
|
||||
strip_tags(io_safe_output($event['evento'])),
|
||||
75,
|
||||
true,
|
||||
'9'
|
||||
),
|
||||
'priority' => ui_print_event_priority($event['criticity'], true, true),
|
||||
'type' => events_print_type_img(
|
||||
$event['event_type'],
|
||||
true
|
||||
),
|
||||
'timestamp' => ui_print_timestamp(
|
||||
$event['timestamp'],
|
||||
true,
|
||||
['style' => 'font-size: 9pt; letter-spacing: 0.3pt;']
|
||||
),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
echo io_json_mb_encode($return);
|
||||
echo io_safe_output(io_json_mb_encode($return));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,12 @@ if (check_login()) {
|
|||
0
|
||||
);
|
||||
|
||||
$load_filter_modal = get_parameter('load_filter_modal', 0);
|
||||
$save_filter_modal = get_parameter('save_filter_modal', 0);
|
||||
$get_monitor_filters = get_parameter('get_monitor_filters', 0);
|
||||
$save_monitor_filter = get_parameter('save_monitor_filter', 0);
|
||||
$update_monitor_filter = get_parameter('update_monitor_filter', 0);
|
||||
|
||||
if ($get_agent_modules_json_by_name === true) {
|
||||
$agent_name = get_parameter('agent_name');
|
||||
|
||||
|
@ -1661,6 +1667,534 @@ if (check_login()) {
|
|||
}
|
||||
|
||||
echo json_encode($children_selected);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Saves an event filter.
|
||||
if ($save_monitor_filter) {
|
||||
$values = [];
|
||||
$values['id_name'] = get_parameter('id_name');
|
||||
$values['id_group_filter'] = get_parameter('id_group_filter');
|
||||
$values['ag_group'] = get_parameter('ag_group');
|
||||
$values['modulegroup'] = get_parameter('modulegroup');
|
||||
$values['recursion'] = get_parameter('recursion');
|
||||
$values['status'] = get_parameter('status');
|
||||
$values['ag_modulename'] = get_parameter('ag_modulename');
|
||||
$values['ag_freestring'] = get_parameter('ag_freestring');
|
||||
$values['tag_filter'] = json_encode(get_parameter('tag_filter'));
|
||||
$values['moduletype'] = get_parameter('moduletype');
|
||||
$values['module_option'] = get_parameter('module_option');
|
||||
$values['min_hours_status'] = get_parameter('min_hours_status');
|
||||
$values['datatype'] = get_parameter('datatype');
|
||||
$values['not_condition'] = get_parameter('not_condition');
|
||||
$values['ag_custom_fields'] = get_parameter('ag_custom_fields');
|
||||
|
||||
$exists = (bool) db_get_value_filter(
|
||||
'id_filter',
|
||||
'tmonitor_filter',
|
||||
$values
|
||||
);
|
||||
|
||||
if ($exists === true) {
|
||||
echo 'duplicate';
|
||||
} else {
|
||||
$result = db_process_sql_insert('tmonitor_filter', $values);
|
||||
|
||||
if ($result === false) {
|
||||
echo 'error';
|
||||
} else {
|
||||
echo $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($update_monitor_filter) {
|
||||
$values = [];
|
||||
$id = get_parameter('id');
|
||||
|
||||
$values['ag_group'] = get_parameter('ag_group');
|
||||
$values['modulegroup'] = get_parameter('modulegroup');
|
||||
$values['recursion'] = get_parameter('recursion');
|
||||
$values['status'] = get_parameter('status');
|
||||
$values['ag_modulename'] = get_parameter('ag_modulename');
|
||||
$values['ag_freestring'] = get_parameter('ag_freestring');
|
||||
$values['tag_filter'] = json_encode(get_parameter('tag_filter'));
|
||||
$values['moduletype'] = get_parameter('moduletype');
|
||||
$values['module_option'] = get_parameter('module_option');
|
||||
$values['min_hours_status'] = get_parameter('min_hours_status');
|
||||
$values['datatype'] = get_parameter('datatype');
|
||||
$values['not_condition'] = get_parameter('not_condition');
|
||||
$values['ag_custom_fields'] = get_parameter('ag_custom_fields');
|
||||
|
||||
$result = db_process_sql_update(
|
||||
'tmonitor_filter',
|
||||
$values,
|
||||
['id_filter' => $id]
|
||||
);
|
||||
|
||||
if ($result === false) {
|
||||
echo 'error';
|
||||
} else {
|
||||
echo 'ok';
|
||||
}
|
||||
}
|
||||
|
||||
if ($get_monitor_filters) {
|
||||
$sql = 'SELECT id_filter, id_name FROM tmonitor_filter';
|
||||
|
||||
$monitor_filters = db_get_all_rows_sql($sql);
|
||||
|
||||
$result = [];
|
||||
|
||||
if ($monitor_filters !== false) {
|
||||
foreach ($monitor_filters as $monitor_filter) {
|
||||
$result[$monitor_filter['id_filter']] = $monitor_filter['id_name'];
|
||||
}
|
||||
}
|
||||
|
||||
echo io_json_mb_encode($result);
|
||||
}
|
||||
|
||||
if ((int) $load_filter_modal === 1) {
|
||||
$user_groups = users_get_groups(
|
||||
$config['id_user'],
|
||||
'AR',
|
||||
users_can_manage_group_all(),
|
||||
true
|
||||
);
|
||||
|
||||
$sql = 'SELECT id_filter, id_name
|
||||
FROM tmonitor_filter
|
||||
WHERE id_group_filter IN ('.implode(',', array_keys($user_groups)).')';
|
||||
|
||||
$event_filters = db_get_all_rows_sql($sql);
|
||||
|
||||
$filters = [];
|
||||
foreach ($event_filters as $event_filter) {
|
||||
$filters[$event_filter['id_filter']] = $event_filter['id_name'];
|
||||
}
|
||||
|
||||
echo '<div id="load-filter-select" class="load-filter-modal">';
|
||||
echo '<form method="post" id="form_load_filter" action="index.php?sec=view&sec2=operation/agentes/status_monitor&pure=">';
|
||||
|
||||
$table = new StdClass;
|
||||
$table->id = 'load_filter_form';
|
||||
$table->width = '100%';
|
||||
$table->cellspacing = 4;
|
||||
$table->cellpadding = 4;
|
||||
$table->class = 'databox';
|
||||
if (is_metaconsole()) {
|
||||
$table->cellspacing = 0;
|
||||
$table->cellpadding = 0;
|
||||
$table->class = 'databox filters';
|
||||
}
|
||||
|
||||
$table->styleTable = 'font-weight: bold; color: #555; text-align:left;';
|
||||
$filter_id_width = '200px';
|
||||
if (is_metaconsole()) {
|
||||
$filter_id_width = '150px';
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$table->rowid[3] = 'update_filter_row1';
|
||||
$data[0] = __('Load filter').$jump;
|
||||
$data[0] .= html_print_select(
|
||||
$filters,
|
||||
'filter_id',
|
||||
$current,
|
||||
'',
|
||||
__('None'),
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'margin-left:5px; width:'.$filter_id_width.';'
|
||||
);
|
||||
$data[1] = html_print_submit_button(
|
||||
__('Load filter'),
|
||||
'load_filter',
|
||||
false,
|
||||
'class="sub upd"',
|
||||
true
|
||||
);
|
||||
$data[1] .= html_print_input_hidden('load_filter', 1, true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
html_print_table($table);
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function show_filter() {
|
||||
$("#load-filter-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: 450
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
show_filter();
|
||||
});
|
||||
|
||||
</script>
|
||||
<?php
|
||||
return;
|
||||
}
|
||||
|
||||
if ($save_filter_modal) {
|
||||
echo '<div id="save-filter-select">';
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
echo '<div id="#info_box"></div>';
|
||||
$table = new StdClass;
|
||||
$table->id = 'save_filter_form';
|
||||
$table->width = '100%';
|
||||
$table->cellspacing = 4;
|
||||
$table->cellpadding = 4;
|
||||
$table->class = 'databox';
|
||||
if (is_metaconsole()) {
|
||||
$table->class = 'databox filters';
|
||||
$table->cellspacing = 0;
|
||||
$table->cellpadding = 0;
|
||||
}
|
||||
|
||||
$table->styleTable = 'font-weight: bold; text-align:left;';
|
||||
if (!is_metaconsole()) {
|
||||
$table->style[0] = 'width: 50%; width:50%;';
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$table->rowid[0] = 'update_save_selector';
|
||||
$data[0] = html_print_radio_button(
|
||||
'filter_mode',
|
||||
'new',
|
||||
'',
|
||||
true,
|
||||
true
|
||||
).__('New filter').'';
|
||||
|
||||
$data[1] = html_print_radio_button(
|
||||
'filter_mode',
|
||||
'update',
|
||||
'',
|
||||
false,
|
||||
true
|
||||
).__('Update filter').'';
|
||||
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = [];
|
||||
$table->rowid[1] = 'save_filter_row1';
|
||||
$data[0] = __('Filter name').$jump;
|
||||
$data[0] .= html_print_input_text('id_name', '', '', 15, 255, true);
|
||||
if (is_metaconsole()) {
|
||||
$data[1] = __('Save in Group').$jump;
|
||||
} else {
|
||||
$data[1] = __('Filter group').$jump;
|
||||
}
|
||||
|
||||
$user_groups_array = users_get_groups_for_select(
|
||||
$config['id_user'],
|
||||
'AW',
|
||||
users_can_manage_group_all(),
|
||||
true
|
||||
);
|
||||
|
||||
$data[1] .= html_print_select(
|
||||
$user_groups_array,
|
||||
'id_group_filter_dialog',
|
||||
$id_group_filter,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'w130'
|
||||
);
|
||||
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = [];
|
||||
$table->rowid[2] = 'save_filter_row2';
|
||||
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = [];
|
||||
$table->rowid[3] = 'update_filter_row1';
|
||||
$data[0] = __('Overwrite filter').$jump;
|
||||
|
||||
$sql = 'SELECT id_filter, id_name FROM tmonitor_filter';
|
||||
$monitor_filters = db_get_all_rows_sql($sql);
|
||||
|
||||
$_filters_update = [];
|
||||
|
||||
if ($monitor_filters !== false) {
|
||||
foreach ($monitor_filters as $monitor_filter) {
|
||||
$_filters_update[$monitor_filter['id_filter']] = $monitor_filter['id_name'];
|
||||
}
|
||||
}
|
||||
|
||||
$data[0] .= html_print_select(
|
||||
$_filters_update,
|
||||
'overwrite_filter',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
);
|
||||
$data[1] = html_print_submit_button(
|
||||
__('Update filter'),
|
||||
'update_filter',
|
||||
false,
|
||||
'class="sub upd" onclick="save_update_filter();"',
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
html_print_table($table);
|
||||
echo '<div>';
|
||||
echo html_print_submit_button(
|
||||
__('Save filter'),
|
||||
'save_filter',
|
||||
false,
|
||||
'class="sub upd float-right" onclick="save_new_filter();"',
|
||||
true
|
||||
);
|
||||
echo '</div>';
|
||||
} else {
|
||||
include 'general/noaccess.php';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function show_save_filter() {
|
||||
$('#save_filter_row1').show();
|
||||
$('#save_filter_row2').show();
|
||||
$('#update_filter_row1').hide();
|
||||
// Filter save mode selector
|
||||
$("[name='filter_mode']").click(function() {
|
||||
if ($(this).val() == 'new') {
|
||||
$('#save_filter_row1').show();
|
||||
$('#save_filter_row2').show();
|
||||
$('#submit-save_filter').show();
|
||||
$('#update_filter_row1').hide();
|
||||
}
|
||||
else {
|
||||
$('#save_filter_row1').hide();
|
||||
$('#save_filter_row2').hide();
|
||||
$('#update_filter_row1').show();
|
||||
$('#submit-save_filter').hide();
|
||||
}
|
||||
});
|
||||
$("#save-filter-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true
|
||||
});
|
||||
}
|
||||
|
||||
function save_new_filter() {
|
||||
// If the filter name is blank show error
|
||||
if ($('#text-id_name').val() == '') {
|
||||
$('#show_filter_error').html("<h3 class='error'><?php echo __('Filter name cannot be left blank'); ?></h3>");
|
||||
|
||||
// Close dialog
|
||||
$('.ui-dialog-titlebar-close').trigger('click');
|
||||
return false;
|
||||
}
|
||||
|
||||
var custom_fields_values = $('input[name^="ag_custom_fields"]').map(function() {
|
||||
return this.value;
|
||||
}).get();
|
||||
|
||||
var custom_fields_ids = $("input[name^='ag_custom_fields']").map(function() {
|
||||
var name = $(this).attr("name");
|
||||
var number = name.match(/\[(.*?)\]/)[1];
|
||||
|
||||
return number;
|
||||
}).get();
|
||||
|
||||
var ag_custom_fields = custom_fields_ids.reduce(function(result, custom_fields_id, index) {
|
||||
result[custom_fields_id] = custom_fields_values[index];
|
||||
return result;
|
||||
}, {});
|
||||
|
||||
var id_filter_save;
|
||||
jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
{
|
||||
"page" : "include/ajax/module",
|
||||
"save_monitor_filter" : 1,
|
||||
"id_name": $("#text-id_name").val(),
|
||||
"id_group_filter": $("#id_group_filter_dialog").val(),
|
||||
"ag_group" : $("#ag_group").val(),
|
||||
"modulegroup" : $("#modulegroup").val(),
|
||||
"recursion" : $("#checkbox-recursion").is(':checked'),
|
||||
"status" : $("#status").val(),
|
||||
"severity" : $("#severity").val(),
|
||||
"ag_modulename" : $("#text-ag_modulename").val(),
|
||||
"ag_freestring" : $("#text-ag_freestring").val(),
|
||||
"tag_filter" : $("#tag_filter").val(),
|
||||
"moduletype" : $("#moduletype").val(),
|
||||
"module_option" : $('#module_option').val(),
|
||||
"min_hours_status" : $('#text-min_hours_status').val(),
|
||||
"datatype" : $("#datatype").val(),
|
||||
"not_condition" : $("#not_condition_switch").is(':checked'),
|
||||
"ag_custom_fields": JSON.stringify(ag_custom_fields),
|
||||
},
|
||||
function (data) {
|
||||
$("#info_box").hide();
|
||||
if (data == 'error') {
|
||||
$("#info_box").filter(function(i, item) {
|
||||
if ($(item).data('type_info_box') == "error_create_filter") {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}).show();
|
||||
}
|
||||
else if (data == 'duplicate') {
|
||||
$("#info_box").filter(function(i, item) {
|
||||
if ($(item).data('type_info_box') == "duplicate_create_filter") {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}).show();
|
||||
}
|
||||
else {
|
||||
id_filter_save = data;
|
||||
|
||||
$("#info_box").filter(function(i, item) {
|
||||
if ($(item).data('type_info_box') == "success_create_filter") {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}).show();
|
||||
}
|
||||
|
||||
// Close dialog.
|
||||
$("#save-filter-select").dialog('close');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function save_update_filter() {
|
||||
var id_filter_update = $("#overwrite_filter").val();
|
||||
var name_filter_update = $("#overwrite_filter option[value='"+id_filter_update+"']").text();
|
||||
|
||||
var custom_fields_values = $('input[name^="ag_custom_fields"]').map(function() {
|
||||
return this.value;
|
||||
}).get();
|
||||
|
||||
var custom_fields_ids = $("input[name^='ag_custom_fields']").map(function() {
|
||||
var name = $(this).attr("name");
|
||||
var number = name.match(/\[(.*?)\]/)[1];
|
||||
|
||||
return number;
|
||||
}).get();
|
||||
|
||||
var ag_custom_fields = custom_fields_ids.reduce(function(result, custom_fields_id, index) {
|
||||
result[custom_fields_id] = custom_fields_values[index];
|
||||
return result;
|
||||
}, {});
|
||||
|
||||
jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
{
|
||||
"page" : "include/ajax/module",
|
||||
"update_monitor_filter" : 1,
|
||||
"id" : $("#overwrite_filter").val(),
|
||||
"ag_group" : $("#ag_group").val(),
|
||||
"modulegroup" : $("#modulegroup").val(),
|
||||
"recursion" : $("#checkbox-recursion").is(':checked'),
|
||||
"status" : $("#status").val(),
|
||||
"severity" : $("#severity").val(),
|
||||
"ag_modulename" : $("#text-ag_modulename").val(),
|
||||
"ag_freestring" : $("#text-ag_freestring").val(),
|
||||
"tag_filter" : $("#tag_filter").val(),
|
||||
"moduletype" : $("#moduletype").val(),
|
||||
"module_option" : $('#module_option').val(),
|
||||
"min_hours_status" : $('#text-min_hours_status').val(),
|
||||
"datatype" : $("#datatype").val(),
|
||||
"not_condition" : $("#not_condition_switch").is(':checked'),
|
||||
"ag_custom_fields": JSON.stringify(ag_custom_fields),
|
||||
},
|
||||
function (data) {
|
||||
$(".info_box").hide();
|
||||
if (data == 'ok') {
|
||||
$(".info_box").filter(function(i, item) {
|
||||
if ($(item).data('type_info_box') == "success_update_filter") {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}).show();
|
||||
}
|
||||
else {
|
||||
$(".info_box").filter(function(i, item) {
|
||||
if ($(item).data('type_info_box') == "error_create_filter") {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}).show();
|
||||
}
|
||||
});
|
||||
|
||||
// First remove all options of filters select
|
||||
$('#filter_id').find('option').remove().end();
|
||||
// Add 'none' option the first
|
||||
$('#filter_id').append ($('<option></option>').html ( <?php echo "'".__('none')."'"; ?> ).attr ("value", 0));
|
||||
// Reload filters select
|
||||
jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
{
|
||||
"page" : "include/ajax/module",
|
||||
"get_monitor_filters" : 1
|
||||
},
|
||||
function (data) {
|
||||
jQuery.each (data, function (i, val) {
|
||||
s = js_html_entity_decode(val);
|
||||
if (i == id_filter_update) {
|
||||
$('#filter_id').append ($('<option selected="selected"></option>').html (s).attr ("value", i));
|
||||
}
|
||||
else {
|
||||
$('#filter_id').append ($('<option></option>').html (s).attr ("value", i));
|
||||
}
|
||||
});
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
||||
// Close dialog
|
||||
$('.ui-dialog-titlebar-close').trigger('click');
|
||||
|
||||
// Update the info with the loaded filter
|
||||
$("#hidden-id_name").val($('#text-id_name').val());
|
||||
$('#filter_loaded_span').html($('#filter_loaded_text').html() + ': ' + name_filter_update);
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
show_save_filter();
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -360,7 +360,7 @@ function process_user_login_remote($login, $pass, $api=false)
|
|||
}
|
||||
|
||||
$user_info = [
|
||||
'fullname' => $login,
|
||||
'fullname' => db_escape_string_sql($login),
|
||||
'comments' => 'Imported from '.$config['auth'],
|
||||
];
|
||||
|
||||
|
@ -398,7 +398,7 @@ function process_user_login_remote($login, $pass, $api=false)
|
|||
$config['auth_error'] = __('User not found in database or incorrect password');
|
||||
return false;
|
||||
} else {
|
||||
$user_info['fullname'] = $sr['cn'][0];
|
||||
$user_info['fullname'] = db_escape_string_sql($sr['cn'][0]);
|
||||
$user_info['email'] = $sr['mail'][0];
|
||||
|
||||
// Create the user.
|
||||
|
@ -1565,7 +1565,7 @@ function local_ldap_search(
|
|||
|
||||
$filter = '';
|
||||
if (!empty($access_attr) && !empty($user)) {
|
||||
$filter = " -s sub '(".$access_attr.'='.$user.")' ";
|
||||
$filter = ' -s sub '.escapeshellarg('('.$access_attr.'='.$user.')');
|
||||
}
|
||||
|
||||
$tls = '';
|
||||
|
@ -1591,7 +1591,7 @@ function local_ldap_search(
|
|||
$ldap_admin_pass = ' -w '.escapeshellarg($ldap_admin_pass);
|
||||
}
|
||||
|
||||
$dn = " -b '".$dn."'";
|
||||
$dn = ' -b '.escapeshellarg($dn);
|
||||
$ldapsearch_command = 'ldapsearch -LLL -o ldif-wrap=no -o nettimeout='.$ldap_search_time.' -x'.$ldap_host.$ldap_version.' -E pr=10000/noprompt '.$ldap_admin_user.$ldap_admin_pass.$dn.$filter.$tls.' | grep -v "^#\|^$" | sed "s/:\+ /=>/g"';
|
||||
$shell_ldap_search = explode("\n", shell_exec($ldapsearch_command));
|
||||
foreach ($shell_ldap_search as $line) {
|
||||
|
|
|
@ -258,6 +258,14 @@ class ConsoleSupervisor
|
|||
$this->checkSyncQueueStatus();
|
||||
}
|
||||
|
||||
/*
|
||||
* Checkc agent missing libraries.
|
||||
* NOTIF.AGENT.LIBRARY
|
||||
*/
|
||||
if ((bool) enterprise_installed() === true) {
|
||||
$this->checkLibaryError();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -518,6 +526,14 @@ class ConsoleSupervisor
|
|||
$this->checkSyncQueueLength();
|
||||
$this->checkSyncQueueStatus();
|
||||
}
|
||||
|
||||
/*
|
||||
* Checkc agent missing libraries.
|
||||
* NOTIF.AGENT.LIBRARY
|
||||
*/
|
||||
if ((bool) enterprise_installed() === true) {
|
||||
$this->checkLibaryError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2379,7 +2395,7 @@ class ConsoleSupervisor
|
|||
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
|
||||
$message_conf_cron .= __('Discovery relies on an appropriate cron setup.');
|
||||
$message_conf_cron .= '. '.__('Please, add the following line to your crontab file:');
|
||||
$message_conf_cron .= '<b><pre class=""ui-dialog>* * * * * <user> wget -q -O - --no-check-certificate ';
|
||||
$message_conf_cron .= '<b><pre class=""ui-dialog>* * * * * <user> wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies ';
|
||||
$message_conf_cron .= str_replace(
|
||||
ENTERPRISE_DIR.'/meta/',
|
||||
'',
|
||||
|
@ -2806,4 +2822,30 @@ class ConsoleSupervisor
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Chechs if an agent has a dependency eror on omnishell
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkLibaryError()
|
||||
{
|
||||
$sql = 'SELECT COUNT(errorlevel) from tremote_command_target WHERE errorlevel = 2';
|
||||
|
||||
$error_dependecies = db_get_sql($sql);
|
||||
if ($error_dependecies > 0) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.AGENT.LIBRARY',
|
||||
'title' => __('Agent dependency error'),
|
||||
'message' => __(
|
||||
'There are omnishell agents with dependency errors',
|
||||
),
|
||||
|
||||
'url' => '__url__/index.php?sec=gextensions&sec2=enterprise/tools/omnishell',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -782,7 +782,9 @@ class NetworkMap
|
|||
if ($this->network) {
|
||||
// Network map, based on direct network.
|
||||
$nodes = networkmap_get_nodes_from_ip_mask(
|
||||
$this->network
|
||||
$this->network,
|
||||
false,
|
||||
'
'
|
||||
);
|
||||
} else if ($this->mapOptions['map_filter']['empty_map']) {
|
||||
// Empty map returns no data.
|
||||
|
@ -792,17 +794,22 @@ class NetworkMap
|
|||
|| $this->mapOptions['map_filter']['dont_show_subgroups'] == 1
|
||||
) {
|
||||
// Show only current selected group.
|
||||
$filter['id_grupo'] = $this->idGroup;
|
||||
$filter['id_grupo'] = explode(',', $this->idGroup);
|
||||
} else {
|
||||
// Show current group and children.
|
||||
$childrens = groups_get_children($this->idGroup, null, true);
|
||||
if (!empty($childrens)) {
|
||||
$childrens = array_keys($childrens);
|
||||
foreach (explode(',', $this->idGroup) as $key => $group) {
|
||||
$childrens = groups_get_children($group, null, true);
|
||||
if (!empty($childrens)) {
|
||||
$childrens = array_keys($childrens);
|
||||
|
||||
$filter['id_grupo'] = $childrens;
|
||||
$filter['id_grupo'][] = $this->idGroup;
|
||||
} else {
|
||||
$filter['id_grupo'] = $this->idGroup;
|
||||
if (empty($filter['id_grupo']) === false) {
|
||||
$filter['id_grupo'] = array_merge($filter['id_grupo'], $childrens);
|
||||
} else {
|
||||
$filter['id_grupo'] = $childrens;
|
||||
}
|
||||
} else {
|
||||
$filter['id_grupo'][] = $group;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1189,6 +1196,10 @@ class NetworkMap
|
|||
$head .= 'overlap="scalexy";';
|
||||
}
|
||||
|
||||
if ($layout == 'spring1' || $layout == 'spring2') {
|
||||
$head .= 'sep="'.$node_sep.'";';
|
||||
}
|
||||
|
||||
if ($layout == 'flat') {
|
||||
$head .= 'ranksep="'.$rank_sep.'";';
|
||||
}
|
||||
|
@ -3498,6 +3509,7 @@ class NetworkMap
|
|||
url_background_grid: url_background_grid,
|
||||
refresh_time: '.$this->mapOptions['refresh_time'].',
|
||||
font_size: '.$this->mapOptions['font_size'].',
|
||||
method: '.$this->map['generation_method'].',
|
||||
base_url_homedir: "'.ui_get_full_url(false).'"
|
||||
});
|
||||
init_drag_and_drop();
|
||||
|
|
|
@ -84,6 +84,15 @@ class SatelliteCollection extends HTML
|
|||
return;
|
||||
}
|
||||
|
||||
if ((int) $config['license_nms'] === 0) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_NMS_VIOLATION,
|
||||
'Trying to access satellite collections'
|
||||
);
|
||||
include $config['homedir'].'/general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the ajax controller.
|
||||
$this->ajaxController = $ajaxController;
|
||||
// Capture all parameters before start.
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC230206';
|
||||
$pandora_version = 'v7.0NG.768';
|
||||
$build_version = 'PC230216';
|
||||
$pandora_version = 'v7.0NG.769';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -6397,3 +6397,19 @@ function getBearerToken()
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check nms license on api.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function nms_check_api()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if ((int) $config['license_nms'] === 1) {
|
||||
returnError('license_error');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,6 +198,16 @@ function returnError($typeError, $returnType='string')
|
|||
);
|
||||
break;
|
||||
|
||||
case 'license_error':
|
||||
returnData(
|
||||
$returnType,
|
||||
[
|
||||
'type' => 'string',
|
||||
'data' => __('License not allowed for this operation.'),
|
||||
]
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
returnData(
|
||||
$returnType,
|
||||
|
|
|
@ -463,10 +463,6 @@ function config_update_config()
|
|||
if (config_update_value('ipam_ocuppied_warning_treshold', get_parameter('ipam_ocuppied_warning_treshold'), true) === false) {
|
||||
$error_update[] = __('Ipam Ocuppied Manager Warning');
|
||||
}
|
||||
|
||||
if (config_update_value('sap_license', get_parameter('sap_license'), true) === false) {
|
||||
$error_update[] = __('SAP/R3 Plugin Licence');
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -4948,7 +4948,6 @@ function events_page_general_acknowledged($event_id)
|
|||
global $config;
|
||||
$Acknowledged = '';
|
||||
$event = db_get_row('tevento', 'id_evento', $event_id);
|
||||
hd($event['ack_utimestamp'], true);
|
||||
if ($event !== false && $event['estado'] == 1) {
|
||||
$user_ack = db_get_value(
|
||||
'fullname',
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Images File Manager functions.
|
||||
*
|
||||
|
@ -96,7 +97,7 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
|
|||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
if (!check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access File manager'
|
||||
|
@ -139,25 +140,8 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
|
|||
$nombre_archivo = sprintf('%s/%s', $real_directory, $filename);
|
||||
try {
|
||||
$mimeContentType = mime_content_type($_FILES['file']['tmp_name']);
|
||||
$fileExtension = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
|
||||
|
||||
$validFileExtension = true;
|
||||
|
||||
if (empty($fileExtension) === false) {
|
||||
$filtered_types = array_filter(
|
||||
$filterFilesType,
|
||||
function ($value) use ($fileExtension) {
|
||||
$mimeTypeExtensionName = explode('/', $value)[1];
|
||||
return $mimeTypeExtensionName === $fileExtension;
|
||||
}
|
||||
);
|
||||
|
||||
if (empty($filtered_types) === true) {
|
||||
$validFileExtension = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($validFileExtension === true && (empty($filterFilesType) === true || in_array($mimeContentType, $filterFilesType) === true)) {
|
||||
if (empty($filterFilesType) === true || in_array($mimeContentType, $filterFilesType) === true) {
|
||||
$result = copy($_FILES['file']['tmp_name'], $nombre_archivo);
|
||||
} else {
|
||||
$error_message = 'The uploaded file is not allowed. Only gif, png or jpg files can be uploaded.';
|
||||
|
@ -240,7 +224,7 @@ function create_text_file($default_real_directory, $destination_directory)
|
|||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
if (!check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access File manager'
|
||||
|
@ -310,7 +294,7 @@ if ($create_dir === true) {
|
|||
$testHash = md5($directory.$config['server_unique_identifier']);
|
||||
|
||||
if ($hash !== $testHash) {
|
||||
ui_print_error_message(__('Security error.'));
|
||||
ui_print_error_message(__('Security error.'));
|
||||
} else {
|
||||
$dirname = filemanager_safe_directory((string) get_parameter('dirname'));
|
||||
|
||||
|
@ -366,7 +350,7 @@ if ($delete_file === true) {
|
|||
}
|
||||
} else {
|
||||
if (unlink($filename) === true) {
|
||||
$config['filemanager']['delete'] = 1;
|
||||
$config['filemanager']['delete'] = 1;
|
||||
} else {
|
||||
$config['filemanager']['delete'] = 0;
|
||||
}
|
||||
|
@ -516,77 +500,116 @@ function filemanager_file_explorer(
|
|||
check_opened_dialog('create_folder');
|
||||
}
|
||||
<?php if ($allowCreateText === true) : ?>
|
||||
function show_create_text_file() {
|
||||
actions_dialog('create_text_file');
|
||||
$("#create_text_file").css("display", "block");
|
||||
check_opened_dialog('create_text_file');
|
||||
}
|
||||
function show_create_text_file() {
|
||||
actions_dialog('create_text_file');
|
||||
$("#create_text_file").css("display", "block");
|
||||
check_opened_dialog('create_text_file');
|
||||
}
|
||||
<?php endif ?>
|
||||
|
||||
function show_upload_file() {
|
||||
actions_dialog('upload_file');
|
||||
$("#upload_file").css("display", "block");
|
||||
check_opened_dialog('upload_file');
|
||||
}
|
||||
|
||||
function check_opened_dialog(check_opened){
|
||||
if(check_opened !== 'create_folder'){
|
||||
function check_opened_dialog(check_opened) {
|
||||
if (check_opened !== 'create_folder') {
|
||||
if (($("#create_folder").hasClass("ui-dialog-content") && $('#create_folder').dialog('isOpen') === true)) {
|
||||
$('#create_folder').dialog('close');
|
||||
}
|
||||
}
|
||||
<?php if ($allowCreateText === true) : ?>
|
||||
if(check_opened !== 'create_text_file'){
|
||||
if (($("#create_text_file").hasClass("ui-dialog-content") && $('#create_text_file').dialog('isOpen') === true)) {
|
||||
$('#create_text_file').dialog('close');
|
||||
if (check_opened !== 'create_text_file') {
|
||||
if (($("#create_text_file").hasClass("ui-dialog-content") && $('#create_text_file').dialog('isOpen') === true)) {
|
||||
$('#create_text_file').dialog('close');
|
||||
}
|
||||
}
|
||||
}
|
||||
<?php endif ?>
|
||||
if(check_opened !== 'upload_file'){
|
||||
if (check_opened !== 'upload_file') {
|
||||
if (($("#upload_file").hasClass("ui-dialog-content") && $('#upload_file').dialog('isOpen')) === true) {
|
||||
$('#upload_file').dialog('close');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function actions_dialog(action){
|
||||
$('.'+action).addClass('file_table_modal_active');
|
||||
var title_action ='';
|
||||
function actions_dialog(action) {
|
||||
$('.' + action).addClass('file_table_modal_active');
|
||||
var title_action = '';
|
||||
switch (action) {
|
||||
case 'create_folder':
|
||||
title_action = "<?php echo __('Create a Directory'); ?>";
|
||||
title_action = "<?php echo __('Create a Directory'); ?>";
|
||||
break;
|
||||
<?php if ($allowCreateText === true) : ?>
|
||||
case 'create_text_file':
|
||||
title_action = "<?php echo __('Create a Text'); ?>";
|
||||
break;
|
||||
<?php endif ?>
|
||||
<?php if ($allowCreateText === true) : ?>
|
||||
case 'create_text_file':
|
||||
title_action = "<?php echo __('Create a Text'); ?>";
|
||||
break;
|
||||
<?php endif ?>
|
||||
case 'upload_file':
|
||||
title_action = "<?php echo __('Upload Files'); ?>";
|
||||
title_action = "<?php echo __('Upload Files'); ?>";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
$('#'+action)
|
||||
.dialog({
|
||||
title: title_action,
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 500,
|
||||
minWidth: 500,
|
||||
minHeight: 210,
|
||||
maxWidth: 800,
|
||||
maxHeight: 300,
|
||||
close: function () {
|
||||
$('.'+action).removeClass('file_table_modal_active');
|
||||
}
|
||||
}).show();
|
||||
$('#' + action)
|
||||
.dialog({
|
||||
title: title_action,
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 500,
|
||||
minWidth: 500,
|
||||
minHeight: 210,
|
||||
maxWidth: 800,
|
||||
maxHeight: 300,
|
||||
close: function() {
|
||||
$('.' + action).removeClass('file_table_modal_active');
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
|
||||
function show_modal_real_path(path) {
|
||||
if (navigator.clipboard && window.isSecureContext) <?php $secure_con = true; ?>;
|
||||
else <?php $secure_con = false; ?>;
|
||||
$('#modal_real_path').addClass('file_table_modal_active');
|
||||
$('#real_path').empty();
|
||||
$('#real_path').html(path);
|
||||
title_action = "<?php echo __('Real path'); ?>";
|
||||
$('#modal_real_path')
|
||||
.dialog({
|
||||
title: title_action,
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 448,
|
||||
minWidth: 448,
|
||||
minHeight: 213,
|
||||
maxWidth: 800,
|
||||
maxHeight: 300,
|
||||
close: function() {
|
||||
$('#modal_real_path').removeClass('file_table_modal_active');
|
||||
}
|
||||
}).show();
|
||||
|
||||
$("#submit-submit").on("click", copyToClipboard);
|
||||
}
|
||||
|
||||
function copyToClipboard() {
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
window.navigator.clipboard.writeText($("#real_path").text()).then(function() {
|
||||
$('#modal_real_path').dialog('close');
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
|
@ -703,9 +726,9 @@ function filemanager_file_explorer(
|
|||
if (pathinfo($fileinfo['realpath'], PATHINFO_EXTENSION) === 'php'
|
||||
&& (is_readable($fileinfo['realpath']) === true || is_executable($fileinfo['realpath']) === true)
|
||||
) {
|
||||
$error_message = __('This file could be executed by any user');
|
||||
$error_message .= '. '.__('Make sure it can\'t perform dangerous tasks');
|
||||
$data[1] = '<span class="error forced_title" data-title="'.$error_message.'" data-use_title_for_force_title="1">'.$data[1].'</span>';
|
||||
$error_message = __('This file could be executed by any user');
|
||||
$error_message .= '. '.__('Make sure it can\'t perform dangerous tasks');
|
||||
$data[1] = '<span class="error forced_title" data-title="'.$error_message.'" data-use_title_for_force_title="1">'.$data[1].'</span>';
|
||||
}
|
||||
|
||||
$data[2] = ui_print_timestamp(
|
||||
|
@ -719,11 +742,11 @@ function filemanager_file_explorer(
|
|||
$data[3] = ui_format_filesize($fileinfo['size']);
|
||||
}
|
||||
|
||||
// Actions buttons
|
||||
// Delete button.
|
||||
$data[4] = '';
|
||||
$data[4] .= '<span style="display: flex">';
|
||||
$typefile = array_pop(explode('.', $fileinfo['name']));
|
||||
// Actions buttons
|
||||
// Delete button.
|
||||
$data[4] = '';
|
||||
$data[4] .= '<span style="display: flex">';
|
||||
$typefile = array_pop(explode('.', $fileinfo['name']));
|
||||
if (is_writable($fileinfo['realpath']) === true
|
||||
&& (is_dir($fileinfo['realpath']) === false || count(scandir($fileinfo['realpath'])) < 3)
|
||||
&& ($readOnly === false)
|
||||
|
@ -764,9 +787,16 @@ function filemanager_file_explorer(
|
|||
$data[4] .= '</a>';
|
||||
}
|
||||
|
||||
$data[4] .= '</span>';
|
||||
if (is_writable($fileinfo['realpath']) === true
|
||||
&& (is_dir($fileinfo['realpath']) === false || count(scandir($fileinfo['realpath'])) < 3)
|
||||
&& ($readOnly === false)
|
||||
) {
|
||||
$data[4] .= '<a href="javascript: show_modal_real_path(`'.$fileinfo['realpath'].'`);">'.html_print_image('images/book_edit.png', true, ['style' => 'margin-top: 2px;', 'title' => __('Real path'), 'class' => 'invert_filter']).'</a>';
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
$data[4] .= '</span>';
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
} else {
|
||||
ui_print_info_message(
|
||||
|
@ -859,7 +889,7 @@ function filemanager_file_explorer(
|
|||
'content' => html_print_input_file(
|
||||
'file',
|
||||
true,
|
||||
[ 'style' => 'border:0; padding:0; width:100%' ]
|
||||
['style' => 'border:0; padding:0; width:100%']
|
||||
),
|
||||
],
|
||||
true
|
||||
|
@ -942,6 +972,22 @@ function filemanager_file_explorer(
|
|||
);
|
||||
echo '</a>';
|
||||
|
||||
// Show Modal Real Path
|
||||
$modal_real_path = "<div><b>Real path to plugin execution is:</b></div>
|
||||
<div id='real_path'></div>";
|
||||
|
||||
if (isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'on' || $_SERVER['SERVER_NAME'] == 'localhost' || $_SERVER['SERVER_NAME'] == '127.0.0.1') {
|
||||
$modal_real_path .= "<div style='float:right;margin: 5em 0 0 auto';>".html_print_submit_button(__('Copy'), 'submit', false, 'class="sub next"', true).'</div>';
|
||||
}
|
||||
|
||||
html_print_div(
|
||||
[
|
||||
'id' => 'modal_real_path',
|
||||
'class' => 'invisible',
|
||||
'content' => $modal_real_path,
|
||||
]
|
||||
);
|
||||
|
||||
echo '</div>';
|
||||
} else {
|
||||
echo "<div style='text-align: right; width: ".$table->width."; color:#AC4444; margin-bottom:10px;'>";
|
||||
|
@ -1088,4 +1134,4 @@ function filemanager_safe_directory(
|
|||
}
|
||||
|
||||
return $directory;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -519,12 +519,13 @@ function modules_delete_agent_module($id_agent_module)
|
|||
'disabled' => 1,
|
||||
'delete_pending' => 1,
|
||||
];
|
||||
$result = db_process_sql_update(
|
||||
$id_agent = db_process_sql_update(
|
||||
'tagente_modulo',
|
||||
$values,
|
||||
['id_agente_modulo' => $id_borrar_modulo]
|
||||
);
|
||||
if ($result === false) {
|
||||
|
||||
if ($id_agent === false) {
|
||||
$error++;
|
||||
} else {
|
||||
// Set flag to update module status count.
|
||||
|
@ -562,7 +563,7 @@ function modules_delete_agent_module($id_agent_module)
|
|||
$result = db_process_delete_temp(
|
||||
'ttag_module',
|
||||
'id_agente_modulo',
|
||||
$id_borrar_modulo
|
||||
$id_agent
|
||||
);
|
||||
if ($result === false) {
|
||||
$error++;
|
||||
|
|
|
@ -1126,6 +1126,10 @@ function networkmap_open_graph(
|
|||
$head .= 'overlap="scalexy";';
|
||||
}
|
||||
|
||||
if ($layout == 'spring1' || $layout == 'spring2') {
|
||||
$head .= 'sep="'.$node_sep.'";';
|
||||
}
|
||||
|
||||
if ($layout === 'flat') {
|
||||
$head .= 'ranksep="'.$rank_sep.'";';
|
||||
} else if ($layout === 'spring2') {
|
||||
|
@ -1356,9 +1360,10 @@ function networkmap_get_types($strict_user=false)
|
|||
*/
|
||||
function networkmap_get_nodes_from_ip_mask(
|
||||
$ip_mask,
|
||||
$return_ids_only=false
|
||||
$return_ids_only=false,
|
||||
$separator=',',
|
||||
) {
|
||||
$list_ip_masks = explode(',', $ip_mask);
|
||||
$list_ip_masks = explode($separator, $ip_mask);
|
||||
|
||||
if (empty($list_ip_masks) === true) {
|
||||
return [];
|
||||
|
@ -1375,14 +1380,14 @@ function networkmap_get_nodes_from_ip_mask(
|
|||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM `tagente`
|
||||
INNER JOIN
|
||||
(SELECT DISTINCT `id_agent` FROM
|
||||
INNER JOIN
|
||||
(SELECT DISTINCT `id_agent` FROM
|
||||
(SELECT `id_agente` AS "id_agent", `direccion` AS "ip"
|
||||
FROM `tagente`
|
||||
FROM `tagente`
|
||||
UNION
|
||||
SELECT ag.`id_agent`, a.`ip`
|
||||
FROM `taddress_agent` ag
|
||||
INNER JOIN `taddress` a
|
||||
FROM `taddress_agent` ag
|
||||
INNER JOIN `taddress` a
|
||||
ON ag.id_a=a.id_a
|
||||
) t_tmp
|
||||
WHERE (-1 << %d) & INET_ATON(t_tmp.ip) = INET_ATON("%s")
|
||||
|
|
|
@ -55,10 +55,30 @@ function draw_minimap() {
|
|||
var relation_min_nodes = minimap_relation;
|
||||
var relation_minimap_w = 2;
|
||||
var relation_minimap_h = 2;
|
||||
if (graph.nodes.length > 100) {
|
||||
if (graph.nodes.length > 100 && graph.nodes.length < 500) {
|
||||
relation_min_nodes = 0.01;
|
||||
relation_minimap_w = (graph.nodes.length / 100) * 2.5;
|
||||
relation_minimap_h = 1.5;
|
||||
} else if (graph.nodes.length >= 500 && graph.nodes.length < 1000) {
|
||||
if (typeof method != "undefined" && method == 4) {
|
||||
relation_min_nodes = 0.002;
|
||||
relation_minimap_w = (graph.nodes.length / 500) * 2.5;
|
||||
relation_minimap_h = 3;
|
||||
} else {
|
||||
relation_min_nodes = 0.008;
|
||||
relation_minimap_w = (graph.nodes.length / 500) * 2.5;
|
||||
relation_minimap_h = 3;
|
||||
}
|
||||
} else if (graph.nodes.length >= 1000) {
|
||||
if (typeof method != "undefined" && method == 4) {
|
||||
relation_min_nodes = 0.001;
|
||||
relation_minimap_w = (graph.nodes.length / 1000) * 4.5;
|
||||
relation_minimap_h = 4;
|
||||
} else {
|
||||
relation_min_nodes = 0.0015;
|
||||
relation_minimap_w = (graph.nodes.length / 1000) * 3.5;
|
||||
relation_minimap_h = 3.5;
|
||||
}
|
||||
}
|
||||
|
||||
//Draw the items and lines
|
||||
|
@ -1792,10 +1812,30 @@ function init_minimap() {
|
|||
var relation_minimap_w = 2;
|
||||
var relation_minimap_h = 2;
|
||||
|
||||
if (graph.nodes.length > 100) {
|
||||
if (graph.nodes.length > 100 && graph.nodes.length < 500) {
|
||||
relation_min_nodes = 0.01;
|
||||
relation_minimap_w = (graph.nodes.length / 100) * 2.5;
|
||||
relation_minimap_h = 1.5;
|
||||
} else if (graph.nodes.length >= 500 && graph.nodes.length < 1000) {
|
||||
if (typeof method != "undefined" && method == 4) {
|
||||
relation_min_nodes = 0.002;
|
||||
relation_minimap_w = (graph.nodes.length / 500) * 2.5;
|
||||
relation_minimap_h = 3;
|
||||
} else {
|
||||
relation_min_nodes = 0.008;
|
||||
relation_minimap_w = (graph.nodes.length / 500) * 2.5;
|
||||
relation_minimap_h = 3;
|
||||
}
|
||||
} else if (graph.nodes.length >= 1000) {
|
||||
if (typeof method != "undefined" && method == 4) {
|
||||
relation_min_nodes = 0.001;
|
||||
relation_minimap_w = (graph.nodes.length / 1000) * 4.5;
|
||||
relation_minimap_h = 4;
|
||||
} else {
|
||||
relation_min_nodes = 0.0015;
|
||||
relation_minimap_w = (graph.nodes.length / 1000) * 3.5;
|
||||
relation_minimap_h = 3.5;
|
||||
}
|
||||
}
|
||||
|
||||
$("#minimap_" + networkmap_id).bind("mousemove", function(event) {
|
||||
|
@ -3092,6 +3132,10 @@ function init_graph(parameter_object) {
|
|||
window.refresh_time = parameter_object.refresh_time;
|
||||
}
|
||||
|
||||
if (typeof parameter_object.method != "undefined") {
|
||||
window.method = parameter_object.method;
|
||||
}
|
||||
|
||||
var rect_center_x = graph.nodes[0].x;
|
||||
var rect_center_y = graph.nodes[0].y;
|
||||
|
||||
|
|
|
@ -2,7 +2,15 @@
|
|||
|
||||
// Show the modal window of an event
|
||||
function show_event_dialog(event, dialog_page) {
|
||||
var ajax_file = $("#hidden-ajax_file").val();
|
||||
var ajax_file = getUrlAjax();
|
||||
|
||||
var view = ``;
|
||||
|
||||
if ($("#event_details_window").length) {
|
||||
view = "#event_details_window";
|
||||
} else if ($("#sound_event_details_window").length) {
|
||||
view = "#sound_event_details_window";
|
||||
}
|
||||
|
||||
if (dialog_page == undefined) {
|
||||
dialog_page = "general";
|
||||
|
@ -39,7 +47,7 @@ function show_event_dialog(event, dialog_page) {
|
|||
filter: values
|
||||
},
|
||||
function(data) {
|
||||
$("#event_details_window")
|
||||
$(view)
|
||||
.hide()
|
||||
.empty()
|
||||
.append(data)
|
||||
|
@ -122,7 +130,7 @@ function execute_response(event_id, server_id) {
|
|||
jQuery.ajax({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
url: getUrlAjax(),
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
// If cannot get response abort it
|
||||
|
@ -153,7 +161,7 @@ function execute_response_massive(events, response_id, response_parameters) {
|
|||
jQuery.ajax({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
url: getUrlAjax(),
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
// If cannot get response abort it
|
||||
|
@ -203,7 +211,7 @@ function execute_response_massive(events, response_id, response_parameters) {
|
|||
jQuery.ajax({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
url: getUrlAjax(),
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$(".container-massive-events-response").append(data);
|
||||
|
@ -240,13 +248,21 @@ function show_response_dialog(response_id, response) {
|
|||
params.push({ name: "server_id", value: response.server_id });
|
||||
params.push({ name: "response", value: JSON.stringify(response) });
|
||||
|
||||
var view = ``;
|
||||
|
||||
if ($("#event_response_window").length) {
|
||||
view = "#event_response_window";
|
||||
} else if ($("#sound_event_response_window").length) {
|
||||
view = "#sound_event_response_window";
|
||||
}
|
||||
|
||||
jQuery.ajax({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
url: getUrlAjax(),
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#event_response_window")
|
||||
$(view)
|
||||
.hide()
|
||||
.empty()
|
||||
.append(data)
|
||||
|
@ -292,7 +308,7 @@ function perform_response(response, response_id, index) {
|
|||
jQuery.ajax({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
url: getUrlAjax(),
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
var out = data.replace(/[\n|\r]/g, "<br>");
|
||||
|
@ -321,7 +337,7 @@ function event_change_status(event_ids, server_id) {
|
|||
server_id: server_id
|
||||
},
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
url: getUrlAjax(),
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
$("#button-status_button").removeAttr("disabled");
|
||||
|
@ -350,9 +366,12 @@ function event_change_status(event_ids, server_id) {
|
|||
}
|
||||
});
|
||||
|
||||
$("#table_events")
|
||||
.DataTable()
|
||||
.draw(false);
|
||||
if ($("#table_events").length) {
|
||||
$("#table_events")
|
||||
.DataTable()
|
||||
.draw(false);
|
||||
}
|
||||
|
||||
$("#notification_status_success").show();
|
||||
|
||||
$("#general_status")
|
||||
|
@ -385,7 +404,7 @@ function event_change_owner(event_id, server_id) {
|
|||
new_owner: new_owner
|
||||
},
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
url: getUrlAjax(),
|
||||
async: true,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
|
@ -404,9 +423,12 @@ function event_change_owner(event_id, server_id) {
|
|||
// if (typeof dt_events !== "undefined") {
|
||||
// dt_events.draw(false);
|
||||
// }
|
||||
$("#table_events")
|
||||
.DataTable()
|
||||
.draw(false);
|
||||
|
||||
if ($("#table_events").length) {
|
||||
$("#table_events")
|
||||
.DataTable()
|
||||
.draw(false);
|
||||
}
|
||||
$("#notification_owner_success").show();
|
||||
if (new_owner == -1) {
|
||||
$("#extended_event_general_page table td.general_owner").html(
|
||||
|
@ -460,7 +482,7 @@ function event_comment(current_event) {
|
|||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
url: getUrlAjax(),
|
||||
dataType: "html",
|
||||
success: function() {
|
||||
$("#button-comment_button").removeAttr("disabled");
|
||||
|
@ -485,7 +507,7 @@ function update_event(table, id_evento, type, event_rep, row, server_id) {
|
|||
$.ajax({
|
||||
async: true,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
url: getUrlAjax(),
|
||||
data: {
|
||||
page: "include/ajax/events",
|
||||
validate_event: type.validate_event,
|
||||
|
@ -776,7 +798,7 @@ function show_response_dialog_massive(response_id, response_parameters) {
|
|||
jQuery.ajax({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
url: getUrlAjax(),
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
// If cannot get response abort it
|
||||
|
@ -914,7 +936,7 @@ function process_buffers(buffers) {
|
|||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
url: getUrlAjax(),
|
||||
async: true,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
|
@ -1030,8 +1052,10 @@ function openSoundEventModal(settings) {
|
|||
|
||||
function test_sound_button(test_sound, urlSound) {
|
||||
if (test_sound === true) {
|
||||
$("#button-melody_sound").addClass("blink-image");
|
||||
add_audio(urlSound);
|
||||
} else {
|
||||
$("#button-melody_sound").removeClass("blink-image");
|
||||
remove_audio();
|
||||
}
|
||||
}
|
||||
|
@ -1147,6 +1171,7 @@ function check_event_sound(settings) {
|
|||
// Add elements.
|
||||
data.forEach(function(element) {
|
||||
var li = document.createElement("li");
|
||||
var b64 = btoa(JSON.stringify(element));
|
||||
li.insertAdjacentHTML(
|
||||
"beforeend",
|
||||
'<div class="li-priority">' + element.priority + "</div>"
|
||||
|
@ -1157,7 +1182,7 @@ function check_event_sound(settings) {
|
|||
);
|
||||
li.insertAdjacentHTML(
|
||||
"beforeend",
|
||||
'<div class="li-title">' + element.message + "</div>"
|
||||
`<div class="li-title"><a href="javascript:" onclick="show_event_dialog('${b64}')">${element.message}</a></div>`
|
||||
);
|
||||
li.insertAdjacentHTML(
|
||||
"beforeend",
|
||||
|
@ -1185,10 +1210,12 @@ function table_info_response_event(response_id, event_id, server_id, massive) {
|
|||
params.push({ name: "server_id", value: server_id });
|
||||
params.push({ name: "event_id", value: event_id });
|
||||
|
||||
var url = getUrlAjax();
|
||||
|
||||
jQuery.ajax({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
url: url,
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
if (response) {
|
||||
|
@ -1201,7 +1228,7 @@ function table_info_response_event(response_id, event_id, server_id, massive) {
|
|||
jQuery.ajax({
|
||||
data: params,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
url: url,
|
||||
dataType: "html",
|
||||
success: function(output) {
|
||||
if (massive === true) {
|
||||
|
@ -1216,3 +1243,11 @@ function table_info_response_event(response_id, event_id, server_id, massive) {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getUrlAjax() {
|
||||
if ($("#hidden-ajax_file").length) {
|
||||
return $("#hidden-ajax_file").val();
|
||||
} else if ($("#hidden-ajax_file_sound_console").length) {
|
||||
return $("#hidden-ajax_file_sound_console").val();
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -301,3 +301,59 @@
|
|||
background: #e63c52;
|
||||
}
|
||||
}
|
||||
|
||||
/* Firefox old*/
|
||||
@-moz-keyframes blink {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes blink {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
/* IE */
|
||||
@-ms-keyframes blink {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.5;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
/* Opera and prob css3 final iteration */
|
||||
@keyframes blink {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.5;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
.blink-image {
|
||||
-moz-animation: blink normal 2s infinite ease-in-out; /* Firefox */
|
||||
-webkit-animation: blink normal 2s infinite ease-in-out; /* Webkit */
|
||||
-ms-animation: blink normal 2s infinite ease-in-out; /* IE */
|
||||
animation: blink normal 2s infinite ease-in-out; /* Opera and prob css3 final iteration */
|
||||
filter: hue-rotate(120deg);
|
||||
}
|
||||
|
|
|
@ -130,8 +130,8 @@
|
|||
</div>
|
||||
<div style='padding-bottom: 50px'>
|
||||
<?php
|
||||
$version = '7.0NG.768';
|
||||
$build = '230206';
|
||||
$version = '7.0NG.769';
|
||||
$build = '230216';
|
||||
$banner = "v$version Build $build";
|
||||
error_reporting(0);
|
||||
|
||||
|
|
|
@ -57,10 +57,10 @@ if ($new_networkmap) {
|
|||
$offset_x = '';
|
||||
$offset_y = '';
|
||||
$scale_z = 0.5;
|
||||
$node_sep = 10;
|
||||
$rank_sep = 1.0;
|
||||
$node_sep = 0.25;
|
||||
$rank_sep = 0.5;
|
||||
$mindist = 1.0;
|
||||
$kval = 5;
|
||||
$kval = 0.3;
|
||||
$refresh_time = 300;
|
||||
}
|
||||
|
||||
|
@ -273,6 +273,25 @@ if (!empty($result)) {
|
|||
if ($not_found) {
|
||||
ui_print_error_message(__('Not found networkmap.'));
|
||||
} else {
|
||||
if ($disabled_source === false) {
|
||||
echo '<div id="map_loading" style="width: 98%;height: 1000px; background-color: rgba(245, 245, 245, .3);position: absolute;display: flex;justify-content: center;align-items: center;flex-direction: column-reverse;">';
|
||||
echo html_print_image('images/spinner.gif', true, 'width: 50px;height: 50px;');
|
||||
echo '<div>'.__('Creating map...').'</div>';
|
||||
echo '</div>';
|
||||
$info1 = __('To create a network map that visually recreates link-level (L2) relationships, you must first discover these relationships with Discovery Server. Network maps only reflect relationships that have already been discovered.');
|
||||
$separator = '<br>';
|
||||
$info2 = __('Discovery Server discovers relationships between interfaces (L2) through SNMP and relationships between hosts (L3) through route discovery.');
|
||||
$info3 = __('You can also create these relationships manually by editing nodes or re-passing a discovery task after adding new information (for example by adding new SNMP communities).');
|
||||
$info4 = __('See our documentation for more information.');
|
||||
ui_print_info_message(
|
||||
[
|
||||
'no_close' => false,
|
||||
'message' => $info1.$separator.$info2.$separator.$info3.$separator.$info4,
|
||||
],
|
||||
'style="width: 98%;"'
|
||||
);
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'form_editor';
|
||||
|
||||
|
@ -337,7 +356,14 @@ if ($not_found) {
|
|||
);
|
||||
|
||||
$table->data[3][0] = __('Description');
|
||||
$table->data[3][1] = html_print_textarea('description', 7, 25, $description, '', true);
|
||||
$table->data[3][1] = html_print_input_text(
|
||||
'description',
|
||||
$description,
|
||||
'',
|
||||
100,
|
||||
100,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[4][0] = __('Position X');
|
||||
$table->data[4][1] = html_print_input_text('pos_x', $offset_x, '', 2, 10, true);
|
||||
|
@ -352,7 +378,23 @@ if ($not_found) {
|
|||
$table->data[6][1] = html_print_input_text('scale_z', $scale_z, '', 2, 10, true).ui_print_help_tip(__('Introduce zoom level. 1 = Highest resolution. Figures may include decimals'), true);
|
||||
|
||||
$table->data['source'][0] = __('Source');
|
||||
$table->data['source'][1] = html_print_radio_button('source', 'group', __('Group'), $source, true, $disabled_source).html_print_radio_button('source', 'recon_task', __('Discovery task'), $source, true, $disabled_source).html_print_radio_button('source', 'ip_mask', __('CIDR IP mask'), $source, true, $disabled_source);
|
||||
$table->data['source'][1] = html_print_select(
|
||||
[
|
||||
'group' => __('Group'),
|
||||
'recon_task' => __('Discovery task'),
|
||||
'ip_mask' => __('CIDR IP mask'),
|
||||
],
|
||||
'source',
|
||||
$source,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabled_source
|
||||
);
|
||||
|
||||
$table->data['source_data_recon_task'][0] = __('Source from recon task');
|
||||
$table->data['source_data_recon_task'][0] .= ui_print_help_tip(
|
||||
|
@ -378,18 +420,28 @@ if ($not_found) {
|
|||
);
|
||||
|
||||
$table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask');
|
||||
$table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source);
|
||||
$table->data['source_data_ip_mask'][1] = html_print_textarea(
|
||||
'ip_mask',
|
||||
3,
|
||||
5,
|
||||
$ip_mask,
|
||||
'style="width: 238px"',
|
||||
true,
|
||||
'',
|
||||
$disabled_source
|
||||
);
|
||||
|
||||
$table->data['source_data_group'][0] = __('Source group');
|
||||
$table->data['source_data_group'][1] = '<div class="w250px">'.html_print_select_groups(
|
||||
$config['id_user'],
|
||||
'AR',
|
||||
true,
|
||||
'id_group',
|
||||
$id_group,
|
||||
'id_group[]',
|
||||
explode(',', $id_group),
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true
|
||||
).'</div>';
|
||||
$table->data['source_data_group'][1] .= html_print_image(
|
||||
|
@ -498,9 +550,10 @@ if ($not_found) {
|
|||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function() {
|
||||
$("input[name='source']").on('change', function() {
|
||||
var source = $("input[name='source']:checked").val();
|
||||
|
||||
$("#map_loading").hide();
|
||||
$("#source").change(function() {
|
||||
const source = $(this).val();
|
||||
|
||||
if (source == 'recon_task') {
|
||||
$("#form_editor-source_data_ip_mask")
|
||||
.css('display', 'none');
|
||||
|
@ -510,7 +563,6 @@ $(document).ready(function() {
|
|||
.css('display', 'none');
|
||||
$("#form_editor-source_data_recon_task")
|
||||
.css('display', '');
|
||||
|
||||
}
|
||||
else if (source == 'ip_mask') {
|
||||
$("#form_editor-source_data_ip_mask")
|
||||
|
@ -565,7 +617,7 @@ $(document).ready(function() {
|
|||
$("#form_editor-kval")
|
||||
.css('display', 'none');
|
||||
$("#form_editor-nodesep")
|
||||
.css('display', '');
|
||||
.css('display', 'none');
|
||||
}
|
||||
else if (method == 'neato') {
|
||||
$("#form_editor-ranksep")
|
||||
|
@ -598,17 +650,15 @@ $(document).ready(function() {
|
|||
.css('display', '');
|
||||
}
|
||||
});
|
||||
|
||||
$("input[name='source']").trigger("change");
|
||||
|
||||
$("#source").trigger("change");
|
||||
$("#method").trigger("change");
|
||||
|
||||
|
||||
// Control if id_group has changed.
|
||||
var id_group_old = $("#id_group").val();
|
||||
var id_group_changed = false;
|
||||
|
||||
$("#id_group").on('change',{id_group_old: id_group_old}, function () {
|
||||
|
||||
var id_group_new = $("#id_group").val();
|
||||
if((id_group_old != id_group_new) && (update_networkmap == 1 )) {
|
||||
id_group_changed = true;
|
||||
|
@ -625,7 +675,7 @@ $(document).ready(function() {
|
|||
update_networkmap = $("input[name='update_networkmap']").val();
|
||||
|
||||
$( "#submit-crt" ).click(function( event ) {
|
||||
|
||||
$("#map_loading").show();
|
||||
if(update_networkmap == 1 && id_group_changed === true) {
|
||||
confirmDialog({
|
||||
title: '<?php echo __('Are you sure?'); ?>',
|
||||
|
@ -643,7 +693,6 @@ $(document).ready(function() {
|
|||
})
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("#refresh_time_units").trigger("change");
|
||||
|
|
|
@ -182,7 +182,7 @@ if ($save_empty_networkmap === true) {
|
|||
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
$values['id_group'] = implode(',', $id_group);
|
||||
|
||||
$values['generation_method'] = 4;
|
||||
|
||||
|
@ -237,7 +237,7 @@ if ($new_networkmap || $save_networkmap) {
|
|||
}
|
||||
|
||||
if ($save_networkmap) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
$id_group = get_parameter('id_group', 0);
|
||||
$id_group_map = (int) get_parameter('id_group_map', 0);
|
||||
|
||||
|
||||
|
@ -292,7 +292,7 @@ if ($new_networkmap || $save_networkmap) {
|
|||
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
$values['id_group'] = implode(',', $id_group);
|
||||
$values['source_period'] = 60;
|
||||
$values['width'] = $width;
|
||||
$values['height'] = $height;
|
||||
|
@ -333,7 +333,7 @@ if ($new_networkmap || $save_networkmap) {
|
|||
|
||||
if ($source == 'group') {
|
||||
$values['source'] = 0;
|
||||
$values['source_data'] = $id_group;
|
||||
$values['source_data'] = implode(',', $id_group);
|
||||
} else if ($source == 'recon_task') {
|
||||
$values['source'] = 1;
|
||||
$values['source_data'] = $recon_task_id;
|
||||
|
@ -444,7 +444,7 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
|||
}
|
||||
|
||||
if ($update_networkmap) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
$id_group = get_parameter('id_group', 0);
|
||||
// Get id of old group source to check changes.
|
||||
$id_group_old = db_get_value('id_group', 'tmap', 'id', $id);
|
||||
|
||||
|
@ -480,7 +480,7 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
|||
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
$values['id_group'] = implode(',', $id_group);
|
||||
$values['id_group_map'] = $id_group_map;
|
||||
|
||||
$description = get_parameter('description', '');
|
||||
|
|
|
@ -171,7 +171,23 @@ if (is_ajax() === true) {
|
|||
$table->data[6][1] = html_print_input_text('scale_z', $map_filter['z_dash'], '', 2, 10, true).ui_print_help_tip(__('Introduce zoom level. 1 = Highest resolution. Figures may include decimals'), true);
|
||||
|
||||
$table->data['source'][0] = __('Source');
|
||||
$table->data['source'][1] = html_print_radio_button('source', 'group', __('Group'), $source, true).html_print_radio_button('source', 'recon_task', __('Discovery task'), $source, true).html_print_radio_button('source', 'ip_mask', __('CIDR IP mask'), $source, true);
|
||||
$table->data['source'][1] = html_print_select(
|
||||
[
|
||||
'group' => __('Group'),
|
||||
'recon_task' => __('Discovery task'),
|
||||
'ip_mask' => __('CIDR IP mask'),
|
||||
],
|
||||
'source',
|
||||
$source,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabled_source
|
||||
);
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
$sql = sprintf(
|
||||
|
@ -221,7 +237,16 @@ if (is_ajax() === true) {
|
|||
);
|
||||
|
||||
$table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask');
|
||||
$table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $map_info['source_data'], '', 20, 255, true);
|
||||
$table->data['source_data_ip_mask'][1] = html_print_textarea(
|
||||
'ip_mask',
|
||||
3,
|
||||
5,
|
||||
$map_info['source_data'],
|
||||
'',
|
||||
true,
|
||||
'',
|
||||
$disabled_source
|
||||
);
|
||||
|
||||
$dont_show_subgroups = 0;
|
||||
if (isset($map_filter['dont_show_subgroups'])) {
|
||||
|
@ -296,9 +321,9 @@ if (is_ajax() === true) {
|
|||
$map_form .= html_print_table($table, true);
|
||||
|
||||
$map_form .= '<script>
|
||||
$("input[name=\'source\']").on(\'change\', function() {
|
||||
var source = $("input[name=\'source\']:checked").val();
|
||||
|
||||
$("#source").change(function() {
|
||||
const source = $(this).val();
|
||||
|
||||
if (source == \'recon_task\') {
|
||||
$("#form_editor-source_data_ip_mask")
|
||||
.css(\'display\', \'none\');
|
||||
|
@ -388,8 +413,8 @@ if (is_ajax() === true) {
|
|||
.css(\'display\', \'\');
|
||||
}
|
||||
});
|
||||
|
||||
$("input[name=\'source\']").trigger("change");
|
||||
|
||||
$("#source").trigger("change");
|
||||
$("#method").trigger("change");
|
||||
</script>';
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ if (! defined('METACONSOLE')) {
|
|||
}
|
||||
|
||||
$recursion = get_parameter_switch('recursion', false);
|
||||
|
||||
if ($recursion === false) {
|
||||
$recursion = get_parameter('recursion', false);
|
||||
}
|
||||
|
@ -132,7 +133,7 @@ $refr = (int) get_parameter('refr', 0);
|
|||
$offset = (int) get_parameter('offset', 0);
|
||||
$status = (int) get_parameter('status', 4);
|
||||
$modulegroup = (int) get_parameter('modulegroup', -1);
|
||||
$tag_filter = (int) get_parameter('tag_filter', 0);
|
||||
$tag_filter = get_parameter('tag_filter', [0]);
|
||||
$min_hours_status = (string) get_parameter('min_hours_status', '');
|
||||
// Sort functionality.
|
||||
$sortField = get_parameter('sort_field');
|
||||
|
@ -161,7 +162,7 @@ $autosearch = false;
|
|||
// It is validated if it receives parameters different from those it has by default.
|
||||
if ($ag_freestring !== '' || $moduletype !== '' || $datatype !== ''
|
||||
|| $ag_modulename !== '' || $refr !== 0 || $offset !== 0 || $status !== 4
|
||||
|| $modulegroup !== -1 || $tag_filter !== 0 || $sortField !== ''
|
||||
|| $modulegroup !== -1 || (bool) array_filter($tag_filter) !== false || $sortField !== ''
|
||||
|| $sort !== 'none' || $id_module !== 0 || $module_option !== 1
|
||||
|| $min_hours_status !== ''
|
||||
) {
|
||||
|
@ -220,6 +221,72 @@ if (is_numeric($ag_group)) {
|
|||
$id_ag_group = db_get_value('id_grupo', 'tgrupo', 'nombre', $ag_group);
|
||||
}
|
||||
|
||||
$load_filter_id = (int) get_parameter('filter_id', 0);
|
||||
|
||||
if ($load_filter_id > 0) {
|
||||
$user_groups_fl = users_get_groups(
|
||||
$config['id_user'],
|
||||
'AR',
|
||||
users_can_manage_group_all(),
|
||||
true
|
||||
);
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT id_filter, id_name
|
||||
FROM tmonitor_filter
|
||||
WHERE id_filter = %d AND id_group_filter IN (%s)',
|
||||
$load_filter_id,
|
||||
implode(',', array_keys($user_groups_fl))
|
||||
);
|
||||
|
||||
$loaded_filter = db_get_row_sql($sql);
|
||||
}
|
||||
|
||||
if ($loaded_filter['id_filter'] > 0) {
|
||||
$query_filter['id_filter'] = $load_filter_id;
|
||||
$filter = db_get_row_filter('tmonitor_filter', $query_filter, false);
|
||||
if ($filter !== false) {
|
||||
$ag_group = $filter['ag_group'];
|
||||
$recursion = $filter['recursion'];
|
||||
$status = $filter['status'];
|
||||
$modulegroup = $filter['modulegroup'];
|
||||
$ag_modulename = $filter['ag_modulename'];
|
||||
$ag_freestring = $filter['ag_freestring'];
|
||||
$tag_filter = $filter['tag_filter'];
|
||||
$moduletype = $filter['moduletype'];
|
||||
$module_option = $filter['module_option'];
|
||||
$min_hours_status = $filter['min_hours_status'];
|
||||
$datatype = $filter['datatype'];
|
||||
$not_condition = $filter['not_condition'];
|
||||
$ag_custom_fields = $filter['ag_custom_fields'];
|
||||
|
||||
if ($not_condition === 'false') {
|
||||
$not_condition = '';
|
||||
}
|
||||
|
||||
if ($not_condition !== '') {
|
||||
$is_none = 'None';
|
||||
$not_condition = 'NOT';
|
||||
}
|
||||
|
||||
if ($not_condition !== '') {
|
||||
$condition_query = '!=';
|
||||
}
|
||||
|
||||
if (is_array($tag_filter) === false) {
|
||||
$tag_filter = json_decode($tag_filter, true);
|
||||
}
|
||||
|
||||
if ($tag_filter === '') {
|
||||
$tag_filter = [0 => 0];
|
||||
}
|
||||
|
||||
if (is_array($ag_custom_fields) === false) {
|
||||
$ag_custom_fields = json_decode(io_safe_output($ag_custom_fields), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Agent group selector.
|
||||
if (!$is_metaconsole) {
|
||||
if ($ag_group > 0 && check_acl($config['id_user'], $ag_group, 'AR')) {
|
||||
|
@ -370,19 +437,21 @@ if (!empty($ag_custom_fields)) {
|
|||
}
|
||||
}
|
||||
|
||||
$all_tags = in_array(0, $tag_filter);
|
||||
|
||||
// Filter by tag.
|
||||
if ($tag_filter !== 0) {
|
||||
if ($is_metaconsole) {
|
||||
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
|
||||
SELECT ttag_module.id_agente_modulo
|
||||
FROM ttag_module
|
||||
WHERE ttag_module.id_tag '.$not_condition.' IN ('.$tag_filter.'))';
|
||||
} else {
|
||||
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
|
||||
SELECT ttag_module.id_agente_modulo
|
||||
FROM ttag_module
|
||||
WHERE ttag_module.id_tag '.$condition_query.' '.$tag_filter.')';
|
||||
if ($all_tags === false) {
|
||||
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
|
||||
SELECT ttag_module.id_agente_modulo
|
||||
FROM ttag_module
|
||||
WHERE 1=1';
|
||||
|
||||
if ($all_tags === false) {
|
||||
$sql_conditions .= ' AND ttag_module.id_tag '.$not_condition.' IN ('.implode(',', $tag_filter).'))';
|
||||
}
|
||||
} else if ($not_condition === 'NOT') {
|
||||
// Match nothing if not condition has been selected along with all tags selected (none).
|
||||
$sql_conditions .= ' AND 0=0';
|
||||
}
|
||||
|
||||
|
||||
|
@ -391,17 +460,17 @@ if ($tag_filter !== 0) {
|
|||
$sql_conditions_tags = '';
|
||||
|
||||
if (!users_is_admin()) {
|
||||
$sql_conditions_tags = tags_get_acl_tags(
|
||||
$config['id_user'],
|
||||
($recursion) ? $all_groups : $ag_group,
|
||||
'AR',
|
||||
'module_condition',
|
||||
'AND',
|
||||
'tagente_modulo',
|
||||
true,
|
||||
[],
|
||||
false
|
||||
);
|
||||
$sql_conditions_tags = tags_get_acl_tags(
|
||||
$config['id_user'],
|
||||
($recursion) ? array_flip($all_groups) : $ag_group,
|
||||
'AR',
|
||||
'module_condition',
|
||||
'AND',
|
||||
'tagente_modulo',
|
||||
true,
|
||||
[],
|
||||
false
|
||||
);
|
||||
|
||||
if (is_numeric($sql_conditions_tags)) {
|
||||
$sql_conditions_tags = ' AND 1 = 0';
|
||||
|
@ -475,13 +544,14 @@ $table->data[0][1] .= html_print_select_groups(
|
|||
false,
|
||||
$not_condition
|
||||
);
|
||||
|
||||
$table->data[0][1] .= '</div><div>';
|
||||
$table->data[0][1] .= html_print_input(
|
||||
[
|
||||
'type' => 'checkbox',
|
||||
'name' => 'recursion',
|
||||
'return' => true,
|
||||
'checked' => $recursion,
|
||||
'checked' => ($recursion === true || $recursion === 'true' || $recursion === '1') ? 'checked' : false,
|
||||
'value' => 1,
|
||||
]
|
||||
);
|
||||
|
@ -556,13 +626,13 @@ if (empty($tags)) {
|
|||
} else {
|
||||
$table->data[1][5] = html_print_select(
|
||||
$tags,
|
||||
'tag_filter',
|
||||
'tag_filter[]',
|
||||
$tag_filter,
|
||||
'',
|
||||
__($is_none),
|
||||
'',
|
||||
__('All'),
|
||||
0,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
|
@ -666,7 +736,6 @@ $table2->data[1][0] = '<span id="datatypetittle"';
|
|||
$table2->data[1][0] .= '>'.__('Data type').'</span>';
|
||||
$table2->data[1][1] .= '<div id="datatypebox">';
|
||||
|
||||
|
||||
switch ($moduletype) {
|
||||
case 1:
|
||||
$sql = sprintf(
|
||||
|
@ -771,7 +840,7 @@ $table2->data[1][3] = html_print_div(
|
|||
'type' => 'switch',
|
||||
'name' => 'not_condition',
|
||||
'return' => false,
|
||||
'checked' => $check_not_condition,
|
||||
'checked' => ($check_not_condition === true || $check_not_condition === 'true' || $check_not_condition === '1') ? 'checked' : false,
|
||||
'value' => 'NOT',
|
||||
'id' => 'not_condition_switch',
|
||||
'onclick' => 'changeNotConditionStatus(this)',
|
||||
|
@ -855,9 +924,30 @@ $table->data[3][0] = ui_toggle(
|
|||
'white_table_graph'
|
||||
);
|
||||
|
||||
$table->colspan[4][0] = 7;
|
||||
$table->colspan[4][0] = 2;
|
||||
$table->cellstyle[4][0] = 'padding-top: 0px;';
|
||||
$table->data[4][0] = html_print_submit_button(
|
||||
$table->data[4][0] = html_print_button(
|
||||
__('Load filter'),
|
||||
'load-filter',
|
||||
false,
|
||||
'',
|
||||
'class="float-left margin-right-2 sub config"',
|
||||
true
|
||||
);
|
||||
|
||||
$table->cellstyle[4][0] .= 'padding-top: 0px;';
|
||||
$table->data[4][0] .= html_print_button(
|
||||
__('Save filter'),
|
||||
'save-filter',
|
||||
false,
|
||||
'',
|
||||
'class="float-left margin-right-2 sub wand"',
|
||||
true
|
||||
);
|
||||
|
||||
$table->colspan[4][2] = 5;
|
||||
$table->cellstyle[4][2] = 'padding-top: 0px;';
|
||||
$table->data[4][2] = html_print_submit_button(
|
||||
__('Show'),
|
||||
'uptbutton',
|
||||
false,
|
||||
|
@ -2017,16 +2107,76 @@ if (!empty($result)) {
|
|||
}
|
||||
|
||||
|
||||
// End Build List Result.
|
||||
echo "<div id='monitor_details_window'></div>";
|
||||
// End Build List Result.
|
||||
echo "<div id='monitor_details_window'></div>";
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
// Load filter div for dialog.
|
||||
echo '<div id="load-modal-filter" style="display:none"></div>';
|
||||
echo '<div id="save-modal-filter" style="display:none"></div>';
|
||||
|
||||
ui_require_javascript_file('pandora_modules');
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
||||
ui_require_javascript_file('pandora_modules');
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
var loading = 0;
|
||||
|
||||
/* Filter management */
|
||||
$('#button-load-filter').click(function (event) {
|
||||
// event.preventDefault();
|
||||
|
||||
if($('#load-filter-select').length) {
|
||||
$('#load-filter-select').dialog();
|
||||
} else {
|
||||
if (loading == 0) {
|
||||
loading = 1
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
|
||||
data: {
|
||||
page: 'include/ajax/module',
|
||||
load_filter_modal: 1
|
||||
},
|
||||
success: function (data){
|
||||
$('#load-modal-filter')
|
||||
.empty()
|
||||
.html(data);
|
||||
|
||||
loading = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#button-save-filter').click(function (){
|
||||
// event.preventDefault();
|
||||
if($('#save-filter-select').length) {
|
||||
$('#save-filter-select').dialog();
|
||||
} else {
|
||||
if (loading == 0) {
|
||||
loading = 1
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
|
||||
data: {
|
||||
page: 'include/ajax/module',
|
||||
save_filter_modal: 1,
|
||||
current_filter: $('#latest_filter_id').val()
|
||||
},
|
||||
success: function (data){
|
||||
$('#save-modal-filter')
|
||||
.empty()
|
||||
.html(data);
|
||||
loading = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(!document.getElementById('not_condition_switch').checked){
|
||||
document.getElementById("select2-ag_group-container").innerHTML = "None";
|
||||
|
||||
|
@ -2149,12 +2299,10 @@ function changeNotConditionStatus() {
|
|||
$("#modulegroup").select2().val(["None"]).trigger("change");
|
||||
$("#tag_filter").select2().val(["None"]).trigger("change");
|
||||
|
||||
|
||||
document.getElementById("select2-status-container").innerHTML = "None";
|
||||
document.getElementById("select2-moduletype-container").innerHTML = "None";
|
||||
document.getElementById("select2-ag_group-container").innerHTML = "None";
|
||||
document.getElementById("select2-modulegroup-container").innerHTML = "None";
|
||||
document.getElementById("select2-tag_filter-container").innerHTML = "None";
|
||||
|
||||
}else {
|
||||
$('select[name=datatypebox] > option:first-child').val('All');
|
||||
|
@ -2176,7 +2324,6 @@ function changeNotConditionStatus() {
|
|||
document.getElementById("select2-moduletype-container").innerHTML = "All";
|
||||
document.getElementById("select2-ag_group-container").innerHTML = "All";
|
||||
document.getElementById("select2-modulegroup-container").innerHTML = "All";
|
||||
document.getElementById("select2-tag_filter-container").innerHTML = "All";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1473,9 +1473,11 @@ if ($tab == 'inventory') {
|
|||
}
|
||||
|
||||
// Collection.
|
||||
$collectiontab = enterprise_hook('collection_tab');
|
||||
if ($collectiontab == -1) {
|
||||
$collectiontab = '';
|
||||
if ((int) $config['license_nms'] !== 1) {
|
||||
$collectiontab = enterprise_hook('collection_tab');
|
||||
if ($collectiontab == -1) {
|
||||
$collectiontab = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.768
|
||||
%define release 230206
|
||||
%define version 7.0NG.769
|
||||
%define release 1
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -26,7 +26,7 @@ BuildRoot: %{_tmppath}/%{name}
|
|||
BuildArch: noarch
|
||||
AutoReq: 0
|
||||
Requires: %{httpd_name} >= 2.0.0
|
||||
Requires: mod_php >= 7.0
|
||||
Requires: php >= 8.0
|
||||
Requires: php-gd, php-ldap, php-snmp, php-session, php-gettext
|
||||
Requires: php-mysqlnd, php-mbstring, php-zip, php-zlib, php-curl
|
||||
Requires: xorg-x11-fonts-75dpi, xorg-x11-fonts-misc, php-pecl-zip
|
||||
|
@ -77,6 +77,11 @@ echo " /etc/init.d/pandora_websocket_engine start"
|
|||
#
|
||||
if [ -f %{prefix}/pandora_console/include/config.php ] ; then
|
||||
mv %{prefix}/pandora_console/install.php %{prefix}/pandora_console/install.done
|
||||
|
||||
# Upgrading MR.
|
||||
echo "Updating the database schema."
|
||||
/usr/bin/php %{prefix}/pandora_console/godmode/um_client/updateMR.php 2>/dev/null
|
||||
|
||||
else
|
||||
echo "Please, now, point your browser to http://your_IP_address/pandora_console/install.php and follow all the steps described on it."
|
||||
fi
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.768
|
||||
%define release 230206
|
||||
%define version 7.0NG.769
|
||||
%define release 1
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -57,11 +57,6 @@ install -m 0644 pandora_console_logrotate_centos $RPM_BUILD_ROOT%{_sysconfdir}/l
|
|||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%post
|
||||
# Upgrading.
|
||||
if [ "$1" -eq "1" ]; then
|
||||
echo "Updating the database schema."
|
||||
/usr/bin/php %{prefix}/pandora_console/godmode/um_client/updateMR.php 2>/dev/null
|
||||
fi
|
||||
|
||||
# Install pandora_websocket_engine service.
|
||||
cp -pf %{prefix}/pandora_console/pandora_websocket_engine /etc/init.d/
|
||||
|
@ -76,6 +71,11 @@ echo " /etc/init.d/pandora_websocket_engine start"
|
|||
#
|
||||
if [ -f %{prefix}/pandora_console/include/config.php ] ; then
|
||||
mv %{prefix}/pandora_console/install.php %{prefix}/pandora_console/install.done
|
||||
|
||||
# Upgrading MR.
|
||||
echo "Updating the database schema."
|
||||
/usr/bin/php %{prefix}/pandora_console/godmode/um_client/updateMR.php 2>/dev/null
|
||||
|
||||
else
|
||||
echo "Please, now, point your browser to http://your_IP_address/pandora_console/install.php and follow all the steps described on it."
|
||||
fi
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.768
|
||||
%define release 230206
|
||||
%define version 7.0NG.769
|
||||
%define release 1
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -29,7 +29,7 @@ BuildArch: noarch
|
|||
AutoReq: 0
|
||||
Requires: apache2
|
||||
Requires: apache2-mod_php7
|
||||
Requires: php >= 7.0
|
||||
Requires: php >= 8.0
|
||||
Requires: php-gd, php-snmp, php-json, php-gettext
|
||||
Requires: php-mysqlnd, php-ldap, php-mbstring, php
|
||||
Requires: graphviz, xorg-x11-fonts-core, graphviz-gd
|
||||
|
@ -58,11 +58,6 @@ fi
|
|||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%post
|
||||
# Upgrading.
|
||||
if [ "$1" -eq "1" ]; then
|
||||
echo "Updating the database schema."
|
||||
/usr/bin/php %{prefix}/pandora_console/godmode/um_client/updateMR.php 2>/dev/null
|
||||
fi
|
||||
|
||||
# Install pandora_websocket_engine service.
|
||||
cp -pf %{prefix}/pandora_console/pandora_websocket_engine /etc/init.d/
|
||||
|
@ -77,6 +72,11 @@ echo " /etc/init.d/pandora_websocket_engine start"
|
|||
#
|
||||
if [ -f %{prefix}/pandora_console/include/config.php ] ; then
|
||||
mv %{prefix}/pandora_console/install.php %{prefix}/pandora_console/install.done
|
||||
|
||||
# Upgrading MR.
|
||||
echo "Updating the database schema."
|
||||
/usr/bin/php %{prefix}/pandora_console/godmode/um_client/updateMR.php 2>/dev/null
|
||||
|
||||
else
|
||||
echo "Please, now, point your browser to http://your_IP_address/pandora_console/install.php and follow all the steps described on it."
|
||||
fi
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.768"
|
||||
PI_VERSION="7.0NG.769"
|
||||
FORCE=0
|
||||
DESTDIR=""
|
||||
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
|
|
|
@ -2323,7 +2323,7 @@ CREATE TABLE IF NOT EXISTS `tsessions_php` (
|
|||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tmap` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_group` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`id_group` TEXT NOT NULL DEFAULT '',
|
||||
`id_user` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`type` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`subtype` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
@ -4154,3 +4154,26 @@ CREATE TABLE IF NOT EXISTS `tbackup` (
|
|||
`filepath` VARCHAR(512) DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmonitor_filter`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tmonitor_filter` (
|
||||
`id_filter` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_name` VARCHAR(600) NOT NULL,
|
||||
`id_group_filter` INT NOT NULL DEFAULT 0,
|
||||
`ag_group` INT NOT NULL DEFAULT 0,
|
||||
`recursion` TEXT,
|
||||
`status` INT NOT NULL DEFAULT -1,
|
||||
`ag_modulename` TEXT,
|
||||
`ag_freestring` TEXT,
|
||||
`tag_filter` TEXT,
|
||||
`moduletype` TEXT,
|
||||
`module_option` INT DEFAULT 1,
|
||||
`modulegroup` INT NOT NULL DEFAULT -1,
|
||||
`min_hours_status` TEXT,
|
||||
`datatype` TEXT,
|
||||
`not_condition` TEXT,
|
||||
`ag_custom_fields` TEXT,
|
||||
PRIMARY KEY (`id_filter`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
|
|
@ -112,10 +112,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||
('custom_report_front_header', ''),
|
||||
('custom_report_front_footer', ''),
|
||||
('MR', 60),
|
||||
('MR', 61),
|
||||
('identification_reminder', 1),
|
||||
('identification_reminder_timestamp', 0),
|
||||
('current_package', 768),
|
||||
('current_package', 769),
|
||||
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.00097656250000":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'),
|
||||
('custom_docs_logo', 'default_docs.png'),
|
||||
('custom_support_logo', 'default_support.png'),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.768-230206
|
||||
Version: 7.0NG.769
|
||||
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.768-230206"
|
||||
pandora_version="7.0NG.769"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -1,15 +1,8 @@
|
|||
#!/usr/bin/perl
|
||||
##########################################################################
|
||||
# pandora_exec
|
||||
################################################################################
|
||||
# pandora_exec - Execute a command with a time limit.
|
||||
#
|
||||
# Executes the given command and prints its output to stdout. If the
|
||||
# execution times out or the command does not exist nothing is printed
|
||||
# to stdout. This is part of Pandora FMS Plugin server, do not delete!.
|
||||
#
|
||||
# Usage: pandora_exec <timeout in seconds> <command>
|
||||
##########################################################################
|
||||
# Copyright (c) 2008 Ramon Novoa, rnovoa@gmail.com
|
||||
# (c) 2008 Artica Soluciones Tecnologicas S.L
|
||||
# Copyright (c) 2008-2023 Artica PFMS S.L.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -22,41 +15,41 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##########################################################################
|
||||
|
||||
################################################################################
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX qw(WEXITSTATUS WIFEXITED);
|
||||
|
||||
# Check command line parameters
|
||||
# Check command line arguments.
|
||||
if ($#ARGV < 1) {
|
||||
print("Usage: $0 <timeout in seconds> <command>\n");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my @opts = @ARGV;
|
||||
my $timeout = shift(@opts);
|
||||
my $command;
|
||||
foreach my $arg (@opts) {
|
||||
$command .= $^O ne 'MSWin32' ? quotemeta ($arg) . ' ' : '"' . $arg . '" ';
|
||||
}
|
||||
chomp ($command);
|
||||
my $output = '';
|
||||
my $ReturnCode = 0;
|
||||
my $command = ($0 =~ m/_agent_exec$/) ? # For backward compatibility with pandora_agent.
|
||||
join(' ', @opts) :
|
||||
join(' ', map { quotemeta($_) } @opts);
|
||||
|
||||
# Execute the command
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "alarm\n" };
|
||||
alarm $timeout;
|
||||
|
||||
$output = `$command`;
|
||||
$ReturnCode = ($? >> 8) & 0xff;
|
||||
alarm 0;
|
||||
};
|
||||
|
||||
# Timeout
|
||||
if ($@ eq "alarm\n") {
|
||||
exit 3;
|
||||
# Fork:
|
||||
# * The child will run the command.
|
||||
# * The parent will timeout if needed
|
||||
# and exit with the appropriate exit status.
|
||||
my $pid = fork();
|
||||
if ($pid == 0) {
|
||||
setpgrp();
|
||||
exec($command);
|
||||
} else {
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { kill(9, -$pid); exit 1; };
|
||||
alarm $timeout;
|
||||
waitpid($pid, 0);
|
||||
alarm 0;
|
||||
if (WIFEXITED(${^CHILD_ERROR_NATIVE})) {
|
||||
exit WEXITSTATUS(${^CHILD_ERROR_NATIVE});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
print $output;
|
||||
|
||||
exit $ReturnCode;
|
||||
exit 1;
|
||||
|
|
|
@ -387,112 +387,114 @@ sub pandora_server_tasks ($) {
|
|||
my $counter = 0;
|
||||
my $first_run = 1;
|
||||
while ($THRRUN == 1) {
|
||||
if (pandora_is_master($pa_config) == 1) {
|
||||
eval {
|
||||
if (pandora_is_master($pa_config) == 1) {
|
||||
|
||||
# TASKS EXECUTED ONCE
|
||||
# -------------------
|
||||
if ($first_run == 1) {
|
||||
$first_run = 0;
|
||||
# TASKS EXECUTED ONCE
|
||||
# -------------------
|
||||
if ($first_run == 1) {
|
||||
$first_run = 0;
|
||||
|
||||
# Update the agent cache.
|
||||
enterprise_hook('update_agent_cache', [\%Config]);
|
||||
}
|
||||
|
||||
# TASKS EXECUTED EVERY 5 SECONDS (Low latency tasks)
|
||||
# --------------------------------------------------
|
||||
if (($counter % 5) == 0) {
|
||||
|
||||
# Update forced alerts
|
||||
pandora_exec_forced_alerts ($pa_config, $dbh);
|
||||
|
||||
my @agents = get_db_rows ($dbh, 'SELECT id_agente, update_alert_count FROM tagente WHERE update_alert_count=1');
|
||||
foreach my $agent (@agents) {
|
||||
if ($agent->{'update_alert_count'} == 1) {
|
||||
pandora_update_agent_alert_count ($pa_config, $dbh, $agent->{'id_agente'});
|
||||
}
|
||||
# Update the agent cache.
|
||||
enterprise_hook('update_agent_cache', [\%Config]);
|
||||
}
|
||||
}
|
||||
|
||||
# TASKS EXECUTED EVERY 30 SECONDS (Mid latency tasks)
|
||||
# ---------------------------------------------------
|
||||
if (($counter % 30) == 0) {
|
||||
# TASKS EXECUTED EVERY 5 SECONDS (Low latency tasks)
|
||||
# --------------------------------------------------
|
||||
if (($counter % 5) == 0) {
|
||||
|
||||
# Update module status and fired alert counts
|
||||
my @agents = get_db_rows ($dbh, 'SELECT id_agente, nombre, update_module_count, update_secondary_groups FROM tagente WHERE (update_module_count=1 OR update_secondary_groups=1)');
|
||||
foreach my $agent (@agents) {
|
||||
logger ($pa_config, "Updating module status and fired alert counts for agent " . $agent->{'nombre'}, 10);
|
||||
# Update forced alerts
|
||||
pandora_exec_forced_alerts ($pa_config, $dbh);
|
||||
|
||||
if ($agent->{'update_module_count'} == 1) {
|
||||
pandora_update_agent_module_count ($pa_config, $dbh, $agent->{'id_agente'});
|
||||
}
|
||||
|
||||
if ($agent->{'update_secondary_groups'} == 1) {
|
||||
pandora_update_secondary_groups_cache ($pa_config, $dbh, $agent->{'id_agente'});
|
||||
my @agents = get_db_rows ($dbh, 'SELECT id_agente, update_alert_count FROM tagente WHERE update_alert_count=1');
|
||||
foreach my $agent (@agents) {
|
||||
if ($agent->{'update_alert_count'} == 1) {
|
||||
pandora_update_agent_alert_count ($pa_config, $dbh, $agent->{'id_agente'});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Keepalive module control.(very DB intensive, not run frecuently
|
||||
pandora_module_keep_alive_nd ($pa_config, $dbh);
|
||||
|
||||
# Set the status of unknown modules
|
||||
pandora_module_unknown ($pa_config, $dbh);
|
||||
|
||||
# Check if an autodisabled agent needs to be autodisable
|
||||
pandora_disable_autodisable_agents ($pa_config, $dbh);
|
||||
}
|
||||
|
||||
# TASKS EXECUTED EVERY 60 SECONDS (High latency tasks)
|
||||
# ----------------------------------------------------
|
||||
if (($counter % 60) == 0) {
|
||||
# Downtimes are executed only 30 x Server Threshold secs
|
||||
pandora_planned_downtime ($pa_config, $dbh);
|
||||
|
||||
# Realtime stats (Only master server!) - ( VERY HEAVY !)
|
||||
# Realtimestats == 1, generated by WEB Console, not by server!
|
||||
if (defined($pa_config->{"realtimestats"}) && $pa_config->{"realtimestats"} == 0){
|
||||
# TASKS EXECUTED EVERY 30 SECONDS (Mid latency tasks)
|
||||
# ---------------------------------------------------
|
||||
if (($counter % 30) == 0) {
|
||||
|
||||
# Update module status and fired alert counts
|
||||
my @agents = get_db_rows ($dbh, 'SELECT id_agente, nombre, update_module_count, update_secondary_groups FROM tagente WHERE (update_module_count=1 OR update_secondary_groups=1)');
|
||||
foreach my $agent (@agents) {
|
||||
logger ($pa_config, "Updating module status and fired alert counts for agent " . $agent->{'nombre'}, 10);
|
||||
|
||||
if ($agent->{'update_module_count'} == 1) {
|
||||
pandora_update_agent_module_count ($pa_config, $dbh, $agent->{'id_agente'});
|
||||
}
|
||||
|
||||
if ($agent->{'update_secondary_groups'} == 1) {
|
||||
pandora_update_secondary_groups_cache ($pa_config, $dbh, $agent->{'id_agente'});
|
||||
}
|
||||
}
|
||||
|
||||
# Keepalive module control.(very DB intensive, not run frecuently
|
||||
pandora_module_keep_alive_nd ($pa_config, $dbh);
|
||||
|
||||
# Check if I need to refresh stats
|
||||
my $last_execution_stats = get_db_value ($dbh, "SELECT MAX(utimestamp) FROM tgroup_stat");
|
||||
if (!defined($last_execution_stats) || $last_execution_stats < (time() - $pa_config->{"stats_interval"})){
|
||||
pandora_group_statistics ($pa_config, $dbh);
|
||||
pandora_server_statistics ($pa_config, $dbh);
|
||||
}
|
||||
# Set the status of unknown modules
|
||||
pandora_module_unknown ($pa_config, $dbh);
|
||||
|
||||
# Check if an autodisabled agent needs to be autodisable
|
||||
pandora_disable_autodisable_agents ($pa_config, $dbh);
|
||||
}
|
||||
|
||||
# Check if snmptrapd is freeze.
|
||||
pandora_snmptrapd_still_working ($pa_config, $dbh);
|
||||
# TASKS EXECUTED EVERY 60 SECONDS (High latency tasks)
|
||||
# ----------------------------------------------------
|
||||
if (($counter % 60) == 0) {
|
||||
# Downtimes are executed only 30 x Server Threshold secs
|
||||
pandora_planned_downtime ($pa_config, $dbh);
|
||||
|
||||
# Realtime stats (Only master server!) - ( VERY HEAVY !)
|
||||
# Realtimestats == 1, generated by WEB Console, not by server!
|
||||
if (defined($pa_config->{"realtimestats"}) && $pa_config->{"realtimestats"} == 0){
|
||||
|
||||
# Check if I need to refresh stats
|
||||
my $last_execution_stats = get_db_value ($dbh, "SELECT MAX(utimestamp) FROM tgroup_stat");
|
||||
if (!defined($last_execution_stats) || $last_execution_stats < (time() - $pa_config->{"stats_interval"})){
|
||||
pandora_group_statistics ($pa_config, $dbh);
|
||||
pandora_server_statistics ($pa_config, $dbh);
|
||||
}
|
||||
}
|
||||
|
||||
# Check if snmptrapd is freeze.
|
||||
pandora_snmptrapd_still_working ($pa_config, $dbh);
|
||||
|
||||
# Event auto-expiry
|
||||
my $expiry_time = $pa_config->{"event_expiry_time"};
|
||||
my $expiry_window = $pa_config->{"event_expiry_window"};
|
||||
if ($expiry_time > 0 && $expiry_window > 0 && $expiry_window > $expiry_time) {
|
||||
my $time_ref = time ();
|
||||
my $expiry_limit = $time_ref - $expiry_time;
|
||||
my $expiry_window = $time_ref - $expiry_window;
|
||||
db_do ($dbh, 'UPDATE tevento SET estado=1, ack_utimestamp=? WHERE estado=0 AND utimestamp < ? AND utimestamp > ?', $time_ref, $expiry_limit, $expiry_window);
|
||||
# Event auto-expiry
|
||||
my $expiry_time = $pa_config->{"event_expiry_time"};
|
||||
my $expiry_window = $pa_config->{"event_expiry_window"};
|
||||
if ($expiry_time > 0 && $expiry_window > 0 && $expiry_window > $expiry_time) {
|
||||
my $time_ref = time ();
|
||||
my $expiry_limit = $time_ref - $expiry_time;
|
||||
my $expiry_window = $time_ref - $expiry_window;
|
||||
db_do ($dbh, 'UPDATE tevento SET estado=1, ack_utimestamp=? WHERE estado=0 AND utimestamp < ? AND utimestamp > ?', $time_ref, $expiry_limit, $expiry_window);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# COMMON TASKS (master and non-master)
|
||||
# ---------------------------------------------------------------
|
||||
if (($counter % 30) == 0) {
|
||||
# Update configuration options from the console.
|
||||
pandora_get_sharedconfig ($pa_config, $dbh);
|
||||
# COMMON TASKS (master and non-master)
|
||||
# ---------------------------------------------------------------
|
||||
if (($counter % 30) == 0) {
|
||||
# Update configuration options from the console.
|
||||
pandora_get_sharedconfig ($pa_config, $dbh);
|
||||
|
||||
# Rotate the log file.
|
||||
pandora_rotate_logfile($pa_config);
|
||||
|
||||
# Set event storm protection
|
||||
pandora_set_event_storm_protection (pandora_get_tconfig_token ($dbh, 'event_storm_protection', 0));
|
||||
}
|
||||
# Pandora self monitoring
|
||||
if (defined($pa_config->{"self_monitoring"})
|
||||
&& $pa_config->{"self_monitoring"} == 1
|
||||
&& !is_metaconsole($pa_config)
|
||||
&& $counter % $pa_config->{'self_monitoring_interval'} == 0) {
|
||||
pandora_self_monitoring ($pa_config, $dbh);
|
||||
}
|
||||
# Rotate the log file.
|
||||
pandora_rotate_logfile($pa_config);
|
||||
|
||||
# Set event storm protection
|
||||
pandora_set_event_storm_protection (pandora_get_tconfig_token ($dbh, 'event_storm_protection', 0));
|
||||
}
|
||||
# Pandora self monitoring
|
||||
if (defined($pa_config->{"self_monitoring"})
|
||||
&& $pa_config->{"self_monitoring"} == 1
|
||||
&& !is_metaconsole($pa_config)
|
||||
&& $counter % $pa_config->{'self_monitoring_interval'} == 0) {
|
||||
pandora_self_monitoring ($pa_config, $dbh);
|
||||
}
|
||||
};
|
||||
|
||||
# Avoid counter overflow
|
||||
if ($counter >= ~0){
|
||||
|
@ -799,7 +801,7 @@ sub main() {
|
|||
# Testing API url
|
||||
my $curl_execution = "'".$Config{'console_api_url'}."?op=get&op2=test&apipass=".$Config{"console_api_pass"}."&user=".$Config{"console_user"}."&pass=".$Config{"console_pass"}."'";
|
||||
# More than 30 secs is highly unrecommendated
|
||||
my $command = $Config{'plugin_exec'}.' 30 curl '.$curl_execution.' 2>/dev/null';
|
||||
my $command = $Config{'plugin_exec'}.' 30 curl --cookie-jar /tmp/cron-session-cookies '.$curl_execution.' 2>/dev/null';
|
||||
my $exe_testing_api = `$command`;
|
||||
my @res_testing_api = split(',', $exe_testing_api);
|
||||
if ( $res_testing_api[0] ne 'OK' ) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#############################################################################
|
||||
# Pandora FMS Server Parameters
|
||||
# Pandora FMS, the Flexible Monitoring System.
|
||||
# Version 7.0NG.768
|
||||
# Version 7.0NG.769
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -598,6 +598,9 @@ unknown_events 1
|
|||
# Time interval (as a multiple of the module interval) before a module becomes unknown. Twice the module's interval by default.
|
||||
#unknown_interval 2
|
||||
|
||||
# Number of unknown modules that will be processed per iteration.
|
||||
unknown_block_size 1000
|
||||
|
||||
# Maximum executing time of an alert (in seconds)
|
||||
global_alert_timeout 15
|
||||
|
||||
|
@ -732,4 +735,4 @@ tentacle_service_watchdog 1
|
|||
|
||||
# Enable (1) or disable (0) the parameter of mysql ssl certification (mysql_ssl_verify_server_cert) (enabled by default).
|
||||
|
||||
verify_mysql_ssl_cert 1
|
||||
verify_mysql_ssl_cert 1
|
||||
|
|
|
@ -45,8 +45,8 @@ our @EXPORT = qw(
|
|||
);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.768";
|
||||
my $pandora_build = "230206";
|
||||
my $pandora_version = "7.0NG.769";
|
||||
my $pandora_build = "230216";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -527,33 +527,35 @@ sub pandora_load_config {
|
|||
|
||||
$pa_config->{"unknown_updates"} = 0; # 7.0.718
|
||||
|
||||
$pa_config->{"provisioningserver"} = 1; # 7.0 720
|
||||
$pa_config->{"provisioningserver_threads"} = 1; # 7.0 720
|
||||
$pa_config->{"provisioning_cache_interval"} = 300; # 7.0 720
|
||||
$pa_config->{"provisioningserver"} = 1; # 7.0.720
|
||||
$pa_config->{"provisioningserver_threads"} = 1; # 7.0.720
|
||||
$pa_config->{"provisioning_cache_interval"} = 300; # 7.0.720
|
||||
|
||||
$pa_config->{"autoconfigure_agents"} = 1; # 7.0 725
|
||||
$pa_config->{"autoconfigure_agents_threshold"} = 300; #7.0 764
|
||||
$pa_config->{"autoconfigure_agents"} = 1; # 7.0.725
|
||||
$pa_config->{"autoconfigure_agents_threshold"} = 300; #7.0.764
|
||||
|
||||
$pa_config->{'snmp_extlog'} = ""; # 7.0 726
|
||||
$pa_config->{'snmp_extlog'} = ""; # 7.0.726
|
||||
|
||||
$pa_config->{"fsnmp"} = "/usr/bin/pandorafsnmp"; # 7.0 732
|
||||
$pa_config->{"fsnmp"} = "/usr/bin/pandorafsnmp"; # 7.0.732
|
||||
|
||||
$pa_config->{"event_inhibit_alerts"} = 0; # 7.0 737
|
||||
$pa_config->{"event_inhibit_alerts"} = 0; # 7.0.737
|
||||
|
||||
$pa_config->{"alertserver"} = 0; # 7.0 756
|
||||
$pa_config->{"alertserver_threads"} = 1; # 7.0 756
|
||||
$pa_config->{"alertserver_warn"} = 180; # 7.0 756
|
||||
$pa_config->{"alertserver_queue"} = 0; # 7.0 764
|
||||
$pa_config->{"alertserver"} = 0; # 7.0.756
|
||||
$pa_config->{"alertserver_threads"} = 1; # 7.0.756
|
||||
$pa_config->{"alertserver_warn"} = 180; # 7.0.756
|
||||
$pa_config->{"alertserver_queue"} = 0; # 7.0.764
|
||||
|
||||
$pa_config->{'ncmserver'} = 0; # 7.0 758
|
||||
$pa_config->{'ncmserver_threads'} = 1; # 7.0 758
|
||||
$pa_config->{'ncm_ssh_utility'} = '/usr/share/pandora_server/util/ncm_ssh_extension'; # 7.0 758
|
||||
$pa_config->{'ncmserver'} = 0; # 7.0.758
|
||||
$pa_config->{'ncmserver_threads'} = 1; # 7.0.758
|
||||
$pa_config->{'ncm_ssh_utility'} = '/usr/share/pandora_server/util/ncm_ssh_extension'; # 7.0.758
|
||||
|
||||
$pa_config->{"pandora_service_cmd"} = 'service pandora_server'; # 7.0 761
|
||||
$pa_config->{"tentacle_service_cmd"} = 'service tentacle_serverd'; # 7.0 761
|
||||
$pa_config->{"tentacle_service_watchdog"} = 1; # 7.0 761
|
||||
$pa_config->{"pandora_service_cmd"} = 'service pandora_server'; # 7.0.761
|
||||
$pa_config->{"tentacle_service_cmd"} = 'service tentacle_serverd'; # 7.0.761
|
||||
$pa_config->{"tentacle_service_watchdog"} = 1; # 7.0.761
|
||||
|
||||
$pa_config->{"dataserver_smart_queue"} = 0; # 765.
|
||||
$pa_config->{"dataserver_smart_queue"} = 0; # 7.0.765
|
||||
|
||||
$pa_config->{"unknown_block_size"} = 1000; # 7.0.769
|
||||
|
||||
# Check for UID0
|
||||
if ($pa_config->{"quiet"} != 0){
|
||||
|
|
|
@ -5628,16 +5628,26 @@ sub pandora_server_statistics ($$) {
|
|||
# Non-dataserver LAG calculation:
|
||||
if ($server->{"server_type"} != DATASERVER){
|
||||
|
||||
$lag_row = get_db_single_row ($dbh, "SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag
|
||||
FROM tagente_estado, tagente_modulo
|
||||
WHERE utimestamp > 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_modulo.id_tipo_modulo < 5
|
||||
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
AND current_interval > 0
|
||||
AND (UNIX_TIMESTAMP() - utimestamp) < ( current_interval * 10)
|
||||
AND running_by = ?
|
||||
AND (UNIX_TIMESTAMP() - utimestamp) > (current_interval * 1.1)", $server->{"id_server"});
|
||||
$lag_row = get_db_single_row ($dbh,
|
||||
"SELECT COUNT(tam.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - tae.last_execution_try - tae.current_interval) AS lag
|
||||
FROM (
|
||||
SELECT tagente_estado.last_execution_try, tagente_estado.current_interval, tagente_estado.id_agente_modulo
|
||||
FROM tagente_estado
|
||||
WHERE tagente_estado.current_interval > 0
|
||||
AND tagente_estado.last_execution_try > 0
|
||||
AND tagente_estado.running_by = ?
|
||||
) tae
|
||||
JOIN (
|
||||
SELECT tagente_modulo.id_agente_modulo, tagente_modulo.flag
|
||||
FROM tagente_modulo LEFT JOIN tagente
|
||||
ON tagente_modulo.id_agente = tagente.id_agente
|
||||
WHERE tagente.disabled = 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_modulo.id_tipo_modulo < 5
|
||||
) tam
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
WHERE (UNIX_TIMESTAMP() - tae.last_execution_try) < ( tae.current_interval * 10)
|
||||
AND (tam.flag = 1 OR (UNIX_TIMESTAMP() - tae.last_execution_try) > tae.current_interval)", $server->{"id_server"});
|
||||
}
|
||||
# Dataserver LAG calculation:
|
||||
else {
|
||||
|
@ -6009,10 +6019,6 @@ sub pandora_self_monitoring ($$) {
|
|||
$pandoradb = 1;
|
||||
}
|
||||
|
||||
my $start_performance = time;
|
||||
get_db_value($dbh, "SELECT COUNT(*) FROM tagente_datos");
|
||||
my $read_speed = int((time - $start_performance) * 1e6);
|
||||
|
||||
my $elasticsearch_perfomance = enterprise_hook("elasticsearch_performance", [$pa_config, $dbh]);
|
||||
|
||||
$xml_output .= $elasticsearch_perfomance if defined($elasticsearch_perfomance);
|
||||
|
@ -6059,13 +6065,6 @@ sub pandora_self_monitoring ($$) {
|
|||
$xml_output .=" </module>";
|
||||
}
|
||||
|
||||
$xml_output .=" <module>";
|
||||
$xml_output .=" <name>Execution_Time</name>";
|
||||
$xml_output .=" <type>generic_data</type>";
|
||||
$xml_output .=" <unit>us</unit>";
|
||||
$xml_output .=" <data>$read_speed</data>";
|
||||
$xml_output .=" </module>";
|
||||
|
||||
$xml_output .= "</agent_data>";
|
||||
|
||||
my $filename = $pa_config->{"incomingdir"}."/".$pa_config->{'servername'}.".self.".$utimestamp.".data";
|
||||
|
@ -6214,7 +6213,7 @@ sub pandora_module_unknown ($$) {
|
|||
')
|
||||
)
|
||||
AND tagente_estado.utimestamp != 0
|
||||
AND (tagente_estado.current_interval * ?) + tagente_estado.utimestamp < UNIX_TIMESTAMP()', $pa_config->{'unknown_interval'});
|
||||
AND (tagente_estado.current_interval * ?) + tagente_estado.utimestamp < UNIX_TIMESTAMP() LIMIT ?', $pa_config->{'unknown_interval'}, $pa_config->{'unknown_block_size'});
|
||||
|
||||
foreach my $module (@modules) {
|
||||
|
||||
|
|
|
@ -618,8 +618,13 @@ sub get_agent_status ($$$) {
|
|||
$module_status = 2;
|
||||
}
|
||||
elsif ($module_status != 2) {
|
||||
if ($m_status == 0) {
|
||||
$module_status = 0;
|
||||
if ($m_status == 3) {
|
||||
$module_status = 3;
|
||||
}
|
||||
elsif ($module_status != 3) {
|
||||
if ($m_status == 0) {
|
||||
$module_status = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -647,7 +652,7 @@ sub get_agent_status ($$$) {
|
|||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $module_status;
|
||||
}
|
||||
|
||||
|
|
|
@ -304,21 +304,22 @@ sub data_consumer ($$) {
|
|||
agent_unlock($pa_config, $agent_name);
|
||||
return;
|
||||
}
|
||||
|
||||
unlink ($file_name);
|
||||
if (defined($xml_data->{'server_name'})) {
|
||||
process_xml_server ($self->getConfig (), $file_name, $xml_data, $self->getDBH ());
|
||||
} elsif (defined($xml_data->{'connection_source'})) {
|
||||
enterprise_hook('process_xml_connections', [$self->getConfig (), $file_name, $xml_data, $self->getDBH ()]);
|
||||
} elsif (defined($xml_data->{'ipam_source'})) {
|
||||
enterprise_hook('process_xml_ipam', [$self->getConfig (), $file_name, $xml_data, $self->getDBH ()]);
|
||||
} elsif (defined($xml_data->{'network_matrix'})){
|
||||
process_xml_matrix_network(
|
||||
$self->getConfig(), $xml_data, $self->getDBH()
|
||||
);
|
||||
} else {
|
||||
process_xml_data ($self->getConfig (), $file_name, $xml_data, $self->getServerID (), $self->getDBH ());
|
||||
}
|
||||
|
||||
eval {
|
||||
if (defined($xml_data->{'server_name'})) {
|
||||
process_xml_server ($self->getConfig (), $file_name, $xml_data, $self->getDBH ());
|
||||
} elsif (defined($xml_data->{'connection_source'})) {
|
||||
enterprise_hook('process_xml_connections', [$self->getConfig (), $file_name, $xml_data, $self->getDBH ()]);
|
||||
} elsif (defined($xml_data->{'ipam_source'})) {
|
||||
enterprise_hook('process_xml_ipam', [$self->getConfig (), $file_name, $xml_data, $self->getDBH ()]);
|
||||
} elsif (defined($xml_data->{'network_matrix'})){
|
||||
process_xml_matrix_network( $self->getConfig(), $xml_data, $self->getDBH());
|
||||
} else {
|
||||
process_xml_data ($self->getConfig (), $file_name, $xml_data, $self->getServerID (), $self->getDBH ());
|
||||
}
|
||||
};
|
||||
|
||||
agent_unlock($pa_config, $agent_name);
|
||||
return;
|
||||
}
|
||||
|
@ -1174,15 +1175,6 @@ sub process_xml_matrix_network {
|
|||
sub agent_lock {
|
||||
my ($pa_config, $dbh, $agent_name) = @_;
|
||||
|
||||
# Do not lock on LIFO mode if the agent already exist.
|
||||
# get_agent_id will be called again from process_xml_data,
|
||||
# so the should be no race conditions if the agent does
|
||||
# not exist.
|
||||
if ($pa_config->{'dataserver_lifo'} == 1 &&
|
||||
get_agent_id ($dbh, $agent_name) > 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
$AgentSem->down ();
|
||||
if (defined ($Agents{$agent_name})) {
|
||||
$AgentSem->up ();
|
||||
|
|
|
@ -221,10 +221,14 @@ sub data_consumer ($$) {
|
|||
|
||||
if ($task->{'type'} == DISCOVERY_APP_SAP) {
|
||||
# SAP TASK, retrieve license.
|
||||
$task->{'sap_license'} = pandora_get_config_value(
|
||||
$dbh,
|
||||
'sap_license'
|
||||
);
|
||||
if (defined($task->{'field4'}) && $task->{'field4'} ne "") {
|
||||
$task->{'sap_license'} = $task->{'field4'};
|
||||
} else {
|
||||
$task->{'sap_license'} = pandora_get_config_value(
|
||||
$dbh,
|
||||
'sap_license'
|
||||
);
|
||||
}
|
||||
|
||||
# Retrieve credentials for task (optional).
|
||||
if (defined($task->{'auth_strings'})
|
||||
|
|
|
@ -33,8 +33,8 @@ use base 'Exporter';
|
|||
our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.768";
|
||||
my $pandora_build = "230206";
|
||||
my $pandora_version = "7.0NG.769";
|
||||
my $pandora_build = "230216";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.768
|
||||
%define release 230206
|
||||
%define version 7.0NG.769
|
||||
%define release 1
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -110,6 +110,12 @@ rm -fr $RPM_BUILD_ROOT
|
|||
getent passwd pandora >/dev/null || \
|
||||
/usr/sbin/useradd -d %{prefix}/pandora_server -s /sbin/nologin -M -g 0 pandora
|
||||
|
||||
current_ver=$(perl -le 'eval "require $ARGV[0]" and print $ARGV[0]->VERSION' Thread::Semaphore 2> /dev/null | cut -d '.' -f 2)
|
||||
if [ $((current_ver)) -lt 13 ] ; then
|
||||
echo "perl Thread::Semaphore version >= 2.13 should be installed. Current version installed ver: $(perl -le 'eval "require $ARGV[0]" and print $ARGV[0]->VERSION' Thread::Semaphore 2> /dev/null)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
%post
|
||||
|
@ -177,6 +183,12 @@ if [ "$1" = "1" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
current_ver=$(perl -le 'eval "require $ARGV[0]" and print $ARGV[0]->VERSION' Thread::Semaphore 2> /dev/null | cut -d '.' -f 2)
|
||||
if [ $((current_ver)) -lt 13 ] ; then
|
||||
echo "perl Thread::Semaphore version >= 2.13 should be installed. Current version installed ver: $(perl -le 'eval "require $ARGV[0]" and print $ARGV[0]->VERSION' Thread::Semaphore 2> /dev/null)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
/sbin/service pandora_server stop >/dev/null 2>&1 || :
|
||||
/sbin/service tentacle_serverd stop >/dev/null 2>&1 || :
|
||||
/sbin/chkconfig --del pandora_server
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.768
|
||||
%define release 230206
|
||||
%define version 7.0NG.769
|
||||
%define release 1
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -101,7 +101,11 @@ if [ "`id pandora | grep uid | wc -l`" = 0 ]
|
|||
then
|
||||
/usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora
|
||||
fi
|
||||
exit 0
|
||||
current_ver=$(perl -le 'eval "require $ARGV[0]" and print $ARGV[0]->VERSION' Thread::Semaphore 2> /dev/null | cut -d '.' -f 2)
|
||||
if [ $((current_ver)) -lt 13 ] ; then
|
||||
echo "perl Thread::Semaphore version >= 2.13 should be installed. Current version installed ver: $(perl -le 'eval "require $ARGV[0]" and print $ARGV[0]->VERSION' Thread::Semaphore 2> /dev/null)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
%post
|
||||
if [ `command -v systemctl` ];
|
||||
|
@ -173,6 +177,12 @@ if [ "$1" = "1" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
current_ver=$(perl -le 'eval "require $ARGV[0]" and print $ARGV[0]->VERSION' Thread::Semaphore 2> /dev/null | cut -d '.' -f 2)
|
||||
if [ $((current_ver)) -lt 13 ] ; then
|
||||
echo "perl Thread::Semaphore version >= 2.13 should be installed. Current version installed ver: $(perl -le 'eval "require $ARGV[0]" and print $ARGV[0]->VERSION' Thread::Semaphore 2> /dev/null)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
/etc/init.d/pandora_server stop &>/dev/null
|
||||
/etc/init.d/tentacle_serverd stop &>/dev/null
|
||||
chkconfig --del pandora_server
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.768"
|
||||
PI_BUILD="230206"
|
||||
PI_VERSION="7.0NG.769"
|
||||
PI_BUILD="230216"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.768 Build 230206";
|
||||
my $version = "7.0NG.769 Build 230216";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
@ -1067,12 +1067,18 @@ sub pandora_delete_old_session_data {
|
|||
|
||||
$ulimit_timestamp = time() - $session_timeout;
|
||||
|
||||
log_message ('PURGE', "Deleting old session data from tsessions_php\n");
|
||||
log_message ('PURGE', "Deleting old session data from tsessions_php");
|
||||
while(db_delete_limit ($dbh, 'tsessions_php', 'last_active < ?', $SMALL_OPERATION_STEP, $ulimit_timestamp) ne '0E0') {
|
||||
usleep (10000);
|
||||
};
|
||||
|
||||
db_do ($dbh, "DELETE FROM tsessions_php WHERE data IS NULL OR id_session REGEXP '^cron-'");
|
||||
|
||||
# Delete cron cookies file
|
||||
my $cookie_file = '/tmp/cron-session-cookies';
|
||||
log_message ('PURGE', "Deleting cron session file");
|
||||
unlink($cookie_file) or die log_message ('PURGE', "Could not delete session file");
|
||||
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.768 Build 230206";
|
||||
my $version = "7.0NG.769 Build 230216";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue