mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Merge remote-tracking branch 'origin/develop' into ent-9895-mensaje-de-error-con-ldap-login-poco-explicativo
This commit is contained in:
commit
cf7e5b7ad9
322
extras/deploy-scripts/deploy_ext_database_el8.sh
Normal file
322
extras/deploy-scripts/deploy_ext_database_el8.sh
Normal file
@ -0,0 +1,322 @@
|
|||||||
|
#!/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='202302201'
|
||||||
|
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
|
||||||
|
sed -i -e "s/character-set-server=utf8/character-set-server=utf8mb4/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"
|
258
extras/deploy-scripts/deploy_ext_database_ubuntu_2204.sh
Normal file
258
extras/deploy-scripts/deploy_ext_database_ubuntu_2204.sh
Normal file
@ -0,0 +1,258 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
##############################################################################################################
|
||||||
|
# PandoraFMS Community online installation script for Ubuntu 22.04
|
||||||
|
##############################################################################################################
|
||||||
|
## Tested versions ##
|
||||||
|
# Ubuntu 22.04.1
|
||||||
|
# Ubuntu 22.04.2
|
||||||
|
|
||||||
|
#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='202302201'
|
||||||
|
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=utf8mb4
|
||||||
|
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 = 300
|
||||||
|
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 \
|
java \
|
||||||
bind-utils \
|
bind-utils \
|
||||||
whois \
|
whois \
|
||||||
|
cpanminus \
|
||||||
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
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 \
|
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"
|
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"
|
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
|
# SDK VMware perl dependencies
|
||||||
vmware_dependencies=" \
|
vmware_dependencies=" \
|
||||||
http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm \
|
http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm \
|
||||||
@ -426,7 +431,7 @@ execute_cmd "curl -LSs --output pandorafms_agent_linux-7.0NG.noarch.rpm ${PANDOR
|
|||||||
execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages"
|
execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages"
|
||||||
|
|
||||||
# Copy gotty utility
|
# Copy gotty utility
|
||||||
execute_cmd "wget https://pandorafms.com/library/wp-content/uploads/2019/11/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
|
execute_cmd "wget https://firefly.pandorafms.com/pandorafms/utils/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
|
||||||
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
|
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
|
||||||
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
|
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
|
||||||
|
|
||||||
@ -634,8 +639,8 @@ systemctl enable tentacle_serverd &>> $LOGFILE
|
|||||||
execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
|
execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
|
||||||
|
|
||||||
# Enabling condole cron
|
# 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"
|
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 http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
|
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
|
## Enabling agent
|
||||||
systemctl enable pandora_agent_daemon &>> $LOGFILE
|
systemctl enable pandora_agent_daemon &>> $LOGFILE
|
||||||
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
|
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
#######################################################
|
#######################################################
|
||||||
## Tested versions ##
|
## Tested versions ##
|
||||||
# Centos 8.4, 8.5
|
# Centos 8.4, 8.5
|
||||||
# Rocky 8.4, 8.5
|
# Rocky 8.4, 8.5, 8.6, 8.7
|
||||||
# Almalinuz 8.4, 8.5
|
# Almalinux 8.4, 8.5
|
||||||
# RedHat 8.5
|
# RedHat 8.5
|
||||||
|
|
||||||
#Constants
|
#Constants
|
||||||
@ -14,7 +14,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
|
|||||||
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
|
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
|
||||||
|
|
||||||
|
|
||||||
S_VERSION='202209231'
|
S_VERSION='202302201'
|
||||||
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
||||||
|
|
||||||
# define default variables
|
# define default variables
|
||||||
@ -32,6 +32,7 @@ LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
|||||||
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
|
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
|
||||||
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=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
|
[ "$PANDORA_BETA" ] || PANDORA_BETA=0
|
||||||
|
|
||||||
# Ansi color code variables
|
# Ansi color code variables
|
||||||
@ -41,7 +42,6 @@ cyan="\e[0;36m"
|
|||||||
reset="\e[0m"
|
reset="\e[0m"
|
||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
|
|
||||||
execute_cmd () {
|
execute_cmd () {
|
||||||
local cmd="$1"
|
local cmd="$1"
|
||||||
local msg="$2"
|
local msg="$2"
|
||||||
@ -76,7 +76,7 @@ check_cmd_status () {
|
|||||||
check_pre_pandora () {
|
check_pre_pandora () {
|
||||||
|
|
||||||
echo -en "${cyan}Checking environment ... ${reset}"
|
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
|
[ -d "$PANDORA_CONSOLE" ] && local fail=true
|
||||||
[ -f /usr/bin/pandora_server ] && local fail=true
|
[ -f /usr/bin/pandora_server ] && local fail=true
|
||||||
|
|
||||||
@ -107,6 +107,17 @@ check_root_permissions () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
installing_docker () {
|
||||||
|
#Installing docker for debug
|
||||||
|
echo "Start installig docker" &>> "$LOGFILE"
|
||||||
|
dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo &>> "$LOGFILE"
|
||||||
|
dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin &>> "$LOGFILE"
|
||||||
|
systemctl disable --now docker &>> "$LOGFILE"
|
||||||
|
systemctl disable docker.socket --now &>> "$LOGFILE"
|
||||||
|
echo "End installig docker" &>> "$LOGFILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
## Main
|
## Main
|
||||||
echo "Starting PandoraFMS Community deployment EL8 ver. $S_VERSION"
|
echo "Starting PandoraFMS Community deployment EL8 ver. $S_VERSION"
|
||||||
|
|
||||||
@ -137,7 +148,10 @@ check_root_permissions
|
|||||||
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
|
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
|
||||||
|
|
||||||
#advicing BETA PROGRAM
|
#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
|
# Connectivity
|
||||||
check_repo_connection
|
check_repo_connection
|
||||||
@ -204,6 +218,7 @@ else
|
|||||||
execute_cmd "dnf config-manager --set-enabled powertools" "Configuring Powertools"
|
execute_cmd "dnf config-manager --set-enabled powertools" "Configuring Powertools"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
execute_cmd "installing_docker" "Installing Docker for debug"
|
||||||
|
|
||||||
#Installing wget
|
#Installing wget
|
||||||
execute_cmd "dnf install -y wget" "Installing wget"
|
execute_cmd "dnf install -y wget" "Installing wget"
|
||||||
@ -451,7 +466,7 @@ innodb_flush_log_at_trx_commit = 0
|
|||||||
innodb_flush_method = O_DIRECT
|
innodb_flush_method = O_DIRECT
|
||||||
innodb_log_file_size = 64M
|
innodb_log_file_size = 64M
|
||||||
innodb_log_buffer_size = 16M
|
innodb_log_buffer_size = 16M
|
||||||
innodb_io_capacity = 100
|
innodb_io_capacity = 300
|
||||||
thread_cache_size = 8
|
thread_cache_size = 8
|
||||||
thread_stack = 256K
|
thread_stack = 256K
|
||||||
max_connections = 100
|
max_connections = 100
|
||||||
@ -467,6 +482,8 @@ query_cache_size = 64M
|
|||||||
query_cache_min_res_unit = 2k
|
query_cache_min_res_unit = 2k
|
||||||
query_cache_limit = 256K
|
query_cache_limit = 256K
|
||||||
|
|
||||||
|
#skip-log-bin
|
||||||
|
|
||||||
sql_mode=""
|
sql_mode=""
|
||||||
|
|
||||||
[mysqld_safe]
|
[mysqld_safe]
|
||||||
@ -477,6 +494,8 @@ EO_CONFIG_F
|
|||||||
|
|
||||||
if [ "$MYVER" -eq '80' ] ; then
|
if [ "$MYVER" -eq '80' ] ; then
|
||||||
sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf
|
sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf
|
||||||
|
sed -i -e "s/#skip-log-bin/skip-log-bin/g" /etc/my.cnf
|
||||||
|
sed -i -e "s/character-set-server=utf8/character-set-server=utf8mb4/g" /etc/my.cnf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
execute_cmd "systemctl restart mysqld" "Configuring database engine"
|
execute_cmd "systemctl restart mysqld" "Configuring database engine"
|
||||||
@ -485,11 +504,18 @@ fi
|
|||||||
export MYSQL_PWD=$DBPASS
|
export MYSQL_PWD=$DBPASS
|
||||||
|
|
||||||
#Define packages
|
#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_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_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"
|
[ "$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_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_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"
|
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm"
|
||||||
@ -504,7 +530,7 @@ execute_cmd "curl -LSs --output pandorafms_agent_linux-7.0NG.noarch.rpm ${PANDOR
|
|||||||
execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "Installing Pandora FMS packages"
|
execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "Installing Pandora FMS packages"
|
||||||
|
|
||||||
# Copy gotty utility
|
# Copy gotty utility
|
||||||
execute_cmd "wget https://pandorafms.com/library/wp-content/uploads/2019/11/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
|
execute_cmd "wget https://firefly.pandorafms.com/pandorafms/utils/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
|
||||||
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
|
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
|
||||||
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
|
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
|
||||||
|
|
||||||
@ -719,8 +745,8 @@ systemctl enable tentacle_serverd &>> "$LOGFILE"
|
|||||||
execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
|
execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
|
||||||
|
|
||||||
# Enabling condole cron
|
# 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"
|
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 http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
|
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
|
## Enabling agent
|
||||||
systemctl enable pandora_agent_daemon &>> "$LOGFILE"
|
systemctl enable pandora_agent_daemon &>> "$LOGFILE"
|
||||||
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
|
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
|
||||||
@ -730,7 +756,7 @@ execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
|
|||||||
|
|
||||||
cat > /etc/issue.net << EOF_banner
|
cat > /etc/issue.net << EOF_banner
|
||||||
|
|
||||||
Welcome to Pandora FMS appliance on CentOS
|
Welcome to Pandora FMS appliance on RHEL/Rocky Linux 8
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
Go to Public http://$ipplublic/pandora_console$to to login web console
|
Go to Public http://$ipplublic/pandora_console$to to login web console
|
||||||
$(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to Local http://"$1"/pandora_console to login web console"}')
|
$(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to Local http://"$1"/pandora_console to login web console"}')
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
##############################################################################################################
|
##############################################################################################################
|
||||||
## Tested versions ##
|
## Tested versions ##
|
||||||
# Ubuntu 22.04.1
|
# Ubuntu 22.04.1
|
||||||
|
# Ubuntu 22.04.2
|
||||||
|
|
||||||
#avoid promps
|
#avoid promps
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
@ -16,7 +17,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
|
|||||||
WORKDIR=/opt/pandora/deploy
|
WORKDIR=/opt/pandora/deploy
|
||||||
|
|
||||||
|
|
||||||
S_VERSION='2022052501'
|
S_VERSION='202302201'
|
||||||
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
||||||
rm -f $LOGFILE &> /dev/null # remove last log before start
|
rm -f $LOGFILE &> /dev/null # remove last log before start
|
||||||
|
|
||||||
@ -34,6 +35,8 @@ rm -f $LOGFILE &> /dev/null # remove last log before start
|
|||||||
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=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_BETA" ] || PANDORA_BETA=0
|
[ "$PANDORA_BETA" ] || PANDORA_BETA=0
|
||||||
|
[ "$PANDORA_LTS" ] || PANDORA_LTS=1
|
||||||
|
|
||||||
|
|
||||||
# Ansi color code variables
|
# Ansi color code variables
|
||||||
red="\e[0;91m"
|
red="\e[0;91m"
|
||||||
@ -104,6 +107,21 @@ check_root_permissions () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
installing_docker () {
|
||||||
|
#Installing docker for debug
|
||||||
|
echo "Start installig docker" &>> "$LOGFILE"
|
||||||
|
mkdir -m 0755 -p /etc/apt/keyrings &>> "$LOGFILE"
|
||||||
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --yes --dearmor -o /etc/apt/keyrings/docker.gpg &>> "$LOGFILE"
|
||||||
|
echo \
|
||||||
|
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
|
||||||
|
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list &>> "$LOGFILE"
|
||||||
|
apt update -y &>> "$LOGFILE"
|
||||||
|
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin &>> "$LOGFILE"
|
||||||
|
systemctl disable docker --now &>> "$LOGFILE"
|
||||||
|
systemctl disable docker.socket --now &>> "$LOGFILE"
|
||||||
|
echo "End installig docker" &>> "$LOGFILE"
|
||||||
|
}
|
||||||
|
|
||||||
## Main
|
## Main
|
||||||
echo "Starting PandoraFMS Community deployment Ubuntu 22.04 ver. $S_VERSION"
|
echo "Starting PandoraFMS Community deployment Ubuntu 22.04 ver. $S_VERSION"
|
||||||
|
|
||||||
@ -134,7 +152,10 @@ check_root_permissions
|
|||||||
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
|
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
|
||||||
|
|
||||||
#advicing BETA PROGRAM
|
#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
|
# Connectivity
|
||||||
check_repo_connection
|
check_repo_connection
|
||||||
@ -168,7 +189,7 @@ execute_cmd "cd $WORKDIR" "Moving to workdir: $WORKDIR"
|
|||||||
|
|
||||||
## Install utils
|
## Install utils
|
||||||
execute_cmd "apt update" "Updating repos"
|
execute_cmd "apt update" "Updating repos"
|
||||||
execute_cmd "apt install -y net-tools vim curl wget software-properties-common apt-transport-https" "Installing utils"
|
execute_cmd "apt install -y net-tools vim curl wget software-properties-common apt-transport-https ca-certificates gnupg lsb-release" "Installing utils"
|
||||||
|
|
||||||
#Installing Apache and php-fpm
|
#Installing Apache and php-fpm
|
||||||
[ -e "/etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list" ] || execute_cmd "add-apt-repository ppa:ondrej/php -y" "Enable ppa:ondrej/php repo"
|
[ -e "/etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list" ] || execute_cmd "add-apt-repository ppa:ondrej/php -y" "Enable ppa:ondrej/php repo"
|
||||||
@ -216,7 +237,8 @@ systemctl restart php$PHPVER-fpm &>> "$LOGFILE"
|
|||||||
php$PHPVER-xml \
|
php$PHPVER-xml \
|
||||||
php$PHPVER-yaml \
|
php$PHPVER-yaml \
|
||||||
libnet-telnet-perl \
|
libnet-telnet-perl \
|
||||||
whois"
|
whois \
|
||||||
|
cron"
|
||||||
execute_cmd "apt install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
|
execute_cmd "apt install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
|
||||||
|
|
||||||
# Server dependencies
|
# Server dependencies
|
||||||
@ -249,10 +271,13 @@ server_dependencies=" \
|
|||||||
libnet-telnet-perl \
|
libnet-telnet-perl \
|
||||||
libjson-perl \
|
libjson-perl \
|
||||||
libencode-perl \
|
libencode-perl \
|
||||||
|
cron \
|
||||||
libgeo-ip-perl \
|
libgeo-ip-perl \
|
||||||
openjdk-8-jdk "
|
openjdk-8-jdk "
|
||||||
execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
|
execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
|
||||||
|
|
||||||
|
execute_cmd "installing_docker" "Installing Docker for debug"
|
||||||
|
|
||||||
# wmic and pandorawmic
|
# wmic and pandorawmic
|
||||||
execute_cmd "curl -O https://firefly.artica.es/pandorafms/utils/bin/wmic" "Downloading wmic"
|
execute_cmd "curl -O https://firefly.artica.es/pandorafms/utils/bin/wmic" "Downloading wmic"
|
||||||
execute_cmd "curl -O https://firefly.artica.es/pandorafms/utils/bin/pandorawmic" "Downloading pandorawmic"
|
execute_cmd "curl -O https://firefly.artica.es/pandorafms/utils/bin/pandorawmic" "Downloading pandorawmic"
|
||||||
@ -272,13 +297,18 @@ echo -en "${cyan}Installing phantomjs...${reset}"
|
|||||||
/usr/bin/phantomjs --version &>> "$LOGFILE"
|
/usr/bin/phantomjs --version &>> "$LOGFILE"
|
||||||
check_cmd_status "Error Installing phanromjs"
|
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
|
# 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 "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 "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"
|
execute_cmd "ln -s /usr/bin/google-chrome /usr/bin/chromium-browser" "Creating /usr/bin/chromium-browser Symlink"
|
||||||
|
|
||||||
# SDK VMware perl dependencies
|
# SDK VMware perl dependencies
|
||||||
vmware_dependencies=" \
|
vmware_dependencies="\
|
||||||
lib32z1 \
|
lib32z1 \
|
||||||
lib32z1 \
|
lib32z1 \
|
||||||
build-essential \
|
build-essential \
|
||||||
@ -350,10 +380,12 @@ systemctl stop apparmor &>> "$LOGFILE"
|
|||||||
systemctl disable apparmor &>> "$LOGFILE"
|
systemctl disable apparmor &>> "$LOGFILE"
|
||||||
|
|
||||||
#install mysql
|
#install mysql
|
||||||
debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password password $DBROOTPASS") &>> "$LOGFILE"
|
execute_cmd "curl -O https://repo.percona.com/apt/percona-release_latest.generic_all.deb" "Downloading Percona repository for MySQL8"
|
||||||
debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password_again password $DBROOTPASS") &>> "$LOGFILE"
|
execute_cmd "apt install -y gnupg2 lsb-release ./percona-release_latest.generic_all.deb" "Installing Percona repository for MySQL8"
|
||||||
echo -en "${cyan}Installing MySql Server...${reset}"
|
execute_cmd "percona-release setup ps80" "Configuring Percona repository for MySQL8"
|
||||||
env DEBIAN_FRONTEND=noninteractive apt install -y mysql-server &>> "$LOGFILE"
|
|
||||||
|
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"
|
check_cmd_status "Error Installing MySql Server"
|
||||||
|
|
||||||
|
|
||||||
@ -361,6 +393,10 @@ check_cmd_status "Error Installing MySql Server"
|
|||||||
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
|
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
|
||||||
execute_cmd "systemctl start mysql" "Starting database engine"
|
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
|
export MYSQL_PWD=$DBROOTPASS
|
||||||
echo -en "${cyan}Creating Pandora FMS database...${reset}"
|
echo -en "${cyan}Creating Pandora FMS database...${reset}"
|
||||||
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
|
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
|
||||||
@ -377,7 +413,7 @@ cat > /etc/mysql/my.cnf << EOF_DB
|
|||||||
[mysqld]
|
[mysqld]
|
||||||
datadir=/var/lib/mysql
|
datadir=/var/lib/mysql
|
||||||
user=mysql
|
user=mysql
|
||||||
character-set-server=utf8
|
character-set-server=utf8mb4
|
||||||
skip-character-set-client-handshake
|
skip-character-set-client-handshake
|
||||||
# Disabling symbolic-links is recommended to prevent assorted security risks
|
# Disabling symbolic-links is recommended to prevent assorted security risks
|
||||||
symbolic-links=0
|
symbolic-links=0
|
||||||
@ -392,18 +428,19 @@ innodb_flush_log_at_trx_commit = 0
|
|||||||
innodb_flush_method = O_DIRECT
|
innodb_flush_method = O_DIRECT
|
||||||
innodb_log_file_size = 64M
|
innodb_log_file_size = 64M
|
||||||
innodb_log_buffer_size = 16M
|
innodb_log_buffer_size = 16M
|
||||||
innodb_io_capacity = 100
|
innodb_io_capacity = 300
|
||||||
thread_cache_size = 8
|
thread_cache_size = 8
|
||||||
thread_stack = 256K
|
thread_stack = 256K
|
||||||
max_connections = 100
|
max_connections = 100
|
||||||
|
|
||||||
key_buffer_size=4M
|
key_buffer_size=4M
|
||||||
read_buffer_size=128K
|
read_buffer_size=128K
|
||||||
|
|
||||||
read_rnd_buffer_size=128K
|
read_rnd_buffer_size=128K
|
||||||
sort_buffer_size=128K
|
sort_buffer_size=128K
|
||||||
join_buffer_size=4M
|
join_buffer_size=4M
|
||||||
|
|
||||||
|
skip-log-bin
|
||||||
|
|
||||||
sql_mode=""
|
sql_mode=""
|
||||||
|
|
||||||
log-error=/var/log/mysql/error.log
|
log-error=/var/log/mysql/error.log
|
||||||
@ -417,11 +454,17 @@ execute_cmd "systemctl restart mysql" "Configuring and restarting database engin
|
|||||||
|
|
||||||
|
|
||||||
#Define packages
|
#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_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_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"
|
[ "$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_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_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"
|
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz"
|
||||||
@ -454,7 +497,7 @@ check_cmd_status "Error installing PandoraFMS Agent"
|
|||||||
|
|
||||||
# Copy gotty utility
|
# Copy gotty utility
|
||||||
cd $WORKDIR &>> "$LOGFILE"
|
cd $WORKDIR &>> "$LOGFILE"
|
||||||
execute_cmd "wget https://pandorafms.com/library/wp-content/uploads/2019/11/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
|
execute_cmd "wget https://firefly.pandorafms.com/pandorafms/utils/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
|
||||||
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
|
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
|
||||||
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
|
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
|
||||||
|
|
||||||
@ -708,9 +751,14 @@ systemctl enable pandora_server &>> "$LOGFILE"
|
|||||||
execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
|
execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
|
||||||
systemctl enable tentacle_serverd &>> "$LOGFILE"
|
systemctl enable tentacle_serverd &>> "$LOGFILE"
|
||||||
|
|
||||||
# Enabling condole cron
|
# Enabling console 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"
|
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 http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
|
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 pandoradb cron
|
||||||
|
execute_cmd "echo 'enabling pandoradb cron' >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS pandoradb cron"
|
||||||
|
echo "@hourly root bash -c /etc/cron.hourly/pandora_db" >> /etc/crontab
|
||||||
|
|
||||||
|
|
||||||
## Enabling agent adn configuring Agente
|
## Enabling agent adn configuring Agente
|
||||||
sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF &>> "$LOGFILE"
|
sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF &>> "$LOGFILE"
|
||||||
@ -725,7 +773,7 @@ sed --follow-symlinks -i -e "s/^openssl_conf = openssl_init/#openssl_conf = open
|
|||||||
|
|
||||||
cat > /etc/issue.net << EOF_banner
|
cat > /etc/issue.net << EOF_banner
|
||||||
|
|
||||||
Welcome to Pandora FMS appliance on CentOS
|
Welcome to Pandora FMS appliance on Ubuntu
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
Go to Public http://$ipplublic/pandora_console$to to login web console
|
Go to Public http://$ipplublic/pandora_console$to to login web console
|
||||||
$(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to Local http://"$1"/pandora_console to login web console"}')
|
$(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to Local http://"$1"/pandora_console to login web console"}')
|
||||||
|
@ -277,8 +277,8 @@ export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64
|
|||||||
EOF_ENV
|
EOF_ENV
|
||||||
|
|
||||||
echo ">> Enable discovery cron: "
|
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 &
|
#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 http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/log/cron.log" >> /opt/pandora/crontasks
|
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: "
|
echo ">> Enable pandora_db cron: "
|
||||||
/usr/bin/perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf
|
/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
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.768, AIX version
|
# Version 7.0NG.769, AIX version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.768, FreeBSD Version
|
# Version 7.0NG.769, FreeBSD Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# 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,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.768, GNU/Linux
|
# Version 7.0NG.769, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.768, GNU/Linux
|
# Version 7.0NG.769, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.768, Solaris Version
|
# Version 7.0NG.769, Solaris Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Base config file for Pandora FMS Windows Agent
|
# Base config file for Pandora FMS Windows Agent
|
||||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
# (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
|
# 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
|
# 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
|
# Foundation; either version 2 of the Licence or any later version
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#
|
#
|
||||||
#Pandora FMS Linux Agent
|
#Pandora FMS Linux Agent
|
||||||
#
|
#
|
||||||
|
%global __os_install_post %{nil}
|
||||||
%define name pandorafms_agent_linux
|
%define name pandorafms_agent_linux
|
||||||
%define version 4.0
|
%define version 4.0
|
||||||
%define release 1
|
%define release 1
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#
|
#
|
||||||
#Pandora FMS Linux Agent
|
#Pandora FMS Linux Agent
|
||||||
#
|
#
|
||||||
|
%global __os_install_post %{nil}
|
||||||
%define name pandorafms_agent_linux
|
%define name pandorafms_agent_linux
|
||||||
%define version 4.0.1
|
%define version 4.0.1
|
||||||
%define release 1
|
%define release 1
|
||||||
|
@ -1,15 +1,8 @@
|
|||||||
#!/usr/bin/perl
|
#!/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
|
# Copyright (c) 2008-2023 Artica PFMS S.L.
|
||||||
# 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
|
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# 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
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
##########################################################################
|
################################################################################
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
use POSIX qw(WEXITSTATUS WIFEXITED);
|
||||||
|
|
||||||
# Check command line parameters
|
# Check command line arguments.
|
||||||
if ($#ARGV < 1) {
|
if ($#ARGV < 1) {
|
||||||
|
print("Usage: $0 <timeout in seconds> <command>\n");
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
my @opts = @ARGV;
|
my @opts = @ARGV;
|
||||||
my $timeout = shift(@opts);
|
my $timeout = shift(@opts);
|
||||||
my $command = join(' ', @opts);
|
my $command = ($0 =~ m/_agent_exec$/) ? # For backward compatibility with pandora_agent.
|
||||||
my $output = '';
|
join(' ', @opts) :
|
||||||
my $ReturnCode = 0;
|
join(' ', map { quotemeta($_) } @opts);
|
||||||
|
|
||||||
# Execute the command
|
# Fork:
|
||||||
eval {
|
# * The child will run the command.
|
||||||
local $SIG{ALRM} = sub { die "alarm\n" };
|
# * 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;
|
alarm $timeout;
|
||||||
|
waitpid($pid, 0);
|
||||||
$output = `$command`;
|
|
||||||
$ReturnCode = ($? >> 8) & 0xff;
|
|
||||||
alarm 0;
|
alarm 0;
|
||||||
};
|
if (WIFEXITED(${^CHILD_ERROR_NATIVE})) {
|
||||||
|
exit WEXITSTATUS(${^CHILD_ERROR_NATIVE});
|
||||||
# Timeout
|
}
|
||||||
if ($@ eq "alarm\n") {
|
};
|
||||||
exit 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print $output;
|
exit 1;
|
||||||
|
|
||||||
exit $ReturnCode;
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.768, AIX version
|
# Version 7.0NG.769, AIX version
|
||||||
|
|
||||||
# General Parameters
|
# General Parameters
|
||||||
# ==================
|
# ==================
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.768
|
# Version 7.0NG.769
|
||||||
# FreeBSD/IPSO version
|
# FreeBSD/IPSO version
|
||||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.768, HPUX Version
|
# Version 7.0NG.769, HPUX Version
|
||||||
|
|
||||||
# General Parameters
|
# General Parameters
|
||||||
# ==================
|
# ==================
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.768
|
# Version 7.0NG.769
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# please visit http://pandora.sourceforge.net
|
# please visit http://pandora.sourceforge.net
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#
|
#
|
||||||
#Pandora FMS Linux Agent
|
#Pandora FMS Linux Agent
|
||||||
#
|
#
|
||||||
|
%global __os_install_post %{nil}
|
||||||
%define name pandorafms_agent
|
%define name pandorafms_agent
|
||||||
%define version 3.2
|
%define version 3.2
|
||||||
Summary: Pandora FMS Linux agent
|
Summary: Pandora FMS Linux agent
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.768
|
# Version 7.0NG.769
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# please visit http://pandora.sourceforge.net
|
# please visit http://pandora.sourceforge.net
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.768
|
# Version 7.0NG.769
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# please visit http://pandora.sourceforge.net
|
# please visit http://pandora.sourceforge.net
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.768, Solaris version
|
# Version 7.0NG.769, Solaris version
|
||||||
|
|
||||||
# General Parameters
|
# General Parameters
|
||||||
# ==================
|
# ==================
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.768, AIX version
|
# Version 7.0NG.769, AIX version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.768
|
Version: 7.0NG.769-230313
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.768"
|
pandora_version="7.0NG.769-230313"
|
||||||
|
|
||||||
echo "Test if you has the tools for to make the packages."
|
echo "Test if you has the tools for to make the packages."
|
||||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||||
|
@ -31,7 +31,7 @@ fi
|
|||||||
if [ "$#" -ge 2 ]; then
|
if [ "$#" -ge 2 ]; then
|
||||||
VERSION="$2"
|
VERSION="$2"
|
||||||
else
|
else
|
||||||
VERSION="7.0NG.768"
|
VERSION="7.0NG.769"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Path for the generated DMG file
|
# Path for the generated DMG file
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
<choice id="com.pandorafms.pandorafms_src" visible="false">
|
<choice id="com.pandorafms.pandorafms_src" visible="false">
|
||||||
<pkg-ref id="com.pandorafms.pandorafms_src"/>
|
<pkg-ref id="com.pandorafms.pandorafms_src"/>
|
||||||
</choice>
|
</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">
|
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
|
||||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
|
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
|
||||||
</choice>
|
</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()" />
|
<!-- <installation-check script="check()" />
|
||||||
<script>
|
<script>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
|
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
|
||||||
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
|
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
|
||||||
|
|
||||||
<key>CFBundleVersion</key> <string>7.0NG.768</string>
|
<key>CFBundleVersion</key> <string>7.0NG.769</string>
|
||||||
<key>CFBundleGetInfoString</key> <string>7.0NG.768 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</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.768</string>
|
<key>CFBundleShortVersionString</key> <string>7.0NG.769</string>
|
||||||
|
|
||||||
<key>NSPrincipalClass</key><string>NSApplication</string>
|
<key>NSPrincipalClass</key><string>NSApplication</string>
|
||||||
<key>NSMainNibFile</key><string>MainMenu</string>
|
<key>NSMainNibFile</key><string>MainMenu</string>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.768, GNU/Linux
|
# Version 7.0NG.769, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.768, FreeBSD Version
|
# Version 7.0NG.769, FreeBSD Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# 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,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.768, GNU/Linux
|
# Version 7.0NG.769, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.768, GNU/Linux
|
# Version 7.0NG.769, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.768, NetBSD Version
|
# Version 7.0NG.769, NetBSD Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.768, Solaris Version
|
# Version 7.0NG.769, Solaris Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -556,10 +556,19 @@ BEGIN {
|
|||||||
sub runCommand {
|
sub runCommand {
|
||||||
my ($self, $ref, $output_mode) = @_;
|
my ($self, $ref, $output_mode) = @_;
|
||||||
|
|
||||||
|
my $result;
|
||||||
if($self->load_libraries()) {
|
if($self->load_libraries()) {
|
||||||
# Functionality possible.
|
# Functionality possible.
|
||||||
my $command = $self->{'commands'}->{$ref};
|
my $command = $self->{'commands'}->{$ref};
|
||||||
my $result = $self->evaluate_command($ref);
|
$result = $self->evaluate_command($ref);
|
||||||
|
} else {
|
||||||
|
$result = {
|
||||||
|
'stderr' => 'Cannot use commands without YAML dependency, please install it.',
|
||||||
|
'name' => 'YAML::Tiny',
|
||||||
|
'error_level' => 2,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (ref($result) eq "HASH") {
|
if (ref($result) eq "HASH") {
|
||||||
# Process command result.
|
# Process command result.
|
||||||
if (defined($output_mode) && $output_mode eq 'xml') {
|
if (defined($output_mode) && $output_mode eq 'xml') {
|
||||||
@ -580,7 +589,6 @@ BEGIN {
|
|||||||
} else {
|
} else {
|
||||||
$self->set_last_error('Failed to process ['.$ref.']: '.$result);
|
$self->set_last_error('Failed to process ['.$ref.']: '.$result);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
@ -1014,8 +1022,8 @@ my $Sem = undef;
|
|||||||
# Semaphore used to control the number of threads
|
# Semaphore used to control the number of threads
|
||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
use constant AGENT_VERSION => '7.0NG.768';
|
use constant AGENT_VERSION => '7.0NG.769';
|
||||||
use constant AGENT_BUILD => '230119';
|
use constant AGENT_BUILD => '230313';
|
||||||
|
|
||||||
# Agent log default file size maximum and instances
|
# Agent log default file size maximum and instances
|
||||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#
|
#
|
||||||
#Pandora FMS Linux Agent
|
#Pandora FMS Linux Agent
|
||||||
#
|
#
|
||||||
|
%global __os_install_post %{nil}
|
||||||
%define name pandorafms_agent_linux
|
%define name pandorafms_agent_linux
|
||||||
%define version 7.0NG.768
|
%define version 7.0NG.769
|
||||||
%define release 1
|
%define release 230313
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#
|
#
|
||||||
#Pandora FMS Linux Agent
|
#Pandora FMS Linux Agent
|
||||||
#
|
#
|
||||||
|
%global __os_install_post %{nil}
|
||||||
%define name pandorafms_agent_linux
|
%define name pandorafms_agent_linux
|
||||||
%define version 7.0NG.768
|
%define version 7.0NG.769
|
||||||
%define release 1
|
%define release 230313
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -1,15 +1,8 @@
|
|||||||
#!/usr/bin/perl
|
#!/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
|
# Copyright (c) 2008-2023 Artica PFMS S.L.
|
||||||
# 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
|
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# 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
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
##########################################################################
|
################################################################################
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
use POSIX qw(WEXITSTATUS WIFEXITED);
|
||||||
|
|
||||||
# Check command line parameters
|
# Check command line arguments.
|
||||||
if ($#ARGV < 1) {
|
if ($#ARGV < 1) {
|
||||||
|
print("Usage: $0 <timeout in seconds> <command>\n");
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
my @opts = @ARGV;
|
my @opts = @ARGV;
|
||||||
my $timeout = shift(@opts);
|
my $timeout = shift(@opts);
|
||||||
my $command = join(' ', @opts);
|
my $command = ($0 =~ m/_agent_exec$/) ? # For backward compatibility with pandora_agent.
|
||||||
my $output = '';
|
join(' ', @opts) :
|
||||||
my $ReturnCode = 0;
|
join(' ', map { quotemeta($_) } @opts);
|
||||||
|
|
||||||
# Execute the command
|
# Fork:
|
||||||
eval {
|
# * The child will run the command.
|
||||||
local $SIG{ALRM} = sub { die "alarm\n" };
|
# * 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;
|
alarm $timeout;
|
||||||
|
waitpid($pid, 0);
|
||||||
$output = `$command`;
|
|
||||||
$ReturnCode = ($? >> 8) & 0xff;
|
|
||||||
alarm 0;
|
alarm 0;
|
||||||
};
|
if (WIFEXITED(${^CHILD_ERROR_NATIVE})) {
|
||||||
|
exit WEXITSTATUS(${^CHILD_ERROR_NATIVE});
|
||||||
# Timeout
|
}
|
||||||
if ($@ eq "alarm\n") {
|
};
|
||||||
exit 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print $output;
|
exit 1;
|
||||||
|
|
||||||
exit $ReturnCode;
|
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.768"
|
PI_VERSION="7.0NG.769"
|
||||||
PI_BUILD="230119"
|
PI_BUILD="230313"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Base config file for Pandora FMS Windows Agent
|
# Base config file for Pandora FMS Windows Agent
|
||||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
# (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
|
# 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
|
# 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
|
# Foundation; either version 2 of the Licence or any later version
|
||||||
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||||||
{Yes}
|
{Yes}
|
||||||
|
|
||||||
AppName
|
AppName
|
||||||
{Pandora FMS Windows Agent v7.0NG.768}
|
{Pandora FMS Windows Agent v7.0NG.769}
|
||||||
|
|
||||||
ApplicationID
|
ApplicationID
|
||||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||||
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Version
|
Version
|
||||||
{230119}
|
{230313}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
|
|||||||
{No}
|
{No}
|
||||||
|
|
||||||
Windows,Executable
|
Windows,Executable
|
||||||
{<%AppName%>-Setup<%Ext%>}
|
{<%AppName%>-<%Version%>-Setup<%Ext%>}
|
||||||
|
|
||||||
Windows,FileDescription
|
Windows,FileDescription
|
||||||
{<%AppName%> <%Version%> Setup}
|
{<%AppName%> <%Version%> Setup}
|
||||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||||||
using namespace Pandora_Strutils;
|
using namespace Pandora_Strutils;
|
||||||
|
|
||||||
#define PATH_SIZE _MAX_PATH+1
|
#define PATH_SIZE _MAX_PATH+1
|
||||||
#define PANDORA_VERSION ("7.0NG.768 Build 230119")
|
#define PANDORA_VERSION ("7.0NG.769 Build 230313")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
@ -11,7 +11,7 @@ BEGIN
|
|||||||
VALUE "LegalCopyright", "Artica ST"
|
VALUE "LegalCopyright", "Artica ST"
|
||||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||||
VALUE "ProductVersion", "(7.0NG.768(Build 230119))"
|
VALUE "ProductVersion", "(7.0NG.769(Build 230313))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.768
|
Version: 7.0NG.769-230313
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.768"
|
pandora_version="7.0NG.769-230313"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -377,17 +377,17 @@ function mainAgentsModules()
|
|||||||
|
|
||||||
$fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&pure=1&
|
$fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&pure=1&
|
||||||
offset='.$offset.'&group_id='.$group_id.'&modulegroup='.$modulegroup.'&refresh='.$refr.'&full_modules_selected='.$full_modules.'&show_type='.$show_type.'
|
offset='.$offset.'&group_id='.$group_id.'&modulegroup='.$modulegroup.'&refresh='.$refr.'&full_modules_selected='.$full_modules.'&show_type='.$show_type.'
|
||||||
&full_agents_id='.$full_agents.'&selection_agent_module='.$selection_a_m.'">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).'</a>';
|
&full_agents_id='.$full_agents.'&selection_agent_module='.$selection_a_m.'">'.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).'</a>';
|
||||||
} else if ($full_modules_selected[0] && $full_agents_id[0]) {
|
} else if ($full_modules_selected[0] && $full_agents_id[0]) {
|
||||||
$full_modules = urlencode(implode(';', $full_modules_selected));
|
$full_modules = urlencode(implode(';', $full_modules_selected));
|
||||||
$full_agents = urlencode(implode(';', $full_agents_id));
|
$full_agents = urlencode(implode(';', $full_agents_id));
|
||||||
|
|
||||||
$fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&pure=1&
|
$fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&pure=1&
|
||||||
offset='.$offset.'&group_id='.$group_id.'&modulegroup='.$modulegroup.'&refresh='.$refr.'&full_modules_selected='.$full_modules.'&show_type='.$show_type.'
|
offset='.$offset.'&group_id='.$group_id.'&modulegroup='.$modulegroup.'&refresh='.$refr.'&full_modules_selected='.$full_modules.'&show_type='.$show_type.'
|
||||||
&full_agents_id='.$full_agents.'&selection_agent_module='.$selection_a_m.'">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).'</a>';
|
&full_agents_id='.$full_agents.'&selection_agent_module='.$selection_a_m.'">'.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).'</a>';
|
||||||
} else {
|
} else {
|
||||||
$fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&pure=1&
|
$fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&pure=1&
|
||||||
offset='.$offset.'&group_id='.$group_id.'&modulegroup='.$modulegroup.'&refresh='.$refr.'&show_type='.$show_type.'">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).'</a>';
|
offset='.$offset.'&group_id='.$group_id.'&modulegroup='.$modulegroup.'&refresh='.$refr.'&show_type='.$show_type.'">'.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,18 +397,56 @@ function mainAgentsModules()
|
|||||||
1 => __('Show module data'),
|
1 => __('Show module data'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$filter_type_label = '<b>'.__('Information to be shown').'</b>';
|
$filter_type = html_print_label_input_block(
|
||||||
$filter_type = html_print_select($show_select, 'show_type', $show_type, '', '', 0, true, false, false, '', false, 'min-width: 180px;');
|
__('Information to be shown'),
|
||||||
|
html_print_select(
|
||||||
|
$show_select,
|
||||||
|
'show_type',
|
||||||
|
$show_type,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'width: 100%;'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// Groups.
|
$filter_groups = html_print_label_input_block(
|
||||||
$filter_groups_label = '<b>'.__('Group').'</b>';
|
__('Group'),
|
||||||
$filter_groups = html_print_select_groups(false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: auto;');
|
html_print_select_groups(
|
||||||
|
false,
|
||||||
|
'AR',
|
||||||
|
true,
|
||||||
|
'group_id',
|
||||||
|
$group_id,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'width: 100%;'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$filter_recursion_label = '</td><td><b>'.__('Recursion').'</b>';
|
$filter_groups .= html_print_label_input_block(
|
||||||
$filter_recursion = html_print_checkbox('recursion', 1, 0, true).'</td>';
|
__('Recursion'),
|
||||||
// Groups module.
|
html_print_checkbox_switch('recursion', 1, 0, true),
|
||||||
$filter_module_groups_label = '<b>'.__('Module group').'</b>';
|
[
|
||||||
$filter_module_groups = html_print_select_from_sql(
|
'div_class' => 'add-input-reverse',
|
||||||
|
'label_class' => 'label-thin',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$filter_module_groups = html_print_label_input_block(
|
||||||
|
__('Module group'),
|
||||||
|
html_print_select_from_sql(
|
||||||
'SELECT * FROM tmodule_group ORDER BY name',
|
'SELECT * FROM tmodule_group ORDER BY name',
|
||||||
'modulegroup',
|
'modulegroup',
|
||||||
$modulegroup,
|
$modulegroup,
|
||||||
@ -419,39 +457,79 @@ function mainAgentsModules()
|
|||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
'width: auto;'
|
'width: 100%;'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Agent.
|
|
||||||
$agents = agents_get_group_agents($group_id);
|
$agents = agents_get_group_agents($group_id);
|
||||||
if ((empty($agents)) || $agents == -1) {
|
if ((empty($agents)) || $agents == -1) {
|
||||||
$agents = [];
|
$agents = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter_agents_label = '<b>'.__('Agents').'</b>';
|
$filter_agents = html_print_label_input_block(
|
||||||
$filter_agents = html_print_select($agents, 'id_agents2[]', $agents_id, '', '', 0, true, true, true, '', false, 'min-width: 180px; max-width: 200px;');
|
__('Agents'),
|
||||||
|
html_print_select(
|
||||||
|
$agents,
|
||||||
|
'id_agents2[]',
|
||||||
|
$agents_id,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'width: 100%;'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// Type show.
|
// Type show.
|
||||||
$selection = [
|
$selection = [
|
||||||
0 => __('Show common modules'),
|
0 => __('Show common modules'),
|
||||||
1 => __('Show all modules'),
|
1 => __('Show all modules'),
|
||||||
];
|
];
|
||||||
$filter_type_show_label = '<b>'.__('Show common modules').'</b>';
|
$filter_type_show = html_print_label_input_block(
|
||||||
$filter_type_show = html_print_select($selection, 'selection_agent_module', $selection_a_m, '', '', 0, true, false, true, '', false, 'min-width: 180px;');
|
__('Show common modules'),
|
||||||
|
html_print_select(
|
||||||
|
$selection,
|
||||||
|
'selection_agent_module',
|
||||||
|
$selection_a_m,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'width: 100%;'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// Modules.
|
// Modules.
|
||||||
$all_modules = select_modules_for_agent_group($group_id, $agents_id, $selection_a_m, false);
|
$all_modules = select_modules_for_agent_group($group_id, $agents_id, $selection_a_m, false);
|
||||||
$filter_modules_label = '<b>'.__('Module').'</b>';
|
$filter_modules = html_print_label_input_block(
|
||||||
$filter_modules = html_print_select($all_modules, 'module[]', $modules_selected, '', '', 0, true, true, false, '', false, 'min-width: 180px; max-width: 200px;');
|
__('Module'),
|
||||||
|
html_print_select(
|
||||||
// Update.
|
$all_modules,
|
||||||
$filter_update = html_print_submit_button(__('Update item'), 'edit_item', false, 'class="sub upd"', true);
|
'module[]',
|
||||||
|
$modules_selected,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'width: 100%;'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$onheader = [
|
$onheader = [
|
||||||
'updated_time' => $updated_time,
|
'updated_time' => $updated_time,
|
||||||
'fullscreen' => $fullscreen,
|
'fullscreen' => $fullscreen,
|
||||||
'combo_module_groups' => $filter_module_groups,
|
|
||||||
'combo_groups' => $filter_groups,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -467,7 +545,7 @@ function mainAgentsModules()
|
|||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
(array) $updated_time,
|
$onheader,
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'link' => '',
|
'link' => '',
|
||||||
@ -479,12 +557,6 @@ function mainAgentsModules()
|
|||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '<table class="w100p">';
|
|
||||||
echo '<tr>';
|
|
||||||
echo "<td> <span class='float-right'>".$fullscreen['text'].'</span> </td>';
|
|
||||||
echo '</tr>';
|
|
||||||
echo '</table>';
|
|
||||||
} else {
|
} else {
|
||||||
if ($full_agents_id[0]) {
|
if ($full_agents_id[0]) {
|
||||||
$full_modules = urlencode(implode(';', $full_modules_selected));
|
$full_modules = urlencode(implode(';', $full_modules_selected));
|
||||||
@ -525,11 +597,11 @@ function mainAgentsModules()
|
|||||||
echo '<li class="nomn">';
|
echo '<li class="nomn">';
|
||||||
echo '<a target="_top" href="'.$url.'">';
|
echo '<a target="_top" href="'.$url.'">';
|
||||||
echo html_print_image(
|
echo html_print_image(
|
||||||
'images/normal_screen.png',
|
'images/exit_fullscreen@svg.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'title' => __('Back to normal mode'),
|
'title' => __('Back to normal mode'),
|
||||||
'class' => 'invert_filter',
|
'class' => 'main_menu_icon invert_filter',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
echo '</a>';
|
echo '</a>';
|
||||||
@ -574,35 +646,46 @@ function mainAgentsModules()
|
|||||||
|
|
||||||
if ($config['pure'] != 1) {
|
if ($config['pure'] != 1) {
|
||||||
$show_filters = '<form method="post" action="'.ui_get_url_refresh(['offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup]).'" class="w100p">';
|
$show_filters = '<form method="post" action="'.ui_get_url_refresh(['offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup]).'" class="w100p">';
|
||||||
$show_filters .= '<table class="w100p no-border" cellpadding="15" cellspacing="0" border="0">';
|
$show_filters .= '<table class="filter-table-adv w100p no-border" cellpadding="4" cellspacing="4">';
|
||||||
$show_filters .= '<tr>';
|
$show_filters .= '<tr>';
|
||||||
$show_filters .= '<td>'.$filter_type_label.'</td>';
|
$show_filters .= '<td width="33%">'.$filter_type.'</td>';
|
||||||
$show_filters .= '<td>'.$filter_type.'</td>';
|
$show_filters .= '<td width="33%">'.$filter_groups.'</td>';
|
||||||
|
$show_filters .= '<td width="33%">'.$filter_module_groups.'</td>';
|
||||||
$show_filters .= '</tr>';
|
$show_filters .= '</tr>';
|
||||||
$show_filters .= '<tr>';
|
$show_filters .= '<tr>';
|
||||||
$show_filters .= '<td>'.$filter_groups_label.'</td>';
|
|
||||||
$show_filters .= '<td>'.$filter_groups.' '.$filter_recursion_label.$filter_recursion.'</td>';
|
|
||||||
$show_filters .= '<td></td>';
|
|
||||||
$show_filters .= '<td></td>';
|
|
||||||
$show_filters .= '<td>'.$filter_module_groups_label.'</td>';
|
|
||||||
$show_filters .= '<td>'.$filter_module_groups.'</td>';
|
|
||||||
$show_filters .= '</tr>';
|
|
||||||
$show_filters .= '<tr>';
|
|
||||||
$show_filters .= '<td>'.$filter_agents_label.'</td>';
|
|
||||||
$show_filters .= '<td>'.$filter_agents.'</td>';
|
$show_filters .= '<td>'.$filter_agents.'</td>';
|
||||||
$show_filters .= '<td>'.$filter_type_show_label.'</td>';
|
|
||||||
$show_filters .= '<td>'.$filter_type_show.'</td>';
|
$show_filters .= '<td>'.$filter_type_show.'</td>';
|
||||||
$show_filters .= '<td>'.$filter_modules_label.'</td>';
|
|
||||||
$show_filters .= '<td>'.$filter_modules.'</td>';
|
$show_filters .= '<td>'.$filter_modules.'</td>';
|
||||||
$show_filters .= '</tr>';
|
$show_filters .= '</tr>';
|
||||||
$show_filters .= '<tr>';
|
|
||||||
$show_filters .= "<td colspan=6 ><span class='right pdd_r_35px mrgn_top_25px'>".$filter_update.'</span></td>';
|
|
||||||
$show_filters .= '</tr>';
|
|
||||||
$show_filters .= '</table>';
|
$show_filters .= '</table>';
|
||||||
|
$show_filters .= html_print_div(
|
||||||
|
[
|
||||||
|
'class' => 'action-buttons',
|
||||||
|
'content' => html_print_submit_button(
|
||||||
|
__('Filter'),
|
||||||
|
'srcbutton',
|
||||||
|
false,
|
||||||
|
[
|
||||||
|
'icon' => 'search',
|
||||||
|
'mode' => 'mini',
|
||||||
|
],
|
||||||
|
true
|
||||||
|
),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
$show_filters .= '</form>';
|
$show_filters .= '</form>';
|
||||||
|
|
||||||
ui_toggle(
|
ui_toggle(
|
||||||
$show_filters,
|
$show_filters,
|
||||||
__('Filters ').ui_print_help_tip(__('Secondary groups and agent subgroups will be taken into account.'), true)
|
'<span class="subsection_header_title">'.__('Filters ').'</span>'.ui_print_help_tip(__('Secondary groups and agent subgroups will be taken into account.'), true),
|
||||||
|
'filter_form',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'white-box-content',
|
||||||
|
'box-flat white_table_graph fixed_filter_bar'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -751,11 +834,11 @@ function mainAgentsModules()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<table cellpadding="4" cellspacing="4" border="0" class="agents_modules_table w100p">';
|
echo '<table cellpadding="4" cellspacing="4" border="0" class="info_table mrgn_btn_20px">';
|
||||||
|
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
|
|
||||||
echo "<th width='140px' class='pdd_r_10px lign_right'>".__('Agents').' / '.__('Modules').'</th>';
|
echo "<th width='140px' class='pdd_r_10px align_right'>".__('Agents').' / '.__('Modules').'</th>';
|
||||||
|
|
||||||
if ($hor_offset > 0) {
|
if ($hor_offset > 0) {
|
||||||
$new_hor_offset = ($hor_offset - $block);
|
$new_hor_offset = ($hor_offset - $block);
|
||||||
@ -804,7 +887,20 @@ function mainAgentsModules()
|
|||||||
|
|
||||||
// Prepare pagination.
|
// Prepare pagination.
|
||||||
$url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m;
|
$url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m;
|
||||||
ui_pagination($total_pagination, $url);
|
$tablePagination = ui_pagination(
|
||||||
|
$total_pagination,
|
||||||
|
$url,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
'offset',
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
html_print_action_buttons(
|
||||||
|
'',
|
||||||
|
[ 'right_content' => $tablePagination ]
|
||||||
|
);
|
||||||
|
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
// Get stats for this group.
|
// Get stats for this group.
|
||||||
|
@ -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);
|
$curlObj = curl_init($url);
|
||||||
if (empty($data) === false) {
|
if (empty($data) === false) {
|
||||||
$url .= http_build_query($data);
|
$url .= http_build_query($data);
|
||||||
@ -186,129 +195,183 @@ function extension_api_checker()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_page_header(
|
// Header.
|
||||||
__('API checker'),
|
ui_print_standard_header(
|
||||||
|
__('Extensions'),
|
||||||
'images/extensions.png',
|
'images/extensions.png',
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
true,
|
true,
|
||||||
''
|
[],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Admin tools'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Extension manager'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('API checker'),
|
||||||
|
],
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->class = 'databox filters filter-table-adv';
|
||||||
|
$table->size[0] = '50%';
|
||||||
|
$table->size[1] = '50%';
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
$row[] = __('IP');
|
$row[] = html_print_label_input_block(
|
||||||
$row[] = html_print_input_text('ip', $ip, '', 50, 255, true);
|
__('IP'),
|
||||||
|
html_print_input_text('ip', $ip, '', 50, 255, true)
|
||||||
|
);
|
||||||
|
|
||||||
|
$row[] = html_print_label_input_block(
|
||||||
|
__('%s Console URL', get_product_name()),
|
||||||
|
html_print_input_text('pandora_url', $pandora_url, '', 50, 255, true)
|
||||||
|
);
|
||||||
$table->data[] = $row;
|
$table->data[] = $row;
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
$row[] = __('%s Console URL', get_product_name());
|
$row[] = html_print_label_input_block(
|
||||||
$row[] = html_print_input_text('pandora_url', $pandora_url, '', 50, 255, true);
|
__('API Token').ui_print_help_tip(__('Use API Token instead API Pass, User and Password.'), true),
|
||||||
|
html_print_input_text('token', $token, '', 50, 255, true)
|
||||||
|
);
|
||||||
|
|
||||||
|
$row[] = html_print_label_input_block(
|
||||||
|
__('API Pass'),
|
||||||
|
html_print_input_password('apipass', $apipass, '', 50, 255, true)
|
||||||
|
);
|
||||||
$table->data[] = $row;
|
$table->data[] = $row;
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
$row[] = __('API Token').ui_print_help_tip(__('Use API Token instead API Pass, User and Password.'), true);
|
$row[] = html_print_label_input_block(
|
||||||
$row[] = html_print_input_text('token', $token, '', 50, 255, true);
|
__('User'),
|
||||||
$table->data[] = $row;
|
html_print_input_text('user', $user, '', 50, 255, true)
|
||||||
|
);
|
||||||
|
|
||||||
$row = [];
|
$row[] = html_print_label_input_block(
|
||||||
$row[] = __('API Pass');
|
__('Password'),
|
||||||
$row[] = html_print_input_password('apipass', $apipass, '', 50, 255, true);
|
html_print_input_password('password', $password, '', 50, 255, true)
|
||||||
$table->data[] = $row;
|
);
|
||||||
|
|
||||||
$row = [];
|
|
||||||
$row[] = __('User');
|
|
||||||
$row[] = html_print_input_text('user', $user, '', 50, 255, true);
|
|
||||||
$table->data[] = $row;
|
|
||||||
|
|
||||||
$row = [];
|
|
||||||
$row[] = __('Password');
|
|
||||||
$row[] = html_print_input_password('password', $password, '', 50, 255, true);
|
|
||||||
$table->data[] = $row;
|
$table->data[] = $row;
|
||||||
|
|
||||||
$table2 = new stdClass();
|
$table2 = new stdClass();
|
||||||
|
$table2->width = '100%';
|
||||||
|
$table2->class = 'databox filters filter-table-adv';
|
||||||
|
$table2->size[0] = '50%';
|
||||||
|
$table2->size[1] = '50%';
|
||||||
$table2->data = [];
|
$table2->data = [];
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
$row[] = __('Action (get or set)');
|
$row[] = html_print_label_input_block(
|
||||||
$row[] = html_print_input_text('op', $op, '', 50, 255, true);
|
__('Action (get or set)'),
|
||||||
|
html_print_input_text('op', $op, '', 50, 255, true)
|
||||||
|
);
|
||||||
|
|
||||||
|
$row[] = html_print_label_input_block(
|
||||||
|
__('Operation'),
|
||||||
|
html_print_input_text('op2', $op2, '', 50, 255, true)
|
||||||
|
);
|
||||||
$table2->data[] = $row;
|
$table2->data[] = $row;
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
$row[] = __('Operation');
|
$row[] = html_print_label_input_block(
|
||||||
$row[] = html_print_input_text('op2', $op2, '', 50, 255, true);
|
__('ID'),
|
||||||
|
html_print_input_text('id', $id, '', 50, 255, true)
|
||||||
|
);
|
||||||
|
|
||||||
|
$row[] = html_print_label_input_block(
|
||||||
|
__('ID 2'),
|
||||||
|
html_print_input_text('id2', $id2, '', 50, 255, true)
|
||||||
|
);
|
||||||
$table2->data[] = $row;
|
$table2->data[] = $row;
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
$row[] = __('ID');
|
$row[] = html_print_label_input_block(
|
||||||
$row[] = html_print_input_text('id', $id, '', 50, 255, true);
|
__('Return Type'),
|
||||||
|
html_print_input_text('return_type', $return_type, '', 50, 255, true)
|
||||||
|
);
|
||||||
|
|
||||||
|
$row[] = html_print_label_input_block(
|
||||||
|
__('Other'),
|
||||||
|
html_print_input_text('other', $other, '', 50, 255, true)
|
||||||
|
);
|
||||||
$table2->data[] = $row;
|
$table2->data[] = $row;
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
$row[] = __('ID 2');
|
$row[] = html_print_label_input_block(
|
||||||
$row[] = html_print_input_text('id2', $id2, '', 50, 255, true);
|
__('Other Mode'),
|
||||||
$table2->data[] = $row;
|
html_print_input_text('other_mode', $other_mode, '', 50, 255, true)
|
||||||
|
);
|
||||||
$row = [];
|
|
||||||
$row[] = __('Return Type');
|
|
||||||
$row[] = html_print_input_text('return_type', $return_type, '', 50, 255, true);
|
|
||||||
$table2->data[] = $row;
|
|
||||||
|
|
||||||
$row = [];
|
|
||||||
$row[] = __('Other');
|
|
||||||
$row[] = html_print_input_text('other', $other, '', 50, 255, true);
|
|
||||||
$table2->data[] = $row;
|
|
||||||
|
|
||||||
$row = [];
|
|
||||||
$row[] = __('Other Mode');
|
|
||||||
$row[] = html_print_input_text('other_mode', $other_mode, '', 50, 255, true);
|
|
||||||
$table2->data[] = $row;
|
$table2->data[] = $row;
|
||||||
|
|
||||||
$table3 = new stdClass();
|
$table3 = new stdClass();
|
||||||
|
$table3->width = '100%';
|
||||||
|
$table3->class = 'databox filters filter-table-adv';
|
||||||
|
$table3->size[0] = '50%';
|
||||||
|
$table3->size[1] = '50%';
|
||||||
$table3->data = [];
|
$table3->data = [];
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
$row[] = __('Raw URL');
|
$row[] = html_print_label_input_block(
|
||||||
$row[] = html_print_input_text('url', $url, '', 50, 2048, true);
|
__('Raw URL'),
|
||||||
|
html_print_input_text('url', $url, '', 50, 2048, true)
|
||||||
|
);
|
||||||
$table3->data[] = $row;
|
$table3->data[] = $row;
|
||||||
|
|
||||||
echo "<form method='post'>";
|
echo "<form method='post' class='max_floating_element_size'>";
|
||||||
echo '<fieldset>';
|
echo '<fieldset class="mrgn_btn_10px">';
|
||||||
echo '<legend>'.__('Credentials').'</legend>';
|
echo '<legend>'.__('Credentials').'</legend>';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
echo '</fieldset>';
|
echo '</fieldset>';
|
||||||
|
|
||||||
echo '<fieldset>';
|
echo '<fieldset class="mrgn_btn_10px">';
|
||||||
echo '<legend>'.__('Call parameters').' '.ui_print_help_tip(__('Action: get Operation: module_last_value id: 63'), true).'</legend>';
|
echo '<legend>'.__('Call parameters').' '.ui_print_help_tip(__('Action: get Operation: module_last_value id: 63'), true).'</legend>';
|
||||||
html_print_table($table2);
|
html_print_table($table2);
|
||||||
echo '</fieldset>';
|
echo '</fieldset>';
|
||||||
echo "<div class='right'>";
|
echo "<div class='right'>";
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
echo '<fieldset>';
|
echo '<fieldset class="mrgn_btn_10px">';
|
||||||
echo '<legend>'.__('Custom URL').'</legend>';
|
echo '<legend>'.__('Custom URL').'</legend>';
|
||||||
html_print_table($table3);
|
html_print_table($table3);
|
||||||
echo '</fieldset>';
|
echo '</fieldset>';
|
||||||
|
|
||||||
echo "<div class='right'>";
|
|
||||||
html_print_input_hidden('api_execute', 1);
|
html_print_input_hidden('api_execute', 1);
|
||||||
html_print_submit_button(__('Call'), 'submit', false, 'class="sub next"');
|
|
||||||
echo '</div>';
|
html_print_action_buttons(
|
||||||
|
html_print_submit_button(
|
||||||
|
__('Call'),
|
||||||
|
'submit',
|
||||||
|
false,
|
||||||
|
[ 'icon' => 'next' ],
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
if ($api_execute === true) {
|
if ($api_execute === true) {
|
||||||
echo '<fieldset>';
|
echo '<fieldset class="mrgn_0px mrgn_btn_10px pdd_15px" style="max-width: 1122px;">';
|
||||||
echo '<legend>'.__('Result').'</legend>';
|
echo '<legend>'.__('Result').'</legend>';
|
||||||
echo __('URL').'<br />';
|
echo html_print_label_input_block(
|
||||||
html_print_input_password('url', $return_call_api['url'], '', 150, 255, false, true);
|
__('URL'),
|
||||||
echo " <a id='show_icon' title='".__('Show URL')."' href='javascript: show_url();'>";
|
html_print_input_password('url', $return_call_api['url'], '', 150, 255, true, true, false, 'mrgn_top_10px'),
|
||||||
html_print_image('images/input_zoom.png');
|
['label_class' => 'font-title-font']
|
||||||
echo '</a>';
|
);
|
||||||
echo '<br />';
|
echo '<br />';
|
||||||
echo __('Result').'<br />';
|
echo html_print_label_input_block(
|
||||||
html_print_textarea('result', 30, 20, $return_call_api['result'], 'readonly="readonly"');
|
__('Result'),
|
||||||
|
html_print_textarea('result', 30, 20, $return_call_api['result'], 'readonly="readonly"', true, 'w100p mrgn_top_10px'),
|
||||||
|
['label_class' => 'font-title-font']
|
||||||
|
);
|
||||||
echo '</fieldset>';
|
echo '</fieldset>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -21,13 +21,23 @@ function extension_db_status()
|
|||||||
$db_name = get_parameter('db_name', '');
|
$db_name = get_parameter('db_name', '');
|
||||||
$db_status_execute = (bool) get_parameter('db_status_execute', false);
|
$db_status_execute = (bool) get_parameter('db_status_execute', false);
|
||||||
|
|
||||||
ui_print_page_header(
|
ui_print_standard_header(
|
||||||
__('DB Schema check'),
|
__('DB Schema check'),
|
||||||
'images/extensions.png',
|
'images/extensions.png',
|
||||||
false,
|
false,
|
||||||
'db_status_tab',
|
'db_status_tab',
|
||||||
true,
|
true,
|
||||||
''
|
[],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Admin tools'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Run test'),
|
||||||
|
],
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!is_user_admin($config['id_user'])) {
|
if (!is_user_admin($config['id_user'])) {
|
||||||
@ -46,32 +56,89 @@ function extension_db_status()
|
|||||||
__('At the moment the checks is for MySQL/MariaDB.')
|
__('At the moment the checks is for MySQL/MariaDB.')
|
||||||
);
|
);
|
||||||
|
|
||||||
echo "<form method='post'>";
|
echo "<form method='post' class='max_floating_element_size'>";
|
||||||
|
|
||||||
echo '<fieldset>';
|
echo '<fieldset>';
|
||||||
echo '<legend>'.__('DB settings').'</legend>';
|
echo '<legend>'.__('DB settings').'</legend>';
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
$row = [];
|
$row = [];
|
||||||
$row[] = __('DB User with privileges');
|
$row[] = html_print_label_input_block(
|
||||||
$row[] = html_print_input_text('db_user', $db_user, '', 50, 255, true);
|
__('DB User with privileges'),
|
||||||
$row[] = __('DB Password for this user');
|
html_print_input_text(
|
||||||
$row[] = html_print_input_password('db_password', $db_password, '', 50, 255, true);
|
'db_user',
|
||||||
|
$db_user,
|
||||||
|
'',
|
||||||
|
50,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'w100p mrgn_top_10px'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$row[] = html_print_label_input_block(
|
||||||
|
__('DB Password for this user'),
|
||||||
|
html_print_input_password(
|
||||||
|
'db_password',
|
||||||
|
$db_password,
|
||||||
|
'',
|
||||||
|
50,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'w100p mrgn_top_10px'
|
||||||
|
)
|
||||||
|
);
|
||||||
$table->data[] = $row;
|
$table->data[] = $row;
|
||||||
$row = [];
|
$row = [];
|
||||||
$row[] = __('DB Hostname');
|
$row[] = html_print_label_input_block(
|
||||||
$row[] = html_print_input_text('db_host', $db_host, '', 50, 255, true);
|
__('DB Hostname'),
|
||||||
$row[] = __('DB Name (temporal for testing)');
|
html_print_input_text(
|
||||||
$row[] = html_print_input_text('db_name', $db_name, '', 50, 255, true);
|
'db_host',
|
||||||
|
$db_host,
|
||||||
|
'',
|
||||||
|
50,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'w100p mrgn_top_10px'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$row[] = html_print_label_input_block(
|
||||||
|
__('DB Name (temporal for testing)'),
|
||||||
|
html_print_input_text(
|
||||||
|
'db_name',
|
||||||
|
$db_name,
|
||||||
|
'',
|
||||||
|
50,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'w100p mrgn_top_10px'
|
||||||
|
)
|
||||||
|
);
|
||||||
$table->data[] = $row;
|
$table->data[] = $row;
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
echo '</fieldset>';
|
echo '</fieldset>';
|
||||||
|
|
||||||
echo "<div class='right'>";
|
html_print_action_buttons(
|
||||||
html_print_input_hidden('db_status_execute', 1);
|
html_print_submit_button(
|
||||||
html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub next"');
|
__('Execute Test'),
|
||||||
echo '</div>';
|
'submit',
|
||||||
|
false,
|
||||||
|
[ 'icon' => 'cog' ],
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
html_print_input_hidden('db_status_execute', 1);
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
if ($db_status_execute) {
|
if ($db_status_execute) {
|
||||||
|
@ -76,10 +76,6 @@ function dbmgr_extension_main()
|
|||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (is_metaconsole() === true) {
|
|
||||||
open_meta_frame();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_user_admin($config['id_user'])) {
|
if (!is_user_admin($config['id_user'])) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
AUDIT_LOG_ACL_VIOLATION,
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
@ -92,7 +88,21 @@ function dbmgr_extension_main()
|
|||||||
$sql = (string) get_parameter('sql');
|
$sql = (string) get_parameter('sql');
|
||||||
$node_id = (int) get_parameter('node_id', -1);
|
$node_id = (int) get_parameter('node_id', -1);
|
||||||
|
|
||||||
ui_print_page_header(__('Database interface'), 'images/gm_db.png', false, false, true);
|
// Header.
|
||||||
|
ui_print_standard_header(
|
||||||
|
__('Database interface'),
|
||||||
|
'images/gm_db.png',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
[],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Extensions'),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
if (is_metaconsole() === true) {
|
if (is_metaconsole() === true) {
|
||||||
$img = '../../images/warning_modern.png';
|
$img = '../../images/warning_modern.png';
|
||||||
@ -122,27 +132,8 @@ function dbmgr_extension_main()
|
|||||||
echo $warning_message;
|
echo $warning_message;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<form method='post' action=''>";
|
ui_print_warning_message(
|
||||||
|
__(
|
||||||
$table = new stdClass();
|
|
||||||
$table->id = 'db_interface';
|
|
||||||
$table->class = 'databox';
|
|
||||||
$table->width = '100%';
|
|
||||||
$table->data = [];
|
|
||||||
$table->head = [];
|
|
||||||
$table->colspan = [];
|
|
||||||
$table->rowstyle = [];
|
|
||||||
|
|
||||||
$table->colspan[0][0] = 2;
|
|
||||||
$table->colspan[1][0] = 2;
|
|
||||||
$table->rowspan[2][0] = 3;
|
|
||||||
|
|
||||||
$table->rowclass[0] = 'notify';
|
|
||||||
$table->rowclass[3] = 'pdd_5px';
|
|
||||||
$table->rowclass[3] = 'flex-content-right';
|
|
||||||
$table->rowclass[4] = 'flex-content-right';
|
|
||||||
|
|
||||||
$data[0][0] = __(
|
|
||||||
"This is an advanced extension to interface with %s database directly from WEB console
|
"This is an advanced extension to interface with %s database directly from WEB console
|
||||||
using native SQL sentences. Please note that <b>you can damage</b> your %s installation
|
using native SQL sentences. Please note that <b>you can damage</b> your %s installation
|
||||||
if you don't know </b>exactly</b> what are you are doing,
|
if you don't know </b>exactly</b> what are you are doing,
|
||||||
@ -152,17 +143,26 @@ function dbmgr_extension_main()
|
|||||||
get_product_name(),
|
get_product_name(),
|
||||||
get_product_name(),
|
get_product_name(),
|
||||||
get_product_name()
|
get_product_name()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$data[1][0] = "Some samples of usage: <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>";
|
echo "<form method='post' action=''>";
|
||||||
|
|
||||||
$data[2][0] = html_print_textarea(
|
$table = new stdClass();
|
||||||
'sql',
|
$table->id = 'db_interface';
|
||||||
5,
|
$table->class = 'databox no_border filter-table-adv';
|
||||||
50,
|
$table->width = '100%';
|
||||||
html_entity_decode($sql, ENT_QUOTES),
|
$table->data = [];
|
||||||
'',
|
$table->colspan = [];
|
||||||
true
|
$table->style[0] = 'width: 30%;';
|
||||||
|
$table->style[1] = 'width: 70%;';
|
||||||
|
|
||||||
|
$table->colspan[1][0] = 2;
|
||||||
|
|
||||||
|
$data[0][0] = "<b>Some samples of usage:</b> <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>";
|
||||||
|
$data[0][0] = html_print_label_input_block(
|
||||||
|
__('Some samples of usage:'),
|
||||||
|
"<blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (is_metaconsole() === true) {
|
if (is_metaconsole() === true) {
|
||||||
@ -181,32 +181,57 @@ function dbmgr_extension_main()
|
|||||||
$servers = [];
|
$servers = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[3][2] = html_print_input(
|
$data[0][1] = html_print_label_input_block(
|
||||||
[
|
__('Select query target'),
|
||||||
'name' => 'node_id',
|
html_print_select(
|
||||||
'type' => 'select',
|
$servers,
|
||||||
'fields' => $servers,
|
'node_id',
|
||||||
'selected' => $node_id,
|
$node_id,
|
||||||
'nothing' => __('This metaconsole'),
|
'',
|
||||||
'nothing_value' => -1,
|
__('This metaconsole'),
|
||||||
'return' => true,
|
-1,
|
||||||
'label' => _('Select query target'),
|
true,
|
||||||
]
|
false,
|
||||||
|
false,
|
||||||
|
'w40p',
|
||||||
|
false,
|
||||||
|
'width: 40%;'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[4][2] = '<div class="action-buttons w100p">';
|
$data[1][0] = html_print_textarea(
|
||||||
$data[4][2] .= html_print_submit_button(
|
'sql',
|
||||||
|
3,
|
||||||
|
50,
|
||||||
|
html_entity_decode($sql, ENT_QUOTES),
|
||||||
|
'placeholder="'.__('Type your query here...').'"',
|
||||||
|
true,
|
||||||
|
'w100p'
|
||||||
|
);
|
||||||
|
|
||||||
|
$execute_button = html_print_submit_button(
|
||||||
__('Execute SQL'),
|
__('Execute SQL'),
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
'class="sub next"',
|
[ 'icon' => 'cog' ],
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
$data[4][2] .= '</div>';
|
|
||||||
|
|
||||||
$table->data = $data;
|
$table->data = $data;
|
||||||
html_print_table($table);
|
// html_print_table($table);
|
||||||
|
html_print_action_buttons($execute_button);
|
||||||
|
ui_toggle(
|
||||||
|
html_print_table($table, true),
|
||||||
|
'<span class="subsection_header_title">'.__('SQL query').'</span>',
|
||||||
|
__('SQL query'),
|
||||||
|
'query',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'white-box-content no_border',
|
||||||
|
'box-flat white_table_graph fixed_filter_bar'
|
||||||
|
);
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
// Processing SQL Code.
|
// Processing SQL Code.
|
||||||
@ -214,10 +239,6 @@ function dbmgr_extension_main()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<br />';
|
|
||||||
echo '<hr />';
|
|
||||||
echo '<br />';
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (\is_metaconsole() === true && $node_id !== -1) {
|
if (\is_metaconsole() === true && $node_id !== -1) {
|
||||||
$node = new Node($node_id);
|
$node = new Node($node_id);
|
||||||
@ -227,7 +248,7 @@ function dbmgr_extension_main()
|
|||||||
'dbport' => $node->dbport(),
|
'dbport' => $node->dbport(),
|
||||||
'dbname' => $node->dbname(),
|
'dbname' => $node->dbname(),
|
||||||
'dbuser' => $node->dbuser(),
|
'dbuser' => $node->dbuser(),
|
||||||
'dbpass' => $node->dbpass(),
|
'dbpass' => io_output_password($node->dbpass()),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$error = '';
|
$error = '';
|
||||||
@ -282,22 +303,17 @@ function dbmgr_extension_main()
|
|||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
if (is_metaconsole()) {
|
|
||||||
close_meta_frame();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (is_metaconsole() === true) {
|
if (is_metaconsole() === true) {
|
||||||
// This adds a option in the operation menu.
|
// This adds a option in the operation menu.
|
||||||
extensions_add_meta_menu_option(
|
extensions_add_meta_menu_option(
|
||||||
'DB interface',
|
__('DB interface'),
|
||||||
'PM',
|
'PM',
|
||||||
'gextensions',
|
'gextensions',
|
||||||
'database.png',
|
'database.png',
|
||||||
'v1r1',
|
'v1r1'
|
||||||
'gdbman'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
extensions_add_meta_function('dbmgr_extension_main');
|
extensions_add_meta_function('dbmgr_extension_main');
|
||||||
|
@ -24,7 +24,6 @@ table.dbmanager th {
|
|||||||
}
|
}
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
min-height: 50px;
|
width: 100% !important;
|
||||||
height: 50px;
|
max-width: 100% !important;
|
||||||
width: 95%;
|
|
||||||
}
|
}
|
||||||
|
@ -25,13 +25,28 @@ function extension_uploader_extensions()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_page_header(
|
// Header.
|
||||||
__('Uploader extension'),
|
ui_print_standard_header(
|
||||||
|
__('Extensions'),
|
||||||
'images/extensions.png',
|
'images/extensions.png',
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
true,
|
true,
|
||||||
''
|
[],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Admin tools'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Extension manager'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Uploader extension'),
|
||||||
|
],
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$upload = (bool) get_parameter('upload', 0);
|
$upload = (bool) get_parameter('upload', 0);
|
||||||
@ -77,20 +92,52 @@ function extension_uploader_extensions()
|
|||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
|
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->class = 'databox filters';
|
$table->class = 'databox filters filter-table-adv';
|
||||||
|
$table->size[0] = '20%';
|
||||||
|
$table->size[1] = '20%';
|
||||||
|
$table->size[2] = '60%';
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
$table->data[0][0] = __('Upload extension');
|
|
||||||
$table->data[0][1] = html_print_input_file('extension', true).ui_print_help_tip(__('Upload the extension as a zip file.'), true);
|
$table->data[0][0] = html_print_label_input_block(
|
||||||
|
__('Upload extension').ui_print_help_tip(__('Upload the extension as a zip file.'), true),
|
||||||
|
html_print_input_file(
|
||||||
|
'extension',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'required' => true,
|
||||||
|
'accept' => '.zip',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
$table->data[0][2] = __('Upload enterprise extension').' '.html_print_checkbox('upload_enterprise', 1, false, true);
|
$table->data[0][1] = html_print_label_input_block(
|
||||||
|
__('Upload enterprise extension'),
|
||||||
|
html_print_checkbox(
|
||||||
|
'upload_enterprise',
|
||||||
|
1,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$table->data[0][1] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$table->data[0][2] = '';
|
||||||
|
|
||||||
echo "<form method='post' enctype='multipart/form-data'>";
|
echo "<form method='post' enctype='multipart/form-data'>";
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
echo "<div class='right' style='width: ".$table->width."'>";
|
|
||||||
html_print_input_hidden('upload', 1);
|
html_print_input_hidden('upload', 1);
|
||||||
html_print_submit_button(__('Upload'), 'submit', false, 'class="sub add"');
|
html_print_action_buttons(
|
||||||
echo '</div>';
|
html_print_submit_button(
|
||||||
|
__('Upload'),
|
||||||
|
'submit',
|
||||||
|
false,
|
||||||
|
['icon' => 'wand'],
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,19 +115,41 @@ function pandora_files_repo_godmode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Header tabs.
|
// Header tabs.
|
||||||
$godmode['text'] = '<a href="index.php?sec=godmode/extensions&sec2=extensions/files_repo">'.html_print_image('images/setup.png', true, ['title' => __('Administration view'), 'class' => 'invert_filter']).'</a>';
|
$godmode['text'] = '<a href="index.php?sec=godmode/extensions&sec2=extensions/files_repo">'.html_print_image('images/configuration@svg.svg', true, ['title' => __('Administration view'), 'class' => 'main_menu_icon invert_filter']).'</a>';
|
||||||
$godmode['godmode'] = 1;
|
$godmode['godmode'] = 1;
|
||||||
$godmode['active'] = 1;
|
$godmode['active'] = 1;
|
||||||
|
|
||||||
$operation['text'] = '<a href="index.php?sec=extensions&sec2=extensions/files_repo">'.html_print_image('images/eye_show.png', true, ['title' => __('Operation view'), 'class' => 'invert_filter']).'</a>';
|
$operation['text'] = '<a href="index.php?sec=extensions&sec2=extensions/files_repo">'.html_print_image('images/see-details@svg.svg', true, ['title' => __('Operation view'), 'class' => 'main_menu_icon invert_filter']).'</a>';
|
||||||
$operation['operation'] = 1;
|
$operation['operation'] = 1;
|
||||||
|
|
||||||
$onheader = [
|
$onheader = [
|
||||||
'godmode' => $godmode,
|
'godmode' => $godmode,
|
||||||
'operation' => $operation,
|
'operation' => $operation,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Header.
|
// Header.
|
||||||
ui_print_page_header(__('Files repository manager'), 'images/extensions.png', false, '', true, $onheader);
|
ui_print_standard_header(
|
||||||
|
__('Extensions'),
|
||||||
|
'images/extensions.png',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
$onheader,
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Admin tools'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Extension manager'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Files repository manager'),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
$full_extensions_dir = $config['homedir'].'/'.EXTENSIONS_DIR.'/';
|
$full_extensions_dir = $config['homedir'].'/'.EXTENSIONS_DIR.'/';
|
||||||
include_once $full_extensions_dir.'files_repo/functions_files_repo.php';
|
include_once $full_extensions_dir.'files_repo/functions_files_repo.php';
|
||||||
@ -204,10 +226,10 @@ function pandora_files_repo_operation()
|
|||||||
// Header tabs.
|
// Header tabs.
|
||||||
$onheader = [];
|
$onheader = [];
|
||||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||||
$godmode['text'] = '<a href="index.php?sec=godmode/extensions&sec2=extensions/files_repo">'.html_print_image('images/setup.png', true, ['title' => __('Administration view'), 'class' => 'invert_filter']).'</a>';
|
$godmode['text'] = '<a href="index.php?sec=godmode/extensions&sec2=extensions/files_repo">'.html_print_image('images/configuration@svg.svg', true, ['title' => __('Administration view'), 'class' => 'main_menu_icon invert_filter']).'</a>';
|
||||||
$godmode['godmode'] = 1;
|
$godmode['godmode'] = 1;
|
||||||
|
|
||||||
$operation['text'] = '<a href="index.php?sec=extensions&sec2=extensions/files_repo">'.html_print_image('images/eye_show.png', true, ['title' => __('Operation view'), 'class' => 'invert_filter']).'</a>';
|
$operation['text'] = '<a href="index.php?sec=extensions&sec2=extensions/files_repo">'.html_print_image('images/see-details@svg.svg', true, ['title' => __('Operation view'), 'class' => 'main_menu_icon invert_filter']).'</a>';
|
||||||
$operation['operation'] = 1;
|
$operation['operation'] = 1;
|
||||||
$operation['active'] = 1;
|
$operation['active'] = 1;
|
||||||
|
|
||||||
|
@ -32,17 +32,15 @@ if (isset($file_id) && $file_id > 0) {
|
|||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->class = 'databox filters';
|
$table->class = 'databox filters filter-table-adv';
|
||||||
$table->style = [];
|
$table->size[0] = '50%';
|
||||||
$table->style[0] = 'font-weight: bold;';
|
$table->size[1] = '50%';
|
||||||
$table->style[2] = 'text-align: center;';
|
|
||||||
$table->colspan = [];
|
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
|
||||||
// GROUPS
|
// GROUPS.
|
||||||
$groups = groups_get_all();
|
$groups = groups_get_all();
|
||||||
// Add the All group to the beginning to be always the first
|
// Add the All group to the beginning to be always the first.
|
||||||
// Use this instead array_unshift to keep the array keys
|
// Use this instead array_unshift to keep the array keys.
|
||||||
$groups = ([0 => __('All')] + $groups);
|
$groups = ([0 => __('All')] + $groups);
|
||||||
$groups_selected = [];
|
$groups_selected = [];
|
||||||
foreach ($groups as $id => $name) {
|
foreach ($groups as $id => $name) {
|
||||||
@ -52,8 +50,9 @@ foreach ($groups as $id => $name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
$row[0] = __('Groups');
|
$row[0] = html_print_label_input_block(
|
||||||
$row[1] = '<div class="w290px">'.html_print_select_groups(
|
__('Groups'),
|
||||||
|
html_print_select_groups(
|
||||||
// Id_user.
|
// Id_user.
|
||||||
false,
|
false,
|
||||||
// Privilege.
|
// Privilege.
|
||||||
@ -74,44 +73,87 @@ $row[1] = '<div class="w290px">'.html_print_select_groups(
|
|||||||
true,
|
true,
|
||||||
// Multiple.
|
// Multiple.
|
||||||
true
|
true
|
||||||
).'</div>';
|
)
|
||||||
$table->data[] = $row;
|
);
|
||||||
$table->colspan[][1] = 3;
|
|
||||||
|
|
||||||
// DESCRIPTION
|
// DESCRIPTION.
|
||||||
$row = [];
|
$row[1] = html_print_label_input_block(
|
||||||
$row[0] = __('Description');
|
__('Description').ui_print_help_tip(__('Only 200 characters are permitted'), true),
|
||||||
$row[0] .= ui_print_help_tip(__('Only 200 characters are permitted'), true);
|
html_print_textarea(
|
||||||
$row[1] = html_print_textarea('description', 3, 20, $file['description'], 'class="file_repo_description"', true);
|
'description',
|
||||||
|
4,
|
||||||
|
20,
|
||||||
|
$file['description'],
|
||||||
|
'class="file_repo_description" style="min-height: 60px; max-height: 60px;"',
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
$table->data[] = $row;
|
$table->data[] = $row;
|
||||||
$table->colspan[][1] = 3;
|
|
||||||
|
|
||||||
// FILE and SUBMIT BUTTON
|
// FILE and SUBMIT BUTTON.
|
||||||
$row = [];
|
$row = [];
|
||||||
// Public checkbox
|
// Public checkbox.
|
||||||
$checkbox = html_print_checkbox('public', 1, (bool) !empty($file['hash']), true);
|
$checkbox = html_print_checkbox('public', 1, (bool) !empty($file['hash']), true);
|
||||||
$style = 'class="inline padding-2-10"';
|
$style = 'class="inline padding-2-10"';
|
||||||
|
|
||||||
$row[0] = __('File');
|
$row[0] = __('File');
|
||||||
if ($file_id > 0) {
|
if ($file_id > 0) {
|
||||||
$row[1] = $file['name'];
|
$submit_button = html_print_submit_button(
|
||||||
$row[2] = "<div $style>".__('Public link')." $checkbox</div>";
|
__('Update'),
|
||||||
$row[3] = html_print_submit_button(__('Update'), 'submit', false, 'class="sub upd"', true);
|
'submit',
|
||||||
$row[3] .= html_print_input_hidden('update_file', 1, true);
|
false,
|
||||||
$row[3] .= html_print_input_hidden('file_id', $file_id, true);
|
['icon' => 'wand'],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$row[0] = html_print_label_input_block(
|
||||||
|
__('File'),
|
||||||
|
$file['name']
|
||||||
|
);
|
||||||
|
|
||||||
|
$row[1] = html_print_label_input_block(
|
||||||
|
__('Public link'),
|
||||||
|
$checkbox.html_print_input_hidden(
|
||||||
|
'file_id',
|
||||||
|
$file_id,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$row[1] = html_print_input_file('upfile', true);
|
$submit_button = html_print_submit_button(
|
||||||
$row[2] = "<div $style>".__('Public link')." $checkbox</div>";
|
__('Add'),
|
||||||
$row[3] = html_print_submit_button(__('Add'), 'submit', false, 'class="sub add"', true);
|
'submit',
|
||||||
$row[3] .= html_print_input_hidden('add_file', 1, true);
|
false,
|
||||||
|
['icon' => 'wand'],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$row[0] = html_print_label_input_block(
|
||||||
|
__('File'),
|
||||||
|
html_print_input_file(
|
||||||
|
'upfile',
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$row[1] = html_print_label_input_block(
|
||||||
|
__('Public link'),
|
||||||
|
$checkbox.html_print_input_hidden(
|
||||||
|
'add_file',
|
||||||
|
1,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$table->data[] = $row;
|
$table->data[] = $row;
|
||||||
$table->colspan[][1] = 1;
|
|
||||||
|
|
||||||
$url = ui_get_full_url('index.php?sec=godmode/extensions&sec2=extensions/files_repo');
|
$url = ui_get_full_url('index.php?sec=godmode/extensions&sec2=extensions/files_repo');
|
||||||
echo "<form method='post' action='$url' enctype='multipart/form-data'>";
|
echo "<form method='post' action='$url' enctype='multipart/form-data'>";
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
html_print_action_buttons($submit_button);
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -98,7 +98,7 @@ if (!empty($files)) {
|
|||||||
// Last modification
|
// Last modification
|
||||||
// Public URL
|
// Public URL
|
||||||
$data[4] = '';
|
$data[4] = '';
|
||||||
$table->cellclass[][4] = 'action_buttons';
|
$table->cellclass[][4] = 'table_action_buttons';
|
||||||
if (!empty($file['hash'])) {
|
if (!empty($file['hash'])) {
|
||||||
$public_url = ui_get_full_url(
|
$public_url = ui_get_full_url(
|
||||||
EXTENSIONS_DIR.'/files_repo/files_repo_get_file.php?file='.$file['hash']
|
EXTENSIONS_DIR.'/files_repo/files_repo_get_file.php?file='.$file['hash']
|
||||||
@ -133,9 +133,12 @@ if (!empty($files)) {
|
|||||||
);
|
);
|
||||||
$data[4] .= "<a href=\"$config_url\">";
|
$data[4] .= "<a href=\"$config_url\">";
|
||||||
$data[4] .= html_print_image(
|
$data[4] .= html_print_image(
|
||||||
'images/config.png',
|
'images/edit.svg',
|
||||||
true,
|
true,
|
||||||
['title' => __('Edit')]
|
[
|
||||||
|
'title' => __('Edit'),
|
||||||
|
'class' => 'main_menu_icon invert_filter',
|
||||||
|
]
|
||||||
);
|
);
|
||||||
// Edit image
|
// Edit image
|
||||||
$data[4] .= '</a>';
|
$data[4] .= '</a>';
|
||||||
@ -145,11 +148,11 @@ if (!empty($files)) {
|
|||||||
);
|
);
|
||||||
$data[4] .= " <a href=\"$delete_url\" onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\">";
|
$data[4] .= " <a href=\"$delete_url\" onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\">";
|
||||||
$data[4] .= html_print_image(
|
$data[4] .= html_print_image(
|
||||||
'images/cross.png',
|
'images/delete.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'title' => __('Delete'),
|
'title' => __('Delete'),
|
||||||
'class' => 'invert_filter',
|
'class' => 'main_menu_icon invert_filter',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
// Delete image
|
// Delete image
|
||||||
|
@ -1,16 +1,32 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Insert Data form.
|
||||||
|
*
|
||||||
|
* @category Extension.
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Load global vars.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; 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.
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
require_once $config['homedir'].'/include/functions_agents.php';
|
require_once $config['homedir'].'/include/functions_agents.php';
|
||||||
@ -55,7 +71,24 @@ function mainInsertData()
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
ui_print_page_header(__('Insert data'), 'images/extensions.png', false, '', true, '');
|
ui_print_standard_header(
|
||||||
|
__('Insert Data'),
|
||||||
|
'images/extensions.png',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
[],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Resources'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Insert Data'),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW') && ! is_user_admin($config['id_user'])) {
|
if (! check_acl($config['id_user'], 0, 'AW') && ! is_user_admin($config['id_user'])) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
@ -84,6 +117,13 @@ function mainInsertData()
|
|||||||
$csv = false;
|
$csv = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui_print_warning_message(
|
||||||
|
sprintf(
|
||||||
|
__('Please check that the directory "%s" is writeable by the apache user. <br /><br />The CSV file format is date;value<newline>date;value<newline>... The date in CSV is in format Y/m/d H:i:s.'),
|
||||||
|
$config['remote_config']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if ($save) {
|
if ($save) {
|
||||||
if (!check_acl($config['id_user'], agents_get_agent_group($agent_id), 'AW')) {
|
if (!check_acl($config['id_user'], agents_get_agent_group($agent_id), 'AW')) {
|
||||||
ui_print_error_message(__('You haven\'t privileges for insert data in the agent.'));
|
ui_print_error_message(__('You haven\'t privileges for insert data in the agent.'));
|
||||||
@ -140,27 +180,25 @@ function mainInsertData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class="notify mrg_btt_15">';
|
$modules = [];
|
||||||
echo sprintf(
|
if ($agent_id > 0) {
|
||||||
__('Please check that the directory "%s" is writeable by the apache user. <br /><br />The CSV file format is date;value<newline>date;value<newline>... The date in CSV is in format Y/m/d H:i:s.'),
|
$modules = agents_get_modules($agent_id, false, ['delete_pending' => 0]);
|
||||||
$config['remote_config']
|
}
|
||||||
);
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->class = 'databox filter-table-adv';
|
||||||
$table->class = 'databox filters';
|
|
||||||
$table->style = [];
|
$table->style = [];
|
||||||
$table->style[0] = 'font-weight: bolder;';
|
$table->cellstyle[0][0] = 'width: 0';
|
||||||
|
$table->cellstyle[0][1] = 'width: 0';
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
$table->data[0][0] = '<label>'.__('Agent').'</label>';
|
||||||
$table->data[0][0] = __('Agent');
|
$table->data[0][1] = '<label>'.__('Module').'</label>';
|
||||||
|
$table->data[0][2] = '<label>'.__('Date').'</label>';
|
||||||
$params = [];
|
$params = [];
|
||||||
$params['return'] = true;
|
$params['return'] = true;
|
||||||
$params['show_helptip'] = true;
|
$params['show_helptip'] = true;
|
||||||
$params['input_name'] = 'agent_name';
|
$params['input_name'] = 'agent_name';
|
||||||
$params['value'] = $agent_name;
|
$params['value'] = ($save === true) ? '' : $agent_name;
|
||||||
$params['javascript_is_function_select'] = true;
|
$params['javascript_is_function_select'] = true;
|
||||||
$params['javascript_name_function_select'] = 'custom_select_function';
|
$params['javascript_name_function_select'] = 'custom_select_function';
|
||||||
$params['javascript_code_function_select'] = '';
|
$params['javascript_code_function_select'] = '';
|
||||||
@ -170,18 +208,12 @@ function mainInsertData()
|
|||||||
$params['hidden_input_idagent_name'] = 'agent_id';
|
$params['hidden_input_idagent_name'] = 'agent_id';
|
||||||
$params['hidden_input_idagent_value'] = $agent_id;
|
$params['hidden_input_idagent_value'] = $agent_id;
|
||||||
|
|
||||||
$table->data[0][1] = ui_print_agent_autocomplete_input($params);
|
$table->data[1][0] = html_print_div(['class' => 'flex flex-items-center', 'content' => ui_print_agent_autocomplete_input($params)], true);
|
||||||
|
|
||||||
$table->data[1][0] = __('Module');
|
|
||||||
$modules = [];
|
|
||||||
if ($agent_id) {
|
|
||||||
$modules = agents_get_modules($agent_id, false, ['delete_pending' => 0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->data[1][1] = html_print_select(
|
$table->data[1][1] = html_print_select(
|
||||||
$modules,
|
$modules,
|
||||||
'id_agent_module',
|
'id_agent_module',
|
||||||
$id_agent_module,
|
($save === true) ? '' : $id_agent_module,
|
||||||
true,
|
true,
|
||||||
__('Select'),
|
__('Select'),
|
||||||
0,
|
0,
|
||||||
@ -191,22 +223,45 @@ function mainInsertData()
|
|||||||
'',
|
'',
|
||||||
empty($agent_id)
|
empty($agent_id)
|
||||||
);
|
);
|
||||||
$table->data[2][0] = __('Data');
|
$table->data[1][2] = html_print_input_text('data', ($save === true) ? date(DATE_FORMAT) : $data, __('Data'), 10, 60, true);
|
||||||
$table->data[2][1] = html_print_input_text('data', $data, __('Data'), 40, 60, true);
|
$table->data[1][2] .= ' ';
|
||||||
$table->data[3][0] = __('Date');
|
$table->data[1][2] .= html_print_input_text('time', ($save === true) ? date(TIME_FORMAT) : $time, '', 10, 7, true);
|
||||||
$table->data[3][1] = html_print_input_text('date', $date, '', 11, 11, true).' ';
|
|
||||||
$table->data[3][1] .= html_print_input_text('time', $time, '', 7, 7, true);
|
$table->data[2][0] = '<label>'.__('Data').'</label>';
|
||||||
$table->data[4][0] = __('CSV');
|
$table->data[2][1] = '<label>'.__('CSV').'</label>';
|
||||||
$table->data[4][1] = html_print_input_file('csv', true);
|
$table->data[3][0] = html_print_input_text(
|
||||||
|
'data',
|
||||||
|
$data,
|
||||||
|
__('Data'),
|
||||||
|
40,
|
||||||
|
60,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table->data[3][1] = html_print_div(
|
||||||
|
[
|
||||||
|
'class' => '',
|
||||||
|
'content' => html_print_input_file('csv', true),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
echo "<form method='post' enctype='multipart/form-data'>";
|
echo "<form method='post' enctype='multipart/form-data'>";
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
echo "<div class='right' style='width: ".$table->width."'>";
|
|
||||||
html_print_input_hidden('save', 1);
|
html_print_input_hidden('save', 1);
|
||||||
html_print_submit_button(__('Save'), 'submit', ($id_agent === ''), 'class="sub next"');
|
|
||||||
echo '</div>';
|
html_print_action_buttons(
|
||||||
|
html_print_submit_button(
|
||||||
|
__('Save'),
|
||||||
|
'submit',
|
||||||
|
// (empty($id_agent) === true),
|
||||||
|
false,
|
||||||
|
[ 'icon' => 'next' ],
|
||||||
|
true
|
||||||
|
),
|
||||||
|
['type' => 'form_action']
|
||||||
|
);
|
||||||
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
@ -257,8 +312,8 @@ function mainInsertData()
|
|||||||
$('#id_agent_module').enable();
|
$('#id_agent_module').enable();
|
||||||
$('#id_agent_module').fadeIn ('normal');
|
$('#id_agent_module').fadeIn ('normal');
|
||||||
|
|
||||||
$('#submit-submit').enable();
|
$('button [name="submit"]').removeClass('disabled_action_button');
|
||||||
$('#submit-submit').fadeIn ('normal');
|
$('button [name="submit"]').fadeIn ('normal');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -266,24 +266,68 @@ function mainModuleGroups()
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
echo "<table cellpadding='4' cellspacing='4' class='databox filters bolder margin-bottom-10' width='100%'>
|
$output = "<form method='post'
|
||||||
<tr>";
|
|
||||||
echo "<form method='post'
|
|
||||||
action='index.php?sec=view&sec2=extensions/module_groups'>";
|
action='index.php?sec=view&sec2=extensions/module_groups'>";
|
||||||
|
|
||||||
echo '<td>';
|
$output .= "<table cellpadding='4' cellspacing='4' class='filter-table-adv margin-bottom-10' width='100%'><tr>";
|
||||||
echo __('Search by agent group').' ';
|
$output .= '<td>';
|
||||||
html_print_input_text('agent_group_search', $agent_group_search);
|
$output .= html_print_label_input_block(
|
||||||
|
__('Search by agent group'),
|
||||||
|
html_print_input_text(
|
||||||
|
'agent_group_search',
|
||||||
|
$agent_group_search,
|
||||||
|
'',
|
||||||
|
50,
|
||||||
|
255,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
echo '</td><td>';
|
$output .= '</td><td>';
|
||||||
echo __('Search by module group').' ';
|
$output .= html_print_label_input_block(
|
||||||
html_print_input_text('module_group_search', $module_group_search);
|
__('Search by module group'),
|
||||||
|
html_print_input_text(
|
||||||
|
'module_group_search',
|
||||||
|
$module_group_search,
|
||||||
|
'',
|
||||||
|
50,
|
||||||
|
255,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$output .= '</td>';
|
||||||
|
$output .= '</tr></table>';
|
||||||
|
|
||||||
echo '</td><td>';
|
$output .= html_print_div(
|
||||||
echo "<input name='srcbutton' type='submit' class='sub search' value='".__('Search')."'>";
|
[
|
||||||
echo '</form>';
|
'class' => 'action-buttons',
|
||||||
echo '<td>';
|
'content' => html_print_submit_button(
|
||||||
echo '</tr></table>';
|
__('Filter'),
|
||||||
|
'srcbutton',
|
||||||
|
false,
|
||||||
|
[
|
||||||
|
'icon' => 'search',
|
||||||
|
'mode' => 'mini',
|
||||||
|
],
|
||||||
|
true
|
||||||
|
),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$output .= '</form>';
|
||||||
|
|
||||||
|
ui_toggle(
|
||||||
|
$output,
|
||||||
|
'<span class="subsection_header_title">'.__('Filters').'</span>',
|
||||||
|
'filter_form',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'white-box-content',
|
||||||
|
'box-flat white_table_graph fixed_filter_bar'
|
||||||
|
);
|
||||||
|
|
||||||
$cell_style = '
|
$cell_style = '
|
||||||
min-width: 60px;
|
min-width: 60px;
|
||||||
@ -299,26 +343,35 @@ function mainModuleGroups()
|
|||||||
|
|
||||||
if ($info && $array_module_group) {
|
if ($info && $array_module_group) {
|
||||||
$table = new StdClass();
|
$table = new StdClass();
|
||||||
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;';
|
$table->class = 'info_table';
|
||||||
|
$table->style[0] = 'font-weight: bolder; min-width: 230px;';
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
|
|
||||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
|
||||||
$background_color = '#333';
|
|
||||||
} else {
|
|
||||||
$background_color = '#fff';
|
|
||||||
}
|
|
||||||
|
|
||||||
$head[0] = __('Groups');
|
$head[0] = __('Groups');
|
||||||
$headstyle[0] = 'width: 20%; font-weight: bolder;';
|
$headstyle[0] = 'width: 20%; font-weight: bolder;';
|
||||||
foreach ($array_module_group as $key => $value) {
|
foreach ($array_module_group as $key => $value) {
|
||||||
$headstyle[] = 'min-width: 60px;max-width: 5%;text-align:center; color: #ffffff; background-color: #373737; font-weight: bolder;';
|
$headstyle[] = 'min-width: 60px;max-width: 5%;text-align:center; font-weight: bolder;';
|
||||||
$head[] = ui_print_truncate_text($value, GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF');
|
$head[] = ui_print_truncate_text(
|
||||||
|
$value,
|
||||||
|
GENERIC_SIZE_TEXT,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
'…'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($array_for_defect as $key => $value) {
|
foreach ($array_for_defect as $key => $value) {
|
||||||
$deep = groups_get_group_deep($key);
|
$deep = groups_get_group_deep($key);
|
||||||
$data[$i][0] = $deep.ui_print_truncate_text($value['data']['name'], GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF');
|
$data[$i][0] = $deep.ui_print_truncate_text(
|
||||||
|
$value['data']['name'],
|
||||||
|
GENERIC_SIZE_TEXT,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
'…'
|
||||||
|
);
|
||||||
$j = 1;
|
$j = 1;
|
||||||
if (isset($array_data[$key])) {
|
if (isset($array_data[$key])) {
|
||||||
foreach ($value['gm'] as $k => $v) {
|
foreach ($value['gm'] as $k => $v) {
|
||||||
@ -378,25 +431,37 @@ function mainModuleGroups()
|
|||||||
$table->headstyle = $headstyle;
|
$table->headstyle = $headstyle;
|
||||||
$table->data = $data;
|
$table->data = $data;
|
||||||
|
|
||||||
ui_pagination($counter);
|
|
||||||
|
|
||||||
echo "<div class='w100p' style='overflow-x:auto;'>";
|
echo "<div class='w100p' style='overflow-x:auto;'>";
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
ui_pagination($counter);
|
$tablePagination = ui_pagination(
|
||||||
|
$counter,
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
'offset',
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
echo "<div class='legend_basic w99p'>";
|
html_print_action_buttons(
|
||||||
echo '<table >';
|
'',
|
||||||
echo "<tr><td colspan='2' class='pdd_b_10px'><b>".__('Legend').'</b></td></tr>';
|
[ 'right_content' => $tablePagination ]
|
||||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_ALERTFIRED.";'></div></td><td>".__('Orange cell when the module group and agent have at least one alarm fired.').'</td></tr>';
|
);
|
||||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_CRITICAL.";'></div></td><td>".__('Red cell when the module group and agent have at least one module in critical status and the others in any status').'</td></tr>';
|
|
||||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_WARNING.";'></div></td><td>".__('Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status').'</td></tr>';
|
$show_legend = '<div>';
|
||||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_UNKNOWN.";'></div></td><td>".__('Grey cell when the module group and agent have at least one in unknown status and the others in green status').'</td></tr>';
|
$show_legend .= '<table>';
|
||||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NORMAL.";'></div></td><td>".__('Green cell when the module group and agent have all modules in OK status').'</td></tr>';
|
$show_legend .= "<tr><td class='legend_square_simple'><div style='background-color: ".COL_ALERTFIRED.";'></div></td><td>".__('Orange cell when the module group and agent have at least one alarm fired.').'</td></tr>';
|
||||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NOTINIT.";'></div></td><td>".__('Blue cell when the module group and agent have all modules in not init status.').'</td></tr>';
|
$show_legend .= "<tr><td class='legend_square_simple'><div style='background-color: ".COL_CRITICAL.";'></div></td><td>".__('Red cell when the module group and agent have at least one module in critical status and the others in any status').'</td></tr>';
|
||||||
echo '</table>';
|
$show_legend .= "<tr><td class='legend_square_simple'><div style='background-color: ".COL_WARNING.";'></div></td><td>".__('Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status').'</td></tr>';
|
||||||
echo '</div>';
|
$show_legend .= "<tr><td class='legend_square_simple'><div style='background-color: ".COL_UNKNOWN.";'></div></td><td>".__('Grey cell when the module group and agent have at least one in unknown status and the others in green status').'</td></tr>';
|
||||||
|
$show_legend .= "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NORMAL.";'></div></td><td>".__('Green cell when the module group and agent have all modules in OK status').'</td></tr>';
|
||||||
|
$show_legend .= "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NOTINIT.";'></div></td><td>".__('Blue cell when the module group and agent have all modules in not init status.').'</td></tr>';
|
||||||
|
$show_legend .= '</table>';
|
||||||
|
$show_legend .= '</div>';
|
||||||
|
|
||||||
|
ui_toggle($show_legend, __('Legend'));
|
||||||
} else {
|
} else {
|
||||||
ui_print_info_message(['no_close' => true, 'message' => __('This table shows in columns the modules group and in rows agents group. The cell shows all modules') ]);
|
ui_print_info_message(['no_close' => true, 'message' => __('This table shows in columns the modules group and in rows agents group. The cell shows all modules') ]);
|
||||||
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined groups or module groups') ]);
|
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined groups or module groups') ]);
|
||||||
|
@ -11,11 +11,12 @@
|
|||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
function view_logfile($file_name)
|
function view_logfile($file_name, $toggle=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$memory_limit = ini_get('memory_limit');
|
$memory_limit = ini_get('memory_limit');
|
||||||
|
$code = '';
|
||||||
|
|
||||||
if (strstr($memory_limit, 'M') !== false) {
|
if (strstr($memory_limit, 'M') !== false) {
|
||||||
$memory_limit = str_replace('M', '', $memory_limit);
|
$memory_limit = str_replace('M', '', $memory_limit);
|
||||||
@ -31,21 +32,37 @@ function view_logfile($file_name)
|
|||||||
$file_size = filesize($file_name);
|
$file_size = filesize($file_name);
|
||||||
|
|
||||||
if ($memory_limit < $file_size) {
|
if ($memory_limit < $file_size) {
|
||||||
echo "<h2>$file_name (".__('File is too large than PHP memory allocated in the system.').')</h2>';
|
$code .= '<pre><h2>'.$file_name.' ('.__('File is too large than PHP memory allocated in the system.').')</h2>';
|
||||||
echo '<h2>'.__('The preview file is imposible.').'</h2>';
|
$code .= '<h2>'.__('The preview file is imposible.').'</h2>';
|
||||||
} else if ($file_size > ($config['max_log_size'] * 1000)) {
|
} else if ($file_size > ($config['max_log_size'] * 1000)) {
|
||||||
$data = file_get_contents($file_name, false, null, ($file_size - ($config['max_log_size'] * 1000)));
|
$data = file_get_contents($file_name, false, null, ($file_size - ($config['max_log_size'] * 1000)));
|
||||||
echo "<h2>$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).' </h2>';
|
$code .= "<h2>$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).' </h2>';
|
||||||
echo "<textarea class='pandora_logs' name='$file_name'>";
|
$code .= "<textarea class='pandora_logs' name='$file_name'>";
|
||||||
echo '... ';
|
$code .= '... ';
|
||||||
echo $data;
|
$code .= $data;
|
||||||
echo '</textarea><br><br>';
|
$code .= '</textarea><br><br>';
|
||||||
} else {
|
} else {
|
||||||
$data = file_get_contents($file_name);
|
$data = file_get_contents($file_name);
|
||||||
echo "<h2>$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).' </h2>';
|
$code .= "<h2>$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).' </h2>';
|
||||||
echo "<textarea class='pandora_logs' name='$file_name'>";
|
$code .= "<textarea class='pandora_logs' name='$file_name'>";
|
||||||
echo $data;
|
$code .= $data;
|
||||||
echo '</textarea><br><br>';
|
$code .= '</textarea><br><br></pre>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($toggle === true) {
|
||||||
|
ui_toggle(
|
||||||
|
$code,
|
||||||
|
'<span class="subsection_header_title">'.$file_name.'</span>',
|
||||||
|
$file_name,
|
||||||
|
'a',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'white-box-content no_border',
|
||||||
|
'filter-datatable-main box-flat white_table_graph'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
echo $code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,21 +81,45 @@ function pandoralogs_extension_main()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_page_header(__('System logfile viewer'), 'images/extensions.png', false, '', true, '');
|
// Header.
|
||||||
|
ui_print_standard_header(
|
||||||
|
__('Extensions'),
|
||||||
|
'images/extensions.png',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
[],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Admin tools'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Extension manager'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('System logfile viewer'),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
echo '<p>'.__('Use this tool to view your %s logfiles directly on the console', get_product_name()).'</p>';
|
ui_print_info_message(
|
||||||
|
__('Use this tool to view your %s logfiles directly on the console', get_product_name()).'<br>
|
||||||
echo '<p>'.__('You can choose the amount of information shown in general setup (Log size limit in system logs viewer extension), '.($config['max_log_size'] * 1000).'B at the moment').'</p>';
|
'.__('You can choose the amount of information shown in general setup (Log size limit in system logs viewer extension), '.($config['max_log_size'] * 1000).'B at the moment')
|
||||||
|
);
|
||||||
|
|
||||||
$logs_directory = (!empty($config['server_log_dir'])) ? io_safe_output($config['server_log_dir']) : '/var/log/pandora';
|
$logs_directory = (!empty($config['server_log_dir'])) ? io_safe_output($config['server_log_dir']) : '/var/log/pandora';
|
||||||
|
|
||||||
// Do not attempt to show console log if disabled.
|
// Do not attempt to show console log if disabled.
|
||||||
if ($config['console_log_enabled']) {
|
if ($config['console_log_enabled']) {
|
||||||
view_logfile($config['homedir'].'/log/console.log');
|
view_logfile($config['homedir'].'/log/console.log', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
view_logfile($logs_directory.'/pandora_server.log');
|
view_logfile($logs_directory.'/pandora_server.log', true);
|
||||||
view_logfile($logs_directory.'/pandora_server.error');
|
view_logfile($logs_directory.'/pandora_server.error', true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ function quickShell()
|
|||||||
'name' => 'submit',
|
'name' => 'submit',
|
||||||
'label' => __('Retry'),
|
'label' => __('Retry'),
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
'attributes' => 'class="sub next"',
|
'attributes' => ['icon' => 'next'],
|
||||||
'return' => true,
|
'return' => true,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -202,7 +202,7 @@ function quickShell()
|
|||||||
'arguments' => [
|
'arguments' => [
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
'label' => __('Connect'),
|
'label' => __('Connect'),
|
||||||
'attributes' => 'class="sub next"',
|
'attributes' => ['icon' => 'cog'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -544,7 +544,7 @@ if (empty($agent_id) === false
|
|||||||
// TabName.
|
// TabName.
|
||||||
__('QuickShell'),
|
__('QuickShell'),
|
||||||
// TabIcon.
|
// TabIcon.
|
||||||
'images/ehorus/terminal.png',
|
'images/quick-shell@svg.svg',
|
||||||
// TabFunction.
|
// TabFunction.
|
||||||
'quickShell',
|
'quickShell',
|
||||||
// Version.
|
// Version.
|
||||||
|
@ -74,61 +74,11 @@ function pandora_realtime_graphs()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$chart[time()]['graph'] = '0';
|
|
||||||
$interactive_graph = true;
|
|
||||||
$color = [];
|
|
||||||
$legend = '';
|
|
||||||
$long_index = [];
|
|
||||||
$no_data_image = '';
|
|
||||||
|
|
||||||
$canvas = '<div id="graph_container" class="graph_container">';
|
|
||||||
$canvas .= '<div id="chartLegend" class="chartLegend"></div>';
|
|
||||||
|
|
||||||
$width = 800;
|
|
||||||
$height = 300;
|
|
||||||
|
|
||||||
$data_array['realtime']['data'][0][0] = (time() - 10);
|
|
||||||
$data_array['realtime']['data'][0][1] = 0;
|
|
||||||
$data_array['realtime']['data'][1][0] = time();
|
|
||||||
$data_array['realtime']['data'][1][1] = 0;
|
|
||||||
$data_array['realtime']['color'] = 'green';
|
|
||||||
|
|
||||||
$params = [
|
|
||||||
'agent_module_id' => false,
|
|
||||||
'period' => 300,
|
|
||||||
'width' => $width,
|
|
||||||
'height' => $height,
|
|
||||||
'unit' => $unit,
|
|
||||||
'only_image' => $only_image,
|
|
||||||
'homeurl' => $homeurl,
|
|
||||||
'type_graph' => 'area',
|
|
||||||
'font' => $config['fontpath'],
|
|
||||||
'font-size' => $config['font_size'],
|
|
||||||
'array_data_create' => $data_array,
|
|
||||||
'show_legend' => false,
|
|
||||||
'show_menu' => false,
|
|
||||||
];
|
|
||||||
|
|
||||||
$canvas .= grafico_modulo_sparse($params);
|
|
||||||
|
|
||||||
$canvas .= '</div>';
|
|
||||||
echo $canvas;
|
|
||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->id = 'table-form';
|
$table->id = 'table-form';
|
||||||
$table->class = 'databox filters';
|
$table->class = 'filter-table-adv';
|
||||||
$table->style = [];
|
$table->style = [];
|
||||||
$table->cellpadding = '0';
|
|
||||||
$table->cellspacing = '0';
|
|
||||||
$table->style['graph'] = 'font-weight: bold;';
|
|
||||||
$table->style['refresh'] = 'font-weight: bold;';
|
|
||||||
$table->style['incremental'] = 'font-weight: bold;';
|
|
||||||
$table->style['reset'] = 'font-weight: bold;';
|
|
||||||
$table->style['snmp_address'] = 'font-weight: bold;';
|
|
||||||
$table->style['snmp_community'] = 'font-weight: bold;';
|
|
||||||
$table->style['snmp_oid'] = 'font-weight: bold;';
|
|
||||||
$table->style['snmp_oid'] = 'font-weight: bold;';
|
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
|
||||||
$graph_fields['cpu_load'] = __('%s Server CPU', get_product_name());
|
$graph_fields['cpu_load'] = __('%s Server CPU', get_product_name());
|
||||||
@ -158,15 +108,22 @@ function pandora_realtime_graphs()
|
|||||||
$refresh = get_parameter('refresh', '1000');
|
$refresh = get_parameter('refresh', '1000');
|
||||||
|
|
||||||
if ($graph != 'snmp_module') {
|
if ($graph != 'snmp_module') {
|
||||||
$data['graph'] = __('Graph').' ';
|
$data['graph'] = html_print_label_input_block(
|
||||||
$data['graph'] .= html_print_select(
|
__('Graph'),
|
||||||
|
html_print_select(
|
||||||
$graph_fields,
|
$graph_fields,
|
||||||
'graph',
|
'graph',
|
||||||
$graph,
|
$graph,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
0,
|
0,
|
||||||
true
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'width: 100%'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,15 +136,13 @@ function pandora_realtime_graphs()
|
|||||||
$agent_alias = io_safe_output(get_parameter('agent_alias', ''));
|
$agent_alias = io_safe_output(get_parameter('agent_alias', ''));
|
||||||
$module_name = io_safe_output(get_parameter('module_name', ''));
|
$module_name = io_safe_output(get_parameter('module_name', ''));
|
||||||
$module_incremental = get_parameter('incremental', 0);
|
$module_incremental = get_parameter('incremental', 0);
|
||||||
$data['module_info'] = $agent_alias.': <b>'.$module_name.'</b>';
|
$data['module_info'] = html_print_label_input_block(
|
||||||
|
$agent_alias.': '.$module_name,
|
||||||
// Append all the hidden in this cell.
|
html_print_input_hidden(
|
||||||
$data['module_info'] .= html_print_input_hidden(
|
|
||||||
'incremental',
|
'incremental',
|
||||||
$module_incremental,
|
$module_incremental,
|
||||||
true
|
true
|
||||||
);
|
).html_print_select(
|
||||||
$data['module_info'] .= html_print_select(
|
|
||||||
['snmp_module' => '-'],
|
['snmp_module' => '-'],
|
||||||
'graph',
|
'graph',
|
||||||
'snmp_module',
|
'snmp_module',
|
||||||
@ -199,33 +154,36 @@ function pandora_realtime_graphs()
|
|||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
'display: none;'
|
'width: 100%; display: none;'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['refresh'] = __('Refresh interval').' ';
|
$data['refresh'] = html_print_label_input_block(
|
||||||
$data['refresh'] .= html_print_select(
|
__('Refresh interval'),
|
||||||
|
html_print_select(
|
||||||
$refresh_fields,
|
$refresh_fields,
|
||||||
'refresh',
|
'refresh',
|
||||||
$refresh,
|
$refresh,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
0,
|
0,
|
||||||
true
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'width: 100%'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($graph != 'snmp_module') {
|
if ($graph != 'snmp_module') {
|
||||||
$data['incremental'] = __('Incremental').' ';
|
$data['incremental'] = html_print_label_input_block(
|
||||||
$data['incremental'] .= html_print_checkbox('incremental', 1, 0, true);
|
__('Incremental'),
|
||||||
|
html_print_checkbox_switch('incremental', 1, 0, true)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['reset'] = html_print_button(
|
|
||||||
__('Clear graph'),
|
|
||||||
'reset',
|
|
||||||
false,
|
|
||||||
'javascript:realtimeGraphs.clearGraph();',
|
|
||||||
'class="sub delete mgn_tp_0" ',
|
|
||||||
true
|
|
||||||
);
|
|
||||||
$table->data[] = $data;
|
$table->data[] = $data;
|
||||||
|
|
||||||
if ($graph == 'snmp_interface' || $graph == 'snmp_module') {
|
if ($graph == 'snmp_interface' || $graph == 'snmp_module') {
|
||||||
@ -236,10 +194,79 @@ function pandora_realtime_graphs()
|
|||||||
html_print_input_hidden('rel_path', get_parameter('rel_path', ''));
|
html_print_input_hidden('rel_path', get_parameter('rel_path', ''));
|
||||||
|
|
||||||
// Print the form.
|
// Print the form.
|
||||||
echo '<form id="realgraph" method="post">';
|
$searchForm = '<form id="realgraph" method="post">';
|
||||||
html_print_table($table);
|
$searchForm .= html_print_table($table, true);
|
||||||
echo '</form>';
|
$searchForm .= html_print_div(
|
||||||
|
[
|
||||||
|
'class' => 'action-buttons',
|
||||||
|
'content' => html_print_submit_button(
|
||||||
|
__('Clear graph'),
|
||||||
|
'srcbutton',
|
||||||
|
false,
|
||||||
|
[
|
||||||
|
'icon' => 'delete',
|
||||||
|
'mode' => 'mini',
|
||||||
|
'onClick' => 'javascript:realtimeGraphs.clearGraph();',
|
||||||
|
],
|
||||||
|
true
|
||||||
|
),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$searchForm .= '</form>';
|
||||||
|
|
||||||
|
ui_toggle(
|
||||||
|
$searchForm,
|
||||||
|
'<span class="subsection_header_title">'.__('Filters').'</span>',
|
||||||
|
'filter_form',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'white-box-content',
|
||||||
|
'box-flat white_table_graph fixed_filter_bar'
|
||||||
|
);
|
||||||
|
|
||||||
|
$chart[time()]['graph'] = '0';
|
||||||
|
$canvas = '<div id="graph_container" class="graph_container">';
|
||||||
|
$canvas .= '<div id="chartLegend" class="chartLegend"></div>';
|
||||||
|
|
||||||
|
$width = 800;
|
||||||
|
$height = 300;
|
||||||
|
|
||||||
|
$data_array['realtime']['data'][0][0] = (time() - 10);
|
||||||
|
$data_array['realtime']['data'][0][1] = 0;
|
||||||
|
$data_array['realtime']['data'][1][0] = time();
|
||||||
|
$data_array['realtime']['data'][1][1] = 0;
|
||||||
|
$data_array['realtime']['color'] = 'green';
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
'agent_module_id' => false,
|
||||||
|
'period' => 300,
|
||||||
|
'width' => $width,
|
||||||
|
'height' => $height,
|
||||||
|
'only_image' => false,
|
||||||
|
'type_graph' => 'area',
|
||||||
|
'font' => $config['fontpath'],
|
||||||
|
'font-size' => $config['font_size'],
|
||||||
|
'array_data_create' => $data_array,
|
||||||
|
'show_legend' => false,
|
||||||
|
'show_menu' => false,
|
||||||
|
'backgroundColor' => 'transparent',
|
||||||
|
];
|
||||||
|
|
||||||
|
$canvas .= grafico_modulo_sparse($params);
|
||||||
|
|
||||||
|
$canvas .= '</div>';
|
||||||
|
|
||||||
|
html_print_div(
|
||||||
|
[
|
||||||
|
'class' => 'white_box',
|
||||||
|
'content' => $canvas,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
// echo $canvas;
|
||||||
// Define a custom action to save
|
// Define a custom action to save
|
||||||
// the OID selected in the SNMP browser to the form.
|
// the OID selected in the SNMP browser to the form.
|
||||||
html_print_input_hidden(
|
html_print_input_hidden(
|
||||||
|
@ -12,6 +12,5 @@
|
|||||||
#graph_container {
|
#graph_container {
|
||||||
width: 800px;
|
width: 800px;
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
background-color: white;
|
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,32 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Resources exportation view.
|
||||||
|
*
|
||||||
|
* @category Extensions.
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Load global vars.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; 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.
|
|
||||||
if (isset($_GET['get_ptr'])) {
|
if (isset($_GET['get_ptr'])) {
|
||||||
if ($_GET['get_ptr'] == 1) {
|
if ($_GET['get_ptr'] == 1) {
|
||||||
$ownDir = dirname(__FILE__).'/';
|
$ownDir = dirname(__FILE__).'/';
|
||||||
@ -123,13 +139,6 @@ function output_xml_report($id)
|
|||||||
|
|
||||||
$agent = null;
|
$agent = null;
|
||||||
switch (io_safe_output($item['type'])) {
|
switch (io_safe_output($item['type'])) {
|
||||||
case 1:
|
|
||||||
case 'simple_graph':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'simple_baseline_graph':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
case 'custom_graph':
|
case 'custom_graph':
|
||||||
case 'automatic_custom_graph':
|
case 'automatic_custom_graph':
|
||||||
@ -169,30 +178,6 @@ function output_xml_report($id)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
|
||||||
case 'monitor_report':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 7:
|
|
||||||
case 'avg_value':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
case 'max_value':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 9:
|
|
||||||
case 'min_value':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 10:
|
|
||||||
case 'sumatory':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'agent_detailed_event':
|
|
||||||
case 'event_report_agent':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'text':
|
case 'text':
|
||||||
echo '<text><![CDATA['.io_safe_output($item['text'])."]]></text>\n";
|
echo '<text><![CDATA['.io_safe_output($item['text'])."]]></text>\n";
|
||||||
break;
|
break;
|
||||||
@ -224,18 +209,6 @@ function output_xml_report($id)
|
|||||||
echo '<group><![CDATA['.io_safe_output($group)."]]></group>\n";
|
echo '<group><![CDATA['.io_safe_output($group)."]]></group>\n";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'event_report_module':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'alert_report_module':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'alert_report_agent':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'alert_report_group':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'url':
|
case 'url':
|
||||||
echo '<url><![CDATA['.io_safe_output($values['external_source']).']]></url>';
|
echo '<url><![CDATA['.io_safe_output($values['external_source']).']]></url>';
|
||||||
break;
|
break;
|
||||||
@ -245,6 +218,29 @@ function output_xml_report($id)
|
|||||||
echo '<line_separator><![CDATA['.io_safe_output($item['line_separator']).']]></line_separator>';
|
echo '<line_separator><![CDATA['.io_safe_output($item['line_separator']).']]></line_separator>';
|
||||||
echo '<column_separator><![CDATA['.io_safe_output($item['header_definition']).']]></column_separator>';
|
echo '<column_separator><![CDATA['.io_safe_output($item['header_definition']).']]></column_separator>';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
case 'simple_graph':
|
||||||
|
case 'simple_baseline_graph':
|
||||||
|
case 6:
|
||||||
|
case 'monitor_report':
|
||||||
|
case 7:
|
||||||
|
case 'avg_value':
|
||||||
|
case 8:
|
||||||
|
case 'max_value':
|
||||||
|
case 9:
|
||||||
|
case 'min_value':
|
||||||
|
case 10:
|
||||||
|
case 'sumatory':
|
||||||
|
case 'agent_detailed_event':
|
||||||
|
case 'event_report_agent':
|
||||||
|
case 'event_report_module':
|
||||||
|
case 'alert_report_module':
|
||||||
|
case 'alert_report_agent':
|
||||||
|
case 'alert_report_group':
|
||||||
|
default:
|
||||||
|
// Do nothing.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</item>\n";
|
echo "</item>\n";
|
||||||
@ -417,25 +413,59 @@ function resource_exportation_extension_main()
|
|||||||
|
|
||||||
$hook_enterprise = enterprise_include('extensions/resource_exportation/functions.php');
|
$hook_enterprise = enterprise_include('extensions/resource_exportation/functions.php');
|
||||||
|
|
||||||
ui_print_page_header(__('Resource exportation'), 'images/extensions.png', false, '', true, '');
|
ui_print_standard_header(
|
||||||
|
__('Resource exportation'),
|
||||||
|
'images/extensions.png',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
[],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Resources'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Resource exporting'),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
echo '<div class=notify>';
|
ui_print_warning_message(
|
||||||
echo __('This extension makes exportation of resource template more easy.').' '.__('You can export resource templates in .ptr format.');
|
__('This extension makes exportation of resource template more easy.').'<br>'.__('You can export resource templates in .ptr format.')
|
||||||
echo '</div>';
|
);
|
||||||
|
|
||||||
echo '<br /><br />';
|
|
||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->class = 'databox filter-table-adv';
|
||||||
$table->style[0] = 'width: 30%;';
|
$table->id = 'resource_exportation_table';
|
||||||
$table->style[1] = 'width: 10%;';
|
$table->style = [];
|
||||||
$table->class = 'databox filters';
|
$table->style[0] = 'width: 30%';
|
||||||
$table->data[0][0] = __('Report');
|
$table->style[1] = 'vertical-align: bottom;';
|
||||||
$table->data[0][1] = html_print_select_from_sql('SELECT id_report, name FROM treport', 'report', '', '', '', 0, true);
|
$table->data = [];
|
||||||
$table->data[0][2] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'report\');', 'class="sub config"', true);
|
$table->data[0][] = html_print_label_input_block(
|
||||||
$table->data[1][0] = __('Visual console');
|
__('Report'),
|
||||||
$table->data[1][1] = html_print_select_from_sql('SELECT id, name FROM tlayout', 'visual_console', '', '', '', 0, true);
|
html_print_div(
|
||||||
$table->data[1][2] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'visual_console\');', 'class="sub config"', true);
|
[
|
||||||
|
'class' => 'flex-content-left',
|
||||||
|
'content' => html_print_select_from_sql('SELECT id_report, name FROM treport', 'report', '', '', '', 0, true),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$table->data[0][] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'report\');', ['mode' => 'link'], true);
|
||||||
|
|
||||||
|
$table->data[1][] = html_print_label_input_block(
|
||||||
|
__('Visual console'),
|
||||||
|
html_print_div(
|
||||||
|
[
|
||||||
|
'class' => 'flex-content-left',
|
||||||
|
'content' => html_print_select_from_sql('SELECT id, name FROM tlayout', 'visual_console', '', '', '', 0, true),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$table->data[1][] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'visual_console\');', ['mode' => 'link'], true);
|
||||||
|
|
||||||
if ($hook_enterprise === true) {
|
if ($hook_enterprise === true) {
|
||||||
add_rows_for_enterprise($table->data);
|
add_rows_for_enterprise($table->data);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Resource registration.
|
* Resource registration.
|
||||||
*
|
*
|
||||||
@ -14,7 +15,7 @@
|
|||||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
*
|
*
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
|
||||||
* Please see http://pandorafms.org for full contribution list
|
* Please see http://pandorafms.org for full contribution list
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -239,13 +240,6 @@ function process_upload_xml_report($xml, $group_filter=0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch ($item['type']) {
|
switch ($item['type']) {
|
||||||
case 1:
|
|
||||||
case 'simple_graph':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'simple_baseline_graph':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
case 'custom_graph':
|
case 'custom_graph':
|
||||||
case 'automatic_custom_graph':
|
case 'automatic_custom_graph':
|
||||||
@ -361,30 +355,6 @@ function process_upload_xml_report($xml, $group_filter=0)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
|
||||||
case 'monitor_report':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 7:
|
|
||||||
case 'avg_value':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
case 'max_value':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 9:
|
|
||||||
case 'min_value':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 10:
|
|
||||||
case 'sumatory':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'agent_detailed_event':
|
|
||||||
case 'event_report_agent':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'text':
|
case 'text':
|
||||||
$values['text'] = io_safe_input($item['text']);
|
$values['text'] = io_safe_input($item['text']);
|
||||||
break;
|
break;
|
||||||
@ -405,18 +375,6 @@ function process_upload_xml_report($xml, $group_filter=0)
|
|||||||
$values['id_agent'] = db_get_value('id_grupo', 'tgrupo', 'nombre', io_safe_input($item->group));
|
$values['id_agent'] = db_get_value('id_grupo', 'tgrupo', 'nombre', io_safe_input($item->group));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'event_report_module':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'alert_report_module':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'alert_report_agent':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'alert_report_group':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'url':
|
case 'url':
|
||||||
$values['external_source'] = io_safe_input($item['url']);
|
$values['external_source'] = io_safe_input($item['url']);
|
||||||
break;
|
break;
|
||||||
@ -426,9 +384,32 @@ function process_upload_xml_report($xml, $group_filter=0)
|
|||||||
$values['line_separator'] = io_safe_input($item['line_separator']);
|
$values['line_separator'] = io_safe_input($item['line_separator']);
|
||||||
$values['column_separator'] = io_safe_input($item['column_separator']);
|
$values['column_separator'] = io_safe_input($item['column_separator']);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
case 'simple_graph':
|
||||||
|
case 'simple_baseline_graph':
|
||||||
|
case 6:
|
||||||
|
case 'monitor_report':
|
||||||
|
case 7:
|
||||||
|
case 'avg_value':
|
||||||
|
case 8:
|
||||||
|
case 'max_value':
|
||||||
|
case 9:
|
||||||
|
case 'min_value':
|
||||||
|
case 10:
|
||||||
|
case 'sumatory':
|
||||||
|
case 'event_report_module':
|
||||||
|
case 'alert_report_module':
|
||||||
|
case 'alert_report_agent':
|
||||||
|
case 'alert_report_group':
|
||||||
|
case 'agent_detailed_event':
|
||||||
|
case 'event_report_agent':
|
||||||
|
default:
|
||||||
|
// Do nothing.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($agents_item)) {
|
if (empty($agents_item) === true) {
|
||||||
$id_content = db_process_sql_insert('treport_content', $values);
|
$id_content = db_process_sql_insert('treport_content', $values);
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
$id_content,
|
$id_content,
|
||||||
@ -782,7 +763,7 @@ function process_upload_xml_visualmap($xml, $filter_group=0)
|
|||||||
|
|
||||||
function process_upload_xml_component($xml)
|
function process_upload_xml_component($xml)
|
||||||
{
|
{
|
||||||
// Extract components
|
// Extract components.
|
||||||
$components = [];
|
$components = [];
|
||||||
foreach ($xml->xpath('/component') as $componentElement) {
|
foreach ($xml->xpath('/component') as $componentElement) {
|
||||||
$name = io_safe_input((string) $componentElement->name);
|
$name = io_safe_input((string) $componentElement->name);
|
||||||
@ -838,7 +819,7 @@ function process_upload_xml_component($xml)
|
|||||||
$idComponent = false;
|
$idComponent = false;
|
||||||
switch ((int) $componentElement->module_source) {
|
switch ((int) $componentElement->module_source) {
|
||||||
case 1:
|
case 1:
|
||||||
// Local component
|
// Local component.
|
||||||
$values = [
|
$values = [
|
||||||
'description' => $description,
|
'description' => $description,
|
||||||
'id_network_component_group' => $group,
|
'id_network_component_group' => $group,
|
||||||
@ -854,12 +835,12 @@ function process_upload_xml_component($xml)
|
|||||||
// Network component
|
// Network component
|
||||||
// for modules
|
// for modules
|
||||||
// 15 = remote_snmp, 16 = remote_snmp_inc,
|
// 15 = remote_snmp, 16 = remote_snmp_inc,
|
||||||
// 17 = remote_snmp_string, 18 = remote_snmp_proc
|
// 17 = remote_snmp_string, 18 = remote_snmp_proc.
|
||||||
$custom_string_1 = '';
|
$custom_string_1 = '';
|
||||||
$custom_string_2 = '';
|
$custom_string_2 = '';
|
||||||
$custom_string_3 = '';
|
$custom_string_3 = '';
|
||||||
if ($type >= 15 && $type <= 18) {
|
if ($type >= 15 && $type <= 18) {
|
||||||
// New support for snmp v3
|
// New support for snmp v3.
|
||||||
$tcp_send = $snmp_version;
|
$tcp_send = $snmp_version;
|
||||||
$plugin_user = $auth_user;
|
$plugin_user = $auth_user;
|
||||||
$plugin_pass = $auth_password;
|
$plugin_pass = $auth_password;
|
||||||
@ -909,13 +890,13 @@ function process_upload_xml_component($xml)
|
|||||||
'post_process' => $post_process,
|
'post_process' => $post_process,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
if ((bool) $idComponent) {
|
if ((bool) $idComponent === true) {
|
||||||
$components[] = $idComponent;
|
$components[] = $idComponent;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
// Plugin component
|
// Plugin component.
|
||||||
$idComponent = network_components_create_network_component(
|
$idComponent = network_components_create_network_component(
|
||||||
$name,
|
$name,
|
||||||
$type,
|
$type,
|
||||||
@ -956,17 +937,13 @@ function process_upload_xml_component($xml)
|
|||||||
'post_process' => $post_process,
|
'post_process' => $post_process,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
if ((bool) $idComponent) {
|
if ((bool) $idComponent === true) {
|
||||||
$components[] = $idComponent;
|
$components[] = $idComponent;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
|
||||||
// Prediction component
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
// WMI component
|
// WMI component.
|
||||||
$idComponent = network_components_create_network_component(
|
$idComponent = network_components_create_network_component(
|
||||||
$name,
|
$name,
|
||||||
$type,
|
$type,
|
||||||
@ -1013,13 +990,17 @@ function process_upload_xml_component($xml)
|
|||||||
'post_process' => $post_process,
|
'post_process' => $post_process,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
if ((bool) $idComponent) {
|
if ((bool) $idComponent === true) {
|
||||||
$components[] = $idComponent;
|
$components[] = $idComponent;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
// Prediction component.
|
||||||
case 7:
|
case 7:
|
||||||
// Web component
|
// Web component.
|
||||||
|
default:
|
||||||
|
// Do nothing.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1030,9 +1011,9 @@ function process_upload_xml_component($xml)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract the template
|
// Extract the template.
|
||||||
$templateElement = $xml->xpath('//template');
|
$templateElement = $xml->xpath('//template');
|
||||||
if (!empty($templateElement)) {
|
if (empty($templateElement) === false) {
|
||||||
$templateElement = $templateElement[0];
|
$templateElement = $templateElement[0];
|
||||||
|
|
||||||
$templateName = (string) $templateElement->name;
|
$templateName = (string) $templateElement->name;
|
||||||
@ -1092,9 +1073,26 @@ function resource_registration_extension_main()
|
|||||||
include_once $config['homedir'].'/include/functions_db.php';
|
include_once $config['homedir'].'/include/functions_db.php';
|
||||||
enterprise_include_once('include/functions_local_components.php');
|
enterprise_include_once('include/functions_local_components.php');
|
||||||
|
|
||||||
ui_print_page_header(__('Resource registration'), 'images/extensions.png', false, '', true, '');
|
ui_print_standard_header(
|
||||||
|
__('Resource registration'),
|
||||||
|
'images/extensions.png',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
[],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Resources'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Resource registration'),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
if (!extension_loaded('libxml')) {
|
if (extension_loaded('libxml') === false) {
|
||||||
ui_print_error_message(_('Error, please install the PHP libXML in the system.'));
|
ui_print_error_message(_('Error, please install the PHP libXML in the system.'));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -1119,14 +1117,41 @@ function resource_registration_extension_main()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class=notify>';
|
ui_print_warning_message(
|
||||||
echo __('This extension makes registering resource templates easier.').' '.__('Here you can upload a resource template in .ptr format.').' '.__('Please refer to our documentation for more information on how to obtain and use %s resources.', get_product_name()).' '.'<br> <br>'.__('You can get more resurces in our <a href="https://pandorafms.com/Library/Library/">Public Resource Library</a>');
|
__('This extension makes registering resource templates easier.').'<br>'.__('Here you can upload a resource template in .ptr format.').'<br>'.__('Please refer to our documentation for more information on how to obtain and use %s resources.', get_product_name()).' '.'<br> <br>'.__('You can get more resurces in our <a href="https://pandorafms.com/Library/Library/">Public Resource Library</a>')
|
||||||
echo '</div>';
|
);
|
||||||
|
|
||||||
echo '<br /><br />';
|
$table = new stdClass();
|
||||||
|
$table->class = 'databox filter-table-adv';
|
||||||
|
$table->id = 'resource_registration_table';
|
||||||
|
|
||||||
|
$table->data = [];
|
||||||
|
|
||||||
|
$table->data[0][] = html_print_label_input_block(
|
||||||
|
__('File to upload'),
|
||||||
|
html_print_input_file('resource_upload', true)
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data[0][] = html_print_label_input_block(
|
||||||
|
__('Group filter'),
|
||||||
|
html_print_select_groups(false, 'AW', true, 'group', '', '', __('All'), 0, true)
|
||||||
|
);
|
||||||
|
|
||||||
// Upload form.
|
// Upload form.
|
||||||
echo "<form name='submit_plugin' method='post' enctype='multipart/form-data'>";
|
echo '<form name="submit_plugin" method="POST" enctype="multipart/form-data">';
|
||||||
|
html_print_table($table);
|
||||||
|
html_print_action_buttons(
|
||||||
|
html_print_submit_button(
|
||||||
|
__('Upload'),
|
||||||
|
'upload',
|
||||||
|
false,
|
||||||
|
[ 'icon' => 'wand' ],
|
||||||
|
true
|
||||||
|
),
|
||||||
|
['type' => 'form_action']
|
||||||
|
);
|
||||||
|
echo '</form>';
|
||||||
|
/*
|
||||||
echo '<table class="databox" id="table1" width="98%" border="0" cellpadding="4" cellspacing="4">';
|
echo '<table class="databox" id="table1" width="98%" border="0" cellpadding="4" cellspacing="4">';
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo "<td colspan='2' class='datos'><input type='file' name='resource_upload' accept='.ptr'/>";
|
echo "<td colspan='2' class='datos'><input type='file' name='resource_upload' accept='.ptr'/>";
|
||||||
@ -1136,8 +1161,7 @@ function resource_registration_extension_main()
|
|||||||
echo '</td>';
|
echo '</td>';
|
||||||
echo "<td class='datos'><input type='submit' class='sub next' value='".__('Upload')."' />";
|
echo "<td class='datos'><input type='submit' class='sub next' value='".__('Upload')."' />";
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
echo '</table>';
|
echo '</table>';*/
|
||||||
echo '</form>';
|
|
||||||
|
|
||||||
if (isset($_FILES['resource_upload']['tmp_name']) === false) {
|
if (isset($_FILES['resource_upload']['tmp_name']) === false) {
|
||||||
return;
|
return;
|
||||||
|
@ -1,16 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Extension to manage a list of gateways and the node address where they should
|
||||||
|
* point to.
|
||||||
|
*
|
||||||
|
* @category Users
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Begin.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; 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.
|
|
||||||
function users_extension_main()
|
function users_extension_main()
|
||||||
{
|
{
|
||||||
users_extension_main_god(false);
|
users_extension_main_god(false);
|
||||||
@ -34,7 +51,24 @@ function users_extension_main_god($god=true)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Header.
|
// Header.
|
||||||
ui_print_page_header(__('Users connected'), $image, false, '', $god);
|
ui_print_standard_header(
|
||||||
|
__('List of users connected'),
|
||||||
|
$image,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
$god,
|
||||||
|
[],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Workspace'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Users connected'),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
$check_profile = db_get_row('tusuario_perfil', 'id_usuario', $config['id_user'], 'id_up');
|
$check_profile = db_get_row('tusuario_perfil', 'id_usuario', $config['id_user'], 'id_up');
|
||||||
if ($check_profile === false && !users_is_admin()) {
|
if ($check_profile === false && !users_is_admin()) {
|
||||||
|
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;
|
158
pandora_console/extras/mr/62.sql
Normal file
158
pandora_console/extras/mr/62.sql
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'linux@os.svg' WHERE `id_os` = 1;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'solaris@os.svg' WHERE `id_os` = 2;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'aix@os.svg' WHERE `id_os` = 3;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'freebsd@os.svg' WHERE `id_os` = 4;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'HP@os.svg' WHERE `id_os` = 5;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'cisco@os.svg' WHERE `id_os` = 7;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'apple@os.svg' WHERE `id_os` = 8;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'windows@os.svg' WHERE `id_os` = 9;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'other-OS@os.svg' WHERE `id_os` = 10;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'network-server@os.svg' WHERE `id_os` = 11;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'network-server@os.svg' WHERE `id_os` = 12;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'network-server@os.svg' WHERE `id_os` = 13;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'embedded@os.svg' WHERE `id_os` = 14;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'android@os.svg' WHERE `id_os` = 15;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'vmware@os.svg' WHERE `id_os` = 16;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'routers@os.svg' WHERE `id_os` = 17;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'switch@os.svg' WHERE `id_os` = 18;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'satellite@os.svg' WHERE `id_os` = 19;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'mainframe@os.svg' WHERE `id_os` = 20;
|
||||||
|
UPDATE tconfig_os SET `icon_name` = 'cluster@os.svg' WHERE `id_os` = 100;
|
||||||
|
|
||||||
|
UPDATE tgrupo SET `icon` = 'servers@groups.svg' WHERE `id_grupo` = 2;
|
||||||
|
UPDATE tgrupo SET `icon` = 'firewall@groups.svg' WHERE `id_grupo` = 4;
|
||||||
|
UPDATE tgrupo SET `icon` = 'database@groups.svg' WHERE `id_grupo` = 8;
|
||||||
|
UPDATE tgrupo SET `icon` = 'network@groups.svg' WHERE `id_grupo` = 9;
|
||||||
|
UPDATE tgrupo SET `icon` = 'unknown@groups.svg' WHERE `id_grupo` = 10;
|
||||||
|
UPDATE tgrupo SET `icon` = 'workstation@groups.svg' WHERE `id_grupo` = 11;
|
||||||
|
UPDATE tgrupo SET `icon` = 'applications@groups.svg' WHERE `id_grupo` = 12;
|
||||||
|
UPDATE tgrupo SET `icon` = 'web@groups.svg' WHERE `id_grupo` = 13;
|
||||||
|
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'data-server@svg.svg' WHERE `id_tipo` = 1;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'generic-boolean@svg.svg' WHERE `id_tipo` = 2;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'generic-string@svg.svg' WHERE `id_tipo` = 3;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'data-server@svg.svg' WHERE `id_tipo` = 4;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'data-server@svg.svg' WHERE `id_tipo` = 5;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'ICMP-network-boolean-data@svg.svg' WHERE `id_tipo` = 6;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'ICMP-network-latency@svg.svg' WHERE `id_tipo` = 7;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-numeric-data@svg.svg' WHERE `id_tipo` = 8;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-boolean-data@svg.svg' WHERE `id_tipo` = 9;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-alphanumeric-data@svg.svg' WHERE `id_tipo` = 10;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-incremental-data@svg.svg' WHERE `id_tipo` = 11;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-numeric-data@svg.svg' WHERE `id_tipo` = 15;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-incremental-data@svg.svg' WHERE `id_tipo` = 16;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-alphanumeric-data@svg.svg' WHERE `id_tipo` = 17;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-incremental-data@svg.svg' WHERE `id_tipo` = 18;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'asynchronus-data@svg.svg' WHERE `id_tipo` = 21;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'asynchronus-data@svg.svg' WHERE `id_tipo` = 22;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'asynchronus-data@svg.svg' WHERE `id_tipo` = 23;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'wux@svg.svg' WHERE `id_tipo` = 25;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 30;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'web-analisys-data@svg.svg' WHERE `id_tipo` = 31;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 32;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 33;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-numeric-data@svg.svg' WHERE `id_tipo` = 34;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-boolean-data@svg.svg' WHERE `id_tipo` = 35;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-alphanumeric-data@svg.svg' WHERE `id_tipo` = 36;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-incremental-data@svg.svg' WHERE `id_tipo` = 37;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 38;
|
||||||
|
UPDATE `ttipo_modulo` SET `icon` = 'keepalive@svg.svg' WHERE `id_tipo` = 100;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
CREATE TABLE `tevent_sound` (
|
||||||
|
`id` INT NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` TEXT NULL,
|
||||||
|
`sound` TEXT NULL,
|
||||||
|
`active` TINYINT NOT NULL DEFAULT '1',
|
||||||
|
PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE INDEX agente_modulo_estado ON tevento (estado, id_agentmodule);
|
||||||
|
CREATE INDEX idx_disabled ON talert_template_modules (disabled);
|
||||||
|
|
||||||
|
INSERT INTO `treport_custom_sql` (`name`, `sql`) VALUES ('Agent safe mode not enable', 'select alias from tagente where safe_mode_module = 0');
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `twelcome_tip` (
|
||||||
|
`id` INT NOT NULL AUTO_INCREMENT,
|
||||||
|
`id_lang` VARCHAR(20) NULL,
|
||||||
|
`id_profile` INT NOT NULL,
|
||||||
|
`title` VARCHAR(255) NOT NULL,
|
||||||
|
`text` TEXT NOT NULL,
|
||||||
|
`url` VARCHAR(255) NULL,
|
||||||
|
`enable` TINYINT NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `twelcome_tip_file` (
|
||||||
|
`id` INT NOT NULL AUTO_INCREMENT,
|
||||||
|
`twelcome_tip_file` INT NOT NULL,
|
||||||
|
`filename` VARCHAR(255) NOT NULL,
|
||||||
|
`path` VARCHAR(255) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
CONSTRAINT `twelcome_tip_file`
|
||||||
|
FOREIGN KEY (`twelcome_tip_file`)
|
||||||
|
REFERENCES `twelcome_tip` (`id`)
|
||||||
|
ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
|
INSERT INTO `twelcome_tip` VALUES
|
||||||
|
(1,'es',0,'¿Sabías que puedes monitorizar webs?','De manera sencilla a través de chequeos HTTP estándar o transaccional mediante transacciones centralizadas WUX, o descentralizadas con el plugin UX de agente.','https://pandorafms.com/manual/es/documentation/03_monitoring/06_web_monitoring','1'),
|
||||||
|
(2,'es',0,'Monitorización remota de dispositivos SNMP','Los dispositivos de red como switches, AP, routers y firewalls se pueden monitorizar remotamente usando el protocolo SNMP. Basta con saber su IP, la comunidad SNMP y lanzar un wizard SNMP desde la consola.','https://pandorafms.com/manual/es/documentation/03_monitoring/03_remote_monitoring#monitorizacion_snmp','1'),
|
||||||
|
(3,'es',0,'Monitorizar rutas desde una IP a otra','Existe un plugin especial que sirve para monitorizar visualmente las rutas desde una IP a otra de manera visual y dinámica, según va cambiando con el tiempo.','https://pandorafms.com/manual/es/documentation/03_monitoring/03_remote_monitoring#monitorizacion_de_rutas','1'),
|
||||||
|
(4,'es',0,'¿Tu red pierde paquetes?','Se puede medir la pérdida de paquetes en tu red usando un agente y un plugin libre llamado “Packet Loss”. Esto es especialmente útil en redes Wifi o redes compartidas con muchos usuarios. Escribimos un artículo en nuestro blog hablando de ello, echale un vistazo','https://pandorafms.com/blog/es/perdida-de-paquetes/','1'),
|
||||||
|
(5,'es',0,'Usar Telegram con Pandora FMS','Perfecto para recibir alertas con gráficas empotradas y personalizar así la recepción de avisos de manera individual o en un canal común con mas personas. ','https://pandorafms.com/library/telegram-bot-cli/','1'),
|
||||||
|
(6,'es',0,'Monitorizar JMX (Tomcat, Websphere, Weblogic, Jboss, Apache Kafka, Jetty, GlassFish…)','Existe un plugin Enterprise que sirve para monitorizar cualquier tecnología JMX. Se puede usar de manera local (como plugin local) o de manera remota con el plugin server.','https://pandorafms.com/library/jmx-monitoring/','1'),
|
||||||
|
(7,'es',0,'¿Sabes que cada usuario puede tener su propia Zona Horaria?','Se puede establecer zonas horarias diferentes para cada usuario, de manera que interprete los datos teniendo en cuenta la diferencia horaria. Pandora FMS también puede tener servidores y agentes en diferentes zonas horarias. ¡Por todo el mundo!','','1'),
|
||||||
|
(8,'es',0,'Paradas planificadas','Se puede definir, a nivel de agente y a nivel de módulo, períodos en los cuales se ignoren las alertas y/o los datos recogidos. Es perfecto para planificar paradas de servicio o desconexión de los sistemas monitorizados. También afecta a los informes SLA, evitando que se tengan en cuenta esos intervalos de tiempo.    ','https://pandorafms.com/manual/es/documentation/04_using/11_managing_and_administration#paradas_de_servicio_planificadas','1'),
|
||||||
|
(9,'es',0,'Personalizar los emails de alerta ','¿Sabías que se pueden personalizar los mails de alertas de Pandora? Solo tienes que editar el código HTML por defecto de las acciones de alerta de tipo email.  ','https://pandorafms.com/manual/en/documentation/04_using/01_alerts#editing_an_action','1'),
|
||||||
|
(10,'es',0,'Usando iconos personalizados en consolas visuales ','Gracias a los iconos personalizados se pueden crear vistas muy personalizadas, como la de la imagen, que representa racks con los tipos de servidores en el orden que están colocados dentro del rack. Perfecto para que un técnico sepa exactamente qué máquina esta fallando. Más visual no puede ser, de ahi el nombre.  ','https://pandorafms.com/manual/start?id=es/documentation/04_using/05_data_presentation_visual_maps','1'),
|
||||||
|
(11,'es',0,'Consolas visuales: mapas de calor ','La consola permite integrar en un fondo personalizado una serie de datos, que en función de su valor se representen con unos colores u otros, en tiempo real. Las aplicaciones son infinitas, solo depende de tu imaginación.   ','https://pandorafms.com/manual/es/documentation/04_using/05_data_presentation_visual_maps#mapa_de_calor_o_nube_de_color','1'),
|
||||||
|
(12,'es',0,'Auditoría interna de la consola ','La consola registra todas las actividades relevantes de cada usuario conectado a la consola. Esto incluye la aplicación de configuraciones, validaciones de eventos y alertas, conexión y desconexión y cientos de otras operaciones. La seguridad en Pandora FMS ha sido siempre una de las características del diseño de su arquitectura.  ','https://pandorafms.com/manual/es/documentation/04_using/11_managing_and_administration#log_de_auditoria','1'),
|
||||||
|
(13,'es',0,'Sistema de provisión automática de agentes ','El sistema de autoprovisión de agentes, permite que un agente recién ingresado en el sistema aplique automáticamente cambios en su configuración (como moverlo de grupo, asignarle ciertos valores en campos personalizados) y por supuesto aplicarle determinadas politicas de monitorización. Es una de las funcionalidades más potentes, orientadas a gestionar parques de sistemas muy extensos.  ','https://pandorafms.com/manual/start?id=es/documentation/02_installation/05_configuration_agents#configuracion_automatica_de_agentes','1'),
|
||||||
|
(14,'es',0,'Modo oscuro ','¿Sabes que existe un modo oscuro en Pandora FMS? Un administrador lo puede activar a nivel global desde las opciones de configuración visuales o cualquier usuario a nivel individual, en las opciones de usuario. ','','1'),
|
||||||
|
(15,'es',0,'Google Sheet ','¿Sabes que se puede coger el valor de una celda de una hoja de cálculo de Google Sheet?, utilizamos la API para pedir el dato a través de un plugin remoto. Es perfecto para construir cuadros de mando de negocio, obtener alertas en tiempo real y crear tus propios informes a medida.  ','https://pandorafms.com/library/google-sheets-plugin/','1'),
|
||||||
|
(16,'es',0,'Tablas de ARP','¿Sabes que existe un módulo de inventario para sacar las tablas ARP de tus servidores windows? Es fácil de instalar y puede darte información muy detallada de tus equipos.','https://pandorafms.com/library/arp-table-windows-local/','1'),
|
||||||
|
(17,'es',0,'Enlaces de red en la consola visual ','Existe un elemento de consola visual llamado “Network link” que permite mostrar visualmente la unión de dos interfaces de red, su estado y el tráfico de subida/bajada, de una manera muy visual.  ','https://pandorafms.com/manual/es/documentation/04_using/05_data_presentation_visual_maps#enlace_de_red','1'),
|
||||||
|
(18,'es',0,'¿Conoces los informes de disponibilidad? ','Son muy útiles ya que te dicen el tiempo (%) que un chequeo ha estado en diferentes estados a lo largo de un lapso de tiempo, por ejemplo, una semana. Ofrece datos crudos completos de lo que se ha hecho con el detalle suficiente para convencer a un proveedor o un cliente.  ','','1'),
|
||||||
|
(19,'es',0,'Gráficas de disponibilidad ','Parecidos a los informes de disponibilidad, pero mucho mas visuales, ofrecen el detalle de estado de un monitor a lo largo del tiempo. Se pueden agrupar con otro módulo para ofrecer datos finales teniendo en cuenta la alta disponibilidad de un servicio. Son perfectos para su uso en informes a proveedores y/o clientes.  ','https://pandorafms.com/manual/es/documentation/04_using/08_data_presentation_reports#grafico_de_disponibilidad','1'),
|
||||||
|
(20,'es',0,'Zoom en gráficas de datos ','¿Sabes que Pandora FMS permite hacer zoom en una parte de la gráfica. Con eso ampliarás la información de la gráfica. Si estás viendo una gráfica de un mes y amplías, podrás ver los datos de ese intervalo. Si utilizas una gráfica con datos de resolución completa (los llamamos gráficas TIP) podrás ver el detalle de cada dato, aunque tu gráfica tenga miles de muestras.  ','','1'),
|
||||||
|
(21,'es',0,'Gráficas de resolución completa ','Pandora FMS y otras herramientas cuando tienen que mostrar una gráfica obtienen los datos de la fuente de datos y luego “simplifican” la gráfica, ya que si la serie de datos tiene 10,000 elementos y la gráfica solo tiene 300 pixeles de ancho no pueden caber todos, asi que se “simplifican” esos 10,000 puntos en solo 300.   Sin embargo al simplificar se pierde “detalle” en la gráfica, y por supuesto no podemos “hacer zoom”. Las gráficas de Pandora FMS permiten mostrar y usar todos los datos en una gráfica, que llamamos “TIP” que muestra todos los puntos superpuestos y además permite que al hacer zoom no se pierda resolución.   ','','1'),
|
||||||
|
(22,'es',0,'Política de contraseñas','La consola de Pandora FMS tiene un sistema de gestión de política de credenciales, para reforzar la seguridad local (además de permitir la autenticación externa contra un LDAP, Active Directory o SAML). A través de este sistema podemos forzar cambios de password cada X días, guardar un histórico de passwords usadas o evitar el uso de ciertas contraseñas entre otras acciones.  ','https://pandorafms.com/manual/es/documentation/04_using/12_console_setup?s%5B%5D%3Dcontrase%25C3%25B1as#password_policy','1'),
|
||||||
|
(23,'es',0,'Autenticación de doble factor ','Es posible activar (y forzar su uso a todos los usuarios) un sistema de doble autenticación (usando Google Auth) para que cualquier usuario se autentique además de con una contraseña, con un sistema de token de un solo uso, dando al sistema mucha más seguridad.  ','https://pandorafms.com/manual/en/documentation/04_using/12_console_setup?s%5B%5D%3Dgoogle%26s%5B%5D%3Dauth#authentication','1');
|
||||||
|
|
||||||
|
INSERT INTO `twelcome_tip_file` (`twelcome_tip_file`, `filename`, `path`) VALUES
|
||||||
|
(1, 'monitorizar_web.png', 'images/tips/'),
|
||||||
|
(2, 'monitorizar_snmp.png', 'images/tips/'),
|
||||||
|
(3, 'monitorizar_desde_ip.png', 'images/tips/'),
|
||||||
|
(4, 'tu_red_pierde_paquetes.png', 'images/tips/'),
|
||||||
|
(5, 'telegram_con_pandora.png', 'images/tips/'),
|
||||||
|
(6, 'monitorizar_con_jmx.png', 'images/tips/'),
|
||||||
|
(7, 'usuario_zona_horaria.png', 'images/tips/'),
|
||||||
|
(8, 'paradas_planificadas.png', 'images/tips/'),
|
||||||
|
(9, 'personalizar_los_emails.png', 'images/tips/'),
|
||||||
|
(10, 'iconos_personalizados.png', 'images/tips/'),
|
||||||
|
(11, 'mapa_de_calor.png', 'images/tips/'),
|
||||||
|
(12, 'auditoria.png', 'images/tips/'),
|
||||||
|
(15, 'google_sheets.png', 'images/tips/'),
|
||||||
|
(17, 'enlaces_consola_visual.png', 'images/tips/'),
|
||||||
|
(18, 'informe_disponibiliad.png', 'images/tips/'),
|
||||||
|
(19, 'graficas_disponibilidad.png', 'images/tips/'),
|
||||||
|
(20, 'zoom_en_graficas.png', 'images/tips/'),
|
||||||
|
(22, 'politica_de_pass.png', 'images/tips/');
|
||||||
|
|
||||||
|
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.
@ -1,16 +1,32 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Custom fields first task.
|
||||||
|
*
|
||||||
|
* @category Custom Fields.
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Opensource
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2022 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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Load globals.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; 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.
|
|
||||||
global $config;
|
global $config;
|
||||||
check_login();
|
check_login();
|
||||||
ui_require_css_file('first_task');
|
ui_require_css_file('first_task');
|
||||||
@ -33,6 +49,20 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
|
|||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
<form action="index.php?sec=gagente&sec2=godmode/agentes/configure_field" method="post">
|
<form action="index.php?sec=gagente&sec2=godmode/agentes/configure_field" method="post">
|
||||||
|
<?php
|
||||||
|
html_print_div(
|
||||||
|
[
|
||||||
|
'class' => 'action-buttons',
|
||||||
|
'content' => html_print_submit_button(
|
||||||
|
__('Create Custom Fields'),
|
||||||
|
'button_task',
|
||||||
|
false,
|
||||||
|
[ 'icon' => 'next' ],
|
||||||
|
true
|
||||||
|
),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
?>
|
||||||
<input type="submit" class="button_task" value="<?php echo __('Create Custom Fields'); ?>" />
|
<input type="submit" class="button_task" value="<?php echo __('Create Custom Fields'); ?>" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,9 +15,6 @@ global $config;
|
|||||||
check_login();
|
check_login();
|
||||||
ui_require_css_file('first_task');
|
ui_require_css_file('first_task');
|
||||||
?>
|
?>
|
||||||
<?php
|
|
||||||
ui_print_info_message(['no_close' => true, 'message' => __('There are no custom graphs defined yet.') ]);
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="new_task">
|
<div class="new_task">
|
||||||
<div class="image_task">
|
<div class="image_task">
|
||||||
@ -36,7 +33,17 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
|
|||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
<form action="index.php?sec=reporting&sec2=godmode/reporting/graph_builder" method="post">
|
<form action="index.php?sec=reporting&sec2=godmode/reporting/graph_builder" method="post">
|
||||||
<input type="submit" class="button_task" value="<?php echo __('Create Custom Graph'); ?>" />
|
<?php
|
||||||
|
html_print_action_buttons(
|
||||||
|
html_print_submit_button(
|
||||||
|
__('Create Custom Graph'),
|
||||||
|
'button_task',
|
||||||
|
false,
|
||||||
|
['icon' => 'wand'],
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -1,28 +1,38 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Map builder First Task.
|
||||||
|
*
|
||||||
|
* @category Topology maps
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Visual consoles
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2007-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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Begin.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; 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.
|
|
||||||
global $config;
|
global $config;
|
||||||
global $vconsoles_write;
|
global $vconsoles_write;
|
||||||
global $vconsoles_manage;
|
global $vconsoles_manage;
|
||||||
check_login();
|
check_login();
|
||||||
ui_require_css_file('first_task');
|
ui_require_css_file('first_task');
|
||||||
|
|
||||||
ui_print_info_message(
|
|
||||||
[
|
|
||||||
'no_close' => true,
|
|
||||||
'message' => __('There are no visual console defined yet.'),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
if ($vconsoles_write || $vconsoles_manage) {
|
if ($vconsoles_write || $vconsoles_manage) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -31,7 +41,7 @@ if ($vconsoles_write || $vconsoles_manage) {
|
|||||||
<?php echo html_print_image('images/first_task/icono_grande_visualconsole.png', true, ['title' => __('Visual Console')]); ?>
|
<?php echo html_print_image('images/first_task/icono_grande_visualconsole.png', true, ['title' => __('Visual Console')]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="text_task">
|
<div class="text_task">
|
||||||
<h3> <?php echo __('Create Visual Console'); ?></h3><p id="description_task">
|
<h3> <?php echo __('Visual Consoles'); ?></h3><p id="description_task">
|
||||||
<?php
|
<?php
|
||||||
echo __(
|
echo __(
|
||||||
'%s allows users to create visual maps on which each user is able to create his or her '.'own monitoring map. The new visual console editor is much more practical, although the prior '."visual console editor had its advantages. On the new visual console, we've been successful in "."imitating the sensation and touch of a drawing application like GIMP. We've also simplified the "."editor by dividing it into several subject-divided tabs named 'Data', 'Preview', 'Wizard', 'List of "."Elements' and 'Editor'. The items the %s Visual Map was designed to handle are "."'static images', 'percentage bars', 'module graphs' and 'simple values'.",
|
'%s allows users to create visual maps on which each user is able to create his or her '.'own monitoring map. The new visual console editor is much more practical, although the prior '."visual console editor had its advantages. On the new visual console, we've been successful in "."imitating the sensation and touch of a drawing application like GIMP. We've also simplified the "."editor by dividing it into several subject-divided tabs named 'Data', 'Preview', 'Wizard', 'List of "."Elements' and 'Editor'. The items the %s Visual Map was designed to handle are "."'static images', 'percentage bars', 'module graphs' and 'simple values'.",
|
||||||
@ -41,8 +51,18 @@ if ($vconsoles_write || $vconsoles_manage) {
|
|||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
<form action="index.php?sec=network&sec2=godmode/reporting/visual_console_builder" method="post">
|
<form action="index.php?sec=network&sec2=godmode/reporting/visual_console_builder" method="post">
|
||||||
<?php html_print_input_hidden('edit_layout', 1); ?>
|
<?php
|
||||||
<input type="submit" class="button_task" value="<?php echo __('Create Visual Console'); ?>" />
|
html_print_input_hidden('edit_layout', 1);
|
||||||
|
html_print_action_buttons(
|
||||||
|
html_print_submit_button(
|
||||||
|
__('Create a Visual Console'),
|
||||||
|
'button_task',
|
||||||
|
false,
|
||||||
|
['icon' => 'wand'],
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,16 +1,32 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Planned downtimes view
|
||||||
|
*
|
||||||
|
* @category Community
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Tools
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2022 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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Begin.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; 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.
|
|
||||||
global $config;
|
global $config;
|
||||||
check_login();
|
check_login();
|
||||||
ui_require_css_file('first_task');
|
ui_require_css_file('first_task');
|
||||||
@ -34,7 +50,12 @@ ui_require_css_file('first_task');
|
|||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
<form action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor" method="post">
|
<form action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor" method="post">
|
||||||
<input type="submit" class="button_task" value="<?php echo __('Create Scheduled Downtime'); ?>" />
|
<?php
|
||||||
|
html_print_submit_button(
|
||||||
|
__('Create Scheduled Downtime'),
|
||||||
|
'button_task'
|
||||||
|
);
|
||||||
|
?>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,29 +1,44 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Services first task.
|
||||||
|
*
|
||||||
|
* @category Topology maps
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Services
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2007-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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Begin.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; 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.
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
ui_require_css_file('first_task');
|
ui_require_css_file('first_task');
|
||||||
?>
|
?>
|
||||||
<?php ui_print_info_message(['no_close' => true, 'message' => __('There are no services defined yet.') ]); ?>
|
|
||||||
<?php if ((bool) $agent_w === true) { ?>
|
<?php if ((bool) $agent_w === true) { ?>
|
||||||
<div class="new_task">
|
<div class="new_task">
|
||||||
<div class="image_task">
|
<div class="image_task">
|
||||||
<?php echo html_print_image('images/first_task/icono_grande_servicios.png', true, ['title' => __('Services')]); ?>
|
<?php echo html_print_image('images/item-service.svg', true, ['title' => __('Services'), 'class' => 'w120px']); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="text_task">
|
<div class="text_task">
|
||||||
<h3> <?php echo __('Create Services'); ?></h3>
|
<h3> <?php echo __('Services'); ?></h3>
|
||||||
<p id="description_task">
|
<p id="description_task">
|
||||||
<?php
|
<?php
|
||||||
echo __(
|
echo __(
|
||||||
@ -37,9 +52,18 @@ ui_require_css_file('first_task');
|
|||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
<form action="index.php?sec=estado&sec2=enterprise/godmode/services/services.service&action=new_service" method="post">
|
<form action="index.php?sec=estado&sec2=enterprise/godmode/services/services.service&action=new_service" method="post">
|
||||||
<input type="submit" class="button_task" value="<?php echo __('Create Services'); ?>" />
|
<?php
|
||||||
|
html_print_action_buttons(
|
||||||
|
html_print_submit_button(
|
||||||
|
__('Create a service'),
|
||||||
|
'button_task',
|
||||||
|
false,
|
||||||
|
['icon' => 'wand'],
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
@ -37,7 +37,6 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
|
|
||||||
// ======= Servers List ===============================================
|
// ======= Servers List ===============================================
|
||||||
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
|
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
|
||||||
$servers_list = '<div id="servers_list">';
|
|
||||||
$servers = [];
|
$servers = [];
|
||||||
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
|
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
|
||||||
if ($servers['all'] != 0) {
|
if ($servers['all'] != 0) {
|
||||||
@ -45,22 +44,33 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
$servers['down'] = ($servers['all'] - $servers['up']);
|
$servers['down'] = ($servers['all'] - $servers['up']);
|
||||||
if ($servers['up'] == 0) {
|
if ($servers['up'] == 0) {
|
||||||
// All Servers down or no servers at all.
|
// All Servers down or no servers at all.
|
||||||
$servers_check_img = html_print_image('images/header_down_gray.png', true, ['alt' => 'cross', 'class' => 'bot', 'title' => __('All systems').': '.__('Down')]);
|
$servers_check_img = html_print_image('images/system_error@header.svg', true, ['alt' => 'cross', 'class' => 'main_menu_icon bot', 'title' => __('All systems').': '.__('Down')]);
|
||||||
} else if ($servers['down'] != 0) {
|
} else if ($servers['down'] != 0) {
|
||||||
// Some servers down.
|
// Some servers down.
|
||||||
$servers_check_img = html_print_image('images/header_warning_gray.png', true, ['alt' => 'error', 'class' => 'bot', 'title' => $servers['down'].' '.__('servers down')]);
|
$servers_check_img = html_print_image('images/system_warning@header.svg', true, ['alt' => 'error', 'class' => 'main_menu_icon bot', 'title' => $servers['down'].' '.__('servers down')]);
|
||||||
} else {
|
} else {
|
||||||
// All servers up.
|
// All servers up.
|
||||||
$servers_check_img = html_print_image('images/header_ready_gray.png', true, ['alt' => 'ok', 'class' => 'bot', 'title' => __('All systems').': '.__('Ready')]);
|
$servers_check_img = html_print_image('images/system_ok@header.svg', true, ['alt' => 'ok', 'class' => 'main_menu_icon bot', 'title' => __('All systems').': '.__('Ready')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($servers);
|
unset($servers);
|
||||||
// Since this is the header, we don't like to trickle down variables.
|
// Since this is the header, we don't like to trickle down variables.
|
||||||
$servers_check_img_link = '<a class="white" href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60">';
|
$servers_check_img_link = html_print_anchor(
|
||||||
$servers_check_img_link .= $servers_check_img;
|
[
|
||||||
$servers_check_img_link .= '</a>';
|
'href' => 'index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60',
|
||||||
|
'content' => $servers_check_img,
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
};
|
};
|
||||||
$servers_list .= $servers_check_img_link.'</div>';
|
|
||||||
|
$servers_list = html_print_div(
|
||||||
|
[
|
||||||
|
'id' => 'servers_list',
|
||||||
|
'content' => $servers_check_img_link,
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -71,9 +81,9 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
|
|
||||||
$check_minor_release_available = db_check_minor_relase_available();
|
$check_minor_release_available = db_check_minor_relase_available();
|
||||||
|
|
||||||
if ($check_minor_release_available) {
|
if ($check_minor_release_available === true) {
|
||||||
if (users_is_admin($config['id_user'])) {
|
if (users_is_admin($config['id_user'])) {
|
||||||
if ($config['language'] == 'es') {
|
if ($config['language'] === 'es') {
|
||||||
set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. <a id="aviable_updates" target="blank" href="https://pandorafms.com/manual/es/documentation/02_installation/02_anexo_upgrade#version_70ng_rolling_release">'.__('Sobre actualización de revisión menor').'</a>', 'Revisión/es menor/es disponible/s');
|
set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. <a id="aviable_updates" target="blank" href="https://pandorafms.com/manual/es/documentation/02_installation/02_anexo_upgrade#version_70ng_rolling_release">'.__('Sobre actualización de revisión menor').'</a>', 'Revisión/es menor/es disponible/s');
|
||||||
} else {
|
} else {
|
||||||
set_pandora_error_for_header('There are one or more minor releases waiting for update. <a id="aviable_updates" target="blank" href="https://pandorafms.com/manual/en/documentation/02_installation/02_anexo_upgrade#version_70ng_rolling_release">'.__('About minor release update').'</a>', 'minor release/s available');
|
set_pandora_error_for_header('There are one or more minor releases waiting for update. <a id="aviable_updates" target="blank" href="https://pandorafms.com/manual/en/documentation/02_installation/02_anexo_upgrade#version_70ng_rolling_release">'.__('About minor release update').'</a>', 'minor release/s available');
|
||||||
@ -107,6 +117,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$search_bar .= '<div id="result_order" class="result_order"></div>';
|
||||||
$search_bar .= '<input id="keywords" name="keywords"';
|
$search_bar .= '<input id="keywords" name="keywords"';
|
||||||
if (!isset($config['search_keywords'])) {
|
if (!isset($config['search_keywords'])) {
|
||||||
$search_bar .= "value='".__('Enter keywords to search')."'";
|
$search_bar .= "value='".__('Enter keywords to search')."'";
|
||||||
@ -116,15 +127,11 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
$search_bar .= "value='".$config['search_keywords']."'";
|
$search_bar .= "value='".$config['search_keywords']."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$search_bar .= 'type="search" onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
|
$search_bar .= 'type="search" onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');" onkeyup="showinterpreter()" class="search_input"/>';
|
||||||
onkeyup="showinterpreter()" class="search_input"/>';
|
|
||||||
|
|
||||||
|
|
||||||
$search_bar .= '<div id="result_order" class="result_order"></div>';
|
|
||||||
// $search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
|
// $search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
|
||||||
$search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />";
|
$search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />";
|
||||||
$search_bar .= '</form>';
|
$search_bar .= '</form>';
|
||||||
|
|
||||||
$header_searchbar = '<div id="header_searchbar">'.$search_bar.'</div>';
|
$header_searchbar = '<div id="header_searchbar">'.$search_bar.'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,10 +234,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
|
|
||||||
if ($do_refresh) {
|
if ($do_refresh) {
|
||||||
$autorefresh_img = html_print_image(
|
$autorefresh_img = html_print_image(
|
||||||
'images/header_refresh_gray.png',
|
'images/auto_refresh@header.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'class' => 'bot',
|
'class' => 'main_menu_icon bot',
|
||||||
'alt' => 'lightning',
|
'alt' => 'lightning',
|
||||||
'title' => __('Configure autorefresh'),
|
'title' => __('Configure autorefresh'),
|
||||||
]
|
]
|
||||||
@ -293,10 +300,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
$display_counter = 'display:block';
|
$display_counter = 'display:block';
|
||||||
} else {
|
} else {
|
||||||
$autorefresh_img = html_print_image(
|
$autorefresh_img = html_print_image(
|
||||||
'images/header_refresh_disabled_gray.png',
|
'images/auto_refresh@header.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'class' => 'bot autorefresh_disabled invert_filter',
|
'class' => 'main_menu_icon bot autorefresh_disabled invert_filter',
|
||||||
'alt' => 'lightning',
|
'alt' => 'lightning',
|
||||||
'title' => __('Disabled autorefresh'),
|
'title' => __('Disabled autorefresh'),
|
||||||
]
|
]
|
||||||
@ -312,10 +319,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$autorefresh_img = html_print_image(
|
$autorefresh_img = html_print_image(
|
||||||
'images/header_refresh_disabled_gray.png',
|
'images/auto_refresh@header.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'class' => 'bot autorefresh_disabled invert_filter',
|
'class' => 'main_menu_icon bot autorefresh_disabled invert_filter',
|
||||||
'alt' => 'lightning',
|
'alt' => 'lightning',
|
||||||
'title' => __('Disabled autorefresh'),
|
'title' => __('Disabled autorefresh'),
|
||||||
]
|
]
|
||||||
@ -350,9 +357,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
$header_feedback .= '<div id="modal-feedback-form" class="invisible"></div>';
|
$header_feedback .= '<div id="modal-feedback-form" class="invisible"></div>';
|
||||||
$header_feedback .= '<div id="msg-header" class="invisible"></div>';
|
$header_feedback .= '<div id="msg-header" class="invisible"></div>';
|
||||||
$header_feedback .= html_print_image(
|
$header_feedback .= html_print_image(
|
||||||
'images/feedback-header.png',
|
'images/send_feedback@header.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
|
'class' => 'main_menu_icon invert_filter',
|
||||||
'title' => __('Feedback'),
|
'title' => __('Feedback'),
|
||||||
'id' => 'feedback-header',
|
'id' => 'feedback-header',
|
||||||
'alt' => __('Feedback'),
|
'alt' => __('Feedback'),
|
||||||
@ -373,11 +381,11 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
$header_support = '<div id="header_support">';
|
$header_support = '<div id="header_support">';
|
||||||
$header_support .= '<a href="'.ui_get_full_external_url($header_support_link).'" target="_blank">';
|
$header_support .= '<a href="'.ui_get_full_external_url($header_support_link).'" target="_blank">';
|
||||||
$header_support .= html_print_image(
|
$header_support .= html_print_image(
|
||||||
'images/header_support.png',
|
'images/support@header.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'title' => __('Go to support'),
|
'title' => __('Go to support'),
|
||||||
'class' => 'bot invert_filter',
|
'class' => 'main_menu_icon bot invert_filter',
|
||||||
'alt' => 'user',
|
'alt' => 'user',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@ -387,11 +395,11 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
$header_docu = '<div id="header_docu">';
|
$header_docu = '<div id="header_docu">';
|
||||||
$header_docu .= '<a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">';
|
$header_docu .= '<a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">';
|
||||||
$header_docu .= html_print_image(
|
$header_docu .= html_print_image(
|
||||||
'images/header_docu.png',
|
'images/documentation@header.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'title' => __('Go to documentation'),
|
'title' => __('Go to documentation'),
|
||||||
'class' => 'bot invert_filter',
|
'class' => 'main_menu_icon bot invert_filter',
|
||||||
'alt' => 'user',
|
'alt' => 'user',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@ -399,34 +407,38 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
|
|
||||||
|
|
||||||
// User.
|
// User.
|
||||||
if (is_user_admin($config['id_user']) == 1) {
|
// $headerUserImage = (is_user_admin($config['id_user']) === true) ? 'images/header_user_admin_green.png' : 'images/header_user_green.png';
|
||||||
$header_user = html_print_image(
|
$headerUser = [];
|
||||||
'images/header_user_admin_green.png',
|
$headerUser[] = html_print_image(
|
||||||
|
'images/edit_user@header.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'title' => __('Edit my user'),
|
'title' => __('Edit my user'),
|
||||||
'class' => 'bot',
|
'class' => 'main_menu_icon bot invert_filter',
|
||||||
'alt' => 'user',
|
'alt' => 'user',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
$header_user = html_print_image(
|
|
||||||
'images/header_user_green.png',
|
|
||||||
true,
|
|
||||||
[
|
|
||||||
'title' => __('Edit my user'),
|
|
||||||
'class' => 'bot',
|
|
||||||
'alt' => 'user',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$header_user = '<div id="header_user"><a href="index.php?sec=workspace&sec2=operation/users/user_edit">'.$header_user.'<span id="user_name_header"> ('.$config['id_user'].')</span></a></div>';
|
$headerUser[] = sprintf('<span id="user_name_header">[ %s ]</span>', $config['id_user']);
|
||||||
|
|
||||||
|
$header_user = html_print_div(
|
||||||
|
[
|
||||||
|
'id' => 'header_user',
|
||||||
|
'content' => html_print_anchor(
|
||||||
|
[
|
||||||
|
'href' => sprintf('index.php?sec=gusuarios&sec2=godmode/users/configure_user&edit_user=1&pure=0&id_user=%s', $config['id_user']),
|
||||||
|
'content' => implode('', $headerUser),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
// Logout.
|
// Logout.
|
||||||
$header_logout = '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
|
$header_logout = '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
|
||||||
$header_logout .= html_print_image(
|
$header_logout .= html_print_image(
|
||||||
'images/header_logout_gray.png',
|
'images/sign_out@header.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'alt' => __('Logout'),
|
'alt' => __('Logout'),
|
||||||
@ -456,10 +468,6 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
</div> <!-- Closes #table_header_inner -->
|
</div> <!-- Closes #table_header_inner -->
|
||||||
</div> <!-- Closes #table_header -->
|
</div> <!-- Closes #table_header -->
|
||||||
|
|
||||||
|
|
||||||
<!-- Notifications content wrapper-->
|
|
||||||
<div id='notification-content' class='invisible'/></div>
|
|
||||||
|
|
||||||
<!-- Old style div wrapper -->
|
<!-- Old style div wrapper -->
|
||||||
<div id="alert_messages" class="invisible"></div>
|
<div id="alert_messages" class="invisible"></div>
|
||||||
|
|
||||||
|
@ -30,15 +30,20 @@ require_once __DIR__.'/../include/functions_html.php';
|
|||||||
|
|
||||||
if ($config['visual_animation']) {
|
if ($config['visual_animation']) {
|
||||||
echo '<style>
|
echo '<style>
|
||||||
@keyframes login_move {
|
div.container_login {
|
||||||
from {margin-left: 10%;margin-right: 10%;opacity:0.1}
|
animation: container_login 3s ease;
|
||||||
to {margin-left: 5%;margin-right: 5%;opacity:1}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes container_login {
|
||||||
|
0% {
|
||||||
|
transform: scale(.9);
|
||||||
|
opacity: 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
div.container_login{
|
100% {
|
||||||
animation-name: login_move;
|
transform: scale(1);
|
||||||
animation-duration: 3s;
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>';
|
</style>';
|
||||||
}
|
}
|
||||||
@ -87,18 +92,36 @@ if (!empty($page) && !empty($sec)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$login_body_style = '';
|
$login_body_style = '';
|
||||||
$login_body_class = '';
|
|
||||||
// Overrides the default background with the defined by the user.
|
// Overrides the default background with the defined by the user.
|
||||||
if (!empty($config['login_background'])) {
|
$background_url = 'images/backgrounds/background_pandora_console_keys.jpg';
|
||||||
|
|
||||||
|
if (empty($config['random_background']) === false) {
|
||||||
|
$random_backgrounds = scandir($config['homedir'].'/images/backgrounds/random_backgrounds');
|
||||||
|
unset($random_backgrounds[0], $random_backgrounds[1]);
|
||||||
|
$random_background = array_rand($random_backgrounds);
|
||||||
|
$background_url = 'images/backgrounds/random_backgrounds/'.$random_backgrounds[$random_background];
|
||||||
|
$background_100 = 'background-size: 100% 100% !important; ';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($config['login_background']) === false) {
|
||||||
$background_url = 'images/backgrounds/'.$config['login_background'];
|
$background_url = 'images/backgrounds/'.$config['login_background'];
|
||||||
$login_body_style = "style=\"background-size: 100% 100% !important;background:linear-gradient(74deg, rgba(2, 2, 2, 0.333) 36%, transparent 36%), url('".$background_url."');\"";
|
$background_100 = 'background-size: 100% 100% !important; ';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Support for Internet Explorer and Microsoft Edge browsers
|
// Support for Internet Explorer and Microsoft Edge browsers
|
||||||
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Edge') !== false) {
|
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Edge') !== false) {
|
||||||
$login_body_class = "class='login_body_trident'";
|
$background_url = 'images/backgrounds/background_pandora_console_keys.jpg';
|
||||||
|
$background_100 = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($config['background_opacity']) === false) {
|
||||||
|
$opacity = $config['background_opacity'];
|
||||||
|
} else {
|
||||||
|
$opacity = 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
$login_body_style = 'style="'.$background_100.'background: linear-gradient(rgba(0,0,0,.'.$opacity.'), rgba(0,0,0,.'.$opacity.")), url('".$background_url."');\"";
|
||||||
|
|
||||||
// Get alternative custom in case of db fail.
|
// Get alternative custom in case of db fail.
|
||||||
$custom_fields = [
|
$custom_fields = [
|
||||||
'custom_logo_login',
|
'custom_logo_login',
|
||||||
@ -123,36 +146,36 @@ foreach ($custom_fields as $field) {
|
|||||||
// Get the custom icons.
|
// Get the custom icons.
|
||||||
$docs_logo = ui_get_docs_logo();
|
$docs_logo = ui_get_docs_logo();
|
||||||
$support_logo = ui_get_support_logo();
|
$support_logo = ui_get_support_logo();
|
||||||
echo '<div id="login_body" '.$login_body_class.' '.$login_body_style.'>';
|
echo '<div id="login_body" '.$login_body_style.'>';
|
||||||
echo '<div id="header_login">';
|
echo '<div id="header_login">';
|
||||||
|
|
||||||
echo '<div id="list_icon_docs_support"><ul>';
|
echo '<div id="list_icon_docs_support"><ul>';
|
||||||
|
|
||||||
if (isset($config['custom_docs_url'])) {
|
if (isset($config['custom_docs_url'])) {
|
||||||
if ($docs_logo !== false) {
|
if ($docs_logo !== false) {
|
||||||
echo '<li><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
|
echo '<li id="li_margin_doc_img"><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<li><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">'.__('Docs').'</li>';
|
echo '<li id="li_margin_doc"><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">'.__('Docs').'</li>';
|
||||||
} else if (!$custom_conf_enabled) {
|
} else if (!$custom_conf_enabled) {
|
||||||
echo '<li><a href="https://pandorafms.com/manual/" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
|
echo '<li id="li_margin_doc_img"><a href="https://pandorafms.com/manual/" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
|
||||||
echo '<li><a href="https://pandorafms.com/manual/" target="_blank">'.__('Docs').'</li>';
|
echo '<li id="li_margin_doc"><a href="https://pandorafms.com/manual/" target="_blank">'.__('Docs').'</li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($config['custom_support_url'])) {
|
if (isset($config['custom_support_url'])) {
|
||||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||||
if ($support_logo !== false) {
|
if ($support_logo !== false) {
|
||||||
echo '<li id="li_margin_left"><a href="'.ui_get_full_external_url($config['custom_support_url']).'" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
|
echo '<li id="li_margin_support_img"><a href="'.ui_get_full_external_url($config['custom_support_url']).'" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<li><a href="'.ui_get_full_external_url($config['custom_support_url']).'" target="_blank">'.__('Support').'</li>';
|
echo '<li id="li_margin_support"><a href="'.ui_get_full_external_url($config['custom_support_url']).'" target="_blank">'.__('Support').'</li>';
|
||||||
} else {
|
} else {
|
||||||
echo '<li id="li_margin_left"><a href="https://pandorafms.com/monitoring-services/support/" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
|
echo '<li id="li_margin_support_img"><a href="https://pandorafms.com/monitoring-services/support/" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
|
||||||
echo '<li>'.__('Support').'</li>';
|
echo '<li id="li_margin_support"><a href="https://support.pandorafms.com" target="_blank">'.__('Support').'</a></li>';
|
||||||
}
|
}
|
||||||
} else if (!$custom_conf_enabled) {
|
} else if (!$custom_conf_enabled) {
|
||||||
echo '<li id="li_margin_left"><a href="https://support.pandorafms.com" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
|
echo '<li id="li_margin_support_img"><a href="https://support.pandorafms.com" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
|
||||||
echo '<li><a href="https://support.pandorafms.com" target="_blank">'.__('Docs').'</li>';
|
echo '<li id="li_margin_support"><a href="https://support.pandorafms.com" target="_blank">'.__('Support').'</a></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</ul></div>';
|
echo '</ul></div>';
|
||||||
@ -248,15 +271,30 @@ switch ($login_screen) {
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
echo '<div id="log_button" class="login_button invisible">';
|
echo '<div id="log_button" class="login_button invisible">';
|
||||||
html_print_submit_button(__('Login as admin'), 'login_button', false, 'class="next_login"');
|
html_print_submit_button(__('Login as admin'), 'login_button', false, [ 'fixed_id' => 'submit-login_button', 'class' => 'next_login']);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
echo '<div class="login_button" id="remove_button">';
|
echo '<div class="login_button" id="remove_button">';
|
||||||
echo '<input type="button" id="input_saml" value="Login as admin" onclick="show_normal_menu()">';
|
html_print_submit_button(
|
||||||
|
__('Login as admin'),
|
||||||
|
'input_saml',
|
||||||
|
false,
|
||||||
|
[
|
||||||
|
'fixed_id' => 'submit-login_button',
|
||||||
|
'class' => 'next_login',
|
||||||
|
'onclick' => 'show_normal_menu()',
|
||||||
|
'id' => 'input_saml',
|
||||||
|
]
|
||||||
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
echo '<div class="login_button login_button_saml">';
|
echo '<div class="login_button login_button_saml">';
|
||||||
html_print_submit_button(__('Login with SAML'), 'login_button_saml', false, '');
|
html_print_submit_button(
|
||||||
|
__('Login with SAML'),
|
||||||
|
'login_button_saml',
|
||||||
|
false,
|
||||||
|
['class' => 'next_login secondary']
|
||||||
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
} else {
|
} else {
|
||||||
echo '<div class="login_nick">';
|
echo '<div class="login_nick">';
|
||||||
@ -288,7 +326,15 @@ switch ($login_screen) {
|
|||||||
);
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div class="login_button">';
|
echo '<div class="login_button">';
|
||||||
html_print_submit_button(__('Login'), 'login_button', false, 'class="next_login"');
|
html_print_submit_button(
|
||||||
|
__('Login'),
|
||||||
|
'login_button',
|
||||||
|
false,
|
||||||
|
[
|
||||||
|
'fixed_id' => 'submit-login_button',
|
||||||
|
'icon' => 'signin',
|
||||||
|
]
|
||||||
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -302,12 +348,13 @@ switch ($login_screen) {
|
|||||||
|
|
||||||
echo '<div class="login_nick">';
|
echo '<div class="login_nick">';
|
||||||
echo '<div>';
|
echo '<div>';
|
||||||
html_print_image('/images/icono_autenticacion.png', false);
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
html_print_input_text_extended('auth_code', '', 'auth_code', '', '', '', false, '', 'class="login login_password" placeholder="'.__('Authentication code').'"', false, true);
|
html_print_input_text_extended('auth_code', '', 'auth_code', '', '', '', false, '', 'class="login login_password" placeholder="'.__('Authentication code').'"', false, true);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div class="login_button">';
|
echo '<div class="login_button">';
|
||||||
html_print_submit_button(__('Check code').' >', 'login_button', false, 'class="next_login"');
|
// html_print_submit_button(__('Check code').' >', 'login_button', false, 'class="next_login"');
|
||||||
|
html_print_submit_button(__('Check code').' >', 'login_button', false, [ 'fixed_id' => 'submit-login_button', 'class' => 'next_login']);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -337,17 +384,18 @@ if ($config['enterprise_installed']) {
|
|||||||
echo '<a href="javascript:centralized_mode_reset_dialog();">'.__('Forgot your password?');
|
echo '<a href="javascript:centralized_mode_reset_dialog();">'.__('Forgot your password?');
|
||||||
echo '</a>';
|
echo '</a>';
|
||||||
|
|
||||||
echo '<div id="centralized_mode_reset_dialog" title="'.__('Password reset').'" style="display:none">';
|
echo '<div id="centralized_mode_reset_dialog" title="'.__('Centralized mode').'" style="display:none">';
|
||||||
echo '<div class="content_alert">';
|
echo '<div class="content_alert">';
|
||||||
echo '<div class="icon_message_alert">';
|
echo '<div class="icon_message_alert">';
|
||||||
echo html_print_image('images/icono_stop.png', true, ['alt' => __('Password reset'), 'border' => 0]);
|
echo html_print_image('images/icono_stop.png', true, ['alt' => __('Centralized mode'), 'border' => 0]);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div class="content_message_alert">';
|
echo '<div class="content_message_alert">';
|
||||||
echo '<div class="text_message_alert">';
|
echo '<div class="text_message_alert">';
|
||||||
echo '<p>'.__('This node is configured with centralized mode. Go to metaconsole to reset the password').'</p>';
|
echo '<p>'.__('This node is configured with centralized mode. Go to metaconsole to reset the password').'</p>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
echo '<br>';
|
||||||
echo '<div class="button_message_alert">';
|
echo '<div class="button_message_alert">';
|
||||||
html_print_submit_button('Ok', 'centralized_mode_reset_button', false);
|
html_print_submit_button('Ok', 'centralized_mode_reset_button', false, ['class' => 'mini float-right']);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
@ -358,13 +406,27 @@ if ($config['enterprise_installed']) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<div class="loader" id="spinner_login">
|
||||||
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
echo '<div id="ver_num">'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '').'</div>';
|
||||||
|
|
||||||
// CSRF validation.
|
// CSRF validation.
|
||||||
|
if (isset($_SESSION['csrf_code']) === true) {
|
||||||
|
unset($_SESSION['csrf_code']);
|
||||||
|
}
|
||||||
|
|
||||||
html_print_csrf_hidden();
|
html_print_csrf_hidden();
|
||||||
|
|
||||||
echo '</form></div>';
|
echo '</form></div>';
|
||||||
echo '<div class="login_data">';
|
echo '<div class="login_data">';
|
||||||
echo '<div class ="text_banner_login">';
|
echo '<div class ="text_banner_login">';
|
||||||
echo '<div><span class="span1 pandora_upper">';
|
echo '<div><span class="span1">';
|
||||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||||
if ($config['custom_title1_login']) {
|
if ($config['custom_title1_login']) {
|
||||||
echo io_safe_output($config['custom_title1_login']);
|
echo io_safe_output($config['custom_title1_login']);
|
||||||
@ -391,7 +453,7 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div class ="img_banner_login">';
|
echo '<div class ="img_banner_login">';
|
||||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||||
if (isset($config['custom_splash_login'])) {
|
if (empty($config['custom_splash_login']) === false && $config['custom_splash_login'] !== 'default') {
|
||||||
html_print_image(
|
html_print_image(
|
||||||
'enterprise/images/custom_splash_login/'.$config['custom_splash_login'],
|
'enterprise/images/custom_splash_login/'.$config['custom_splash_login'],
|
||||||
false,
|
false,
|
||||||
@ -403,25 +465,39 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
html_print_image(
|
echo '
|
||||||
'enterprise/images/custom_splash_login/splash_image_default.png',
|
<div class="loginimg-container">
|
||||||
false,
|
<div class="lineone"></div>
|
||||||
[
|
<div class="linetwo"></div>
|
||||||
'alt' => 'logo',
|
<div class="linethree"></div>
|
||||||
'border' => 0,
|
<div style="display:flex;">
|
||||||
],
|
<div class="towerone"></div>
|
||||||
false,
|
<div class="towertwo"></div>
|
||||||
false
|
<div class="towerthree"></div>
|
||||||
);
|
<div class="towerfour"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
html_print_image('images/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0], false, true);
|
echo '
|
||||||
|
<div class="loginimg-container">
|
||||||
|
<div class="lineone"></div>
|
||||||
|
<div class="linetwo"></div>
|
||||||
|
<div class="linethree"></div>
|
||||||
|
<div style="display:flex;">
|
||||||
|
<div class="towerone"></div>
|
||||||
|
<div class="towertwo"></div>
|
||||||
|
<div class="towerthree"></div>
|
||||||
|
<div class="towerfour"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div id="ver_num">'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '').'</div>';
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
if (empty($process_error_message) && isset($mail)) {
|
if (empty($process_error_message) && isset($mail)) {
|
||||||
@ -435,25 +511,28 @@ if (empty($process_error_message) && isset($mail)) {
|
|||||||
echo '<h1>'.__('INFO').'</h1>';
|
echo '<h1>'.__('INFO').'</h1>';
|
||||||
echo '<p>'.__('An email has been sent to your email address').'</p>';
|
echo '<p>'.__('An email has been sent to your email address').'</p>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
echo '<br>';
|
||||||
echo '<div class="button_message_alert">';
|
echo '<div class="button_message_alert">';
|
||||||
html_print_submit_button('Ok', 'reset_correct_button', false);
|
html_print_submit_button('Ok', 'reset_correct_button', false, ['class' => 'mini float-right']);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
} else if (isset($process_error_message) && !empty($process_error_message)) {
|
} else if (isset($process_error_message) && !empty($process_error_message)) {
|
||||||
echo '<div id="reset_correct" title="'.__('Password reset').'">';
|
echo '<div id="reset_correct" title="'.__('Error').'">';
|
||||||
echo '<div class="content_alert">';
|
echo '<div class="content_alert">';
|
||||||
echo '<div class="icon_message_alert">';
|
echo '<div class="icon_message_alert">';
|
||||||
echo html_print_image('images/icono_stop.png', true, ['alt' => __('Password reset'), 'border' => 0]);
|
echo html_print_image('images/icono_stop.png', true, ['alt' => __('Forbidden'), 'border' => 0]);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div class="content_message_alert">';
|
echo '<div class="content_message_alert">';
|
||||||
echo '<div class="text_message_alert">';
|
echo '<div class="text_message_alert">';
|
||||||
echo '<h1>'.__('ERROR').'</h1>';
|
echo '<h1>'.__('ERROR').'</h1>';
|
||||||
echo '<p>'.$process_error_message.'</p>';
|
echo '<p>'.$process_error_message.'</p>';
|
||||||
|
echo '<br>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
echo '<br>';
|
||||||
echo '<div class="button_message_alert">';
|
echo '<div class="button_message_alert">';
|
||||||
html_print_submit_button('Ok', 'reset_correct_button', false);
|
html_print_submit_button('Ok', 'reset_correct_button', false, ['class' => 'mini float-right']);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
@ -472,8 +551,9 @@ if (isset($correct_reset_pass_process)) {
|
|||||||
echo '<h1>'.__('SUCCESS').'</h1>';
|
echo '<h1>'.__('SUCCESS').'</h1>';
|
||||||
echo '<p>'.$correct_reset_pass_process.'</p>';
|
echo '<p>'.$correct_reset_pass_process.'</p>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
echo '<br>';
|
||||||
echo '<div class="button_message_alert">';
|
echo '<div class="button_message_alert">';
|
||||||
html_print_submit_button('Ok', 'final_process_correct_button', false);
|
html_print_submit_button('Ok', 'final_process_correct_button', false, ['class' => 'mini float-right']);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
@ -481,9 +561,36 @@ if (isset($correct_reset_pass_process)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($login_failed)) {
|
if (isset($login_failed)) {
|
||||||
$nick = get_parameter_post('nick');
|
$nick = io_safe_input(get_parameter_post('nick'));
|
||||||
$fails = db_get_value('failed_attempt', 'tusuario', 'id_user', $nick);
|
$user_in_db = db_get_row_filter(
|
||||||
|
'tusuario',
|
||||||
|
['id_user' => $nick],
|
||||||
|
'*'
|
||||||
|
);
|
||||||
|
$fails = $user_in_db['failed_attempt'];
|
||||||
|
// If user not exist, and attempts its enable, lets make array and fails attemps.
|
||||||
|
if ($fails == false && $config['enable_pass_policy'] && $user_in_db === false) {
|
||||||
|
$nick_array_error = json_decode(base64_decode($config['nicks_error']), true);
|
||||||
|
$nick = strtolower($nick);
|
||||||
|
if (isset($nick_array_error[$nick]) !== false) {
|
||||||
|
$nick_array_error[$nick] += 1;
|
||||||
|
} else {
|
||||||
|
$nick_array_error[$nick] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fails = $nick_array_error[$nick];
|
||||||
|
// Save or update the array.
|
||||||
|
if ($config['nicks_error']) {
|
||||||
|
config_update_value('nicks_error', base64_encode(json_encode($nick_array_error)));
|
||||||
|
} else {
|
||||||
|
config_create_value('nicks_error', base64_encode(json_encode($nick_array_error)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$fails = ++$fails;
|
||||||
|
}
|
||||||
|
|
||||||
$attemps = ($config['number_attempts'] - $fails);
|
$attemps = ($config['number_attempts'] - $fails);
|
||||||
|
$attemps = ($attemps < 0) ? 0 : $attemps;
|
||||||
echo '<div id="login_failed" title="'.__('Login failed').'">';
|
echo '<div id="login_failed" title="'.__('Login failed').'">';
|
||||||
echo '<div class="content_alert">';
|
echo '<div class="content_alert">';
|
||||||
echo '<div class="icon_message_alert">';
|
echo '<div class="icon_message_alert">';
|
||||||
@ -496,12 +603,18 @@ if (isset($login_failed)) {
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
if ($config['enable_pass_policy']) {
|
if ($config['enable_pass_policy']) {
|
||||||
echo '<div class="text_message_alert">';
|
echo '<div class="text_message_alert">';
|
||||||
echo '<p><strong>Remaining attempts: '.$attemps.'</strong></p>';
|
if ($attemps !== 0 && $user_in_db['login_blocked'] == 0) {
|
||||||
|
echo '<p><strong>'.__('Remaining attempts: ').$attemps.'</strong></p>';
|
||||||
|
} else {
|
||||||
|
echo '<p><strong>'.__('User is blocked').'</strong></p>';
|
||||||
|
}
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo '<br>';
|
||||||
echo '<div class="button_message_alert">';
|
echo '<div class="button_message_alert">';
|
||||||
html_print_submit_button('Ok', 'hide-login-error', false);
|
html_print_submit_button('Ok', 'hide-login-error', false, ['class' => ' mini float-right']);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
@ -524,8 +637,9 @@ if ($login_screen == 'logout') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
echo '<br>';
|
||||||
echo '<div class="button_message_alert">';
|
echo '<div class="button_message_alert">';
|
||||||
html_print_submit_button('Ok', 'hide-login-logout', false);
|
html_print_submit_button('Ok', 'hide-login-logout', false, ['class' => ' mini float-right']);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
@ -543,8 +657,9 @@ if ($login_screen === 'disabled_access_node') {
|
|||||||
echo '<h1>'.__('Centralized user in metaconsole').'</h1>';
|
echo '<h1>'.__('Centralized user in metaconsole').'</h1>';
|
||||||
echo '<p>'.__('This user does not have access on node, please enable node access on this user from metaconsole.').'</p>';
|
echo '<p>'.__('This user does not have access on node, please enable node access on this user from metaconsole.').'</p>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
echo '<br>';
|
||||||
echo '<div class="button_message_alert">';
|
echo '<div class="button_message_alert">';
|
||||||
html_print_submit_button('Ok', 'hide-login-logout', false);
|
html_print_submit_button('Ok', 'hide-login-logout', false, ['class' => 'mini float-right']);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
@ -651,8 +766,9 @@ if ($login_screen == 'error_authconfig' || $login_screen == 'error_emptyconfig'
|
|||||||
echo '<h1>'.$title.'</h1>';
|
echo '<h1>'.$title.'</h1>';
|
||||||
echo '<p> '.$message.'</h1>';
|
echo '<p> '.$message.'</h1>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
echo '<br>';
|
||||||
echo '<div class="button_message_alert">';
|
echo '<div class="button_message_alert">';
|
||||||
html_print_submit_button('Ok', 'hide-login-error', false);
|
html_print_submit_button('Ok', 'hide-login-error', false, ['class' => 'mini float-right']);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
@ -707,7 +823,7 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#submit-hide-login-error").click (function () {
|
$("#button-hide-login-error").click (function () {
|
||||||
$("#modal_alert" ).dialog('close');
|
$("#modal_alert" ).dialog('close');
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -722,18 +838,22 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
|||||||
resizable: true,
|
resizable: true,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
modal: true,
|
modal: true,
|
||||||
height: 220,
|
|
||||||
width: 528,
|
width: 528,
|
||||||
clickOutside: true,
|
clickOutside: true,
|
||||||
overlay: {
|
overlay: {
|
||||||
opacity: 0.5,
|
opacity: 0.5,
|
||||||
background: "black"
|
background: "black"
|
||||||
|
},
|
||||||
|
open: function (event, ui) {
|
||||||
|
$(".ui-widget-overlay").click(function () {
|
||||||
|
$('#login_logout').dialog('close');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#submit-hide-login-logout").click (function () {
|
$("#button-hide-login-logout").click (function () {
|
||||||
document.location = "<?php echo ui_get_full_url('index.php'); ?>";
|
$( "#login_logout" ).dialog( "close" );
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@ -745,7 +865,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
|||||||
resizable: true,
|
resizable: true,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
modal: true,
|
modal: true,
|
||||||
height: 220,
|
|
||||||
width: 528,
|
width: 528,
|
||||||
clickOutside: true,
|
clickOutside: true,
|
||||||
overlay: {
|
overlay: {
|
||||||
@ -755,7 +874,7 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#submit-hide-login-logout").click (function () {
|
$("#button-hide-login-logout").click (function () {
|
||||||
document.location = "<?php echo ui_get_full_url('index.php'); ?>";
|
document.location = "<?php echo ui_get_full_url('index.php'); ?>";
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -769,7 +888,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
|||||||
resizable: true,
|
resizable: true,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
modal: true,
|
modal: true,
|
||||||
height: 400,
|
|
||||||
width: 700,
|
width: 700,
|
||||||
overlay: {
|
overlay: {
|
||||||
opacity: 0.5,
|
opacity: 0.5,
|
||||||
@ -787,8 +905,8 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
|||||||
resizable: true,
|
resizable: true,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
modal: true,
|
modal: true,
|
||||||
height: 220,
|
height: 230,
|
||||||
width: 528,
|
width: 530,
|
||||||
overlay: {
|
overlay: {
|
||||||
opacity: 0.5,
|
opacity: 0.5,
|
||||||
background: "black"
|
background: "black"
|
||||||
@ -796,12 +914,11 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#submit-hide-login-error").click (function () {
|
$("#button-hide-login-error").click (function () {
|
||||||
$("#login_failed" ).dialog('close');
|
$("#login_failed" ).dialog('close');
|
||||||
$("#login_correct_pass").dialog('close');
|
$("#login_correct_pass").dialog('close');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#nick').focus();
|
$('#nick').focus();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -812,7 +929,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
|||||||
resizable: true,
|
resizable: true,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
modal: true,
|
modal: true,
|
||||||
height: 220,
|
|
||||||
width: 528,
|
width: 528,
|
||||||
clickOutside: true,
|
clickOutside: true,
|
||||||
overlay: {
|
overlay: {
|
||||||
@ -822,7 +938,7 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#submit-reset_correct_button").click (function () {
|
$("#button-reset_correct_button").click (function () {
|
||||||
$("#reset_correct").dialog('close');
|
$("#reset_correct").dialog('close');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -833,7 +949,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
|||||||
resizable: true,
|
resizable: true,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
modal: true,
|
modal: true,
|
||||||
height: 220,
|
|
||||||
width: 528,
|
width: 528,
|
||||||
clickOutside: true,
|
clickOutside: true,
|
||||||
overlay: {
|
overlay: {
|
||||||
@ -853,7 +968,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
|||||||
resizable: true,
|
resizable: true,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
modal: true,
|
modal: true,
|
||||||
height: 220,
|
|
||||||
width: 528,
|
width: 528,
|
||||||
overlay: {
|
overlay: {
|
||||||
opacity: 0.5,
|
opacity: 0.5,
|
||||||
@ -866,5 +980,18 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#submit-login_button span').removeAttr('style');
|
||||||
|
$('#spinner_login').hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#submit-login_button').click(function (e) {
|
||||||
|
$('.login_nick').hide();
|
||||||
|
$('.login_pass').hide();
|
||||||
|
$('.login_button').hide();
|
||||||
|
$('.reset_password').hide();
|
||||||
|
$('#spinner_login').show();
|
||||||
|
});
|
||||||
|
|
||||||
/* ]]> */
|
/* ]]> */
|
||||||
</script>
|
</script>
|
||||||
|
@ -124,8 +124,14 @@ foreach ($stats as $stat) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$status .= '</table>';
|
$status .= '</table>';
|
||||||
|
$table->rowclass = [];
|
||||||
|
$table->rowclass[0] = 'w100p';
|
||||||
|
$table->rowclass[1] = 'w100p';
|
||||||
|
$table->rowclass[2] = 'w100p';
|
||||||
|
$table->rowclass[3] = 'w100p';
|
||||||
|
$table->rowclass[4] = 'w100p';
|
||||||
|
$table->rowclass[5] = 'w100p';
|
||||||
$table->data[0][0] = $status;
|
$table->data[0][0] = $status;
|
||||||
$table->rowclass[] = '';
|
|
||||||
|
|
||||||
$table->data[] = $tdata;
|
$table->data[] = $tdata;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
*
|
*
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
|
||||||
* Please see http://pandorafms.org for full contribution list
|
* Please see http://pandorafms.org for full contribution list
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -26,38 +26,21 @@
|
|||||||
* ============================================================================
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use function PHPSTORM_META\map;
|
|
||||||
|
|
||||||
// Begin.
|
// Begin.
|
||||||
if (isset($config['id_user']) === false) {
|
if (isset($config['id_user']) === false) {
|
||||||
include 'general/login_page.php';
|
include 'general/login_page.php';
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
require_once 'include/functions_menu.php';
|
||||||
<script type="text/javascript" language="javascript">
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
// Global variable. Do not delete.
|
||||||
var menuType_value = "<?php echo ($_SESSION['menu_type'] ?? ''); ?>";
|
$tab_active = '';
|
||||||
|
|
||||||
if (menuType_value === '' || menuType_value === 'classic') {
|
|
||||||
$('ul.submenu').css('left', '214px');
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$('ul.submenu').css('left', '59px');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<?php
|
|
||||||
$autohidden_menu = 0;
|
|
||||||
|
|
||||||
if (isset($config['autohidden_menu']) === true && (bool) $config['autohidden_menu'] === true) {
|
|
||||||
$autohidden_menu = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start of full lateral menu.
|
// Start of full lateral menu.
|
||||||
echo sprintf('<div id="menu_full" class="menu_full_%s">', $menuTypeClass);
|
echo sprintf('<div id="menu_full" class="menu_full_%s">', $menuTypeClass);
|
||||||
|
|
||||||
$url_logo = ui_get_full_url('index.php');
|
$url_logo = ui_get_full_url('index.php');
|
||||||
if (is_reporting_console_node() === true) {
|
if (is_reporting_console_node() === true) {
|
||||||
$url_logo = 'index.php?logged=1&sec=discovery&sec2=godmode/servers/discovery&wiz=tasklist';
|
$url_logo = 'index.php?logged=1&sec=discovery&sec2=godmode/servers/discovery&wiz=tasklist';
|
||||||
@ -76,52 +59,98 @@ html_print_div(
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
true
|
true
|
||||||
),
|
).'<div id="button_collapse" class="button_'.$menuTypeClass.'" style="cursor: pointer"></div>',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
require 'operation/menu.php';
|
$display_classic = '';
|
||||||
require 'godmode/menu.php';
|
$display_collapsed = 'display: none;';
|
||||||
|
if ($menuTypeClass === 'collapsed') {
|
||||||
|
$display_classic = 'display: none;';
|
||||||
|
$display_collapsed = '';
|
||||||
|
}
|
||||||
|
|
||||||
html_print_div(
|
|
||||||
[
|
// Tabs.
|
||||||
'id' => 'button_collapse',
|
echo '<div id="menu_tabs">';
|
||||||
'class' => sprintf('button_collapse button_%s', $menuTypeClass),
|
// Tabs classic.
|
||||||
]
|
echo '<ul class="tabs_ul" style="'.$display_classic.'">';
|
||||||
);
|
echo '<li id="tab_display" class="tabs_li"><span>'.__('Operation').'</span></a></li>';
|
||||||
|
echo '<li id="tab_management" class="tabs_li"><span>'.__('Management').'</span></a></li>';
|
||||||
|
echo '</ul>';
|
||||||
|
echo '<div class="div_border_line" style="'.$display_classic.'"><div id="tab_line_1" class="border_line"></div><div id="tab_line_2" class="border_line"></div></div>';
|
||||||
|
// Tabs collapse.
|
||||||
|
echo '<div class="tabs_collapsed" style="'.$display_collapsed.'">';
|
||||||
|
echo '<div class="tabs_collapsed_container">';
|
||||||
|
echo '<div id="tab_collapsed_display" class="tabs_collapsed_div" title="'.__('Operation').'"><div class="tabs_collapsed_display"></div></div>';
|
||||||
|
echo '<div id="tab_collapsed_management" class="tabs_collapsed_div" title="'.__('Management').'"><div class="tabs_collapsed_management"></div></div>';
|
||||||
|
echo '</div></div>';
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
// Menu_container.
|
|
||||||
ui_require_jquery_file('cookie');
|
|
||||||
|
|
||||||
$config_fixed_header = false;
|
echo '<div id="div_display">';
|
||||||
if (isset($config['fixed_header']) === true) {
|
require 'operation/menu.php';
|
||||||
$config_fixed_header = $config['fixed_header'];
|
echo '</div>';
|
||||||
}
|
echo '<div id="div_management">';
|
||||||
|
require 'godmode/menu.php';
|
||||||
|
echo '</div>';
|
||||||
|
echo '</div>';
|
||||||
?>
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
<script type="text/javascript" language="javascript">
|
$(document).ready(function() {
|
||||||
/* <![CDATA[ */
|
menuActionButtonResizing();
|
||||||
|
const menuTypeClass = '<?php echo $menuTypeClass; ?>';
|
||||||
$('#button_collapse').on('click', function() {
|
if (menuTypeClass === 'classic' && menuTypeClass !== localStorage.getItem('menuType')) {
|
||||||
|
localStorage.setItem('menuType', 'classic');
|
||||||
if($('#menu_full').hasClass('menu_full_classic')){
|
|
||||||
localStorage.setItem("menuType", "collapsed");
|
|
||||||
$('ul.submenu').css('left', '59px');
|
|
||||||
var menuType_val = localStorage.getItem("menuType");
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: "ajax.php",
|
|
||||||
data: {
|
|
||||||
menuType: menuType_val,
|
|
||||||
page: "include/functions_menu"
|
|
||||||
},
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else if($('#menu_full').hasClass('menu_full_collapsed')){
|
const tab = '<?php echo $tab_active; ?>';
|
||||||
localStorage.setItem("menuType", "classic");
|
|
||||||
$('ul.submenu').css('left', '214px');
|
if (tab === 'management') {
|
||||||
|
$('#tab_line_2').addClass('tabs_selected');
|
||||||
|
$('#div_display').css('display', 'none');
|
||||||
|
$('#div_management').css('display', 'block');
|
||||||
|
$('#tab_display').addClass('head_tab_unselected').removeClass('head_tab_selected');
|
||||||
|
$('#tab_management').addClass('head_tab_selected').removeClass('head_tab_unselected');
|
||||||
|
$('#tab_collapsed_display').children().first().removeClass('tabs_collapsed_display');
|
||||||
|
$('#tab_collapsed_display').children().first().addClass('tabs_collapsed_oval');
|
||||||
|
} else {
|
||||||
|
$('#tab_line_1').addClass('tabs_selected');
|
||||||
|
$('#tab_management').addClass('head_tab_unselected').removeClass('head_tab_selected');
|
||||||
|
$('#tab_display').addClass('head_tab_selected').removeClass('head_tab_unselected');
|
||||||
|
$('#tab_collapsed_management').children().first().removeClass('tabs_collapsed_management');
|
||||||
|
$('#tab_collapsed_management').children().first().addClass('tabs_collapsed_oval');
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#tab_display,#tab_collapsed_display').click(function() {
|
||||||
|
$('#tab_line_1').addClass('tabs_selected');
|
||||||
|
$('#tab_line_2').removeClass('tabs_selected');
|
||||||
|
$('#div_management').css('display', 'none');
|
||||||
|
$('#div_display').css('display', 'block');
|
||||||
|
$('#tab_management').addClass('head_tab_unselected').removeClass('head_tab_selected');
|
||||||
|
$('#tab_display').addClass('head_tab_selected').removeClass('head_tab_unselected');
|
||||||
|
$('#tab_collapsed_management').children().first().removeClass('tabs_collapsed_management');
|
||||||
|
$('#tab_collapsed_management').children().first().addClass('tabs_collapsed_oval');
|
||||||
|
$('#tab_collapsed_display').children().first().removeClass('tabs_collapsed_oval');
|
||||||
|
$('#tab_collapsed_display').children().first().addClass('tabs_collapsed_display');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#tab_management,#tab_collapsed_management').click(function() {
|
||||||
|
$('#tab_line_2').addClass('tabs_selected');
|
||||||
|
$('#tab_line_1').removeClass('tabs_selected');
|
||||||
|
$('#div_display').css('display', 'none');
|
||||||
|
$('#div_management').css('display', 'block');
|
||||||
|
$('#tab_display').addClass('head_tab_unselected').removeClass('head_tab_selected');
|
||||||
|
$('#tab_management').addClass('head_tab_selected').removeClass('head_tab_unselected');
|
||||||
|
$('#tab_collapsed_display').children().first().removeClass('tabs_collapsed_display');
|
||||||
|
$('#tab_collapsed_display').children().first().addClass('tabs_collapsed_oval');
|
||||||
|
$('#tab_collapsed_management').children().first().removeClass('tabs_collapsed_oval');
|
||||||
|
$('#tab_collapsed_management').children().first().addClass('tabs_collapsed_management');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#button_collapse').click(function() {
|
||||||
|
if ($('#menu_full').hasClass('menu_full_classic')) {
|
||||||
|
localStorage.setItem("menuType", "collapsed");
|
||||||
|
$('ul.submenu').css('left', '80px');
|
||||||
var menuType_val = localStorage.getItem("menuType");
|
var menuType_val = localStorage.getItem("menuType");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@ -132,207 +161,156 @@ $('#button_collapse').on('click', function() {
|
|||||||
},
|
},
|
||||||
dataType: "json"
|
dataType: "json"
|
||||||
});
|
});
|
||||||
|
$('.tabs_ul').hide();
|
||||||
|
$('.div_border_line').hide();
|
||||||
|
$('.tabs_collapsed').show();
|
||||||
|
|
||||||
|
$(".title_menu_classic").children('div[class*=icon_]').each(function() {
|
||||||
|
$(this).removeClass('w15p').addClass('w100p');
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".title_menu_classic").children('div[class*=arrow_]').each(function() {
|
||||||
|
$(this).hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".title_menu_classic").children('span').each(function() {
|
||||||
|
$(this).hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('ul.submenu').css('position', 'fixed');
|
||||||
|
$('ul.submenu').css('left', '60px');
|
||||||
|
|
||||||
|
$('li.selected').each(function() {
|
||||||
|
$(`#sub${this.id}`).hide();
|
||||||
|
})
|
||||||
|
} else if ($('#menu_full').hasClass('menu_full_collapsed')) {
|
||||||
|
localStorage.setItem("menuType", "classic");
|
||||||
|
$('ul.submenu').css('left', '280px');
|
||||||
|
var menuType_val = localStorage.getItem("menuType");
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "ajax.php",
|
||||||
|
data: {
|
||||||
|
menuType: menuType_val,
|
||||||
|
page: "include/functions_menu"
|
||||||
|
},
|
||||||
|
dataType: "json"
|
||||||
|
});
|
||||||
|
$('.tabs_ul').show();
|
||||||
|
$('.div_border_line').show();
|
||||||
|
$('.tabs_collapsed').hide();
|
||||||
|
|
||||||
|
$(".title_menu_classic").children('div[class*=icon_]').each(function() {
|
||||||
|
$(this).removeClass('w100p').addClass('w15p');
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".title_menu_classic").children('div[class*=arrow_]').each(function() {
|
||||||
|
$(this).show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".title_menu_classic").children('span').each(function() {
|
||||||
|
$(this).show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('ul.submenu').css('position', '');
|
||||||
|
$('ul.submenu').css('left', '80px');
|
||||||
|
|
||||||
|
$('li.selected').each(function() {
|
||||||
|
$(`#sub${this.id}`).show();
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.logo_full').toggle();
|
$('.logo_full').toggle();
|
||||||
$('.logo_icon').toggle();
|
$('.logo_icon').toggle();
|
||||||
$('#menu_full').toggleClass('menu_full_classic menu_full_collapsed');
|
$('#menu_full').toggleClass('menu_full_classic menu_full_collapsed');
|
||||||
$('#button_collapse').toggleClass('button_classic button_collapsed');
|
$('#button_collapse').toggleClass('button_classic button_collapsed');
|
||||||
$('div#title_menu').toggleClass('title_menu_classic title_menu_collapsed');
|
|
||||||
$('div#page').toggleClass('page_classic page_collapsed');
|
$('div#page').toggleClass('page_classic page_collapsed');
|
||||||
$('#header_table').toggleClass('header_table_classic header_table_collapsed');
|
$('#header_table').toggleClass('header_table_classic header_table_collapsed');
|
||||||
$('li.menu_icon').toggleClass("no_hidden_menu menu_icon_collapsed");
|
$('li.menu_icon').toggleClass("no_hidden_menu menu_icon_collapsed");
|
||||||
});
|
menuActionButtonResizing();
|
||||||
|
|
||||||
|
|
||||||
var autohidden_menu = <?php echo $autohidden_menu; ?>;
|
|
||||||
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
|
|
||||||
var id_user = "<?php echo $config['id_user']; ?>";
|
|
||||||
var cookie_name = id_user + '-pandora_menu_state';
|
|
||||||
var cookie_name_encoded = btoa(cookie_name);
|
|
||||||
var click_display = "<?php echo $config['click_display']; ?>";
|
|
||||||
|
|
||||||
|
|
||||||
var menuState = $.cookie(cookie_name_encoded);
|
|
||||||
if (!menuState) {
|
|
||||||
menuState = {};
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
menuState = JSON.parse(menuState);
|
|
||||||
open_submenus();
|
|
||||||
}
|
|
||||||
|
|
||||||
function open_submenus () {
|
|
||||||
$.each(menuState, function (index, value) {
|
|
||||||
if (value)
|
|
||||||
$('div.menu>ul>li#' + index + '>ul').show();
|
|
||||||
});
|
});
|
||||||
//$('div.menu>ul>li.selected>ul').removeClass('invisible');
|
|
||||||
}
|
|
||||||
|
|
||||||
function close_submenus () {
|
const id_selected = '<?php echo $menu1_selected; ?>';
|
||||||
$.each(menuState, function (index, value) {
|
if (id_selected != '') {
|
||||||
if (value)
|
var menuType_val = localStorage.getItem("menuType");
|
||||||
$('div.menu>ul>li#' + index + '>ul').hide();
|
if (menuType_val === 'classic') {
|
||||||
});
|
$(`ul#subicon_${id_selected}`).show();
|
||||||
//$('div.menu>ul>li.selected>ul').addClass('invisible');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// Arrow.
|
||||||
|
$(`#icon_${id_selected}`).children().first().children().last().removeClass('arrow_menu_down');
|
||||||
|
$(`#icon_${id_selected}`).children().first().children().last().addClass('arrow_menu_up');
|
||||||
|
// Span.
|
||||||
|
$(`#icon_${id_selected}`).children().first().children().eq(1).addClass('span_selected');
|
||||||
|
|
||||||
/* ]]> */
|
const id_selected2 = '<?php echo $menu2_selected; ?>';
|
||||||
</script>
|
if (id_selected2 != '') {
|
||||||
|
if ($(`#sub${id_selected2}`).length > 0) {
|
||||||
<script type="text/javascript">
|
$(`#sub${id_selected2}`).show();
|
||||||
openTime = 0;
|
// Arrow.
|
||||||
openTime2 = 0;
|
$(`#${id_selected2}`).children().first().children().last().removeClass('arrow_menu_down');
|
||||||
handsIn = 0;
|
$(`#${id_selected2}`).children().first().children().last().addClass('arrow_menu_up');
|
||||||
handsIn2 = 0;
|
// Span.
|
||||||
|
$(`#${id_selected2}`).children().first().children().first().addClass('span_selected');
|
||||||
|
// Vertical line.
|
||||||
/**
|
$(`.sub_subMenu.selected`).prepend(`<div class="element_submenu_selected left_3"></div>`);
|
||||||
* Positionate the submenu elements. Add a negative top.
|
|
||||||
*
|
|
||||||
* @param int index It is the position of li.menu_icon in the ul.
|
|
||||||
* @param string id_submenu It is the id of first level submenu.
|
|
||||||
* @param string id_submenu2 It is the id of second level submenu.
|
|
||||||
* @param int item_height It is the height of a menu item (28 o 35).
|
|
||||||
*
|
|
||||||
* @return (int) The position (in px).
|
|
||||||
*/
|
|
||||||
function menu_calculate_top(index, id_submenu, id_submenu2, item_height){
|
|
||||||
|
|
||||||
var level1 = index;
|
|
||||||
var level2 = $('#'+id_submenu+' ul.submenu > li').length;
|
|
||||||
var level3 = $('#'+id_submenu2+' > li.sub_subMenu').length;
|
|
||||||
var item_height = item_height;
|
|
||||||
|
|
||||||
level2--;
|
|
||||||
if (id_submenu2 !== false) {
|
|
||||||
// If level3 is set, the position is calculated like box is in the center.
|
|
||||||
// wiouth considering level2 box can be moved.
|
|
||||||
level3--;
|
|
||||||
total = (level1 + level3);
|
|
||||||
comp = level3;
|
|
||||||
} else {
|
} else {
|
||||||
total = (level1 + level2);
|
$(`#${id_selected2}`).addClass('submenu_selected_no_submenu');
|
||||||
comp = level2;
|
$(`#${id_selected2}`).children().first().children().first().css('color', '#fff');
|
||||||
|
// Vertical line.
|
||||||
|
$(`#${id_selected2}`).prepend(`<div class="element_submenu_selected"></div>`);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Positionate in the middle
|
|
||||||
if (total > 12 && ((total < 18) || ((level1 - comp) <= 4))) {
|
|
||||||
return - ( Math.floor(comp / 2) * item_height);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Positionate in the bottom
|
var click_display = "<?php echo $config['click_display']; ?>";
|
||||||
if (total >= 18) {
|
|
||||||
return (- comp * item_height);
|
|
||||||
}
|
|
||||||
|
|
||||||
// return 0 by default
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the menu items to be positioned.
|
|
||||||
*
|
|
||||||
* @param string item It is the selector of the current element.
|
|
||||||
*
|
|
||||||
* @return Add the top position in a inline style.
|
|
||||||
*/
|
|
||||||
function get_menu_items(item){
|
|
||||||
var item_height = parseInt(item.css('min-height'));
|
|
||||||
var id_submenu = item.attr('id');
|
|
||||||
var id_submenu2 = false;
|
|
||||||
var index = item.index();
|
|
||||||
|
|
||||||
if(item.parent().hasClass('godmode')){
|
|
||||||
index = index+6; // This is because the menu has divided in two parts.
|
|
||||||
}
|
|
||||||
var top_submenu = menu_calculate_top(index, id_submenu, id_submenu2, item_height);
|
|
||||||
top_submenu = top_submenu+'px';
|
|
||||||
$('#'+id_submenu+' ul.submenu').css('top', top_submenu);
|
|
||||||
|
|
||||||
$('.has_submenu').mouseenter(function() {
|
|
||||||
id_submenu2 = item.attr('id');
|
|
||||||
id_submenu2 = $('#'+id_submenu2+' ul.submenu2').attr('id');
|
|
||||||
var top_submenu2 = menu_calculate_top(index, id_submenu, id_submenu2, item_height);
|
|
||||||
top_submenu2 = top_submenu2+'px';
|
|
||||||
$('#'+id_submenu2).css('top', top_submenu2);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Show and hide submenus
|
|
||||||
*/
|
|
||||||
if(!click_display){
|
|
||||||
$('.menu_icon').mouseenter(function() {
|
$('.menu_icon').mouseenter(function() {
|
||||||
|
var menuType_val = localStorage.getItem("menuType");
|
||||||
|
if (!click_display && menuType_val === 'collapsed') {
|
||||||
table_hover = $(this);
|
table_hover = $(this);
|
||||||
handsIn = 1;
|
handsIn = 1;
|
||||||
openTime = new Date().getTime();
|
openTime = new Date().getTime();
|
||||||
$("ul#sub"+table_hover[0].id).show();
|
$("ul#sub"+table_hover[0].id).show();
|
||||||
get_menu_items(table_hover);
|
get_menu_items(table_hover);
|
||||||
if( typeof(table_noHover) != 'undefined')
|
if (typeof(table_noHover) != 'undefined') {
|
||||||
if ( "ul#sub"+table_hover[0].id != "ul#sub"+table_noHover[0].id )
|
if ("ul#sub"+table_hover[0].id != "ul#sub"+table_noHover[0].id ) {
|
||||||
$("ul#sub"+table_noHover[0].id).hide();
|
$("ul#sub"+table_noHover[0].id).hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}).mouseleave(function() {
|
}).mouseleave(function() {
|
||||||
|
var menuType_val = localStorage.getItem("menuType");
|
||||||
|
if (!click_display && menuType_val === 'collapsed') {
|
||||||
table_noHover = $(this);
|
table_noHover = $(this);
|
||||||
handsIn = 0;
|
handsIn = 0;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
opened = new Date().getTime() - openTime;
|
opened = new Date().getTime() - openTime;
|
||||||
if(opened > 3000 && handsIn == 0) {
|
if(opened > 2500 && handsIn == 0) {
|
||||||
openTime = 4000;
|
openTime = 4000;
|
||||||
$("ul#sub"+table_noHover[0].id).hide();
|
$("ul#sub"+table_noHover[0].id).hide();
|
||||||
}
|
}
|
||||||
}, 2500);
|
}, 2500);
|
||||||
});
|
|
||||||
}else{
|
|
||||||
$(document).ready(function() {
|
|
||||||
if (autohidden_menu) {
|
|
||||||
$('.menu_icon').on("click", function() {
|
|
||||||
if( typeof(table_hover) != 'undefined'){
|
|
||||||
$("ul#sub"+table_hover[0].id).hide();
|
|
||||||
}
|
|
||||||
table_hover = $(this);
|
|
||||||
handsIn = 1;
|
|
||||||
openTime = new Date().getTime();
|
|
||||||
$("ul#sub"+table_hover[0].id).show();
|
|
||||||
get_menu_items(table_hover);
|
|
||||||
}).mouseleave(function() {
|
|
||||||
table_noHover = $(this);
|
|
||||||
handsIn = 0;
|
|
||||||
setTimeout(function() {
|
|
||||||
opened = new Date().getTime() - openTime;
|
|
||||||
if(opened > 5000 && handsIn == 0) {
|
|
||||||
openTime = 6000;
|
|
||||||
$("ul#sub"+table_noHover[0].id).hide();
|
|
||||||
}
|
|
||||||
}, 5500);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$('.menu_icon').on("click", function() {
|
|
||||||
if( typeof(table_hover) != 'undefined'){
|
|
||||||
$("ul#sub"+table_hover[0].id).hide();
|
|
||||||
}
|
|
||||||
table_hover = $(this);
|
|
||||||
handsIn = 1;
|
|
||||||
openTime = new Date().getTime();
|
|
||||||
$("ul#sub"+table_hover[0].id).show();
|
|
||||||
get_menu_items(table_hover);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
$('.has_submenu').mouseenter(function() {
|
$('.has_submenu').mouseenter(function() {
|
||||||
|
var menuType_val = localStorage.getItem("menuType");
|
||||||
|
if (!click_display && menuType_val === 'collapsed') {
|
||||||
table_hover2 = $(this);
|
table_hover2 = $(this);
|
||||||
handsIn2 = 1;
|
handsIn2 = 1;
|
||||||
openTime2 = new Date().getTime();
|
openTime2 = new Date().getTime();
|
||||||
$("#sub"+table_hover2[0].id).show();
|
$("#sub"+table_hover2[0].id).show();
|
||||||
if( typeof(table_noHover2) != 'undefined')
|
if( typeof(table_noHover2) != 'undefined') {
|
||||||
if ( "ul#sub"+table_hover2[0].id != "ul#sub"+table_noHover2[0].id )
|
if ( "ul#sub"+table_hover2[0].id != "ul#sub"+table_noHover2[0].id ) {
|
||||||
$("ul#sub"+table_noHover2[0].id).hide();
|
$("ul#sub"+table_noHover2[0].id).hide();
|
||||||
}).mouseleave(function() {
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).mouseleave(function() {
|
||||||
|
var menuType_val = localStorage.getItem("menuType");
|
||||||
|
if (!click_display && menuType_val === 'collapsed') {
|
||||||
table_noHover2 = table_hover2;
|
table_noHover2 = table_hover2;
|
||||||
handsIn2 = 0;
|
handsIn2 = 0;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@ -342,45 +320,140 @@ $('.has_submenu').mouseenter(function() {
|
|||||||
$("ul#sub"+table_hover2[0].id).hide();
|
$("ul#sub"+table_hover2[0].id).hide();
|
||||||
}
|
}
|
||||||
}, 3500);
|
}, 3500);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
|
|
||||||
if(!click_display){
|
|
||||||
$('#container').click(function() {
|
$('#container').click(function() {
|
||||||
|
var menuType_val = localStorage.getItem("menuType");
|
||||||
|
if (!click_display && menuType_val === 'collapsed') {
|
||||||
|
|
||||||
openTime = 4000;
|
openTime = 4000;
|
||||||
if( typeof(table_hover) != 'undefined')
|
if( typeof(table_hover) != 'undefined') {
|
||||||
$("ul#sub"+table_hover[0].id).hide();
|
$("ul#sub"+table_hover[0].id).hide();
|
||||||
if( typeof(table_hover2) != 'undefined')
|
}
|
||||||
|
|
||||||
|
if( typeof(table_hover2) != 'undefined') {
|
||||||
$("ul#sub"+table_hover2[0].id).hide();
|
$("ul#sub"+table_hover2[0].id).hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}else{
|
|
||||||
$('#main').click(function() {
|
$('.title_menu_classic').click(function() {
|
||||||
openTime = 4000;
|
var menuType_val = localStorage.getItem("menuType");
|
||||||
if( typeof(table_hover) != 'undefined')
|
if (click_display || (!click_display && menuType_val === 'classic')) {
|
||||||
$("ul#sub"+table_hover[0].id).hide();
|
const table_hover = $(this).parent();
|
||||||
if( typeof(table_hover2) != 'undefined')
|
const id = table_hover[0].id;
|
||||||
$("ul#sub"+table_hover2[0].id).hide();
|
const classes = $(`#${id}`).attr('class');
|
||||||
|
|
||||||
|
if (id === 'icon_about') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var menuType_val = localStorage.getItem("menuType");
|
||||||
|
|
||||||
|
if (classes.includes('selected') === true) {
|
||||||
|
if (menuType_val === 'collapsed' && $(`ul#sub${id}`).is(':hidden')) {
|
||||||
|
$(`ul#sub${id}`).show();
|
||||||
|
get_menu_items(table_hover);
|
||||||
|
} else {
|
||||||
|
$(`#${id}`).removeClass('selected');
|
||||||
|
$(`ul#sub${id}`).hide();
|
||||||
|
// Arrow.
|
||||||
|
table_hover.children().first().children().last().removeClass('arrow_menu_up');
|
||||||
|
table_hover.children().first().children().last().addClass('arrow_menu_down');
|
||||||
|
// Span.
|
||||||
|
table_hover.children().first().children().eq(1).removeClass('span_selected');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (menuType_val === 'collapsed') {
|
||||||
|
// hide all submenus.
|
||||||
|
$('ul[id^=sub]').hide();
|
||||||
|
$(`ul#sub${id}`).show();
|
||||||
|
// Unselect all.
|
||||||
|
$(`li[id^=icon_]`).removeClass('selected');
|
||||||
|
$(`#${id}`).addClass('selected');
|
||||||
|
get_menu_items(table_hover);
|
||||||
|
} else {
|
||||||
|
$(`ul#sub${id}`).show();
|
||||||
|
$(`#${id}`).addClass('selected');
|
||||||
|
// Arrow.
|
||||||
|
$(this).children().last().removeClass('arrow_menu_down');
|
||||||
|
$(this).children().last().addClass('arrow_menu_up');
|
||||||
|
// Span.
|
||||||
|
$(this).children().eq(1).addClass('span_selected');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.has_submenu').click(function() {
|
||||||
|
var menuType_val = localStorage.getItem("menuType");
|
||||||
|
if (click_display || (!click_display && menuType_val === 'classic')) {
|
||||||
|
const table_hover2 = $(this);
|
||||||
|
const id = table_hover2[0].id;
|
||||||
|
const classes = $(`#${id}`).attr('class');
|
||||||
|
|
||||||
|
if (classes.includes('submenu_selected') === true) {
|
||||||
|
$(`#${id}`).removeClass('submenu_selected');
|
||||||
|
$(`#${id}`).addClass('submenu_not_selected');
|
||||||
|
$(`#sub${id}`).hide();
|
||||||
|
// Arrow.
|
||||||
|
table_hover2.children().first().children().last().removeClass('arrow_menu_up');
|
||||||
|
table_hover2.children().first().children().last().addClass('arrow_menu_down');
|
||||||
|
// Span.
|
||||||
|
table_hover2.children().first().children().first().removeClass('span_selected');
|
||||||
|
} else {
|
||||||
|
$(`#${id}`).removeClass('submenu_not_selected');
|
||||||
|
$(`#${id}`).addClass('submenu_selected');
|
||||||
|
$(`#sub${id}`).show();
|
||||||
|
// Arrow.
|
||||||
|
table_hover2.children().first().children().last().removeClass('arrow_menu_down');
|
||||||
|
table_hover2.children().first().children().last().addClass('arrow_menu_up');
|
||||||
|
// Span.
|
||||||
|
table_hover2.children().first().children().first().addClass('span_selected');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.sub_subMenu').click(function (event) {
|
||||||
|
event.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the menu items to be positioned.
|
||||||
|
*
|
||||||
|
* @param string item It is the selector of the current element.
|
||||||
|
*
|
||||||
|
* @return Add the top position in a inline style.
|
||||||
|
*/
|
||||||
|
function get_menu_items(item) {
|
||||||
|
var item_height = parseInt(item.css('min-height'));
|
||||||
|
var id_submenu = item.attr('id');
|
||||||
|
var index = item.index();
|
||||||
|
|
||||||
|
var top_submenu = menu_calculate_top(index, item_height);
|
||||||
|
top_submenu = top_submenu+'px';
|
||||||
|
$('#'+id_submenu+' ul.submenu').css('position', 'fixed');
|
||||||
|
$('#'+id_submenu+' ul.submenu').css('top', top_submenu);
|
||||||
|
$('#'+id_submenu+' ul.submenu').css('left', '60px');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$('div.menu>ul>li>ul>li>a').click(function() {
|
/**
|
||||||
openTime = 4000;
|
* Positionate the submenu elements. Add a negative top.
|
||||||
if( typeof(table_hover) != 'undefined')
|
*
|
||||||
$("ul#sub"+table_hover[0].id).hide();
|
* @param int index It is the position of li.menu_icon in the ul.
|
||||||
if( typeof(table_hover2) != 'undefined')
|
* @param int item_height It is the height of a menu item (35).
|
||||||
$("ul#sub"+table_hover2[0].id).hide();
|
*
|
||||||
|
* @return (int) The position (in px).
|
||||||
|
*/
|
||||||
|
function menu_calculate_top(index, item_height) {
|
||||||
|
const height_position = index * item_height;
|
||||||
|
const height_logo = $('.logo_green').outerHeight(true);
|
||||||
|
const height_tabs = $('#menu_tabs').outerHeight(true);
|
||||||
|
const padding_menu = parseInt($('.godmode').css('padding-top'));
|
||||||
|
|
||||||
|
return height_logo + height_tabs + padding_menu + height_position;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('div.menu>ul>li>ul>li>ul>li>a').click(function() {
|
|
||||||
openTime = 4000;
|
|
||||||
if( typeof(table_hover) != 'undefined')
|
|
||||||
$("ul#sub"+table_hover[0].id).hide();
|
|
||||||
if( typeof(table_hover2) != 'undefined')
|
|
||||||
$("ul#sub"+table_hover2[0].id).hide();
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,167 +1,77 @@
|
|||||||
<html>
|
<?php
|
||||||
<head>
|
echo '<script src="'.ui_get_full_url('include/javascript/jquery.current.js', false, false, false).'" type="text/javascript"></script>';
|
||||||
|
|
||||||
<style>
|
$message = '';
|
||||||
|
|
||||||
#alert_messages_na{
|
|
||||||
-moz-border-bottom-right-radius: 5px;
|
|
||||||
-webkit-border-bottom-left-radius: 5px;
|
|
||||||
border-bottom-right-radius: 5px;
|
|
||||||
border-bottom-left-radius: 5px;
|
|
||||||
z-index:2;
|
|
||||||
position:fixed;
|
|
||||||
width:700px;
|
|
||||||
background:white;
|
|
||||||
left:50%;
|
|
||||||
top:20%;
|
|
||||||
margin-left:-350px;
|
|
||||||
|
|
||||||
|
if ($config['history_db_connection'] === false) {
|
||||||
|
$message = __('Failure to connect to historical database, please check the configuration or contact system administrator if you need assistance.');
|
||||||
|
} else {
|
||||||
|
$message = __('Failure to connect to Database server, please check the configuration file config.php or contact system administrator if you need assistance.');
|
||||||
}
|
}
|
||||||
|
|
||||||
.modalheade{
|
$custom_conf_enabled = false;
|
||||||
text-align:center;
|
foreach ($config as $key => $value) {
|
||||||
width:100%;
|
|
||||||
height:37px;
|
|
||||||
left:0px;
|
|
||||||
background-color:#82b92e;
|
|
||||||
}
|
|
||||||
.modalheadertex{
|
|
||||||
color:white;
|
|
||||||
position:relative;
|
|
||||||
font-size:13pt;
|
|
||||||
top:8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modalconten{
|
|
||||||
color:black;
|
|
||||||
background:white;
|
|
||||||
}
|
|
||||||
.modalcontentim{
|
|
||||||
float:left;
|
|
||||||
margin-left:30px;
|
|
||||||
margin-top:30px;
|
|
||||||
margin-bottom:30px;
|
|
||||||
}
|
|
||||||
.modalcontenttex{
|
|
||||||
float:left;
|
|
||||||
text-align:justify;
|
|
||||||
color:black;
|
|
||||||
font-size: 9.5pt;
|
|
||||||
line-height:13pt;
|
|
||||||
margin-top:40px;
|
|
||||||
width:430px;
|
|
||||||
margin-left:30px;
|
|
||||||
}
|
|
||||||
.modalwikibutto{
|
|
||||||
cursor:pointer;
|
|
||||||
text-align:center;
|
|
||||||
margin-right:45px;
|
|
||||||
float:right;
|
|
||||||
-moz-border-radius: 3px;
|
|
||||||
-webkit-border-radius: 3px;
|
|
||||||
margin-bottom:30px;
|
|
||||||
border-radius: 3px;
|
|
||||||
width:170px;
|
|
||||||
height:30px;
|
|
||||||
border: 1px solid #82b92e;
|
|
||||||
margin-top:8%;
|
|
||||||
background-color:#82b92e;
|
|
||||||
}
|
|
||||||
.modalwikibuttontex{
|
|
||||||
color:#ffffff;
|
|
||||||
font-size:10pt;
|
|
||||||
position:relative;
|
|
||||||
top:6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#opacity{
|
|
||||||
background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%;
|
|
||||||
background:black;
|
|
||||||
opacity:0.1;
|
|
||||||
left:0px;
|
|
||||||
top:0px;
|
|
||||||
width:100%;
|
|
||||||
height:100%;
|
|
||||||
position: fixed;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
img.modalclose {
|
|
||||||
text-align: right;
|
|
||||||
float: right;
|
|
||||||
padding-right: 11px;
|
|
||||||
padding-top: 11px;
|
|
||||||
vertical-align: middle;
|
|
||||||
cursor:pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="alert_messages_na">
|
|
||||||
|
|
||||||
<div class='modalheade'>
|
|
||||||
<span class='modalheadertex'>
|
|
||||||
<?php echo __('Database error'); ?>
|
|
||||||
</span>
|
|
||||||
<img class='modalclose' src='<?php echo $config['homeurl']; ?>/images/icono_cerrar.png'>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class='modalconten'>
|
|
||||||
<img class='modalcontentim' src='<?php echo $config['homeurl']; ?>/images/mysqlerr.png'>
|
|
||||||
<div class='modalcontenttex'>
|
|
||||||
<?php
|
|
||||||
if ($config['history_db_connection'] === false) {
|
|
||||||
echo __('Failure to connect to historical database, please check the configuration or contact system administrator if you need assistance.');
|
|
||||||
} else {
|
|
||||||
echo __('Failure to connect to Database server, please check the configuration file config.php or contact system administrator if you need assistance.');
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
$custom_conf_enabled = false;
|
|
||||||
foreach ($config as $key => $value) {
|
|
||||||
if (preg_match('/._alt/i', $key)) {
|
if (preg_match('/._alt/i', $key)) {
|
||||||
$custom_conf_enabled = true;
|
$custom_conf_enabled = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$custom_conf_enabled || isset($config['custom_docs_url_alt'])) {
|
if (empty($custom_conf_enabled) === true || isset($config['custom_docs_url_alt']) === true) {
|
||||||
if (isset($config['custom_docs_url_alt'])) {
|
if (isset($config['custom_docs_url_alt']) === true) {
|
||||||
$docs_url = $config['custom_docs_url_alt'];
|
$docs_url = $config['custom_docs_url_alt'];
|
||||||
} else {
|
} else {
|
||||||
$docs_url = 'https://pandorafms.com/manual/en/documentation/02_installation/04_configuration';
|
$docs_url = 'https://pandorafms.com/manual/en/documentation/02_installation/04_configuration';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
echo '
|
echo '<div id="mysqlerr" title="'.__('Error').'">';
|
||||||
<a href="'.ui_get_full_external_url($docs_url).'" target="_blank">
|
echo '<div class="content_alert">';
|
||||||
<div class="modalwikibutto">
|
echo '<div class="icon_message_alert">';
|
||||||
<span class="modalwikibuttontex">'.__('Documentation').'
|
echo html_print_image('images/mysqlerr.png', true, ['alt' => __('Mysql error'), 'border' => 0]);
|
||||||
</span>
|
echo '</div>';
|
||||||
</div>
|
echo '<div class="content_message_alert">';
|
||||||
</a>
|
echo '<div class="text_message_alert">';
|
||||||
';
|
echo '<h1>'.__('Database error').'</h1>';
|
||||||
}
|
echo '<p>'.$message.'</p>';
|
||||||
|
echo '<br>';
|
||||||
|
echo '</div>';
|
||||||
|
echo '<div class="button_message_alert">';
|
||||||
|
html_print_submit_button(
|
||||||
|
__('Documentation'),
|
||||||
|
'mysqlerr_button',
|
||||||
|
false,
|
||||||
|
['class' => 'mini float-right']
|
||||||
|
);
|
||||||
|
echo '</div>';
|
||||||
|
echo '</div>';
|
||||||
|
echo '</div>';
|
||||||
|
echo '</div>';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="opacity"></div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$(function() {
|
||||||
$(".modalclose").click(function(){
|
$("#mysqlerr").dialog({
|
||||||
$('div#alert_messages_na').toggle();
|
resizable: true,
|
||||||
$('div#opacity').toggle();
|
draggable: true,
|
||||||
|
modal: true,
|
||||||
|
width: 700,
|
||||||
|
clickOutside: true,
|
||||||
|
overlay: {
|
||||||
|
opacity: 0.5,
|
||||||
|
background: "black"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#mysqlerr").hide();
|
||||||
|
|
||||||
|
$("#button-mysqlerr_button").click (function () {
|
||||||
|
window.open('<?php echo ui_get_full_external_url($docs_url); ?>', '_blank');
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
$("#mysqlerr").show();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -77,7 +77,7 @@ if (! $id || ! file_exists($help_file)) {
|
|||||||
echo '<div class="msg msg_pandora_help">'.__("%s help system has been called with a help reference that currently don't exist. There is no help content to show.", get_product_name()).'</div></div></div>';
|
echo '<div class="msg msg_pandora_help">'.__("%s help system has been called with a help reference that currently don't exist. There is no help content to show.", get_product_name()).'</div></div></div>';
|
||||||
echo '<br /><br />';
|
echo '<br /><br />';
|
||||||
echo '<div id="footer_help">';
|
echo '<div id="footer_help">';
|
||||||
include 'footer.php';
|
// include 'footer.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ ob_end_clean();
|
|||||||
echo $help;
|
echo $help;
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div id="footer_help">';
|
echo '<div id="footer_help">';
|
||||||
require 'footer.php';
|
// require 'footer.php';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
?>
|
?>
|
||||||
</body>
|
</body>
|
||||||
|
@ -31,6 +31,7 @@ global $config;
|
|||||||
|
|
||||||
require_once $config['homedir'].'/include/functions_register.php';
|
require_once $config['homedir'].'/include/functions_register.php';
|
||||||
require_once $config['homedir'].'/include/class/WelcomeWindow.class.php';
|
require_once $config['homedir'].'/include/class/WelcomeWindow.class.php';
|
||||||
|
require_once $config['homedir'].'/include/class/TipsWindow.class.php';
|
||||||
|
|
||||||
|
|
||||||
if ((bool) is_ajax() === true) {
|
if ((bool) is_ajax() === true) {
|
||||||
@ -109,6 +110,16 @@ try {
|
|||||||
$welcome = false;
|
$welcome = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (isset($_SESSION['showed_tips_window']) === false) {
|
||||||
|
$tips_window = new TipsWindow();
|
||||||
|
if ($tips_window !== null) {
|
||||||
|
$tips_window->run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
}
|
||||||
|
|
||||||
$double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']);
|
$double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']);
|
||||||
|
|
||||||
if (isset($config['2FA_all_users']) === false) {
|
if (isset($config['2FA_all_users']) === false) {
|
||||||
|
@ -59,7 +59,7 @@ ui_print_warning_message(
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$table = new StdClass();
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->class = 'databox filters';
|
$table->class = 'databox filters';
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
@ -59,23 +59,22 @@ $result = integria_api_call(null, null, null, null, 'get_incidents', $params, fa
|
|||||||
|
|
||||||
$result = json_decode($result, true);
|
$result = json_decode($result, true);
|
||||||
|
|
||||||
$count = count($result);
|
if (empty($result) === true) {
|
||||||
|
|
||||||
$result = array_slice($result, $offset, $config['block_size']);
|
|
||||||
|
|
||||||
if (empty($result)) {
|
|
||||||
$result = [];
|
$result = [];
|
||||||
$count = 0;
|
$count = 0;
|
||||||
echo '<div class="nf">'.__('No incidents associated to this agent').'</div><br />';
|
echo '<div class="nf">'.__('No incidents associated to this agent').'</div><br />';
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
$count = count($result);
|
||||||
|
$result = array_slice($result, $offset, $config['block_size']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show pagination
|
// Show pagination.
|
||||||
ui_pagination($count, $url, $offset, 0, false, 'offset');
|
ui_pagination($count, $url, $offset, 0, false, 'offset');
|
||||||
// ($count + $offset) it's real count of incidents because it's use LIMIT $offset in query.
|
// ($count + $offset) it's real count of incidents because it's use LIMIT $offset in query.
|
||||||
echo '<br />';
|
echo '<br />';
|
||||||
|
|
||||||
// Show headers
|
// Show headers.
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->class = 'databox';
|
$table->class = 'databox';
|
||||||
$table->cellpadding = 4;
|
$table->cellpadding = 4;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,20 +1,35 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Agent Modules Templates.
|
||||||
|
*
|
||||||
|
* @category Module
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Agent Configuration
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation for version 2.
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// Load global vars
|
// Load global vars.
|
||||||
if (!isset($id_agente)) {
|
if (isset($id_agente) === false) {
|
||||||
die('Not Authorized');
|
die('Not Authorized');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,8 +38,8 @@ require_once $config['homedir'].'/include/functions_modules.php';
|
|||||||
// ==========================
|
// ==========================
|
||||||
// TEMPLATE ASSIGMENT LOGIC
|
// TEMPLATE ASSIGMENT LOGIC
|
||||||
// ==========================
|
// ==========================
|
||||||
if (isset($_POST['template_id'])) {
|
if (isset($_POST['template_id']) === true) {
|
||||||
// Take agent data
|
// Take agent data.
|
||||||
$row = db_get_row('tagente', 'id_agente', $id_agente);
|
$row = db_get_row('tagente', 'id_agente', $id_agente);
|
||||||
if ($row !== false) {
|
if ($row !== false) {
|
||||||
$intervalo = $row['intervalo'];
|
$intervalo = $row['intervalo'];
|
||||||
@ -49,7 +64,8 @@ if (isset($_POST['template_id'])) {
|
|||||||
$npc = [];
|
$npc = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$success_count = $error_count = 0;
|
$success_count = 0;
|
||||||
|
$error_count = 0;
|
||||||
$modules_already_added = [];
|
$modules_already_added = [];
|
||||||
|
|
||||||
foreach ($npc as $row) {
|
foreach ($npc as $row) {
|
||||||
@ -60,7 +76,7 @@ if (isset($_POST['template_id'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($nc as $row2) {
|
foreach ($nc as $row2) {
|
||||||
// Insert each module from tnetwork_component into agent
|
// Insert each module from tnetwork_component into agent.
|
||||||
$values = [
|
$values = [
|
||||||
'id_agente' => $id_agente,
|
'id_agente' => $id_agente,
|
||||||
'id_tipo_modulo' => $row2['type'],
|
'id_tipo_modulo' => $row2['type'],
|
||||||
@ -113,14 +129,14 @@ if (isset($_POST['template_id'])) {
|
|||||||
|
|
||||||
$name = $row2['name'];
|
$name = $row2['name'];
|
||||||
|
|
||||||
// Put tags in array if the component has to add them later
|
// Put tags in array if the component has to add them later.
|
||||||
if (!empty($row2['tags'])) {
|
if (empty($row2['tags']) === false) {
|
||||||
$tags = explode(',', $row2['tags']);
|
$tags = explode(',', $row2['tags']);
|
||||||
} else {
|
} else {
|
||||||
$tags = [];
|
$tags = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if this module exists in the agent
|
// Check if this module exists in the agent.
|
||||||
$module_name_check = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['delete_pending' => 0, 'nombre' => $name, 'id_agente' => $id_agente]);
|
$module_name_check = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['delete_pending' => 0, 'nombre' => $name, 'id_agente' => $id_agente]);
|
||||||
|
|
||||||
if ($module_name_check !== false) {
|
if ($module_name_check !== false) {
|
||||||
@ -132,13 +148,13 @@ if (isset($_POST['template_id'])) {
|
|||||||
if ($id_agente_modulo === false) {
|
if ($id_agente_modulo === false) {
|
||||||
$error_count++;
|
$error_count++;
|
||||||
} else {
|
} else {
|
||||||
if (!empty($tags)) {
|
if (empty($tags) === false) {
|
||||||
// Creating tags
|
// Creating tags.
|
||||||
$tag_ids = [];
|
$tag_ids = [];
|
||||||
foreach ($tags as $tag_name) {
|
foreach ($tags as $tag_name) {
|
||||||
$tag_id = tags_get_id($tag_name);
|
$tag_id = tags_get_id($tag_name);
|
||||||
|
|
||||||
// If tag exists in the system we store to create it
|
// If tag exists in the system we store to create it.
|
||||||
$tag_ids[] = $tag_id;
|
$tag_ids[] = $tag_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +168,7 @@ if (isset($_POST['template_id'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($error_count > 0) {
|
if ($error_count > 0) {
|
||||||
if (empty($modules_already_added)) {
|
if (empty($modules_already_added) === true) {
|
||||||
ui_print_error_message(__('Error adding modules').sprintf(' (%s)', $error_count));
|
ui_print_error_message(__('Error adding modules').sprintf(' (%s)', $error_count));
|
||||||
} else {
|
} else {
|
||||||
ui_print_error_message(__('Error adding modules. The following errors already exists: ').implode(', ', $modules_already_added));
|
ui_print_error_message(__('Error adding modules. The following errors already exists: ').implode(', ', $modules_already_added));
|
||||||
@ -168,8 +184,6 @@ if (isset($_POST['template_id'])) {
|
|||||||
// ==========================
|
// ==========================
|
||||||
// TEMPLATE ASSIGMENT FORM
|
// TEMPLATE ASSIGMENT FORM
|
||||||
// ==========================
|
// ==========================
|
||||||
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'">';
|
|
||||||
|
|
||||||
$nps = db_get_all_fields_in_table('tnetwork_profile', 'name');
|
$nps = db_get_all_fields_in_table('tnetwork_profile', 'name');
|
||||||
if ($nps === false) {
|
if ($nps === false) {
|
||||||
$nps = [];
|
$nps = [];
|
||||||
@ -180,44 +194,45 @@ foreach ($nps as $row) {
|
|||||||
$select[$row['id_np']] = $row['name'];
|
$select[$row['id_np']] = $row['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<table width="100%" cellpadding="0" cellspacing="0" class="databox filters" >';
|
$filterTable = new stdClass();
|
||||||
echo "<tr><td class='datos w50p'>";
|
$filterTable->width = '100%';
|
||||||
html_print_select($select, 'template_id', '', '', '', 0, false, false, true, '', false, 'max-width: 200px !important');
|
$filterTable->class = 'fixed_filter_bar';
|
||||||
echo '</td>';
|
$filterTable->data = [];
|
||||||
echo '<td class="datos">';
|
$filterTable->data[0][0] = __('Module templates');
|
||||||
html_print_submit_button(__('Assign'), 'crt', false, 'class="sub next mgn_tp_0"');
|
$filterTable->data[1][0] = html_print_select($select, 'template_id', '', '', '', 0, true, false, true, '', false, 'max-width: 200px !important');
|
||||||
echo '</td>';
|
$filterTable->data[1][1] = html_print_div(
|
||||||
echo '</tr>';
|
[
|
||||||
echo '</form>';
|
'class' => 'action-buttons',
|
||||||
echo '</table>';
|
'content' => html_print_submit_button(
|
||||||
echo '</form>';
|
__('Assign'),
|
||||||
|
'crt',
|
||||||
|
false,
|
||||||
|
[
|
||||||
|
'icon' => 'wand',
|
||||||
|
'mode' => 'secondary mini',
|
||||||
|
],
|
||||||
|
true
|
||||||
|
),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$outputFilterTable = '<form style="border:0" class="fixed_filter_bar" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'">';
|
||||||
|
$outputFilterTable .= html_print_table($filterTable, true);
|
||||||
|
$outputFilterTable .= '</form>';
|
||||||
|
|
||||||
|
echo $outputFilterTable;
|
||||||
|
|
||||||
// ==========================
|
// ==========================
|
||||||
// MODULE VISUALIZATION TABLE
|
// MODULE VISUALIZATION TABLE
|
||||||
// ==========================
|
// ==========================
|
||||||
switch ($config['dbtype']) {
|
$sql = sprintf(
|
||||||
case 'mysql':
|
|
||||||
case 'postgresql':
|
|
||||||
$sql = sprintf(
|
|
||||||
'SELECT *
|
'SELECT *
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
WHERE id_agente = %d AND delete_pending = false
|
WHERE id_agente = %d AND delete_pending = false
|
||||||
ORDER BY id_module_group, nombre',
|
ORDER BY id_module_group, nombre',
|
||||||
$id_agente
|
$id_agente
|
||||||
);
|
);
|
||||||
break;
|
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
$sql = sprintf(
|
|
||||||
'SELECT *
|
|
||||||
FROM tagente_modulo
|
|
||||||
WHERE id_agente = %d
|
|
||||||
AND (delete_pending <> 1 AND delete_pending IS NOT NULL)
|
|
||||||
ORDER BY id_module_group, dbms_lob.substr(nombre,4000,1)',
|
|
||||||
$id_agente
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = db_get_all_rows_sql($sql);
|
$result = db_get_all_rows_sql($sql);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
@ -233,10 +248,10 @@ $table->head = [];
|
|||||||
$table->data = [];
|
$table->data = [];
|
||||||
$table->align = [];
|
$table->align = [];
|
||||||
|
|
||||||
$table->head[0] = __('Module name');
|
$table->head[0] = '<span>'.__('Module name').'</span>';
|
||||||
$table->head[1] = __('Type');
|
$table->head[1] = '<span>'.__('Type').'</span>';
|
||||||
$table->head[2] = __('Description');
|
$table->head[2] = '<span>'.__('Description').'</span>';
|
||||||
$table->head[3] = __('Action');
|
$table->head[3] = '<span>'.__('Action').'</span>';
|
||||||
|
|
||||||
$table->align[1] = 'left';
|
$table->align[1] = 'left';
|
||||||
$table->align[3] = 'left';
|
$table->align[3] = 'left';
|
||||||
@ -245,27 +260,43 @@ $table->size[1] = '5%';
|
|||||||
$table->size[3] = '8%';
|
$table->size[3] = '8%';
|
||||||
|
|
||||||
foreach ($result as $row) {
|
foreach ($result as $row) {
|
||||||
|
$table->cellclass[][3] = 'table_action_buttons';
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
$data[0] = '<span>'.$row['nombre'];
|
$data[0] = '<span>'.$row['nombre'];
|
||||||
if ($row['id_tipo_modulo'] > 0) {
|
$data[1] = ($row['id_tipo_modulo'] > 0) ? ui_print_moduletype_icon($row['id_tipo_modulo'], true, false, true) : '';
|
||||||
$data[1] = html_print_image('images/'.modules_show_icon_type($row['id_tipo_modulo']), true, ['border' => '0', 'class' => 'invert_filter']);
|
|
||||||
} else {
|
|
||||||
$data[1] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[2] = mb_substr($row['descripcion'], 0, 60);
|
$data[2] = mb_substr($row['descripcion'], 0, 60);
|
||||||
|
$data[3] = html_print_menu_button(
|
||||||
$table->cellclass[][3] = 'action_buttons';
|
[
|
||||||
$data[3] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'&delete_module='.$row['id_agente_modulo'].'">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter', 'border' => '0', 'alt' => __('Delete'), 'onclick' => "if (!confirm('".__('Are you sure?')."')) return false;"]).'</a>';
|
'href' => 'index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'&delete_module='.$row['id_agente_modulo'],
|
||||||
$data[3] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&edit_module=1&id_agent_module='.$row['id_agente_modulo'].'">'.html_print_image('images/config.png', true, ['class' => 'invert_filter', 'border' => '0', 'alt' => __('Update')]).'</a>';
|
'image' => 'images/delete.svg',
|
||||||
|
'title' => __('Delete'),
|
||||||
|
'onClick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;',
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$data[3] .= html_print_menu_button(
|
||||||
|
[
|
||||||
|
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&edit_module=1&id_agent_module='.$row['id_agente_modulo'],
|
||||||
|
'image' => 'images/edit.svg',
|
||||||
|
'title' => __('Edit'),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
array_push($table->data, $data);
|
array_push($table->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($table->data)) {
|
if (empty($table->data) === false) {
|
||||||
html_print_table($table);
|
$output = html_print_table($table, true);
|
||||||
unset($table);
|
|
||||||
} else {
|
} else {
|
||||||
ui_print_empty_data(__('No modules'));
|
$output = ui_print_empty_data(__('No modules'), '', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html_print_div(
|
||||||
|
[
|
||||||
|
'class' => 'datatable_form',
|
||||||
|
'content' => $output,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
@ -295,7 +295,6 @@ if ($create_agent) {
|
|||||||
'fixed_ip' => $fixed_ip,
|
'fixed_ip' => $fixed_ip,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
enterprise_hook('update_agent', [$id_agente]);
|
|
||||||
} else {
|
} else {
|
||||||
$id_agente = false;
|
$id_agente = false;
|
||||||
}
|
}
|
||||||
@ -377,94 +376,97 @@ $img_style = [
|
|||||||
|
|
||||||
if ($id_agente) {
|
if ($id_agente) {
|
||||||
// View tab.
|
// View tab.
|
||||||
$viewtab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">'.html_print_image(
|
$viewtab['text'] = html_print_anchor(
|
||||||
'images/eye.png',
|
[
|
||||||
|
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente,
|
||||||
|
'content' => html_print_image(
|
||||||
|
'images/enable.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'title' => __('View'),
|
'title' => __('View'),
|
||||||
'class' => 'invert_filter',
|
'class' => 'invert_filter main_menu_icon',
|
||||||
]
|
]
|
||||||
).'</a>';
|
),
|
||||||
|
],
|
||||||
if ($tab == 'view') {
|
true
|
||||||
$viewtab['active'] = true;
|
);
|
||||||
} else {
|
|
||||||
$viewtab['active'] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$viewtab['active'] = ($tab === 'view');
|
||||||
$viewtab['operation'] = 1;
|
$viewtab['operation'] = 1;
|
||||||
|
|
||||||
// Main tab.
|
// Main tab.
|
||||||
$maintab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agente.'">'.html_print_image(
|
$maintab['text'] = html_print_anchor(
|
||||||
'images/gm_setup.png',
|
[
|
||||||
|
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agente,
|
||||||
|
'content' => html_print_image(
|
||||||
|
'images/configuration@svg.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'title' => __('Setup'),
|
'title' => __('Setup'),
|
||||||
'class' => 'invert_filter',
|
'class' => 'invert_filter main_menu_icon',
|
||||||
]
|
]
|
||||||
).'</a>';
|
),
|
||||||
if ($tab == 'main') {
|
],
|
||||||
$maintab['active'] = true;
|
true
|
||||||
} else {
|
);
|
||||||
$maintab['active'] = false;
|
|
||||||
}
|
$maintab['active'] = ($tab === 'main');
|
||||||
|
|
||||||
// Module tab.
|
// Module tab.
|
||||||
$moduletab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">'.html_print_image(
|
$moduletab['text'] = html_print_anchor(
|
||||||
'images/gm_modules.png',
|
[
|
||||||
|
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente,
|
||||||
|
'content' => html_print_image(
|
||||||
|
'images/modules@svg.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'title' => __('Modules'),
|
'title' => __('Modules'),
|
||||||
'class' => 'invert_filter',
|
'class' => 'invert_filter main_menu_icon',
|
||||||
]
|
]
|
||||||
).'</a>';
|
),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
if ($tab == 'module') {
|
$moduletab['active'] = ($tab === 'module');
|
||||||
$moduletab['active'] = true;
|
|
||||||
} else {
|
|
||||||
$moduletab['active'] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alert tab.
|
// Alert tab.
|
||||||
$alerttab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.'">'.html_print_image(
|
$alerttab['text'] = html_print_anchor(
|
||||||
'images/gm_alerts.png',
|
[
|
||||||
|
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente,
|
||||||
|
'content' => html_print_image(
|
||||||
|
'images/alert@svg.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'title' => __('Alerts'),
|
'title' => __('Alerts'),
|
||||||
'class' => 'invert_filter',
|
'class' => 'invert_filter main_menu_icon',
|
||||||
]
|
]
|
||||||
).'</a>';
|
),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
if ($tab == 'alert') {
|
$alerttab['active'] = ($tab === 'alert');
|
||||||
$alerttab['active'] = true;
|
|
||||||
} else {
|
|
||||||
$alerttab['active'] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Template tab.
|
// Template tab.
|
||||||
$templatetab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'">'.html_print_image(
|
$templatetab['text'] = html_print_menu_button(
|
||||||
'images/templates.png',
|
|
||||||
true,
|
|
||||||
[
|
[
|
||||||
|
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente,
|
||||||
|
'image' => 'images/modules-group@svg.svg',
|
||||||
'title' => __('Module templates'),
|
'title' => __('Module templates'),
|
||||||
'class' => 'invert_filter',
|
],
|
||||||
]
|
true
|
||||||
).'</a>';
|
);
|
||||||
|
|
||||||
if ($tab == 'template') {
|
|
||||||
$templatetab['active'] = true;
|
|
||||||
} else {
|
|
||||||
$templatetab['active'] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$templatetab['active'] = ($tab === 'template');
|
||||||
|
|
||||||
// Inventory.
|
// Inventory.
|
||||||
$inventorytab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'">'.html_print_image(
|
$inventorytab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'">'.html_print_image(
|
||||||
'images/page_white_text.png',
|
'images/hardware-software-component@svg.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'title' => __('Inventory'),
|
'title' => __('Inventory'),
|
||||||
'class' => 'invert_filter',
|
'class' => 'main_menu_icon invert_filter',
|
||||||
]
|
]
|
||||||
).'</a>';
|
).'</a>';
|
||||||
|
|
||||||
@ -474,11 +476,6 @@ if ($id_agente) {
|
|||||||
$inventorytab['active'] = false;
|
$inventorytab['active'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($inventorytab == -1) {
|
|
||||||
$inventorytab = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$has_remote_conf = enterprise_hook(
|
$has_remote_conf = enterprise_hook(
|
||||||
'config_agents_has_remote_configuration',
|
'config_agents_has_remote_configuration',
|
||||||
[$id_agente]
|
[$id_agente]
|
||||||
@ -490,7 +487,7 @@ if ($id_agente) {
|
|||||||
if ($has_remote_conf === true) {
|
if ($has_remote_conf === true) {
|
||||||
// Plugins.
|
// Plugins.
|
||||||
$pluginstab = enterprise_hook('plugins_tab');
|
$pluginstab = enterprise_hook('plugins_tab');
|
||||||
if ($pluginstab == -1) {
|
if ($pluginstab === ENTERPRISE_NOT_HOOK) {
|
||||||
$pluginstab = '';
|
$pluginstab = '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -498,60 +495,62 @@ if ($id_agente) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Collection.
|
// Collection.
|
||||||
|
if ((int) $config['license_nms'] !== 1) {
|
||||||
$collectiontab = enterprise_hook('collection_tab');
|
$collectiontab = enterprise_hook('collection_tab');
|
||||||
|
if ($collectiontab === ENTERPRISE_NOT_HOOK) {
|
||||||
if ($collectiontab == -1) {
|
$collectiontab = '';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$collectiontab = '';
|
$collectiontab = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkConfigManager tab.
|
// NetworkConfigManager tab.
|
||||||
$ncm_tab = enterprise_hook('networkconfigmanager_tab');
|
$ncm_tab = enterprise_hook('networkconfigmanager_tab');
|
||||||
|
|
||||||
if ($ncm_tab === ENTERPRISE_NOT_HOOK) {
|
if ($ncm_tab === ENTERPRISE_NOT_HOOK) {
|
||||||
$ncm_tab = '';
|
$ncm_tab = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group tab.
|
// Group tab.
|
||||||
$grouptab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&ag_group='.$group.'">'.html_print_image(
|
$grouptab['text'] = html_print_menu_button(
|
||||||
'images/group.png',
|
|
||||||
true,
|
|
||||||
[
|
[
|
||||||
|
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&ag_group='.$group,
|
||||||
|
'image' => 'images/groups@svg.svg',
|
||||||
'title' => __('Group'),
|
'title' => __('Group'),
|
||||||
'class' => 'invert_filter',
|
],
|
||||||
]
|
true
|
||||||
).'</a>';
|
);
|
||||||
|
|
||||||
$grouptab['active'] = false;
|
$grouptab['active'] = false;
|
||||||
|
|
||||||
$gistab = [];
|
$gistab = [];
|
||||||
|
|
||||||
// GIS tab.
|
// TODO. OVERRIDE.
|
||||||
if ($config['activate_gis']) {
|
$config['activate_gis'] = true;
|
||||||
$gistab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=gis&id_agente='.$id_agente.'">'.html_print_image(
|
|
||||||
'images/gm_gis.png',
|
|
||||||
true,
|
|
||||||
[
|
|
||||||
'title' => __('GIS data'),
|
|
||||||
'class' => 'invert_filter',
|
|
||||||
]
|
|
||||||
).'</a>';
|
|
||||||
|
|
||||||
if ($tab == 'gis') {
|
// GIS tab.
|
||||||
$gistab['active'] = true;
|
if ((bool) $config['activate_gis'] === true) {
|
||||||
} else {
|
$gistab['text'] = html_print_menu_button(
|
||||||
$gistab['active'] = false;
|
[
|
||||||
}
|
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=gis&id_agente='.$id_agente,
|
||||||
|
'image' => 'images/poi@svg.svg',
|
||||||
|
'title' => __('GIS data'),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$gistab['active'] = ($tab === 'gis');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Agent wizard tab.
|
// Agent wizard tab.
|
||||||
$agent_wizard['text'] = '<a href="javascript:" class="agent_wizard_tab">'.html_print_image(
|
$agent_wizard['text'] = html_print_menu_button(
|
||||||
'images/wand_agent.png',
|
|
||||||
true,
|
|
||||||
[
|
[
|
||||||
|
'href' => 'javascript:',
|
||||||
|
'class' => 'agent_wizard_tab',
|
||||||
|
'image' => 'images/wizard@svg.svg',
|
||||||
'title' => __('Agent wizard'),
|
'title' => __('Agent wizard'),
|
||||||
'class' => 'invert_filter',
|
],
|
||||||
]
|
true
|
||||||
).'</a>';
|
);
|
||||||
|
|
||||||
// Hidden subtab layer.
|
// Hidden subtab layer.
|
||||||
$agent_wizard['sub_menu'] = '<ul class="mn subsubmenu invisible float-none">';
|
$agent_wizard['sub_menu'] = '<ul class="mn subsubmenu invisible float-none">';
|
||||||
@ -599,42 +598,34 @@ if ($id_agente) {
|
|||||||
|
|
||||||
// Incident tab.
|
// Incident tab.
|
||||||
if ($total_incidents > 0) {
|
if ($total_incidents > 0) {
|
||||||
$incidenttab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agente.'">'.html_print_image(
|
$incidenttab['text'] = html_print_menu_button(
|
||||||
'images/book_edit.png',
|
|
||||||
true,
|
|
||||||
[
|
[
|
||||||
|
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agente,
|
||||||
|
'image' => 'images/logs@svg.svg',
|
||||||
'title' => __('Incidents'),
|
'title' => __('Incidents'),
|
||||||
'class' => 'invert_filter',
|
],
|
||||||
]
|
true
|
||||||
).'</a>';
|
);
|
||||||
|
|
||||||
if ($tab == 'incident') {
|
$incidenttab['active'] = ($tab === 'incident');
|
||||||
$incidenttab['active'] = true;
|
|
||||||
} else {
|
|
||||||
$incidenttab['active'] = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
|
||||||
if ($has_remote_conf) {
|
if ($has_remote_conf !== false) {
|
||||||
$agent_name = agents_get_name($id_agente);
|
$agent_name = agents_get_name($id_agente);
|
||||||
$agent_name = io_safe_output($agent_name);
|
$agent_name = io_safe_output($agent_name);
|
||||||
$agent_md5 = md5($agent_name, false);
|
$agent_md5 = md5($agent_name, false);
|
||||||
|
|
||||||
$remote_configuration_tab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$id_agente.'&disk_conf='.$agent_md5.'">'.html_print_image(
|
$remote_configuration_tab['text'] = html_print_menu_button(
|
||||||
'images/remote_configuration.png',
|
|
||||||
true,
|
|
||||||
[
|
[
|
||||||
|
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$id_agente.'&disk_conf='.$agent_md5,
|
||||||
|
'image' => 'images/remote-configuration@svg.svg',
|
||||||
'title' => __('Remote configuration'),
|
'title' => __('Remote configuration'),
|
||||||
'class' => 'invert_filter',
|
],
|
||||||
]
|
true
|
||||||
).'</a>';
|
);
|
||||||
if ($tab == 'remote_configuration') {
|
|
||||||
$remote_configuration_tab['active'] = true;
|
|
||||||
} else {
|
|
||||||
$remote_configuration_tab['active'] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$remote_configuration_tab['active'] = ($tab === 'remote_configuration');
|
||||||
|
|
||||||
$onheader = [
|
$onheader = [
|
||||||
'view' => $viewtab,
|
'view' => $viewtab,
|
||||||
@ -717,37 +708,32 @@ if ($id_agente) {
|
|||||||
// This add information to the header.
|
// This add information to the header.
|
||||||
switch ($tab) {
|
switch ($tab) {
|
||||||
case 'main':
|
case 'main':
|
||||||
$tab_description = '- '.__('Setup');
|
|
||||||
$help_header = 'main_tab';
|
$help_header = 'main_tab';
|
||||||
$tab_name = 'Setup';
|
$tab_name = __('Setup');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'collection':
|
case 'collection':
|
||||||
$tab_description = '- '.__('Collection');
|
$tab_name = __('Collection');
|
||||||
$tab_name = 'Collection';
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'ncm':
|
case 'ncm':
|
||||||
$tab_description = '- '.__('Network config manager');
|
$tab_name = __('Network config manager');
|
||||||
$tab_name = 'Network config manager';
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'inventory':
|
case 'inventory':
|
||||||
$tab_description = '- '.__('Inventory');
|
|
||||||
$help_header = 'inventory_tab';
|
$help_header = 'inventory_tab';
|
||||||
$tab_name = 'Inventory';
|
$tab_name = __('Inventory');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'plugins':
|
case 'plugins':
|
||||||
$tab_description = '- '.__('Agent plugins');
|
|
||||||
$help_header = 'plugins_tab';
|
$help_header = 'plugins_tab';
|
||||||
|
$tab_name = __('Agent plugins');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'module':
|
case 'module':
|
||||||
$type_module_t = get_parameter('moduletype', '');
|
$type_module_t = get_parameter('moduletype', '');
|
||||||
$tab_description = '- '.__('Modules');
|
$tab_name = __('Modules');
|
||||||
$tab_name = 'Modules';
|
if ($type_module_t === 'webux') {
|
||||||
if ($type_module_t == 'webux') {
|
|
||||||
$help_header = 'wux_console';
|
$help_header = 'wux_console';
|
||||||
} else {
|
} else {
|
||||||
$help_header = 'local_module_tab';
|
$help_header = 'local_module_tab';
|
||||||
@ -755,47 +741,42 @@ if ($id_agente) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'alert':
|
case 'alert':
|
||||||
$tab_description = '- '.__('Alert');
|
|
||||||
$help_header = 'manage_alert_list';
|
$help_header = 'manage_alert_list';
|
||||||
$tab_name = 'Alerts';
|
$tab_name = __('Alerts');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'template':
|
case 'template':
|
||||||
$tab_description = '- '.__('Templates');
|
$tab_name = __('Module templates');
|
||||||
$tab_name = 'Module templates';
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'gis':
|
case 'gis':
|
||||||
$tab_description = '- '.__('Gis');
|
$tab_name = __('Gis');
|
||||||
$help_header = 'gis_tab';
|
$help_header = 'gis_tab';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'incident':
|
case 'incident':
|
||||||
$tab_description = '- '.__('Incidents');
|
$tab_name = __('Incidents');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'remote_configuration':
|
case 'remote_configuration':
|
||||||
$tab_description = '- '.__('Remote configuration');
|
$tab_name = __('Remote configuration');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'agent_wizard':
|
case 'agent_wizard':
|
||||||
switch (get_parameter('wizard_section')) {
|
switch (get_parameter('wizard_section')) {
|
||||||
case 'snmp_explorer':
|
case 'snmp_explorer':
|
||||||
$tab_description = '- '.__('SNMP Wizard');
|
|
||||||
$help_header = 'agent_snmp_explorer_tab';
|
$help_header = 'agent_snmp_explorer_tab';
|
||||||
$tab_name = 'SNMP Wizard';
|
$tab_name = __('SNMP Wizard');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'snmp_interfaces_explorer':
|
case 'snmp_interfaces_explorer':
|
||||||
$tab_description = '- '.__('SNMP Interfaces wizard');
|
$tab_name = __('SNMP Interfaces Wizard');
|
||||||
$help_header = 'agent_snmp_interfaces_explorer_tab';
|
$help_header = 'agent_snmp_interfaces_explorer_tab';
|
||||||
$tab_name = 'SNMP Interfaces wizard';
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'wmi_explorer':
|
case 'wmi_explorer':
|
||||||
$tab_description = '- '.__('WMI Wizard');
|
$tab_name = __('WMI Wizard');
|
||||||
$help_header = 'agent_snmp_wmi_explorer_tab';
|
$help_header = 'agent_snmp_wmi_explorer_tab';
|
||||||
$tab_name = 'WMI Wizard';
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -824,48 +805,49 @@ if ($id_agente) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$helper = ($help_header === 'main_tab') ? 'main_tab' : '';
|
$helper = ($help_header === 'main_tab') ? 'main_tab' : '';
|
||||||
$pure = get_parameter('pure', 0);
|
$pure = (int) get_parameter('pure');
|
||||||
if (!$pure) {
|
if ($pure === 0) {
|
||||||
ui_print_page_header(
|
ui_print_standard_header(
|
||||||
agents_get_alias($id_agente),
|
__('Agent setup view'),
|
||||||
'images/setup.png',
|
'images/agent.png',
|
||||||
false,
|
false,
|
||||||
$helper,
|
$helper,
|
||||||
true,
|
|
||||||
$onheader,
|
|
||||||
false,
|
false,
|
||||||
'',
|
$onheader,
|
||||||
$config['item_title_size_text'],
|
|
||||||
'',
|
|
||||||
ui_print_breadcrums(
|
|
||||||
[
|
[
|
||||||
__('Resources'),
|
[
|
||||||
__('Manage agents'),
|
'link' => '',
|
||||||
'<span class="breadcrumb_active">'.$tab_name.'</span>',
|
'label' => __('Resources'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
|
||||||
|
'label' => __('Manage agents'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => $tab_name,
|
||||||
|
],
|
||||||
]
|
]
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Create agent.
|
ui_print_standard_header(
|
||||||
ui_print_page_header(
|
__('Create agent'),
|
||||||
__('Agent manager'),
|
|
||||||
'images/agent.png',
|
'images/agent.png',
|
||||||
false,
|
false,
|
||||||
'create_agent',
|
|
||||||
true,
|
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
'',
|
[],
|
||||||
GENERIC_SIZE_TEXT,
|
|
||||||
'',
|
|
||||||
ui_print_breadcrums(
|
|
||||||
[
|
[
|
||||||
__('Resources'),
|
[
|
||||||
__('Manage agents'),
|
'link' => '',
|
||||||
'<span class="breadcrumb_active">'.__('Create agent').'</span>',
|
'label' => __('Resources'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
|
||||||
|
'label' => __('Manage agents'),
|
||||||
|
],
|
||||||
]
|
]
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -890,7 +872,8 @@ if ($delete_conf_file) {
|
|||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
$correct,
|
$correct,
|
||||||
__('Conf file deleted successfully'),
|
__('Conf file deleted successfully'),
|
||||||
__('Could not delete conf file')
|
__('Could not delete conf file'),
|
||||||
|
[ 'autoclose' => true ]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1248,9 +1231,9 @@ if ($id_agente) {
|
|||||||
$intervalo = $agent['intervalo'];
|
$intervalo = $agent['intervalo'];
|
||||||
// Define interval in seconds.
|
// Define interval in seconds.
|
||||||
$nombre_agente = $agent['nombre'];
|
$nombre_agente = $agent['nombre'];
|
||||||
if (empty($alias)) {
|
if (empty($alias) === true) {
|
||||||
$alias = $agent['alias'];
|
$alias = $agent['alias'];
|
||||||
if (empty($alias)) {
|
if (empty($alias) === true) {
|
||||||
$alias = $nombre_agente;
|
$alias = $nombre_agente;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1289,7 +1272,7 @@ $duplicate_module = (int) get_parameter('duplicate_module');
|
|||||||
$edit_module = (bool) get_parameter('edit_module');
|
$edit_module = (bool) get_parameter('edit_module');
|
||||||
|
|
||||||
// GET DATA for MODULE UPDATE OR MODULE INSERT.
|
// GET DATA for MODULE UPDATE OR MODULE INSERT.
|
||||||
if ($update_module || $create_module) {
|
if ($update_module === true || $create_module === true) {
|
||||||
$id_grupo = agents_get_agent_group($id_agente);
|
$id_grupo = agents_get_agent_group($id_agente);
|
||||||
$all_groups = agents_get_all_groups_agent($id_agente, $id_grupo);
|
$all_groups = agents_get_all_groups_agent($id_agente, $id_grupo);
|
||||||
|
|
||||||
@ -1316,12 +1299,7 @@ if ($update_module || $create_module) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$post_process = (string) get_parameter('post_process', 0.0);
|
$post_process = (string) get_parameter('post_process', 0.0);
|
||||||
if (get_parameter('prediction_module')) {
|
$prediction_module = (int) get_parameter('prediction_module');
|
||||||
$prediction_module = 1;
|
|
||||||
} else {
|
|
||||||
$prediction_module = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$max_timeout = (int) get_parameter('max_timeout');
|
$max_timeout = (int) get_parameter('max_timeout');
|
||||||
$max_retries = (int) get_parameter('max_retries');
|
$max_retries = (int) get_parameter('max_retries');
|
||||||
$min = (int) get_parameter('min');
|
$min = (int) get_parameter('min');
|
||||||
@ -1578,11 +1556,11 @@ if ($update_module || $create_module) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$cron_interval = $minute_from.$minute_to.' '.$hour_from.$hour_to.' '.$mday_from.$mday_to.' '.$month_from.$month_to.' '.$wday_from.$wday_to;
|
$cron_interval = $minute_from.$minute_to.' '.$hour_from.$hour_to.' '.$mday_from.$mday_to.' '.$month_from.$month_to.' '.$wday_from.$wday_to;
|
||||||
if (!cron_check_syntax($cron_interval)) {
|
if (cron_check_syntax($cron_interval) === false) {
|
||||||
$cron_interval = '';
|
$cron_interval = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($prediction_module != MODULE_PREDICTION_SYNTHETIC) {
|
if ($prediction_module !== MODULE_PREDICTION_SYNTHETIC) {
|
||||||
unset($serialize_ops);
|
unset($serialize_ops);
|
||||||
enterprise_hook(
|
enterprise_hook(
|
||||||
'modules_delete_synthetic_operations',
|
'modules_delete_synthetic_operations',
|
||||||
@ -1707,7 +1685,7 @@ if ($update_module) {
|
|||||||
$values['plugin_parameter'] = '';
|
$values['plugin_parameter'] = '';
|
||||||
|
|
||||||
foreach ($plugin_parameter_split as $key => $value) {
|
foreach ($plugin_parameter_split as $key => $value) {
|
||||||
if ($key == 1) {
|
if ((int) $key === 1) {
|
||||||
if ($http_user) {
|
if ($http_user) {
|
||||||
$values['plugin_parameter'] .= 'http_auth_user '.$http_user.'
';
|
$values['plugin_parameter'] .= 'http_auth_user '.$http_user.'
';
|
||||||
}
|
}
|
||||||
@ -1726,12 +1704,12 @@ if ($update_module) {
|
|||||||
|
|
||||||
// In local modules, the interval is updated by agent.
|
// In local modules, the interval is updated by agent.
|
||||||
$module_kind = (int) get_parameter('moduletype');
|
$module_kind = (int) get_parameter('moduletype');
|
||||||
if ($module_kind == MODULE_DATA) {
|
if ($module_kind === MODULE_DATA) {
|
||||||
unset($values['module_interval']);
|
unset($values['module_interval']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($prediction_module == MODULE_PREDICTION_SYNTHETIC
|
if ($prediction_module === MODULE_PREDICTION_SYNTHETIC
|
||||||
&& $serialize_ops == ''
|
&& empty($serialize_ops) === true
|
||||||
) {
|
) {
|
||||||
$result = false;
|
$result = false;
|
||||||
} else {
|
} else {
|
||||||
@ -1752,7 +1730,7 @@ if ($update_module) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_error($result)) {
|
if (is_error($result) === true) {
|
||||||
switch ($result) {
|
switch ($result) {
|
||||||
case ERR_EXIST:
|
case ERR_EXIST:
|
||||||
$msg = __('There was a problem updating module. Another module already exists with the same name.');
|
$msg = __('There was a problem updating module. Another module already exists with the same name.');
|
||||||
@ -1785,7 +1763,7 @@ if ($update_module) {
|
|||||||
"Fail to try update module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
|
"Fail to try update module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if ($prediction_module == MODULE_PREDICTION_SYNTHETIC) {
|
if ($prediction_module === MODULE_PREDICTION_SYNTHETIC) {
|
||||||
enterprise_hook(
|
enterprise_hook(
|
||||||
'modules_create_synthetic_operations',
|
'modules_create_synthetic_operations',
|
||||||
[
|
[
|
||||||
@ -1819,28 +1797,16 @@ if ($create_module) {
|
|||||||
// Old configuration data must always be empty in case of creation.
|
// Old configuration data must always be empty in case of creation.
|
||||||
$old_configuration_data = '';
|
$old_configuration_data = '';
|
||||||
|
|
||||||
if (isset($_POST['combo_snmp_oid'])) {
|
if (isset($_POST['combo_snmp_oid']) === true) {
|
||||||
$combo_snmp_oid = get_parameter_post('combo_snmp_oid');
|
$combo_snmp_oid = get_parameter_post('combo_snmp_oid');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($snmp_oid == '') {
|
if (empty($snmp_oid) === true) {
|
||||||
$snmp_oid = $combo_snmp_oid;
|
$snmp_oid = $combo_snmp_oid;
|
||||||
}
|
}
|
||||||
|
|
||||||
$id_module = (int) get_parameter('id_module');
|
$id_module = (int) get_parameter('id_module');
|
||||||
|
|
||||||
switch ($config['dbtype']) {
|
|
||||||
case 'oracle':
|
|
||||||
if (empty($description) || !isset($description)) {
|
|
||||||
$description = ' ';
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// Default.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$values = [
|
$values = [
|
||||||
'id_tipo_modulo' => $id_module_type,
|
'id_tipo_modulo' => $id_module_type,
|
||||||
'descripcion' => $description,
|
'descripcion' => $description,
|
||||||
@ -1909,13 +1875,13 @@ if ($create_module) {
|
|||||||
'warning_time' => $warning_time,
|
'warning_time' => $warning_time,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) {
|
if ($id_module_type === 30 || $id_module_type === 31 || $id_module_type === 32 || $id_module_type === 33) {
|
||||||
$plugin_parameter_split = explode('
', $values['plugin_parameter']);
|
$plugin_parameter_split = explode('
', $values['plugin_parameter']);
|
||||||
|
|
||||||
$values['plugin_parameter'] = '';
|
$values['plugin_parameter'] = '';
|
||||||
|
|
||||||
foreach ($plugin_parameter_split as $key => $value) {
|
foreach ($plugin_parameter_split as $key => $value) {
|
||||||
if ($key == 1) {
|
if ((int) $key === 1) {
|
||||||
if ($http_user) {
|
if ($http_user) {
|
||||||
$values['plugin_parameter'] .= 'http_auth_user '.$http_user.'
';
|
$values['plugin_parameter'] .= 'http_auth_user '.$http_user.'
';
|
||||||
}
|
}
|
||||||
@ -1923,15 +1889,13 @@ if ($create_module) {
|
|||||||
if ($http_pass) {
|
if ($http_pass) {
|
||||||
$values['plugin_parameter'] .= 'http_auth_pass '.$http_pass.'
';
|
$values['plugin_parameter'] .= 'http_auth_pass '.$http_pass.'
';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$values['plugin_parameter'] .= $value.'
';
|
|
||||||
} else {
|
|
||||||
$values['plugin_parameter'] .= $value.'
';
|
$values['plugin_parameter'] .= $value.'
';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($prediction_module == MODULE_PREDICTION_SYNTHETIC && $serialize_ops == '') {
|
if ((int) $prediction_module === MODULE_PREDICTION_SYNTHETIC && empty($serialize_ops) === true) {
|
||||||
$id_agent_module = false;
|
$id_agent_module = false;
|
||||||
} else {
|
} else {
|
||||||
$id_agent_module = modules_create_agent_module(
|
$id_agent_module = modules_create_agent_module(
|
||||||
@ -1943,7 +1907,7 @@ if ($create_module) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_error($id_agent_module)) {
|
if (is_error($id_agent_module) === true) {
|
||||||
switch ($id_agent_module) {
|
switch ($id_agent_module) {
|
||||||
case ERR_EXIST:
|
case ERR_EXIST:
|
||||||
$msg = __('There was a problem adding module. Another module already exists with the same name.');
|
$msg = __('There was a problem adding module. Another module already exists with the same name.');
|
||||||
@ -1972,7 +1936,7 @@ if ($create_module) {
|
|||||||
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
|
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if ($prediction_module == MODULE_PREDICTION_SYNTHETIC) {
|
if ($prediction_module === MODULE_PREDICTION_SYNTHETIC) {
|
||||||
enterprise_hook(
|
enterprise_hook(
|
||||||
'modules_create_synthetic_operations',
|
'modules_create_synthetic_operations',
|
||||||
[
|
[
|
||||||
@ -1994,7 +1958,7 @@ if ($create_module) {
|
|||||||
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
AUDIT_LOG_AGENT_MANAGEMENT,
|
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,
|
false,
|
||||||
true,
|
true,
|
||||||
io_json_mb_encode($values)
|
io_json_mb_encode($values)
|
||||||
@ -2252,8 +2216,8 @@ if ($disable_module) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UPDATE GIS.
|
// UPDATE GIS.
|
||||||
$updateGIS = get_parameter('update_gis', 0);
|
$updateGIS = (bool) get_parameter('update_gis', 0);
|
||||||
if ($updateGIS) {
|
if ($updateGIS === true) {
|
||||||
$updateGisData = get_parameter('update_gis_data');
|
$updateGisData = get_parameter('update_gis_data');
|
||||||
$lastLatitude = get_parameter('latitude');
|
$lastLatitude = get_parameter('latitude');
|
||||||
$lastLongitude = get_parameter('longitude');
|
$lastLongitude = get_parameter('longitude');
|
||||||
@ -2523,7 +2487,7 @@ switch ($tab) {
|
|||||||
if(wizard_tab_showed <= 0) {
|
if(wizard_tab_showed <= 0) {
|
||||||
$('.subsubmenu').hide("fast");
|
$('.subsubmenu').hide("fast");
|
||||||
}
|
}
|
||||||
},15000);
|
},1500);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ]]> */
|
/* ]]> */
|
||||||
|
@ -1,16 +1,32 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Edit Fields manager.
|
||||||
|
*
|
||||||
|
* @category Resources.
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Load global vars.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation for version 2.
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
@ -47,13 +63,8 @@ if ($id_field) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->class = 'databox';
|
||||||
$table->class = 'databox filters';
|
|
||||||
$table->id = 'configure_field';
|
$table->id = 'configure_field';
|
||||||
$table->style[0] = 'font-weight: bold';
|
|
||||||
$table->style[2] = 'font-weight: bold';
|
|
||||||
$table->style[4] = 'font-weight: bold';
|
|
||||||
$table->style[6] = 'font-weight: bold';
|
|
||||||
|
|
||||||
echo "<div id='message_set_password' title='".__('Agent Custom Fields Information')."' class='invisible'>";
|
echo "<div id='message_set_password' title='".__('Agent Custom Fields Information')."' class='invisible'>";
|
||||||
echo "<p class='center bolder'>".__('You cannot set the Password type until you clear the combo values and click on update button.').'</p>';
|
echo "<p class='center bolder'>".__('You cannot set the Password type until you clear the combo values and click on update button.').'</p>';
|
||||||
@ -75,7 +86,7 @@ echo '</div>';
|
|||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
|
||||||
$table->data[0][0] = __('Name');
|
$table->data[0][0] = __('Name');
|
||||||
$table->data[0][1] = html_print_input_text(
|
$table->data[1][0] = html_print_input_text(
|
||||||
'name',
|
'name',
|
||||||
$name,
|
$name,
|
||||||
'',
|
'',
|
||||||
@ -84,30 +95,39 @@ $table->data[0][1] = html_print_input_text(
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data[1][0] = __('Pass type').ui_print_help_tip(
|
$table->data[2][0] = __('Pass type').ui_print_help_tip(
|
||||||
__('The fields with pass type enabled will be displayed like html input type pass in html'),
|
__('The fields with pass type enabled will be displayed like html input type pass in html'),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
$table->data[1][1] = html_print_checkbox_switch(
|
$table->data[2][1] = __('Display on front').ui_print_help_tip(
|
||||||
|
__('The fields with display on front enabled will be displayed into the agent details'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table->data[2][2] = __('Link type');
|
||||||
|
|
||||||
|
$table->data[3][0] = html_print_checkbox_switch(
|
||||||
'is_password_type',
|
'is_password_type',
|
||||||
1,
|
1,
|
||||||
$is_password_type,
|
$is_password_type,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
$table->data[3][1] = html_print_checkbox_switch(
|
||||||
$table->data[2][0] = __('Display on front').ui_print_help_tip(
|
|
||||||
__('The fields with display on front enabled will be displayed into the agent details'),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
$table->data[2][1] = html_print_checkbox_switch(
|
|
||||||
'display_on_front',
|
'display_on_front',
|
||||||
1,
|
1,
|
||||||
$display_on_front,
|
$display_on_front,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
$table->data[3][2] = html_print_checkbox_switch_extended(
|
||||||
$table->data[3][0] = __('Enabled combo');
|
'is_link_enabled',
|
||||||
$table->data[3][1] = html_print_checkbox_switch_extended(
|
1,
|
||||||
|
$is_link_enabled,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table->data[4][0] = __('Enabled combo');
|
||||||
|
$table->data[5][0] = html_print_checkbox_switch_extended(
|
||||||
'is_combo_enable',
|
'is_combo_enable',
|
||||||
0,
|
0,
|
||||||
$config['is_combo_enable'],
|
$config['is_combo_enable'],
|
||||||
@ -117,12 +137,15 @@ $table->data[3][1] = html_print_checkbox_switch_extended(
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->rowstyle[4] = 'display: none;';
|
|
||||||
$table->data[4][0] = __('Combo values').ui_print_help_tip(
|
$table->cellstyle[4][1] = 'display: none;';
|
||||||
|
$table->cellstyle[5][1] = 'display: none;';
|
||||||
|
|
||||||
|
$table->data[4][1] = __('Combo values').ui_print_help_tip(
|
||||||
__('Set values separated by comma'),
|
__('Set values separated by comma'),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
$table->data[4][1] = html_print_textarea(
|
$table->data[5][1] = html_print_textarea(
|
||||||
'combo_values',
|
'combo_values',
|
||||||
3,
|
3,
|
||||||
65,
|
65,
|
||||||
@ -131,31 +154,40 @@ $table->data[4][1] = html_print_textarea(
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data[5][0] = __('Link type');
|
|
||||||
$table->data[5][1] = html_print_checkbox_switch_extended(
|
|
||||||
'is_link_enabled',
|
|
||||||
1,
|
|
||||||
$is_link_enabled,
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
echo '<form name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">';
|
echo '<form name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
|
||||||
|
|
||||||
if ($id_field) {
|
if ($id_field > 0) {
|
||||||
html_print_input_hidden('update_field', 1);
|
html_print_input_hidden('update_field', 1);
|
||||||
html_print_input_hidden('id_field', $id_field);
|
html_print_input_hidden('id_field', $id_field);
|
||||||
html_print_submit_button(__('Update'), 'updbutton', false, 'class="sub upd"');
|
$buttonCaption = __('Update');
|
||||||
|
$buttonName = 'updbutton';
|
||||||
} else {
|
} else {
|
||||||
html_print_input_hidden('create_field', 1);
|
html_print_input_hidden('create_field', 1);
|
||||||
html_print_submit_button(__('Create'), 'crtbutton', false, 'class="sub wand"');
|
$buttonCaption = __('Create');
|
||||||
|
$buttonName = 'crtbutton';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</div>';
|
$actionButtons = [];
|
||||||
|
$actionButtons[] = html_print_submit_button(
|
||||||
|
$buttonCaption,
|
||||||
|
$buttonName,
|
||||||
|
false,
|
||||||
|
[ 'icon' => 'wand' ],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$actionButtons[] = html_print_go_back_button(
|
||||||
|
'index.php?sec=gagente&sec2=godmode/agentes/fields_manager',
|
||||||
|
['button_class' => ''],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
html_print_action_buttons(
|
||||||
|
implode('', $actionButtons),
|
||||||
|
['type' => 'form_action'],
|
||||||
|
);
|
||||||
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -1,22 +1,37 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Fields manager.
|
||||||
|
*
|
||||||
|
* @category Resources.
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Load global vars.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation for version 2.
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
// Load global vars
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (!check_acl($config['id_user'], 0, 'PM')) {
|
if ((bool) check_acl($config['id_user'], 0, 'PM') === false) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
AUDIT_LOG_ACL_VIOLATION,
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Group Management'
|
'Trying to access Group Management'
|
||||||
@ -27,7 +42,24 @@ if (!check_acl($config['id_user'], 0, 'PM')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Header.
|
// Header.
|
||||||
ui_print_page_header(__('Agents custom fields manager'), 'images/custom_field.png', false, '', true, '');
|
ui_print_standard_header(
|
||||||
|
__('Agents custom fields manager'),
|
||||||
|
'images/custom_field.png',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
[],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Resources'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Custom fields'),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
$create_field = (bool) get_parameter('create_field');
|
$create_field = (bool) get_parameter('create_field');
|
||||||
$update_field = (bool) get_parameter('update_field');
|
$update_field = (bool) get_parameter('update_field');
|
||||||
@ -114,7 +146,6 @@ $fields = db_get_all_rows_filter(
|
|||||||
);
|
);
|
||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
|
||||||
$table->class = 'info_table';
|
$table->class = 'info_table';
|
||||||
if ($fields) {
|
if ($fields) {
|
||||||
$table->head = [];
|
$table->head = [];
|
||||||
@ -140,34 +171,66 @@ if ($fields === false) {
|
|||||||
|
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
$data[0] = $field['id_field'];
|
$data[0] = $field['id_field'];
|
||||||
|
$data[1] = $field['name'];
|
||||||
|
|
||||||
$data[1] = '<b>'.$field['name'].'</b>';
|
|
||||||
|
|
||||||
if ($field['display_on_front']) {
|
|
||||||
$data[2] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
|
|
||||||
} else {
|
|
||||||
$data[2] = html_print_image(
|
$data[2] = html_print_image(
|
||||||
'images/icono_stop.png',
|
((bool) $field['display_on_front'] === true) ? 'images/validate.svg' : 'images/fail@svg.svg',
|
||||||
true,
|
true,
|
||||||
['style' => 'width:21px;height:21px;']
|
['class' => 'main_menu_icon invert_filter']
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
$table->cellclass[][3] = 'action_buttons';
|
$table->cellclass[][3] = 'table_action_buttons';
|
||||||
$data[3] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configure_field&id_field='.$field['id_field'].'">'.html_print_image('images/config.png', true, ['alt' => __('Edit'), 'title' => __('Edit'), 'border' => '0', 'class' => 'invert_filter']).'</a>';
|
$tableActionButtons = [];
|
||||||
$data[3] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/fields_manager&delete_field=1&id_field='.$field['id_field'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete'), 'border' => '0', 'class' => 'invert_filter']).'</a>';
|
$tableActionButtons[] = html_print_anchor(
|
||||||
|
[
|
||||||
|
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configure_field&id_field='.$field['id_field'],
|
||||||
|
'content' => html_print_image(
|
||||||
|
'images/edit.svg',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('Edit'),
|
||||||
|
'class' => 'main_menu_icon invert_filter',
|
||||||
|
]
|
||||||
|
),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$tableActionButtons[] = html_print_anchor(
|
||||||
|
[
|
||||||
|
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/fields_manager&delete_field=1&id_field='.$field['id_field'],
|
||||||
|
'content' => html_print_image(
|
||||||
|
'images/delete.svg',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('Delete'),
|
||||||
|
'class' => 'main_menu_icon invert_filter',
|
||||||
|
]
|
||||||
|
),
|
||||||
|
'onClick' => 'if (!confirm(\' '.__('Are you sure?').'\')) return false;',
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$data[3] = implode('', $tableActionButtons);
|
||||||
|
|
||||||
array_push($table->data, $data);
|
array_push($table->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fields) {
|
if ($fields) {
|
||||||
ui_pagination($count_fields, false, $offset);
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
ui_pagination($count_fields, false, $offset, 0, false, 'offset', true, 'pagination-bottom');
|
$tablePagination = ui_pagination($count_fields, false, $offset, 0, true, 'offset', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configure_field">';
|
echo '<form method="POST" action="index.php?sec=gagente&sec2=godmode/agentes/configure_field">';
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
html_print_action_buttons(
|
||||||
html_print_submit_button(__('Create field'), 'crt', false, 'class="sub next"');
|
html_print_submit_button(
|
||||||
echo '</div>';
|
__('Create field'),
|
||||||
|
'crt',
|
||||||
|
false,
|
||||||
|
[ 'icon' => 'next' ],
|
||||||
|
true
|
||||||
|
),
|
||||||
|
['type' => 'form_action']
|
||||||
|
);
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
@ -235,7 +235,7 @@ if (db_get_num_rows($sql) == 0) {
|
|||||||
if ($id_policy) {
|
if ($id_policy) {
|
||||||
$policy = policies_get_policy($id_policy);
|
$policy = policies_get_policy($id_policy);
|
||||||
$data[0] = '<a href="index.php?sec=gmodules&sec2='.ENTERPRISE_DIR.'/godmode/policies/policies&id='.$id_policy.'">';
|
$data[0] = '<a href="index.php?sec=gmodules&sec2='.ENTERPRISE_DIR.'/godmode/policies/policies&id='.$id_policy.'">';
|
||||||
$data[0] .= html_print_image('images/policies_mc.png', true, ['border' => '0', 'title' => $policy['name']]);
|
$data[0] .= html_print_image('images/policy@svg.svg', true, ['border' => '0', 'title' => $policy['name'], 'class' => 'main_menu_icon invert_filter']);
|
||||||
$data[0] .= '</a>';
|
$data[0] .= '</a>';
|
||||||
} else {
|
} else {
|
||||||
$data[0] = '';
|
$data[0] = '';
|
||||||
@ -247,15 +247,15 @@ if (db_get_num_rows($sql) == 0) {
|
|||||||
$data[4] = human_time_description_raw($row['interval']);
|
$data[4] = human_time_description_raw($row['interval']);
|
||||||
// Delete module
|
// Delete module
|
||||||
$data[5] = '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&delete_inventory_module='.$row['id_agent_module_inventory'].'" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
|
$data[5] = '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&delete_inventory_module='.$row['id_agent_module_inventory'].'" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
|
||||||
$data[5] .= html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete'), 'class' => 'invert_filter']);
|
$data[5] .= html_print_image('images/delete.svg', true, ['border' => '0', 'title' => __('Delete'), 'class' => 'main_menu_icon invert_filter']);
|
||||||
$data[5] .= '</b></a> ';
|
$data[5] .= '</b></a> ';
|
||||||
// Update module
|
// Update module
|
||||||
$data[5] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&load_inventory_module='.$row['id_module_inventory'].'">';
|
$data[5] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&load_inventory_module='.$row['id_module_inventory'].'">';
|
||||||
$data[5] .= html_print_image('images/config.png', true, ['border' => '0', 'title' => __('Update'), 'class' => 'invert_filter']);
|
$data[5] .= html_print_image('images/edit.svg', true, ['border' => '0', 'title' => __('Update'), 'class' => 'main_menu_icon invert_filter']);
|
||||||
$data[5] .= '</b></a> ';
|
$data[5] .= '</b></a> ';
|
||||||
// Force refresh module
|
// Force refresh module
|
||||||
$data[5] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&force_inventory_module='.$row['id_agent_module_inventory'].'">';
|
$data[5] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&force_inventory_module='.$row['id_agent_module_inventory'].'">';
|
||||||
$data[5] .= html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force'), 'class' => 'invert_filter']).'</b></a>';
|
$data[5] .= html_print_image('images/change-active.svg', true, ['border' => '0', 'title' => __('Force'), 'class' => 'main_menu_icon invert_filter']).'</b></a>';
|
||||||
array_push($table->data, $data);
|
array_push($table->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,10 +36,10 @@ $ag_group = get_parameter('ag_group_refresh', -1);
|
|||||||
$sortField = get_parameter('sort_field');
|
$sortField = get_parameter('sort_field');
|
||||||
$sort = get_parameter('sort', 'none');
|
$sort = get_parameter('sort', 'none');
|
||||||
$recursion = (bool) get_parameter('recursion', false);
|
$recursion = (bool) get_parameter('recursion', false);
|
||||||
$disabled = get_parameter('disabled', 0);
|
$disabled = (int) get_parameter('disabled');
|
||||||
$os = get_parameter('os', 0);
|
$os = (int) get_parameter('os');
|
||||||
|
|
||||||
if ($ag_group == -1) {
|
if ($ag_group === -1) {
|
||||||
$ag_group = (int) get_parameter('ag_group', -1);
|
$ag_group = (int) get_parameter('ag_group', -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,15 +68,16 @@ if (! check_acl(
|
|||||||
enterprise_include_once('include/functions_policies.php');
|
enterprise_include_once('include/functions_policies.php');
|
||||||
require_once 'include/functions_agents.php';
|
require_once 'include/functions_agents.php';
|
||||||
require_once 'include/functions_users.php';
|
require_once 'include/functions_users.php';
|
||||||
|
enterprise_include_once('include/functions_config_agents.php');
|
||||||
|
|
||||||
$search = get_parameter('search', '');
|
$search = get_parameter('search');
|
||||||
|
|
||||||
// Prepare the tab system to the future.
|
// Prepare the tab system to the future.
|
||||||
$tab = 'view';
|
$tab = 'view';
|
||||||
|
|
||||||
// Setup tab.
|
// Setup tab.
|
||||||
$viewtab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente">'.html_print_image(
|
$viewtab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente">'.html_print_image(
|
||||||
'images/eye_show.png',
|
'images/see-details@svg.svg',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'title' => __('View'),
|
'title' => __('View'),
|
||||||
@ -132,20 +133,19 @@ $agent_to_delete = (int) get_parameter('borrar_agente');
|
|||||||
$enable_agent = (int) get_parameter('enable_agent');
|
$enable_agent = (int) get_parameter('enable_agent');
|
||||||
$disable_agent = (int) get_parameter('disable_agent');
|
$disable_agent = (int) get_parameter('disable_agent');
|
||||||
|
|
||||||
if ($disable_agent != 0) {
|
if ($disable_agent !== 0) {
|
||||||
$server_name = db_get_row_sql(
|
$server_name = db_get_row_sql(
|
||||||
'select server_name from tagente where id_agente = '.$disable_agent
|
'select server_name from tagente where id_agente = '.$disable_agent
|
||||||
);
|
);
|
||||||
} else if ($enable_agent != 0) {
|
} else if ($enable_agent !== 0) {
|
||||||
$server_name = db_get_row_sql(
|
$server_name = db_get_row_sql(
|
||||||
'select server_name from tagente where id_agente = '.$enable_agent
|
'select server_name from tagente where id_agente = '.$enable_agent
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$result = null;
|
$result = null;
|
||||||
|
|
||||||
if ($agent_to_delete) {
|
if ($agent_to_delete > 0) {
|
||||||
$id_agente = $agent_to_delete;
|
$id_agente = $agent_to_delete;
|
||||||
if (check_acl_one_of_groups(
|
if (check_acl_one_of_groups(
|
||||||
$config['id_user'],
|
$config['id_user'],
|
||||||
@ -171,17 +171,10 @@ if ($agent_to_delete) {
|
|||||||
__('Could not be deleted.')
|
__('Could not be deleted.')
|
||||||
);
|
);
|
||||||
|
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed() === true) {
|
||||||
// Check if the remote config file still exist.
|
// Check if the remote config file still exist.
|
||||||
if (isset($config['remote_config'])) {
|
if (isset($config['remote_config']) === true) {
|
||||||
enterprise_include_once(
|
if ((bool) enterprise_hook('config_agents_has_remote_configuration', [$id_agente]) === true) {
|
||||||
'include/functions_config_agents.php'
|
|
||||||
);
|
|
||||||
if (enterprise_hook(
|
|
||||||
'config_agents_has_remote_configuration',
|
|
||||||
[$id_agente]
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
ui_print_error_message(
|
ui_print_error_message(
|
||||||
__('Maybe the files conf or md5 could not be deleted')
|
__('Maybe the files conf or md5 could not be deleted')
|
||||||
);
|
);
|
||||||
@ -190,7 +183,7 @@ if ($agent_to_delete) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($enable_agent) {
|
if ($enable_agent > 0) {
|
||||||
$result = db_process_sql_update(
|
$result = db_process_sql_update(
|
||||||
'tagente',
|
'tagente',
|
||||||
['disabled' => 0],
|
['disabled' => 0],
|
||||||
@ -198,7 +191,7 @@ if ($enable_agent) {
|
|||||||
);
|
);
|
||||||
$alias = io_safe_output(agents_get_alias($enable_agent));
|
$alias = io_safe_output(agents_get_alias($enable_agent));
|
||||||
|
|
||||||
if ($result) {
|
if ((bool) $result !== false) {
|
||||||
// Update the agent from the metaconsole cache.
|
// Update the agent from the metaconsole cache.
|
||||||
enterprise_include_once('include/functions_agents.php');
|
enterprise_include_once('include/functions_agents.php');
|
||||||
$values = ['disabled' => 0];
|
$values = ['disabled' => 0];
|
||||||
@ -236,7 +229,7 @@ if ($enable_agent) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($disable_agent) {
|
if ($disable_agent > 0) {
|
||||||
$result = db_process_sql_update('tagente', ['disabled' => 1], ['id_agente' => $disable_agent]);
|
$result = db_process_sql_update('tagente', ['disabled' => 1], ['id_agente' => $disable_agent]);
|
||||||
$alias = io_safe_output(agents_get_alias($disable_agent));
|
$alias = io_safe_output(agents_get_alias($disable_agent));
|
||||||
|
|
||||||
@ -279,28 +272,45 @@ if ($disable_agent) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<table cellpadding='4' cellspacing='4' class='databox filters font_bold margin-bottom-10' width='100%'>
|
|
||||||
<tr>";
|
|
||||||
echo "<form method='post'
|
|
||||||
action='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente'>";
|
|
||||||
|
|
||||||
echo '<td>';
|
|
||||||
|
|
||||||
echo __('Group').' ';
|
|
||||||
$own_info = get_user_info($config['id_user']);
|
$own_info = get_user_info($config['id_user']);
|
||||||
if (!$own_info['is_admin'] && !check_acl(
|
if ((bool) $own_info['is_admin'] === false && (bool) check_acl(
|
||||||
$config['id_user'],
|
$config['id_user'],
|
||||||
0,
|
0,
|
||||||
'AR'
|
'AR'
|
||||||
) && !check_acl($config['id_user'], 0, 'AW')
|
) === false && (bool) check_acl($config['id_user'], 0, 'AW') === false
|
||||||
) {
|
) {
|
||||||
$return_all_group = false;
|
$return_all_group = false;
|
||||||
} else {
|
} else {
|
||||||
$return_all_group = true;
|
$return_all_group = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class="w250px inline">';
|
$showAgentFields = [
|
||||||
html_print_select_groups(
|
2 => __('Everyone'),
|
||||||
|
1 => __('Only disabled'),
|
||||||
|
0 => __('Only enabled'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$pre_fields = db_get_all_rows_sql(
|
||||||
|
'select distinct(tagente.id_os),tconfig_os.name from tagente,tconfig_os where tagente.id_os = tconfig_os.id_os'
|
||||||
|
);
|
||||||
|
|
||||||
|
$fields = [];
|
||||||
|
|
||||||
|
foreach ($pre_fields as $key => $value) {
|
||||||
|
$fields[$value['id_os']] = $value['name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter table.
|
||||||
|
$filterTable = new stdClass();
|
||||||
|
$filterTable->class = 'fixed_filter_bar';
|
||||||
|
$filterTable->data = [];
|
||||||
|
$filterTable->cellstyle[0][0] = 'width:0';
|
||||||
|
$filterTable->cellstyle[0][1] = 'width:0';
|
||||||
|
$filterTable->cellstyle[0][2] = 'width:0';
|
||||||
|
$filterTable->cellstyle[0][3] = 'width:0';
|
||||||
|
|
||||||
|
$filterTable->data[0][0] = __('Group');
|
||||||
|
$filterTable->data[1][0] = html_print_select_groups(
|
||||||
false,
|
false,
|
||||||
'AR',
|
'AR',
|
||||||
$return_all_group,
|
$return_all_group,
|
||||||
@ -309,71 +319,78 @@ html_print_select_groups(
|
|||||||
'this.form.submit();',
|
'this.form.submit();',
|
||||||
'',
|
'',
|
||||||
0,
|
0,
|
||||||
false,
|
true,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
echo '</div></td>';
|
|
||||||
|
|
||||||
// Recursion checkbox.
|
$filterTable->data[0][1] = __('Recursion');
|
||||||
echo '<td>';
|
$filterTable->data[1][1] = html_print_checkbox_switch(
|
||||||
echo __('Recursion').' ';
|
|
||||||
html_print_checkbox(
|
|
||||||
'recursion',
|
'recursion',
|
||||||
1,
|
1,
|
||||||
$recursion,
|
$recursion,
|
||||||
false,
|
true,
|
||||||
false,
|
false,
|
||||||
'this.form.submit()'
|
'this.form.submit()'
|
||||||
);
|
);
|
||||||
echo '</td>';
|
|
||||||
echo '<td>';
|
$filterTable->data[0][2] = __('Show agents');
|
||||||
echo __('Show Agents').' ';
|
$filterTable->data[1][2] = html_print_select(
|
||||||
$fields = [
|
$showAgentFields,
|
||||||
2 => __('Everyone'),
|
|
||||||
1 => __('Only disabled'),
|
|
||||||
0 => __('Only enabled'),
|
|
||||||
];
|
|
||||||
html_print_select(
|
|
||||||
$fields,
|
|
||||||
'disabled',
|
'disabled',
|
||||||
$disabled,
|
$disabled,
|
||||||
'this.form.submit()'
|
'this.form.submit()',
|
||||||
);
|
'',
|
||||||
|
0,
|
||||||
echo '</td>';
|
|
||||||
|
|
||||||
echo '<td>';
|
|
||||||
echo __('Operative System').' ';
|
|
||||||
|
|
||||||
$pre_fields = db_get_all_rows_sql(
|
|
||||||
'select distinct(tagente.id_os),tconfig_os.name from tagente,tconfig_os where tagente.id_os = tconfig_os.id_os'
|
|
||||||
);
|
|
||||||
$fields = [];
|
|
||||||
|
|
||||||
foreach ($pre_fields as $key => $value) {
|
|
||||||
$fields[$value['id_os']] = $value['name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
html_print_select($fields, 'os', $os, 'this.form.submit()', 'All', 0);
|
|
||||||
|
|
||||||
echo '</td><td>';
|
|
||||||
echo __('Search').' ';
|
|
||||||
html_print_input_text('search', $search, '', 12);
|
|
||||||
|
|
||||||
echo ui_print_help_tip(
|
|
||||||
__('Search filter by alias, name, description, IP address or custom fields content'),
|
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '</td><td>';
|
$filterTable->data[0][3] = __('Operating System');
|
||||||
echo "<input name='srcbutton' type='submit' class='sub search' value='".__('Search')."'>";
|
$filterTable->data[1][3] = html_print_select(
|
||||||
echo '</form>';
|
$fields,
|
||||||
echo '<td>';
|
'os',
|
||||||
echo '</tr></table>';
|
$os,
|
||||||
|
'this.form.submit()',
|
||||||
|
'All',
|
||||||
|
0,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$filterTable->data[0][4] = __('Free search');
|
||||||
|
$filterTable->data[0][4] .= ui_print_help_tip(
|
||||||
|
__('Search filter by alias, name, description, IP address or custom fields content'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$filterTable->data[1][4] = html_print_input_text(
|
||||||
|
'search',
|
||||||
|
$search,
|
||||||
|
'',
|
||||||
|
12,
|
||||||
|
255,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$filterTable->cellstyle[1][5] = 'vertical-align: bottom';
|
||||||
|
$filterTable->data[1][5] = html_print_submit_button(
|
||||||
|
__('Filter'),
|
||||||
|
'srcbutton',
|
||||||
|
false,
|
||||||
|
[
|
||||||
|
'icon' => 'search',
|
||||||
|
'class' => 'float-right',
|
||||||
|
'mode' => 'secondary mini',
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
// Print filter table.
|
||||||
|
echo '<form method=\'post\' action=\'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente\'>';
|
||||||
|
html_print_table($filterTable);
|
||||||
|
echo '</form>';
|
||||||
|
|
||||||
|
// Data table.
|
||||||
$selected = true;
|
$selected = true;
|
||||||
$selectNameUp = false;
|
$selectNameUp = false;
|
||||||
$selectNameDown = false;
|
$selectNameDown = false;
|
||||||
@ -381,6 +398,8 @@ $selectOsUp = false;
|
|||||||
$selectOsDown = false;
|
$selectOsDown = false;
|
||||||
$selectGroupUp = false;
|
$selectGroupUp = false;
|
||||||
$selectGroupDown = false;
|
$selectGroupDown = false;
|
||||||
|
$selectRemoteUp = false;
|
||||||
|
$selectRemoteDown = false;
|
||||||
switch ($sortField) {
|
switch ($sortField) {
|
||||||
case 'remote':
|
case 'remote':
|
||||||
switch ($sort) {
|
switch ($sort) {
|
||||||
@ -553,7 +572,7 @@ if ($disabled == 1) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($os != 0) {
|
if ($os !== 0) {
|
||||||
$search_sql .= ' AND id_os = '.$os;
|
$search_sql .= ' AND id_os = '.$os;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,7 +581,7 @@ $user_groups_to_sql = '';
|
|||||||
if ($ag_group > 0) {
|
if ($ag_group > 0) {
|
||||||
$ag_groups = [];
|
$ag_groups = [];
|
||||||
$ag_groups = (array) $ag_group;
|
$ag_groups = (array) $ag_group;
|
||||||
if ($recursion) {
|
if ($recursion === true) {
|
||||||
$ag_groups = groups_get_children_ids($ag_group, true);
|
$ag_groups = groups_get_children_ids($ag_group, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,23 +629,15 @@ $sql = sprintf(
|
|||||||
);
|
);
|
||||||
|
|
||||||
$agents = db_get_all_rows_sql($sql);
|
$agents = db_get_all_rows_sql($sql);
|
||||||
|
$custom_font_size = '';
|
||||||
// Delete rnum row generated by oracle_recode_query() function.
|
|
||||||
if (($config['dbtype'] == 'oracle') && ($agents !== false)) {
|
|
||||||
for ($i = 0; $i < count($agents); $i++) {
|
|
||||||
unset($agents[$i]['rnum']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prepare pagination.
|
// Prepare pagination.
|
||||||
ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
|
// ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
|
||||||
|
|
||||||
if ($agents !== false) {
|
if ($agents !== false) {
|
||||||
// Urls to sort the table.
|
// Urls to sort the table.
|
||||||
if ($config['language'] == 'ja'
|
if ($config['language'] === 'ja'
|
||||||
|| $config['language'] == 'zh_CN'
|
|| $config['language'] === 'zh_CN'
|
||||||
|| $own_info['language'] == 'ja'
|
|| $own_info['language'] === 'ja'
|
||||||
|| $own_info['language'] == 'zh_CN'
|
|| $own_info['language'] === 'zh_CN'
|
||||||
) {
|
) {
|
||||||
// Adds a custom font size for Japanese and Chinese language.
|
// Adds a custom font size for Japanese and Chinese language.
|
||||||
$custom_font_size = 'custom_font_size';
|
$custom_font_size = 'custom_font_size';
|
||||||
@ -641,38 +652,33 @@ if ($agents !== false) {
|
|||||||
$url_up_group = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled';
|
$url_up_group = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled';
|
||||||
$url_down_group = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled';
|
$url_down_group = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled';
|
||||||
|
|
||||||
|
$tableAgents = new stdClass();
|
||||||
echo "<table cellpadding='0' id='agent_list' cellspacing='0' width='100%' class='info_table'>";
|
$tableAgents->id = 'agent_list';
|
||||||
echo '<thead><tr>';
|
$tableAgents->class = 'info_table tactical_table';
|
||||||
echo '<th>'.__('Agent name').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectNameUp, $selectNameDown).'</th>';
|
$tableAgents->head = [];
|
||||||
echo "<th title='".__('Remote agent configuration')."'>".__('R').ui_get_sorting_arrows($url_up_remote, $url_down_remote, $selectRemoteUp, $selectRemoteDown).'</th>';
|
$tableAgents->data = [];
|
||||||
echo '<th>'.__('OS').ui_get_sorting_arrows($url_up_os, $url_down_os, $selectOsUp, $selectOsDown).'</th>';
|
// Header.
|
||||||
echo '<th>'.__('Type').'</th>';
|
$tableAgents->head[0] = '<span>'.__('Agent name').'</span>';
|
||||||
echo '<th>'.__('Group').ui_get_sorting_arrows($url_up_group, $url_down_group, $selectGroupUp, $selectGroupDown).'</th>';
|
$tableAgents->head[0] .= ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectNameUp, $selectNameDown);
|
||||||
echo '<th>'.__('Description').'</th>';
|
$tableAgents->head[1] = '<span title=\''.__('Remote agent configuration').'\'>'.__('R').'</span>';
|
||||||
echo "<th class='context_help_body'>".__('Actions').'</th>';
|
$tableAgents->head[1] .= ui_get_sorting_arrows($url_up_remote, $url_down_remote, $selectRemoteUp, $selectRemoteDown);
|
||||||
echo '</tr></thead>';
|
$tableAgents->head[2] = '<span>'.__('OS').'</span>';
|
||||||
$color = 1;
|
$tableAgents->head[2] .= ui_get_sorting_arrows($url_up_os, $url_down_os, $selectOsUp, $selectOsDown);
|
||||||
|
$tableAgents->head[3] = '<span>'.__('Type').'</span>';
|
||||||
$rowPair = true;
|
$tableAgents->head[4] = '<span>'.__('Group').'</span>';
|
||||||
$iterator = 0;
|
$tableAgents->head[4] .= ui_get_sorting_arrows($url_up_group, $url_down_group, $selectGroupUp, $selectGroupDown);
|
||||||
foreach ($agents as $agent) {
|
$tableAgents->head[5] = '<span>'.__('Description').'</span>';
|
||||||
// Begin Update tagente.remote 0/1 with remote agent function return.
|
$tableAgents->head[6] = '<span>'.__('Actions').'</span>';
|
||||||
if (enterprise_hook(
|
// Body.
|
||||||
'config_agents_has_remote_configuration',
|
foreach ($agents as $key => $agent) {
|
||||||
[$agent['id_agente']]
|
// Begin Update tagente.remote with 0/1 values.
|
||||||
)
|
$resultHasRemoteConfig = ((int) enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']]) > 0);
|
||||||
) {
|
|
||||||
db_process_sql_update(
|
db_process_sql_update(
|
||||||
'tagente',
|
'tagente',
|
||||||
['remote' => 1],
|
['remote' => ((int) $resultHasRemoteConfig) ],
|
||||||
'id_agente = '.$agent['id_agente'].''
|
'id_agente = '.$agent['id_agente'].''
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
db_process_sql_update('tagente', ['remote' => 0], 'id_agente = '.$agent['id_agente'].'');
|
|
||||||
}
|
|
||||||
|
|
||||||
// End Update tagente.remote 0/1 with remote agent function return.
|
|
||||||
$all_groups = agents_get_all_groups_agent(
|
$all_groups = agents_get_all_groups_agent(
|
||||||
$agent['id_agente'],
|
$agent['id_agente'],
|
||||||
$agent['id_grupo']
|
$agent['id_grupo']
|
||||||
@ -688,87 +694,66 @@ if ($agents !== false) {
|
|||||||
'AD'
|
'AD'
|
||||||
);
|
);
|
||||||
|
|
||||||
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
|
$cluster = db_get_row_sql(
|
||||||
|
'select id from tcluster where id_agent = '.$agent['id_agente']
|
||||||
|
);
|
||||||
|
|
||||||
// Do not show the agent if there is not enough permissions.
|
if ($check_aw === false && $check_ad === false) {
|
||||||
if (!$check_aw && !$check_ad) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($color == 1) {
|
if ((int) $agent['id_os'] === CLUSTER_OS_ID) {
|
||||||
$tdcolor = 'datos';
|
$cluster = PandoraFMS\Cluster::loadFromAgentId($agent['id_agente']);
|
||||||
$color = 0;
|
$agentNameUrl = sprintf(
|
||||||
|
'index.php?sec=reporting&sec2=operation/cluster/cluster&op=update&id=%s',
|
||||||
|
$cluster->id()
|
||||||
|
);
|
||||||
|
$agentViewUrl = sprintf(
|
||||||
|
'index.php?sec=reporting&sec2=operation/cluster/cluster&op=view&id=%s',
|
||||||
|
$cluster->id()
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$tdcolor = 'datos2';
|
$main_tab = ($check_aw === true) ? 'main' : 'module';
|
||||||
$color = 1;
|
$agentNameUrl = sprintf(
|
||||||
|
'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=%s&id_agente=%s',
|
||||||
|
$main_tab,
|
||||||
|
$agent['id_agente']
|
||||||
|
);
|
||||||
|
$agentViewUrl = sprintf(
|
||||||
|
'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=%s',
|
||||||
|
$agent['id_agente']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($agent['alias']) === true) {
|
||||||
if ($rowPair) {
|
|
||||||
$rowclass = 'rowPair';
|
|
||||||
} else {
|
|
||||||
$rowclass = 'rowOdd';
|
|
||||||
}
|
|
||||||
|
|
||||||
$rowPair = !$rowPair;
|
|
||||||
$iterator++;
|
|
||||||
// Agent name.
|
|
||||||
echo "<tr class='$rowclass'><td class='$tdcolor' width='40%'>";
|
|
||||||
if ($agent['disabled']) {
|
|
||||||
echo '<em>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<span class="left">';
|
|
||||||
echo '<strong>';
|
|
||||||
|
|
||||||
if ($check_aw) {
|
|
||||||
$main_tab = 'main';
|
|
||||||
} else {
|
|
||||||
$main_tab = 'module';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($agent['alias'] == '') {
|
|
||||||
$agent['alias'] = $agent['nombre'];
|
$agent['alias'] = $agent['nombre'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($agent['id_os'] == CLUSTER_OS_ID) {
|
$additionalDataAgentName = [];
|
||||||
$cluster = PandoraFMS\Cluster::loadFromAgentId(
|
|
||||||
$agent['id_agente']
|
|
||||||
);
|
|
||||||
$url = 'index.php?sec=reporting&sec2=';
|
|
||||||
$url .= 'operation/cluster/cluster';
|
|
||||||
$url = ui_get_full_url(
|
|
||||||
$url.'&op=update&id='.$cluster->id()
|
|
||||||
);
|
|
||||||
echo '<a href="'.$url.'">'.ui_print_truncate_text($agent['alias'], 'agent_medium').'</a>';
|
|
||||||
} else {
|
|
||||||
echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
|
|
||||||
sec2=godmode/agentes/configurar_agente&tab=$main_tab&
|
|
||||||
id_agente=".$agent['id_agente']."'>".'<span class="'.$custom_font_size.' title ="'.$agent['nombre'].'">'.ui_print_truncate_text($agent['alias'], 'agent_medium').'</span>'.'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</strong>';
|
$inPlannedDowntime = db_get_sql(
|
||||||
|
|
||||||
$in_planned_downtime = db_get_sql(
|
|
||||||
'SELECT executed FROM tplanned_downtime
|
'SELECT executed FROM tplanned_downtime
|
||||||
INNER JOIN tplanned_downtime_agents ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime
|
INNER JOIN tplanned_downtime_agents ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime
|
||||||
WHERE tplanned_downtime_agents.id_agent = '.$agent['id_agente'].' AND tplanned_downtime.executed = 1
|
WHERE tplanned_downtime_agents.id_agent = '.$agent['id_agente'].' AND tplanned_downtime.executed = 1
|
||||||
AND tplanned_downtime.type_downtime <> "disable_agent_modules"'
|
AND tplanned_downtime.type_downtime <> "disable_agent_modules"'
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($agent['disabled']) {
|
if ($inPlannedDowntime !== false) {
|
||||||
ui_print_help_tip(__('Disabled'));
|
$additionalDataAgentName[] = ui_print_help_tip(
|
||||||
|
__('Module in scheduled downtime'),
|
||||||
if (!$in_planned_downtime) {
|
true,
|
||||||
echo '</em>';
|
'images/clock.svg'
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($agent['quiet']) {
|
if ((bool) $agent['disabled'] === true) {
|
||||||
echo ' ';
|
$additionalDataAgentName[] = ui_print_help_tip(__('Disabled'));
|
||||||
html_print_image(
|
}
|
||||||
|
|
||||||
|
if ((bool) $agent['quiet'] === true) {
|
||||||
|
$additionalDataAgentName[] = html_print_image(
|
||||||
'images/dot_blue.png',
|
'images/dot_blue.png',
|
||||||
false,
|
true,
|
||||||
[
|
[
|
||||||
'border' => '0',
|
'border' => '0',
|
||||||
'title' => __('Quiet'),
|
'title' => __('Quiet'),
|
||||||
@ -777,183 +762,254 @@ if ($agents !== false) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($in_planned_downtime) {
|
// Agent name column (1). Agent name.
|
||||||
ui_print_help_tip(
|
$agentNameColumn = html_print_anchor(
|
||||||
__('Agent in scheduled downtime'),
|
|
||||||
false,
|
|
||||||
'images/minireloj-16.png'
|
|
||||||
);
|
|
||||||
|
|
||||||
echo '</em>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</span><div class="left actions clear_left" style=" visibility: hidden">';
|
|
||||||
if ($check_aw) {
|
|
||||||
if ($agent['id_os'] == CLUSTER_OS_ID) {
|
|
||||||
$cluster = PandoraFMS\Cluster::loadFromAgentId(
|
|
||||||
$agent['id_agente']
|
|
||||||
);
|
|
||||||
$url = 'index.php?sec=reporting&sec2=';
|
|
||||||
$url .= 'operation/cluster/cluster';
|
|
||||||
$url = ui_get_full_url(
|
|
||||||
$url.'&op=update&id='.$cluster->id()
|
|
||||||
);
|
|
||||||
echo '<a href="'.$url.'">'.__('Edit').'</a>';
|
|
||||||
echo ' | ';
|
|
||||||
} else {
|
|
||||||
echo '<a href="index.php?sec=gagente&
|
|
||||||
sec2=godmode/agentes/configurar_agente&tab=main&
|
|
||||||
id_agente='.$agent['id_agente'].'">'.__('Edit').'</a>';
|
|
||||||
echo ' | ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($agent['id_os'] != 100) {
|
|
||||||
echo '<a href="index.php?sec=gagente&
|
|
||||||
sec2=godmode/agentes/configurar_agente&tab=module&
|
|
||||||
id_agente='.$agent['id_agente'].'">'.__('Modules').'</a>';
|
|
||||||
echo ' | ';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<a href="index.php?sec=gagente&
|
|
||||||
sec2=godmode/agentes/configurar_agente&tab=alert&
|
|
||||||
id_agente='.$agent['id_agente'].'">'.__('Alerts').'</a>';
|
|
||||||
echo ' | ';
|
|
||||||
|
|
||||||
if ($agent['id_os'] == CLUSTER_OS_ID) {
|
|
||||||
$cluster = PandoraFMS\Cluster::loadFromAgentId(
|
|
||||||
$agent['id_agente']
|
|
||||||
);
|
|
||||||
$url = 'index.php?sec=reporting&sec2=';
|
|
||||||
$url .= 'operation/cluster/cluster';
|
|
||||||
$url = ui_get_full_url(
|
|
||||||
$url.'&op=view&id='.$cluster->id()
|
|
||||||
);
|
|
||||||
echo '<a href="'.$url.'">'.__('View').'</a>';
|
|
||||||
} else {
|
|
||||||
echo '<a href="index.php?sec=estado
|
|
||||||
&sec2=operation/agentes/ver_agente
|
|
||||||
&id_agente='.$agent['id_agente'].'">'.__('View').'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</div>';
|
|
||||||
echo '</td>';
|
|
||||||
|
|
||||||
echo "<td align='left' class='$tdcolor'>";
|
|
||||||
// Has remote configuration ?
|
|
||||||
if (enterprise_installed()) {
|
|
||||||
enterprise_include_once('include/functions_config_agents.php');
|
|
||||||
if (enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']])) {
|
|
||||||
echo "<a href='index.php?".'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'tab=remote_configuration&'.'id_agente='.$agent['id_agente']."&disk_conf=1'>";
|
|
||||||
echo html_print_image(
|
|
||||||
'images/application_edit.png',
|
|
||||||
true,
|
|
||||||
[
|
[
|
||||||
'align' => 'middle',
|
'href' => ui_get_full_url($agentNameUrl),
|
||||||
'title' => __('Edit remote config'),
|
'title' => $agent['nombre'],
|
||||||
'class' => 'invert_filter',
|
'content' => ui_print_truncate_text($agent['alias'], 'agent_medium').implode('', $additionalDataAgentName),
|
||||||
]
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$additionalOptionsAgentName = [];
|
||||||
|
// Additional options generation.
|
||||||
|
if ($check_aw === true) {
|
||||||
|
$additionalOptionsAgentName[] = html_print_anchor(
|
||||||
|
[
|
||||||
|
'href' => ui_get_full_url($agentNameUrl),
|
||||||
|
'content' => __('Edit'),
|
||||||
|
],
|
||||||
|
true
|
||||||
);
|
);
|
||||||
echo '</a>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</td>';
|
if ((int) $agent['id_os'] !== 100) {
|
||||||
|
$additionalOptionsAgentName[] = html_print_anchor(
|
||||||
|
[
|
||||||
|
'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$agent['id_agente']),
|
||||||
|
'content' => __('Modules'),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Operating System icon.
|
$additionalOptionsAgentName[] = html_print_anchor(
|
||||||
echo "<td class='$tdcolor' align='left' valign='middle'>";
|
[
|
||||||
ui_print_os_icon($agent['id_os'], false);
|
'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$agent['id_agente']),
|
||||||
echo '</td>';
|
'content' => __('Alerts'),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
// Type agent (Networt, Software or Satellite).
|
$additionalOptionsAgentName[] = html_print_anchor(
|
||||||
echo "<td class='$tdcolor' align='left' valign='middle'>";
|
[
|
||||||
echo ui_print_type_agent_icon(
|
'href' => ui_get_full_url($agentViewUrl),
|
||||||
|
'content' => __('View'),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
// Agent name column (2). Available options.
|
||||||
|
$agentAvailableActionsColumn = html_print_div(
|
||||||
|
[
|
||||||
|
'class' => 'left actions clear_left w100p',
|
||||||
|
'style' => 'visibility: hidden',
|
||||||
|
'content' => implode(' | ', $additionalOptionsAgentName),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
// Remote Configuration column.
|
||||||
|
if ($resultHasRemoteConfig === true) {
|
||||||
|
$remoteConfigurationColumn = html_print_menu_button(
|
||||||
|
[
|
||||||
|
'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$agent['id_agente'].'&disk_conf=1'),
|
||||||
|
'image' => 'images/remote-configuration@svg.svg',
|
||||||
|
'title' => __('Edit remote config'),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$remoteConfigurationColumn = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Operating System icon column.
|
||||||
|
$osIconColumn = html_print_div(
|
||||||
|
[
|
||||||
|
'class' => 'main_menu_icon invert_filter',
|
||||||
|
'content' => ui_print_os_icon($agent['id_os'], false, true),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
// Agent type column.
|
||||||
|
$agentTypeIconColumn = ui_print_type_agent_icon(
|
||||||
$agent['id_os'],
|
$agent['id_os'],
|
||||||
$agent['ultimo_contacto_remoto'],
|
$agent['ultimo_contacto_remoto'],
|
||||||
$agent['ultimo_contacto'],
|
$agent['ultimo_contacto'],
|
||||||
|
true,
|
||||||
$agent['remote'],
|
$agent['remote'],
|
||||||
$agent['agent_version']
|
$agent['agent_version']
|
||||||
);
|
);
|
||||||
echo '</td>';
|
|
||||||
|
|
||||||
|
// Group icon and name column.
|
||||||
|
$agentGroupIconColumn = html_print_div(
|
||||||
|
[
|
||||||
|
'class' => 'main_menu_icon invert_filter',
|
||||||
|
'content' => ui_print_group_icon($agent['id_grupo'], true),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
// Group icon and name.
|
// Description column.
|
||||||
echo "<td class='$tdcolor' align='left' valign='middle'>".ui_print_group_icon($agent['id_grupo'], true).'</td>';
|
$descriptionColumn = ui_print_truncate_text(
|
||||||
|
$agent['comentarios'],
|
||||||
|
'description',
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
'[…]'
|
||||||
|
);
|
||||||
|
|
||||||
// Description.
|
$agentActionButtons = [];
|
||||||
echo "<td class='".$tdcolor."f9'><span class='".$custom_font_size."'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[…]').'</span></td>';
|
|
||||||
|
|
||||||
// Action
|
if ((bool) $agent['disabled'] === true) {
|
||||||
// When there is only one element in page it's necesary go back page.
|
$agentDisableEnableTitle = __('Enable agent');
|
||||||
if ((count($agents) == 1) && ($offset >= $config['block_size'])) {
|
$agentDisableEnableAction = 'enable_agent';
|
||||||
$offsetArg = ($offset - $config['block_size']);
|
$agentDisableEnableCaption = __('You are going to enable a cluster agent. Are you sure?');
|
||||||
|
$agentDisableEnableIcon = 'change-pause.svg';
|
||||||
} else {
|
} else {
|
||||||
$offsetArg = $offset;
|
$agentDisableEnableTitle = __('Disable agent');
|
||||||
|
$agentDisableEnableAction = 'disable_agent';
|
||||||
|
$agentDisableEnableCaption = __('You are going to disable a cluster agent. Are you sure?');
|
||||||
|
$agentDisableEnableIcon = 'change-active.svg';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<td class='$tdcolor action_buttons' align='left' width=7% valign='middle'>";
|
$agentActionButtons[] = html_print_menu_button(
|
||||||
|
[
|
||||||
|
'href' => ui_get_full_url(
|
||||||
|
sprintf(
|
||||||
|
'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&%s_agent=%s&group_id=%s&recursion=%s&search=%s&offset=%s&sort_field=%s&sort=%s&disabled=%s',
|
||||||
|
$agentDisableEnableAction,
|
||||||
|
$agent['id_agente'],
|
||||||
|
$ag_group,
|
||||||
|
$recursion,
|
||||||
|
$search,
|
||||||
|
'',
|
||||||
|
$sortField,
|
||||||
|
$sort,
|
||||||
|
$disabled
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'onClick' => ($agent['id_os'] === CLUSTER_OS_ID) ? sprintf('if (!confirm(\'%s\')) return false', $agentDisableEnableCaption) : 'return true;',
|
||||||
|
'image' => sprintf('images/%s', $agentDisableEnableIcon),
|
||||||
|
'title' => $agentDisableEnableTitle,
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
if ($agent['disabled']) {
|
if ($check_aw === true && is_management_allowed() === true) {
|
||||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
if ($agent['id_os'] !== CLUSTER_OS_ID) {
|
||||||
enable_agent=".$agent['id_agente']."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
|
$onClickActionDeleteAgent = 'if (!confirm(\' '.__('Are you sure?').'\')) return false;';
|
||||||
|
|
||||||
if ($agent['id_os'] != 100) {
|
|
||||||
echo '>';
|
|
||||||
} else {
|
} else {
|
||||||
echo ' onClick="if (!confirm(\' '.__('You are going to enable a cluster agent. Are you sure?').'\')) return false;">';
|
$onClickActionDeleteAgent = 'if (!confirm(\' '.__('WARNING! - You are going to delete a cluster agent. Are you sure?').'\')) return false;';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo html_print_image('images/lightbulb_off.png', true, ['alt' => __('Enable agent'), 'title' => __('Enable agent'), 'class' => 'filter_none']).'</a>';
|
$agentActionButtons[] = html_print_menu_button(
|
||||||
} else {
|
[
|
||||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
'href' => ui_get_full_url(
|
||||||
disable_agent=".$agent['id_agente']."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
|
sprintf(
|
||||||
if ($agent['id_os'] != 100) {
|
'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=%s&%s_agent=%s&group_id=%s&recursion=%s&search=%s&offset=%s&sort_field=%s&sort=%s&disabled=%s',
|
||||||
echo '>';
|
$agent['id_agente'],
|
||||||
} else {
|
$agentDisableEnableAction,
|
||||||
echo ' onClick="if (!confirm(\' '.__('You are going to disable a cluster agent. Are you sure?').'\')) return false;">';
|
$agent['id_agente'],
|
||||||
|
$ag_group,
|
||||||
|
$recursion,
|
||||||
|
$search,
|
||||||
|
'',
|
||||||
|
$sortField,
|
||||||
|
$sort,
|
||||||
|
$disabled
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'onClick' => $onClickActionDeleteAgent,
|
||||||
|
'image' => sprintf('images/delete.svg'),
|
||||||
|
'title' => __('Delete agent'),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo html_print_image('images/lightbulb.png', true, ['alt' => __('Disable agent'), 'title' => __('Disable agent'), 'class' => 'invert_filter']).'</a>';
|
// Action buttons column.
|
||||||
|
$actionButtonsColumn = implode('', $agentActionButtons);
|
||||||
|
// Defined class for action buttons.
|
||||||
|
$tableAgents->cellclass[$key][6] = 'table_action_buttons';
|
||||||
|
// Row data.
|
||||||
|
$tableAgents->data[$key][0] = $agentNameColumn;
|
||||||
|
$tableAgents->data[$key][0] .= $agentAvailableActionsColumn;
|
||||||
|
$tableAgents->data[$key][1] = $remoteConfigurationColumn;
|
||||||
|
$tableAgents->data[$key][2] = $osIconColumn;
|
||||||
|
$tableAgents->data[$key][3] = $agentTypeIconColumn;
|
||||||
|
$tableAgents->data[$key][4] = $agentGroupIconColumn;
|
||||||
|
$tableAgents->data[$key][5] = $descriptionColumn;
|
||||||
|
$tableAgents->data[$key][6] = $actionButtonsColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($check_aw && is_management_allowed() === true) {
|
html_print_table($tableAgents);
|
||||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
|
||||||
borrar_agente=".$agent['id_agente']."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
|
|
||||||
|
|
||||||
if ($agent['id_os'] != 100) {
|
$tablePagination = ui_pagination(
|
||||||
echo ' onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
$total_agents,
|
||||||
} else {
|
ui_get_url_refresh(
|
||||||
echo ' onClick="if (!confirm(\' '.__('WARNING! - You are going to delete a cluster agent. Are you sure?').'\')) return false;">';
|
[
|
||||||
}
|
'group_id' => $group_id,
|
||||||
|
'search' => $search,
|
||||||
|
'sort_field' => $sortField,
|
||||||
|
'sort' => $sort,
|
||||||
|
'status' => $status,
|
||||||
|
]
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
'offset',
|
||||||
|
false,
|
||||||
|
'dataTables_paginate paging_simple_numbers'
|
||||||
|
);
|
||||||
|
|
||||||
echo html_print_image('images/cross.png', true, ['border' => '0', 'class' => 'invert_filter']).'</a>';
|
/*
|
||||||
}
|
ui_pagination(
|
||||||
|
$total_agents,
|
||||||
echo '</td>';
|
"index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os",
|
||||||
}
|
$offset
|
||||||
|
);
|
||||||
echo '</table>';
|
*/
|
||||||
ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
|
|
||||||
echo "<table width='100%'><tr><td align='right'>";
|
|
||||||
} else {
|
} else {
|
||||||
|
$tablePagination = '';
|
||||||
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]);
|
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||||
// Create agent button.
|
// Create agent button.
|
||||||
echo '<div class="action-buttons">';
|
|
||||||
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||||
|
|
||||||
|
html_print_action_buttons(
|
||||||
html_print_submit_button(
|
html_print_submit_button(
|
||||||
__('Create agent'),
|
__('Create agent'),
|
||||||
'crt-2',
|
'crt-2',
|
||||||
false,
|
false,
|
||||||
'class="sub next"'
|
[ 'icon' => 'next' ],
|
||||||
|
true
|
||||||
|
),
|
||||||
|
[
|
||||||
|
'type' => 'data_table',
|
||||||
|
'class' => 'fixed_action_buttons',
|
||||||
|
'right_content' => $tablePagination,
|
||||||
|
]
|
||||||
);
|
);
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
echo '</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</td></tr></table>';
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -396,9 +396,9 @@ if ($id_agent_module) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isset($moduletype) === false) {
|
if (isset($moduletype) === false || $moduletype === 0) {
|
||||||
$moduletype = (string) get_parameter('moduletype');
|
$moduletype = (string) get_parameter('moduletype');
|
||||||
if ($_SESSION['create_module'] && $config['welcome_state'] == 1) {
|
if ((bool) $_SESSION['create_module'] === true && (bool) $config['welcome_state'] === true) {
|
||||||
$moduletype = 'networkserver';
|
$moduletype = 'networkserver';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -581,11 +581,11 @@ if ($__code_from !== 'policies') {
|
|||||||
$tag_acl = true;
|
$tag_acl = true;
|
||||||
|
|
||||||
// If edit a existing module.
|
// If edit a existing module.
|
||||||
if (!empty($id_agent_module)) {
|
if (empty($id_agent_module) === false) {
|
||||||
$tag_acl = tags_check_acl_by_module($id_agent_module);
|
$tag_acl = tags_check_acl_by_module($id_agent_module);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$tag_acl) {
|
if ($tag_acl !== true) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
AUDIT_LOG_ACL_VIOLATION,
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access agent manager'
|
'Trying to access agent manager'
|
||||||
@ -595,16 +595,15 @@ if ($__code_from !== 'policies') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch ($moduletype) {
|
switch ($moduletype) {
|
||||||
case 'dataserver':
|
case 'dataserver':
|
||||||
case MODULE_DATA:
|
case MODULE_DATA:
|
||||||
$moduletype = MODULE_DATA;
|
$moduletype = MODULE_DATA;
|
||||||
// Has remote configuration ?
|
// Has remote configuration ?
|
||||||
$remote_conf = false;
|
$remote_conf = false;
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed() === true) {
|
||||||
enterprise_include_once('include/functions_config_agents.php');
|
enterprise_include_once('include/functions_config_agents.php');
|
||||||
$remote_conf = enterprise_hook(
|
$remote_conf = (bool) enterprise_hook(
|
||||||
'config_agents_has_remote_configuration',
|
'config_agents_has_remote_configuration',
|
||||||
[$id_agente]
|
[$id_agente]
|
||||||
);
|
);
|
||||||
@ -621,7 +620,7 @@ switch ($moduletype) {
|
|||||||
];
|
];
|
||||||
include 'module_manager_editor_common.php';
|
include 'module_manager_editor_common.php';
|
||||||
include 'module_manager_editor_data.php';
|
include 'module_manager_editor_data.php';
|
||||||
if ($config['enterprise_installed'] && $remote_conf) {
|
if ((bool) $config['enterprise_installed'] === true && $remote_conf === true) {
|
||||||
if ($id_agent_module) {
|
if ($id_agent_module) {
|
||||||
enterprise_include_once('include/functions_config_agents.php');
|
enterprise_include_once('include/functions_config_agents.php');
|
||||||
$configuration_data = enterprise_hook(
|
$configuration_data = enterprise_hook(
|
||||||
@ -649,7 +648,7 @@ switch ($moduletype) {
|
|||||||
4,
|
4,
|
||||||
5,
|
5,
|
||||||
];
|
];
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed() === true) {
|
||||||
$categories[] = 10;
|
$categories[] = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,7 +699,7 @@ switch ($moduletype) {
|
|||||||
$moduletype = MODULE_WEB;
|
$moduletype = MODULE_WEB;
|
||||||
// Remove content of $ip_target when it is ip_agent because
|
// Remove content of $ip_target when it is ip_agent because
|
||||||
// it is used as HTTP auth (server) ....ONLY IN NEW MODULE!!!
|
// it is used as HTTP auth (server) ....ONLY IN NEW MODULE!!!
|
||||||
if (empty($id_agent_module)
|
if (empty($id_agent_module) === true
|
||||||
&& ($ip_target === agents_get_address($id_agente))
|
&& ($ip_target === agents_get_address($id_agente))
|
||||||
) {
|
) {
|
||||||
$ip_target = '';
|
$ip_target = '';
|
||||||
@ -724,8 +723,8 @@ switch ($moduletype) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($config['enterprise_installed'] && $id_agent_module) {
|
if ((bool) $config['enterprise_installed'] === true && $id_agent_module) {
|
||||||
if (policies_is_module_in_policy($id_agent_module)) {
|
if (policies_is_module_in_policy($id_agent_module) === true) {
|
||||||
policies_add_policy_linkation($id_agent_module);
|
policies_add_policy_linkation($id_agent_module);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -733,27 +732,45 @@ if ($config['enterprise_installed'] && $id_agent_module) {
|
|||||||
echo '<h3 id="message" class="error invisible"></h3>';
|
echo '<h3 id="message" class="error invisible"></h3>';
|
||||||
|
|
||||||
// TODO: Change to the ui_print_error system.
|
// TODO: Change to the ui_print_error system.
|
||||||
echo '<form method="post" id="module_form">';
|
$outputForm = '<form method="post" id="module_form">';
|
||||||
|
$outputForm .= ui_toggle(
|
||||||
ui_toggle(
|
|
||||||
html_print_table($table_simple, true),
|
html_print_table($table_simple, true),
|
||||||
__('Base options'),
|
'<span class="subsection_header_title">'.__('Base options').'</span>',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
false
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'box-flat white_table_flex white_table_graph_fixed'
|
||||||
);
|
);
|
||||||
|
|
||||||
ui_toggle(
|
$outputForm .= ui_toggle(
|
||||||
html_print_table($table_advanced, true),
|
html_print_table($table_advanced, true),
|
||||||
__('Advanced options')
|
'<span class="subsection_header_title">'.__('Advanced options').'</span>',
|
||||||
);
|
'',
|
||||||
ui_toggle(
|
'',
|
||||||
html_print_table($table_macros, true),
|
true,
|
||||||
__('Custom macros')
|
true,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'box-flat white_table_flex white_table_graph_fixed'
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($moduletype != 13) {
|
$outputForm .= ui_toggle(
|
||||||
ui_toggle(
|
html_print_table($table_macros, true),
|
||||||
|
'<span class="subsection_header_title">'.__('Custom macros').'</span>',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'box-flat white_table_flex white_table_graph_fixed'
|
||||||
|
);
|
||||||
|
|
||||||
|
if ((int) $moduletype !== 13) {
|
||||||
|
$outputForm .= ui_toggle(
|
||||||
html_print_table(
|
html_print_table(
|
||||||
$table_new_relations,
|
$table_new_relations,
|
||||||
true
|
true
|
||||||
@ -761,51 +778,78 @@ if ($moduletype != 13) {
|
|||||||
$table_relations,
|
$table_relations,
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
__('Module relations')
|
'<span class="subsection_header_title">'.__('Module relations').'<span>',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'box-flat white_table_flex white_table_graph_fixed'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submit.
|
// Submit.
|
||||||
echo '<div class="action-buttons" style="width: '.$table_simple->width.'">';
|
|
||||||
if ($id_agent_module) {
|
if ($id_agent_module) {
|
||||||
html_print_submit_button(
|
$actionButtons = html_print_submit_button(
|
||||||
__('Update'),
|
__('Update'),
|
||||||
'updbutton',
|
'updbutton',
|
||||||
false,
|
false,
|
||||||
'class="sub upd"'
|
[ 'icon' => 'update' ],
|
||||||
|
true
|
||||||
);
|
);
|
||||||
html_print_input_hidden('update_module', 1);
|
$actionButtons .= html_print_button(
|
||||||
html_print_input_hidden('id_agent_module', $id_agent_module);
|
__('Delete'),
|
||||||
html_print_input_hidden('id_module_type', $id_module_type);
|
'deleteModule',
|
||||||
|
false,
|
||||||
if ($config['enterprise_installed'] && $remote_conf) {
|
'window.location.assign("index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$id_agent_module.'")',
|
||||||
?>
|
[
|
||||||
<script type="text/javascript">
|
'icon' => 'delete',
|
||||||
var check_remote_conf = true;
|
'mode' => 'secondary',
|
||||||
</script>
|
],
|
||||||
<?php
|
true
|
||||||
}
|
);
|
||||||
|
$actionButtons .= html_print_input_hidden('update_module', 1, true);
|
||||||
|
$actionButtons .= html_print_input_hidden('id_agent_module', $id_agent_module, true);
|
||||||
|
$actionButtons .= html_print_input_hidden('id_module_type', $id_module_type, true);
|
||||||
} else {
|
} else {
|
||||||
html_print_submit_button(
|
$actionButtons = html_print_submit_button(
|
||||||
__('Create'),
|
__('Create'),
|
||||||
'crtbutton',
|
'crtbutton',
|
||||||
false,
|
false,
|
||||||
'class="sub wand"'
|
[ 'icon' => 'wand' ],
|
||||||
|
true
|
||||||
);
|
);
|
||||||
html_print_input_hidden('id_module', $moduletype);
|
|
||||||
html_print_input_hidden('create_module', 1);
|
|
||||||
|
|
||||||
if ($config['enterprise_installed'] && $remote_conf) {
|
$actionButtons .= html_print_input_hidden('id_module', $moduletype, true);
|
||||||
?>
|
$actionButtons .= html_print_input_hidden('create_module', 1, true);
|
||||||
<script type="text/javascript">
|
|
||||||
var check_remote_conf = true;
|
|
||||||
</script>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</div>';
|
$actionButtons .= html_print_go_back_button(
|
||||||
echo '</form>';
|
'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente,
|
||||||
|
['button_class' => ''],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$outputForm .= html_print_action_buttons(
|
||||||
|
$actionButtons,
|
||||||
|
['type' => 'form_action'],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
if ((bool) $config['enterprise_installed'] === true && $remote_conf === true) {
|
||||||
|
$outputForm .= '<script type="text/javascript">var check_remote_conf = true;</script>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$outputForm .= '</form>';
|
||||||
|
|
||||||
|
html_print_div(
|
||||||
|
[
|
||||||
|
'class' => 'max_floating_element_size',
|
||||||
|
'content' => $outputForm,
|
||||||
|
],
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
ui_require_jquery_file('ui');
|
ui_require_jquery_file('ui');
|
||||||
ui_require_jquery_file('form');
|
ui_require_jquery_file('form');
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Extension to manage a list of gateways and the node address where they should
|
* Network module manager editor.
|
||||||
* point to.
|
|
||||||
*
|
*
|
||||||
* @category Extensions
|
* @category Modules
|
||||||
* @package Pandora FMS
|
* @package Pandora FMS
|
||||||
* @subpackage Community
|
* @subpackage Community
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
@ -15,7 +14,7 @@
|
|||||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
*
|
*
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
|
||||||
* Please see http://pandorafms.org for full contribution list
|
* Please see http://pandorafms.org for full contribution list
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -28,10 +27,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
require_once $config['homedir'].'/include/class/CredentialStore.class.php';
|
||||||
require_once $config['homedir'].'/include/functions_snmp_browser.php';
|
require_once $config['homedir'].'/include/functions_snmp_browser.php';
|
||||||
$snmp_browser_path = (is_metaconsole()) ? '../../' : '';
|
$snmp_browser_path = (is_metaconsole() === true) ? '../../' : '';
|
||||||
$snmp_browser_path .= 'include/javascript/pandora_snmp_browser.js';
|
$snmp_browser_path .= 'include/javascript/pandora_snmp_browser.js';
|
||||||
|
$array_credential_identifier = CredentialStore::getKeys('CUSTOM');
|
||||||
|
|
||||||
echo "<script type='text/javascript' src='".$snmp_browser_path."'></script>";
|
echo "<script type='text/javascript' src='".$snmp_browser_path."'></script>";
|
||||||
|
|
||||||
// Define a custom action to save the OID selected
|
// Define a custom action to save the OID selected
|
||||||
@ -63,13 +64,13 @@ if (strstr($page, 'policy_modules') === false) {
|
|||||||
if ($disabledBecauseInPolicy) {
|
if ($disabledBecauseInPolicy) {
|
||||||
$disabledTextBecauseInPolicy = 'readonly = "yes"';
|
$disabledTextBecauseInPolicy = 'readonly = "yes"';
|
||||||
$classdisabledBecauseInPolicy = 'readonly';
|
$classdisabledBecauseInPolicy = 'readonly';
|
||||||
$largeclassdisabledBecauseInPolicy = 'class = readonly';
|
$largeclassdisabledBecauseInPolicy = 'readonly';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define('ID_NETWORK_COMPONENT_TYPE', 2);
|
define('ID_NETWORK_COMPONENT_TYPE', 2);
|
||||||
|
|
||||||
if (empty($edit_module)) {
|
if (empty($edit_module) === true) {
|
||||||
// Function in module_manager_editor_common.php.
|
// Function in module_manager_editor_common.php.
|
||||||
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
|
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
|
||||||
}
|
}
|
||||||
@ -78,12 +79,20 @@ $extra_title = __('Network server module');
|
|||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('Target IP');
|
$data[0] = __('Target IP');
|
||||||
|
if ((int) $id_module_type !== 6 && $id_module_type !== 7) {
|
||||||
|
$data[1] = __('Port');
|
||||||
|
}
|
||||||
|
|
||||||
|
$table_simple->rowclass['caption_target_ip'] = 'w50p';
|
||||||
|
push_table_simple($data, 'caption_target_ip');
|
||||||
|
|
||||||
|
$data = [];
|
||||||
// Show agent_for defect.
|
// Show agent_for defect.
|
||||||
if ($page == 'enterprise/godmode/policies/policy_modules') {
|
if ($page === 'enterprise/godmode/policies/policy_modules') {
|
||||||
if ($ip_target != 'auto' && $ip_target != '') {
|
if (empty($ip_target) === false && $ip_target !== 'auto') {
|
||||||
$custom_ip_target = $ip_target;
|
$custom_ip_target = $ip_target;
|
||||||
$ip_target = 'custom';
|
$ip_target = 'custom';
|
||||||
} else if ($ip_target == '') {
|
} else if (empty($ip_target) === true) {
|
||||||
$ip_target = 'force_pri';
|
$ip_target = 'force_pri';
|
||||||
$custom_ip_target = '';
|
$custom_ip_target = '';
|
||||||
} else {
|
} else {
|
||||||
@ -95,7 +104,7 @@ if ($page == 'enterprise/godmode/policies/policy_modules') {
|
|||||||
$target_ip_values['force_pri'] = __('Force primary key');
|
$target_ip_values['force_pri'] = __('Force primary key');
|
||||||
$target_ip_values['custom'] = __('Custom');
|
$target_ip_values['custom'] = __('Custom');
|
||||||
|
|
||||||
$data[1] = html_print_select(
|
$data[0] = html_print_select(
|
||||||
$target_ip_values,
|
$target_ip_values,
|
||||||
'ip_target',
|
'ip_target',
|
||||||
$ip_target,
|
$ip_target,
|
||||||
@ -105,39 +114,38 @@ if ($page == 'enterprise/godmode/policies/policy_modules') {
|
|||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
'',
|
'w100p',
|
||||||
false,
|
false,
|
||||||
'width:200px;'
|
|
||||||
);
|
);
|
||||||
$data[1] .= html_print_input_text('custom_ip_target', $custom_ip_target, '', 15, 60, true);
|
$data[0] .= html_print_input_text('custom_ip_target', $custom_ip_target, '', 0, 60, true, false, false, '', 'w100p');
|
||||||
} else {
|
} else {
|
||||||
if ($ip_target == 'auto') {
|
if ($ip_target === 'auto') {
|
||||||
$ip_target = agents_get_address($id_agente);
|
$ip_target = agents_get_address($id_agente);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
|
$data[0] = html_print_input_text('ip_target', $ip_target, '', 0, 60, true, false, false, '', 'w100p');
|
||||||
}
|
}
|
||||||
|
|
||||||
// In ICMP modules, port is not configurable.
|
// In ICMP modules, port is not configurable.
|
||||||
if ($id_module_type >= 6 && $id_module_type <= 7) {
|
if ($id_module_type !== 6 && $id_module_type !== 7) {
|
||||||
$data[2] = '';
|
$tcp_port = (empty($tcp_port) === false) ? $tcp_port : get_parameter('tcp_port');
|
||||||
$data[3] = '';
|
$data[1] = html_print_input_text(
|
||||||
} else {
|
|
||||||
$data[2] = __('Port');
|
|
||||||
$data[3] = html_print_input_text(
|
|
||||||
'tcp_port',
|
'tcp_port',
|
||||||
$tcp_port,
|
$tcp_port,
|
||||||
'',
|
'',
|
||||||
5,
|
0,
|
||||||
20,
|
20,
|
||||||
true,
|
true,
|
||||||
$disabledBecauseInPolicy,
|
$disabledBecauseInPolicy,
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
$classdisabledBecauseInPolicy
|
$classdisabledBecauseInPolicy.' w100p',
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
$data[1] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$table_simple->rowclass['target_ip'] = 'w50p';
|
||||||
push_table_simple($data, 'target_ip');
|
push_table_simple($data, 'target_ip');
|
||||||
|
|
||||||
$user_groups = users_get_groups(false, 'AR');
|
$user_groups = users_get_groups(false, 'AR');
|
||||||
@ -162,7 +170,10 @@ if (empty($credentials) === false) {
|
|||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('Credential store');
|
$data[0] = __('Credential store');
|
||||||
$data[1] = html_print_select(
|
push_table_simple($data, 'caption_snmp_credentials');
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$data[0] = html_print_select(
|
||||||
$fields,
|
$fields,
|
||||||
'credentials',
|
'credentials',
|
||||||
0,
|
0,
|
||||||
@ -178,55 +189,62 @@ if (empty($credentials) === false) {
|
|||||||
'',
|
'',
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
push_table_simple($data, 'snmp_credentials');
|
push_table_simple($data, 'snmp_credentials');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$data[0] = __('SNMP community');
|
||||||
|
$data[1] = __('SNMP version');
|
||||||
|
$data[2] = __('SNMP OID');
|
||||||
|
$data[2] .= ui_print_help_icon('snmpwalk', true);
|
||||||
|
$table_simple->cellclass['snmp_1'][0] = 'w25p';
|
||||||
|
$table_simple->cellclass['snmp_1'][1] = 'w25p';
|
||||||
|
$table_simple->cellclass['snmp_1'][2] = 'w50p';
|
||||||
|
push_table_simple($data, 'snmp_1');
|
||||||
|
|
||||||
|
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && isset($id_agent_module) === true) {
|
||||||
|
$adopt = policies_is_module_adopt($id_agent_module);
|
||||||
|
} else {
|
||||||
|
$adopt = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($adopt === false) {
|
||||||
|
$snmpCommunityInput = html_print_input_text(
|
||||||
|
'snmp_community',
|
||||||
|
$snmp_community,
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
60,
|
||||||
|
true,
|
||||||
|
$disabledBecauseInPolicy,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
$classdisabledBecauseInPolicy.' w100p'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$snmpCommunityInput = html_print_input_text(
|
||||||
|
'snmp_community',
|
||||||
|
$snmp_community,
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
60,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'w100p'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$snmp_versions['1'] = 'v. 1';
|
$snmp_versions['1'] = 'v. 1';
|
||||||
$snmp_versions['2'] = 'v. 2';
|
$snmp_versions['2'] = 'v. 2';
|
||||||
$snmp_versions['2c'] = 'v. 2c';
|
$snmp_versions['2c'] = 'v. 2c';
|
||||||
$snmp_versions['3'] = 'v. 3';
|
$snmp_versions['3'] = 'v. 3';
|
||||||
|
|
||||||
$data = [];
|
$snmpVersionsInput = html_print_select(
|
||||||
$data[0] = __('SNMP community');
|
|
||||||
$adopt = false;
|
|
||||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && isset($id_agent_module)) {
|
|
||||||
$adopt = policies_is_module_adopt($id_agent_module);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$adopt) {
|
|
||||||
$data[1] = html_print_input_text(
|
|
||||||
'snmp_community',
|
|
||||||
$snmp_community,
|
|
||||||
'',
|
|
||||||
15,
|
|
||||||
60,
|
|
||||||
true,
|
|
||||||
$disabledBecauseInPolicy,
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
$classdisabledBecauseInPolicy
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$data[1] = html_print_input_text(
|
|
||||||
'snmp_community',
|
|
||||||
$snmp_community,
|
|
||||||
'',
|
|
||||||
15,
|
|
||||||
60,
|
|
||||||
true,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[2] = _('SNMP version');
|
|
||||||
|
|
||||||
if ($id_module_type >= 15 && $id_module_type <= 18) {
|
|
||||||
$data[3] = html_print_select(
|
|
||||||
$snmp_versions,
|
$snmp_versions,
|
||||||
'snmp_version',
|
'snmp_version',
|
||||||
$snmp_version,
|
($id_module_type >= 15 && $id_module_type <= 18) ? $snmp_version : 0,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
@ -235,45 +253,29 @@ if ($id_module_type >= 15 && $id_module_type <= 18) {
|
|||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
$disabledBecauseInPolicy,
|
$disabledBecauseInPolicy,
|
||||||
false,
|
'width: 100%',
|
||||||
'',
|
'',
|
||||||
$classdisabledBecauseInPolicy
|
$classdisabledBecauseInPolicy.' w100p'
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
$data[3] = html_print_select(
|
|
||||||
$snmp_versions,
|
|
||||||
'snmp_version',
|
|
||||||
0,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
$disabledBecauseInPolicy,
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
$classdisabledBecauseInPolicy
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($disabledBecauseInPolicy) {
|
if ($disabledBecauseInPolicy === true) {
|
||||||
if ($id_module_type >= 15 && $id_module_type <= 18) {
|
if ($id_module_type >= 15 && $id_module_type <= 18) {
|
||||||
$data[3] .= html_print_input_hidden('snmp_version', $tcp_send, true);
|
$snmpVersionsInput .= html_print_input_hidden('snmp_version', $tcp_send, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
push_table_simple($data, 'snmp_1');
|
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('SNMP OID');
|
$table_simple->cellclass['snmp_2'][0] = 'w25p';
|
||||||
$data[1] = '<span class="left w50p">';
|
$table_simple->cellclass['snmp_2'][1] = 'w25p';
|
||||||
$data[1] .= html_print_input_text(
|
$table_simple->cellclass['snmp_2'][2] = 'w50p';
|
||||||
|
|
||||||
|
$data[0] = $snmpCommunityInput;
|
||||||
|
$data[1] = $snmpVersionsInput;
|
||||||
|
$data[2] = html_print_input_text(
|
||||||
'snmp_oid',
|
'snmp_oid',
|
||||||
$snmp_oid,
|
$snmp_oid,
|
||||||
'',
|
'',
|
||||||
30,
|
0,
|
||||||
255,
|
255,
|
||||||
true,
|
true,
|
||||||
$disabledBecauseInPolicy,
|
$disabledBecauseInPolicy,
|
||||||
@ -281,8 +283,8 @@ $data[1] .= html_print_input_text(
|
|||||||
'',
|
'',
|
||||||
$classdisabledBecauseInPolicy
|
$classdisabledBecauseInPolicy
|
||||||
);
|
);
|
||||||
$data[1] .= '<span class="invisible" id="oid">';
|
$data[2] .= '<span class="invisible" id="oid">';
|
||||||
$data[1] .= html_print_select(
|
$data[2] .= html_print_select(
|
||||||
[],
|
[],
|
||||||
'select_snmp_oid',
|
'select_snmp_oid',
|
||||||
$snmp_oid,
|
$snmp_oid,
|
||||||
@ -295,7 +297,7 @@ $data[1] .= html_print_select(
|
|||||||
'',
|
'',
|
||||||
$disabledBecauseInPolicy
|
$disabledBecauseInPolicy
|
||||||
);
|
);
|
||||||
$data[1] .= html_print_image(
|
$data[2] .= html_print_image(
|
||||||
'images/edit.png',
|
'images/edit.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
@ -303,26 +305,27 @@ $data[1] .= html_print_image(
|
|||||||
'id' => 'edit_oid',
|
'id' => 'edit_oid',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$data[1] .= '</span>';
|
$data[2] .= '</span>';
|
||||||
$data[1] .= '</span><span class="right w50p right">';
|
$data[2] .= html_print_button(
|
||||||
$data[1] .= html_print_button(
|
__('SNMP Walk'),
|
||||||
__('SNMP walk'),
|
|
||||||
'snmp_walk',
|
'snmp_walk',
|
||||||
false,
|
false,
|
||||||
'snmpBrowserWindow()',
|
'snmpBrowserWindow()',
|
||||||
'class="sub next"',
|
[ 'mode' => 'link' ],
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
$data[1] .= ui_print_help_icon('snmpwalk', true);
|
|
||||||
$data[1] .= '</span>';
|
|
||||||
$table_simple->colspan['snmp_2'][1] = 3;
|
|
||||||
|
|
||||||
push_table_simple($data, 'snmp_2');
|
push_table_simple($data, 'snmp_2');
|
||||||
|
|
||||||
// Advanced stuff.
|
// Advanced stuff.
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('TCP send');
|
$data[0] = __('TCP send');
|
||||||
$data[1] = html_print_textarea(
|
$data[1] = __('TCP receive');
|
||||||
|
|
||||||
|
push_table_simple($data, 'caption_tcp_send_receive');
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$data[0] = html_print_textarea(
|
||||||
'tcp_send',
|
'tcp_send',
|
||||||
2,
|
2,
|
||||||
65,
|
65,
|
||||||
@ -331,11 +334,6 @@ $data[1] = html_print_textarea(
|
|||||||
true,
|
true,
|
||||||
$largeclassdisabledBecauseInPolicy
|
$largeclassdisabledBecauseInPolicy
|
||||||
);
|
);
|
||||||
$table_simple->colspan['tcp_send'][1] = 3;
|
|
||||||
|
|
||||||
push_table_simple($data, 'tcp_send');
|
|
||||||
|
|
||||||
$data[0] = __('TCP receive');
|
|
||||||
$data[1] = html_print_textarea(
|
$data[1] = html_print_textarea(
|
||||||
'tcp_rcv',
|
'tcp_rcv',
|
||||||
2,
|
2,
|
||||||
@ -345,9 +343,8 @@ $data[1] = html_print_textarea(
|
|||||||
true,
|
true,
|
||||||
$largeclassdisabledBecauseInPolicy
|
$largeclassdisabledBecauseInPolicy
|
||||||
);
|
);
|
||||||
$table_simple->colspan['tcp_receive'][1] = 3;
|
|
||||||
|
|
||||||
push_table_simple($data, 'tcp_receive');
|
push_table_simple($data, 'tcp_send_receive');
|
||||||
|
|
||||||
if ($id_module_type < 8 || $id_module_type > 11) {
|
if ($id_module_type < 8 || $id_module_type > 11) {
|
||||||
// NOT TCP.
|
// NOT TCP.
|
||||||
@ -393,7 +390,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[2] = __('Auth password').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||||
$data[3] = html_print_input_password(
|
$data[3] = html_print_input_password(
|
||||||
'snmp3_auth_pass',
|
'snmp3_auth_pass',
|
||||||
$snmp3_auth_pass,
|
'',
|
||||||
'',
|
'',
|
||||||
15,
|
15,
|
||||||
60,
|
60,
|
||||||
@ -415,7 +412,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[2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||||
$data[3] = html_print_input_password(
|
$data[3] = html_print_input_password(
|
||||||
'snmp3_privacy_pass',
|
'snmp3_privacy_pass',
|
||||||
$snmp3_privacy_pass,
|
'',
|
||||||
'',
|
'',
|
||||||
15,
|
15,
|
||||||
60,
|
60,
|
||||||
@ -475,33 +472,41 @@ push_table_simple($data, 'field_snmpv3_row3');
|
|||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('Command');
|
$data[0] = __('Command');
|
||||||
$data[1] = html_print_input_text_extended(
|
$data[0] .= ui_print_help_tip(
|
||||||
'command_text',
|
|
||||||
$command_text,
|
|
||||||
'command_text',
|
|
||||||
'',
|
|
||||||
100,
|
|
||||||
10000,
|
|
||||||
$disabledBecauseInPolicy,
|
|
||||||
'',
|
|
||||||
$largeClassDisabledBecauseInPolicy,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
$data[1] .= ui_print_help_tip(
|
|
||||||
__(
|
__(
|
||||||
'Please use single quotation marks when necessary. '."\n".'
|
'Please use single quotation marks when necessary. '."\n".'
|
||||||
If double quotation marks are needed, please escape them with a backslash (\")'
|
If double quotation marks are needed, please escape them with a backslash (\")'
|
||||||
),
|
),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
$table_simple->colspan['row-cmd-row-1'][1] = 3;
|
push_table_simple($data, 'caption-row-cmd-row-1');
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$data[0] = html_print_input_text_extended(
|
||||||
|
'command_text',
|
||||||
|
$command_text,
|
||||||
|
'command_text',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
10000,
|
||||||
|
$disabledBecauseInPolicy,
|
||||||
|
'',
|
||||||
|
$largeClassDisabledBecauseInPolicy.' class="w100p"',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table_simple->rowclass['row-cmd-row-1'] = 'w100p';
|
||||||
push_table_simple($data, 'row-cmd-row-1');
|
push_table_simple($data, 'row-cmd-row-1');
|
||||||
|
|
||||||
require_once $config['homedir'].'/include/class/CredentialStore.class.php';
|
$data = [];
|
||||||
$array_credential_identifier = CredentialStore::getKeys('CUSTOM');
|
|
||||||
|
|
||||||
$data[0] = __('Credential identifier');
|
$data[0] = __('Credential identifier');
|
||||||
$data[1] = html_print_select(
|
$data[1] = __('Connection method');
|
||||||
|
// $table_simple->rowclass['row-cmd-row-1'] = 'w100p';
|
||||||
|
$table_simple->cellclass['caption-row-cmd-row-2'][0] = 'w50p';
|
||||||
|
$table_simple->cellclass['caption-row-cmd-row-2'][1] = 'w50p';
|
||||||
|
push_table_simple($data, 'caption-row-cmd-row-2');
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$data[0] = html_print_select(
|
||||||
$array_credential_identifier,
|
$array_credential_identifier,
|
||||||
'command_credential_identifier',
|
'command_credential_identifier',
|
||||||
$command_credential_identifier,
|
$command_credential_identifier,
|
||||||
@ -512,10 +517,18 @@ $data[1] = html_print_select(
|
|||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
$disabledBecauseInPolicy
|
$disabledBecauseInPolicy,
|
||||||
|
'width: 100%;'
|
||||||
);
|
);
|
||||||
|
|
||||||
$data[1] .= '<br> <br><a class="info_cell" href="'.ui_get_full_url('index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox').'">'.__('Manage credentials').'</a>';
|
$data[0] .= html_print_button(
|
||||||
|
__('Manage credentials'),
|
||||||
|
'manage_credentials_button',
|
||||||
|
false,
|
||||||
|
'window.location.assign("index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox")',
|
||||||
|
[ 'mode' => 'link' ],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$array_os = [
|
$array_os = [
|
||||||
'inherited' => __('Inherited'),
|
'inherited' => __('Inherited'),
|
||||||
@ -523,8 +536,7 @@ $array_os = [
|
|||||||
'windows' => __('Windows remote'),
|
'windows' => __('Windows remote'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$data[2] = __('Connection method');
|
$data[1] = html_print_select(
|
||||||
$data[3] = html_print_select(
|
|
||||||
$array_os,
|
$array_os,
|
||||||
'command_os',
|
'command_os',
|
||||||
$command_os,
|
$command_os,
|
||||||
@ -535,9 +547,11 @@ $data[3] = html_print_select(
|
|||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
$disabledBecauseInPolicy
|
$disabledBecauseInPolicy,
|
||||||
|
'width: 100%;'
|
||||||
);
|
);
|
||||||
|
$table_simple->cellclass['row-cmd-row-2'][0] = 'w50p';
|
||||||
|
$table_simple->cellclass['row-cmd-row-2'][1] = 'w50p';
|
||||||
push_table_simple($data, 'row-cmd-row-2');
|
push_table_simple($data, 'row-cmd-row-2');
|
||||||
|
|
||||||
if ($id_module_type !== 34
|
if ($id_module_type !== 34
|
||||||
@ -545,7 +559,9 @@ if ($id_module_type !== 34
|
|||||||
&& $id_module_type !== 36
|
&& $id_module_type !== 36
|
||||||
&& $id_module_type !== 37
|
&& $id_module_type !== 37
|
||||||
) {
|
) {
|
||||||
|
$table_simple->rowstyle['caption-row-cmd-row-1'] = 'display: none;';
|
||||||
$table_simple->rowstyle['row-cmd-row-1'] = 'display: none;';
|
$table_simple->rowstyle['row-cmd-row-1'] = 'display: none;';
|
||||||
|
$table_simple->rowstyle['caption-row-cmd-row-2'] = 'display: none;';
|
||||||
$table_simple->rowstyle['row-cmd-row-2'] = 'display: none;';
|
$table_simple->rowstyle['row-cmd-row-2'] = 'display: none;';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -581,9 +597,13 @@ $(document).ready (function () {
|
|||||||
(this.value == "37")
|
(this.value == "37")
|
||||||
) {
|
) {
|
||||||
$("#simple-row-cmd-row-1").attr("style", "");
|
$("#simple-row-cmd-row-1").attr("style", "");
|
||||||
|
$("#simple-caption-row-cmd-row-1").attr("style", "");
|
||||||
$("#simple-row-cmd-row-2").attr("style", "");
|
$("#simple-row-cmd-row-2").attr("style", "");
|
||||||
|
$("#simple-caption-row-cmd-row-2").attr("style", "");
|
||||||
} else {
|
} else {
|
||||||
|
$("#simple-caption-row-cmd-row-1").css("display", "none");
|
||||||
$("#simple-row-cmd-row-1").css("display", "none");
|
$("#simple-row-cmd-row-1").css("display", "none");
|
||||||
|
$("#simple-caption-row-cmd-row-2").css("display", "none");
|
||||||
$("#simple-row-cmd-row-2").css("display", "none");
|
$("#simple-row-cmd-row-2").css("display", "none");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -704,13 +724,19 @@ $(document).ready (function () {
|
|||||||
$("#text-custom_ip_target").hide();
|
$("#text-custom_ip_target").hide();
|
||||||
}
|
}
|
||||||
$('#ip_target').change(function() {
|
$('#ip_target').change(function() {
|
||||||
if($(this).val() == 'custom') {
|
if($(this).val() === 'custom') {
|
||||||
$("#text-custom_ip_target").show();
|
$("#text-custom_ip_target").show();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$("#text-custom_ip_target").hide();
|
$("#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,10 +85,11 @@ $table_simple->rowstyle['macro_field'] = 'display:none';
|
|||||||
|
|
||||||
push_table_simple($data, 'macro_field');
|
push_table_simple($data, 'macro_field');
|
||||||
|
|
||||||
|
$password_fields = [];
|
||||||
|
|
||||||
// If there are $macros, we create the form fields
|
// If there are $macros, we create the form fields
|
||||||
if (!empty($macros)) {
|
if (!empty($macros)) {
|
||||||
$macros = json_decode($macros, true);
|
$macros = json_decode(io_safe_output($macros), true);
|
||||||
|
|
||||||
foreach ($macros as $k => $m) {
|
foreach ($macros as $k => $m) {
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = $m['desc'];
|
$data[0] = $m['desc'];
|
||||||
@ -102,7 +103,8 @@ if (!empty($macros)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($m_hide) {
|
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 {
|
} else {
|
||||||
$data[1] = html_print_input_text(
|
$data[1] = html_print_input_text(
|
||||||
$m['macro'],
|
$m['macro'],
|
||||||
@ -125,6 +127,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">
|
<script type="text/javascript">
|
||||||
function changePluginSelect() {
|
function changePluginSelect() {
|
||||||
@ -140,4 +153,8 @@ if (!empty($macros)) {
|
|||||||
|
|
||||||
forced_title_callback();
|
forced_title_callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
observerInputPassword();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,16 +1,31 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Prediction module manager editor.
|
||||||
|
*
|
||||||
|
* @category Modules
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation for version 2.
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
enterprise_include_once('include/functions_policies.php');
|
enterprise_include_once('include/functions_policies.php');
|
||||||
enterprise_include_once('godmode/agentes/module_manager_editor_prediction.php');
|
enterprise_include_once('godmode/agentes/module_manager_editor_prediction.php');
|
||||||
require_once 'include/functions_agents.php';
|
require_once 'include/functions_agents.php';
|
||||||
@ -31,7 +46,7 @@ $is_service = false;
|
|||||||
$is_synthetic = false;
|
$is_synthetic = false;
|
||||||
$is_synthetic_avg = false;
|
$is_synthetic_avg = false;
|
||||||
$ops = false;
|
$ops = false;
|
||||||
if ($row !== false && is_array($row)) {
|
if ($row !== false && is_array($row) === true) {
|
||||||
$prediction_module = $row['prediction_module'];
|
$prediction_module = $row['prediction_module'];
|
||||||
$custom_integer_2 = $row['custom_integer_2'];
|
$custom_integer_2 = $row['custom_integer_2'];
|
||||||
// Services are an Enterprise feature.
|
// Services are an Enterprise feature.
|
||||||
@ -49,19 +64,14 @@ if ($row !== false && is_array($row)) {
|
|||||||
[$id_agente_modulo]
|
[$id_agente_modulo]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
$ops = json_decode($ops_json, true);
|
$ops = json_decode($ops_json, true);
|
||||||
|
|
||||||
|
// Erase the key of array serialize as <num>**.
|
||||||
|
|
||||||
// Erase the key of array serialize as <num>**
|
|
||||||
$chunks = explode('**', reset(array_keys($ops)));
|
$chunks = explode('**', reset(array_keys($ops)));
|
||||||
|
|
||||||
$first_op = explode('_', $chunks[1]);
|
$first_op = explode('_', $chunks[1]);
|
||||||
|
|
||||||
|
if (isset($first_op[1]) === true && $first_op[1] === 'avg') {
|
||||||
|
|
||||||
if (isset($first_op[1]) && $first_op[1] == 'avg') {
|
|
||||||
$selected = 'synthetic_avg_selected';
|
$selected = 'synthetic_avg_selected';
|
||||||
} else {
|
} else {
|
||||||
$selected = 'synthetic_selected';
|
$selected = 'synthetic_selected';
|
||||||
@ -109,23 +119,28 @@ $extra_title = __('Prediction server module');
|
|||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('Source module');
|
$data[0] = __('Source module');
|
||||||
$data[0] .= ui_print_help_icon('prediction_source_module', true);
|
$data[0] .= ui_print_help_icon('prediction_source_module', true);
|
||||||
$data[1] = '';
|
push_table_simple($data, 'caption_module_service_synthetic_selector');
|
||||||
// Services and Synthetic are an Enterprise feature.
|
// Services and Synthetic are an Enterprise feature.
|
||||||
$module_service_synthetic_selector = enterprise_hook('get_module_service_synthetic_selector', [$selected]);
|
$module_service_synthetic_selector = enterprise_hook('get_module_service_synthetic_selector', [$selected]);
|
||||||
if ($module_service_synthetic_selector !== ENTERPRISE_NOT_HOOK) {
|
if ($module_service_synthetic_selector !== ENTERPRISE_NOT_HOOK) {
|
||||||
$data[1] = $module_service_synthetic_selector;
|
$data = [];
|
||||||
|
$data[0] = $module_service_synthetic_selector;
|
||||||
|
|
||||||
$table_simple->colspan['module_service_synthetic_selector'][1] = 3;
|
$table_simple->colspan['module_service_synthetic_selector'][1] = 3;
|
||||||
push_table_simple($data, 'module_service_synthetic_selector');
|
push_table_simple($data, 'module_service_synthetic_selector');
|
||||||
|
|
||||||
$data = [];
|
|
||||||
$data[0] = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[1] = '<div id="module_data" class="w50p float-left top-1em">';
|
$data = [];
|
||||||
$data[1] .= html_print_label(__('Agent'), 'agent_name', true).'<br/>';
|
$data[0] = __('Agent');
|
||||||
|
$data[1] = __('Module');
|
||||||
|
$data[2] = __('Period');
|
||||||
|
$table_simple->cellclass['caption_prediction_module'][0] = 'w33p';
|
||||||
|
$table_simple->cellclass['caption_prediction_module'][1] = 'w33p';
|
||||||
|
$table_simple->cellclass['caption_prediction_module'][2] = 'w33p';
|
||||||
|
push_table_simple($data, 'caption_prediction_module');
|
||||||
|
|
||||||
// Get module and agent of the target prediction module
|
$data = [];
|
||||||
|
// Get module and agent of the target prediction module.
|
||||||
if (empty($prediction_module) === false) {
|
if (empty($prediction_module) === false) {
|
||||||
$id_agente_clean = modules_get_agentmodule_agent($prediction_module);
|
$id_agente_clean = modules_get_agentmodule_agent($prediction_module);
|
||||||
$prediction_module_agent = modules_get_agentmodule_agent_name($prediction_module);
|
$prediction_module_agent = modules_get_agentmodule_agent_name($prediction_module);
|
||||||
@ -137,7 +152,6 @@ if (empty($prediction_module) === false) {
|
|||||||
$agent_alias = '';
|
$agent_alias = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$params = [];
|
$params = [];
|
||||||
$params['return'] = true;
|
$params['return'] = true;
|
||||||
$params['show_helptip'] = true;
|
$params['show_helptip'] = true;
|
||||||
@ -147,106 +161,105 @@ $params['javascript_is_function_select'] = true;
|
|||||||
$params['selectbox_id'] = 'prediction_module';
|
$params['selectbox_id'] = 'prediction_module';
|
||||||
$params['none_module_text'] = __('Select Module');
|
$params['none_module_text'] = __('Select Module');
|
||||||
$params['use_hidden_input_idagent'] = true;
|
$params['use_hidden_input_idagent'] = true;
|
||||||
|
$params['input_style'] = 'width: 100%;';
|
||||||
$params['hidden_input_idagent_id'] = 'hidden-id_agente_module_prediction';
|
$params['hidden_input_idagent_id'] = 'hidden-id_agente_module_prediction';
|
||||||
$data[1] .= ui_print_agent_autocomplete_input($params);
|
$data[0] = ui_print_agent_autocomplete_input($params);
|
||||||
|
|
||||||
$data[1] .= '<br />';
|
if ($id_agente > 0) {
|
||||||
$data[1] .= html_print_label(__('Module'), 'prediction_module', true).'<br />';
|
$predictionModuleInput = html_print_select_from_sql(
|
||||||
if ($id_agente) {
|
'SELECT id_agente_modulo, nombre
|
||||||
$sql = 'SELECT id_agente_modulo, nombre
|
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
WHERE delete_pending = 0
|
WHERE delete_pending = 0
|
||||||
AND history_data = 1
|
AND history_data = 1
|
||||||
AND id_agente = '.$id_agente_clean.'
|
AND id_agente = '.$id_agente_clean.'
|
||||||
AND id_agente_modulo <> '.$id_agente_modulo;
|
AND id_agente_modulo <> '.$id_agente_modulo,
|
||||||
|
'prediction_module',
|
||||||
$data[1] .= html_print_input(
|
$prediction_module,
|
||||||
[
|
'',
|
||||||
'type' => 'select_from_sql',
|
__('Select Module'),
|
||||||
'sql' => $sql,
|
0,
|
||||||
'name' => 'prediction_module',
|
true,
|
||||||
'selected' => $prediction_module,
|
false,
|
||||||
'nothing' => __('Select Module'),
|
true,
|
||||||
'nothing_value' => 0,
|
false,
|
||||||
'return' => true,
|
'width: 100%;'
|
||||||
]
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$data[1] .= '<select id="prediction_module" name="custom_integer_1" disabled="disabled"><option value="0">Select an Agent first</option></select>';
|
$predictionModuleInput = '<select id="prediction_module" name="custom_integer_1" disabled="disabled"><option value="0">Select an Agent first</option></select>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[1] .= '<br />';
|
$data[1] = $predictionModuleInput;
|
||||||
$data[1] .= html_print_label(__('Period'), 'custom_integer_2', true).'<br/>';
|
$data[2] = html_print_select([__('Weekly'), __('Monthly'), __('Daily')], 'custom_integer_2', $custom_integer_2, '', '', 0, true, false, true, '', false, 'width: 100%;');
|
||||||
|
$data[2] .= html_print_input_hidden('id_agente_module_prediction', $id_agente, true);
|
||||||
$periods[0] = __('Weekly');
|
$table_simple->cellclass['prediction_module'][0] = 'w33p';
|
||||||
$periods[1] = __('Monthly');
|
$table_simple->cellclass['prediction_module'][1] = 'w33p';
|
||||||
$periods[2] = __('Daily');
|
$table_simple->cellclass['prediction_module'][2] = 'w33p';
|
||||||
$data[1] .= html_print_select($periods, 'custom_integer_2', $custom_integer_2, '', '', 0, true);
|
|
||||||
|
|
||||||
$data[1] .= html_print_input_hidden('id_agente_module_prediction', $id_agente, true);
|
|
||||||
$data[1] .= '</div>';
|
|
||||||
|
|
||||||
$table_simple->colspan['prediction_module'][1] = 3;
|
|
||||||
push_table_simple($data, 'prediction_module');
|
push_table_simple($data, 'prediction_module');
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = '';
|
$data[0] = __('Calculation type');
|
||||||
|
$data[1] = __('Future estimation');
|
||||||
|
$data[2] = __('Limit value');
|
||||||
|
$table_simple->cellclass['caption_capacity_planning'][0] = 'w33p';
|
||||||
|
$table_simple->cellclass['caption_capacity_planning'][1] = 'w33p';
|
||||||
|
$table_simple->cellclass['caption_capacity_planning'][2] = 'w33p';
|
||||||
|
push_table_simple($data, 'caption_capacity_planning');
|
||||||
|
|
||||||
$data[1] .= html_print_label(__('Calculation type'), 'estimation_type', true).'<br/>';
|
$data = [];
|
||||||
$data[1] .= html_print_input(
|
$data[0] = html_print_select(
|
||||||
[
|
[
|
||||||
'type' => 'select',
|
|
||||||
'return' => 'true',
|
|
||||||
'name' => 'estimation_type',
|
|
||||||
'class' => 'w250px',
|
|
||||||
'fields' => [
|
|
||||||
'estimation_absolute' => __('Estimated absolute value'),
|
'estimation_absolute' => __('Estimated absolute value'),
|
||||||
'estimation_calculation' => __('Calculation of days to reach limit'),
|
'estimation_calculation' => __('Calculation of days to reach limit'),
|
||||||
],
|
],
|
||||||
'selected' => $estimation_type,
|
'estimation_type',
|
||||||
],
|
$estimation_type,
|
||||||
'div',
|
'',
|
||||||
false
|
'',
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'width: 100%;'
|
||||||
);
|
);
|
||||||
|
|
||||||
$data[1] .= '<div id="estimation_interval_row">';
|
$data[1] = html_print_input(
|
||||||
$data[1] .= html_print_label(__('Future estimation'), 'estimation_interval', true).'<br/>';
|
|
||||||
$data[1] .= html_print_input(
|
|
||||||
[
|
[
|
||||||
'type' => 'interval',
|
'type' => 'interval',
|
||||||
'return' => 'true',
|
'return' => 'true',
|
||||||
'name' => 'estimation_interval',
|
'name' => 'estimation_interval',
|
||||||
'value' => $estimation_interval,
|
'value' => $estimation_interval,
|
||||||
|
'class' => 'w100p',
|
||||||
],
|
],
|
||||||
'div',
|
'div',
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
$data[1] .= '</div>';
|
|
||||||
|
|
||||||
|
$data[2] = html_print_input(
|
||||||
$data[1] .= '<div id="estimation_days_row">';
|
|
||||||
$data[1] .= html_print_label(__('Limit value'), 'estimation_days', true).'<br/>';
|
|
||||||
$data[1] .= html_print_input(
|
|
||||||
[
|
[
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'return' => 'true',
|
'return' => 'true',
|
||||||
'id' => 'estimation_days',
|
'id' => 'estimation_days',
|
||||||
'name' => 'estimation_days',
|
'name' => 'estimation_days',
|
||||||
'value' => $estimation_interval,
|
'value' => $estimation_interval,
|
||||||
|
'class' => 'w100p',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$data[1] .= '</div>';
|
$table_simple->cellclass['capacity_planning'][0] = 'w33p';
|
||||||
|
$table_simple->cellclass['capacity_planning'][1] = 'w33p';
|
||||||
|
$table_simple->cellclass['capacity_planning'][2] = 'w33p';
|
||||||
push_table_simple($data, 'capacity_planning');
|
push_table_simple($data, 'capacity_planning');
|
||||||
|
|
||||||
// Services are an Enterprise feature.
|
// Services are an Enterprise feature.
|
||||||
$selector_form = enterprise_hook('get_selector_form', [$custom_integer_1]);
|
$selector_form = enterprise_hook('get_selector_form', [$custom_integer_1]);
|
||||||
if ($selector_form !== ENTERPRISE_NOT_HOOK) {
|
if ($selector_form !== ENTERPRISE_NOT_HOOK) {
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = '';
|
$data[0] = $selector_form['caption'];
|
||||||
$data[1] = $selector_form;
|
push_table_simple($data, 'caption_service_module');
|
||||||
|
|
||||||
$table_simple->colspan['service_module'][1] = 3;
|
$data = [];
|
||||||
|
$data[0] = $selector_form['input'];
|
||||||
push_table_simple($data, 'service_module');
|
push_table_simple($data, 'service_module');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,38 +267,31 @@ if ($selector_form !== ENTERPRISE_NOT_HOOK) {
|
|||||||
$synthetic_module_form = enterprise_hook('get_synthetic_module_form');
|
$synthetic_module_form = enterprise_hook('get_synthetic_module_form');
|
||||||
if ($synthetic_module_form !== ENTERPRISE_NOT_HOOK) {
|
if ($synthetic_module_form !== ENTERPRISE_NOT_HOOK) {
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = '';
|
$data[0] = $synthetic_module_form;
|
||||||
$data[1] = $synthetic_module_form;
|
|
||||||
|
|
||||||
push_table_simple($data, 'synthetic_module');
|
push_table_simple($data, 'synthetic_module');
|
||||||
}
|
}
|
||||||
|
|
||||||
$trending_module_form = enterprise_hook('get_trending_module_form', [$custom_string_1]);
|
$trending_module_form = enterprise_hook('get_trending_module_form', [$custom_string_1]);
|
||||||
if ($trending_module_form !== ENTERPRISE_NOT_HOOK) {
|
if ($trending_module_form !== ENTERPRISE_NOT_HOOK) {
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = '';
|
$data[0] = $trending_module_form['caption'];
|
||||||
$data[1] .= $trending_module_form;
|
push_table_simple($data, 'caption_trending_module');
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$data[0] = $trending_module_form['input'];
|
||||||
push_table_simple($data, 'trending_module');
|
push_table_simple($data, 'trending_module');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Netflow modules are an Enterprise feature.
|
// Netflow modules are an Enterprise feature.
|
||||||
$netflow_module_form = enterprise_hook('get_netflow_module_form', [$custom_integer_1]);
|
$netflow_module_form = enterprise_hook('get_netflow_module_form', [$custom_integer_1]);
|
||||||
if ($netflow_module_form !== ENTERPRISE_NOT_HOOK) {
|
if ($netflow_module_form !== ENTERPRISE_NOT_HOOK) {
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = '';
|
$data[0] = '';
|
||||||
$data[1] = $netflow_module_form;
|
$data[1] = $netflow_module_form;
|
||||||
|
|
||||||
$table_simple->colspan['netflow_module_form'][1] = 3;
|
|
||||||
push_table_simple($data, 'netflow_module');
|
push_table_simple($data, 'netflow_module');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Removed common useless parameter.
|
||||||
|
|
||||||
|
|
||||||
// Removed common useless parameter
|
|
||||||
unset($table_advanced->data[3]);
|
unset($table_advanced->data[3]);
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Web Module Editor for Module Manager.
|
* Web module manager editor.
|
||||||
*
|
*
|
||||||
* @category Module manager
|
* @category Modules
|
||||||
* @package Pandora FMS
|
* @package Pandora FMS
|
||||||
* @subpackage Module manager
|
* @subpackage Community
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @license See below
|
* @license See below
|
||||||
*
|
*
|
||||||
@ -14,7 +14,7 @@
|
|||||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
*
|
*
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
|
||||||
* Please see http://pandorafms.org for full contribution list
|
* Please see http://pandorafms.org for full contribution list
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -33,8 +33,10 @@ $disabledBecauseInPolicy = false;
|
|||||||
$disabledTextBecauseInPolicy = '';
|
$disabledTextBecauseInPolicy = '';
|
||||||
$classdisabledBecauseInPolicy = '';
|
$classdisabledBecauseInPolicy = '';
|
||||||
$page = get_parameter('page', '');
|
$page = get_parameter('page', '');
|
||||||
|
$id_policy_module = (int) get_parameter('id_policy_module');
|
||||||
|
|
||||||
if (strstr($page, 'policy_modules') === false) {
|
if (strstr($page, 'policy_modules') === false) {
|
||||||
if ($config['enterprise_installed']) {
|
if ((bool) $config['enterprise_installed'] === true) {
|
||||||
if (policies_is_module_linked($id_agent_module) == 1) {
|
if (policies_is_module_linked($id_agent_module) == 1) {
|
||||||
$disabledBecauseInPolicy = 1;
|
$disabledBecauseInPolicy = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -44,7 +46,7 @@ if (strstr($page, 'policy_modules') === false) {
|
|||||||
$disabledBecauseInPolicy = false;
|
$disabledBecauseInPolicy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($disabledBecauseInPolicy) {
|
if ((bool) $disabledBecauseInPolicy === true) {
|
||||||
$disabledTextBecauseInPolicy = 'disabled = "disabled"';
|
$disabledTextBecauseInPolicy = 'disabled = "disabled"';
|
||||||
$classdisabledBecauseInPolicy = 'readonly';
|
$classdisabledBecauseInPolicy = 'readonly';
|
||||||
}
|
}
|
||||||
@ -62,45 +64,47 @@ html_print_div(
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (is_int($id_agent_module) && $id_agent_module !== 0) {
|
if (is_int($id_agent_module) === true && $id_agent_module !== 0) {
|
||||||
include_once $config['homedir'].'/include/ajax/web_server_module_debug.php';
|
include_once $config['homedir'].'/include/ajax/web_server_module_debug.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
define('ID_NETWORK_COMPONENT_TYPE', 7);
|
define('ID_NETWORK_COMPONENT_TYPE', 7);
|
||||||
|
|
||||||
if (!$tcp_port && !$id_agent_module) {
|
if (empty($tcp_port) === true && $id_agent_module !== 0) {
|
||||||
$tcp_port = 80;
|
$tcp_port = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
// plugin_server is the browser id
|
// Plugin_server is the browser id.
|
||||||
if ($plugin_user == '' && !$id_agent_module) {
|
if (empty($plugin_user) === true && $id_agent_module !== 0) {
|
||||||
$plugin_user = get_product_name().' / Webcheck';
|
$plugin_user = get_product_name().' / Webcheck';
|
||||||
}
|
}
|
||||||
|
|
||||||
// plugin_server is the referer
|
// Plugin_server is the referer.
|
||||||
if ($plugin_pass == '' && !$id_agent_module) {
|
if (empty($plugin_pass) === true && $id_agent_module !== 0) {
|
||||||
$plugin_pass = 1;
|
$plugin_pass = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($edit_module)) {
|
if (empty($edit_module) === true) {
|
||||||
// Function in module_manager_editor_common.php
|
|
||||||
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
|
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
|
||||||
} else {
|
|
||||||
// TODO: Print network component if available
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('Web checks');
|
$data[0] = __('Web checks');
|
||||||
|
$suc_err_check = ' <span id="check_conf_suc" class="checks invisible">'.html_print_image('/images/ok.png', true).'</span>';
|
||||||
|
$suc_err_check .= ' <span id="check_conf_err" class="checks invisible">'.html_print_image('/images/error_red.png', true).'</span>';
|
||||||
|
$data[1] = $suc_err_check;
|
||||||
|
push_table_simple($data, 'header_web_checks');
|
||||||
|
|
||||||
$adopt = false;
|
$adopt = false;
|
||||||
if (isset($id_agent_module)) {
|
if (isset($id_agent_module) === true && $id_agent_module !== 0) {
|
||||||
$adopt = enterprise_hook('policies_is_module_adopt', [$id_agent_module]);
|
$adopt = enterprise_hook('policies_is_module_adopt', [$id_agent_module]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$id_policy_module = (int) get_parameter('id_policy_module', '');
|
if ($id_policy_module > 0) {
|
||||||
if ($id_policy_module) {
|
|
||||||
$module = enterprise_hook('policies_get_module', [$id_policy_module]);
|
$module = enterprise_hook('policies_get_module', [$id_policy_module]);
|
||||||
$plugin_parameter = $module['plugin_parameter'];
|
$plugin_parameter = $module['plugin_parameter'];
|
||||||
|
} else {
|
||||||
|
$plugin_parameter = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$plugin_parameter_split = explode('
', $plugin_parameter);
|
$plugin_parameter_split = explode('
', $plugin_parameter);
|
||||||
@ -121,7 +125,7 @@ foreach ($plugin_parameter_split as $key => $value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((bool) $adopt === false) {
|
if ((bool) $adopt === false) {
|
||||||
$data[1] = html_print_textarea(
|
$textareaPluginParameter = html_print_textarea(
|
||||||
'plugin_parameter',
|
'plugin_parameter',
|
||||||
15,
|
15,
|
||||||
65,
|
65,
|
||||||
@ -131,7 +135,7 @@ if ((bool) $adopt === false) {
|
|||||||
'resizev'
|
'resizev'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$data[1] = html_print_textarea(
|
$textareaPluginParameter = html_print_textarea(
|
||||||
'plugin_parameter',
|
'plugin_parameter',
|
||||||
15,
|
15,
|
||||||
65,
|
65,
|
||||||
@ -141,7 +145,9 @@ if ((bool) $adopt === false) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_simple->colspan['web_checks'][1] = 2;
|
$data = [];
|
||||||
|
$data[0] = $textareaPluginParameter;
|
||||||
|
push_table_simple($data, 'textarea_web_checks');
|
||||||
|
|
||||||
// Disable debug button if module has not started.
|
// Disable debug button if module has not started.
|
||||||
if ($id_agent_module > 0
|
if ($id_agent_module > 0
|
||||||
@ -158,35 +164,43 @@ if ($id_agent_module > 0
|
|||||||
$hintDebug = __('Debug this module once it has been initialized');
|
$hintDebug = __('Debug this module once it has been initialized');
|
||||||
}
|
}
|
||||||
|
|
||||||
$suc_err_check = ' <span id="check_conf_suc" class="checks invisible">'.html_print_image('/images/ok.png', true).'</span>';
|
$actionButtons = html_print_button(
|
||||||
$suc_err_check .= ' <span id="check_conf_err" class="checks invisible">'.html_print_image('/images/error_red.png', true).'</span>';
|
|
||||||
$data[2] = html_print_button(
|
|
||||||
__('Load basic'),
|
__('Load basic'),
|
||||||
'btn_loadbasic',
|
'btn_loadbasic',
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
'class="sub config"',
|
[
|
||||||
|
'icon' => 'cog',
|
||||||
|
'mode' => 'mini secondary',
|
||||||
|
],
|
||||||
true
|
true
|
||||||
).ui_print_help_tip(__('Load a basic structure on Web Checks'), true);
|
).ui_print_help_tip(__('Load a basic structure on Web Checks'), true);
|
||||||
$data[2] .= '<br><br>'.html_print_button(
|
$actionButtons .= html_print_button(
|
||||||
__('Check'),
|
__('Check'),
|
||||||
'btn_checkconf',
|
'btn_checkconf',
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
'class="sub upd"',
|
[
|
||||||
|
'icon' => 'update',
|
||||||
|
'mode' => 'mini secondary',
|
||||||
|
],
|
||||||
true
|
true
|
||||||
).ui_print_help_tip(__('Check the correct structure of the WebCheck'), true).$suc_err_check;
|
).ui_print_help_tip(__('Check the correct structure of the WebCheck'), true);
|
||||||
$data[2] .= '<br><br>'.html_print_button(
|
$actionButtons .= html_print_button(
|
||||||
__('Debug'),
|
__('Debug'),
|
||||||
'btn_debugModule',
|
'btn_debugModule',
|
||||||
$disableDebug,
|
$disableDebug,
|
||||||
'',
|
'loadDebugWindow()',
|
||||||
'class="sub config" onClick="loadDebugWindow()"',
|
[
|
||||||
|
'icon' => 'cog',
|
||||||
|
'mode' => 'mini secondary ',
|
||||||
|
],
|
||||||
true
|
true
|
||||||
).ui_print_help_tip($hintDebug, true);
|
).ui_print_help_tip($hintDebug, true);
|
||||||
|
|
||||||
|
$data = [];
|
||||||
push_table_simple($data, 'web_checks');
|
$data[0] = $actionButtons;
|
||||||
|
push_table_simple($data, 'buttons_web_checks');
|
||||||
|
|
||||||
$http_checks_type = [
|
$http_checks_type = [
|
||||||
0 => 'Anyauth',
|
0 => 'Anyauth',
|
||||||
|
@ -116,7 +116,7 @@ $data[1] = html_print_input_text(
|
|||||||
$data[2] = __('Password');
|
$data[2] = __('Password');
|
||||||
$data[3] = html_print_input_password(
|
$data[3] = html_print_input_password(
|
||||||
'plugin_pass',
|
'plugin_pass',
|
||||||
$plugin_pass,
|
'',
|
||||||
'',
|
'',
|
||||||
15,
|
15,
|
||||||
60,
|
60,
|
||||||
@ -191,6 +191,11 @@ $(document).ready (function () {
|
|||||||
$("#text-custom_ip_target").hide();
|
$("#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>
|
</script>
|
||||||
|
@ -117,29 +117,29 @@ if ($not_found) {
|
|||||||
$table = new StdClass();
|
$table = new StdClass();
|
||||||
$table->id = 'form_editor';
|
$table->id = 'form_editor';
|
||||||
|
|
||||||
$table->width = '98%';
|
$table->width = '100%';
|
||||||
$table->class = 'databox_color';
|
$table->class = 'databox filter-table-adv';
|
||||||
|
|
||||||
$table->head = [];
|
|
||||||
|
|
||||||
$table->size = [];
|
|
||||||
$table->size[0] = '30%';
|
|
||||||
|
|
||||||
$table->style = [];
|
$table->style = [];
|
||||||
$table->style[0] = 'font-weight: bold; width: 150px;';
|
$table->style[0] = 'width: 50%';
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
|
||||||
$table->data[0][0] = __('Name');
|
$table->data[0][] = html_print_label_input_block(
|
||||||
$table->data[0][1] = html_print_input_text(
|
__('Name'),
|
||||||
|
html_print_input_text(
|
||||||
'name',
|
'name',
|
||||||
$name,
|
$name,
|
||||||
'',
|
'',
|
||||||
30,
|
30,
|
||||||
100,
|
100,
|
||||||
true
|
true
|
||||||
|
),
|
||||||
|
[ 'div_class' => 'w50p' ]
|
||||||
);
|
);
|
||||||
$table->data[1][0] = __('Group');
|
|
||||||
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
|
$table->data[1][] = html_print_label_input_block(
|
||||||
|
__('Group'),
|
||||||
|
html_print_select_groups(
|
||||||
false,
|
false,
|
||||||
'AR',
|
'AR',
|
||||||
true,
|
true,
|
||||||
@ -149,47 +149,59 @@ if ($not_found) {
|
|||||||
'',
|
'',
|
||||||
0,
|
0,
|
||||||
true
|
true
|
||||||
).'</div>';
|
),
|
||||||
|
[ 'div_class' => 'w50p' ]
|
||||||
|
);
|
||||||
|
|
||||||
$table->data[2][0] = __('Node radius');
|
$table->data[2][] = html_print_label_input_block(
|
||||||
$table->data[2][1] = html_print_input_text(
|
__('Node radius'),
|
||||||
|
html_print_input_text(
|
||||||
'node_radius',
|
'node_radius',
|
||||||
$node_radius,
|
$node_radius,
|
||||||
'',
|
'',
|
||||||
2,
|
2,
|
||||||
10,
|
10,
|
||||||
true
|
true
|
||||||
|
),
|
||||||
|
[ 'div_class' => 'w50p' ]
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data[3][0] = __('Description');
|
$table->data[3][] = html_print_label_input_block(
|
||||||
$table->data[3][1] = html_print_textarea('description', 7, 25, $description, '', true);
|
__('Description'),
|
||||||
|
html_print_textarea(
|
||||||
|
'description',
|
||||||
|
7,
|
||||||
|
25,
|
||||||
|
$description,
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
echo '<form method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
echo '<form method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
echo "<div style='width: ".$table->width."; text-align: right; margin-top:20px;'>";
|
|
||||||
if ($new_empty_networkmap) {
|
if ($new_empty_networkmap) {
|
||||||
html_print_input_hidden('save_empty_networkmap', 1);
|
html_print_input_hidden('save_empty_networkmap', 1);
|
||||||
html_print_submit_button(
|
$titleButton = __('Save networkmap');
|
||||||
__('Save networkmap'),
|
|
||||||
'crt',
|
|
||||||
false,
|
|
||||||
'class="sub next"'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($edit_networkmap) {
|
if ($edit_networkmap) {
|
||||||
html_print_input_hidden('id_networkmap', $id);
|
html_print_input_hidden('id_networkmap', $id);
|
||||||
html_print_input_hidden('update_empty_networkmap', 1);
|
html_print_input_hidden('update_empty_networkmap', 1);
|
||||||
html_print_submit_button(
|
$titleButton = __('Update networkmap');
|
||||||
__('Update networkmap'),
|
|
||||||
'crt',
|
|
||||||
false,
|
|
||||||
'class="sub upd"'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html_print_action_buttons(
|
||||||
|
html_print_submit_button(
|
||||||
|
$titleButton,
|
||||||
|
'crt',
|
||||||
|
false,
|
||||||
|
['icon' => 'next'],
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
echo '</div>';
|
|
||||||
}
|
}
|
||||||
|
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