mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
fix conflicts
This commit is contained in:
commit
b76a4b1a48
320
extras/deploy-scripts/deploy_ext_database_el8.sh
Normal file
320
extras/deploy-scripts/deploy_ext_database_el8.sh
Normal file
@ -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"
|
257
extras/deploy-scripts/deploy_ext_database_ubuntu_2204.sh
Normal file
257
extras/deploy-scripts/deploy_ext_database_ubuntu_2204.sh
Normal file
@ -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"
|
@ -285,11 +285,16 @@ server_dependencies=" \
|
||||
java \
|
||||
bind-utils \
|
||||
whois \
|
||||
cpanminus \
|
||||
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
||||
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \
|
||||
https://firefly.artica.es/centos7/pandorawmic-1.0.0-1.x86_64.rpm"
|
||||
execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
|
||||
|
||||
# install cpan dependencies
|
||||
execute_cmd "cpanm -i Thread::Semaphore" "Installing Thread::Semaphore"
|
||||
|
||||
|
||||
# SDK VMware perl dependencies
|
||||
vmware_dependencies=" \
|
||||
http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm \
|
||||
@ -634,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"
|
||||
|
@ -4,7 +4,7 @@
|
||||
#######################################################
|
||||
## Tested versions ##
|
||||
# Centos 8.4, 8.5
|
||||
# Rocky 8.4, 8.5
|
||||
# Rocky 8.4, 8.5, 8.6, 8.7
|
||||
# Almalinuz 8.4, 8.5
|
||||
# RedHat 8.5
|
||||
|
||||
@ -14,24 +14,25 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
|
||||
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
|
||||
|
||||
|
||||
S_VERSION='202209231'
|
||||
S_VERSION='202301251'
|
||||
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
||||
|
||||
# define default variables
|
||||
[ "$TZ" ] || TZ="Europe/Madrid"
|
||||
[ "$MYVER" ] || MYVER=57
|
||||
[ "$PHPVER" ] || PHPVER=8
|
||||
[ "$DBHOST" ] || DBHOST=127.0.0.1
|
||||
[ "$DBNAME" ] || DBNAME=pandora
|
||||
[ "$DBUSER" ] || DBUSER=pandora
|
||||
[ "$DBPASS" ] || DBPASS=pandora
|
||||
[ "$DBPORT" ] || DBPORT=3306
|
||||
[ "$TZ" ] || TZ="Europe/Madrid"
|
||||
[ "$MYVER" ] || MYVER=57
|
||||
[ "$PHPVER" ] || PHPVER=8
|
||||
[ "$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_PRECHECK" ] || SKIP_PRECHECK=0
|
||||
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
|
||||
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
|
||||
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
|
||||
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
|
||||
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
|
||||
[ "$PANDORA_LTS" ] || PANDORA_LTS=1
|
||||
[ "$PANDORA_BETA" ] || PANDORA_BETA=0
|
||||
|
||||
# Ansi color code variables
|
||||
@ -41,7 +42,6 @@ cyan="\e[0;36m"
|
||||
reset="\e[0m"
|
||||
|
||||
# Functions
|
||||
|
||||
execute_cmd () {
|
||||
local cmd="$1"
|
||||
local msg="$2"
|
||||
@ -76,7 +76,7 @@ check_cmd_status () {
|
||||
check_pre_pandora () {
|
||||
|
||||
echo -en "${cyan}Checking environment ... ${reset}"
|
||||
rpm -qa | grep 'pandorafms_' &>> /dev/null && local fail=true
|
||||
rpm -qa | grep -v "pandorawmic" | grep 'pandorafms_' &>> /dev/null && local fail=true
|
||||
[ -d "$PANDORA_CONSOLE" ] && local fail=true
|
||||
[ -f /usr/bin/pandora_server ] && local fail=true
|
||||
|
||||
@ -137,7 +137,10 @@ check_root_permissions
|
||||
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
|
||||
|
||||
#advicing BETA PROGRAM
|
||||
[ "$PANDORA_BETA" -ne '0' ] && echo -e "${red}BETA version enable using nightly PandoraFMS packages${reset}"
|
||||
INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}"
|
||||
[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}"
|
||||
[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}"
|
||||
echo -e $INSTALLING_VER
|
||||
|
||||
# Connectivity
|
||||
check_repo_connection
|
||||
@ -467,6 +470,8 @@ query_cache_size = 64M
|
||||
query_cache_min_res_unit = 2k
|
||||
query_cache_limit = 256K
|
||||
|
||||
#skip-log-bin
|
||||
|
||||
sql_mode=""
|
||||
|
||||
[mysqld_safe]
|
||||
@ -477,6 +482,7 @@ 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"
|
||||
@ -485,11 +491,18 @@ fi
|
||||
export MYSQL_PWD=$DBPASS
|
||||
|
||||
#Define packages
|
||||
if [ "$PANDORA_BETA" -eq '0' ] ; then
|
||||
if [ "$PANDORA_LTS" -eq '1' ] ; then
|
||||
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_server-7.0NG.noarch.rpm"
|
||||
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_console-7.0NG.noarch.rpm"
|
||||
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_agent_linux-7.0NG.noarch.rpm"
|
||||
elif [ "$PANDORA_LTS" -ne '1' ] ; then
|
||||
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm"
|
||||
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm"
|
||||
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm"
|
||||
elif [ "$PANDORA_BETA" -ne '0' ] ; then
|
||||
fi
|
||||
|
||||
# if beta is enable
|
||||
if [ "$PANDORA_BETA" -eq '1' ] ; then
|
||||
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm"
|
||||
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://pandorafms.com/community/community-console-rpm-beta/"
|
||||
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm"
|
||||
@ -719,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"
|
||||
|
@ -16,7 +16,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
|
||||
WORKDIR=/opt/pandora/deploy
|
||||
|
||||
|
||||
S_VERSION='2022052501'
|
||||
S_VERSION='202301251'
|
||||
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
||||
rm -f $LOGFILE &> /dev/null # remove last log before start
|
||||
|
||||
@ -34,6 +34,8 @@ rm -f $LOGFILE &> /dev/null # remove last log before start
|
||||
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
|
||||
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
|
||||
[ "$PANDORA_BETA" ] || PANDORA_BETA=0
|
||||
[ "$PANDORA_LTS" ] || PANDORA_LTS=1
|
||||
|
||||
|
||||
# Ansi color code variables
|
||||
red="\e[0;91m"
|
||||
@ -134,7 +136,10 @@ check_root_permissions
|
||||
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
|
||||
|
||||
#advicing BETA PROGRAM
|
||||
[ "$PANDORA_BETA" -ne '0' ] && echo -e "${red}BETA version enable using nightly PandoraFMS packages${reset}"
|
||||
INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}"
|
||||
[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}"
|
||||
[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}"
|
||||
echo -e $INSTALLING_VER
|
||||
|
||||
# Connectivity
|
||||
check_repo_connection
|
||||
@ -272,14 +277,19 @@ echo -en "${cyan}Installing phantomjs...${reset}"
|
||||
/usr/bin/phantomjs --version &>> "$LOGFILE"
|
||||
check_cmd_status "Error Installing phanromjs"
|
||||
|
||||
# create symlink for fping
|
||||
rm -f /usr/sbin/fping &>> "$LOGFILE"
|
||||
ln -s /usr/bin/fping /usr/sbin/fping &>> "$LOGFILE"
|
||||
|
||||
# Chrome
|
||||
rm -f /usr/bin/chromium-browser &>> "$LOGFILE"
|
||||
execute_cmd "wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" "Downloading google chrome"
|
||||
execute_cmd "apt install -y ./google-chrome-stable_current_amd64.deb" "Intalling google chrome"
|
||||
execute_cmd "ln -s /usr/bin/google-chrome /usr/bin/chromium-browser" "Creating /usr/bin/chromium-browser Symlink"
|
||||
|
||||
# SDK VMware perl dependencies
|
||||
vmware_dependencies=" \
|
||||
lib32z1 \
|
||||
vmware_dependencies="\
|
||||
lib32z1 \
|
||||
lib32z1 \
|
||||
build-essential \
|
||||
uuid uuid-dev \
|
||||
@ -350,10 +360,12 @@ systemctl stop apparmor &>> "$LOGFILE"
|
||||
systemctl disable apparmor &>> "$LOGFILE"
|
||||
|
||||
#install mysql
|
||||
debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password password $DBROOTPASS") &>> "$LOGFILE"
|
||||
debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password_again password $DBROOTPASS") &>> "$LOGFILE"
|
||||
echo -en "${cyan}Installing MySql Server...${reset}"
|
||||
env DEBIAN_FRONTEND=noninteractive apt install -y mysql-server &>> "$LOGFILE"
|
||||
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"
|
||||
|
||||
|
||||
@ -361,6 +373,10 @@ check_cmd_status "Error Installing MySql Server"
|
||||
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
|
||||
@ -399,11 +415,12 @@ 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
|
||||
@ -417,11 +434,17 @@ execute_cmd "systemctl restart mysql" "Configuring and restarting database engin
|
||||
|
||||
|
||||
#Define packages
|
||||
if [ "$PANDORA_BETA" -eq '0' ] ; then
|
||||
if [ "$PANDORA_LTS" -eq '1' ] ; then
|
||||
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_server-7.0NG.tar.gz"
|
||||
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_console-7.0NG.tar.gz"
|
||||
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_agent_linux-7.0NG.tar.gz"
|
||||
elif [ "$PANDORA_LTS" -ne '1' ] ; then
|
||||
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_server-7.0NG.tar.gz"
|
||||
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_console-7.0NG.tar.gz"
|
||||
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz"
|
||||
elif [ "$PANDORA_BETA" -ne '0' ] ; then
|
||||
fi
|
||||
|
||||
if [ "$PANDORA_BETA" -eq '1' ] ; then
|
||||
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest_x86_64.tar.gz"
|
||||
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_console-latest.tar.gz"
|
||||
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz"
|
||||
@ -709,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,6 +1,7 @@
|
||||
#
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 4.0
|
||||
%define release 1
|
||||
|
@ -1,6 +1,7 @@
|
||||
#
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 4.0.1
|
||||
%define release 1
|
||||
|
@ -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,6 +1,7 @@
|
||||
#
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent
|
||||
%define version 3.2
|
||||
Summary: Pandora FMS Linux agent
|
||||
|
@ -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-230120
|
||||
Version: 7.0NG.769-230222
|
||||
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-230120"
|
||||
pandora_version="7.0NG.769-230222"
|
||||
|
||||
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 => '230120';
|
||||
use constant AGENT_VERSION => '7.0NG.769';
|
||||
use constant AGENT_BUILD => '230222';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -1,9 +1,10 @@
|
||||
#
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.768
|
||||
%define release 230120
|
||||
%define version 7.0NG.769
|
||||
%define release 230222
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -1,9 +1,10 @@
|
||||
#
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.768
|
||||
%define release 230120
|
||||
%define version 7.0NG.769
|
||||
%define release 230222
|
||||
|
||||
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="230120"
|
||||
PI_VERSION="7.0NG.769"
|
||||
PI_BUILD="230222"
|
||||
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
|
||||
{230120}
|
||||
{230222}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.768 Build 230120")
|
||||
#define PANDORA_VERSION ("7.0NG.769 Build 230222")
|
||||
|
||||
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 230120))"
|
||||
VALUE "ProductVersion", "(7.0NG.769(Build 230222))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.768-230120
|
||||
Version: 7.0NG.769-230222
|
||||
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-230120"
|
||||
pandora_version="7.0NG.769-230222"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -103,6 +103,15 @@ function api_execute(
|
||||
}
|
||||
}
|
||||
|
||||
$url_protocol = parse_url($url)['scheme'];
|
||||
|
||||
if ($url_protocol !== 'http' && $url_protocol !== 'https') {
|
||||
return [
|
||||
'url' => $url,
|
||||
'result' => '',
|
||||
];
|
||||
}
|
||||
|
||||
$curlObj = curl_init($url);
|
||||
if (empty($data) === false) {
|
||||
$url .= http_build_query($data);
|
||||
|
49
pandora_console/extras/mr/61.sql
Normal file
49
pandora_console/extras/mr/61.sql
Normal file
@ -0,0 +1,49 @@
|
||||
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,
|
||||
`text` TEXT NULL,
|
||||
`period` TEXT NULL,
|
||||
`ip` TEXT NULL,
|
||||
`type` TEXT NULL,
|
||||
`user` TEXT NULL,
|
||||
PRIMARY KEY (`id_filter`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE INDEX `tusuario_perfil_user` ON `tusuario_perfil` (`id_usuario`);
|
||||
CREATE INDEX `tusuario_perfil_group` ON `tusuario_perfil` (`id_grupo`);
|
||||
CREATE INDEX `tusuario_perfil_profile` ON `tusuario_perfil` (`id_perfil`);
|
||||
CREATE INDEX `tlayout_data_layout` ON `tlayout_data` (`id_layout`);
|
||||
CREATE INDEX `taddress_agent_agent` ON `taddress_agent` (`id_agent`);
|
||||
CREATE INDEX `ttag_name` ON `ttag` (name(15));
|
||||
CREATE INDEX `tservice_element_service` ON `tservice_element` (`id_service`);
|
||||
CREATE INDEX `tservice_element_agent` ON `tservice_element` (`id_agent`);
|
||||
CREATE INDEX `tservice_element_am` ON `tservice_element` (`id_agente_modulo`);
|
||||
CREATE INDEX `tagent_module_log_agent` ON `tagent_module_log` (`id_agent`);
|
||||
|
||||
COMMIT;
|
@ -1,18 +0,0 @@
|
||||
START TRANSACTION;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tagent_filter` (
|
||||
`id_filter` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_name` VARCHAR(600) NOT NULL,
|
||||
`id_group_filter` INT NOT NULL DEFAULT 0,
|
||||
`group_id` INT NOT NULL DEFAULT 0,
|
||||
`recursion` TEXT,
|
||||
`status` INT NOT NULL DEFAULT -1,
|
||||
`search` TEXT,
|
||||
`id_os` INT NOT NULL DEFAULT 0,
|
||||
`policies` TEXT,
|
||||
`search_custom` TEXT,
|
||||
`ag_custom_fields` TEXT,
|
||||
PRIMARY KEY (`id_filter`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
COMMIT;
|
BIN
pandora_console/fonts/CircularStd-Book.woff
Normal file
BIN
pandora_console/fonts/CircularStd-Book.woff
Normal file
Binary file not shown.
BIN
pandora_console/fonts/CircularStd-Medium.woff
Normal file
BIN
pandora_console/fonts/CircularStd-Medium.woff
Normal file
Binary file not shown.
@ -359,6 +359,10 @@ if ($config['enterprise_installed']) {
|
||||
}
|
||||
|
||||
// CSRF validation.
|
||||
if (isset($_SESSION['csrf_code']) === true) {
|
||||
unset($_SESSION['csrf_code']);
|
||||
}
|
||||
|
||||
html_print_csrf_hidden();
|
||||
|
||||
echo '</form></div>';
|
||||
|
@ -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.
|
||||
@ -1994,7 +1996,7 @@ if ($create_module) {
|
||||
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||
"Added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']),
|
||||
"Added module '".db_escape_string_sql($name)."' for agent ".io_safe_output($agent['alias']),
|
||||
false,
|
||||
true,
|
||||
io_json_mb_encode($values)
|
||||
|
@ -1283,9 +1283,13 @@ foreach ($modules as $module) {
|
||||
}
|
||||
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
// Check module relatonships to show warning message.
|
||||
$url = htmlentities('index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo']);
|
||||
|
||||
// Delete module.
|
||||
$data[9] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
|
||||
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
$data[9] = '<a href="#"
|
||||
onClick="get_children_modules(false, \''.$module['id_agente_modulo'].'\', \''.$url.'\')">';
|
||||
|
||||
$data[9] .= html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
@ -1309,8 +1313,7 @@ foreach ($modules as $module) {
|
||||
}
|
||||
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module"
|
||||
onsubmit="if (! confirm (\''.__('Are you sure?').'\')) return false">';
|
||||
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module" id="form_multiple_delete">';
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
@ -1344,6 +1347,8 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
false,
|
||||
'class="sub next"'
|
||||
);
|
||||
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
@ -1353,6 +1358,17 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
$("input[name=submit_modules_action]").click(function (event) {
|
||||
event.preventDefault();
|
||||
var module_action = $('#module_action').val();
|
||||
if(module_action !== 'delete') {
|
||||
$("#form_multiple_delete").submit();
|
||||
} else {
|
||||
get_children_modules(true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('[id^=checkbox-id_delete]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
@ -1394,4 +1410,60 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
window.location = window.location + "&checked=true";
|
||||
}
|
||||
}
|
||||
|
||||
function get_children_modules(multiple, id_module, url) {
|
||||
var selected_modules = [];
|
||||
|
||||
if(typeof(id_module) === 'undefined' && multiple === true) {
|
||||
$("input[id^='checkbox-id_delete']:checked").each(function () {
|
||||
selected_modules.push(this.value);
|
||||
});
|
||||
} else {
|
||||
selected_modules = [id_module];
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: 'include/ajax/module',
|
||||
get_children_modules: true,
|
||||
parent_modulues: JSON.parse(JSON.stringify(selected_modules)),
|
||||
},
|
||||
success: function (data) {
|
||||
delete_module_warning(data, multiple, id_module, url);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function delete_module_warning(children, multiple, id_module, url) {
|
||||
var message = '<?php echo __('Are you sure?'); ?>';
|
||||
var ret = false;
|
||||
|
||||
if(children != false) {
|
||||
message += '<br><strong>' + '<?php echo __('This module has children modules.The following modules will also be deleted: '); ?>' + '</strong><ul>';
|
||||
$.each(children, function (key, value) {
|
||||
message += '<li>' + value['nombre'] + '</li>';
|
||||
});
|
||||
message += '</ul>';
|
||||
}
|
||||
|
||||
confirmDialog({
|
||||
title: "<?php echo __('Delete module'); ?>",
|
||||
message: message,
|
||||
onAccept: function() {
|
||||
if(multiple === true) {
|
||||
$("#form_multiple_delete").submit();
|
||||
return true;
|
||||
} else {
|
||||
window.location.href = url;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
@ -393,7 +393,7 @@ $data[1] = html_print_input_text(
|
||||
$data[2] = __('Auth password').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||
$data[3] = html_print_input_password(
|
||||
'snmp3_auth_pass',
|
||||
$snmp3_auth_pass,
|
||||
'',
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
@ -415,7 +415,7 @@ $data[1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_pr
|
||||
$data[2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||
$data[3] = html_print_input_password(
|
||||
'snmp3_privacy_pass',
|
||||
$snmp3_privacy_pass,
|
||||
'',
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
@ -711,6 +711,12 @@ $(document).ready (function () {
|
||||
$("#text-custom_ip_target").hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Add input password values with js to hide it in browser inspector.
|
||||
$('#password-snmp3_auth_pass').val('<?php echo $snmp3_auth_pass; ?>');
|
||||
$('#password-snmp3_privacy_pass').val('<?php echo $snmp3_privacy_pass; ?>');
|
||||
|
||||
observerInputPassword();
|
||||
});
|
||||
|
||||
|
||||
|
@ -85,6 +85,8 @@ $table_simple->rowstyle['macro_field'] = 'display:none';
|
||||
|
||||
push_table_simple($data, 'macro_field');
|
||||
|
||||
$password_fields = [];
|
||||
|
||||
// If there are $macros, we create the form fields
|
||||
if (!empty($macros)) {
|
||||
$macros = json_decode($macros, true);
|
||||
@ -102,7 +104,8 @@ if (!empty($macros)) {
|
||||
}
|
||||
|
||||
if ($m_hide) {
|
||||
$data[1] = html_print_input_password($m['macro'], io_output_password($m['value']), '', 100, 1024, true);
|
||||
$data[1] = html_print_input_password($m['macro'], '', '', 100, 1024, true);
|
||||
array_push($password_fields, $m);
|
||||
} else {
|
||||
$data[1] = html_print_input_text(
|
||||
$m['macro'],
|
||||
@ -125,6 +128,17 @@ if (!empty($macros)) {
|
||||
}
|
||||
}
|
||||
|
||||
// Add input password values with js to hide it in browser inspector.
|
||||
foreach ($password_fields as $k => $p) {
|
||||
echo "
|
||||
<script>
|
||||
$(document).ready(() => {
|
||||
$('input[name=\"".$p['macro']."\"]').val('".$p['value']."');
|
||||
});
|
||||
</script>
|
||||
";
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function changePluginSelect() {
|
||||
@ -140,4 +154,8 @@ if (!empty($macros)) {
|
||||
|
||||
forced_title_callback();
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
observerInputPassword();
|
||||
});
|
||||
</script>
|
||||
|
@ -116,7 +116,7 @@ $data[1] = html_print_input_text(
|
||||
$data[2] = __('Password');
|
||||
$data[3] = html_print_input_password(
|
||||
'plugin_pass',
|
||||
$plugin_pass,
|
||||
'',
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
@ -191,6 +191,11 @@ $(document).ready (function () {
|
||||
$("#text-custom_ip_target").hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Add input password values with js to hide it in browser inspector.
|
||||
$('#password-plugin_pass').val('<?php echo $plugin_pass; ?>');
|
||||
|
||||
observerInputPassword();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
@ -290,7 +290,7 @@ $search_text = (string) get_parameter('search_text');
|
||||
$date_from = (string) get_parameter('date_from');
|
||||
$date_to = (string) get_parameter('date_to');
|
||||
$execution_type = (string) get_parameter('execution_type');
|
||||
$show_archived = (bool) get_parameter('archived');
|
||||
$show_archived = (bool) get_parameter_switch('archived', false);
|
||||
$agent_id = (int) get_parameter('agent_id');
|
||||
$agent_name = (string) ((empty($agent_id) === false) ? get_parameter('agent_name') : '');
|
||||
$module_id = (int) get_parameter('module_name_hidden');
|
||||
@ -313,12 +313,20 @@ $table_form = new StdClass();
|
||||
$table_form->class = 'databox filters';
|
||||
$table_form->width = '100%';
|
||||
$table_form->rowstyle = [];
|
||||
$table_form->cellstyle[0] = ['width: 100px;'];
|
||||
$table_form->cellstyle[1] = ['width: 100px;'];
|
||||
$table_form->cellstyle[1][2] = 'display: flex; align-items: center;';
|
||||
$table_form->cellstyle[2] = ['width: 100px;'];
|
||||
$table_form->cellstyle[3] = ['text-align: right;'];
|
||||
$table_form->colspan[3][0] = 3;
|
||||
$table_form->data = [];
|
||||
|
||||
$row = [];
|
||||
|
||||
// Search text.
|
||||
$row[] = __('Search').' '.html_print_input_text(
|
||||
$row[] = __('Search');
|
||||
|
||||
$row[] = html_print_input_text(
|
||||
'search_text',
|
||||
$search_text,
|
||||
'',
|
||||
@ -356,7 +364,8 @@ $execution_type_fields = [
|
||||
'periodically' => __('Periodically'),
|
||||
'cron' => __('Cron'),
|
||||
];
|
||||
$row[] = __('Execution type').' '.html_print_select(
|
||||
$row[] = __('Execution type');
|
||||
$row[] = html_print_select(
|
||||
$execution_type_fields,
|
||||
'execution_type',
|
||||
$execution_type,
|
||||
@ -368,11 +377,11 @@ $row[] = __('Execution type').' '.html_print_select(
|
||||
false
|
||||
);
|
||||
// Show past downtimes.
|
||||
$row[] = __('Show past downtimes').' '.html_print_checkbox(
|
||||
'archived',
|
||||
1,
|
||||
$show_archived,
|
||||
true
|
||||
$row[] = __('Show past downtimes').' '.html_print_switch(
|
||||
[
|
||||
'name' => 'archived',
|
||||
'value' => $show_archived,
|
||||
]
|
||||
);
|
||||
|
||||
$table_form->data[] = $row;
|
||||
@ -388,8 +397,8 @@ $params['return'] = true;
|
||||
$params['print_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_name'] = 'agent_id';
|
||||
$params['hidden_input_idagent_value'] = $agent_id;
|
||||
$agent_input = __('Agent').' '.ui_print_agent_autocomplete_input($params);
|
||||
$row[] = $agent_input;
|
||||
$row[] = __('Agent');
|
||||
$row[] = ui_print_agent_autocomplete_input($params);
|
||||
|
||||
// Module.
|
||||
$row[] = __('Module').' '.html_print_autocomplete_modules(
|
||||
@ -402,6 +411,10 @@ $row[] = __('Module').' '.html_print_autocomplete_modules(
|
||||
true
|
||||
);
|
||||
|
||||
$table_form->data[] = $row;
|
||||
|
||||
$row = [];
|
||||
|
||||
$row[] = html_print_submit_button(
|
||||
__('Search'),
|
||||
'search',
|
||||
|
@ -550,7 +550,22 @@ $table->data['form_agents_3'][3] = html_print_select(
|
||||
|
||||
|
||||
$table->data['edit0'][0] = __('Dynamic Interval');
|
||||
$table->data['edit0'][1] = html_print_extended_select_for_time('dynamic_interval', '', '', 'None', '0', 10, true, 'width:150px', false);
|
||||
$table->data['edit0'][1] = html_print_extended_select_for_time(
|
||||
'dynamic_interval',
|
||||
-2,
|
||||
'',
|
||||
'None',
|
||||
'0',
|
||||
10,
|
||||
true,
|
||||
'width:150px',
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table->data['edit0'][2] = '<table width="100%"><tr><td><em>'.__('Dynamic Min.').'</em></td>';
|
||||
$table->data['edit0'][2] .= '<td align="right">'.html_print_input_text('dynamic_min', '', '', 10, 255, true).'</td></tr>';
|
||||
$table->data['edit0'][2] .= '<tr><td><em>'.__('Dynamic Max.').'</em></td>';
|
||||
@ -2128,6 +2143,12 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
|
||||
}
|
||||
break;
|
||||
|
||||
case 'dynamic_interval':
|
||||
if ($value !== '-2') {
|
||||
$values[$field] = $value;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'plugin_pass':
|
||||
if ($value != '') {
|
||||
$values['plugin_pass'] = io_input_password($value);
|
||||
|
@ -865,6 +865,11 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
|
||||
var id_layout_data = $("#active_id_layout_data").val();
|
||||
var label = tinyMCE.activeEditor.getContent();
|
||||
$("#hidden-label_" + id_layout_data).val(label);
|
||||
},
|
||||
buttons: {
|
||||
Save: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -177,7 +177,7 @@ switch ($activeTab) {
|
||||
$background_color = (string) get_parameter('background_color');
|
||||
$width = (int) get_parameter('width');
|
||||
$height = (int) get_parameter('height');
|
||||
$visualConsoleName = (string) get_parameter('name');
|
||||
$visualConsoleName = io_safe_input((string) get_parameter('name'));
|
||||
$is_favourite = (int) get_parameter('is_favourite_sent');
|
||||
$auto_adjust = (int) get_parameter('auto_adjust_sent');
|
||||
|
||||
|
@ -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;
|
||||
|
@ -230,9 +230,64 @@ if ($filemanager) {
|
||||
$directory = filemanager_safe_directory($directory, $fallback_directory);
|
||||
}
|
||||
|
||||
$base_url = 'index.php?sec=gservers&sec2=godmode/servers/plugin';
|
||||
$setup_url = $base_url.'&filemanager=1&tab=Attachments';
|
||||
$tab = get_parameter('tab', null);
|
||||
$tabs = [
|
||||
'list' => [
|
||||
'text' => '<a href="'.$base_url.'">'.html_print_image(
|
||||
'images/eye_show.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Plugins'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>',
|
||||
'active' => (bool) ($tab != 'Attachments'),
|
||||
],
|
||||
'options' => [
|
||||
'text' => '<a href="'.$setup_url.'">'.html_print_image(
|
||||
'images/collection.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Attachments'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>',
|
||||
'active' => (bool) ($tab == 'Attachments'),
|
||||
],
|
||||
];
|
||||
|
||||
if ($tab === 'Attachments') {
|
||||
$helpHeader = '';
|
||||
$titleHeader = __('Index of attachment/plugin');
|
||||
} else {
|
||||
$helpHeader = 'servers_ha_clusters_tab';
|
||||
$titleHeader = __('Plug-ins registered on %s', get_product_name());
|
||||
}
|
||||
|
||||
// Header.
|
||||
ui_print_standard_header(
|
||||
$titleHeader,
|
||||
'images/gm_servers.png',
|
||||
false,
|
||||
$helpHeader,
|
||||
false,
|
||||
$tabs,
|
||||
[
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Servers'),
|
||||
],
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Plugins'),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$real_directory = realpath($config['homedir'].'/'.$directory);
|
||||
|
||||
echo '<h4>'.__('Index of %s', $directory).'</h4>';
|
||||
|
||||
$chunck_url = '&view='.$id_plugin;
|
||||
if ($id_plugin == 0) {
|
||||
@ -255,7 +310,7 @@ if ($filemanager) {
|
||||
filemanager_file_explorer(
|
||||
$real_directory,
|
||||
$directory,
|
||||
'index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$id_plugin,
|
||||
'index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$id_plugin.'&tab=Attachments',
|
||||
$fallback_directory,
|
||||
true,
|
||||
false,
|
||||
@ -401,7 +456,7 @@ if (($create != '') || ($view != '')) {
|
||||
$data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true);
|
||||
$data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" >';
|
||||
|
||||
$data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$form_id.'" class="bot">';
|
||||
$data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&tab=Attachments&id_plugin='.$form_id.'" class="bot">';
|
||||
$data[1] .= html_print_image('images/file.png', true, ['class' => 'invert_filter'], false, true);
|
||||
$data[1] .= '</a>';
|
||||
$table->data['plugin_command'] = $data;
|
||||
@ -597,15 +652,60 @@ if (($create != '') || ($view != '')) {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
ui_print_page_header(
|
||||
__(
|
||||
'Plug-ins registered on %s',
|
||||
get_product_name()
|
||||
),
|
||||
$base_url = 'index.php?sec=gservers&sec2=godmode/servers/plugin';
|
||||
$setup_url = $base_url.'&filemanager=1&tab=Attachments';
|
||||
$tab = get_parameter('tab', null);
|
||||
$tabs = [
|
||||
'list' => [
|
||||
'text' => '<a href="'.$base_url.'">'.html_print_image(
|
||||
'images/eye_show.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Plugins'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>',
|
||||
'active' => (bool) ($tab != 'Attachments'),
|
||||
],
|
||||
'options' => [
|
||||
'text' => '<a href="'.$setup_url.'">'.html_print_image(
|
||||
'images/collection.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Attachments'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>',
|
||||
'active' => (bool) ($tab == 'Attachments'),
|
||||
],
|
||||
];
|
||||
|
||||
if ($tab === 'Attachments') {
|
||||
$helpHeader = '';
|
||||
$titleHeader = __('Index of attachment/plugin');
|
||||
} else {
|
||||
$helpHeader = 'servers_ha_clusters_tab';
|
||||
$titleHeader = __('Plug-ins registered on %s', get_product_name());
|
||||
}
|
||||
|
||||
// Header.
|
||||
ui_print_standard_header(
|
||||
$titleHeader,
|
||||
'images/gm_servers.png',
|
||||
false,
|
||||
'',
|
||||
true
|
||||
$helpHeader,
|
||||
false,
|
||||
$tabs,
|
||||
[
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Servers'),
|
||||
],
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Plugins'),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$management_allowed = is_management_allowed();
|
||||
|
@ -110,6 +110,12 @@ foreach ($servers as $server) {
|
||||
];
|
||||
$data[0] = '<span title="'.$server['version'].'">'.strip_tags($server['name']).'</span>';
|
||||
|
||||
$server_keepalive = time_w_fixed_tz($server['keepalive']);
|
||||
|
||||
if ($server['server_keepalive_utimestamp'] > 0) {
|
||||
$server_keepalive = $server['server_keepalive_utimestamp'];
|
||||
}
|
||||
|
||||
// Status.
|
||||
$data[1] = ui_print_status_image(STATUS_SERVER_OK, '', true);
|
||||
if ($server['status'] == -1) {
|
||||
@ -119,7 +125,7 @@ foreach ($servers as $server) {
|
||||
true
|
||||
);
|
||||
} else if ((int) ($server['status'] === 0)
|
||||
|| (($date - time_w_fixed_tz($server['keepalive'])) > ($server['server_keepalive']) * 2)
|
||||
|| (($date - $server_keepalive) > ($server['server_keepalive']) * 2)
|
||||
) {
|
||||
$data[1] = ui_print_status_image(
|
||||
STATUS_SERVER_DOWN,
|
||||
|
@ -87,6 +87,20 @@ $create_text_file = (bool) get_parameter('create_text_file');
|
||||
|
||||
$default_real_directory = realpath($config['homedir'].'/');
|
||||
|
||||
// Remove double dot in filename path.
|
||||
$file_name = $_FILES['file']['name'];
|
||||
$path_parts = explode('/', $file_name);
|
||||
|
||||
$stripped_parts = array_filter(
|
||||
$path_parts,
|
||||
function ($value) {
|
||||
return $value !== '..';
|
||||
}
|
||||
);
|
||||
|
||||
$stripped_path = implode('/', $stripped_parts);
|
||||
$_FILES['file']['name'] = $stripped_path;
|
||||
|
||||
if ($upload_file === true) {
|
||||
upload_file(
|
||||
$upload_file,
|
||||
|
@ -1353,11 +1353,8 @@ $values = [
|
||||
'Alert detail' => __('Alert detail'),
|
||||
'External link' => __('External link'),
|
||||
'Other' => __('Other'),
|
||||
'Dashboard' => __('Dashboard'),
|
||||
];
|
||||
if (!is_metaconsole()) {
|
||||
$values['Dashboard'] = __('Dashboard');
|
||||
}
|
||||
|
||||
|
||||
$home_screen .= html_print_select(
|
||||
$values,
|
||||
@ -1372,7 +1369,14 @@ $home_screen .= html_print_select(
|
||||
).'</div>';
|
||||
|
||||
|
||||
$dashboards = Manager::getDashboards(-1, -1);
|
||||
$dashboards = Manager::getDashboards(
|
||||
-1,
|
||||
-1,
|
||||
false,
|
||||
false,
|
||||
$id_usr
|
||||
);
|
||||
|
||||
$dashboards_aux = [];
|
||||
if ($dashboards === false) {
|
||||
$dashboards = ['None' => 'None'];
|
||||
|
@ -333,6 +333,7 @@ if ($delete_user === true) {
|
||||
$result = delete_user($id_user);
|
||||
|
||||
if ($result) {
|
||||
delete_session_user($id_user);
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_USER_MANAGEMENT,
|
||||
__('Deleted user %s', io_safe_output($id_user))
|
||||
@ -401,6 +402,11 @@ if ($delete_user === true) {
|
||||
__('There was a problem deleting the profile')
|
||||
);
|
||||
} else if ($disable_user !== false) {
|
||||
// CSRF Validator.
|
||||
if (html_print_csrf_error()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable_user.
|
||||
$id_user = get_parameter('id', 0);
|
||||
|
||||
@ -645,6 +651,8 @@ $limit = (int) $config['block_size'];
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
$cont = 0;
|
||||
// Creates csrf.
|
||||
$csrf = html_print_csrf_hidden(true);
|
||||
foreach ($info as $user_id => $user_info) {
|
||||
if (empty($user_id) === true) {
|
||||
continue;
|
||||
@ -814,6 +822,8 @@ foreach ($info as $user_id => $user_info) {
|
||||
$user_info['id_user'],
|
||||
true
|
||||
);
|
||||
// Same csrf for every disable button for submit.
|
||||
$data[6] .= $csrf;
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'disable_user',
|
||||
$toDoAction,
|
||||
|
BIN
pandora_console/images/Pandora-FMS-installer-gear.png
Normal file
BIN
pandora_console/images/Pandora-FMS-installer-gear.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
pandora_console/images/Pandora-FMS-installer.png
Normal file
BIN
pandora_console/images/Pandora-FMS-installer.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 100 KiB |
BIN
pandora_console/images/installer-background.jpg
Normal file
BIN
pandora_console/images/installer-background.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 668 KiB |
@ -721,7 +721,7 @@ if ($get_agent_alerts_datatable === true) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'lastFired':
|
||||
case 'last_fired':
|
||||
switch ($sort) {
|
||||
case 'asc':
|
||||
$selectLastFiredasc = $selected;
|
||||
|
457
pandora_console/include/ajax/audit_log.php
Normal file
457
pandora_console/include/ajax/audit_log.php
Normal file
@ -0,0 +1,457 @@
|
||||
<?php
|
||||
/**
|
||||
* Manage AJAX response for event pages.
|
||||
*
|
||||
* @category Ajax
|
||||
* @package Pandora FMS
|
||||
* @subpackage Events
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
global $config;
|
||||
enterprise_include_once('include/functions_audit.php');
|
||||
|
||||
// Check access.
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'ER')
|
||||
&& ! check_acl($config['id_user'], 0, 'EW')
|
||||
&& ! check_acl($config['id_user'], 0, 'EM')
|
||||
) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access event viewer'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
$save_filter_modal = get_parameter('save_filter_modal', 0);
|
||||
$load_filter_modal = get_parameter('load_filter_modal', 0);
|
||||
$get_filter_values = get_parameter('get_filter_values', 0);
|
||||
$update_log_filter = get_parameter('update_log_filter', 0);
|
||||
$save_log_filter = get_parameter('save_log_filter', 0);
|
||||
$recover_aduit_log_select = get_parameter('recover_aduit_log_select', 0);
|
||||
|
||||
|
||||
// Saves an event filter.
|
||||
if ($save_log_filter) {
|
||||
$values = [];
|
||||
$values['id_name'] = get_parameter('id_name');
|
||||
$values['text'] = get_parameter('text', '');
|
||||
$values['period'] = get_parameter('period', '');
|
||||
$values['ip'] = get_parameter('ip', '');
|
||||
$values['type'] = get_parameter('type', -1);
|
||||
$values['user'] = get_parameter('user', -1);
|
||||
|
||||
$exists = (bool) db_get_value_filter(
|
||||
'id_filter',
|
||||
'tsesion_filter',
|
||||
['id_name' => $values['id_name']]
|
||||
);
|
||||
|
||||
if ($exists) {
|
||||
echo 'duplicate';
|
||||
} else {
|
||||
$result = db_process_sql_insert('tsesion_filter', $values);
|
||||
|
||||
if ($result === false) {
|
||||
echo 'error';
|
||||
} else {
|
||||
echo $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($recover_aduit_log_select) {
|
||||
echo json_encode(audit_get_audit_filter_select());
|
||||
}
|
||||
|
||||
if ($update_log_filter) {
|
||||
$values = [];
|
||||
$id = get_parameter('id');
|
||||
$values['text'] = get_parameter('text', '');
|
||||
$values['period'] = get_parameter('period', '');
|
||||
$values['ip'] = get_parameter('ip', '');
|
||||
$values['type'] = get_parameter('type', -1);
|
||||
$values['user'] = get_parameter('user', -1);
|
||||
|
||||
$result = db_process_sql_update(
|
||||
'tsesion_filter',
|
||||
$values,
|
||||
['id_filter' => $id]
|
||||
);
|
||||
|
||||
if ($result === false) {
|
||||
echo 'error';
|
||||
} else {
|
||||
echo 'ok';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($get_filter_values) {
|
||||
$id_filter = get_parameter('id');
|
||||
|
||||
$event_filter = audit_get_audit_log_filter($id_filter);
|
||||
echo json_encode($event_filter);
|
||||
}
|
||||
|
||||
|
||||
if ($load_filter_modal) {
|
||||
$filters = audit_get_audit_filter_select();
|
||||
$user_groups_array = users_get_groups_for_select(
|
||||
$config['id_user'],
|
||||
$access,
|
||||
true,
|
||||
true,
|
||||
false
|
||||
);
|
||||
|
||||
echo '<div id="load-filter-select" class="load-filter-modal">';
|
||||
|
||||
$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',
|
||||
'',
|
||||
'',
|
||||
__('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" onclick="load_filter_values()"',
|
||||
true
|
||||
);
|
||||
$data[1] .= html_print_input_hidden('load_filter', 1, true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
html_print_table($table);
|
||||
echo '</div>';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function show_filter() {
|
||||
$("#load-filter-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: 450
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function load_filter_values() {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: 'include/ajax/audit_log',
|
||||
get_filter_values: 1,
|
||||
"id" : $('#filter_id :selected').val()
|
||||
},
|
||||
success: function(data) {
|
||||
var options = "";
|
||||
$.each(data,function(i,value){
|
||||
if (i == 'text'){
|
||||
$("#text-filter_text").val(value);
|
||||
}
|
||||
if (i == 'period'){
|
||||
$("#text-filter_period").val(value);
|
||||
}
|
||||
if (i == 'ip'){
|
||||
$("#text-filter_ip").val(value);
|
||||
}
|
||||
if (i == 'type'){
|
||||
$("#filter_type").val(value).change();
|
||||
}
|
||||
if (i == 'user'){
|
||||
$("#filter_user").val(value).change();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Close dialog.
|
||||
$("#load-filter-select").dialog('close');
|
||||
}
|
||||
|
||||
$(document).ready (function() {
|
||||
show_filter();
|
||||
})
|
||||
|
||||
</script>
|
||||
<?php
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ($save_filter_modal) {
|
||||
echo '<div id="save-filter-select" style="width:350px;">';
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'EW') === 1 || check_acl($config['id_user'], 0, 'EM') === 1) {
|
||||
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',
|
||||
__('New filter'),
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
$data[1] = html_print_radio_button(
|
||||
'filter_mode',
|
||||
'update',
|
||||
__('Update filter'),
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
$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);
|
||||
|
||||
$data[1] = html_print_submit_button(
|
||||
__('Save filter'),
|
||||
'save_filter',
|
||||
false,
|
||||
'class="sub wand" onclick="save_new_filter();"',
|
||||
true
|
||||
);
|
||||
|
||||
$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;
|
||||
|
||||
$_filters_update = audit_get_audit_filter_select();
|
||||
|
||||
$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);
|
||||
} 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() == '') {
|
||||
$('#info_box').html("<h3 class='error'><?php echo __('Filter name cannot be left blank'); ?></h3>");
|
||||
return false;
|
||||
}
|
||||
|
||||
var id_filter_save;
|
||||
|
||||
jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
{
|
||||
"page" : "include/ajax/audit_log",
|
||||
"save_log_filter" : 1,
|
||||
"id_name" : $("#text-id_name").val(),
|
||||
"text" : $("#text-filter_text").val(),
|
||||
"period" : $("#text-filter_period").val(),
|
||||
"ip" : $('#text-filter_ip').val(),
|
||||
"type" : $('#filter_type :selected').val(),
|
||||
"user" : $('#filter_user :selected').val(),
|
||||
},
|
||||
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').html("<h3 class='error'><?php echo __('Filter name already on use'); ?></h3>");
|
||||
$('#info_box').show();
|
||||
} else {
|
||||
// Close dialog.
|
||||
$("#save-filter-select").dialog('close');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// This updates an event filter
|
||||
function save_update_filter() {
|
||||
var id_filter_update = $("#overwrite_filter").val();
|
||||
var name_filter_update = $("#overwrite_filter option[value='"+id_filter_update+"']").text();
|
||||
|
||||
jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
{"page" : "include/ajax/audit_log",
|
||||
"update_log_filter" : 1,
|
||||
"id" : $("#overwrite_filter :selected").val(),
|
||||
"text" : $("#text-filter_text").val(),
|
||||
"period" : $("#text-filter_period").val(),
|
||||
"ip" : $('#text-filter_ip').val(),
|
||||
"type" : $('#filter_type :selected').val(),
|
||||
"user" : $('#filter_user :selected').val(),
|
||||
},
|
||||
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();
|
||||
}
|
||||
});
|
||||
|
||||
// Close dialog
|
||||
$('.ui-dialog-titlebar-close').trigger('click');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function (){
|
||||
show_save_filter();
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
return;
|
||||
}
|
@ -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']
|
||||
@ -1515,9 +1518,37 @@ if ($change_status === true) {
|
||||
}
|
||||
|
||||
if ($get_Acknowledged === true) {
|
||||
$event_id = get_parameter('event_id');
|
||||
echo events_page_general_acknowledged($event_id);
|
||||
return;
|
||||
$event_id = (int) get_parameter('event_id', 0);
|
||||
$server_id = (int) get_parameter('server_id', 0);
|
||||
|
||||
$return = '';
|
||||
try {
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
) {
|
||||
$node = new Node($server_id);
|
||||
$node->connect();
|
||||
}
|
||||
|
||||
echo events_page_general_acknowledged($event_id);
|
||||
} catch (\Exception $e) {
|
||||
// Unexistent agent.
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
) {
|
||||
$node->disconnect();
|
||||
}
|
||||
|
||||
$return = false;
|
||||
} finally {
|
||||
if (is_metaconsole() === true
|
||||
&& $server_id > 0
|
||||
) {
|
||||
$node->disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
if ($change_owner === true) {
|
||||
@ -1611,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'];
|
||||
@ -2379,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>';
|
||||
|
||||
@ -2465,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;
|
||||
|
||||
@ -2483,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;
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,7 @@ if (is_ajax() === true) {
|
||||
|
||||
// Group.
|
||||
$secondary_groups = '';
|
||||
$secondary = agents_get_secondary_groups($data['id_agente']);
|
||||
$secondary = enterprise_hook('agents_get_secondary_groups', [$data['id_agente']]);
|
||||
if (isset($secondary['for_select']) === true && empty($secondary['for_select']) === false) {
|
||||
$secondary_groups = implode(', ', $secondary['for_select']);
|
||||
$secondary_groups = ', '.$secondary_groups;
|
||||
@ -353,19 +353,26 @@ if (is_ajax() === true) {
|
||||
|
||||
|
||||
// Events.
|
||||
echo '<div class="div-dialog">';
|
||||
echo graph_graphic_agentevents(
|
||||
$id,
|
||||
100,
|
||||
40,
|
||||
SECONDS_1DAY,
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
1
|
||||
$result_graph_event = enterprise_hook(
|
||||
'graph_graphic_agentevents',
|
||||
[
|
||||
$id,
|
||||
100,
|
||||
40,
|
||||
SECONDS_1DAY,
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
1,
|
||||
]
|
||||
);
|
||||
echo '</div>';
|
||||
|
||||
if ($result_graph_event !== -1) {
|
||||
echo '<div class="div-dialog">';
|
||||
echo $result_graph_event;
|
||||
echo '</div>';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -61,11 +61,19 @@ if (check_login()) {
|
||||
0
|
||||
);
|
||||
|
||||
$get_children_modules = (bool) get_parameter('get_children_modules', false);
|
||||
|
||||
$get_data_dataMatrix = (bool) get_parameter(
|
||||
'get_data_dataMatrix',
|
||||
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');
|
||||
|
||||
@ -1629,4 +1637,564 @@ if (check_login()) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_children_modules === true) {
|
||||
$parent_modules = get_parameter('parent_modulues', false);
|
||||
$children_selected = [];
|
||||
|
||||
if ($parent_modules === false) {
|
||||
$children_selected = false;
|
||||
} else {
|
||||
foreach ($parent_modules as $parent) {
|
||||
$child_modules = get_children_module($parent_modules, ['nombre', 'id_agente_modulo'], true);
|
||||
if ((bool) $child_modules === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($child_modules as $child) {
|
||||
$module_exist = in_array($child['id_agente_modulo'], $parent_modules);
|
||||
$child_exist = in_array($child, $children_selected);
|
||||
|
||||
if ($module_exist === false && $child_exist === false) {
|
||||
array_push($children_selected, $child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($children_selected) === true) {
|
||||
$children_selected = false;
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -843,6 +843,7 @@ class AgentWizard extends HTML
|
||||
html_print_div(
|
||||
[
|
||||
'class' => 'white_box',
|
||||
'style' => 'padding: 20px',
|
||||
'content' => $this->printForm(
|
||||
[
|
||||
'form' => $form,
|
||||
@ -2723,7 +2724,7 @@ class AgentWizard extends HTML
|
||||
'action' => $this->sectionUrl,
|
||||
'id' => 'form-filter-interfaces',
|
||||
'method' => 'POST',
|
||||
'class' => 'modal flex flex-row searchbox',
|
||||
'class' => 'modal searchbox',
|
||||
'extra' => '',
|
||||
];
|
||||
|
||||
@ -5476,6 +5477,19 @@ class AgentWizard extends HTML
|
||||
*/
|
||||
private function getInterfacesModulesx64(array $data=[])
|
||||
{
|
||||
$equivalencies_x86 = [
|
||||
'ifHCInOctets' => 'ifInOctets',
|
||||
'ifHCOutOctets' => 'ifOutOctets',
|
||||
'ifHCInUcastPkts' => 'ifInUcastPkts',
|
||||
'ifHCOutUcastPkts' => 'ifOutUcastPkts',
|
||||
'ifHCInNUcastPkts' => 'ifInNUcastPkts',
|
||||
'ifHCOutNUcastPkts' => 'ifOutNUcastPkts',
|
||||
];
|
||||
|
||||
foreach ($equivalencies_x86 as $key => $equivalencie) {
|
||||
$this->defaultSNMPValues[$key] = $this->defaultSNMPValues[$equivalencie];
|
||||
}
|
||||
|
||||
$moduleDescription = '';
|
||||
$name = '';
|
||||
$value = '1';
|
||||
|
@ -156,6 +156,26 @@ class AuditLog extends HTML
|
||||
open_meta_frame();
|
||||
}
|
||||
|
||||
$buttons = [];
|
||||
|
||||
$buttons[] = [
|
||||
'id' => 'load-filter',
|
||||
'class' => 'float-left margin-right-2 margin-left-2 sub config',
|
||||
'text' => __('Load filter'),
|
||||
'onclick' => '',
|
||||
];
|
||||
|
||||
$buttons[] = [
|
||||
'id' => 'save-filter',
|
||||
'class' => 'float-left margin-right-2 sub wand',
|
||||
'text' => __('Save filter'),
|
||||
'onclick' => '',
|
||||
];
|
||||
|
||||
// Modal for save/load filters.
|
||||
echo '<div id="save-modal-filter" style="display:none"></div>';
|
||||
echo '<div id="load-modal-filter" style="display:none"></div>';
|
||||
|
||||
// Load datatables user interface.
|
||||
ui_print_datatable(
|
||||
[
|
||||
@ -174,9 +194,10 @@ class AuditLog extends HTML
|
||||
],
|
||||
'search_button_class' => 'sub filter float-right',
|
||||
'form' => [
|
||||
'inputs' => [
|
||||
'extra_buttons' => $buttons,
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Search'),
|
||||
'label' => __('Free search').ui_print_help_tip(__('Search filter by User, Action, Date, Source IP or Comments fields content'), true),
|
||||
'type' => 'text',
|
||||
'class' => 'w200px',
|
||||
'id' => 'filter_text',
|
||||
@ -211,7 +232,9 @@ class AuditLog extends HTML
|
||||
'type' => 'select_from_sql',
|
||||
'nothing' => __('All'),
|
||||
'nothing_value' => '-1',
|
||||
'sql' => 'SELECT id_user, id_user AS text FROM tusuario',
|
||||
'sql' => 'SELECT id_user, id_user AS text FROM tusuario UNION SELECT "SYSTEM"
|
||||
AS id_user, "SYSTEM" AS text UNION SELECT "N/A"
|
||||
AS id_user, "N/A" AS text',
|
||||
'class' => 'mw250px',
|
||||
'id' => 'filter_user',
|
||||
'name' => 'filter_user',
|
||||
@ -269,7 +292,10 @@ class AuditLog extends HTML
|
||||
|
||||
if (empty($this->filterText) === false) {
|
||||
$filter .= sprintf(
|
||||
" AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%')",
|
||||
" AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR id_usuario LIKE '%%%s%%' OR fecha LIKE '%%%s%%' OR ip_origen LIKE '%%%s%%')",
|
||||
$this->filterText,
|
||||
$this->filterText,
|
||||
$this->filterText,
|
||||
$this->filterText,
|
||||
$this->filterText
|
||||
);
|
||||
@ -366,38 +392,149 @@ class AuditLog extends HTML
|
||||
|
||||
// Javascript content.
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function format(d) {
|
||||
var output = '';
|
||||
<script type="text/javascript">
|
||||
var loading = 0;
|
||||
|
||||
if (d.extendedInfo === '') {
|
||||
output = "<?php echo __('There is no additional information to display'); ?>";
|
||||
} else {
|
||||
output = d.extendedInfo;
|
||||
function format(d) {
|
||||
var output = '';
|
||||
|
||||
if (d.extendedInfo === '') {
|
||||
output = "<?php echo __('There is no additional information to display'); ?>";
|
||||
} else {
|
||||
output = d.extendedInfo;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
$(document).ready(function() {
|
||||
// Add event listener for opening and closing details
|
||||
$('#audit_logs tbody').on('click', 'td.show_extended_info', function() {
|
||||
var tr = $(this).closest('tr');
|
||||
var table = $("#<?php echo $this->tableId; ?>").DataTable();
|
||||
var row = table.row(tr);
|
||||
|
||||
$(document).ready(function() {
|
||||
// Add event listener for opening and closing details
|
||||
$('#audit_logs tbody').on('click', 'td.show_extended_info', function() {
|
||||
var tr = $(this).closest('tr');
|
||||
var table = $("#<?php echo $this->tableId; ?>").DataTable();
|
||||
var row = table.row(tr);
|
||||
|
||||
if (row.child.isShown()) {
|
||||
if (row.child.isShown()) {
|
||||
// This row is already open - close it
|
||||
row.child.hide();
|
||||
tr.removeClass('shown');
|
||||
} else {
|
||||
// Open this row
|
||||
row.child(format(row.data())).show();
|
||||
tr.addClass('shown');
|
||||
}
|
||||
row.child.hide();
|
||||
tr.removeClass('shown');
|
||||
} else {
|
||||
// Open this row
|
||||
row.child(format(row.data())).show();
|
||||
tr.addClass('shown');
|
||||
}
|
||||
$('#audit_logs').css('table-layout','fixed');
|
||||
$('#audit_logs').css('width','95% !important');
|
||||
});
|
||||
|
||||
$('#save-filter').click(function() {
|
||||
if ($('#save-filter-select').length) {
|
||||
$('#save-filter-select').dialog({
|
||||
width: "20%",
|
||||
maxWidth: "25%",
|
||||
title: "<?php echo __('Save filter'); ?>"
|
||||
});
|
||||
$('#info_box').html("");
|
||||
$('#text-id_name').val("");
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: 'include/ajax/audit_log',
|
||||
recover_aduit_log_select: 1
|
||||
},
|
||||
success: function(data) {
|
||||
var options = "";
|
||||
$.each(data,function(key,value){
|
||||
options += "<option value='"+key+"'>"+value+"</option>";
|
||||
});
|
||||
$('#overwrite_filter').html(options);
|
||||
$('#overwrite_filter').select2();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (loading == 0) {
|
||||
loading = 1
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
|
||||
data: {
|
||||
page: 'include/ajax/audit_log',
|
||||
save_filter_modal: 1,
|
||||
current_filter: $('#latest_filter_id').val()
|
||||
},
|
||||
success: function(data) {
|
||||
$('#save-modal-filter')
|
||||
.empty()
|
||||
.html(data);
|
||||
loading = 0;
|
||||
$('#save-filter-select').dialog({
|
||||
width: "20%",
|
||||
maxWidth: "25%",
|
||||
title: "<?php echo __('Save filter'); ?>"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#save_filter_form-0-1, #radiobtn0002').click(function(){
|
||||
$('#overwrite_filter').select2();
|
||||
});
|
||||
|
||||
/* Filter management */
|
||||
$('#load-filter').click(function (){
|
||||
if($('#load-filter-select').length) {
|
||||
$('#load-filter-select').dialog({width: "20%",
|
||||
maxWidth: "25%",
|
||||
title: "<?php echo __('Load filter'); ?>"
|
||||
});
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: 'include/ajax/audit_log',
|
||||
recover_aduit_log_select: 1
|
||||
},
|
||||
success: function(data) {
|
||||
var options = "";
|
||||
$.each(data,function(key,value){
|
||||
options += "<option value='"+key+"'>"+value+"</option>";
|
||||
});
|
||||
$('#filter_id').html(options);
|
||||
$('#filter_id').select2();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (loading == 0) {
|
||||
loading = 1
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
|
||||
data: {
|
||||
page: 'include/ajax/audit_log',
|
||||
load_filter_modal: 1
|
||||
},
|
||||
success: function (data){
|
||||
$('#load-modal-filter')
|
||||
.empty()
|
||||
.html(data);
|
||||
loading = 0;
|
||||
$('#load-filter-select').dialog({
|
||||
width: "20%",
|
||||
maxWidth: "25%",
|
||||
title: "<?php echo __('Load filter'); ?>"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
<?php
|
||||
// EOF Javascript content.
|
||||
return ob_get_clean();
|
||||
|
@ -900,7 +900,7 @@ class CalendarManager
|
||||
$id_group = get_parameter('id_group', null);
|
||||
$day_code = get_parameter('day_code', null);
|
||||
$id_calendar = get_parameter('id_calendar', null);
|
||||
$description = get_parameter('description', null);
|
||||
$description = io_safe_input(get_parameter('description', null));
|
||||
$change = true;
|
||||
if ($new === false
|
||||
&& ($date === $specialDay->date()
|
||||
|
@ -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',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -104,6 +104,7 @@ class Diagnostics extends Wizard
|
||||
'getChartAjax',
|
||||
'formFeedback',
|
||||
'createdScheduleFeedbackTask',
|
||||
'getSystemDate',
|
||||
];
|
||||
|
||||
|
||||
@ -209,6 +210,7 @@ class Diagnostics extends Wizard
|
||||
'getAttachmentFolder',
|
||||
'getInfoTagenteDatos',
|
||||
'getServerThreads',
|
||||
'getSystemDate',
|
||||
];
|
||||
|
||||
if ($this->pdf === true) {
|
||||
@ -278,6 +280,10 @@ class Diagnostics extends Wizard
|
||||
$title = __('SQL show engine innodb status');
|
||||
break;
|
||||
|
||||
case 'getSystemDate':
|
||||
$title = __('Date system');
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not possible.
|
||||
$title = '';
|
||||
@ -516,6 +522,27 @@ class Diagnostics extends Wizard
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Date system
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSystemDate(): string
|
||||
{
|
||||
$result = [
|
||||
'error' => false,
|
||||
'data' => [
|
||||
'date' => [
|
||||
'name' => __('System Date (Console)'),
|
||||
'value' => date('H:i:s Y-m-d'),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
return json_encode($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Database size stats.
|
||||
*
|
||||
@ -619,7 +646,7 @@ class Diagnostics extends Wizard
|
||||
$currentTime = time();
|
||||
|
||||
$pandoraDbLastRun = __('Pandora DB has never been executed');
|
||||
if ($dateDbMantenaince !== false) {
|
||||
if ($dateDbMantenaince !== false && empty($dateDbMantenaince) === false) {
|
||||
$difference = ($currentTime - $dateDbMantenaince);
|
||||
$pandoraDbLastRun = human_time_description_raw(
|
||||
$difference,
|
||||
@ -659,15 +686,6 @@ class Diagnostics extends Wizard
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Size BBDD.
|
||||
$dbSizeSql = db_get_value_sql(
|
||||
'SELECT ROUND(SUM(data_length+index_length)/1024/1024,3)
|
||||
FROM information_schema.TABLES'
|
||||
);
|
||||
|
||||
// Add unit size.
|
||||
$dbSize = $dbSizeSql.' M';
|
||||
|
||||
$result = [
|
||||
'error' => false,
|
||||
'data' => [
|
||||
@ -683,10 +701,6 @@ class Diagnostics extends Wizard
|
||||
'name' => __('DB Schema Build'),
|
||||
'value' => $config['db_scheme_build'],
|
||||
],
|
||||
'dbSize' => [
|
||||
'name' => __('DB Size'),
|
||||
'value' => $dbSize,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -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.
|
||||
|
@ -413,73 +413,74 @@ class SnmpConsole extends HTML
|
||||
'class' => 'flex-row',
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Alert'),
|
||||
'type' => 'select',
|
||||
'id' => 'filter_alert',
|
||||
'name' => 'filter_alert',
|
||||
'class' => 'w200px',
|
||||
'fields' => $show_alerts,
|
||||
'return' => true,
|
||||
'selected' => $this->filter_alert,
|
||||
'label' => __('Alert'),
|
||||
'type' => 'select',
|
||||
'id' => 'filter_alert',
|
||||
'input_class' => 'filter_input_datatable',
|
||||
'name' => 'filter_alert',
|
||||
'fields' => $show_alerts,
|
||||
'return' => true,
|
||||
'selected' => $this->filter_alert,
|
||||
],
|
||||
[
|
||||
'label' => __('Severity'),
|
||||
'type' => 'select',
|
||||
'id' => 'filter_severity',
|
||||
'name' => 'filter_severity',
|
||||
'class' => 'w200px',
|
||||
'fields' => $severities,
|
||||
'return' => true,
|
||||
'selected' => $this->filter_severity,
|
||||
'label' => __('Severity'),
|
||||
'type' => 'select',
|
||||
'id' => 'filter_severity',
|
||||
'input_class' => 'filter_input_datatable',
|
||||
'name' => 'filter_severity',
|
||||
'fields' => $severities,
|
||||
'return' => true,
|
||||
'selected' => $this->filter_severity,
|
||||
],
|
||||
[
|
||||
'label' => __('Free search'),
|
||||
'type' => 'text',
|
||||
'class' => 'w400px',
|
||||
'id' => 'filter_free_search',
|
||||
'name' => 'filter_free_search',
|
||||
'value' => $this->filter_free_search,
|
||||
'label' => __('Free search'),
|
||||
'type' => 'text',
|
||||
'id' => 'filter_free_search',
|
||||
'input_class' => 'filter_input_datatable',
|
||||
'name' => 'filter_free_search',
|
||||
'value' => $this->filter_free_search,
|
||||
],
|
||||
[
|
||||
'label' => __('Status'),
|
||||
'type' => 'select',
|
||||
'id' => 'filter_status',
|
||||
'name' => 'filter_status',
|
||||
'class' => 'w200px',
|
||||
'fields' => $status_array,
|
||||
'return' => true,
|
||||
'selected' => $this->filter_status,
|
||||
'label' => __('Status'),
|
||||
'type' => 'select',
|
||||
'id' => 'filter_status',
|
||||
'input_class' => 'filter_input_datatable',
|
||||
'name' => 'filter_status',
|
||||
'fields' => $status_array,
|
||||
'return' => true,
|
||||
'selected' => $this->filter_status,
|
||||
],
|
||||
[
|
||||
'label' => __('Group by Enterprise String/IP'),
|
||||
'type' => 'select',
|
||||
'name' => 'filter_group_by',
|
||||
'selected' => $this->filter_group_by,
|
||||
'disabled' => false,
|
||||
'return' => true,
|
||||
'id' => 'filter_group_by',
|
||||
'fields' => [
|
||||
'label' => __('Group by Enterprise String/IP'),
|
||||
'type' => 'select',
|
||||
'name' => 'filter_group_by',
|
||||
'selected' => $this->filter_group_by,
|
||||
'disabled' => false,
|
||||
'return' => true,
|
||||
'id' => 'filter_group_by',
|
||||
'input_class' => 'filter_input_datatable',
|
||||
'fields' => [
|
||||
0 => __('No'),
|
||||
1 => __('Yes'),
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => __('Max. hours old'),
|
||||
'type' => 'text',
|
||||
'class' => 'w200px',
|
||||
'id' => 'filter_hours_ago',
|
||||
'name' => 'filter_hours_ago',
|
||||
'value' => $this->filter_hours_ago,
|
||||
'label' => __('Max. hours old'),
|
||||
'type' => 'text',
|
||||
'id' => 'filter_hours_ago',
|
||||
'input_class' => 'filter_input_datatable',
|
||||
'name' => 'filter_hours_ago',
|
||||
'value' => $this->filter_hours_ago,
|
||||
],
|
||||
[
|
||||
'label' => __('Trap type'),
|
||||
'type' => 'select',
|
||||
'id' => 'filter_trap_type',
|
||||
'name' => 'filter_trap_type',
|
||||
'class' => 'w200px',
|
||||
'fields' => $trap_types,
|
||||
'return' => true,
|
||||
'selected' => $this->filter_trap_type,
|
||||
'label' => __('Trap type'),
|
||||
'type' => 'select',
|
||||
'id' => 'filter_trap_type',
|
||||
'input_class' => 'filter_input_datatable',
|
||||
'name' => 'filter_trap_type',
|
||||
'fields' => $trap_types,
|
||||
'return' => true,
|
||||
'selected' => $this->filter_trap_type,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
@ -20,8 +20,8 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC230120';
|
||||
$pandora_version = 'v7.0NG.768';
|
||||
$build_version = 'PC230222';
|
||||
$pandora_version = 'v7.0NG.769';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
@ -805,6 +805,7 @@ define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management');
|
||||
define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management');
|
||||
define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management');
|
||||
define('AUDIT_LOG_UMC', 'Warp Manager');
|
||||
define('AUDIT_LOG_NMS_VIOLATION', 'NMS Violation');
|
||||
|
||||
// MIMEs.
|
||||
define(
|
||||
|
@ -226,7 +226,7 @@ function format_numeric($number, $decimals=1)
|
||||
global $config;
|
||||
|
||||
// Translate to float in case there are characters in the string so
|
||||
// fmod doesn't throw a notice
|
||||
// fmod doesn't throw a notice.
|
||||
$number = (float) $number;
|
||||
|
||||
if ($number == 0) {
|
||||
@ -234,10 +234,20 @@ function format_numeric($number, $decimals=1)
|
||||
}
|
||||
|
||||
if (fmod($number, 1) > 0) {
|
||||
return number_format($number, $decimals, $config['decimal_separator'], $config['thousand_separator']);
|
||||
return number_format(
|
||||
$number,
|
||||
$decimals,
|
||||
$config['decimal_separator'],
|
||||
($config['thousand_separator'] ?? ',')
|
||||
);
|
||||
}
|
||||
|
||||
return number_format($number, 0, $config['decimal_separator'], $config['thousand_separator']);
|
||||
return number_format(
|
||||
$number,
|
||||
0,
|
||||
$config['decimal_separator'],
|
||||
($config['thousand_separator'] ?? ',')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -6387,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;
|
||||
}
|
||||
}
|
||||
|
@ -1405,12 +1405,14 @@ function agents_get_group_agents(
|
||||
'id_agente',
|
||||
'alias',
|
||||
'ta.id_tmetaconsole_setup AS id_server',
|
||||
'ta.disabled',
|
||||
];
|
||||
} else {
|
||||
$fields = [
|
||||
'ta.id_tagente AS id_agente',
|
||||
'alias',
|
||||
'ta.id_tmetaconsole_setup AS id_server',
|
||||
'ta.disabled',
|
||||
];
|
||||
}
|
||||
} else {
|
||||
@ -1419,6 +1421,7 @@ function agents_get_group_agents(
|
||||
$fields = [
|
||||
'id_agente',
|
||||
'alias',
|
||||
'disabled',
|
||||
];
|
||||
}
|
||||
|
||||
@ -1463,6 +1466,13 @@ function agents_get_group_agents(
|
||||
$value = mb_strtoupper($row['alias'], 'UTF-8');
|
||||
break;
|
||||
|
||||
case 'disabled':
|
||||
$value = $row['alias'];
|
||||
if ($row['disabled'] == 1) {
|
||||
$value .= ' ('.__('Disabled').')';
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$value = $row['alias'];
|
||||
break;
|
||||
|
@ -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,
|
||||
@ -12471,9 +12481,26 @@ function api_get_total_modules($id_group, $trash1, $trash2, $returnType)
|
||||
return;
|
||||
}
|
||||
|
||||
$partial = tactical_status_modules_agents($config['id_user'], false, 'AR');
|
||||
if ($id_group) {
|
||||
$groups_clause = '1 = 1';
|
||||
if (!users_is_admin($config['id_user'])) {
|
||||
$user_groups = implode(',', array_keys(users_get_groups()));
|
||||
$groups_clause = "(ta.id_grupo IN ($user_groups) OR tasg.id_group IN ($user_groups))";
|
||||
}
|
||||
|
||||
$total = (int) $partial['_monitor_total_'];
|
||||
$sql = "SELECT COUNT(DISTINCT(id_agente_modulo))
|
||||
FROM tagente_modulo tam, tagente ta
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE tam.id_agente = ta.id_agente AND id_module_group = $id_group
|
||||
AND delete_pending = 0 AND $groups_clause";
|
||||
|
||||
$total = db_get_value_sql($sql);
|
||||
} else {
|
||||
$partial = tactical_status_modules_agents($config['id_user'], false, 'AR');
|
||||
|
||||
$total = (int) $partial['_monitor_total_'];
|
||||
}
|
||||
|
||||
$data = [
|
||||
'type' => 'string',
|
||||
@ -14430,7 +14457,7 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4)
|
||||
$height = (!empty($other) && isset($other['data'][3]) && $other['data'][3]) ? $other['data'][3] : 225;
|
||||
|
||||
// Graph width (optional).
|
||||
$width = (!empty($other) && isset($other['data'][4]) && $other['data'][4]) ? $other['data'][4] : '';
|
||||
$width = (!empty($other) && isset($other['data'][4]) && $other['data'][4]) ? $other['data'][4] : 600;
|
||||
|
||||
// If recive value its from mail call.
|
||||
$graph_font_size = $other['data'][5];
|
||||
|
@ -67,7 +67,7 @@ function config_create_value($token, $value)
|
||||
*
|
||||
* @return boolean True if success. False on failure.
|
||||
*/
|
||||
function config_update_value($token, $value, $noticed=false)
|
||||
function config_update_value($token, $value, $noticed=false, $password=false)
|
||||
{
|
||||
global $config;
|
||||
// Include functions_io to can call __() function.
|
||||
@ -91,7 +91,11 @@ function config_update_value($token, $value, $noticed=false)
|
||||
|
||||
if (isset($config[$token]) === false) {
|
||||
$config[$token] = $value;
|
||||
return (bool) config_create_value($token, io_safe_input($value));
|
||||
if (($password === false)) {
|
||||
return (bool) config_create_value($token, io_safe_input($value));
|
||||
} else {
|
||||
return (bool) config_create_value($token, io_input_password($value));
|
||||
}
|
||||
}
|
||||
|
||||
// If it has not changed.
|
||||
@ -104,7 +108,7 @@ function config_update_value($token, $value, $noticed=false)
|
||||
|
||||
$result = db_process_sql_update(
|
||||
'tconfig',
|
||||
['value' => io_safe_input($value)],
|
||||
['value' => ($password === false) ? io_safe_input($value) : io_input_password($value)],
|
||||
['token' => $token]
|
||||
);
|
||||
|
||||
@ -459,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;
|
||||
|
||||
|
@ -496,9 +496,13 @@ function events_update_status($id_evento, $status, $filter=null)
|
||||
// No groups option direct update.
|
||||
$update_sql = sprintf(
|
||||
'UPDATE tevento
|
||||
SET estado = %d
|
||||
SET estado = %d,
|
||||
ack_utimestamp = %d,
|
||||
id_usuario = "%s"
|
||||
WHERE id_evento = %d',
|
||||
$status,
|
||||
time(),
|
||||
$config['id_user'],
|
||||
$id_evento
|
||||
);
|
||||
break;
|
||||
@ -4732,7 +4736,7 @@ function events_page_general($event)
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Owner');
|
||||
if (empty($event['owner_user']) === true) {
|
||||
if ($event['owner_user'] == -1) {
|
||||
$data[1] = '<i>'.__('N/A').'</i>';
|
||||
} else {
|
||||
$user_owner = db_get_value(
|
||||
@ -4797,14 +4801,15 @@ function events_page_general($event)
|
||||
|
||||
$data = [];
|
||||
|
||||
$table_general->rowid[7] = 'general_status';
|
||||
$table_general->rowid[count($table_general->data)] = 'general_status';
|
||||
$table_general->cellclass[count($table_general->data)][1] = 'general_status';
|
||||
$data[0] = __('Status');
|
||||
$data[1] = $event_st['title'];
|
||||
$data[2] = html_print_image($event_st['img'], true);
|
||||
$table_general->data[] = $data;
|
||||
|
||||
// If event is validated, show who and when acknowleded it.
|
||||
$table_general->cellclass[8][1] = 'general_acknowleded';
|
||||
$table_general->cellclass[count($table_general->data)][1] = 'general_acknowleded';
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Acknowledged by');
|
||||
@ -4825,7 +4830,17 @@ function events_page_general($event)
|
||||
}
|
||||
}
|
||||
|
||||
$data[1] = $user_ack.' ( '.date($config['date_format'], $event['ack_utimestamp_raw']).' ) ';
|
||||
$data[1] = $user_ack.' ( ';
|
||||
if ($event['ack_utimestamp_raw'] !== false
|
||||
&& $event['ack_utimestamp_raw'] !== 'false'
|
||||
) {
|
||||
$data[1] .= date(
|
||||
$config['date_format'],
|
||||
$event['ack_utimestamp_raw']
|
||||
);
|
||||
}
|
||||
|
||||
$data[1] .= ' ) ';
|
||||
} else {
|
||||
$data[1] = '<i>'.__('N/A').'</i>';
|
||||
}
|
||||
@ -4932,9 +4947,8 @@ function events_page_general_acknowledged($event_id)
|
||||
{
|
||||
global $config;
|
||||
$Acknowledged = '';
|
||||
$event = db_get_all_rows_filter('tevento', 'id_evento', $event_id);
|
||||
|
||||
if ($event) {
|
||||
$event = db_get_row('tevento', 'id_evento', $event_id);
|
||||
if ($event !== false && $event['estado'] == 1) {
|
||||
$user_ack = db_get_value(
|
||||
'fullname',
|
||||
'tusuario',
|
||||
@ -4946,7 +4960,17 @@ function events_page_general_acknowledged($event_id)
|
||||
$user_ack = $config['id_user'];
|
||||
}
|
||||
|
||||
$Acknowledged = $user_ack.' ( '.date($config['date_format'], $event['ack_utimestamp_raw']).' ) ';
|
||||
$Acknowledged = $user_ack.' ( ';
|
||||
if ($event['ack_utimestamp'] !== false
|
||||
&& $event['ack_utimestamp'] !== 'false'
|
||||
) {
|
||||
$Acknowledged .= date(
|
||||
$config['date_format'],
|
||||
$event['ack_utimestamp']
|
||||
);
|
||||
}
|
||||
|
||||
$Acknowledged .= ' ) ';
|
||||
} else {
|
||||
$Acknowledged = 'N/A';
|
||||
}
|
||||
|
@ -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'
|
||||
@ -223,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'
|
||||
@ -293,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'));
|
||||
|
||||
@ -349,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;
|
||||
}
|
||||
@ -499,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
|
||||
@ -686,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(
|
||||
@ -702,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)
|
||||
@ -747,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(
|
||||
@ -842,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
|
||||
@ -925,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;'>";
|
||||
|
@ -508,6 +508,14 @@ function menu_add_extras(&$menu)
|
||||
$menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_wizard']['text'] = __('Graph template wizard');
|
||||
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=wizard&action=wizard']['text'] = __('Templates wizard');
|
||||
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=template&action=list_template']['text'] = __('Templates');
|
||||
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&action=edit']['text'] = __('Edit custom reports');
|
||||
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=list_items&action=edit']['text'] = __('List items');
|
||||
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=item_editor&action=new']['text'] = __('Edit item');
|
||||
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=wizard&action=edit']['text'] = __('Wizard');
|
||||
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=wizard_sla&action=edit']['text'] = __('Wizard sla');
|
||||
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=global&action=edit']['text'] = __('Global custom reports');
|
||||
$menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=advanced&action=edit']['text'] = __('Avanced options');
|
||||
|
||||
if ($config['activate_gis']) {
|
||||
$menu_extra['godgismaps']['sub']['godmode/gis_maps/configure_gis_map']['text'] = __('Manage GIS Maps');
|
||||
}
|
||||
@ -789,6 +797,7 @@ if (is_ajax()) {
|
||||
$db_fragmentation = json_decode($d->getTablesFragmentation());
|
||||
$sys_info = json_decode($d->getSystemInfo());
|
||||
$php_sys = json_decode($d->getPHPSetup());
|
||||
$system_date = json_decode($d->getSystemDate());
|
||||
|
||||
$fragmentation_status = '';
|
||||
if ($db_fragmentation->data->tablesFragmentationStatus->status === 1) {
|
||||
@ -811,6 +820,27 @@ if (is_ajax()) {
|
||||
);
|
||||
}
|
||||
|
||||
$image_about = ui_get_full_url('/images/custom_logo/logo-default-pandorafms.png', false, false, false);
|
||||
if (enterprise_installed() === false) {
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
$image_about = 'images/custom_logo/'.HEADER_LOGO_BLACK_CLASSIC;
|
||||
} else if ($config['style'] === 'pandora') {
|
||||
$image_about = 'images/custom_logo/'.HEADER_LOGO_DEFAULT_CLASSIC;
|
||||
}
|
||||
} else {
|
||||
if ($config['style'] === 'pandora_black' && $config['custom_logo'] === HEADER_LOGO_DEFAULT_CLASSIC) {
|
||||
$config['custom_logo'] = HEADER_LOGO_BLACK_CLASSIC;
|
||||
} else if ($config['style'] === 'pandora' && $config['custom_logo'] === HEADER_LOGO_BLACK_CLASSIC) {
|
||||
$config['custom_logo'] = HEADER_LOGO_DEFAULT_CLASSIC;
|
||||
}
|
||||
|
||||
$image_about = 'images/custom_logo/'.$config['custom_logo'];
|
||||
|
||||
if (file_exists(ENTERPRISE_DIR.'/'.$image_about) === true) {
|
||||
$image_about = ENTERPRISE_DIR.'/'.$image_about;
|
||||
}
|
||||
}
|
||||
|
||||
$dialog = '
|
||||
<div id="about-tabs" class="invisible overflow-hidden">
|
||||
<ul>
|
||||
@ -827,7 +857,7 @@ if (is_ajax()) {
|
||||
<tbody>
|
||||
<tr>
|
||||
<th style="width: 40%;">
|
||||
<img src="'.ui_get_full_url('/images/custom_logo/'.$config['custom_logo'], false, false, false).'" alt="logo" width="70%">
|
||||
<img src="'.$image_about.'" alt="logo" width="70%">
|
||||
</th>
|
||||
<th style="width: 60%; text-align: left;">
|
||||
<h1>'.$product_name.'</h1>
|
||||
@ -1001,6 +1031,14 @@ if (is_ajax()) {
|
||||
<p>'.$sys_info->data->ipInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$system_date->data->date->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p>'.$system_date->data->date->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -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++;
|
||||
@ -3992,16 +3993,28 @@ function recursive_get_dt_from_modules_tree(&$f_modules, $modules, $deep)
|
||||
* Get the module data from a children
|
||||
*
|
||||
* @param integer $id_module Id module
|
||||
* @param boolean $recursive Recursive children search.
|
||||
* @return array Children module data
|
||||
*/
|
||||
function get_children_module($id_module)
|
||||
function get_children_module($id_module, $fields=false, $recursion=false)
|
||||
{
|
||||
$children_module_data = db_get_all_rows_sql(
|
||||
'SELECT *
|
||||
FROM tagente_modulo
|
||||
WHERE parent_module_id = '.$id_module
|
||||
$children_module_data = db_get_all_rows_filter(
|
||||
'tagente_modulo',
|
||||
['parent_module_id' => $id_module],
|
||||
$fields
|
||||
);
|
||||
|
||||
if ($children_module_data !== false && $recursion === true) {
|
||||
foreach ($children_module_data as $child) {
|
||||
$niece = get_children_module($child['id_agente_modulo'], $fields, false);
|
||||
if ((bool) $niece === false) {
|
||||
continue;
|
||||
} else {
|
||||
$children_module_data = array_merge($children_module_data, $niece);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $children_module_data;
|
||||
}
|
||||
|
||||
|
@ -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 [];
|
||||
|
@ -257,6 +257,10 @@ function reporting_make_reporting_data(
|
||||
|
||||
$content['style'] = json_decode(io_safe_output($content['style']), true);
|
||||
|
||||
if (!empty($content['style']['event_filter_search'])) {
|
||||
$content['style']['event_filter_search'] = io_safe_input($content['style']['event_filter_search']);
|
||||
}
|
||||
|
||||
$graphs_to_macro = db_get_all_rows_field_filter(
|
||||
'tgraph_source',
|
||||
'id_graph',
|
||||
@ -8802,24 +8806,27 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
||||
$data = [];
|
||||
|
||||
$style = io_safe_output($content['style']);
|
||||
if ($style['hide_notinit_agents']) {
|
||||
$aux_id_agents = $agents;
|
||||
$i = 0;
|
||||
foreach ($items as $item) {
|
||||
$utimestamp = db_get_value(
|
||||
'utimestamp',
|
||||
'tagente_datos',
|
||||
'id_agente_modulo',
|
||||
$item['id_agent_module'],
|
||||
true
|
||||
);
|
||||
if (($utimestamp === false)
|
||||
|| (intval($utimestamp) > intval($datetime_to))
|
||||
) {
|
||||
unset($items[$i]);
|
||||
}
|
||||
|
||||
$i++;
|
||||
if (is_array($style)) {
|
||||
if ($style['hide_notinit_agents']) {
|
||||
$aux_id_agents = $agents;
|
||||
$i = 0;
|
||||
foreach ($items as $item) {
|
||||
$utimestamp = db_get_value(
|
||||
'utimestamp',
|
||||
'tagente_datos',
|
||||
'id_agente_modulo',
|
||||
$item['id_agent_module'],
|
||||
true
|
||||
);
|
||||
if (($utimestamp === false)
|
||||
|| (intval($utimestamp) > intval($datetime_to))
|
||||
) {
|
||||
unset($items[$i]);
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -478,8 +478,13 @@ function tactical_get_data(
|
||||
$list['_monitors_alerts_fired_'] = tactical_monitor_fired_alerts(explode(',', $user_groups_ids), $user_strict, explode(',', $user_groups_ids));
|
||||
$list['_monitors_alerts_'] = tactical_monitor_alerts($user_strict);
|
||||
|
||||
$filter_agents = [];
|
||||
if (users_is_admin() === false) {
|
||||
$filter_agents = ['id_grupo' => explode(',', $user_groups_ids)];
|
||||
}
|
||||
|
||||
$total_agentes = agents_get_agents(
|
||||
['id_grupo' => explode(',', $user_groups_ids)],
|
||||
$filter_agents,
|
||||
['count(DISTINCT id_agente) as total_agents'],
|
||||
'AR',
|
||||
false,
|
||||
|
@ -847,30 +847,38 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
|
||||
$permission = check_acl($config['id_user'], $agent['id_grupo'], 'RR');
|
||||
|
||||
if ($permission) {
|
||||
$params = [
|
||||
'interface_name' => $interface_name,
|
||||
'agent_id' => $id_agente,
|
||||
'traffic_module_in' => $interface['traffic']['in'],
|
||||
'traffic_module_out' => $interface['traffic']['out'],
|
||||
];
|
||||
if ($interface['traffic']['in'] > 0 && $interface['traffic']['out'] > 0) {
|
||||
$params = [
|
||||
'interface_name' => $interface_name,
|
||||
'agent_id' => $id_agente,
|
||||
'traffic_module_in' => $interface['traffic']['in'],
|
||||
'traffic_module_out' => $interface['traffic']['out'],
|
||||
];
|
||||
|
||||
if (defined('METACONSOLE') && !empty($server_id)) {
|
||||
$params['server'] = $server_id;
|
||||
if (defined('METACONSOLE') && !empty($server_id)) {
|
||||
$params['server'] = $server_id;
|
||||
}
|
||||
|
||||
$params_json = json_encode($params);
|
||||
$params_encoded = base64_encode($params_json);
|
||||
$url = ui_get_full_url('operation/agentes/interface_traffic_graph_win.php', false, false, false);
|
||||
$graph_url = "$url?params=$params_encoded";
|
||||
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
|
||||
|
||||
$graph_link = "<a href=\"javascript:winopeng_var('".$graph_url."','".$win_handle."', 800, 480)\">";
|
||||
$graph_link .= html_print_image(
|
||||
'images/chart_curve.png',
|
||||
true,
|
||||
['title' => __('Interface traffic')]
|
||||
);
|
||||
$graph_link .= '</a>';
|
||||
} else {
|
||||
$graph_link = html_print_image(
|
||||
'images/chart_curve.disabled.png',
|
||||
true,
|
||||
['title' => __('inOctets and outOctets must be enabled.')]
|
||||
);
|
||||
}
|
||||
|
||||
$params_json = json_encode($params);
|
||||
$params_encoded = base64_encode($params_json);
|
||||
$url = ui_get_full_url('operation/agentes/interface_traffic_graph_win.php', false, false, false);
|
||||
$graph_url = "$url?params=$params_encoded";
|
||||
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
|
||||
|
||||
$graph_link = "<a href=\"javascript:winopeng_var('".$graph_url."','".$win_handle."', 800, 480)\">";
|
||||
$graph_link .= html_print_image(
|
||||
'images/chart_curve.png',
|
||||
true,
|
||||
['title' => __('Interface traffic')]
|
||||
);
|
||||
$graph_link .= '</a>';
|
||||
} else {
|
||||
$graph_link = '';
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user