9680-Conflict

This commit is contained in:
Pablo Aragon 2023-03-10 09:38:55 +01:00
commit 4ebe7ee790
733 changed files with 57806 additions and 30606 deletions
extras
pandora_agents
pandora_console

View 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"

View 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"

View File

@ -431,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"
# 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
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
@ -639,8 +639,8 @@ systemctl enable tentacle_serverd &>> $LOGFILE
execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
# Enabling condole cron
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
## Enabling agent
systemctl enable pandora_agent_daemon &>> $LOGFILE
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"

View File

@ -5,7 +5,7 @@
## Tested versions ##
# Centos 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
#Constants
@ -14,7 +14,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='202301251'
S_VERSION='202302201'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables
@ -107,6 +107,17 @@ check_root_permissions () {
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
echo "Starting PandoraFMS Community deployment EL8 ver. $S_VERSION"
@ -207,6 +218,7 @@ else
execute_cmd "dnf config-manager --set-enabled powertools" "Configuring Powertools"
fi
execute_cmd "installing_docker" "Installing Docker for debug"
#Installing wget
execute_cmd "dnf install -y wget" "Installing wget"
@ -454,7 +466,7 @@ 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
innodb_io_capacity = 300
thread_cache_size = 8
thread_stack = 256K
max_connections = 100
@ -483,6 +495,7 @@ EO_CONFIG_F
if [ "$MYVER" -eq '80' ] ; then
sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf
sed -i -e "s/#skip-log-bin/skip-log-bin/g" /etc/my.cnf
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"
@ -517,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"
# 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
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
@ -732,8 +745,8 @@ systemctl enable tentacle_serverd &>> "$LOGFILE"
execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
# Enabling condole cron
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
## Enabling agent
systemctl enable pandora_agent_daemon &>> "$LOGFILE"
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
@ -743,7 +756,7 @@ execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
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
$(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"}')

View File

@ -4,6 +4,7 @@
##############################################################################################################
## Tested versions ##
# Ubuntu 22.04.1
# Ubuntu 22.04.2
#avoid promps
export DEBIAN_FRONTEND=noninteractive
@ -16,7 +17,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
WORKDIR=/opt/pandora/deploy
S_VERSION='202301251'
S_VERSION='202302201'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
rm -f $LOGFILE &> /dev/null # remove last log before start
@ -106,6 +107,21 @@ check_root_permissions () {
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
echo "Starting PandoraFMS Community deployment Ubuntu 22.04 ver. $S_VERSION"
@ -173,7 +189,7 @@ 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"
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
[ -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"
@ -221,7 +237,8 @@ systemctl restart php$PHPVER-fpm &>> "$LOGFILE"
php$PHPVER-xml \
php$PHPVER-yaml \
libnet-telnet-perl \
whois"
whois \
cron"
execute_cmd "apt install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
# Server dependencies
@ -254,10 +271,13 @@ server_dependencies=" \
libnet-telnet-perl \
libjson-perl \
libencode-perl \
cron \
libgeo-ip-perl \
openjdk-8-jdk "
execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
execute_cmd "installing_docker" "Installing Docker for debug"
# 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/pandorawmic" "Downloading pandorawmic"
@ -393,7 +413,7 @@ cat > /etc/mysql/my.cnf << EOF_DB
[mysqld]
datadir=/var/lib/mysql
user=mysql
character-set-server=utf8
character-set-server=utf8mb4
skip-character-set-client-handshake
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
@ -408,7 +428,7 @@ 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
innodb_io_capacity = 300
thread_cache_size = 8
thread_stack = 256K
max_connections = 100
@ -477,7 +497,7 @@ check_cmd_status "Error installing PandoraFMS Agent"
# Copy gotty utility
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
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
@ -731,9 +751,14 @@ systemctl enable pandora_server &>> "$LOGFILE"
execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
systemctl enable tentacle_serverd &>> "$LOGFILE"
# Enabling condole cron
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
# Enabling 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 --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
sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF &>> "$LOGFILE"
@ -748,7 +773,7 @@ sed --follow-symlinks -i -e "s/^openssl_conf = openssl_init/#openssl_conf = open
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
$(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"}')

View File

@ -277,8 +277,8 @@ export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64
EOF_ENV
echo ">> Enable discovery cron: "
#while true ; do wget -q -O - --no-check-certificate http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/pandora_console.log && sleep 60 ; done &
echo "*/5 * * * * wget -q -O - --no-check-certificate http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/log/cron.log" >> /opt/pandora/crontasks
#while true ; do wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/pandora_console.log && sleep 60 ; done &
echo "*/5 * * * * wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/log/cron.log" >> /opt/pandora/crontasks
echo ">> Enable pandora_db cron: "
/usr/bin/perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768, AIX version
# Version 7.0NG.769, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768, FreeBSD Version
# Version 7.0NG.769, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768, HP-UX Version
# Version 7.0NG.769, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768, GNU/Linux
# Version 7.0NG.769, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768, GNU/Linux
# Version 7.0NG.769, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768, Solaris Version
# Version 7.0NG.769, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.768
# Version 7.0NG.769
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version

View File

@ -1,6 +1,7 @@
#
#Pandora FMS Linux Agent
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 4.0
%define release 1

View File

@ -1,6 +1,7 @@
#
#Pandora FMS Linux Agent
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 4.0.1
%define release 1

View File

@ -1,15 +1,8 @@
#!/usr/bin/perl
##########################################################################
# pandora_agent_exec
################################################################################
# pandora_exec - Execute a command with a time limit.
#
# Executes the given command and prints its output to stdout. If the
# execution times out or the command does not exist nothing is printed
# to stdout. This is part of Pandora FMS Plugin server, do not delete!.
#
# Usage: pandora_agent_exec <timeout in seconds> <command>
##########################################################################
# Copyright (c) 2008-2010 Ramon Novoa, rnovoa@gmail.com
# (c) 2008-2010 Artica Soluciones Tecnologicas S.L
# Copyright (c) 2008-2023 Artica PFMS S.L.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -22,37 +15,41 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##########################################################################
################################################################################
use strict;
use warnings;
use POSIX qw(WEXITSTATUS WIFEXITED);
# Check command line parameters
# Check command line arguments.
if ($#ARGV < 1) {
print("Usage: $0 <timeout in seconds> <command>\n");
exit 1;
}
my @opts = @ARGV;
my $timeout = shift(@opts);
my $command = join(' ', @opts);
my $output = '';
my $ReturnCode = 0;
my $command = ($0 =~ m/_agent_exec$/) ? # For backward compatibility with pandora_agent.
join(' ', @opts) :
join(' ', map { quotemeta($_) } @opts);
# Execute the command
eval {
local $SIG{ALRM} = sub { die "alarm\n" };
alarm $timeout;
$output = `$command`;
$ReturnCode = ($? >> 8) & 0xff;
alarm 0;
};
# Timeout
if ($@ eq "alarm\n") {
exit 3;
# Fork:
# * The child will run the command.
# * The parent will timeout if needed
# and exit with the appropriate exit status.
my $pid = fork();
if ($pid == 0) {
setpgrp();
exec($command);
} else {
eval {
local $SIG{ALRM} = sub { kill(9, -$pid); exit 1; };
alarm $timeout;
waitpid($pid, 0);
alarm 0;
if (WIFEXITED(${^CHILD_ERROR_NATIVE})) {
exit WEXITSTATUS(${^CHILD_ERROR_NATIVE});
}
};
}
print $output;
exit $ReturnCode;
exit 1;

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.768, AIX version
# Version 7.0NG.769, AIX version
# General Parameters
# ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.768
# Version 7.0NG.769
# FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.768, HPUX Version
# Version 7.0NG.769, HPUX Version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768
# Version 7.0NG.769
# Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,7 @@
#
#Pandora FMS Linux Agent
#
%global __os_install_post %{nil}
%define name pandorafms_agent
%define version 3.2
Summary: Pandora FMS Linux agent

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768
# Version 7.0NG.769
# Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768
# Version 7.0NG.769
# Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.768, Solaris version
# Version 7.0NG.769, Solaris version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768, AIX version
# Version 7.0NG.769, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.768-230207
Version: 7.0NG.769-230310
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.768-230207"
pandora_version="7.0NG.769-230310"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -31,7 +31,7 @@ fi
if [ "$#" -ge 2 ]; then
VERSION="$2"
else
VERSION="7.0NG.768"
VERSION="7.0NG.769"
fi
# Path for the generated DMG file

View File

@ -19,11 +19,11 @@
<choice id="com.pandorafms.pandorafms_src" visible="false">
<pkg-ref id="com.pandorafms.pandorafms_src"/>
</choice>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.768" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.769" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
</choice>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.768" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.769" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<!-- <installation-check script="check()" />
<script>
<![CDATA[

View File

@ -5,9 +5,9 @@
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
<key>CFBundleVersion</key> <string>7.0NG.768</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.768 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.768</string>
<key>CFBundleVersion</key> <string>7.0NG.769</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.769 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.769</string>
<key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string>

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768, GNU/Linux
# Version 7.0NG.769, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768, FreeBSD Version
# Version 7.0NG.769, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768, HP-UX Version
# Version 7.0NG.769, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768, GNU/Linux
# Version 7.0NG.769, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768, GNU/Linux
# Version 7.0NG.769, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768, NetBSD Version
# Version 7.0NG.769, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.768, Solaris Version
# Version 7.0NG.769, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -556,30 +556,38 @@ BEGIN {
sub runCommand {
my ($self, $ref, $output_mode) = @_;
my $result;
if($self->load_libraries()) {
# Functionality possible.
my $command = $self->{'commands'}->{$ref};
my $result = $self->evaluate_command($ref);
if (ref($result) eq "HASH") {
# Process command result.
if (defined($output_mode) && $output_mode eq 'xml') {
my $output = '';
$output .= "<cmd_report>\n";
$output .= " <cmd_response>\n";
$output .= " <cmd_name><![CDATA[".$result->{'name'}."]]></cmd_name>\n";
$output .= " <cmd_key><![CDATA[".$ref."]]></cmd_key>\n";
$output .= " <cmd_errorlevel><![CDATA[".$result->{'error_level'}."]]></cmd_errorlevel>\n";
$output .= " <cmd_stdout><![CDATA[".$result->{'stdout'}."]]></cmd_stdout>\n";
$output .= " <cmd_stderr><![CDATA[".$result->{'stderr'}."]]></cmd_stderr>\n";
$output .= " </cmd_response>\n";
$output .= "</cmd_report>\n";
$result = $self->evaluate_command($ref);
} else {
$result = {
'stderr' => 'Cannot use commands without YAML dependency, please install it.',
'name' => 'YAML::Tiny',
'error_level' => 2,
};
}
return $output;
}
return $result;
} else {
$self->set_last_error('Failed to process ['.$ref.']: '.$result);
if (ref($result) eq "HASH") {
# Process command result.
if (defined($output_mode) && $output_mode eq 'xml') {
my $output = '';
$output .= "<cmd_report>\n";
$output .= " <cmd_response>\n";
$output .= " <cmd_name><![CDATA[".$result->{'name'}."]]></cmd_name>\n";
$output .= " <cmd_key><![CDATA[".$ref."]]></cmd_key>\n";
$output .= " <cmd_errorlevel><![CDATA[".$result->{'error_level'}."]]></cmd_errorlevel>\n";
$output .= " <cmd_stdout><![CDATA[".$result->{'stdout'}."]]></cmd_stdout>\n";
$output .= " <cmd_stderr><![CDATA[".$result->{'stderr'}."]]></cmd_stderr>\n";
$output .= " </cmd_response>\n";
$output .= "</cmd_report>\n";
return $output;
}
return $result;
} else {
$self->set_last_error('Failed to process ['.$ref.']: '.$result);
}
return undef;
@ -1014,8 +1022,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.768';
use constant AGENT_BUILD => '230207';
use constant AGENT_VERSION => '7.0NG.769';
use constant AGENT_BUILD => '230310';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -1,9 +1,10 @@
#
#Pandora FMS Linux Agent
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.768
%define release 230207
%define version 7.0NG.769
%define release 230310
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -1,9 +1,10 @@
#
#Pandora FMS Linux Agent
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.768
%define release 230207
%define version 7.0NG.769
%define release 230310
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -1,15 +1,8 @@
#!/usr/bin/perl
##########################################################################
# pandora_agent_exec
################################################################################
# pandora_exec - Execute a command with a time limit.
#
# Executes the given command and prints its output to stdout. If the
# execution times out or the command does not exist nothing is printed
# to stdout. This is part of Pandora FMS Plugin server, do not delete!.
#
# Usage: pandora_agent_exec <timeout in seconds> <command>
##########################################################################
# Copyright (c) 2008-2010 Ramon Novoa, rnovoa@gmail.com
# (c) 2008-2010 Artica Soluciones Tecnologicas S.L
# Copyright (c) 2008-2023 Artica PFMS S.L.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -22,37 +15,41 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##########################################################################
################################################################################
use strict;
use warnings;
use POSIX qw(WEXITSTATUS WIFEXITED);
# Check command line parameters
# Check command line arguments.
if ($#ARGV < 1) {
print("Usage: $0 <timeout in seconds> <command>\n");
exit 1;
}
my @opts = @ARGV;
my $timeout = shift(@opts);
my $command = join(' ', @opts);
my $output = '';
my $ReturnCode = 0;
my $command = ($0 =~ m/_agent_exec$/) ? # For backward compatibility with pandora_agent.
join(' ', @opts) :
join(' ', map { quotemeta($_) } @opts);
# Execute the command
eval {
local $SIG{ALRM} = sub { die "alarm\n" };
alarm $timeout;
$output = `$command`;
$ReturnCode = ($? >> 8) & 0xff;
alarm 0;
};
# Timeout
if ($@ eq "alarm\n") {
exit 3;
# Fork:
# * The child will run the command.
# * The parent will timeout if needed
# and exit with the appropriate exit status.
my $pid = fork();
if ($pid == 0) {
setpgrp();
exec($command);
} else {
eval {
local $SIG{ALRM} = sub { kill(9, -$pid); exit 1; };
alarm $timeout;
waitpid($pid, 0);
alarm 0;
if (WIFEXITED(${^CHILD_ERROR_NATIVE})) {
exit WEXITSTATUS(${^CHILD_ERROR_NATIVE});
}
};
}
print $output;
exit $ReturnCode;
exit 1;

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.768"
PI_BUILD="230207"
PI_VERSION="7.0NG.769"
PI_BUILD="230310"
OS_NAME=`uname -s`
FORCE=0

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.768
# Version 7.0NG.769
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v7.0NG.768}
{Pandora FMS Windows Agent v7.0NG.769}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{230207}
{230310}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.768 Build 230207")
#define PANDORA_VERSION ("7.0NG.769 Build 230310")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.768(Build 230207))"
VALUE "ProductVersion", "(7.0NG.769(Build 230310))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.768-230207
Version: 7.0NG.769-230310
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.768-230207"
pandora_version="7.0NG.769-230310"
package_pear=0
package_pandora=1

View File

@ -377,17 +377,17 @@ function mainAgentsModules()
$fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&amp;sec=extensions&amp;sec2=extensions/agents_modules&amp;pure=1&amp;
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]) {
$full_modules = urlencode(implode(';', $full_modules_selected));
$full_agents = urlencode(implode(';', $full_agents_id));
$fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&amp;sec=extensions&amp;sec2=extensions/agents_modules&amp;pure=1&amp;
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 {
$fullscreen['text'] = '<a href="index.php?extension_in_menu=estado&amp;sec=extensions&amp;sec2=extensions/agents_modules&amp;pure=1&amp;
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,61 +397,139 @@ function mainAgentsModules()
1 => __('Show module data'),
];
$filter_type_label = '<b>'.__('Information to be shown').'</b>';
$filter_type = html_print_select($show_select, 'show_type', $show_type, '', '', 0, true, false, false, '', false, 'min-width: 180px;');
// Groups.
$filter_groups_label = '<b>'.__('Group').'</b>';
$filter_groups = html_print_select_groups(false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: auto;');
$filter_recursion_label = '</td><td><b>'.__('Recursion').'</b>';
$filter_recursion = html_print_checkbox('recursion', 1, 0, true).'</td>';
// Groups module.
$filter_module_groups_label = '<b>'.__('Module group').'</b>';
$filter_module_groups = html_print_select_from_sql(
'SELECT * FROM tmodule_group ORDER BY name',
'modulegroup',
$modulegroup,
'',
__('All'),
0,
true,
false,
true,
false,
'width: auto;'
$filter_type = html_print_label_input_block(
__('Information to be shown'),
html_print_select(
$show_select,
'show_type',
$show_type,
'',
'',
0,
true,
false,
false,
'',
false,
'width: 100%;'
)
);
$filter_groups = html_print_label_input_block(
__('Group'),
html_print_select_groups(
false,
'AR',
true,
'group_id',
$group_id,
'',
'',
'',
true,
false,
true,
'',
false,
'width: 100%;'
)
);
$filter_groups .= html_print_label_input_block(
__('Recursion'),
html_print_checkbox_switch('recursion', 1, 0, true),
[
'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',
'modulegroup',
$modulegroup,
'',
__('All'),
0,
true,
false,
true,
false,
'width: 100%;'
)
);
// Agent.
$agents = agents_get_group_agents($group_id);
if ((empty($agents)) || $agents == -1) {
$agents = [];
}
$filter_agents_label = '<b>'.__('Agents').'</b>';
$filter_agents = html_print_select($agents, 'id_agents2[]', $agents_id, '', '', 0, true, true, true, '', false, 'min-width: 180px; max-width: 200px;');
$filter_agents = html_print_label_input_block(
__('Agents'),
html_print_select(
$agents,
'id_agents2[]',
$agents_id,
'',
'',
0,
true,
true,
true,
'',
false,
'width: 100%;'
)
);
// Type show.
$selection = [
0 => __('Show common modules'),
1 => __('Show all modules'),
];
$filter_type_show_label = '<b>'.__('Show common modules').'</b>';
$filter_type_show = html_print_select($selection, 'selection_agent_module', $selection_a_m, '', '', 0, true, false, true, '', false, 'min-width: 180px;');
$filter_type_show = html_print_label_input_block(
__('Show common modules'),
html_print_select(
$selection,
'selection_agent_module',
$selection_a_m,
'',
'',
0,
true,
false,
true,
'',
false,
'width: 100%;'
)
);
// Modules.
$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_select($all_modules, 'module[]', $modules_selected, '', '', 0, true, true, false, '', false, 'min-width: 180px; max-width: 200px;');
// Update.
$filter_update = html_print_submit_button(__('Update item'), 'edit_item', false, 'class="sub upd"', true);
$filter_modules = html_print_label_input_block(
__('Module'),
html_print_select(
$all_modules,
'module[]',
$modules_selected,
'',
'',
0,
true,
true,
false,
'',
false,
'width: 100%;'
)
);
$onheader = [
'updated_time' => $updated_time,
'fullscreen' => $fullscreen,
'combo_module_groups' => $filter_module_groups,
'combo_groups' => $filter_groups,
'updated_time' => $updated_time,
'fullscreen' => $fullscreen,
];
/*
@ -467,7 +545,7 @@ function mainAgentsModules()
false,
'',
false,
(array) $updated_time,
$onheader,
[
[
'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 {
if ($full_agents_id[0]) {
$full_modules = urlencode(implode(';', $full_modules_selected));
@ -525,11 +597,11 @@ function mainAgentsModules()
echo '<li class="nomn">';
echo '<a target="_top" href="'.$url.'">';
echo html_print_image(
'images/normal_screen.png',
'images/exit_fullscreen@svg.svg',
true,
[
'title' => __('Back to normal mode'),
'class' => 'invert_filter',
'class' => 'main_menu_icon invert_filter',
]
);
echo '</a>';
@ -574,35 +646,46 @@ function mainAgentsModules()
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 .= '<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 .= '<td>'.$filter_type_label.'</td>';
$show_filters .= '<td>'.$filter_type.'</td>';
$show_filters .= '<td width="33%">'.$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 .= '<td>'.$filter_groups_label.'</td>';
$show_filters .= '<td>'.$filter_groups.'&nbsp;&nbsp;&nbsp;'.$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_type_show_label.'</td>';
$show_filters .= '<td>'.$filter_type_show.'</td>';
$show_filters .= '<td>'.$filter_modules_label.'</td>';
$show_filters .= '<td>'.$filter_modules.'</td>';
$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 .= html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Filter'),
'srcbutton',
false,
[
'icon' => 'search',
'mode' => 'mini',
],
true
),
],
true
);
$show_filters .= '</form>';
ui_toggle(
$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;
}
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 "<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) {
$new_hor_offset = ($hor_offset - $block);
@ -804,7 +887,20 @@ function mainAgentsModules()
// 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;
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) {
// Get stats for this group.

View File

@ -195,129 +195,183 @@ function extension_api_checker()
);
}
ui_print_page_header(
__('API checker'),
// Header.
ui_print_standard_header(
__('Extensions'),
'images/extensions.png',
false,
'',
true,
''
[],
[
[
'link' => '',
'label' => __('Admin tools'),
],
[
'link' => '',
'label' => __('Extension manager'),
],
[
'link' => '',
'label' => __('API checker'),
],
]
);
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters filter-table-adv';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = [];
$row = [];
$row[] = __('IP');
$row[] = html_print_input_text('ip', $ip, '', 50, 255, true);
$row[] = html_print_label_input_block(
__('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;
$row = [];
$row[] = __('%s Console URL', get_product_name());
$row[] = html_print_input_text('pandora_url', $pandora_url, '', 50, 255, true);
$row[] = html_print_label_input_block(
__('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;
$row = [];
$row[] = __('API Token').ui_print_help_tip(__('Use API Token instead API Pass, User and Password.'), true);
$row[] = html_print_input_text('token', $token, '', 50, 255, true);
$table->data[] = $row;
$row[] = html_print_label_input_block(
__('User'),
html_print_input_text('user', $user, '', 50, 255, true)
);
$row = [];
$row[] = __('API Pass');
$row[] = html_print_input_password('apipass', $apipass, '', 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);
$row[] = html_print_label_input_block(
__('Password'),
html_print_input_password('password', $password, '', 50, 255, true)
);
$table->data[] = $row;
$table2 = new stdClass();
$table2->width = '100%';
$table2->class = 'databox filters filter-table-adv';
$table2->size[0] = '50%';
$table2->size[1] = '50%';
$table2->data = [];
$row = [];
$row[] = __('Action (get or set)');
$row[] = html_print_input_text('op', $op, '', 50, 255, true);
$row[] = html_print_label_input_block(
__('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;
$row = [];
$row[] = __('Operation');
$row[] = html_print_input_text('op2', $op2, '', 50, 255, true);
$row[] = html_print_label_input_block(
__('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;
$row = [];
$row[] = __('ID');
$row[] = html_print_input_text('id', $id, '', 50, 255, true);
$row[] = html_print_label_input_block(
__('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;
$row = [];
$row[] = __('ID 2');
$row[] = html_print_input_text('id2', $id2, '', 50, 255, true);
$table2->data[] = $row;
$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);
$row[] = html_print_label_input_block(
__('Other Mode'),
html_print_input_text('other_mode', $other_mode, '', 50, 255, true)
);
$table2->data[] = $row;
$table3 = new stdClass();
$table3->width = '100%';
$table3->class = 'databox filters filter-table-adv';
$table3->size[0] = '50%';
$table3->size[1] = '50%';
$table3->data = [];
$row = [];
$row[] = __('Raw URL');
$row[] = html_print_input_text('url', $url, '', 50, 2048, true);
$row[] = html_print_label_input_block(
__('Raw URL'),
html_print_input_text('url', $url, '', 50, 2048, true)
);
$table3->data[] = $row;
echo "<form method='post'>";
echo '<fieldset>';
echo "<form method='post' class='max_floating_element_size'>";
echo '<fieldset class="mrgn_btn_10px">';
echo '<legend>'.__('Credentials').'</legend>';
html_print_table($table);
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>';
html_print_table($table2);
echo '</fieldset>';
echo "<div class='right'>";
echo '</div>';
echo '<fieldset>';
echo '<fieldset class="mrgn_btn_10px">';
echo '<legend>'.__('Custom URL').'</legend>';
html_print_table($table3);
echo '</fieldset>';
echo "<div class='right'>";
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>';
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 __('URL').'<br />';
html_print_input_password('url', $return_call_api['url'], '', 150, 255, false, true);
echo "&nbsp;<a id='show_icon' title='".__('Show URL')."' href='javascript: show_url();'>";
html_print_image('images/input_zoom.png');
echo '</a>';
echo html_print_label_input_block(
__('URL'),
html_print_input_password('url', $return_call_api['url'], '', 150, 255, true, true, false, 'mrgn_top_10px'),
['label_class' => 'font-title-font']
);
echo '<br />';
echo __('Result').'<br />';
html_print_textarea('result', 30, 20, $return_call_api['result'], 'readonly="readonly"');
echo html_print_label_input_block(
__('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>';
}
?>

View File

@ -21,13 +21,23 @@ function extension_db_status()
$db_name = get_parameter('db_name', '');
$db_status_execute = (bool) get_parameter('db_status_execute', false);
ui_print_page_header(
ui_print_standard_header(
__('DB Schema check'),
'images/extensions.png',
false,
'db_status_tab',
true,
''
[],
[
[
'link' => '',
'label' => __('Admin tools'),
],
[
'link' => '',
'label' => __('Run test'),
],
]
);
if (!is_user_admin($config['id_user'])) {
@ -46,32 +56,89 @@ function extension_db_status()
__('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 '<legend>'.__('DB settings').'</legend>';
$table = new stdClass();
$table->data = [];
$row = [];
$row[] = __('DB User with privileges');
$row[] = html_print_input_text('db_user', $db_user, '', 50, 255, true);
$row[] = __('DB Password for this user');
$row[] = html_print_input_password('db_password', $db_password, '', 50, 255, true);
$row[] = html_print_label_input_block(
__('DB User with privileges'),
html_print_input_text(
'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;
$row = [];
$row[] = __('DB Hostname');
$row[] = html_print_input_text('db_host', $db_host, '', 50, 255, true);
$row[] = __('DB Name (temporal for testing)');
$row[] = html_print_input_text('db_name', $db_name, '', 50, 255, true);
$row[] = html_print_label_input_block(
__('DB Hostname'),
html_print_input_text(
'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;
html_print_table($table);
echo '</fieldset>';
echo "<div class='right'>";
html_print_input_hidden('db_status_execute', 1);
html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub next"');
echo '</div>';
html_print_action_buttons(
html_print_submit_button(
__('Execute Test'),
'submit',
false,
[ 'icon' => 'cog' ],
true
)
);
html_print_input_hidden('db_status_execute', 1);
echo '</form>';
if ($db_status_execute) {

View File

@ -76,10 +76,6 @@ function dbmgr_extension_main()
global $config;
if (is_metaconsole() === true) {
open_meta_frame();
}
if (!is_user_admin($config['id_user'])) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
@ -92,7 +88,21 @@ function dbmgr_extension_main()
$sql = (string) get_parameter('sql');
$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) {
$img = '../../images/warning_modern.png';
@ -122,47 +132,37 @@ function dbmgr_extension_main()
echo $warning_message;
}
ui_print_warning_message(
__(
"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
if you don't know </b>exactly</b> what are you are doing,
this means that you can severily damage your setup using this extension.
This extension is intended to be used <b>only by experienced users</b>
with a depth knowledge of %s internals.",
get_product_name(),
get_product_name(),
get_product_name()
)
);
echo "<form method='post' action=''>";
$table = new stdClass();
$table->id = 'db_interface';
$table->class = 'databox';
$table->class = 'databox no_border filter-table-adv';
$table->width = '100%';
$table->data = [];
$table->head = [];
$table->colspan = [];
$table->rowstyle = [];
$table->style[0] = 'width: 30%;';
$table->style[1] = 'width: 70%;';
$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
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,
this means that you can severily damage your setup using this extension.
This extension is intended to be used <b>only by experienced users</b>
with a depth knowledge of %s internals.",
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>";
$data[2][0] = html_print_textarea(
'sql',
5,
50,
html_entity_decode($sql, ENT_QUOTES),
'',
true
$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) {
@ -181,32 +181,57 @@ function dbmgr_extension_main()
$servers = [];
}
$data[3][2] = html_print_input(
[
'name' => 'node_id',
'type' => 'select',
'fields' => $servers,
'selected' => $node_id,
'nothing' => __('This metaconsole'),
'nothing_value' => -1,
'return' => true,
'label' => _('Select query target'),
]
$data[0][1] = html_print_label_input_block(
__('Select query target'),
html_print_select(
$servers,
'node_id',
$node_id,
'',
__('This metaconsole'),
-1,
true,
false,
false,
'w40p',
false,
'width: 40%;'
)
);
}
$data[4][2] = '<div class="action-buttons w100p">';
$data[4][2] .= html_print_submit_button(
$data[1][0] = html_print_textarea(
'sql',
3,
50,
html_entity_decode($sql, ENT_QUOTES),
'placeholder="'.__('Type your query here...').'"',
true,
'w100p'
);
$execute_button = html_print_submit_button(
__('Execute SQL'),
'',
false,
'class="sub next"',
[ 'icon' => 'cog' ],
true
);
$data[4][2] .= '</div>';
$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>';
// Processing SQL Code.
@ -214,10 +239,6 @@ function dbmgr_extension_main()
return;
}
echo '<br />';
echo '<hr />';
echo '<br />';
try {
if (\is_metaconsole() === true && $node_id !== -1) {
$node = new Node($node_id);
@ -227,7 +248,7 @@ function dbmgr_extension_main()
'dbport' => $node->dbport(),
'dbname' => $node->dbname(),
'dbuser' => $node->dbuser(),
'dbpass' => $node->dbpass(),
'dbpass' => io_output_password($node->dbpass()),
]
);
$error = '';
@ -282,22 +303,17 @@ function dbmgr_extension_main()
html_print_table($table);
echo '</div>';
if (is_metaconsole()) {
close_meta_frame();
}
}
if (is_metaconsole() === true) {
// This adds a option in the operation menu.
extensions_add_meta_menu_option(
'DB interface',
__('DB interface'),
'PM',
'gextensions',
'database.png',
'v1r1',
'gdbman'
'v1r1'
);
extensions_add_meta_function('dbmgr_extension_main');

View File

@ -24,7 +24,6 @@ table.dbmanager th {
}
textarea {
min-height: 50px;
height: 50px;
width: 95%;
width: 100% !important;
max-width: 100% !important;
}

View File

@ -25,13 +25,28 @@ function extension_uploader_extensions()
return;
}
ui_print_page_header(
__('Uploader extension'),
// Header.
ui_print_standard_header(
__('Extensions'),
'images/extensions.png',
false,
'',
true,
''
[],
[
[
'link' => '',
'label' => __('Admin tools'),
],
[
'link' => '',
'label' => __('Extension manager'),
],
[
'link' => '',
'label' => __('Uploader extension'),
],
]
);
$upload = (bool) get_parameter('upload', 0);
@ -77,20 +92,52 @@ function extension_uploader_extensions()
$table = new stdClass();
$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[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()) {
$table->data[0][2] = __('Upload enterprise extension').'&nbsp;'.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'>";
html_print_table($table);
echo "<div class='right' style='width: ".$table->width."'>";
html_print_input_hidden('upload', 1);
html_print_submit_button(__('Upload'), 'submit', false, 'class="sub add"');
echo '</div>';
html_print_action_buttons(
html_print_submit_button(
__('Upload'),
'submit',
false,
['icon' => 'wand'],
true
)
);
echo '</form>';
}

View File

@ -126,8 +126,30 @@ function pandora_files_repo_godmode()
'godmode' => $godmode,
'operation' => $operation,
];
// 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.'/';
include_once $full_extensions_dir.'files_repo/functions_files_repo.php';

View File

@ -32,17 +32,15 @@ if (isset($file_id) && $file_id > 0) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->style = [];
$table->style[0] = 'font-weight: bold;';
$table->style[2] = 'text-align: center;';
$table->colspan = [];
$table->class = 'databox filters filter-table-adv';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = [];
// GROUPS
// GROUPS.
$groups = groups_get_all();
// Add the All group to the beginning to be always the first
// Use this instead array_unshift to keep the array keys
// Add the All group to the beginning to be always the first.
// Use this instead array_unshift to keep the array keys.
$groups = ([0 => __('All')] + $groups);
$groups_selected = [];
foreach ($groups as $id => $name) {
@ -52,66 +50,110 @@ foreach ($groups as $id => $name) {
}
$row = [];
$row[0] = __('Groups');
$row[1] = '<div class="w290px">'.html_print_select_groups(
// Id_user.
false,
// Privilege.
'AR',
// ReturnAllGroup.
true,
// Name.
'groups[]',
// Selected.
$groups_selected,
// Script.
'',
// Nothing.
'',
// Nothing_value.
0,
// Return.
true,
// Multiple.
true
).'</div>';
$table->data[] = $row;
$table->colspan[][1] = 3;
$row[0] = html_print_label_input_block(
__('Groups'),
html_print_select_groups(
// Id_user.
false,
// Privilege.
'AR',
// ReturnAllGroup.
true,
// Name.
'groups[]',
// Selected.
$groups_selected,
// Script.
'',
// Nothing.
'',
// Nothing_value.
0,
// Return.
true,
// Multiple.
true
)
);
// DESCRIPTION
$row = [];
$row[0] = __('Description');
$row[0] .= ui_print_help_tip(__('Only 200 characters are permitted'), true);
$row[1] = html_print_textarea('description', 3, 20, $file['description'], 'class="file_repo_description"', true);
// DESCRIPTION.
$row[1] = html_print_label_input_block(
__('Description').ui_print_help_tip(__('Only 200 characters are permitted'), true),
html_print_textarea(
'description',
4,
20,
$file['description'],
'class="file_repo_description" style="min-height: 60px; max-height: 60px;"',
true
)
);
$table->data[] = $row;
$table->colspan[][1] = 3;
// FILE and SUBMIT BUTTON
// FILE and SUBMIT BUTTON.
$row = [];
// Public checkbox
// Public checkbox.
$checkbox = html_print_checkbox('public', 1, (bool) !empty($file['hash']), true);
$style = 'class="inline padding-2-10"';
$row[0] = __('File');
if ($file_id > 0) {
$row[1] = $file['name'];
$row[2] = "<div $style>".__('Public link')."&nbsp;$checkbox</div>";
$row[3] = html_print_submit_button(__('Update'), 'submit', false, 'class="sub upd"', true);
$row[3] .= html_print_input_hidden('update_file', 1, true);
$row[3] .= html_print_input_hidden('file_id', $file_id, true);
$submit_button = html_print_submit_button(
__('Update'),
'submit',
false,
['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 {
$row[1] = html_print_input_file('upfile', true);
$row[2] = "<div $style>".__('Public link')."&nbsp;$checkbox</div>";
$row[3] = html_print_submit_button(__('Add'), 'submit', false, 'class="sub add"', true);
$row[3] .= html_print_input_hidden('add_file', 1, true);
$submit_button = html_print_submit_button(
__('Add'),
'submit',
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->colspan[][1] = 1;
$url = ui_get_full_url('index.php?sec=godmode/extensions&sec2=extensions/files_repo');
echo "<form method='post' action='$url' enctype='multipart/form-data'>";
html_print_table($table);
html_print_action_buttons($submit_button);
echo '</form>';
?>

View File

@ -98,7 +98,7 @@ if (!empty($files)) {
// Last modification
// Public URL
$data[4] = '';
$table->cellclass[][4] = 'action_buttons';
$table->cellclass[][4] = 'table_action_buttons';
if (!empty($file['hash'])) {
$public_url = ui_get_full_url(
EXTENSIONS_DIR.'/files_repo/files_repo_get_file.php?file='.$file['hash']

View File

@ -1,16 +1,32 @@
<?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
// ==================================================
// 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.
// Load global vars.
global $config;
require_once $config['homedir'].'/include/functions_agents.php';
@ -55,7 +71,24 @@ function mainInsertData()
{
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'])) {
db_pandora_audit(
@ -84,6 +117,13 @@ function mainInsertData()
$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&lt;newline&gt;date;value&lt;newline&gt;... The date in CSV is in format Y/m/d H:i:s.'),
$config['remote_config']
)
);
if ($save) {
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.'));
@ -140,27 +180,25 @@ function mainInsertData()
}
}
echo '<div class="notify mrg_btt_15">';
echo sprintf(
__('Please check that the directory "%s" is writeable by the apache user. <br /><br />The CSV file format is date;value&lt;newline&gt;date;value&lt;newline&gt;... The date in CSV is in format Y/m/d H:i:s.'),
$config['remote_config']
);
echo '</div>';
$modules = [];
if ($agent_id > 0) {
$modules = agents_get_modules($agent_id, false, ['delete_pending' => 0]);
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->class = 'databox filter-table-adv';
$table->style = [];
$table->style[0] = 'font-weight: bolder;';
$table->cellstyle[0][0] = 'width: 0';
$table->cellstyle[0][1] = 'width: 0';
$table->data = [];
$table->data[0][0] = __('Agent');
$table->data[0][0] = '<label>'.__('Agent').'</label>';
$table->data[0][1] = '<label>'.__('Module').'</label>';
$table->data[0][2] = '<label>'.__('Date').'</label>';
$params = [];
$params['return'] = true;
$params['show_helptip'] = true;
$params['input_name'] = 'agent_name';
$params['value'] = $agent_name;
$params['value'] = ($save === true) ? '' : $agent_name;
$params['javascript_is_function_select'] = true;
$params['javascript_name_function_select'] = 'custom_select_function';
$params['javascript_code_function_select'] = '';
@ -170,18 +208,12 @@ function mainInsertData()
$params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $agent_id;
$table->data[0][1] = ui_print_agent_autocomplete_input($params);
$table->data[1][0] = __('Module');
$modules = [];
if ($agent_id) {
$modules = agents_get_modules($agent_id, false, ['delete_pending' => 0]);
}
$table->data[1][0] = html_print_div(['class' => 'flex flex-items-center', 'content' => ui_print_agent_autocomplete_input($params)], true);
$table->data[1][1] = html_print_select(
$modules,
'id_agent_module',
$id_agent_module,
($save === true) ? '' : $id_agent_module,
true,
__('Select'),
0,
@ -191,22 +223,45 @@ function mainInsertData()
'',
empty($agent_id)
);
$table->data[2][0] = __('Data');
$table->data[2][1] = html_print_input_text('data', $data, __('Data'), 40, 60, true);
$table->data[3][0] = __('Date');
$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[4][0] = __('CSV');
$table->data[4][1] = html_print_input_file('csv', true);
$table->data[1][2] = html_print_input_text('data', ($save === true) ? date(DATE_FORMAT) : $data, __('Data'), 10, 60, true);
$table->data[1][2] .= '&nbsp;';
$table->data[1][2] .= html_print_input_text('time', ($save === true) ? date(TIME_FORMAT) : $time, '', 10, 7, true);
$table->data[2][0] = '<label>'.__('Data').'</label>';
$table->data[2][1] = '<label>'.__('CSV').'</label>';
$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'>";
html_print_table($table);
echo "<div class='right' style='width: ".$table->width."'>";
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>';
@ -257,8 +312,8 @@ function mainInsertData()
$('#id_agent_module').enable();
$('#id_agent_module').fadeIn ('normal');
$('#submit-submit').enable();
$('#submit-submit').fadeIn ('normal');
$('button [name="submit"]').removeClass('disabled_action_button');
$('button [name="submit"]').fadeIn ('normal');
}
});
}

View File

@ -266,24 +266,68 @@ function mainModuleGroups()
]
);
echo "<table cellpadding='4' cellspacing='4' class='databox filters bolder margin-bottom-10' width='100%'>
<tr>";
echo "<form method='post'
action='index.php?sec=view&sec2=extensions/module_groups'>";
$output = "<form method='post'
action='index.php?sec=view&sec2=extensions/module_groups'>";
echo '<td>';
echo __('Search by agent group').'&nbsp;';
html_print_input_text('agent_group_search', $agent_group_search);
$output .= "<table cellpadding='4' cellspacing='4' class='filter-table-adv margin-bottom-10' width='100%'><tr>";
$output .= '<td>';
$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>';
echo __('Search by module group').'&nbsp;';
html_print_input_text('module_group_search', $module_group_search);
$output .= '</td><td>';
$output .= html_print_label_input_block(
__('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>';
echo "<input name='srcbutton' type='submit' class='sub search' value='".__('Search')."'>";
echo '</form>';
echo '<td>';
echo '</tr></table>';
$output .= html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('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 = '
min-width: 60px;
@ -299,26 +343,35 @@ function mainModuleGroups()
if ($info && $array_module_group) {
$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%';
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$background_color = '#333';
} else {
$background_color = '#fff';
}
$head[0] = __('Groups');
$headstyle[0] = 'width: 20%; font-weight: bolder;';
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;';
$head[] = ui_print_truncate_text($value, GENERIC_SIZE_TEXT, true, true, true, '&hellip;', 'color:#FFF');
$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,
'&hellip;'
);
}
$i = 0;
foreach ($array_for_defect as $key => $value) {
$deep = groups_get_group_deep($key);
$data[$i][0] = $deep.ui_print_truncate_text($value['data']['name'], GENERIC_SIZE_TEXT, true, true, true, '&hellip;', 'color:#FFF');
$data[$i][0] = $deep.ui_print_truncate_text(
$value['data']['name'],
GENERIC_SIZE_TEXT,
true,
true,
true,
'&hellip;'
);
$j = 1;
if (isset($array_data[$key])) {
foreach ($value['gm'] as $k => $v) {
@ -378,25 +431,37 @@ function mainModuleGroups()
$table->headstyle = $headstyle;
$table->data = $data;
ui_pagination($counter);
echo "<div class='w100p' style='overflow-x:auto;'>";
html_print_table($table);
echo '</div>';
ui_pagination($counter);
$tablePagination = ui_pagination(
$counter,
false,
0,
0,
true,
'offset',
false
);
echo "<div class='legend_basic w99p'>";
echo '<table >';
echo "<tr><td colspan='2' class='pdd_b_10px'><b>".__('Legend').'</b></td></tr>';
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>';
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>';
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>';
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>';
echo '</table>';
echo '</div>';
html_print_action_buttons(
'',
[ 'right_content' => $tablePagination ]
);
$show_legend = '<div>';
$show_legend .= '<table>';
$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>';
$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>';
$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>';
$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 {
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') ]);

View File

@ -11,11 +11,12 @@
// 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 view_logfile($file_name)
function view_logfile($file_name, $toggle=false)
{
global $config;
$memory_limit = ini_get('memory_limit');
$code = '';
if (strstr($memory_limit, 'M') !== false) {
$memory_limit = str_replace('M', '', $memory_limit);
@ -31,21 +32,37 @@ function view_logfile($file_name)
$file_size = filesize($file_name);
if ($memory_limit < $file_size) {
echo "<h2>$file_name (".__('File is too large than PHP memory allocated in the system.').')</h2>';
echo '<h2>'.__('The preview file is imposible.').'</h2>';
$code .= '<pre><h2>'.$file_name.' ('.__('File is too large than PHP memory allocated in the system.').')</h2>';
$code .= '<h2>'.__('The preview file is imposible.').'</h2>';
} else if ($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>';
echo "<textarea class='pandora_logs' name='$file_name'>";
echo '... ';
echo $data;
echo '</textarea><br><br>';
$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>';
$code .= "<textarea class='pandora_logs' name='$file_name'>";
$code .= '... ';
$code .= $data;
$code .= '</textarea><br><br>';
} else {
$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>';
echo "<textarea class='pandora_logs' name='$file_name'>";
echo $data;
echo '</textarea><br><br>';
$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>';
$code .= "<textarea class='pandora_logs' name='$file_name'>";
$code .= $data;
$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;
}
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>';
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>';
ui_print_info_message(
__('Use this tool to view your %s logfiles directly on the console', get_product_name()).'<br>
'.__('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';
// Do not attempt to show console log if disabled.
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.error');
view_logfile($logs_directory.'/pandora_server.log', true);
view_logfile($logs_directory.'/pandora_server.error', true);
}

View File

@ -151,7 +151,7 @@ function quickShell()
'name' => 'submit',
'label' => __('Retry'),
'type' => 'submit',
'attributes' => 'class="sub next"',
'attributes' => ['icon' => 'next'],
'return' => true,
],
],
@ -202,7 +202,7 @@ function quickShell()
'arguments' => [
'type' => 'submit',
'label' => __('Connect'),
'attributes' => 'class="sub next"',
'attributes' => ['icon' => 'cog'],
],
],
],
@ -544,7 +544,7 @@ if (empty($agent_id) === false
// TabName.
__('QuickShell'),
// TabIcon.
'images/ehorus/terminal.png',
'images/quick-shell@svg.svg',
// TabFunction.
'quickShell',
// Version.

View File

@ -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->width = '100%';
$table->id = 'table-form';
$table->class = 'databox filters';
$table->class = 'filter-table-adv';
$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 = [];
$graph_fields['cpu_load'] = __('%s Server CPU', get_product_name());
@ -158,15 +108,22 @@ function pandora_realtime_graphs()
$refresh = get_parameter('refresh', '1000');
if ($graph != 'snmp_module') {
$data['graph'] = __('Graph').'&nbsp;&nbsp;';
$data['graph'] .= html_print_select(
$graph_fields,
'graph',
$graph,
'',
'',
0,
true
$data['graph'] = html_print_label_input_block(
__('Graph'),
html_print_select(
$graph_fields,
'graph',
$graph,
'',
'',
0,
true,
false,
true,
'',
false,
'width: 100%'
)
);
}
@ -179,18 +136,35 @@ function pandora_realtime_graphs()
$agent_alias = io_safe_output(get_parameter('agent_alias', ''));
$module_name = io_safe_output(get_parameter('module_name', ''));
$module_incremental = get_parameter('incremental', 0);
$data['module_info'] = $agent_alias.': <b>'.$module_name.'</b>';
// Append all the hidden in this cell.
$data['module_info'] .= html_print_input_hidden(
'incremental',
$module_incremental,
true
$data['module_info'] = html_print_label_input_block(
$agent_alias.': '.$module_name,
html_print_input_hidden(
'incremental',
$module_incremental,
true
).html_print_select(
['snmp_module' => '-'],
'graph',
'snmp_module',
'',
'',
0,
true,
false,
true,
'',
false,
'width: 100%; display: none;'
)
);
$data['module_info'] .= html_print_select(
['snmp_module' => '-'],
'graph',
'snmp_module',
}
$data['refresh'] = html_print_label_input_block(
__('Refresh interval'),
html_print_select(
$refresh_fields,
'refresh',
$refresh,
'',
'',
0,
@ -199,33 +173,17 @@ function pandora_realtime_graphs()
true,
'',
false,
'display: none;'
'width: 100%'
)
);
if ($graph != 'snmp_module') {
$data['incremental'] = html_print_label_input_block(
__('Incremental'),
html_print_checkbox_switch('incremental', 1, 0, true)
);
}
$data['refresh'] = __('Refresh interval').'&nbsp;&nbsp;';
$data['refresh'] .= html_print_select(
$refresh_fields,
'refresh',
$refresh,
'',
'',
0,
true
);
if ($graph != 'snmp_module') {
$data['incremental'] = __('Incremental').'&nbsp;&nbsp;';
$data['incremental'] .= html_print_checkbox('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;
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', ''));
// Print the form.
echo '<form id="realgraph" method="post">';
html_print_table($table);
echo '</form>';
$searchForm = '<form id="realgraph" method="post">';
$searchForm .= html_print_table($table, true);
$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
// the OID selected in the SNMP browser to the form.
html_print_input_hidden(

View File

@ -12,6 +12,5 @@
#graph_container {
width: 800px;
margin: 20px auto;
background-color: white;
border-radius: 3px;
}

View File

@ -1,16 +1,32 @@
<?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
// ==================================================
// 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.
// Load global vars.
if (isset($_GET['get_ptr'])) {
if ($_GET['get_ptr'] == 1) {
$ownDir = dirname(__FILE__).'/';
@ -123,13 +139,6 @@ function output_xml_report($id)
$agent = null;
switch (io_safe_output($item['type'])) {
case 1:
case 'simple_graph':
break;
case 'simple_baseline_graph':
break;
case 2:
case 'custom_graph':
case 'automatic_custom_graph':
@ -169,30 +178,6 @@ function output_xml_report($id)
}
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':
echo '<text><![CDATA['.io_safe_output($item['text'])."]]></text>\n";
break;
@ -224,18 +209,6 @@ function output_xml_report($id)
echo '<group><![CDATA['.io_safe_output($group)."]]></group>\n";
break;
case 'event_report_module':
break;
case 'alert_report_module':
break;
case 'alert_report_agent':
break;
case 'alert_report_group':
break;
case 'url':
echo '<url><![CDATA['.io_safe_output($values['external_source']).']]></url>';
break;
@ -245,6 +218,29 @@ function output_xml_report($id)
echo '<line_separator><![CDATA['.io_safe_output($item['line_separator']).']]></line_separator>';
echo '<column_separator><![CDATA['.io_safe_output($item['header_definition']).']]></column_separator>';
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";
@ -417,25 +413,59 @@ function resource_exportation_extension_main()
$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>';
echo __('This extension makes exportation of resource template more easy.').' '.__('You can export resource templates in .ptr format.');
echo '</div>';
echo '<br /><br />';
ui_print_warning_message(
__('This extension makes exportation of resource template more easy.').'<br>'.__('You can export resource templates in .ptr format.')
);
$table = new stdClass();
$table->width = '100%';
$table->style[0] = 'width: 30%;';
$table->style[1] = 'width: 10%;';
$table->class = 'databox filters';
$table->data[0][0] = __('Report');
$table->data[0][1] = html_print_select_from_sql('SELECT id_report, name FROM treport', 'report', '', '', '', 0, true);
$table->data[0][2] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'report\');', 'class="sub config"', true);
$table->data[1][0] = __('Visual console');
$table->data[1][1] = html_print_select_from_sql('SELECT id, name FROM tlayout', 'visual_console', '', '', '', 0, true);
$table->data[1][2] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'visual_console\');', 'class="sub config"', true);
$table->class = 'databox filter-table-adv';
$table->id = 'resource_exportation_table';
$table->style = [];
$table->style[0] = 'width: 30%';
$table->style[1] = 'vertical-align: bottom;';
$table->data = [];
$table->data[0][] = html_print_label_input_block(
__('Report'),
html_print_div(
[
'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) {
add_rows_for_enterprise($table->data);

View File

@ -1,4 +1,5 @@
<?php
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
/**
* 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
* This program is free software; you can redistribute it and/or
* 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']) {
case 1:
case 'simple_graph':
break;
case 'simple_baseline_graph':
break;
case 2:
case 'custom_graph':
case 'automatic_custom_graph':
@ -361,30 +355,6 @@ function process_upload_xml_report($xml, $group_filter=0)
}
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':
$values['text'] = io_safe_input($item['text']);
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));
break;
case 'event_report_module':
break;
case 'alert_report_module':
break;
case 'alert_report_agent':
break;
case 'alert_report_group':
break;
case 'url':
$values['external_source'] = io_safe_input($item['url']);
break;
@ -426,9 +384,32 @@ function process_upload_xml_report($xml, $group_filter=0)
$values['line_separator'] = io_safe_input($item['line_separator']);
$values['column_separator'] = io_safe_input($item['column_separator']);
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);
ui_print_result_message(
$id_content,
@ -782,7 +763,7 @@ function process_upload_xml_visualmap($xml, $filter_group=0)
function process_upload_xml_component($xml)
{
// Extract components
// Extract components.
$components = [];
foreach ($xml->xpath('/component') as $componentElement) {
$name = io_safe_input((string) $componentElement->name);
@ -838,7 +819,7 @@ function process_upload_xml_component($xml)
$idComponent = false;
switch ((int) $componentElement->module_source) {
case 1:
// Local component
// Local component.
$values = [
'description' => $description,
'id_network_component_group' => $group,
@ -854,12 +835,12 @@ function process_upload_xml_component($xml)
// Network component
// for modules
// 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_2 = '';
$custom_string_3 = '';
if ($type >= 15 && $type <= 18) {
// New support for snmp v3
// New support for snmp v3.
$tcp_send = $snmp_version;
$plugin_user = $auth_user;
$plugin_pass = $auth_password;
@ -909,13 +890,13 @@ function process_upload_xml_component($xml)
'post_process' => $post_process,
]
);
if ((bool) $idComponent) {
if ((bool) $idComponent === true) {
$components[] = $idComponent;
}
break;
case 4:
// Plugin component
// Plugin component.
$idComponent = network_components_create_network_component(
$name,
$type,
@ -956,17 +937,13 @@ function process_upload_xml_component($xml)
'post_process' => $post_process,
]
);
if ((bool) $idComponent) {
if ((bool) $idComponent === true) {
$components[] = $idComponent;
}
break;
case 5:
// Prediction component
break;
case 6:
// WMI component
// WMI component.
$idComponent = network_components_create_network_component(
$name,
$type,
@ -1013,13 +990,17 @@ function process_upload_xml_component($xml)
'post_process' => $post_process,
]
);
if ((bool) $idComponent) {
if ((bool) $idComponent === true) {
$components[] = $idComponent;
}
break;
case 5:
// Prediction component.
case 7:
// Web component
// Web component.
default:
// Do nothing.
break;
}
@ -1030,9 +1011,9 @@ function process_upload_xml_component($xml)
);
}
// Extract the template
// Extract the template.
$templateElement = $xml->xpath('//template');
if (!empty($templateElement)) {
if (empty($templateElement) === false) {
$templateElement = $templateElement[0];
$templateName = (string) $templateElement->name;
@ -1092,9 +1073,26 @@ function resource_registration_extension_main()
include_once $config['homedir'].'/include/functions_db.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.'));
return;
@ -1119,15 +1117,42 @@ function resource_registration_extension_main()
return;
}
echo '<div class=notify>';
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>');
echo '</div>';
ui_print_warning_message(
__('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 '<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.
echo "<form name='submit_plugin' method='post' enctype='multipart/form-data'>";
echo '<table class="databox" id="table1" width="98%" border="0" cellpadding="4" cellspacing="4">';
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 '<tr>';
echo "<td colspan='2' class='datos'><input type='file' name='resource_upload' accept='.ptr'/>";
echo '<td>'.__('Group filter: ').'</td>';
@ -1136,8 +1161,7 @@ function resource_registration_extension_main()
echo '</td>';
echo "<td class='datos'><input type='submit' class='sub next' value='".__('Upload')."' />";
echo '</tr>';
echo '</table>';
echo '</form>';
echo '</table>';*/
if (isset($_FILES['resource_upload']['tmp_name']) === false) {
return;

View File

@ -1,16 +1,33 @@
<?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
// ==================================================
// 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.
// Begin.
function users_extension_main()
{
users_extension_main_god(false);
@ -34,7 +51,24 @@ function users_extension_main_god($god=true)
}
// 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');
if ($check_profile === false && !users_is_admin()) {

View File

@ -2,6 +2,8 @@ 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,

View File

@ -0,0 +1,90 @@
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&#x20;safe&#x20;mode&#x20;not&#x20;enable', 'select&#x20;alias&#x20;from&#x20;tagente&#x20;where&#x20;safe_mode_module&#x20;=&#x20;0');
COMMIT;

View File

@ -1,16 +1,32 @@
<?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
// ==================================================
// 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.
// Load globals.
global $config;
check_login();
ui_require_css_file('first_task');
@ -24,7 +40,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
<?php echo html_print_image('images/first_task/icono_grande_reconserver.png', true, ['title' => __('Custom Fields')]); ?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Custom Fields'); ?></h3><p id="description_task">
<h3> <?php echo __('Create Custom Fields'); ?></h3><p id="description_task">
<?php
echo __(
"Custom fields are an easy way to personalized agent's information.
@ -33,6 +49,20 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
?>
</p>
<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'); ?>" />
</form>
</div>

View File

@ -15,9 +15,6 @@ global $config;
check_login();
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="image_task">
@ -36,7 +33,17 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
?>
</p>
<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>
</div>
</div>

View File

@ -1,28 +1,38 @@
<?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
// ==================================================
// 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.
// Begin.
global $config;
global $vconsoles_write;
global $vconsoles_manage;
check_login();
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) {
?>
@ -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')]); ?>
</div>
<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
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'.",
@ -41,8 +51,18 @@ if ($vconsoles_write || $vconsoles_manage) {
?>
</p>
<form action="index.php?sec=network&amp;sec2=godmode/reporting/visual_console_builder" method="post">
<?php html_print_input_hidden('edit_layout', 1); ?>
<input type="submit" class="button_task" value="<?php echo __('Create Visual Console'); ?>" />
<?php
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>
</div>
</div>

View File

@ -1,16 +1,32 @@
<?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
// ==================================================
// 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.
// Begin.
global $config;
check_login();
ui_require_css_file('first_task');
@ -22,7 +38,7 @@ ui_require_css_file('first_task');
<?php echo html_print_image('images/first_task/icono_grande_visualconsole.png', true, ['title' => __('Scehduled Downtime')]); ?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Scheduled Downtime'); ?></h3><p id="description_task">
<h3> <?php echo __('Create Scheduled Downtime'); ?></h3><p id="description_task">
<?php
echo __(
"%s contains a scheduled downtime management system.
@ -34,7 +50,12 @@ ui_require_css_file('first_task');
?>
</p>
<form action="index.php?sec=extensions&amp;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>
</div>
</div>

View File

@ -1,29 +1,44 @@
<?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
// ==================================================
// 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.
// Begin.
global $config;
check_login();
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) { ?>
<div class="new_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 class="text_task">
<h3> <?php echo __('Create Services'); ?></h3>
<h3> <?php echo __('Services'); ?></h3>
<p id="description_task">
<?php
echo __(
@ -37,9 +52,18 @@ ui_require_css_file('first_task');
?>
</p>
<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>
</div>
</div>
<?php

View File

@ -26,7 +26,7 @@ config_check();
echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
?>
<div id="header_table_inner">
<div id="header_table_inner">
<?php
// ======= Notifications Discovery ===============================================
$notifications_numbers = notifications_get_counters();
@ -37,7 +37,6 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
// ======= Servers List ===============================================
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
$servers_list = '<div id="servers_list">';
$servers = [];
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
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']);
if ($servers['up'] == 0) {
// 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) {
// 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 {
// 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);
// 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 .= $servers_check_img;
$servers_check_img_link .= '</a>';
$servers_check_img_link = html_print_anchor(
[
'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();
if ($check_minor_release_available) {
if ($check_minor_release_available === true) {
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');
} 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');
@ -227,10 +237,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
if ($do_refresh) {
$autorefresh_img = html_print_image(
'images/header_refresh_gray.png',
'images/auto_refresh@header.svg',
true,
[
'class' => 'bot',
'class' => 'main_menu_icon bot',
'alt' => 'lightning',
'title' => __('Configure autorefresh'),
]
@ -293,10 +303,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$display_counter = 'display:block';
} else {
$autorefresh_img = html_print_image(
'images/header_refresh_disabled_gray.png',
'images/auto_refresh@header.svg',
true,
[
'class' => 'bot autorefresh_disabled invert_filter',
'class' => 'main_menu_icon bot autorefresh_disabled invert_filter',
'alt' => 'lightning',
'title' => __('Disabled autorefresh'),
]
@ -312,10 +322,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
}
} else {
$autorefresh_img = html_print_image(
'images/header_refresh_disabled_gray.png',
'images/auto_refresh@header.svg',
true,
[
'class' => 'bot autorefresh_disabled invert_filter',
'class' => 'main_menu_icon bot autorefresh_disabled invert_filter',
'alt' => 'lightning',
'title' => __('Disabled autorefresh'),
]
@ -350,9 +360,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="msg-header" class="invisible"></div>';
$header_feedback .= html_print_image(
'images/feedback-header.png',
'images/send_feedback@header.svg',
true,
[
'class' => 'main_menu_icon invert_filter',
'title' => __('Feedback'),
'id' => 'feedback-header',
'alt' => __('Feedback'),
@ -373,11 +384,11 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$header_support = '<div id="header_support">';
$header_support .= '<a href="'.ui_get_full_external_url($header_support_link).'" target="_blank">';
$header_support .= html_print_image(
'images/header_support.png',
'images/support@header.svg',
true,
[
'title' => __('Go to support'),
'class' => 'bot invert_filter',
'class' => 'main_menu_icon bot invert_filter',
'alt' => 'user',
]
);
@ -387,11 +398,11 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$header_docu = '<div id="header_docu">';
$header_docu .= '<a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">';
$header_docu .= html_print_image(
'images/header_docu.png',
'images/documentation@header.svg',
true,
[
'title' => __('Go to documentation'),
'class' => 'bot invert_filter',
'class' => 'main_menu_icon bot invert_filter',
'alt' => 'user',
]
);
@ -399,34 +410,38 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
// User.
if (is_user_admin($config['id_user']) == 1) {
$header_user = html_print_image(
'images/header_user_admin_green.png',
true,
[
'title' => __('Edit my user'),
'class' => 'bot',
'alt' => 'user',
]
);
} else {
$header_user = html_print_image(
'images/header_user_green.png',
true,
[
'title' => __('Edit my user'),
'class' => 'bot',
'alt' => 'user',
]
);
}
// $headerUserImage = (is_user_admin($config['id_user']) === true) ? 'images/header_user_admin_green.png' : 'images/header_user_green.png';
$headerUser = [];
$headerUser[] = html_print_image(
'images/edit_user@header.svg',
true,
[
'title' => __('Edit my user'),
'class' => 'main_menu_icon bot invert_filter',
'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.
$header_logout = '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
$header_logout .= html_print_image(
'images/header_logout_gray.png',
'images/sign_out@header.svg',
true,
[
'alt' => __('Logout'),
@ -456,10 +471,6 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
</div> <!-- Closes #table_header_inner -->
</div> <!-- Closes #table_header -->
<!-- Notifications content wrapper-->
<div id='notification-content' class='invisible'/></div>
<!-- Old style div wrapper -->
<div id="alert_messages" class="invisible"></div>

View File

@ -30,16 +30,21 @@ require_once __DIR__.'/../include/functions_html.php';
if ($config['visual_animation']) {
echo '<style>
@keyframes login_move {
from {margin-left: 10%;margin-right: 10%;opacity:0.1}
to {margin-left: 5%;margin-right: 5%;opacity:1}
}
div.container_login{
animation-name: login_move;
animation-duration: 3s;
}
div.container_login {
animation: container_login 3s ease;
}
@keyframes container_login {
0% {
transform: scale(.9);
opacity: 0.1;
}
100% {
transform: scale(1);
opacity: 1;
}
}
</style>';
}
@ -87,18 +92,36 @@ if (!empty($page) && !empty($sec)) {
}
$login_body_style = '';
$login_body_class = '';
// 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'];
$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
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.
$custom_fields = [
'custom_logo_login',
@ -123,36 +146,36 @@ foreach ($custom_fields as $field) {
// Get the custom icons.
$docs_logo = ui_get_docs_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="list_icon_docs_support"><ul>';
if (isset($config['custom_docs_url'])) {
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) {
echo '<li><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_img"><a href="https://pandorafms.com/manual/" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
echo '<li id="li_margin_doc"><a href="https://pandorafms.com/manual/" target="_blank">'.__('Docs').'</li>';
}
if (isset($config['custom_support_url'])) {
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
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 {
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>'.__('Support').'</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 id="li_margin_support"><a href="https://support.pandorafms.com" target="_blank">'.__('Support').'</a></li>';
}
} 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><a href="https://support.pandorafms.com" target="_blank">'.__('Docs').'</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 id="li_margin_support"><a href="https://support.pandorafms.com" target="_blank">'.__('Support').'</a></li>';
}
echo '</ul></div>';
@ -248,15 +271,30 @@ switch ($login_screen) {
echo '</div>';
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 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 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>';
} else {
echo '<div class="login_nick">';
@ -288,7 +326,15 @@ switch ($login_screen) {
);
echo '</div>';
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>';
}
break;
@ -302,12 +348,13 @@ switch ($login_screen) {
echo '<div class="login_nick">';
echo '<div>';
html_print_image('/images/icono_autenticacion.png', false);
echo '</div>';
html_print_input_text_extended('auth_code', '', 'auth_code', '', '', '', false, '', 'class="login login_password" placeholder="'.__('Authentication code').'"', false, true);
echo '</div>';
echo '<div class="login_button">';
html_print_submit_button(__('Check code').'&nbsp;&nbsp;>', 'login_button', false, 'class="next_login"');
// html_print_submit_button(__('Check code').'&nbsp;&nbsp;>', 'login_button', false, 'class="next_login"');
html_print_submit_button(__('Check code').'&nbsp;&nbsp;>', 'login_button', false, [ 'fixed_id' => 'submit-login_button', 'class' => 'next_login']);
echo '</div>';
break;
@ -337,17 +384,18 @@ if ($config['enterprise_installed']) {
echo '<a href="javascript:centralized_mode_reset_dialog();">'.__('Forgot your password?');
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="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 class="content_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 '</div>';
echo '<br>';
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>';
@ -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.
if (isset($_SESSION['csrf_code']) === true) {
unset($_SESSION['csrf_code']);
}
html_print_csrf_hidden();
echo '</form></div>';
echo '<div class="login_data">';
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 ($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 class ="img_banner_login">';
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(
'enterprise/images/custom_splash_login/'.$config['custom_splash_login'],
false,
@ -403,25 +465,39 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
false
);
} else {
html_print_image(
'enterprise/images/custom_splash_login/splash_image_default.png',
false,
[
'alt' => 'logo',
'border' => 0,
],
false,
false
);
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>
';
}
} 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 id="ver_num">'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '').'</div>';
echo '</div>';
if (empty($process_error_message) && isset($mail)) {
@ -435,25 +511,28 @@ if (empty($process_error_message) && isset($mail)) {
echo '<h1>'.__('INFO').'</h1>';
echo '<p>'.__('An email has been sent to your email address').'</p>';
echo '</div>';
echo '<br>';
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>';
} 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="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 class="content_message_alert">';
echo '<div class="text_message_alert">';
echo '<h1>'.__('ERROR').'</h1>';
echo '<p>'.$process_error_message.'</p>';
echo '<br>';
echo '</div>';
echo '<br>';
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>';
@ -472,8 +551,9 @@ if (isset($correct_reset_pass_process)) {
echo '<h1>'.__('SUCCESS').'</h1>';
echo '<p>'.$correct_reset_pass_process.'</p>';
echo '</div>';
echo '<br>';
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>';
@ -481,9 +561,36 @@ if (isset($correct_reset_pass_process)) {
}
if (isset($login_failed)) {
$nick = get_parameter_post('nick');
$fails = db_get_value('failed_attempt', 'tusuario', 'id_user', $nick);
$nick = io_safe_input(get_parameter_post('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 = ($attemps < 0) ? 0 : $attemps;
echo '<div id="login_failed" title="'.__('Login failed').'">';
echo '<div class="content_alert">';
echo '<div class="icon_message_alert">';
@ -496,12 +603,18 @@ if (isset($login_failed)) {
echo '</div>';
if ($config['enable_pass_policy']) {
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 '<br>';
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>';
@ -524,8 +637,9 @@ if ($login_screen == 'logout') {
}
echo '</div>';
echo '<br>';
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>';
@ -543,8 +657,9 @@ if ($login_screen === 'disabled_access_node') {
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 '</div>';
echo '<br>';
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>';
@ -651,8 +766,9 @@ if ($login_screen == 'error_authconfig' || $login_screen == 'error_emptyconfig'
echo '<h1>'.$title.'</h1>';
echo '<p> '.$message.'</h1>';
echo '</div>';
echo '<br>';
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>';
@ -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');
});
@ -722,19 +838,23 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
resizable: true,
draggable: true,
modal: true,
height: 220,
width: 528,
clickOutside: true,
overlay: {
opacity: 0.5,
background: "black"
},
open: function (event, ui) {
$(".ui-widget-overlay").click(function () {
$('#login_logout').dialog('close');
});
}
});
});
$("#submit-hide-login-logout").click (function () {
document.location = "<?php echo ui_get_full_url('index.php'); ?>";
});
$("#button-hide-login-logout").click (function () {
$( "#login_logout" ).dialog( "close" );
});
});
break;
@ -745,7 +865,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
resizable: true,
draggable: true,
modal: true,
height: 220,
width: 528,
clickOutside: true,
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'); ?>";
});
});
@ -769,7 +888,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
resizable: true,
draggable: true,
modal: true,
height: 400,
width: 700,
overlay: {
opacity: 0.5,
@ -787,8 +905,8 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
resizable: true,
draggable: true,
modal: true,
height: 220,
width: 528,
height: 230,
width: 530,
overlay: {
opacity: 0.5,
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_correct_pass").dialog('close');
});
});
$('#nick').focus();
break;
}
@ -812,7 +929,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
resizable: true,
draggable: true,
modal: true,
height: 220,
width: 528,
clickOutside: true,
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');
});
});
@ -833,7 +949,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
resizable: true,
draggable: true,
modal: true,
height: 220,
width: 528,
clickOutside: true,
overlay: {
@ -853,7 +968,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
resizable: true,
draggable: true,
modal: true,
height: 220,
width: 528,
overlay: {
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>

View File

@ -124,8 +124,14 @@ foreach ($stats as $stat) {
}
$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->rowclass[] = '';
$table->data[] = $tdata;

View File

@ -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
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -26,38 +26,21 @@
* ============================================================================
*/
use function PHPSTORM_META\map;
// Begin.
if (isset($config['id_user']) === false) {
include 'general/login_page.php';
exit();
}
?>
<script type="text/javascript" language="javascript">
require_once 'include/functions_menu.php';
$(document).ready(function(){
var menuType_value = "<?php echo ($_SESSION['menu_type'] ?? ''); ?>";
// Global variable. Do not delete.
$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.
echo sprintf('<div id="menu_full" class="menu_full_%s">', $menuTypeClass);
$url_logo = ui_get_full_url('index.php');
if (is_reporting_console_node() === true) {
$url_logo = 'index.php?logged=1&sec=discovery&sec2=godmode/servers/discovery&wiz=tasklist';
@ -76,311 +59,401 @@ html_print_div(
),
],
true
),
).'<div id="button_collapse" class="button_'.$menuTypeClass.'" style="cursor: pointer"></div>',
]
);
require 'operation/menu.php';
require 'godmode/menu.php';
$display_classic = '';
$display_collapsed = 'display: none;';
if ($menuTypeClass === 'collapsed') {
$display_classic = 'display: none;';
$display_collapsed = '';
}
html_print_div(
[
'id' => 'button_collapse',
'class' => sprintf('button_collapse button_%s', $menuTypeClass),
]
);
// Tabs.
echo '<div id="menu_tabs">';
// 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>';
// Menu_container.
ui_require_jquery_file('cookie');
$config_fixed_header = false;
if (isset($config['fixed_header']) === true) {
$config_fixed_header = $config['fixed_header'];
}
echo '<div id="div_display">';
require 'operation/menu.php';
echo '</div>';
echo '<div id="div_management">';
require 'godmode/menu.php';
echo '</div>';
echo '</div>';
?>
<script type="text/javascript" language="javascript">
/* <![CDATA[ */
$('#button_collapse').on('click', function() {
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')){
localStorage.setItem("menuType", "classic");
$('ul.submenu').css('left', '214px');
var menuType_val = localStorage.getItem("menuType");
$.ajax({
type: "POST",
url: "ajax.php",
data: {
menuType: menuType_val,
page: "include/functions_menu"
},
dataType: "json"
});
}
$('.logo_full').toggle();
$('.logo_icon').toggle();
$('#menu_full').toggleClass('menu_full_classic menu_full_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');
$('#header_table').toggleClass('header_table_classic header_table_collapsed');
$('li.menu_icon').toggleClass("no_hidden_menu menu_icon_collapsed");
});
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 () {
$.each(menuState, function (index, value) {
if (value)
$('div.menu>ul>li#' + index + '>ul').hide();
});
//$('div.menu>ul>li.selected>ul').addClass('invisible');
}
/* ]]> */
</script>
<script type="text/javascript">
openTime = 0;
openTime2 = 0;
handsIn = 0;
handsIn2 = 0;
/**
* 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 {
total = (level1 + level2);
comp = level2;
}
// Positionate in the middle
if (total > 12 && ((total < 18) || ((level1 - comp) <= 4))) {
return - ( Math.floor(comp / 2) * item_height);
}
// Positionate in the bottom
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() {
table_hover = $(this);
handsIn = 1;
openTime = new Date().getTime();
$("ul#sub"+table_hover[0].id).show();
get_menu_items(table_hover);
if( typeof(table_noHover) != 'undefined')
if ( "ul#sub"+table_hover[0].id != "ul#sub"+table_noHover[0].id )
$("ul#sub"+table_noHover[0].id).hide();
}).mouseleave(function() {
table_noHover = $(this);
handsIn = 0;
setTimeout(function() {
opened = new Date().getTime() - openTime;
if(opened > 3000 && handsIn == 0) {
openTime = 4000;
$("ul#sub"+table_noHover[0].id).hide();
}
}, 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();
menuActionButtonResizing();
const menuTypeClass = '<?php echo $menuTypeClass; ?>';
if (menuTypeClass === 'classic' && menuTypeClass !== localStorage.getItem('menuType')) {
localStorage.setItem('menuType', 'classic');
}
const tab = '<?php echo $tab_active; ?>';
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");
$.ajax({
type: "POST",
url: "ajax.php",
data: {
menuType: menuType_val,
page: "include/functions_menu"
},
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_icon').toggle();
$('#menu_full').toggleClass('menu_full_classic menu_full_collapsed');
$('#button_collapse').toggleClass('button_classic button_collapsed');
$('div#page').toggleClass('page_classic page_collapsed');
$('#header_table').toggleClass('header_table_classic header_table_collapsed');
$('li.menu_icon').toggleClass("no_hidden_menu menu_icon_collapsed");
menuActionButtonResizing();
});
const id_selected = '<?php echo $menu1_selected; ?>';
if (id_selected != '') {
var menuType_val = localStorage.getItem("menuType");
if (menuType_val === 'classic') {
$(`ul#subicon_${id_selected}`).show();
}
// 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; ?>';
if (id_selected2 != '') {
if ($(`#sub${id_selected2}`).length > 0) {
$(`#sub${id_selected2}`).show();
// Arrow.
$(`#${id_selected2}`).children().first().children().last().removeClass('arrow_menu_down');
$(`#${id_selected2}`).children().first().children().last().addClass('arrow_menu_up');
// Span.
$(`#${id_selected2}`).children().first().children().first().addClass('span_selected');
// Vertical line.
$(`.sub_subMenu.selected`).prepend(`<div class="element_submenu_selected left_3"></div>`);
} else {
$(`#${id_selected2}`).addClass('submenu_selected_no_submenu');
$(`#${id_selected2}`).children().first().children().first().css('color', '#fff');
// Vertical line.
$(`#${id_selected2}`).prepend(`<div class="element_submenu_selected"></div>`);
}
}
}
var click_display = "<?php echo $config['click_display']; ?>";
$('.menu_icon').mouseenter(function() {
var menuType_val = localStorage.getItem("menuType");
if (!click_display && menuType_val === 'collapsed') {
table_hover = $(this);
handsIn = 1;
openTime = new Date().getTime();
$("ul#sub"+table_hover[0].id).show();
get_menu_items(table_hover);
}).mouseleave(function() {
if (typeof(table_noHover) != 'undefined') {
if ("ul#sub"+table_hover[0].id != "ul#sub"+table_noHover[0].id ) {
$("ul#sub"+table_noHover[0].id).hide();
}
}
}
}).mouseleave(function() {
var menuType_val = localStorage.getItem("menuType");
if (!click_display && menuType_val === 'collapsed') {
table_noHover = $(this);
handsIn = 0;
setTimeout(function() {
opened = new Date().getTime() - openTime;
if(opened > 5000 && handsIn == 0) {
openTime = 6000;
if(opened > 2500 && handsIn == 0) {
openTime = 4000;
$("ul#sub"+table_noHover[0].id).hide();
}
}, 5500);
});
} else {
$('.menu_icon').on("click", function() {
if( typeof(table_hover) != 'undefined'){
}, 2500);
}
});
$('.has_submenu').mouseenter(function() {
var menuType_val = localStorage.getItem("menuType");
if (!click_display && menuType_val === 'collapsed') {
table_hover2 = $(this);
handsIn2 = 1;
openTime2 = new Date().getTime();
$("#sub"+table_hover2[0].id).show();
if( typeof(table_noHover2) != 'undefined') {
if ( "ul#sub"+table_hover2[0].id != "ul#sub"+table_noHover2[0].id ) {
$("ul#sub"+table_noHover2[0].id).hide();
}
}
}
}).mouseleave(function() {
var menuType_val = localStorage.getItem("menuType");
if (!click_display && menuType_val === 'collapsed') {
table_noHover2 = table_hover2;
handsIn2 = 0;
setTimeout(function() {
opened = new Date().getTime() - openTime2;
if(opened >= 3000 && handsIn2 == 0) {
openTime2 = 4000;
$("ul#sub"+table_hover2[0].id).hide();
}
}, 3500);
}
});
$('#container').click(function() {
var menuType_val = localStorage.getItem("menuType");
if (!click_display && menuType_val === 'collapsed') {
openTime = 4000;
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);
});
if( typeof(table_hover2) != 'undefined') {
$("ul#sub"+table_hover2[0].id).hide();
}
}
});
$('.title_menu_classic').click(function() {
var menuType_val = localStorage.getItem("menuType");
if (click_display || (!click_display && menuType_val === 'classic')) {
const table_hover = $(this).parent();
const id = table_hover[0].id;
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');
}
/**
* Positionate the submenu elements. Add a negative top.
*
* @param int index It is the position of li.menu_icon in the ul.
* @param int item_height It is the height of a menu item (35).
*
* @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;
}
});
}
$('.has_submenu').mouseenter(function() {
table_hover2 = $(this);
handsIn2 = 1;
openTime2 = new Date().getTime();
$("#sub"+table_hover2[0].id).show();
if( typeof(table_noHover2) != 'undefined')
if ( "ul#sub"+table_hover2[0].id != "ul#sub"+table_noHover2[0].id )
$("ul#sub"+table_noHover2[0].id).hide();
}).mouseleave(function() {
table_noHover2 = table_hover2;
handsIn2 = 0;
setTimeout(function() {
opened = new Date().getTime() - openTime2;
if(opened >= 3000 && handsIn2 == 0) {
openTime2 = 4000;
$("ul#sub"+table_hover2[0].id).hide();
}
}, 3500);
});
$(document).ready(function() {
if(!click_display){
$('#container').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();
});
}else{
$('#main').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();
});
}
$('div.menu>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();
});
$('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>

View File

@ -1,167 +1,77 @@
<html>
<head>
<style>
<?php
echo '<script src="'.ui_get_full_url('include/javascript/jquery.current.js', false, false, false).'" type="text/javascript"></script>';
#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;
$message = '';
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{
text-align:center;
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)) {
$custom_conf_enabled = true;
break;
}
$custom_conf_enabled = false;
foreach ($config as $key => $value) {
if (preg_match('/._alt/i', $key)) {
$custom_conf_enabled = true;
break;
}
}
if (!$custom_conf_enabled || isset($config['custom_docs_url_alt'])) {
if (isset($config['custom_docs_url_alt'])) {
$docs_url = $config['custom_docs_url_alt'];
} else {
$docs_url = 'https://pandorafms.com/manual/en/documentation/02_installation/04_configuration';
}
echo '
<a href="'.ui_get_full_external_url($docs_url).'" target="_blank">
<div class="modalwikibutto">
<span class="modalwikibuttontex">'.__('Documentation').'
</span>
</div>
</a>
';
if (empty($custom_conf_enabled) === true || isset($config['custom_docs_url_alt']) === true) {
if (isset($config['custom_docs_url_alt']) === true) {
$docs_url = $config['custom_docs_url_alt'];
} else {
$docs_url = 'https://pandorafms.com/manual/en/documentation/02_installation/04_configuration';
}
}
echo '<div id="mysqlerr" title="'.__('Error').'">';
echo '<div class="content_alert">';
echo '<div class="icon_message_alert">';
echo html_print_image('images/mysqlerr.png', true, ['alt' => __('Mysql error'), 'border' => 0]);
echo '</div>';
echo '<div class="content_message_alert">';
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>
$(".modalclose").click(function(){
$('div#alert_messages_na').toggle();
$('div#opacity').toggle();
$(function() {
$("#mysqlerr").dialog({
resizable: true,
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>

View File

@ -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 '<br /><br />';
echo '<div id="footer_help">';
include 'footer.php';
// include 'footer.php';
return;
}
@ -100,7 +100,7 @@ ob_end_clean();
echo $help;
echo '</div>';
echo '<div id="footer_help">';
require 'footer.php';
// require 'footer.php';
echo '</div>';
?>
</body>

View File

@ -59,7 +59,7 @@ ui_print_warning_message(
]
);
$table = new StdClass();
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->data = [];

View File

@ -59,23 +59,22 @@ $result = integria_api_call(null, null, null, null, 'get_incidents', $params, fa
$result = json_decode($result, true);
$count = count($result);
$result = array_slice($result, $offset, $config['block_size']);
if (empty($result)) {
if (empty($result) === true) {
$result = [];
$count = 0;
echo '<div class="nf">'.__('No incidents associated to this agent').'</div><br />';
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');
// ($count + $offset) it's real count of incidents because it's use LIMIT $offset in query.
echo '<br />';
// Show headers
// Show headers.
$table->width = '100%';
$table->class = 'databox';
$table->cellpadding = 4;

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,35 @@
<?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;
// Load global vars
if (!isset($id_agente)) {
// Load global vars.
if (isset($id_agente) === false) {
die('Not Authorized');
}
@ -23,8 +38,8 @@ require_once $config['homedir'].'/include/functions_modules.php';
// ==========================
// TEMPLATE ASSIGMENT LOGIC
// ==========================
if (isset($_POST['template_id'])) {
// Take agent data
if (isset($_POST['template_id']) === true) {
// Take agent data.
$row = db_get_row('tagente', 'id_agente', $id_agente);
if ($row !== false) {
$intervalo = $row['intervalo'];
@ -49,7 +64,8 @@ if (isset($_POST['template_id'])) {
$npc = [];
}
$success_count = $error_count = 0;
$success_count = 0;
$error_count = 0;
$modules_already_added = [];
foreach ($npc as $row) {
@ -60,7 +76,7 @@ if (isset($_POST['template_id'])) {
}
foreach ($nc as $row2) {
// Insert each module from tnetwork_component into agent
// Insert each module from tnetwork_component into agent.
$values = [
'id_agente' => $id_agente,
'id_tipo_modulo' => $row2['type'],
@ -113,14 +129,14 @@ if (isset($_POST['template_id'])) {
$name = $row2['name'];
// Put tags in array if the component has to add them later
if (!empty($row2['tags'])) {
// Put tags in array if the component has to add them later.
if (empty($row2['tags']) === false) {
$tags = explode(',', $row2['tags']);
} else {
$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]);
if ($module_name_check !== false) {
@ -132,13 +148,13 @@ if (isset($_POST['template_id'])) {
if ($id_agente_modulo === false) {
$error_count++;
} else {
if (!empty($tags)) {
// Creating tags
if (empty($tags) === false) {
// Creating tags.
$tag_ids = [];
foreach ($tags as $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;
}
@ -152,7 +168,7 @@ if (isset($_POST['template_id'])) {
}
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));
} else {
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
// ==========================
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');
if ($nps === false) {
$nps = [];
@ -180,44 +194,45 @@ foreach ($nps as $row) {
$select[$row['id_np']] = $row['name'];
}
echo '<table width="100%" cellpadding="0" cellspacing="0" class="databox filters" >';
echo "<tr><td class='datos w50p'>";
html_print_select($select, 'template_id', '', '', '', 0, false, false, true, '', false, 'max-width: 200px !important');
echo '</td>';
echo '<td class="datos">';
html_print_submit_button(__('Assign'), 'crt', false, 'class="sub next mgn_tp_0"');
echo '</td>';
echo '</tr>';
echo '</form>';
echo '</table>';
echo '</form>';
$filterTable = new stdClass();
$filterTable->width = '100%';
$filterTable->class = 'fixed_filter_bar';
$filterTable->data = [];
$filterTable->data[0][0] = __('Module templates');
$filterTable->data[1][0] = html_print_select($select, 'template_id', '', '', '', 0, true, false, true, '', false, 'max-width: 200px !important');
$filterTable->data[1][1] = html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('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
// ==========================
switch ($config['dbtype']) {
case 'mysql':
case 'postgresql':
$sql = sprintf(
'SELECT *
FROM tagente_modulo
WHERE id_agente = %d AND delete_pending = false
ORDER BY id_module_group, nombre',
$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;
}
$sql = sprintf(
'SELECT *
FROM tagente_modulo
WHERE id_agente = %d AND delete_pending = false
ORDER BY id_module_group, nombre',
$id_agente
);
$result = db_get_all_rows_sql($sql);
if ($result === false) {
@ -233,10 +248,10 @@ $table->head = [];
$table->data = [];
$table->align = [];
$table->head[0] = __('Module name');
$table->head[1] = __('Type');
$table->head[2] = __('Description');
$table->head[3] = __('Action');
$table->head[0] = '<span>'.__('Module name').'</span>';
$table->head[1] = '<span>'.__('Type').'</span>';
$table->head[2] = '<span>'.__('Description').'</span>';
$table->head[3] = '<span>'.__('Action').'</span>';
$table->align[1] = 'left';
$table->align[3] = 'left';
@ -245,27 +260,43 @@ $table->size[1] = '5%';
$table->size[3] = '8%';
foreach ($result as $row) {
$table->cellclass[][3] = 'table_action_buttons';
$data = [];
$data[0] = '<span>'.$row['nombre'];
if ($row['id_tipo_modulo'] > 0) {
$data[1] = html_print_image('images/'.modules_show_icon_type($row['id_tipo_modulo']), true, ['border' => '0', 'class' => 'invert_filter']);
} else {
$data[1] = '';
}
$data[1] = ($row['id_tipo_modulo'] > 0) ? ui_print_moduletype_icon($row['id_tipo_modulo'], true, false, true) : '';
$data[2] = mb_substr($row['descripcion'], 0, 60);
$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>';
$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>';
$data[3] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'&delete_module='.$row['id_agente_modulo'],
'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);
}
if (!empty($table->data)) {
html_print_table($table);
unset($table);
if (empty($table->data) === false) {
$output = html_print_table($table, true);
} else {
ui_print_empty_data(__('No modules'));
$output = ui_print_empty_data(__('No modules'), '', true);
}
html_print_div(
[
'class' => 'datatable_form',
'content' => $output,
]
);

View File

@ -295,7 +295,6 @@ if ($create_agent) {
'fixed_ip' => $fixed_ip,
]
);
enterprise_hook('update_agent', [$id_agente]);
} else {
$id_agente = false;
}
@ -377,94 +376,97 @@ $img_style = [
if ($id_agente) {
// View tab.
$viewtab['text'] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/eye.png',
true,
$viewtab['text'] = html_print_anchor(
[
'title' => __('View'),
'class' => 'invert_filter',
]
).'</a>';
if ($tab == 'view') {
$viewtab['active'] = true;
} else {
$viewtab['active'] = false;
}
'href' => 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente,
'content' => html_print_image(
'images/enable.svg',
true,
[
'title' => __('View'),
'class' => 'invert_filter main_menu_icon',
]
),
],
true
);
$viewtab['active'] = ($tab === 'view');
$viewtab['operation'] = 1;
// Main tab.
$maintab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/gm_setup.png',
true,
$maintab['text'] = html_print_anchor(
[
'title' => __('Setup'),
'class' => 'invert_filter',
]
).'</a>';
if ($tab == 'main') {
$maintab['active'] = true;
} else {
$maintab['active'] = false;
}
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;id_agente='.$id_agente,
'content' => html_print_image(
'images/configuration@svg.svg',
true,
[
'title' => __('Setup'),
'class' => 'invert_filter main_menu_icon',
]
),
],
true
);
$maintab['active'] = ($tab === 'main');
// Module tab.
$moduletab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=module&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/gm_modules.png',
true,
$moduletab['text'] = html_print_anchor(
[
'title' => __('Modules'),
'class' => 'invert_filter',
]
).'</a>';
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=module&amp;id_agente='.$id_agente,
'content' => html_print_image(
'images/modules@svg.svg',
true,
[
'title' => __('Modules'),
'class' => 'invert_filter main_menu_icon',
]
),
],
true
);
if ($tab == 'module') {
$moduletab['active'] = true;
} else {
$moduletab['active'] = false;
}
$moduletab['active'] = ($tab === 'module');
// Alert tab.
$alerttab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=alert&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/gm_alerts.png',
true,
$alerttab['text'] = html_print_anchor(
[
'title' => __('Alerts'),
'class' => 'invert_filter',
]
).'</a>';
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=alert&amp;id_agente='.$id_agente,
'content' => html_print_image(
'images/alert@svg.svg',
true,
[
'title' => __('Alerts'),
'class' => 'invert_filter main_menu_icon',
]
),
],
true
);
if ($tab == 'alert') {
$alerttab['active'] = true;
} else {
$alerttab['active'] = false;
}
$alerttab['active'] = ($tab === 'alert');
// Template tab.
$templatetab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=template&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/templates.png',
true,
$templatetab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=template&amp;id_agente='.$id_agente,
'image' => 'images/modules-group@svg.svg',
'title' => __('Module templates'),
'class' => 'invert_filter',
]
).'</a>';
if ($tab == 'template') {
$templatetab['active'] = true;
} else {
$templatetab['active'] = false;
}
],
true
);
$templatetab['active'] = ($tab === 'template');
// Inventory.
$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,
[
'title' => __('Inventory'),
'class' => 'invert_filter',
'class' => 'main_menu_icon invert_filter',
]
).'</a>';
@ -474,11 +476,6 @@ if ($id_agente) {
$inventorytab['active'] = false;
}
if ($inventorytab == -1) {
$inventorytab = '';
}
$has_remote_conf = enterprise_hook(
'config_agents_has_remote_configuration',
[$id_agente]
@ -490,7 +487,7 @@ if ($id_agente) {
if ($has_remote_conf === true) {
// Plugins.
$pluginstab = enterprise_hook('plugins_tab');
if ($pluginstab == -1) {
if ($pluginstab === ENTERPRISE_NOT_HOOK) {
$pluginstab = '';
}
} else {
@ -498,60 +495,62 @@ if ($id_agente) {
}
// Collection.
$collectiontab = enterprise_hook('collection_tab');
if ($collectiontab == -1) {
if ((int) $config['license_nms'] !== 1) {
$collectiontab = enterprise_hook('collection_tab');
if ($collectiontab === ENTERPRISE_NOT_HOOK) {
$collectiontab = '';
}
} else {
$collectiontab = '';
}
// NetworkConfigManager tab.
$ncm_tab = enterprise_hook('networkconfigmanager_tab');
if ($ncm_tab === ENTERPRISE_NOT_HOOK) {
$ncm_tab = '';
}
// Group tab.
$grouptab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&ag_group='.$group.'">'.html_print_image(
'images/group.png',
true,
$grouptab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&ag_group='.$group,
'image' => 'images/groups@svg.svg',
'title' => __('Group'),
'class' => 'invert_filter',
]
).'</a>';
],
true
);
$grouptab['active'] = false;
$gistab = [];
// GIS tab.
if ($config['activate_gis']) {
$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>';
// TODO. OVERRIDE.
$config['activate_gis'] = true;
if ($tab == 'gis') {
$gistab['active'] = true;
} else {
$gistab['active'] = false;
}
// GIS tab.
if ((bool) $config['activate_gis'] === true) {
$gistab['text'] = html_print_menu_button(
[
'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['text'] = '<a href="javascript:" class="agent_wizard_tab">'.html_print_image(
'images/wand_agent.png',
true,
$agent_wizard['text'] = html_print_menu_button(
[
'href' => 'javascript:',
'class' => 'agent_wizard_tab',
'image' => 'images/wizard@svg.svg',
'title' => __('Agent wizard'),
'class' => 'invert_filter',
]
).'</a>';
],
true
);
// Hidden subtab layer.
$agent_wizard['sub_menu'] = '<ul class="mn subsubmenu invisible float-none">';
@ -599,42 +598,34 @@ if ($id_agente) {
// Incident tab.
if ($total_incidents > 0) {
$incidenttab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=incident&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/book_edit.png',
true,
$incidenttab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=incident&amp;id_agente='.$id_agente,
'image' => 'images/logs@svg.svg',
'title' => __('Incidents'),
'class' => 'invert_filter',
]
).'</a>';
],
true
);
if ($tab == 'incident') {
$incidenttab['active'] = true;
} else {
$incidenttab['active'] = false;
}
$incidenttab['active'] = ($tab === 'incident');
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
if ($has_remote_conf) {
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
if ($has_remote_conf !== false) {
$agent_name = agents_get_name($id_agente);
$agent_name = io_safe_output($agent_name);
$agent_md5 = md5($agent_name, false);
$remote_configuration_tab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=remote_configuration&amp;id_agente='.$id_agente.'&amp;disk_conf='.$agent_md5.'">'.html_print_image(
'images/remote_configuration.png',
true,
$remote_configuration_tab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=remote_configuration&amp;id_agente='.$id_agente.'&amp;disk_conf='.$agent_md5,
'image' => 'images/remote-configuration@svg.svg',
'title' => __('Remote configuration'),
'class' => 'invert_filter',
]
).'</a>';
if ($tab == 'remote_configuration') {
$remote_configuration_tab['active'] = true;
} else {
$remote_configuration_tab['active'] = false;
}
],
true
);
$remote_configuration_tab['active'] = ($tab === 'remote_configuration');
$onheader = [
'view' => $viewtab,
@ -717,37 +708,32 @@ if ($id_agente) {
// This add information to the header.
switch ($tab) {
case 'main':
$tab_description = '- '.__('Setup');
$help_header = 'main_tab';
$tab_name = 'Setup';
$tab_name = __('Setup');
break;
case 'collection':
$tab_description = '- '.__('Collection');
$tab_name = 'Collection';
$tab_name = __('Collection');
break;
case 'ncm':
$tab_description = '- '.__('Network config manager');
$tab_name = 'Network config manager';
$tab_name = __('Network config manager');
break;
case 'inventory':
$tab_description = '- '.__('Inventory');
$help_header = 'inventory_tab';
$tab_name = 'Inventory';
$tab_name = __('Inventory');
break;
case 'plugins':
$tab_description = '- '.__('Agent plugins');
$help_header = 'plugins_tab';
$tab_name = __('Agent plugins');
break;
case 'module':
$type_module_t = get_parameter('moduletype', '');
$tab_description = '- '.__('Modules');
$tab_name = 'Modules';
if ($type_module_t == 'webux') {
$tab_name = __('Modules');
if ($type_module_t === 'webux') {
$help_header = 'wux_console';
} else {
$help_header = 'local_module_tab';
@ -755,47 +741,42 @@ if ($id_agente) {
break;
case 'alert':
$tab_description = '- '.__('Alert');
$help_header = 'manage_alert_list';
$tab_name = 'Alerts';
$tab_name = __('Alerts');
break;
case 'template':
$tab_description = '- '.__('Templates');
$tab_name = 'Module templates';
$tab_name = __('Module templates');
break;
case 'gis':
$tab_description = '- '.__('Gis');
$tab_name = __('Gis');
$help_header = 'gis_tab';
break;
case 'incident':
$tab_description = '- '.__('Incidents');
$tab_name = __('Incidents');
break;
case 'remote_configuration':
$tab_description = '- '.__('Remote configuration');
$tab_name = __('Remote configuration');
break;
case 'agent_wizard':
switch (get_parameter('wizard_section')) {
case 'snmp_explorer':
$tab_description = '- '.__('SNMP Wizard');
$help_header = 'agent_snmp_explorer_tab';
$tab_name = 'SNMP Wizard';
$tab_name = __('SNMP Wizard');
break;
case 'snmp_interfaces_explorer':
$tab_description = '- '.__('SNMP Interfaces wizard');
$tab_name = __('SNMP Interfaces Wizard');
$help_header = 'agent_snmp_interfaces_explorer_tab';
$tab_name = 'SNMP Interfaces wizard';
break;
case 'wmi_explorer':
$tab_description = '- '.__('WMI Wizard');
$tab_name = __('WMI Wizard');
$help_header = 'agent_snmp_wmi_explorer_tab';
$tab_name = 'WMI Wizard';
break;
default:
@ -824,48 +805,49 @@ if ($id_agente) {
}
$helper = ($help_header === 'main_tab') ? 'main_tab' : '';
$pure = get_parameter('pure', 0);
if (!$pure) {
ui_print_page_header(
agents_get_alias($id_agente),
'images/setup.png',
$pure = (int) get_parameter('pure');
if ($pure === 0) {
ui_print_standard_header(
__('Agent setup view'),
'images/agent.png',
false,
$helper,
true,
$onheader,
false,
'',
$config['item_title_size_text'],
'',
ui_print_breadcrums(
$onheader,
[
[
__('Resources'),
__('Manage agents'),
'<span class="breadcrumb_active">'.$tab_name.'</span>',
]
)
'link' => '',
'label' => __('Resources'),
],
[
'link' => 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
'label' => __('Manage agents'),
],
[
'link' => '',
'label' => $tab_name,
],
]
);
}
} else {
// Create agent.
ui_print_page_header(
__('Agent manager'),
ui_print_standard_header(
__('Create agent'),
'images/agent.png',
false,
'create_agent',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
ui_print_breadcrums(
[],
[
[
__('Resources'),
__('Manage agents'),
'<span class="breadcrumb_active">'.__('Create agent').'</span>',
]
)
'link' => '',
'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(
$correct,
__('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'];
// Define interval in seconds.
$nombre_agente = $agent['nombre'];
if (empty($alias)) {
if (empty($alias) === true) {
$alias = $agent['alias'];
if (empty($alias)) {
if (empty($alias) === true) {
$alias = $nombre_agente;
}
}
@ -1289,7 +1272,7 @@ $duplicate_module = (int) get_parameter('duplicate_module');
$edit_module = (bool) get_parameter('edit_module');
// 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);
$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);
if (get_parameter('prediction_module')) {
$prediction_module = 1;
} else {
$prediction_module = 0;
}
$prediction_module = (int) get_parameter('prediction_module');
$max_timeout = (int) get_parameter('max_timeout');
$max_retries = (int) get_parameter('max_retries');
$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;
if (!cron_check_syntax($cron_interval)) {
if (cron_check_syntax($cron_interval) === false) {
$cron_interval = '';
}
if ($prediction_module != MODULE_PREDICTION_SYNTHETIC) {
if ($prediction_module !== MODULE_PREDICTION_SYNTHETIC) {
unset($serialize_ops);
enterprise_hook(
'modules_delete_synthetic_operations',
@ -1707,7 +1685,7 @@ if ($update_module) {
$values['plugin_parameter'] = '';
foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) {
if ((int) $key === 1) {
if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
}
@ -1726,12 +1704,12 @@ if ($update_module) {
// In local modules, the interval is updated by agent.
$module_kind = (int) get_parameter('moduletype');
if ($module_kind == MODULE_DATA) {
if ($module_kind === MODULE_DATA) {
unset($values['module_interval']);
}
if ($prediction_module == MODULE_PREDICTION_SYNTHETIC
&& $serialize_ops == ''
if ($prediction_module === MODULE_PREDICTION_SYNTHETIC
&& empty($serialize_ops) === true
) {
$result = false;
} else {
@ -1752,7 +1730,7 @@ if ($update_module) {
}
}
if (is_error($result)) {
if (is_error($result) === true) {
switch ($result) {
case ERR_EXIST:
$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'])
);
} else {
if ($prediction_module == MODULE_PREDICTION_SYNTHETIC) {
if ($prediction_module === MODULE_PREDICTION_SYNTHETIC) {
enterprise_hook(
'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 = '';
if (isset($_POST['combo_snmp_oid'])) {
if (isset($_POST['combo_snmp_oid']) === true) {
$combo_snmp_oid = get_parameter_post('combo_snmp_oid');
}
if ($snmp_oid == '') {
if (empty($snmp_oid) === true) {
$snmp_oid = $combo_snmp_oid;
}
$id_module = (int) get_parameter('id_module');
switch ($config['dbtype']) {
case 'oracle':
if (empty($description) || !isset($description)) {
$description = ' ';
}
break;
default:
// Default.
break;
}
$values = [
'id_tipo_modulo' => $id_module_type,
'descripcion' => $description,
@ -1909,13 +1875,13 @@ if ($create_module) {
'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('&#x0a;', $values['plugin_parameter']);
$values['plugin_parameter'] = '';
foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) {
if ((int) $key === 1) {
if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
}
@ -1923,15 +1889,13 @@ if ($create_module) {
if ($http_pass) {
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;';
}
$values['plugin_parameter'] .= $value.'&#x0a;';
} else {
$values['plugin_parameter'] .= $value.'&#x0a;';
}
$values['plugin_parameter'] .= $value.'&#x0a;';
}
}
if ($prediction_module == MODULE_PREDICTION_SYNTHETIC && $serialize_ops == '') {
if ((int) $prediction_module === MODULE_PREDICTION_SYNTHETIC && empty($serialize_ops) === true) {
$id_agent_module = false;
} else {
$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) {
case ERR_EXIST:
$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'])
);
} else {
if ($prediction_module == MODULE_PREDICTION_SYNTHETIC) {
if ($prediction_module === MODULE_PREDICTION_SYNTHETIC) {
enterprise_hook(
'modules_create_synthetic_operations',
[
@ -2252,8 +2216,8 @@ if ($disable_module) {
}
// UPDATE GIS.
$updateGIS = get_parameter('update_gis', 0);
if ($updateGIS) {
$updateGIS = (bool) get_parameter('update_gis', 0);
if ($updateGIS === true) {
$updateGisData = get_parameter('update_gis_data');
$lastLatitude = get_parameter('latitude');
$lastLongitude = get_parameter('longitude');
@ -2523,7 +2487,7 @@ switch ($tab) {
if(wizard_tab_showed <= 0) {
$('.subsubmenu').hide("fast");
}
},15000);
},1500);
}
/* ]]> */

View File

@ -1,16 +1,32 @@
<?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
// ==================================================
// 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;
check_login();
@ -47,13 +63,8 @@ if ($id_field) {
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->class = 'databox';
$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 "<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[0][0] = __('Name');
$table->data[0][1] = html_print_input_text(
$table->data[1][0] = html_print_input_text(
'name',
$name,
'',
@ -84,30 +95,39 @@ $table->data[0][1] = html_print_input_text(
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'),
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',
1,
$is_password_type,
true
);
$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(
$table->data[3][1] = html_print_checkbox_switch(
'display_on_front',
1,
$display_on_front,
true
);
$table->data[3][0] = __('Enabled combo');
$table->data[3][1] = html_print_checkbox_switch_extended(
$table->data[3][2] = html_print_checkbox_switch_extended(
'is_link_enabled',
1,
$is_link_enabled,
false,
'',
'',
true
);
$table->data[4][0] = __('Enabled combo');
$table->data[5][0] = html_print_checkbox_switch_extended(
'is_combo_enable',
0,
$config['is_combo_enable'],
@ -117,12 +137,15 @@ $table->data[3][1] = html_print_checkbox_switch_extended(
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'),
true
);
$table->data[4][1] = html_print_textarea(
$table->data[5][1] = html_print_textarea(
'combo_values',
3,
65,
@ -131,31 +154,40 @@ $table->data[4][1] = html_print_textarea(
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">';
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('id_field', $id_field);
html_print_submit_button(__('Update'), 'updbutton', false, 'class="sub upd"');
$buttonCaption = __('Update');
$buttonName = 'updbutton';
} else {
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>';
?>

View File

@ -1,22 +1,37 @@
<?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
// ==================================================
// 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
// Load global vars.
global $config;
check_login();
if (!check_acl($config['id_user'], 0, 'PM')) {
if ((bool) check_acl($config['id_user'], 0, 'PM') === false) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Group Management'
@ -27,7 +42,24 @@ if (!check_acl($config['id_user'], 0, 'PM')) {
}
// 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');
$update_field = (bool) get_parameter('update_field');
@ -114,7 +146,6 @@ $fields = db_get_all_rows_filter(
);
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
if ($fields) {
$table->head = [];
@ -140,34 +171,66 @@ if ($fields === false) {
foreach ($fields as $field) {
$data[0] = $field['id_field'];
$data[1] = $field['name'];
$data[1] = '<b>'.$field['name'].'</b>';
$data[2] = html_print_image(
((bool) $field['display_on_front'] === true) ? 'images/validate.svg' : 'images/icono_stop.png',
true,
['class' => 'main_menu_icon invert_filter']
);
if ($field['display_on_front']) {
$data[2] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
} else {
$data[2] = html_print_image(
'images/icono_stop.png',
true,
['style' => 'width:21px;height:21px;']
);
}
$table->cellclass[][3] = 'table_action_buttons';
$tableActionButtons = [];
$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
);
$table->cellclass[][3] = '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>';
$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/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);
}
if ($fields) {
ui_pagination($count_fields, false, $offset);
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 '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button(__('Create field'), 'crt', false, 'class="sub next"');
echo '</div>';
echo '<form method="POST" action="index.php?sec=gagente&sec2=godmode/agentes/configure_field">';
html_print_action_buttons(
html_print_submit_button(
__('Create field'),
'crt',
false,
[ 'icon' => 'next' ],
true
),
['type' => 'form_action']
);
echo '</form>';

View File

@ -36,10 +36,10 @@ $ag_group = get_parameter('ag_group_refresh', -1);
$sortField = get_parameter('sort_field');
$sort = get_parameter('sort', 'none');
$recursion = (bool) get_parameter('recursion', false);
$disabled = get_parameter('disabled', 0);
$os = get_parameter('os', 0);
$disabled = (int) get_parameter('disabled');
$os = (int) get_parameter('os');
if ($ag_group == -1) {
if ($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');
require_once 'include/functions_agents.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.
$tab = 'view';
// Setup tab.
$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,
[
'title' => __('View'),
@ -132,20 +133,19 @@ $agent_to_delete = (int) get_parameter('borrar_agente');
$enable_agent = (int) get_parameter('enable_agent');
$disable_agent = (int) get_parameter('disable_agent');
if ($disable_agent != 0) {
if ($disable_agent !== 0) {
$server_name = db_get_row_sql(
'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(
'select server_name from tagente where id_agente = '.$enable_agent
);
}
$result = null;
if ($agent_to_delete) {
if ($agent_to_delete > 0) {
$id_agente = $agent_to_delete;
if (check_acl_one_of_groups(
$config['id_user'],
@ -171,17 +171,10 @@ if ($agent_to_delete) {
__('Could not be deleted.')
);
if (enterprise_installed()) {
if (enterprise_installed() === true) {
// Check if the remote config file still exist.
if (isset($config['remote_config'])) {
enterprise_include_once(
'include/functions_config_agents.php'
);
if (enterprise_hook(
'config_agents_has_remote_configuration',
[$id_agente]
)
) {
if (isset($config['remote_config']) === true) {
if ((bool) enterprise_hook('config_agents_has_remote_configuration', [$id_agente]) === true) {
ui_print_error_message(
__('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(
'tagente',
['disabled' => 0],
@ -198,7 +191,7 @@ if ($enable_agent) {
);
$alias = io_safe_output(agents_get_alias($enable_agent));
if ($result) {
if ((bool) $result !== false) {
// Update the agent from the metaconsole cache.
enterprise_include_once('include/functions_agents.php');
$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]);
$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').'&nbsp;';
$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'],
0,
'AR'
) && !check_acl($config['id_user'], 0, 'AW')
) === false && (bool) check_acl($config['id_user'], 0, 'AW') === false
) {
$return_all_group = false;
} else {
$return_all_group = true;
}
echo '<div class="w250px inline">';
html_print_select_groups(
$showAgentFields = [
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,
'AR',
$return_all_group,
@ -309,71 +319,78 @@ html_print_select_groups(
'this.form.submit();',
'',
0,
false,
true,
false,
true,
'',
false
);
echo '</div></td>';
// Recursion checkbox.
echo '<td>';
echo __('Recursion').'&nbsp;';
html_print_checkbox(
$filterTable->data[0][1] = __('Recursion');
$filterTable->data[1][1] = html_print_checkbox_switch(
'recursion',
1,
$recursion,
false,
true,
false,
'this.form.submit()'
);
echo '</td>';
echo '<td>';
echo __('Show Agents').'&nbsp;';
$fields = [
2 => __('Everyone'),
1 => __('Only disabled'),
0 => __('Only enabled'),
];
html_print_select(
$fields,
$filterTable->data[0][2] = __('Show agents');
$filterTable->data[1][2] = html_print_select(
$showAgentFields,
'disabled',
$disabled,
'this.form.submit()'
);
echo '</td>';
echo '<td>';
echo __('Operative System').'&nbsp;';
$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').'&nbsp;';
html_print_input_text('search', $search, '', 12);
echo ui_print_help_tip(
__('Search filter by alias, name, description, IP address or custom fields content'),
'this.form.submit()',
'',
0,
true
);
echo '</td><td>';
echo "<input name='srcbutton' type='submit' class='sub search' value='".__('Search')."'>";
echo '</form>';
echo '<td>';
echo '</tr></table>';
$filterTable->data[0][3] = __('Operating System');
$filterTable->data[1][3] = html_print_select(
$fields,
'os',
$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;
$selectNameUp = false;
$selectNameDown = false;
@ -381,6 +398,8 @@ $selectOsUp = false;
$selectOsDown = false;
$selectGroupUp = false;
$selectGroupDown = false;
$selectRemoteUp = false;
$selectRemoteDown = false;
switch ($sortField) {
case 'remote':
switch ($sort) {
@ -553,7 +572,7 @@ if ($disabled == 1) {
}
}
if ($os != 0) {
if ($os !== 0) {
$search_sql .= ' AND id_os = '.$os;
}
@ -562,7 +581,7 @@ $user_groups_to_sql = '';
if ($ag_group > 0) {
$ag_groups = [];
$ag_groups = (array) $ag_group;
if ($recursion) {
if ($recursion === true) {
$ag_groups = groups_get_children_ids($ag_group, true);
}
@ -610,23 +629,15 @@ $sql = sprintf(
);
$agents = db_get_all_rows_sql($sql);
// 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']);
}
}
$custom_font_size = '';
// 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) {
// Urls to sort the table.
if ($config['language'] == 'ja'
|| $config['language'] == 'zh_CN'
|| $own_info['language'] == 'ja'
|| $own_info['language'] == 'zh_CN'
if ($config['language'] === 'ja'
|| $config['language'] === 'zh_CN'
|| $own_info['language'] === 'ja'
|| $own_info['language'] === 'zh_CN'
) {
// Adds a custom font size for Japanese and Chinese language.
$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_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();
$tableAgents->id = 'agent_list';
$tableAgents->class = 'info_table tactical_table';
$tableAgents->head = [];
$tableAgents->data = [];
// Header.
$tableAgents->head[0] = '<span>'.__('Agent name').'</span>';
$tableAgents->head[0] .= ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectNameUp, $selectNameDown);
$tableAgents->head[1] = '<span title=\''.__('Remote agent configuration').'\'>'.__('R').'</span>';
$tableAgents->head[1] .= ui_get_sorting_arrows($url_up_remote, $url_down_remote, $selectRemoteUp, $selectRemoteDown);
$tableAgents->head[2] = '<span>'.__('OS').'</span>';
$tableAgents->head[2] .= ui_get_sorting_arrows($url_up_os, $url_down_os, $selectOsUp, $selectOsDown);
$tableAgents->head[3] = '<span>'.__('Type').'</span>';
$tableAgents->head[4] = '<span>'.__('Group').'</span>';
$tableAgents->head[4] .= ui_get_sorting_arrows($url_up_group, $url_down_group, $selectGroupUp, $selectGroupDown);
$tableAgents->head[5] = '<span>'.__('Description').'</span>';
$tableAgents->head[6] = '<span>'.__('Actions').'</span>';
// Body.
foreach ($agents as $key => $agent) {
// 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(
'tagente',
['remote' => ((int) $resultHasRemoteConfig) ],
'id_agente = '.$agent['id_agente'].''
);
echo "<table cellpadding='0' id='agent_list' cellspacing='0' width='100%' class='info_table'>";
echo '<thead><tr>';
echo '<th>'.__('Agent name').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectNameUp, $selectNameDown).'</th>';
echo "<th title='".__('Remote agent configuration')."'>".__('R').ui_get_sorting_arrows($url_up_remote, $url_down_remote, $selectRemoteUp, $selectRemoteDown).'</th>';
echo '<th>'.__('OS').ui_get_sorting_arrows($url_up_os, $url_down_os, $selectOsUp, $selectOsDown).'</th>';
echo '<th>'.__('Type').'</th>';
echo '<th>'.__('Group').ui_get_sorting_arrows($url_up_group, $url_down_group, $selectGroupUp, $selectGroupDown).'</th>';
echo '<th>'.__('Description').'</th>';
echo "<th class='context_help_body'>".__('Actions').'</th>';
echo '</tr></thead>';
$color = 1;
$rowPair = true;
$iterator = 0;
foreach ($agents as $agent) {
// Begin Update tagente.remote 0/1 with remote agent function return.
if (enterprise_hook(
'config_agents_has_remote_configuration',
[$agent['id_agente']]
)
) {
db_process_sql_update(
'tagente',
['remote' => 1],
'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(
$agent['id_agente'],
$agent['id_grupo']
@ -688,87 +694,66 @@ if ($agents !== false) {
'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 && !$check_ad) {
if ($check_aw === false && $check_ad === false) {
continue;
}
if ($color == 1) {
$tdcolor = 'datos';
$color = 0;
if ((int) $agent['id_os'] === CLUSTER_OS_ID) {
$cluster = PandoraFMS\Cluster::loadFromAgentId($agent['id_agente']);
$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 {
$tdcolor = 'datos2';
$color = 1;
$main_tab = ($check_aw === true) ? 'main' : 'module';
$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 ($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'] == '') {
if (empty($agent['alias']) === true) {
$agent['alias'] = $agent['nombre'];
}
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.'">'.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>';
}
$additionalDataAgentName = [];
echo '</strong>';
$in_planned_downtime = db_get_sql(
$inPlannedDowntime = db_get_sql(
'SELECT executed FROM tplanned_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
AND tplanned_downtime.type_downtime <> "disable_agent_modules"'
);
if ($agent['disabled']) {
ui_print_help_tip(__('Disabled'));
if (!$in_planned_downtime) {
echo '</em>';
}
if ($inPlannedDowntime !== false) {
$additionalDataAgentName[] = ui_print_help_tip(
__('Module in scheduled downtime'),
true,
'images/clock.svg'
);
}
if ($agent['quiet']) {
echo '&nbsp;';
html_print_image(
if ((bool) $agent['disabled'] === true) {
$additionalDataAgentName[] = ui_print_help_tip(__('Disabled'));
}
if ((bool) $agent['quiet'] === true) {
$additionalDataAgentName[] = html_print_image(
'images/dot_blue.png',
false,
true,
[
'border' => '0',
'title' => __('Quiet'),
@ -777,183 +762,254 @@ if ($agents !== false) {
);
}
if ($in_planned_downtime) {
ui_print_help_tip(
__('Agent in scheduled downtime'),
false,
'images/minireloj-16.png'
);
// Agent name column (1). Agent name.
$agentNameColumn = html_print_anchor(
[
'href' => ui_get_full_url($agentNameUrl),
'title' => $agent['nombre'],
'content' => ui_print_truncate_text($agent['alias'], 'agent_medium').implode('', $additionalDataAgentName),
],
true
);
echo '</em>';
$additionalOptionsAgentName = [];
// Additional options generation.
if ($check_aw === true) {
$additionalOptionsAgentName[] = html_print_anchor(
[
'href' => ui_get_full_url($agentNameUrl),
'content' => __('Edit'),
],
true
);
}
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 ((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
);
}
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 ' | ';
}
$additionalOptionsAgentName[] = html_print_anchor(
[
'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$agent['id_agente']),
'content' => __('Alerts'),
],
true
);
echo '<a href="index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=alert&
id_agente='.$agent['id_agente'].'">'.__('Alerts').'</a>';
echo ' | ';
$additionalOptionsAgentName[] = html_print_anchor(
[
'href' => ui_get_full_url($agentViewUrl),
'content' => __('View'),
],
true
);
if ($agent['id_os'] == CLUSTER_OS_ID) {
$cluster = PandoraFMS\Cluster::loadFromAgentId(
$agent['id_agente']
// 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
);
$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>';
$remoteConfigurationColumn = '';
}
echo '</div>';
echo '</td>';
// 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
);
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',
'title' => __('Edit remote config'),
'class' => 'invert_filter',
]
);
echo '</a>';
}
}
echo '</td>';
// Operating System icon.
echo "<td class='$tdcolor' align='left' valign='middle'>";
ui_print_os_icon($agent['id_os'], false);
echo '</td>';
// Type agent (Networt, Software or Satellite).
echo "<td class='$tdcolor' align='left' valign='middle'>";
echo ui_print_type_agent_icon(
// Agent type column.
$agentTypeIconColumn = ui_print_type_agent_icon(
$agent['id_os'],
$agent['ultimo_contacto_remoto'],
$agent['ultimo_contacto'],
true,
$agent['remote'],
$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.
echo "<td class='$tdcolor' align='left' valign='middle'>".ui_print_group_icon($agent['id_grupo'], true).'</td>';
// Description column.
$descriptionColumn = ui_print_truncate_text(
$agent['comentarios'],
'description',
true,
true,
true,
'[&hellip;]'
);
// Description.
echo "<td class='".$tdcolor."f9'><span class='".$custom_font_size."'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[&hellip;]').'</span></td>';
$agentActionButtons = [];
// Action
// When there is only one element in page it's necesary go back page.
if ((count($agents) == 1) && ($offset >= $config['block_size'])) {
$offsetArg = ($offset - $config['block_size']);
if ((bool) $agent['disabled'] === true) {
$agentDisableEnableTitle = __('Enable agent');
$agentDisableEnableAction = 'enable_agent';
$agentDisableEnableCaption = __('You are going to enable a cluster agent. Are you sure?');
$agentDisableEnableIcon = 'change-pause.svg';
} 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']) {
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
enable_agent=".$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) {
echo '>';
if ($check_aw === true && is_management_allowed() === true) {
if ($agent['id_os'] !== CLUSTER_OS_ID) {
$onClickActionDeleteAgent = 'if (!confirm(\' '.__('Are you sure?').'\')) return false;';
} 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>';
} else {
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
disable_agent=".$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) {
echo '>';
} else {
echo ' onClick="if (!confirm(\' '.__('You are going to disable a cluster agent. Are you sure?').'\')) return false;">';
}
echo html_print_image('images/lightbulb.png', true, ['alt' => __('Disable agent'), 'title' => __('Disable agent'), 'class' => 'invert_filter']).'</a>';
$agentActionButtons[] = html_print_menu_button(
[
'href' => ui_get_full_url(
sprintf(
'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',
$agent['id_agente'],
$agentDisableEnableAction,
$agent['id_agente'],
$ag_group,
$recursion,
$search,
'',
$sortField,
$sort,
$disabled
)
),
'onClick' => $onClickActionDeleteAgent,
'image' => sprintf('images/delete.svg'),
'title' => __('Delete agent'),
],
true
);
}
if ($check_aw && is_management_allowed() === true) {
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) {
echo ' onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
} else {
echo ' onClick="if (!confirm(\' '.__('WARNING! - You are going to delete a cluster agent. Are you sure?').'\')) return false;">';
}
echo html_print_image('images/cross.png', true, ['border' => '0', 'class' => 'invert_filter']).'</a>';
}
echo '</td>';
// 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;
}
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'>";
html_print_table($tableAgents);
$tablePagination = ui_pagination(
$total_agents,
ui_get_url_refresh(
[
'group_id' => $group_id,
'search' => $search,
'sort_field' => $sortField,
'sort' => $sort,
'status' => $status,
]
),
0,
0,
true,
'offset',
false,
'dataTables_paginate paging_simple_numbers'
);
/*
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
);
*/
} else {
$tablePagination = '';
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.
echo '<div class="action-buttons">';
echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">';
html_print_submit_button(
__('Create agent'),
'crt-2',
false,
'class="sub next"'
html_print_action_buttons(
html_print_submit_button(
__('Create agent'),
'crt-2',
false,
[ 'icon' => 'next' ],
true
),
[
'type' => 'data_table',
'class' => 'fixed_action_buttons',
'right_content' => $tablePagination,
]
);
echo '</form>';
echo '</div>';
}
echo '</td></tr></table>';
?>
<script type="text/javascript">

File diff suppressed because it is too large Load Diff

View File

@ -396,9 +396,9 @@ if ($id_agent_module) {
);
}
} else {
if (isset($moduletype) === false) {
if (isset($moduletype) === false || $moduletype === 0) {
$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';
}
@ -581,11 +581,11 @@ if ($__code_from !== 'policies') {
$tag_acl = true;
// 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);
}
if (!$tag_acl) {
if ($tag_acl !== true) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access agent manager'
@ -595,16 +595,15 @@ if ($__code_from !== 'policies') {
}
}
switch ($moduletype) {
case 'dataserver':
case MODULE_DATA:
$moduletype = MODULE_DATA;
// Has remote configuration ?
$remote_conf = false;
if (enterprise_installed()) {
if (enterprise_installed() === true) {
enterprise_include_once('include/functions_config_agents.php');
$remote_conf = enterprise_hook(
$remote_conf = (bool) enterprise_hook(
'config_agents_has_remote_configuration',
[$id_agente]
);
@ -621,7 +620,7 @@ switch ($moduletype) {
];
include 'module_manager_editor_common.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) {
enterprise_include_once('include/functions_config_agents.php');
$configuration_data = enterprise_hook(
@ -649,7 +648,7 @@ switch ($moduletype) {
4,
5,
];
if (enterprise_installed()) {
if (enterprise_installed() === true) {
$categories[] = 10;
}
@ -700,7 +699,7 @@ switch ($moduletype) {
$moduletype = MODULE_WEB;
// Remove content of $ip_target when it is ip_agent because
// 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 = '';
@ -724,8 +723,8 @@ switch ($moduletype) {
}
if ($config['enterprise_installed'] && $id_agent_module) {
if (policies_is_module_in_policy($id_agent_module)) {
if ((bool) $config['enterprise_installed'] === true && $id_agent_module) {
if (policies_is_module_in_policy($id_agent_module) === true) {
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>';
// TODO: Change to the ui_print_error system.
echo '<form method="post" id="module_form">';
ui_toggle(
$outputForm = '<form method="post" id="module_form">';
$outputForm .= ui_toggle(
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),
__('Advanced options')
);
ui_toggle(
html_print_table($table_macros, true),
__('Custom macros')
'<span class="subsection_header_title">'.__('Advanced options').'</span>',
'',
'',
true,
true,
'',
'',
'box-flat white_table_flex white_table_graph_fixed'
);
if ($moduletype != 13) {
ui_toggle(
$outputForm .= 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(
$table_new_relations,
true
@ -761,51 +778,78 @@ if ($moduletype != 13) {
$table_relations,
true
),
__('Module relations')
'<span class="subsection_header_title">'.__('Module relations').'<span>',
'',
'',
true,
true,
'',
'',
'box-flat white_table_flex white_table_graph_fixed'
);
}
// Submit.
echo '<div class="action-buttons" style="width: '.$table_simple->width.'">';
if ($id_agent_module) {
html_print_submit_button(
$actionButtons = html_print_submit_button(
__('Update'),
'updbutton',
false,
'class="sub upd"'
[ 'icon' => 'update' ],
true
);
html_print_input_hidden('update_module', 1);
html_print_input_hidden('id_agent_module', $id_agent_module);
html_print_input_hidden('id_module_type', $id_module_type);
if ($config['enterprise_installed'] && $remote_conf) {
?>
<script type="text/javascript">
var check_remote_conf = true;
</script>
<?php
}
$actionButtons .= html_print_button(
__('Delete'),
'deleteModule',
false,
'window.location.assign("index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$id_agent_module.'")',
[
'icon' => 'delete',
'mode' => 'secondary',
],
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 {
html_print_submit_button(
$actionButtons = html_print_submit_button(
__('Create'),
'crtbutton',
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) {
?>
<script type="text/javascript">
var check_remote_conf = true;
</script>
<?php
}
$actionButtons .= html_print_input_hidden('id_module', $moduletype, true);
$actionButtons .= html_print_input_hidden('create_module', 1, true);
}
echo '</div>';
echo '</form>';
$actionButtons .= html_print_go_back_button(
'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('form');

View File

@ -1,9 +1,8 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
* Network module manager editor.
*
* @category Extensions
* @category Modules
* @package Pandora FMS
* @subpackage Community
* @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
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -28,10 +27,12 @@
*/
global $config;
require_once $config['homedir'].'/include/class/CredentialStore.class.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';
$array_credential_identifier = CredentialStore::getKeys('CUSTOM');
echo "<script type='text/javascript' src='".$snmp_browser_path."'></script>";
// Define a custom action to save the OID selected
@ -63,13 +64,13 @@ if (strstr($page, 'policy_modules') === false) {
if ($disabledBecauseInPolicy) {
$disabledTextBecauseInPolicy = 'readonly = "yes"';
$classdisabledBecauseInPolicy = 'readonly';
$largeclassdisabledBecauseInPolicy = 'class = readonly';
$largeclassdisabledBecauseInPolicy = 'readonly';
}
}
define('ID_NETWORK_COMPONENT_TYPE', 2);
if (empty($edit_module)) {
if (empty($edit_module) === true) {
// Function in module_manager_editor_common.php.
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
}
@ -78,12 +79,20 @@ $extra_title = __('Network server module');
$data = [];
$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.
if ($page == 'enterprise/godmode/policies/policy_modules') {
if ($ip_target != 'auto' && $ip_target != '') {
if ($page === 'enterprise/godmode/policies/policy_modules') {
if (empty($ip_target) === false && $ip_target !== 'auto') {
$custom_ip_target = $ip_target;
$ip_target = 'custom';
} else if ($ip_target == '') {
} else if (empty($ip_target) === true) {
$ip_target = 'force_pri';
$custom_ip_target = '';
} else {
@ -95,7 +104,7 @@ if ($page == 'enterprise/godmode/policies/policy_modules') {
$target_ip_values['force_pri'] = __('Force primary key');
$target_ip_values['custom'] = __('Custom');
$data[1] = html_print_select(
$data[0] = html_print_select(
$target_ip_values,
'ip_target',
$ip_target,
@ -105,39 +114,38 @@ if ($page == 'enterprise/godmode/policies/policy_modules') {
true,
false,
false,
'',
'w100p',
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 {
if ($ip_target == 'auto') {
if ($ip_target === 'auto') {
$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.
if ($id_module_type >= 6 && $id_module_type <= 7) {
$data[2] = '';
$data[3] = '';
} else {
$data[2] = __('Port');
$data[3] = html_print_input_text(
if ($id_module_type !== 6 && $id_module_type !== 7) {
$tcp_port = (empty($tcp_port) === false) ? $tcp_port : get_parameter('tcp_port');
$data[1] = html_print_input_text(
'tcp_port',
$tcp_port,
'',
5,
0,
20,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
$classdisabledBecauseInPolicy.' w100p',
);
} else {
$data[1] = '';
}
$table_simple->rowclass['target_ip'] = 'w50p';
push_table_simple($data, 'target_ip');
$user_groups = users_get_groups(false, 'AR');
@ -162,7 +170,10 @@ if (empty($credentials) === false) {
$data = [];
$data[0] = __('Credential store');
$data[1] = html_print_select(
push_table_simple($data, 'caption_snmp_credentials');
$data = [];
$data[0] = html_print_select(
$fields,
'credentials',
0,
@ -178,102 +189,93 @@ if (empty($credentials) === false) {
'',
false
);
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['2'] = 'v. 2';
$snmp_versions['2c'] = 'v. 2c';
$snmp_versions['3'] = 'v. 3';
$data = [];
$data[0] = __('SNMP community');
$adopt = false;
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && isset($id_agent_module)) {
$adopt = policies_is_module_adopt($id_agent_module);
}
$snmpVersionsInput = html_print_select(
$snmp_versions,
'snmp_version',
($id_module_type >= 15 && $id_module_type <= 18) ? $snmp_version : 0,
'',
'',
'',
true,
false,
false,
'',
$disabledBecauseInPolicy,
'width: 100%',
'',
$classdisabledBecauseInPolicy.' w100p'
);
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_version',
$snmp_version,
'',
'',
'',
true,
false,
false,
'',
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
);
} 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) {
$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[0] = __('SNMP OID');
$data[1] = '<span class="left w50p">';
$data[1] .= html_print_input_text(
$table_simple->cellclass['snmp_2'][0] = 'w25p';
$table_simple->cellclass['snmp_2'][1] = 'w25p';
$table_simple->cellclass['snmp_2'][2] = 'w50p';
$data[0] = $snmpCommunityInput;
$data[1] = $snmpVersionsInput;
$data[2] = html_print_input_text(
'snmp_oid',
$snmp_oid,
'',
30,
0,
255,
true,
$disabledBecauseInPolicy,
@ -281,8 +283,8 @@ $data[1] .= html_print_input_text(
'',
$classdisabledBecauseInPolicy
);
$data[1] .= '<span class="invisible" id="oid">';
$data[1] .= html_print_select(
$data[2] .= '<span class="invisible" id="oid">';
$data[2] .= html_print_select(
[],
'select_snmp_oid',
$snmp_oid,
@ -295,7 +297,7 @@ $data[1] .= html_print_select(
'',
$disabledBecauseInPolicy
);
$data[1] .= html_print_image(
$data[2] .= html_print_image(
'images/edit.png',
true,
[
@ -303,26 +305,27 @@ $data[1] .= html_print_image(
'id' => 'edit_oid',
]
);
$data[1] .= '</span>';
$data[1] .= '</span><span class="right w50p right">';
$data[1] .= html_print_button(
__('SNMP walk'),
$data[2] .= '</span>';
$data[2] .= html_print_button(
__('SNMP Walk'),
'snmp_walk',
false,
'snmpBrowserWindow()',
'class="sub next"',
[ 'mode' => 'link' ],
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');
// Advanced stuff.
$data = [];
$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',
2,
65,
@ -331,11 +334,6 @@ $data[1] = html_print_textarea(
true,
$largeclassdisabledBecauseInPolicy
);
$table_simple->colspan['tcp_send'][1] = 3;
push_table_simple($data, 'tcp_send');
$data[0] = __('TCP receive');
$data[1] = html_print_textarea(
'tcp_rcv',
2,
@ -345,9 +343,8 @@ $data[1] = html_print_textarea(
true,
$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) {
// NOT TCP.
@ -475,33 +472,41 @@ push_table_simple($data, 'field_snmpv3_row3');
$data = [];
$data[0] = __('Command');
$data[1] = html_print_input_text_extended(
'command_text',
$command_text,
'command_text',
'',
100,
10000,
$disabledBecauseInPolicy,
'',
$largeClassDisabledBecauseInPolicy,
true
);
$data[1] .= ui_print_help_tip(
$data[0] .= ui_print_help_tip(
__(
'Please use single quotation marks when necessary. '."\n".'
If double quotation marks are needed, please escape them with a backslash (\&quot;)'
),
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');
require_once $config['homedir'].'/include/class/CredentialStore.class.php';
$array_credential_identifier = CredentialStore::getKeys('CUSTOM');
$data = [];
$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,
'command_credential_identifier',
$command_credential_identifier,
@ -512,10 +517,18 @@ $data[1] = html_print_select(
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 = [
'inherited' => __('Inherited'),
@ -523,8 +536,7 @@ $array_os = [
'windows' => __('Windows remote'),
];
$data[2] = __('Connection method');
$data[3] = html_print_select(
$data[1] = html_print_select(
$array_os,
'command_os',
$command_os,
@ -535,9 +547,11 @@ $data[3] = html_print_select(
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');
if ($id_module_type !== 34
@ -545,7 +559,9 @@ if ($id_module_type !== 34
&& $id_module_type !== 36
&& $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['caption-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")
) {
$("#simple-row-cmd-row-1").attr("style", "");
$("#simple-caption-row-cmd-row-1").attr("style", "");
$("#simple-row-cmd-row-2").attr("style", "");
$("#simple-caption-row-cmd-row-2").attr("style", "");
} else {
$("#simple-caption-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");
}
});
@ -704,7 +724,7 @@ $(document).ready (function () {
$("#text-custom_ip_target").hide();
}
$('#ip_target').change(function() {
if($(this).val() == 'custom') {
if($(this).val() === 'custom') {
$("#text-custom_ip_target").show();
}
else{

View File

@ -89,8 +89,7 @@ $password_fields = [];
// If there are $macros, we create the form fields
if (!empty($macros)) {
$macros = json_decode($macros, true);
$macros = json_decode(io_safe_output($macros), true);
foreach ($macros as $k => $m) {
$data = [];
$data[0] = $m['desc'];

View File

@ -1,16 +1,31 @@
<?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('godmode/agentes/module_manager_editor_prediction.php');
require_once 'include/functions_agents.php';
@ -31,7 +46,7 @@ $is_service = false;
$is_synthetic = false;
$is_synthetic_avg = false;
$ops = false;
if ($row !== false && is_array($row)) {
if ($row !== false && is_array($row) === true) {
$prediction_module = $row['prediction_module'];
$custom_integer_2 = $row['custom_integer_2'];
// Services are an Enterprise feature.
@ -49,19 +64,14 @@ if ($row !== false && is_array($row)) {
[$id_agente_modulo]
);
$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)));
$first_op = explode('_', $chunks[1]);
if (isset($first_op[1]) && $first_op[1] == 'avg') {
if (isset($first_op[1]) === true && $first_op[1] === 'avg') {
$selected = 'synthetic_avg_selected';
} else {
$selected = 'synthetic_selected';
@ -109,23 +119,28 @@ $extra_title = __('Prediction server module');
$data = [];
$data[0] = __('Source module');
$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.
$module_service_synthetic_selector = enterprise_hook('get_module_service_synthetic_selector', [$selected]);
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;
push_table_simple($data, 'module_service_synthetic_selector');
$data = [];
$data[0] = '';
}
$data[1] = '<div id="module_data" class="w50p float-left top-1em">';
$data[1] .= html_print_label(__('Agent'), 'agent_name', true).'<br/>';
$data = [];
$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) {
$id_agente_clean = modules_get_agentmodule_agent($prediction_module);
$prediction_module_agent = modules_get_agentmodule_agent_name($prediction_module);
@ -137,7 +152,6 @@ if (empty($prediction_module) === false) {
$agent_alias = '';
}
$params = [];
$params['return'] = true;
$params['show_helptip'] = true;
@ -147,106 +161,105 @@ $params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'prediction_module';
$params['none_module_text'] = __('Select Module');
$params['use_hidden_input_idagent'] = true;
$params['input_style'] = 'width: 100%;';
$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 />';
$data[1] .= html_print_label(__('Module'), 'prediction_module', true).'<br />';
if ($id_agente) {
$sql = 'SELECT id_agente_modulo, nombre
FROM tagente_modulo
WHERE delete_pending = 0
AND history_data = 1
AND id_agente = '.$id_agente_clean.'
AND id_agente_modulo <> '.$id_agente_modulo;
$data[1] .= html_print_input(
[
'type' => 'select_from_sql',
'sql' => $sql,
'name' => 'prediction_module',
'selected' => $prediction_module,
'nothing' => __('Select Module'),
'nothing_value' => 0,
'return' => true,
]
if ($id_agente > 0) {
$predictionModuleInput = html_print_select_from_sql(
'SELECT id_agente_modulo, nombre
FROM tagente_modulo
WHERE delete_pending = 0
AND history_data = 1
AND id_agente = '.$id_agente_clean.'
AND id_agente_modulo <> '.$id_agente_modulo,
'prediction_module',
$prediction_module,
'',
__('Select Module'),
0,
true,
false,
true,
false,
'width: 100%;'
);
} 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] .= html_print_label(__('Period'), 'custom_integer_2', true).'<br/>';
$periods[0] = __('Weekly');
$periods[1] = __('Monthly');
$periods[2] = __('Daily');
$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;
$data[1] = $predictionModuleInput;
$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);
$table_simple->cellclass['prediction_module'][0] = 'w33p';
$table_simple->cellclass['prediction_module'][1] = 'w33p';
$table_simple->cellclass['prediction_module'][2] = 'w33p';
push_table_simple($data, 'prediction_module');
$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[1] .= html_print_input(
$data = [];
$data[0] = html_print_select(
[
'type' => 'select',
'return' => 'true',
'name' => 'estimation_type',
'class' => 'w250px',
'fields' => [
'estimation_absolute' => __('Estimated absolute value'),
'estimation_calculation' => __('Calculation of days to reach limit'),
],
'selected' => $estimation_type,
'estimation_absolute' => __('Estimated absolute value'),
'estimation_calculation' => __('Calculation of days to reach limit'),
],
'div',
false
'estimation_type',
$estimation_type,
'',
'',
0,
true,
false,
true,
'',
false,
'width: 100%;'
);
$data[1] .= '<div id="estimation_interval_row">';
$data[1] .= html_print_label(__('Future estimation'), 'estimation_interval', true).'<br/>';
$data[1] .= html_print_input(
$data[1] = html_print_input(
[
'type' => 'interval',
'return' => 'true',
'name' => 'estimation_interval',
'value' => $estimation_interval,
'class' => 'w100p',
],
'div',
false
);
$data[1] .= '</div>';
$data[1] .= '<div id="estimation_days_row">';
$data[1] .= html_print_label(__('Limit value'), 'estimation_days', true).'<br/>';
$data[1] .= html_print_input(
$data[2] = html_print_input(
[
'type' => 'number',
'return' => 'true',
'id' => 'estimation_days',
'name' => 'estimation_days',
'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');
// Services are an Enterprise feature.
$selector_form = enterprise_hook('get_selector_form', [$custom_integer_1]);
if ($selector_form !== ENTERPRISE_NOT_HOOK) {
$data = [];
$data[0] = '';
$data[1] = $selector_form;
$data[0] = $selector_form['caption'];
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');
}
@ -254,38 +267,31 @@ if ($selector_form !== ENTERPRISE_NOT_HOOK) {
$synthetic_module_form = enterprise_hook('get_synthetic_module_form');
if ($synthetic_module_form !== ENTERPRISE_NOT_HOOK) {
$data = [];
$data[0] = '';
$data[1] = $synthetic_module_form;
$data[0] = $synthetic_module_form;
push_table_simple($data, 'synthetic_module');
}
$trending_module_form = enterprise_hook('get_trending_module_form', [$custom_string_1]);
if ($trending_module_form !== ENTERPRISE_NOT_HOOK) {
$data = [];
$data[0] = '';
$data[1] .= $trending_module_form;
$data[0] = $trending_module_form['caption'];
push_table_simple($data, 'caption_trending_module');
$data = [];
$data[0] = $trending_module_form['input'];
push_table_simple($data, 'trending_module');
}
// Netflow modules are an Enterprise feature.
$netflow_module_form = enterprise_hook('get_netflow_module_form', [$custom_integer_1]);
if ($netflow_module_form !== ENTERPRISE_NOT_HOOK) {
$data = [];
$data[0] = '';
$data[1] = $netflow_module_form;
$table_simple->colspan['netflow_module_form'][1] = 3;
push_table_simple($data, 'netflow_module');
}
// Removed common useless parameter
// Removed common useless parameter.
unset($table_advanced->data[3]);
?>
<script type="text/javascript">

View File

@ -1,10 +1,10 @@
<?php
/**
* Web Module Editor for Module Manager.
* Web module manager editor.
*
* @category Module manager
* @category Modules
* @package Pandora FMS
* @subpackage Module manager
* @subpackage Community
* @version 1.0.0
* @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
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -32,9 +32,11 @@ enterprise_include_once('include/functions_policies.php');
$disabledBecauseInPolicy = false;
$disabledTextBecauseInPolicy = '';
$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 ($config['enterprise_installed']) {
if ((bool) $config['enterprise_installed'] === true) {
if (policies_is_module_linked($id_agent_module) == 1) {
$disabledBecauseInPolicy = 1;
} else {
@ -44,7 +46,7 @@ if (strstr($page, 'policy_modules') === false) {
$disabledBecauseInPolicy = false;
}
if ($disabledBecauseInPolicy) {
if ((bool) $disabledBecauseInPolicy === true) {
$disabledTextBecauseInPolicy = 'disabled = "disabled"';
$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';
}
define('ID_NETWORK_COMPONENT_TYPE', 7);
if (!$tcp_port && !$id_agent_module) {
if (empty($tcp_port) === true && $id_agent_module !== 0) {
$tcp_port = 80;
}
// plugin_server is the browser id
if ($plugin_user == '' && !$id_agent_module) {
// Plugin_server is the browser id.
if (empty($plugin_user) === true && $id_agent_module !== 0) {
$plugin_user = get_product_name().' / Webcheck';
}
// plugin_server is the referer
if ($plugin_pass == '' && !$id_agent_module) {
// Plugin_server is the referer.
if (empty($plugin_pass) === true && $id_agent_module !== 0) {
$plugin_pass = 1;
}
if (empty($edit_module)) {
// Function in module_manager_editor_common.php
if (empty($edit_module) === true) {
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
} else {
// TODO: Print network component if available
}
$data = [];
$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;
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]);
}
$id_policy_module = (int) get_parameter('id_policy_module', '');
if ($id_policy_module) {
if ($id_policy_module > 0) {
$module = enterprise_hook('policies_get_module', [$id_policy_module]);
$plugin_parameter = $module['plugin_parameter'];
} else {
$plugin_parameter = '';
}
$plugin_parameter_split = explode('&#x0a;', $plugin_parameter);
@ -121,7 +125,7 @@ foreach ($plugin_parameter_split as $key => $value) {
}
if ((bool) $adopt === false) {
$data[1] = html_print_textarea(
$textareaPluginParameter = html_print_textarea(
'plugin_parameter',
15,
65,
@ -131,7 +135,7 @@ if ((bool) $adopt === false) {
'resizev'
);
} else {
$data[1] = html_print_textarea(
$textareaPluginParameter = html_print_textarea(
'plugin_parameter',
15,
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.
if ($id_agent_module > 0
@ -158,35 +164,43 @@ if ($id_agent_module > 0
$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>';
$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(
$actionButtons = html_print_button(
__('Load basic'),
'btn_loadbasic',
false,
'',
'class="sub config"',
[
'icon' => 'cog',
'mode' => 'mini secondary',
],
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'),
'btn_checkconf',
false,
'',
'class="sub upd"',
[
'icon' => 'update',
'mode' => 'mini secondary',
],
true
).ui_print_help_tip(__('Check the correct structure of the WebCheck'), true).$suc_err_check;
$data[2] .= '<br><br>'.html_print_button(
).ui_print_help_tip(__('Check the correct structure of the WebCheck'), true);
$actionButtons .= html_print_button(
__('Debug'),
'btn_debugModule',
$disableDebug,
'',
'class="sub config" onClick="loadDebugWindow()"',
'loadDebugWindow()',
[
'icon' => 'cog',
'mode' => 'mini secondary ',
],
true
).ui_print_help_tip($hintDebug, true);
push_table_simple($data, 'web_checks');
$data = [];
$data[0] = $actionButtons;
push_table_simple($data, 'buttons_web_checks');
$http_checks_type = [
0 => 'Anyauth',

View File

@ -117,79 +117,91 @@ if ($not_found) {
$table = new StdClass();
$table->id = 'form_editor';
$table->width = '98%';
$table->class = 'databox_color';
$table->head = [];
$table->size = [];
$table->size[0] = '30%';
$table->width = '100%';
$table->class = 'databox filter-table-adv';
$table->style = [];
$table->style[0] = 'font-weight: bold; width: 150px;';
$table->style[0] = 'width: 50%';
$table->data = [];
$table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text(
'name',
$name,
'',
30,
100,
true
);
$table->data[1][0] = __('Group');
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
false,
'AR',
true,
'id_group',
$id_group,
'',
'',
0,
true
).'</div>';
$table->data[2][0] = __('Node radius');
$table->data[2][1] = html_print_input_text(
'node_radius',
$node_radius,
'',
2,
10,
true
$table->data[0][] = html_print_label_input_block(
__('Name'),
html_print_input_text(
'name',
$name,
'',
30,
100,
true
),
[ 'div_class' => 'w50p' ]
);
$table->data[3][0] = __('Description');
$table->data[3][1] = html_print_textarea('description', 7, 25, $description, '', true);
$table->data[1][] = html_print_label_input_block(
__('Group'),
html_print_select_groups(
false,
'AR',
true,
'id_group',
$id_group,
'',
'',
0,
true
),
[ 'div_class' => 'w50p' ]
);
$table->data[2][] = html_print_label_input_block(
__('Node radius'),
html_print_input_text(
'node_radius',
$node_radius,
'',
2,
10,
true
),
[ 'div_class' => 'w50p' ]
);
$table->data[3][] = html_print_label_input_block(
__('Description'),
html_print_textarea(
'description',
7,
25,
$description,
'',
true
)
);
echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">';
html_print_table($table);
echo "<div style='width: ".$table->width."; text-align: right; margin-top:20px;'>";
if ($new_empty_networkmap) {
html_print_input_hidden('save_empty_networkmap', 1);
html_print_submit_button(
__('Save networkmap'),
'crt',
false,
'class="sub next"'
);
$titleButton = __('Save networkmap');
}
if ($edit_networkmap) {
html_print_input_hidden('id_networkmap', $id);
html_print_input_hidden('update_empty_networkmap', 1);
html_print_submit_button(
__('Update networkmap'),
'crt',
false,
'class="sub upd"'
);
$titleButton = __('Update networkmap');
}
html_print_action_buttons(
html_print_submit_button(
$titleButton,
'crt',
false,
['icon' => 'next'],
true
)
);
echo '</form>';
echo '</div>';
}

View File

@ -15,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
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -29,8 +29,6 @@
global $config;
check_login();
$agent_d = check_acl($config['id_user'], 0, 'AD');
@ -54,23 +52,33 @@ require_once $config['homedir'].'/include/functions_cron.php';
// Buttons.
$buttons = [
'text' => "<a href='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>".html_print_image(
'images/list.png',
'images/logs@svg.svg',
true,
[
'title' => __('List'),
'class' => 'invert_filter',
'class' => 'main_menu_icon invert_filter',
]
).'</a>',
];
// Header.
ui_print_page_header(
ui_print_standard_header(
__('Scheduled Downtime'),
'images/gm_monitoring.png',
false,
'',
true,
$buttons
$buttons,
[
[
'link' => '',
'label' => __('Tools'),
],
[
'link' => '',
'label' => __('Scheduled Downtime'),
],
]
);
// Recursion group filter.
@ -813,227 +821,7 @@ if (users_can_manage_group_all('AW') === true || $disabled) {
$return_all_group = true;
}
$table = new StdClass();
$table->class = 'databox filters';
$table->width = '100%';
$table->data = [];
$table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text(
'name',
$name,
'',
25,
40,
true,
$disabled_in_execution
);
$table->data[1][0] = __('Group');
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
false,
$access,
$return_all_group,
'id_group',
$id_group,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
).'</div>';
$table->data[2][0] = __('Description');
$table->data[2][1] = html_print_textarea(
'description',
3,
35,
$description,
'',
true
);
$table->data[3][0] = __('Type').ui_print_help_tip(
__('Quiet: Modules will not generate events or fire alerts.').'<br>'.__('Disable Agents: Disables the selected agents.').'<br>'.__('Disable Alerts: Disable alerts for the selected agents.'),
true
);
$table->data[3][1] = html_print_select(
[
'quiet' => __('Quiet'),
'disable_agents' => __('Disabled Agents'),
'disable_agent_modules' => __('Disable Modules'),
'disable_agents_alerts' => __('Disabled only Alerts'),
],
'type_downtime',
$type_downtime,
'change_type_downtime()',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
);
$table->data[4][0] = __('Execution');
$table->data[4][1] = html_print_select(
[
'once' => __('Once'),
'periodically' => __('Periodically'),
'cron' => __('Cron from/to'),
],
'type_execution',
$type_execution,
'change_type_execution();',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
);
$days = array_combine(range(1, 31), range(1, 31));
$table->data[5][0] = __('Configure the time').'&nbsp;';
;
$table->data[5][1] = "
<div id='once_time' style='display: none;'>
<table>
<tr>
<td>".__('From:').'</td>
<td>'.html_print_input_text('once_date_from', $once_date_from, '', 10, 10, true, $disabled_in_execution).html_print_input_text('once_time_from', $once_time_from, '', 9, 9, true, $disabled_in_execution).'</td>
</tr>
<tr>
<td>'.__('To:').'</td>
<td>'.html_print_input_text('once_date_to', $once_date_to, '', 10, 10, true).html_print_input_text('once_time_to', $once_time_to, '', 9, 9, true)."</td>
</tr>
</table>
</div>
<div id='periodically_time' style='display: none;'>
<table>
<tr><td>".ui_get_using_system_timezone_warning().'</td></tr>
<tr>
<td>'.__('Type Periodicity:').'&nbsp;'.html_print_select(
[
'weekly' => __('Weekly'),
'monthly' => __('Monthly'),
],
'type_periodicity',
$type_periodicity,
'change_type_periodicity();',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
)."</td>
</tr>
<tr>
<td colspan='2'>
<table id='weekly_item' style='display: none;'>
<tr>
<td>".__('Mon').html_print_checkbox('monday', 1, $monday, true, $disabled_in_execution).'</td>
<td>'.__('Tue').html_print_checkbox('tuesday', 1, $tuesday, true, $disabled_in_execution).'</td>
<td>'.__('Wed').html_print_checkbox('wednesday', 1, $wednesday, true, $disabled_in_execution).'</td>
<td>'.__('Thu').html_print_checkbox('thursday', 1, $thursday, true, $disabled_in_execution).'</td>
<td>'.__('Fri').html_print_checkbox('friday', 1, $friday, true, $disabled_in_execution).'</td>
<td>'.__('Sat').html_print_checkbox('saturday', 1, $saturday, true, $disabled_in_execution).'</td>
<td>'.__('Sun').html_print_checkbox('sunday', 1, $sunday, true, $disabled_in_execution)."</td>
</tr>
</table>
<table id='monthly_item' style='display: none;'>
<tr>
<td>".__('From day:').'</td>
<td>'.html_print_select(
$days,
'periodically_day_from',
$periodically_day_from,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
).'</td>
<td>'.__('To day:').'</td>
<td>'.html_print_select(
$days,
'periodically_day_to',
$periodically_day_to,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
).'</td>
<td>'.ui_print_help_tip(__('The end day must be higher than the start day'), true).'</td>
</tr>
</table>
<table>
<tr>
<td>'.__('From hour:').'</td>
<td>'.html_print_input_text(
'periodically_time_from',
$periodically_time_from,
'',
7,
7,
true,
$disabled_in_execution
).ui_print_help_tip(
__('The end time must be higher than the start time'),
true
).'</td>
<td>'.__('To hour:').'</td>
<td>'.html_print_input_text(
'periodically_time_to',
$periodically_time_to,
'',
7,
7,
true,
$disabled_in_execution
).ui_print_help_tip(
__('The end time must be higher than the start time'),
true
).'</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="cron_time" style="display: none;">
<table class="w100p">
<tr>
<td>'.__('Cron from:').'</td>
<td>'.html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, false, false, true, 'from').'</td>
</tr>
<tr>
<td>'.__('Cron to:').'</td>
<td>'.html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, false, true, true, 'to').'</td>
</tr>
</table>
</div>';
if ($id_downtime > 0) {
echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
} else {
echo '<form method="POST" action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor">';
}
// Editor form.
html_print_table($table);
echo "<td valign=top style='width:300px;padding-left:20px;'>";
$filter_group = (int) get_parameter('filter_group', 0);
@ -1074,105 +862,467 @@ if (empty($agents) || $disabled_in_execution) {
$disabled_add_button = true;
}
// Show available agents to include into downtime
$table = new StdClass();
$table->class = 'databox filters';
$table->class = 'databox filter-table-adv';
$table->id = 'principal_table_scheduled';
$table->width = '100%';
$table->size = [];
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = [];
$table->size[0] = '25%';
$table->data[0][0] = __('Group filter');
$table->data[0][1] = html_print_select_groups(
false,
$access,
$return_all_group,
'filter_group',
$filter_group,
'',
'',
'',
true,
false,
true,
'',
false,
'min-width:180px;margin-right:15px;'
);
$table->data[0][2] = __('Recursion').'&nbsp&nbsp'.html_print_checkbox('recursion', 1, $recursion, true, false, '');
$table->data[1][0] = __('Available agents');
$table->data[1][1] = html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, true, true, true, '', false, 'min-width: 250px;width: 70%;');
$table->rowid[2] = 'available_modules_selection_mode';
$table->data[2][1] = html_print_select(
$table->data['first_title'][] = html_print_div(
[
'common' => __('Show common modules'),
'all' => __('Show all modules'),
'class' => 'section_table_title',
'content' => __('Editor'),
],
'modules_selection_mode',
'common',
false,
'',
'',
true,
false,
true,
'',
false,
'min-width:180px;'
true
);
$table->data[0][] = html_print_label_input_block(
__('Name'),
html_print_input_text(
'name',
$name,
'',
25,
40,
true,
$disabled_in_execution
)
);
$table->data[0][] = html_print_label_input_block(
__('Group'),
html_print_select_groups(
false,
$access,
$return_all_group,
'id_group',
$id_group,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
)
);
$table->rowid[3] = 'available_modules';
$table->data[3][0] = __('Available modules:').ui_print_help_tip(
__('Only for type Quiet for downtimes.'),
$table->data[1][] = html_print_label_input_block(
__('Description'),
html_print_textarea(
'description',
3,
35,
$description,
'',
true
)
);
$table->data[1][] = html_print_label_input_block(
__('Type'),
html_print_select(
[
'quiet' => __('Quiet'),
'disable_agents' => __('Disabled Agents'),
'disable_agent_modules' => __('Disable Modules'),
'disable_agents_alerts' => __('Disabled only Alerts'),
],
'type_downtime',
$type_downtime,
'change_type_downtime()',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
).ui_print_input_placeholder(
__('Quiet: Modules will not generate events or fire alerts.').'<br>'.__('Disable Agents: Disables the selected agents.').'<br>'.__('Disable Alerts: Disable alerts for the selected agents.'),
true
)
);
$table->data[2][] = html_print_label_input_block(
__('Execution'),
html_print_select(
[
'once' => __('Once'),
'periodically' => __('Periodically'),
'cron' => __('Cron from/to'),
],
'type_execution',
$type_execution,
'change_type_execution();',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
)
);
$timeInputs = [];
$timeInputs[] = html_print_div(
[
'id' => 'once_time',
'style' => 'display: none',
'content' => html_print_div(
[
'class' => '',
'content' => html_print_input_text(
'once_date_from',
$once_date_from,
'',
10,
10,
true,
$disabled_in_execution
).html_print_input_text(
'once_time_from',
$once_time_from,
'',
9,
9,
true,
$disabled_in_execution
).'<span class="margin-lr-10 result_info_text">'.__(
'To'
).'</span>'.html_print_input_text(
'once_date_to',
$once_date_to,
'',
10,
10,
true
).html_print_input_text(
'once_time_to',
$once_time_to,
'',
9,
9,
true
),
],
true
),
],
true
);
$table->data[3][1] = html_print_select(
[],
'module[]',
'',
'',
'',
0,
true,
true,
true,
'',
false,
'min-width: 250px;width: 70%;'
$timeInputs[] = html_print_div(
[
'id' => 'periodically_time',
'style' => 'display: none',
'content' => html_print_div(
[
'class' => 'filter-table-adv-manual w50p',
'content' => html_print_label_input_block(
__('Type Periodicity'),
html_print_select(
[
'weekly' => __('Weekly'),
'monthly' => __('Monthly'),
],
'type_periodicity',
$type_periodicity,
'change_type_periodicity();',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
)
),
],
true
).html_print_div(
[
'id' => 'weekly_item',
'class' => '',
'content' => '<ul class="flex-row-center mrgn_top_15px mrgn_btn_15px">
<li class="flex">'.__('Mon').html_print_checkbox('monday', 1, $monday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'</li>
<li class="flex">'.__('Tue').html_print_checkbox('tuesday', 1, $tuesday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'</li>
<li class="flex">'.__('Wed').html_print_checkbox('wednesday', 1, $wednesday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'</li>
<li class="flex">'.__('Thu').html_print_checkbox('thursday', 1, $thursday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'</li>
<li class="flex">'.__('Fri').html_print_checkbox('friday', 1, $friday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'</li>
<li class="flex">'.__('Sat').html_print_checkbox('saturday', 1, $saturday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'</li>
<li class="flex">'.__('Sun').html_print_checkbox('sunday', 1, $sunday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'</li>
</ul>',
],
true
).html_print_div(
[
'id' => 'monthly_item',
'style' => 'margin-top: 12px;',
'class' => 'filter-table-adv-manual flex-row-start w50p',
'content' => html_print_label_input_block(
__('From day'),
html_print_select(
$days,
'periodically_day_from',
$periodically_day_from,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
),
[ 'div_style' => 'flex: 50; margin-right: 5px;' ]
).html_print_label_input_block(
__('To day'),
html_print_select(
$days,
'periodically_day_to',
$periodically_day_to,
'',
'',
0,
true,
false,
true,
'',
$disabled_in_execution
).ui_print_input_placeholder(
__('The end day must be higher than the start day'),
true
),
[ 'div_style' => 'flex: 50; margin-left: 5px;' ]
),
],
true
).html_print_div(
[
'class' => 'filter-table-adv-manual flex-row-start w50p',
'content' => html_print_label_input_block(
__('From hour'),
html_print_input_text(
'periodically_time_from',
$periodically_time_from,
'',
7,
7,
true,
$disabled_in_execution
).ui_print_input_placeholder(
__('The start time must be lower than the end time'),
true
),
[ 'div_style' => 'flex: 50; margin-right: 5px;' ]
).html_print_label_input_block(
__('To hour'),
html_print_input_text(
'periodically_time_to',
$periodically_time_to,
'',
7,
7,
true,
$disabled_in_execution
).ui_print_input_placeholder(
__('The end time must be higher than the start time'),
true
),
[ 'div_style' => 'flex: 50; margin-left: 5px;' ]
),
],
true
).ui_get_using_system_timezone_warning(),
],
true
);
$timeInputs[] = html_print_div(
[
'id' => 'cron_time',
'style' => 'display: none',
'content' => html_print_label_input_block(
__('Cron from'),
html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, false, false, true, 'from')
).html_print_label_input_block(
__('Cron to'),
html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, false, true, true, 'to')
),
],
true
);
$table->colspan[3][0] = 2;
$table->data[3][0] = html_print_label_input_block(
__('Configure the time'),
implode('', $timeInputs)
);
$table->data[4][] = html_print_div(
[
'class' => 'section_table_title',
'content' => __('Filtering'),
],
true
);
$table->data[5][] = html_print_label_input_block(
__('Group filter'),
html_print_select_groups(
false,
$access,
$return_all_group,
'filter_group',
$filter_group,
'',
'',
'',
true,
false,
true,
'',
false,
'min-width:180px;margin-right:15px;'
)
);
$table->data[5][] = html_print_label_input_block(
__('Recursion'),
html_print_checkbox_switch(
'recursion',
1,
$recursion,
true,
false,
''
)
);
$table->colspan[6][0] = 2;
$availableModules = html_print_label_input_block(
__('Available agents'),
html_print_select(
$agents,
'id_agents[]',
-1,
'',
__('Any'),
-2,
true,
true,
true,
'',
false,
'min-width: 250px;width: 70%;'
),
[
'div_class' => 'flex-column',
'div_style' => 'flex: 33',
]
);
$availableModules .= html_print_label_input_block(
__('Selection mode'),
html_print_select(
[
'common' => __('Show common modules'),
'all' => __('Show all modules'),
],
'modules_selection_mode',
'common',
false,
'',
'',
true,
false,
true,
'',
false,
'min-width:180px;'
),
[
'div_class' => 'available_modules_selection_mode flex-column',
'div_style' => 'flex: 33',
]
);
$availableModules .= html_print_label_input_block(
__('Available modules'),
html_print_select(
[],
'module[]',
'',
'',
'',
0,
true,
true,
true,
'',
false,
'min-width: 250px;width: 70%;'
).ui_print_input_placeholder(
__('Only for type Quiet for downtimes.'),
true
),
[
'div_class' => 'available_modules flex-column',
'div_style' => 'flex: 33',
]
);
$table->data[6][0] = html_print_div(
[
'style' => 'flex-direction: row;align-items: flex-start;',
'content' => $availableModules,
],
true
);
// Print agent table.
if ($id_downtime > 0) {
echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
} else {
echo '<form method="POST" action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor">';
}
html_print_table($table);
echo '<br /><br /><br />';
$buttons = '';
html_print_input_hidden('id_agent', $id_agent);
echo '<div class="action-buttons w100p" >';
if ($id_downtime > 0) {
html_print_input_hidden('update_downtime', 1);
html_print_input_hidden('id_downtime', $id_downtime);
html_print_submit_button(
$buttons .= html_print_submit_button(
__('Update'),
'updbutton',
false,
'class="sub upd"'
['icon' => 'update'],
true
);
} else {
html_print_input_hidden('create_downtime', 1);
html_print_submit_button(
$buttons .= html_print_submit_button(
__('Add'),
'crtbutton',
false,
'class="sub wand"'
['icon' => 'wand'],
true
);
}
echo '</div>';
html_print_action_buttons(
$buttons
);
html_print_input_hidden('all_common_modules', '');
echo '</form>';
@ -1208,11 +1358,17 @@ if (empty($downtimes_agents)) {
$table->head[2] = __('OS');
$table->head[3] = __('Last contact');
$table->head['count_modules'] = __('Modules');
$table->align = [];
$table->align[0] = 'center';
$table->align[1] = 'center';
$table->align[2] = 'center';
$table->align[3] = 'center';
$table->align[4] = 'center';
if (!$running) {
$table->head[5] = __('Actions');
$table->align[5] = 'center';
$table->size[5] = '5%';
$table->align[5] = 'right';
$table->size[5] = '10%';
}
foreach ($downtimes_agents as $downtime_agent) {
@ -1232,7 +1388,13 @@ if (empty($downtimes_agents)) {
WHERE id_grupo = '.$downtime_agent['id_grupo']
);
$data[2] = ui_print_os_icon($downtime_agent['id_os'], true, true);
$data[2] = html_print_div(
[
'class' => 'main_menu_icon invert_filter',
'content' => ui_print_os_icon($downtime_agent['id_os'], false, true),
],
true
);
$data[3] = $downtime_agent['ultimo_contacto'];
@ -1251,10 +1413,10 @@ if (empty($downtimes_agents)) {
if (!$running) {
$data[5] = '';
if ($type_downtime !== 'disable_agents') {
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).'</a>';
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/edit.svg', true, ['alt' => __('Edit'), 'class' => 'main_menu_icon invert_filter']).'</a>';
}
$data[5] .= '<a href="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).'</a>';
$data[5] .= '<a href="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image('images/delete.svg', true, ['alt' => __('Delete'), 'class' => 'main_menu_icon invert_filter']).'</a>';
}
$table->data['agent_'.$downtime_agent['id_agente']] = $data;
@ -1263,17 +1425,7 @@ if (empty($downtimes_agents)) {
html_print_table($table);
}
$table = new stdClass();
$table->id = 'loading';
$table->width = '100%';
$table->colspan['loading'][0] = '6';
$table->style[0] = 'text-align: center;';
$table->data = [];
$table->data['loading'] = [];
$table->data['loading'][0] = html_print_image('images/spinner.gif', true);
echo "<div class='invisible'>";
html_print_table($table);
echo '</div>';
ui_print_spinner('Loading');
$table = new stdClass();
$table->id = 'editor';
@ -1577,13 +1729,13 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
switch ($("#type_downtime").val()) {
case 'disable_agents_alerts':
case 'disable_agents':
$("#available_modules").hide();
$("#available_modules_selection_mode").hide();
$(".available_modules").hide();
$(".available_modules_selection_mode").hide();
break;
case 'quiet':
case 'disable_agent_modules':
$("#available_modules_selection_mode").show();
$("#available_modules").show();
$(".available_modules_selection_mode").show();
$(".available_modules").show();
break;
}
}

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* 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
@ -89,7 +89,7 @@ if (is_ajax() === true) {
[
'id' => 'agent_modules_affected_planned_downtime',
'class' => 'info_table',
'style' => 'width: 100%',
'style' => 'width: 99%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'godmode/agentes/planned_downtime.list',
@ -103,6 +103,7 @@ if (is_ajax() === true) {
],
'search_button_class' => 'sub filter float-right',
'form' => [
'class' => 'filter-table-adv',
'inputs' => [
[
'label' => __('Agents'),
@ -207,13 +208,23 @@ if ($migrate_malformed === true) {
}
// Header.
ui_print_page_header(
ui_print_standard_header(
__('Scheduled Downtime'),
'images/gm_monitoring.png',
false,
'',
true,
''
[],
[
[
'link' => '',
'label' => __('Tools'),
],
[
'link' => '',
'label' => __('Scheduled Downtime'),
],
],
);
$id_downtime = (int) get_parameter('id_downtime', 0);
@ -308,34 +319,8 @@ $filter_params['module_name'] = $module_name;
$filter_params_str = http_build_query($filter_params);
// Table filter.
$table_form = new StdClass();
$table_form->class = 'databox filters';
$table_form->width = '100%';
$table_form->rowstyle = [];
$table_form->cellstyle[0] = ['width: 100px;'];
$table_form->cellstyle[1] = ['width: 100px;'];
$table_form->cellstyle[1][2] = 'display: flex; align-items: center;';
$table_form->cellstyle[2] = ['width: 100px;'];
$table_form->cellstyle[3] = ['text-align: right;'];
$table_form->colspan[3][0] = 3;
$table_form->data = [];
$row = [];
// Search text.
$row[] = __('Search');
$row[] = html_print_input_text(
'search_text',
$search_text,
'',
50,
250,
true
);
// Dates.
$date_inputs = __('From').'&nbsp;'.html_print_input_text(
// From/To inputs.
$date_inputs = html_print_input_text(
'date_from',
$date_from,
'',
@ -343,8 +328,8 @@ $date_inputs = __('From').'&nbsp;'.html_print_input_text(
10,
true
);
$date_inputs .= '&nbsp;&nbsp;';
$date_inputs .= __('To').'&nbsp;'.html_print_input_text(
$date_inputs .= '&nbsp;'.__('To').'&nbsp;';
$date_inputs .= html_print_input_text(
'date_to',
$date_to,
'',
@ -352,11 +337,6 @@ $date_inputs .= __('To').'&nbsp;'.html_print_input_text(
10,
true
);
$row[] = $date_inputs;
$table_form->data[] = $row;
$row = [];
// Execution type.
$execution_type_fields = [
@ -364,29 +344,6 @@ $execution_type_fields = [
'periodically' => __('Periodically'),
'cron' => __('Cron'),
];
$row[] = __('Execution type');
$row[] = html_print_select(
$execution_type_fields,
'execution_type',
$execution_type,
'',
__('Any'),
'',
true,
false,
false
);
// Show past downtimes.
$row[] = __('Show past downtimes').'&nbsp;&nbsp;&nbsp;&nbsp;'.html_print_switch(
[
'name' => 'archived',
'value' => $show_archived,
]
);
$table_form->data[] = $row;
$row = [];
// Agent.
$params = [];
@ -397,33 +354,89 @@ $params['return'] = true;
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $agent_id;
$row[] = __('Agent');
$row[] = ui_print_agent_autocomplete_input($params);
// Module.
$row[] = __('Module').'&nbsp;'.html_print_autocomplete_modules(
'module_name',
$module_name,
false,
true,
'',
[],
true
);
$table_form->data[] = $row;
$row = [];
$row[] = html_print_submit_button(
// Table filter.
$table_form = new stdClass();
$table_form->class = 'filter-table-adv';
$table_form->id = 'filter_scheduled_downtime';
$table_form->width = '100%';
$table_form->rowstyle = [];
$table_form->cellstyle[0] = ['width: 100px;'];
$table_form->cellstyle[1] = ['width: 100px;'];
$table_form->cellstyle[1][2] = 'display: flex; align-items: center;';
$table_form->cellstyle[2] = ['width: 100px;'];
$table_form->cellstyle[3] = ['text-align: right;'];
$table_form->data = [];
// Search text.
$table_form->data[0][] = html_print_label_input_block(
__('Search'),
'search',
false,
'class="sub search"',
true
html_print_input_text(
'search_text',
$search_text,
'',
50,
250,
true
)
);
// From / To.
$table_form->data[0][] = html_print_label_input_block(
__('Between dates'),
html_print_div(
[
'class' => 'flex-content-left',
'content' => $date_inputs,
],
true
)
);
// Show past downtimes.
$table_form->data[0][] = html_print_label_input_block(
__('Show past downtimes'),
html_print_switch(
[
'name' => 'archived',
'value' => $show_archived,
]
)
);
// Execution type.
$table_form->data[1][] = html_print_label_input_block(
__('Execution type'),
html_print_select(
$execution_type_fields,
'execution_type',
$execution_type,
'',
__('Any'),
'',
true,
false,
false
)
);
$table_form->data[1][] = html_print_label_input_block(
__('Agent'),
ui_print_agent_autocomplete_input($params)
);
$table_form->data[1][] = html_print_label_input_block(
__('Module'),
html_print_autocomplete_modules(
'module_name',
$module_name,
false,
true,
'',
[],
true,
0,
30,
true
)
);
$table_form->data[] = $row;
// End of table filter.
// Useful to know if the user has done a form filtering.
$filter_performed = false;
@ -626,35 +639,86 @@ if ($downtimes === false && $filter_performed === false) {
// No downtimes cause the user performed a search.
// Filter form.
echo '<form method="post" action="'.$url_list.'">';
html_print_table($table_form);
$outputTable = html_print_table($table_form, true);
$outputTable .= html_print_div(
[
'class' => 'action-buttons-right-forced',
'content' => html_print_submit_button(
__('Filter'),
'search',
false,
[
'icon' => 'search',
'mode' => 'mini',
],
true
),
],
true
);
ui_toggle(
$outputTable,
'<span class="subsection_header_title">'.__('Filters').'</span>',
__('Filters'),
'',
true,
false,
'',
'white-box-content',
'box-flat white_table_graph fixed_filter_bar'
);
echo '</form>';
// Info message.
echo '<div class="nf">'.__('No scheduled downtime').'</div>';
echo '<div class="action-buttons w100p" >';
ui_print_info_message(__('No scheduled downtime'));
// Create button.
if ($write_permisson === true) {
echo '&nbsp;';
echo '<form method="post" class="display_in" action="'.$url_editor.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
html_print_action_buttons(
html_print_submit_button(
__('Create'),
'create',
false,
['icon' => 'next'],
true
)
);
echo '</form>';
}
echo '</div>';
} else {
// Has downtimes.
echo '<form method="post" action="'.$url_list.'">';
html_print_table($table_form);
$outputTable = html_print_table($table_form, true);
$outputTable .= html_print_div(
[
'class' => 'action-buttons-right-forced',
'content' => html_print_submit_button(
__('Search'),
'search',
false,
[
'icon' => 'search',
'mode' => 'mini',
],
true
),
],
true
);
ui_toggle(
$outputTable,
'<span class="subsection_header_title">'.__('Filters').'</span>',
__('Filters'),
'',
true,
false,
'',
'white-box-content',
'box-flat white_table_graph fixed_filter_bar'
);
echo '</form>';
ui_pagination(
$downtimes_number,
$url_list.'&'.$filter_params_str,
$offset
);
// User groups with AR, AD or AW permission.
$groupsAD = users_get_groups($config['id_user'], $access);
$groupsAD = array_keys($groupsAD);
@ -753,17 +817,17 @@ if ($downtimes === false && $filter_performed === false) {
$settings = [
'url' => ui_get_full_url('ajax.php', false, false, false),
'loadingText' => __('Loading, this operation might take several minutes...'),
'title' => __('Agents / Modules affected'),
'title' => __('Elements affected'),
'id' => $downtime['id'],
];
$data['agents_modules'] = '<a href="#" onclick=\'dialogAgentModulesAffected('.json_encode($settings).')\'>';
$data['agents_modules'] .= html_print_image(
'images/search_big.png',
'images/details.svg',
true,
[
'title' => __('Agents and modules affected'),
'style' => 'width:22px; height: 22px;',
'class' => 'main_menu_icon invert_filter',
]
);
$data['agents_modules'] .= '</a>';
@ -780,15 +844,21 @@ if ($downtimes === false && $filter_performed === false) {
$url_list_params = $url_list.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str;
$data['stop'] = '<a href="'.$url_list_params.'">';
$data['stop'] .= html_print_image(
'images/cancel.png',
'images/fail@svg.svg',
true,
['title' => __('Stop downtime')]
[
'title' => __('Stop downtime'),
'class' => 'main_menu_icon invert_filter',
]
);
} else {
$data['stop'] = html_print_image(
'images/cancel.png',
'images/fail@svg.svg',
true,
['title' => __('Stop downtime')]
[
'title' => __('Stop downtime'),
'class' => 'main_menu_icon invert_filter',
]
);
}
} else {
@ -803,11 +873,11 @@ if ($downtimes === false && $filter_performed === false) {
// Copy.
$data['copy'] = '<a href="'.$url_editor.'&downtime_copy=1&id_downtime='.$downtime['id'].'">';
$data['copy'] .= html_print_image(
'images/copy.png',
'images/copy.svg',
true,
[
'title' => __('Copy'),
'class' => 'invert_filter',
'class' => 'main_menu_icon invert_filter',
]
);
$data['copy'] .= '</a>';
@ -815,11 +885,11 @@ if ($downtimes === false && $filter_performed === false) {
// Edit.
$data['edit'] = '<a href="'.$url_editor.'&edit_downtime=1&id_downtime='.$downtime['id'].'">';
$data['edit'] .= html_print_image(
'images/config.png',
'images/configuration@svg.svg',
true,
[
'title' => __('Update'),
'class' => 'invert_filter',
'class' => 'main_menu_icon invert_filter',
]
);
$data['edit'] .= '</a>';
@ -828,11 +898,11 @@ if ($downtimes === false && $filter_performed === false) {
$url_delete = $url_list.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str;
$data['delete'] = '<a id="delete_downtime" href="'.$url_delete.'">';
$data['delete'] .= html_print_image(
'images/cross.png',
'images/delete.svg',
true,
[
'title' => __('Delete'),
'class' => 'invert_filter',
'class' => 'main_menu_icon invert_filter',
]
);
$data['delete'] .= '</a>';
@ -849,22 +919,22 @@ if ($downtimes === false && $filter_performed === false) {
// Copy.
$data['copy'] = '<a href="'.$url_editor.'&downtime_copy=1&id_downtime='.$downtime['id'].'">';
$data['copy'] .= html_print_image(
'images/copy.png',
'images/copy.svg',
true,
[
'title' => __('Copy'),
'class' => 'invert_filter',
'class' => 'main_menu_icon invert_filter',
]
);
$data['copy'] .= '</a>';
// Edit.
$data['edit'] = '<a href="'.$url_editor.'&edit_downtime=1&id_downtime='.$downtime['id'].'">';
$data['edit'] .= html_print_image(
'images/config.png',
'images/configuration@svg.svg',
true,
[
'title' => __('Update'),
'class' => 'invert_filter',
'class' => 'main_menu_icon invert_filter',
]
);
$data['edit'] .= '</a>';
@ -901,44 +971,47 @@ if ($downtimes === false && $filter_performed === false) {
}
html_print_table($table);
ui_pagination(
$tablePagination = ui_pagination(
$downtimes_number,
$url_list.'&'.$filter_params_str,
$offset,
0,
false,
'offset',
true,
'pagination-bottom'
'offset',
false
);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
// CSV export button.
echo '<div class="display_in">';
html_print_button(
__('Export to CSV'),
'csv_export',
false,
'blockResubmit($(this)); location.href=\'godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'\'',
'class="sub next"'
);
echo '</div>';
$actionsButtons = '';
// Create button.
if ($write_permisson === true) {
echo '&nbsp;';
echo '<form method="post" action="'.$url_editor.'" class="display_in" >';
html_print_submit_button(
$actionsButtons .= '<form method="post" action="'.$url_editor.'" class="display_in" >';
$actionsButtons .= html_print_submit_button(
__('Create'),
'create',
false,
'class="sub next"'
['icon' => 'next'],
true
);
echo '</form>';
$actionsButtons .= '</form>';
}
echo '</div>';
// CSV export button.
$actionsButtons .= html_print_button(
__('Export to CSV'),
'csv_export',
false,
'blockResubmit($(this)); location.href="godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'"',
[
'icon' => 'load',
'mode' => 'secondary',
],
true
);
html_print_action_buttons(
$actionsButtons,
[ 'right_content' => $tablePagination ]
);
}
ui_require_jquery_file(

View File

@ -122,8 +122,6 @@ if ($fields_selected[0] != '') {
}
}
echo '<h3>'.__('Show monitor detail fields').'</h3>';
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
@ -161,6 +159,12 @@ foreach ($fields_available as $key => $available) {
}
}
// General title.
$generalTitleContent = [];
$generalTitleContent[] = html_print_div([ 'style' => 'width: 10px; flex: 0 0 auto; margin-right: 5px;}', 'class' => 'section_table_title_line' ], true);
$generalTitleContent[] = html_print_div([ 'class' => 'section_table_title', 'content' => __('Show monitor detail fields')], true);
$titledata[0] = html_print_div(['class' => 'flex-row-center', 'content' => implode('', $generalTitleContent) ], true);
$table->data['general_title'] = $titledata;
$table->data[0][0] = '<b>'.__('Fields available').'</b>';
$table->data[1][0] = html_print_select($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px');
$table->data[1][1] = '<a href="javascript:">'.html_print_image(
@ -202,10 +206,18 @@ $table->data[1][2] = html_print_select(
echo '<form id="custom_status_monitor" method="post" action="index.php?sec=view&sec2=operation/agentes/status_monitor&section=fields&amp;pure='.$config['pure'].'">';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button(__('Update'), 'upd_button', false, 'class="sub upd"');
html_print_action_buttons(
html_print_submit_button(
__('Update'),
'update_button',
false,
[ 'icon' => 'update' ],
true
)
);
echo '</form>';
echo '</div>';
?>
<script type="text/javascript">

View File

@ -36,10 +36,6 @@ enterprise_include_once('meta/include/functions_alerts_meta.php');
check_login();
enterprise_hook('open_meta_frame');
if (! check_acl($config['id_user'], 0, 'LM')) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
@ -70,12 +66,19 @@ if (check_acl_restricted_all($config['id_user'], 0, 'LM')) {
if (defined('METACONSOLE')) {
alerts_meta_print_header();
} else {
ui_print_page_header(
__('Alerts').' &raquo; '.__('Alert actions'),
ui_print_standard_header(
__('Alerts'),
'images/gm_alerts.png',
false,
'',
true
true,
[],
[
[
'link' => '',
'label' => __('Alert actions'),
],
]
);
}
@ -234,21 +237,25 @@ $url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&search_string='
// Filter table.
$table_filter = new stdClass();
$table_filter->width = '100%';
$table_filter->class = 'databox filters';
$table_filter->class = 'databox filters no_border filter-table-adv';
$table_filter->style = [];
$table_filter->style[0] = 'font-weight: bold';
$table_filter->style[2] = 'font-weight: bold';
$table_filter->style[4] = 'font-weight: bold';
$table_filter->style[0] = 'width: 33%';
$table_filter->style[1] = 'width: 33%';
$table_filter->style[2] = 'width: 33%';
$table_filter->data = [];
$table_filter->colspan = [];
$table_filter->colspan[1][0] = 3;
$table_filter->data[0][0] = __('Search');
$table_filter->data[0][1] = html_print_input_text(
'search_string',
$search_string,
'',
25,
255,
true
$table_filter->data[0][0] = html_print_label_input_block(
__('Search'),
html_print_input_text(
'search_string',
$search_string,
'',
25,
255,
true
)
);
$return_all_group = false;
@ -257,19 +264,22 @@ if (users_can_manage_group_all('LM') === true) {
$return_all_group = true;
}
$table_filter->data[0][2] = __('Group');
$table_filter->data[0][3] = html_print_select_groups(
$config['id_user'],
'LM',
$return_all_group,
'group_search',
$group_search,
'',
'',
0,
true
$table_filter->data[0][1] = html_print_label_input_block(
__('Group'),
html_print_select_groups(
$config['id_user'],
'LM',
$return_all_group,
'group_search',
$group_search,
'',
'',
0,
true
)
);
$table_filter->data[0][4] = __('Command');
$commands_sql = db_get_all_rows_filter(
'talert_commands',
['id_group' => array_keys(users_get_groups(false, 'LW'))],
@ -283,39 +293,54 @@ $commands_sql = db_get_all_rows_filter(
);
$commands = db_get_all_rows_sql($commands_sql);
$table_filter->data[0][5] = html_print_select(
index_array($commands, 'id', 'name'),
'id_command_search',
$id_command_search,
'',
__('None'),
0,
true,
false,
true,
'',
false,
'width:150px'
$table_filter->data[0][2] = html_print_label_input_block(
__('Command'),
html_print_select(
index_array($commands, 'id', 'name'),
'id_command_search',
$id_command_search,
'',
__('None'),
0,
true,
false,
true,
'',
false,
'width:100%'
)
);
$table_filter->data[0][6] = '<div class="action-buttons">';
$table_filter->data[0][6] .= html_print_submit_button(
$table_filter->data[1][0] = '<div class="float-right">';
$table_filter->data[1][0] .= html_print_submit_button(
__('Search'),
'',
false,
'class="sub search"',
[
'icon' => 'search',
'class' => 'mini',
],
true
);
$table_filter->data[0][5] .= '</div>';
$table_filter->data[1][0] .= '</div>';
$show_table_filter = '<form method="post" action="'.$url.'">';
$show_table_filter .= html_print_table($table_filter, true);
$show_table_filter .= ui_toggle(
html_print_table($table_filter, true),
'<span class="subsection_header_title">'.__('Search').'</span>',
__('Search'),
'search',
true,
false,
'',
'white-box-content no_border',
'filter-datatable-main box-flat white_table_graph fixed_filter_bar '
);
$show_table_filter .= '</form>';
if (is_metaconsole()) {
ui_toggle($show_table_filter, __('Show Options'));
} else {
echo $show_table_filter;
}
echo $show_table_filter;
$table = new stdClass();
@ -391,7 +416,7 @@ foreach ($actions as $action) {
$data = [];
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.$action['name'].'</a>';
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'&offset='.$offset.'">'.$action['name'].'</a>';
if ($action['id_group'] == 0 && $can_edit_all == false) {
$data[0] .= ui_print_help_tip(__('You cannot edit this action, You don\'t have the permission to edit All group.'), true);
}
@ -416,8 +441,8 @@ foreach ($actions as $action) {
&& check_acl($config['id_user'], $action['id_group'], 'LM')
) {
$table->cellclass[] = [
3 => 'action_buttons',
4 => 'action_buttons',
3 => 'table_action_buttons',
4 => 'table_action_buttons',
];
$id_action = $action['id'];
@ -428,11 +453,14 @@ foreach ($actions as $action) {
$data[3] .= html_print_input_hidden('id', $id_action, true);
$data[3] .= html_print_input_image(
'dup',
'images/copy.png',
'images/copy.svg',
1,
'',
true,
['title' => __('Duplicate')]
[
'title' => __('Duplicate'),
'class' => 'main_menu_icon invert_filter',
]
);
$data[3] .= '</form> ';
@ -442,11 +470,14 @@ foreach ($actions as $action) {
$data[4] .= html_print_input_hidden('id', $id_action, true);
$data[4] .= html_print_input_image(
'del',
'images/cross.png',
'images/delete.svg',
1,
'',
true,
['title' => __('Delete')]
[
'title' => __('Delete'),
'class' => 'main_menu_icon invert_filter',
]
);
$data[4] .= '</form> ';
} else {
@ -457,21 +488,20 @@ foreach ($actions as $action) {
array_push($table->data, $data);
}
ui_pagination($total_actions, $url);
$pagination = '';
if (isset($data)) {
html_print_table($table);
ui_pagination($total_actions, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
$pagination = ui_pagination($total_actions, $url, 0, 0, true, 'offset', false, '');
} else {
ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]);
}
if (is_management_allowed() === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'&offset='.$offset.'">';
$button = html_print_submit_button(__('Create'), 'create', false, ['icon' => 'wand'], true);
html_print_input_hidden('create_alert', 1);
html_print_action_buttons($button, ['right_content' => $pagination]);
echo '</form>';
echo '</div>';
}
enterprise_hook('close_meta_frame');

View File

@ -171,10 +171,10 @@ if (is_ajax()) {
$ffield = $editor_type_chkbx;
$ffield .= html_print_textarea(
'field'.$i.'_value',
1,
5,
1,
'',
'class="fields"',
'class="fields w100p"',
true,
'',
$is_management_allowed
@ -208,7 +208,7 @@ if (is_ajax()) {
$rfield = $editor_type_chkbx;
$rfield .= html_print_textarea(
'field'.$i.'_recovery_value',
1,
5,
1,
'',
'class="fields_recovery"',
@ -307,7 +307,8 @@ if (is_ajax()) {
false,
false,
'fields',
$is_management_allowed
$is_management_allowed,
'width: 100%;'
);
$rfield .= html_print_select(
@ -321,7 +322,8 @@ if (is_ajax()) {
false,
false,
'fields',
$is_management_allowed
$is_management_allowed,
'width: 100%;'
);
$ffield .= html_print_input_text('field'.$i.'_value[]', '', '', 10, 10, true, false, false, '', 'datepicker');
@ -329,7 +331,7 @@ if (is_ajax()) {
$ffield .= html_print_textarea(
'field'.$i.'_value[]',
1,
5,
1,
'',
'style="min-height:40px; '.$style.'" class="fields"',
@ -341,7 +343,7 @@ if (is_ajax()) {
$rfield .= html_print_textarea(
'field'.$i.'_recovery_value[]',
1,
5,
1,
'',
'style="min-height:40px; '.$style.'" class="fields_recovery',
@ -484,20 +486,20 @@ if (is_ajax()) {
} else {
$ffield = html_print_textarea(
'field'.$i.'_value',
1,
5,
1,
$fv[0],
'style="'.$style.'" class="fields min-height-40px"',
'style="'.$style.'" class="fields min-height-40px w100p"',
true,
'',
$is_management_allowed
);
$rfield = html_print_textarea(
'field'.$i.'_recovery_value',
1,
5,
1,
$fv[0],
'style="'.$style.'" class="fields_recovery min-height-40px',
'style="'.$style.'" class="fields_recovery min-height-40px w100p',
true,
'',
$is_management_allowed
@ -507,20 +509,20 @@ if (is_ajax()) {
} else {
$ffield = html_print_textarea(
'field'.$i.'_value',
1,
5,
1,
'',
'style="'.$style.'" class="fields min-height-40px"',
'style="'.$style.'" class="fields min-height-40px w100p"',
true,
'',
$is_management_allowed
);
$rfield = html_print_textarea(
'field'.$i.'_recovery_value',
1,
5,
1,
'',
'style="'.$style.'" class="fields_recovery min-height-40px"',
'style="'.$style.'" class="fields_recovery min-height-40px w100p"',
true,
'',
$is_management_allowed
@ -533,7 +535,7 @@ if (is_ajax()) {
$fields_rows[$i] = '';
} else {
$fields_rows[$i] = '<tr id="table_macros-field'.$i.'" class="datos">';
$fields_rows[$i] .= '<td class="datos bolder w20p">'.$fdesc.'</td>';
$fields_rows[$i] .= '<td class="datos bolder w20p" style="font-size: 13px;">'.$fdesc.'</td>';
$fields_rows[$i] .= '<td class="datos">'.$ffield.'</td>';
if ($get_recovery_fields) {
$fields_rows[$i] .= '<td class="datos recovery_col">'.$rfield.'</td>';
@ -566,8 +568,6 @@ tyle='display:none;'>";
echo '</div>';
}
enterprise_hook('open_meta_frame');
if ($update_command) {
include_once 'configure_alert_command.php';
return;
@ -577,12 +577,19 @@ if ($update_command) {
if (defined('METACONSOLE')) {
alerts_meta_print_header();
} else {
ui_print_page_header(
__('Alerts').' &raquo; '.__('Alert commands'),
ui_print_standard_header(
__('Alerts'),
'images/gm_alerts.png',
false,
'',
true
true,
[],
[
[
'link' => '',
'label' => __('Alert commands'),
],
]
);
}
@ -794,16 +801,17 @@ foreach ($commands as $command) {
io_safe_output($command['description'])
);
$data['action'] = '';
$table->cellclass[]['action'] = 'action_buttons';
$table->cellclass[]['action'] = 'table_action_buttons';
$offset_delete = ($offset >= ($total_commands - 1)) ? ($offset - $limit) : $offset;
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.
if ($is_management_allowed === true && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) {
if (is_user_admin($config['id_user']) === true) {
$data['action'] = '<span class="inline_flex">';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'"
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'&offset='.$offset.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true, ['class' => 'invert_filter']).'</a>';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'"
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'&offset='.$offset_delete.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>';
$data['action'] .= '</span>';
}
@ -812,10 +820,9 @@ foreach ($commands as $command) {
array_push($table->data, $data);
}
ui_pagination($total_commands, $url);
if (isset($data) === true && count($table->data) > 0) {
html_print_table($table);
ui_pagination($total_commands, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
$pagination = ui_pagination($total_commands, $url, 0, 0, true, 'offset', false, '');
} else {
ui_print_info_message(
[
@ -827,16 +834,19 @@ if (isset($data) === true && count($table->data) > 0) {
// Commands can only be created by the super administrator.
if (users_is_admin() === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
$buttonSubmit = html_print_submit_button(
__('Create'),
'create',
false,
['icon' => 'wand'],
true
);
html_print_input_hidden('create_alert', 1);
html_print_action_buttons($buttonSubmit, ['right_content' => $pagination]);
echo '</form>';
echo '</div>';
}
enterprise_hook('close_meta_frame');
?>
<script type="text/javascript">

Some files were not shown because too many files have changed in this diff Show More