mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Merge remote-tracking branch 'origin/develop' into ent-8508-cepsa-correlation-server-no-encola-alertas-en-alert-server
Conflicts: pandora_console/extras/mr/52.sql pandora_console/pandoradb.sql
This commit is contained in:
commit
261fbe0ba3
10
README.md
10
README.md
@ -1,12 +1,16 @@
|
|||||||
[](https://travis-ci.org/pandorafms/pandorafms)
|
[](https://travis-ci.org/pandorafms/pandorafms)
|
||||||
|
|
||||||
[](http://pandorafms.org)
|

|
||||||
|
|
||||||
Pandora FMS is a monitoring software for IT infrastructure management which includes network equipment, Windows and Unix servers, virtual infrastructure and all different kind of applications. It has a large amount of features, making it a new generation software which discovers all the monitoring issues that an organization may need.
|
With more than 50,000 customer installations across the five continents, Pandora FMS is an out-of-the-box monitoring solution: profitable and scalable, covering most infrastructure deployment options.
|
||||||
|
|
||||||
|
Pandora FMS gives you the agility to find and solve problems quickly, scaling them so they can be derived from any source, on-premise, multi cloud or both of them mixed. Now you have that capability across your entire IT stack and analytics to find any problem, even the ones that are hard to find.
|
||||||
|
|
||||||
|
Thanks to more than 500 plugins available, you can control and manage any application and technology, from SAP, Oracle, Lotus, Citrix or Jboss to VMware, AWS, SQL Server, Redhat, Websphere, etc.
|
||||||
|
|
||||||
### Support
|
### Support
|
||||||
|
|
||||||
For community support you can visit our forums at http://forums.pandorafms.org. Visit our community page at http://pandorafms.org and if you need commercial information or/and professional support visit http://pandorafms.com.
|
For community support you can visit our forums at https://pandorafms.com/community/ and if you need commercial information or/and professional support visit https://pandorafms.com
|
||||||
|
|
||||||
### How to install Pandora FMS
|
### How to install Pandora FMS
|
||||||
|
|
||||||
|
@ -82,10 +82,10 @@ execute_cmd "[ $PANDORA_SERVER_IP ]" 'Check Server IP Address' 'Please define e
|
|||||||
# Check OS.
|
# Check OS.
|
||||||
OS=$([[ $(grep '^ID_LIKE=' /etc/os-release) ]] && grep ^ID_LIKE= /etc/os-release | cut -d '=' -f2 | tr -d '"' || grep ^ID= /etc/os-release | cut -d '=' -f2 | tr -d '"')
|
OS=$([[ $(grep '^ID_LIKE=' /etc/os-release) ]] && grep ^ID_LIKE= /etc/os-release | cut -d '=' -f2 | tr -d '"' || grep ^ID= /etc/os-release | cut -d '=' -f2 | tr -d '"')
|
||||||
|
|
||||||
[[ $OS == 'rhel fedora' ]] && OS_RELEASE=$OS
|
[[ $OS =~ 'rhel' ]] && OS_RELEASE=$OS
|
||||||
[[ $OS == 'fedora' ]] && OS_RELEASE=$OS
|
[[ $OS =~ 'debian' ]] && OS_RELEASE=$OS
|
||||||
[[ $OS == 'centos rhel fedora' ]] && OS_RELEASE=$OS
|
#[[ $OS == 'rhel fedora' ]] && OS_RELEASE=$OS
|
||||||
[[ $OS == 'debian' ]] && OS_RELEASE=$OS
|
#[[ $OS == 'centos rhel fedora' ]] && OS_RELEASE=$OS
|
||||||
|
|
||||||
# initialice logfile
|
# initialice logfile
|
||||||
execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE"
|
execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE"
|
||||||
@ -113,7 +113,7 @@ execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_d
|
|||||||
|
|
||||||
# Downloading and installing packages
|
# Downloading and installing packages
|
||||||
|
|
||||||
if [[ $OS_RELEASE == 'rhel fedora' ]] || [[ $OS_RELEASE == 'centos rhel fedora' ]]; then
|
if [[ $OS_RELEASE =~ 'rhel' ]]; then
|
||||||
yum install -y perl wget curl perl-Sys-Syslog unzip &>> $LOGFILE
|
yum install -y perl wget curl perl-Sys-Syslog unzip &>> $LOGFILE
|
||||||
echo -e "${cyan}Instaling agent dependencies...${reset}" ${green}OK${reset}
|
echo -e "${cyan}Instaling agent dependencies...${reset}" ${green}OK${reset}
|
||||||
|
|
||||||
|
@ -1,20 +1,32 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#######################################################
|
||||||
|
# PandoraFMS Community online installation script
|
||||||
|
#######################################################
|
||||||
|
## Tested versions ##
|
||||||
|
# Centos 7.9
|
||||||
|
|
||||||
# define variables
|
#Constants
|
||||||
PANDORA_CONSOLE=/var/www/html/pandora_console
|
PANDORA_CONSOLE=/var/www/html/pandora_console
|
||||||
CONSOLE_PATH=/var/www/html/pandora_console
|
|
||||||
PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
|
PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
|
||||||
PANDORA_SERVER_BIN=/usr/bin/pandora_server
|
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
|
||||||
PANDORA_HA_BIN=/usr/bin/pandora_ha
|
|
||||||
PANDORA_TABLES_MIN=160
|
|
||||||
DBHOST=127.0.0.1
|
S_VERSION='2022012401'
|
||||||
DBNAME=pandora
|
|
||||||
DBUSER=pandora
|
|
||||||
DBPASS=pandora
|
|
||||||
DBPORT=3306
|
|
||||||
S_VERSION='2021012801'
|
|
||||||
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
||||||
|
|
||||||
|
# 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_PRECHECK" ] || SKIP_PRECHECK=0
|
||||||
|
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
|
||||||
|
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
|
||||||
|
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
|
||||||
|
|
||||||
# Ansi color code variables
|
# Ansi color code variables
|
||||||
red="\e[0;91m"
|
red="\e[0;91m"
|
||||||
green="\e[0;92m"
|
green="\e[0;92m"
|
||||||
@ -60,7 +72,7 @@ check_pre_pandora () {
|
|||||||
|
|
||||||
echo -en "${cyan}Checking environment ... ${reset}"
|
echo -en "${cyan}Checking environment ... ${reset}"
|
||||||
rpm -qa | grep pandora &>> /dev/null && local fail=true
|
rpm -qa | grep pandora &>> /dev/null && local fail=true
|
||||||
[ -d "$CONSOLE_PATH" ] && local fail=true
|
[ -d "$PANDORA_CONSOLE" ] && local fail=true
|
||||||
[ -f /usr/bin/pandora_server ] && local fail=true
|
[ -f /usr/bin/pandora_server ] && local fail=true
|
||||||
echo "use $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST &>> /dev/null && local fail=true
|
echo "use $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST &>> /dev/null && local fail=true
|
||||||
|
|
||||||
@ -111,7 +123,7 @@ echo "Community installer version: $S_VERSION" >> $LOGFILE
|
|||||||
check_root_permissions
|
check_root_permissions
|
||||||
|
|
||||||
# Pre installed pandora
|
# Pre installed pandora
|
||||||
check_pre_pandora
|
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
|
||||||
|
|
||||||
# Connectivity
|
# Connectivity
|
||||||
check_repo_connection
|
check_repo_connection
|
||||||
@ -125,6 +137,9 @@ execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]"
|
|||||||
# Check disk size at least 10 Gb free space
|
# Check disk size at least 10 Gb free space
|
||||||
execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)'
|
execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)'
|
||||||
|
|
||||||
|
# Setting timezone
|
||||||
|
execute_cmd "timedatectl set-timezone $TZ" "Setting Timezone $TZ"
|
||||||
|
|
||||||
# Execute tools check
|
# Execute tools check
|
||||||
execute_cmd "awk --version" 'Checking needed tools: awk'
|
execute_cmd "awk --version" 'Checking needed tools: awk'
|
||||||
execute_cmd "grep --version" 'Checking needed tools: grep'
|
execute_cmd "grep --version" 'Checking needed tools: grep'
|
||||||
@ -148,10 +163,10 @@ http://rpms.remirepo.net/enterprise/remi-release-7.rpm \
|
|||||||
https://repo.percona.com/yum/percona-release-latest.noarch.rpm"
|
https://repo.percona.com/yum/percona-release-latest.noarch.rpm"
|
||||||
|
|
||||||
execute_cmd "yum install -y $extra_repos" "Installing extra repositories"
|
execute_cmd "yum install -y $extra_repos" "Installing extra repositories"
|
||||||
execute_cmd "yum-config-manager --enable remi-php73" "Configuring PHP"
|
execute_cmd "yum-config-manager --enable remi-php74" "Configuring PHP"
|
||||||
|
|
||||||
# Install percona Database
|
# Install percona Database
|
||||||
[ -f /etc/my.cnf ] && rm -rf /etc/my.cnf
|
#[ -f /etc/my.cnf ] && rm -rf /etc/my.cnf
|
||||||
execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server"
|
execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server"
|
||||||
|
|
||||||
# Console dependencies
|
# Console dependencies
|
||||||
@ -256,6 +271,7 @@ server_dependencies=" \
|
|||||||
perl(XML::Twig) \
|
perl(XML::Twig) \
|
||||||
expect \
|
expect \
|
||||||
openssh-clients \
|
openssh-clients \
|
||||||
|
java \
|
||||||
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
||||||
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm"
|
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm"
|
||||||
execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
|
execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
|
||||||
@ -275,32 +291,51 @@ execute_cmd "yum install -y $vmware_dependencies" "Installing SDK VMware perl de
|
|||||||
oracle_dependencies=" \
|
oracle_dependencies=" \
|
||||||
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm \
|
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm \
|
||||||
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm"
|
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm"
|
||||||
execute_cmd "yum install -y $oracle_dependencies" "Installing Oracle Instant client"
|
execute_cmd "yum install -y $oracle_dependencies || yum reinstall -y $oracle_dependencies" "Installing Oracle Instant client"
|
||||||
|
|
||||||
|
#ipam dependencies
|
||||||
|
ipam_dependencies=" \
|
||||||
|
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
||||||
|
perl(NetAddr::IP) \
|
||||||
|
perl(Sys::Syslog) \
|
||||||
|
perl(DBI) \
|
||||||
|
perl(XML::Simple) \
|
||||||
|
perl(Geo::IP) \
|
||||||
|
perl(IO::Socket::INET6) \
|
||||||
|
perl(XML::Twig)"
|
||||||
|
execute_cmd "yum install -y $ipam_dependencies" "Installing IPAM Instant client"
|
||||||
|
|
||||||
|
# MSSQL dependencies el7
|
||||||
|
execute_cmd "curl https://packages.microsoft.com/config/rhel/7/prod.repo -o /etc/yum.repos.d/mssql-release.repo" "Configuring Microsoft repositories"
|
||||||
|
execute_cmd "yum remove unixODBC-utf16 unixODBC-utf16-devel" "Removing default unixODBC packages"
|
||||||
|
execute_cmd "env ACCEPT_EULA=Y yum install -y msodbcsql17" "Installing ODBC Driver for Microsoft(R) SQL Server(R)"
|
||||||
|
MS_ID=$(head -1 /etc/odbcinst.ini | tr -d '[]') &>> "$LOGFILE"
|
||||||
|
#yum config-manager --set-disable packages-microsoft-com-prod
|
||||||
|
|
||||||
# Disabling SELINUX and firewalld
|
# Disabling SELINUX and firewalld
|
||||||
setenforce 0
|
setenforce 0
|
||||||
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
|
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
|
||||||
systemctl disable firewalld --now &>> $LOGFILE
|
systemctl disable firewalld --now &>> $LOGFILE
|
||||||
|
|
||||||
|
|
||||||
#Configuring Database
|
#Configuring Database
|
||||||
|
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
|
||||||
execute_cmd "systemctl start mysqld" "Starting database engine"
|
execute_cmd "systemctl start mysqld" "Starting database engine"
|
||||||
export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev)
|
export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev)
|
||||||
echo """
|
echo """
|
||||||
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Pandor4!');
|
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Pandor4!');
|
||||||
UNINSTALL PLUGIN validate_password;
|
UNINSTALL PLUGIN validate_password;
|
||||||
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('pandora');
|
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('$DBROOTPASS');
|
||||||
""" | mysql --connect-expired-password -uroot
|
""" | mysql --connect-expired-password -uroot &>> "$LOGFILE"
|
||||||
|
fi
|
||||||
export MYSQL_PWD=$DBPASS
|
export MYSQL_PWD=$DBROOTPASS
|
||||||
echo -en "${cyan}Creating Pandora FMS database...${reset}"
|
echo -en "${cyan}Creating Pandora FMS database...${reset}"
|
||||||
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
|
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
|
||||||
check_cmd_status 'Error creating database pandora, is this an empty node? if you have a previus installation please contact with support.'
|
check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support."
|
||||||
|
|
||||||
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%' identified by \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST
|
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%' identified by \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST
|
||||||
|
export MYSQL_PWD=$DBPASS
|
||||||
|
|
||||||
#Generating my.cnf
|
#Generating my.cnf
|
||||||
POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
|
|
||||||
cat > /etc/my.cnf << EO_CONFIG_F
|
cat > /etc/my.cnf << EO_CONFIG_F
|
||||||
[mysqld]
|
[mysqld]
|
||||||
datadir=/var/lib/mysql
|
datadir=/var/lib/mysql
|
||||||
@ -350,7 +385,7 @@ execute_cmd "systemctl restart mysqld" "Configuring database engine"
|
|||||||
# Downloading Pandora Packages
|
# Downloading Pandora Packages
|
||||||
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" "Downloading Pandora FMS Server community"
|
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" "Downloading Pandora FMS Server community"
|
||||||
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" "Downloading Pandora FMS Console community"
|
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" "Downloading Pandora FMS Console community"
|
||||||
execute_cmd "wget http://firefly.artica.es/centos7/pandorafms_agent_unix-7.0NG.751_x86_64.rpm" "Downloading Pandora FMS Agent community"
|
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm" "Downloading Pandora FMS Agent community"
|
||||||
|
|
||||||
# Install Pandora
|
# Install Pandora
|
||||||
execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages"
|
execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages"
|
||||||
@ -374,13 +409,13 @@ mysql -u$DBUSER -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb_data.sq
|
|||||||
check_cmd_status 'Error Loading database schema data'
|
check_cmd_status 'Error Loading database schema data'
|
||||||
|
|
||||||
# Configure console
|
# Configure console
|
||||||
cat > $CONSOLE_PATH/include/config.php << EO_CONFIG_F
|
cat > $PANDORA_CONSOLE/include/config.php << EO_CONFIG_F
|
||||||
<?php
|
<?php
|
||||||
\$config["dbtype"] = "mysql";
|
\$config["dbtype"] = "mysql";
|
||||||
\$config["dbname"]="$DBNAME";
|
\$config["dbname"]="$DBNAME";
|
||||||
\$config["dbuser"]="$DBUSER";
|
\$config["dbuser"]="$DBUSER";
|
||||||
\$config["dbpass"]="$DBPASS";
|
\$config["dbpass"]="$DBPASS";
|
||||||
\$config["dbhost"]="localhost";
|
\$config["dbhost"]="$DBHOST";
|
||||||
\$config["homedir"]="$PANDORA_CONSOLE";
|
\$config["homedir"]="$PANDORA_CONSOLE";
|
||||||
\$config["homeurl"]="/pandora_console";
|
\$config["homeurl"]="/pandora_console";
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
@ -420,9 +455,9 @@ sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/images/.htaccess
|
|||||||
sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/attachment/.htaccess
|
sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/attachment/.htaccess
|
||||||
|
|
||||||
# Fixing console permissions
|
# Fixing console permissions
|
||||||
chmod 600 $CONSOLE_PATH/include/config.php
|
chmod 600 $PANDORA_CONSOLE/include/config.php
|
||||||
chown apache. $CONSOLE_PATH/include/config.php
|
chown apache. $PANDORA_CONSOLE/include/config.php
|
||||||
mv $CONSOLE_PATH/install.php $CONSOLE_PATH/install.done
|
mv $PANDORA_CONSOLE/install.php $PANDORA_CONSOLE/install.done
|
||||||
|
|
||||||
# Prepare php.ini
|
# Prepare php.ini
|
||||||
sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini
|
sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini
|
||||||
@ -449,6 +484,10 @@ sed -i -e "s/^dbname.*/dbname $DBNAME/g" $PANDORA_SERVER_CONF
|
|||||||
sed -i -e "s/^dbuser.*/dbuser $DBUSER/g" $PANDORA_SERVER_CONF
|
sed -i -e "s/^dbuser.*/dbuser $DBUSER/g" $PANDORA_SERVER_CONF
|
||||||
sed -i -e "s|^dbpass.*|dbpass $DBPASS|g" $PANDORA_SERVER_CONF
|
sed -i -e "s|^dbpass.*|dbpass $DBPASS|g" $PANDORA_SERVER_CONF
|
||||||
sed -i -e "s/^dbport.*/dbport $DBPORT/g" $PANDORA_SERVER_CONF
|
sed -i -e "s/^dbport.*/dbport $DBPORT/g" $PANDORA_SERVER_CONF
|
||||||
|
sed -i -e "s/^#.mssql_driver.*/mssql_driver $MS_ID/g" $PANDORA_SERVER_CONF
|
||||||
|
|
||||||
|
# Enable agent remote config
|
||||||
|
sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF
|
||||||
|
|
||||||
# Set Oracle environment for pandora_server
|
# Set Oracle environment for pandora_server
|
||||||
cat > /etc/pandora/pandora_server.env << 'EOF_ENV'
|
cat > /etc/pandora/pandora_server.env << 'EOF_ENV'
|
||||||
@ -459,7 +498,7 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/$VERSION/client64/lib
|
|||||||
export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64
|
export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64
|
||||||
EOF_ENV
|
EOF_ENV
|
||||||
|
|
||||||
# Kernel optimization
|
if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then
|
||||||
cat >> /etc/sysctl.conf <<EO_KO
|
cat >> /etc/sysctl.conf <<EO_KO
|
||||||
# Pandora FMS Optimization
|
# Pandora FMS Optimization
|
||||||
|
|
||||||
@ -487,6 +526,7 @@ net.core.optmem_max = 81920
|
|||||||
EO_KO
|
EO_KO
|
||||||
|
|
||||||
[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
|
[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
|
||||||
|
fi
|
||||||
|
|
||||||
# Fix pandora_server.{log,error} permissions to allow Console check them
|
# Fix pandora_server.{log,error} permissions to allow Console check them
|
||||||
chown pandora:apache /var/log/pandora
|
chown pandora:apache /var/log/pandora
|
||||||
@ -563,7 +603,7 @@ execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://12
|
|||||||
echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
|
echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
|
||||||
## Enabling agent
|
## Enabling agent
|
||||||
systemctl enable pandora_agent_daemon &>> $LOGFILE
|
systemctl enable pandora_agent_daemon &>> $LOGFILE
|
||||||
execute_cmd "systemctl start pandora_agent_daemon" "starting Pandora FMS Agent"
|
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
|
||||||
|
|
||||||
#SSH banner
|
#SSH banner
|
||||||
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)
|
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)
|
||||||
|
@ -1,17 +1,35 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#######################################################
|
||||||
|
# PandoraFMS Community online installation script
|
||||||
|
#######################################################
|
||||||
|
## Tested versions ##
|
||||||
|
# Centos 8.4, 8.5
|
||||||
|
# Rocky 8.4, 8.5
|
||||||
|
# Almalinuz 8.4, 8.5
|
||||||
|
# RedHat 8.5
|
||||||
|
|
||||||
# define variables
|
#Constants
|
||||||
PANDORA_CONSOLE=/var/www/html/pandora_console
|
PANDORA_CONSOLE=/var/www/html/pandora_console
|
||||||
CONSOLE_PATH=/var/www/html/pandora_console
|
|
||||||
PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
|
PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
|
||||||
DBHOST=127.0.0.1
|
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
|
||||||
DBNAME=pandora
|
|
||||||
DBUSER=pandora
|
|
||||||
DBPASS=pandora
|
S_VERSION='2022012401'
|
||||||
DBPORT=3306
|
|
||||||
S_VERSION='2021070101'
|
|
||||||
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
|
||||||
|
|
||||||
|
# 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_PRECHECK" ] || SKIP_PRECHECK=0
|
||||||
|
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
|
||||||
|
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
|
||||||
|
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
|
||||||
|
|
||||||
# Ansi color code variables
|
# Ansi color code variables
|
||||||
red="\e[0;91m"
|
red="\e[0;91m"
|
||||||
green="\e[0;92m"
|
green="\e[0;92m"
|
||||||
@ -56,7 +74,7 @@ check_pre_pandora () {
|
|||||||
|
|
||||||
echo -en "${cyan}Checking environment ... ${reset}"
|
echo -en "${cyan}Checking environment ... ${reset}"
|
||||||
rpm -qa | grep pandora &>> /dev/null && local fail=true
|
rpm -qa | grep pandora &>> /dev/null && local fail=true
|
||||||
[ -d "$CONSOLE_PATH" ] && local fail=true
|
[ -d "$PANDORA_CONSOLE" ] && local fail=true
|
||||||
[ -f /usr/bin/pandora_server ] && local fail=true
|
[ -f /usr/bin/pandora_server ] && local fail=true
|
||||||
echo "use $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST &>> /dev/null && local fail=true
|
echo "use $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST &>> /dev/null && local fail=true
|
||||||
|
|
||||||
@ -74,7 +92,7 @@ check_root_permissions () {
|
|||||||
echo -en "${cyan}Checking root account... ${reset}"
|
echo -en "${cyan}Checking root account... ${reset}"
|
||||||
if [ "$(whoami)" != "root" ]; then
|
if [ "$(whoami)" != "root" ]; then
|
||||||
echo -e "${red}Fail${reset}"
|
echo -e "${red}Fail${reset}"
|
||||||
echo "Please use a root account or sudo for installing PandoraFMS"
|
echo "Please use a root account or sudo for installing Pandora FMS"
|
||||||
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
|
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
@ -87,8 +105,8 @@ check_root_permissions () {
|
|||||||
echo "Starting PandoraFMS Community deployment EL8 ver. $S_VERSION"
|
echo "Starting PandoraFMS Community deployment EL8 ver. $S_VERSION"
|
||||||
|
|
||||||
# Centos Version
|
# Centos Version
|
||||||
if [ ! "$(grep -Ei 'centos|rocky' /etc/redhat-release)" ]; then
|
if [ ! "$(grep -Ei 'centos|rocky|Almalinux|Red Hat Enterprise' /etc/redhat-release)" ]; then
|
||||||
printf "\n ${red}Error this is not a Centos/Rocky Base system, this installer is compatible with Centos/Rocky systems only${reset}\n"
|
printf "\n ${red}Error this is not a Centos/Rocky/Almalinux Base system, this installer is compatible with Centos/Rocky systems only${reset}\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -106,7 +124,7 @@ echo "Community installer version: $S_VERSION" >> "$LOGFILE"
|
|||||||
check_root_permissions
|
check_root_permissions
|
||||||
|
|
||||||
# Pre installed pandora
|
# Pre installed pandora
|
||||||
check_pre_pandora
|
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
|
||||||
|
|
||||||
# Connectivity
|
# Connectivity
|
||||||
check_repo_connection
|
check_repo_connection
|
||||||
@ -120,6 +138,9 @@ execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]"
|
|||||||
# Check disk size at least 10 Gb free space
|
# Check disk size at least 10 Gb free space
|
||||||
execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)'
|
execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)'
|
||||||
|
|
||||||
|
# Setting timezone
|
||||||
|
execute_cmd "timedatectl set-timezone $TZ" "Setting Timezone $TZ"
|
||||||
|
|
||||||
# Execute tools check
|
# Execute tools check
|
||||||
execute_cmd "awk --version" 'Checking needed tools: awk'
|
execute_cmd "awk --version" 'Checking needed tools: awk'
|
||||||
execute_cmd "grep --version" 'Checking needed tools: grep'
|
execute_cmd "grep --version" 'Checking needed tools: grep'
|
||||||
@ -131,25 +152,57 @@ rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE"
|
|||||||
mkdir "$HOME"/pandora_deploy_tmp &>> "$LOGFILE"
|
mkdir "$HOME"/pandora_deploy_tmp &>> "$LOGFILE"
|
||||||
execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_deploy_tmp"
|
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 status &>> "$LOGFILE"
|
||||||
|
subscription-manager list &>> "$LOGFILE"
|
||||||
|
subscription-manager list | grep 'Status:' | grep Subscribed &>> "$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 \
|
||||||
|
http://rpms.remirepo.net/enterprise/remi-release-8.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 \
|
||||||
|
http://rpms.remirepo.net/enterprise/remi-release-8.rpm \
|
||||||
|
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
|
#Installing wget
|
||||||
execute_cmd "dnf install -y wget" "Installing wget"
|
execute_cmd "dnf install -y wget" "Installing wget"
|
||||||
|
|
||||||
#Installing extra repositiries
|
#Installing extra repositiries
|
||||||
extra_repos=" \
|
|
||||||
tar \
|
|
||||||
dnf-utils \
|
|
||||||
epel-release \
|
|
||||||
http://rpms.remirepo.net/enterprise/remi-release-8.rpm \
|
|
||||||
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"
|
|
||||||
execute_cmd "dnf module reset -y php " "Disabling standard PHP module"
|
execute_cmd "dnf module reset -y php " "Disabling standard PHP module"
|
||||||
execute_cmd "dnf module install -y php:remi-7.3" "Configuring PHP"
|
execute_cmd "dnf module install -y php:remi-7.4" "Configuring PHP"
|
||||||
|
|
||||||
# Install percona Database
|
# Install percona Database
|
||||||
execute_cmd "dnf module disable -y mysql" "Disabiling mysql module"
|
execute_cmd "dnf module disable -y mysql" "Disabiling mysql module"
|
||||||
rm -rf /etc/my.cnf
|
#rm -rf /etc/my.cnf
|
||||||
execute_cmd "dnf install -y Percona-Server-server-57" "Installing Percona Server"
|
execute_cmd "dnf install -y Percona-Server-server-57" "Installing Percona Server"
|
||||||
|
|
||||||
# Console dependencies
|
# Console dependencies
|
||||||
@ -231,6 +284,7 @@ console_dependencies=" \
|
|||||||
xorg-x11-fonts-misc \
|
xorg-x11-fonts-misc \
|
||||||
poppler-data \
|
poppler-data \
|
||||||
php-yaml \
|
php-yaml \
|
||||||
|
mod_ssl \
|
||||||
http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
|
http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
|
||||||
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \
|
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \
|
||||||
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
|
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
|
||||||
@ -255,7 +309,8 @@ server_dependencies=" \
|
|||||||
perl(IO::Socket::INET6) \
|
perl(IO::Socket::INET6) \
|
||||||
perl(XML::Twig) \
|
perl(XML::Twig) \
|
||||||
expect \
|
expect \
|
||||||
openssh-clients \
|
openssh-clients \
|
||||||
|
java \
|
||||||
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
||||||
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm"
|
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm"
|
||||||
execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
|
execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
|
||||||
@ -281,6 +336,7 @@ oracle_dependencies=" \
|
|||||||
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm"
|
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm"
|
||||||
execute_cmd "dnf install -y $oracle_dependencies" "Installing Oracle Instant client"
|
execute_cmd "dnf install -y $oracle_dependencies" "Installing Oracle Instant client"
|
||||||
|
|
||||||
|
#ipam dependencies
|
||||||
ipam_dependencies=" \
|
ipam_dependencies=" \
|
||||||
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
|
||||||
perl(NetAddr::IP) \
|
perl(NetAddr::IP) \
|
||||||
@ -290,32 +346,39 @@ ipam_dependencies=" \
|
|||||||
perl(Geo::IP) \
|
perl(Geo::IP) \
|
||||||
perl(IO::Socket::INET6) \
|
perl(IO::Socket::INET6) \
|
||||||
perl(XML::Twig)"
|
perl(XML::Twig)"
|
||||||
execute_cmd "dnf install -y $ipam_dependencies" "Installing Oracle Instant client"
|
execute_cmd "dnf install -y $ipam_dependencies" "Installing IPAM Instant client"
|
||||||
|
|
||||||
|
# MSSQL dependencies el8
|
||||||
|
execute_cmd "curl https://packages.microsoft.com/config/rhel/8/prod.repo -o /etc/yum.repos.d/mssql-release.repo" "Configuring Microsoft repositories"
|
||||||
|
execute_cmd "dnf remove unixODBC-utf16 unixODBC-utf16-devel" "Removing default unixODBC packages"
|
||||||
|
execute_cmd "env ACCEPT_EULA=Y dnf install -y msodbcsql17" "Installing ODBC Driver for Microsoft(R) SQL Server(R)"
|
||||||
|
MS_ID=$(head -1 /etc/odbcinst.ini | tr -d '[]') &>> "$LOGFILE"
|
||||||
|
#dnf config-manager --set-disable packages-microsoft-com-prod
|
||||||
|
|
||||||
# Disabling SELINUX and firewalld
|
# Disabling SELINUX and firewalld
|
||||||
setenforce 0 &>> "$LOGFILE"
|
setenforce 0 &>> "$LOGFILE"
|
||||||
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config &>> "$LOGFILE"
|
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config &>> "$LOGFILE"
|
||||||
systemctl disable firewalld --now &>> "$LOGFILE"
|
systemctl disable firewalld --now &>> "$LOGFILE"
|
||||||
|
|
||||||
|
|
||||||
#Configuring Database
|
#Configuring Database
|
||||||
|
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
|
||||||
execute_cmd "systemctl start mysqld" "Starting database engine"
|
execute_cmd "systemctl start mysqld" "Starting database engine"
|
||||||
export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev)
|
export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev)
|
||||||
echo """
|
echo """
|
||||||
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Pandor4!');
|
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Pandor4!');
|
||||||
UNINSTALL PLUGIN validate_password;
|
UNINSTALL PLUGIN validate_password;
|
||||||
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('pandora');
|
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('$DBROOTPASS');
|
||||||
""" | mysql --connect-expired-password -uroot
|
""" | mysql --connect-expired-password -uroot &>> "$LOGFILE"
|
||||||
|
fi
|
||||||
export MYSQL_PWD=$DBPASS
|
export MYSQL_PWD=$DBROOTPASS
|
||||||
echo -en "${cyan}Creating Pandora FMS database...${reset}"
|
echo -en "${cyan}Creating Pandora FMS database...${reset}"
|
||||||
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
|
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
|
||||||
check_cmd_status 'Error creating database pandora, is this an empty node? if you have a previus installation please contact with support.'
|
check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support."
|
||||||
|
|
||||||
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%' identified by \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST
|
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%' identified by \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST
|
||||||
|
export MYSQL_PWD=$DBPASS
|
||||||
|
|
||||||
#Generating my.cnf
|
#Generating my.cnf
|
||||||
POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
|
|
||||||
cat > /etc/my.cnf << EO_CONFIG_F
|
cat > /etc/my.cnf << EO_CONFIG_F
|
||||||
[mysqld]
|
[mysqld]
|
||||||
datadir=/var/lib/mysql
|
datadir=/var/lib/mysql
|
||||||
@ -365,10 +428,10 @@ execute_cmd "systemctl restart mysqld" "Configuring database engine"
|
|||||||
# Downloading Pandora Packages
|
# Downloading Pandora Packages
|
||||||
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" "Downloading Pandora FMS Server community"
|
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" "Downloading Pandora FMS Server community"
|
||||||
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" "Downloading Pandora FMS Console community"
|
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" "Downloading Pandora FMS Console community"
|
||||||
execute_cmd "wget http://firefly.artica.es/centos7/pandorafms_agent_unix-7.0NG.751_x86_64.rpm" "Downloading Pandora FMS Agent community"
|
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm" "Downloading Pandora FMS Agent community"
|
||||||
|
|
||||||
# Install Pandora
|
# Install Pandora
|
||||||
execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages"
|
execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "Installing Pandora FMS packages"
|
||||||
|
|
||||||
# Copy gotty utility
|
# Copy gotty utility
|
||||||
execute_cmd "wget https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
|
execute_cmd "wget https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
|
||||||
@ -391,13 +454,13 @@ mysql -u$DBUSER -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb_data.sq
|
|||||||
check_cmd_status 'Error Loading database schema data'
|
check_cmd_status 'Error Loading database schema data'
|
||||||
|
|
||||||
# Configure console
|
# Configure console
|
||||||
cat > $CONSOLE_PATH/include/config.php << EO_CONFIG_F
|
cat > $PANDORA_CONSOLE/include/config.php << EO_CONFIG_F
|
||||||
<?php
|
<?php
|
||||||
\$config["dbtype"] = "mysql";
|
\$config["dbtype"] = "mysql";
|
||||||
\$config["dbname"]="$DBNAME";
|
\$config["dbname"]="$DBNAME";
|
||||||
\$config["dbuser"]="$DBUSER";
|
\$config["dbuser"]="$DBUSER";
|
||||||
\$config["dbpass"]="$DBPASS";
|
\$config["dbpass"]="$DBPASS";
|
||||||
\$config["dbhost"]="localhost";
|
\$config["dbhost"]="$DBHOST";
|
||||||
\$config["homedir"]="$PANDORA_CONSOLE";
|
\$config["homedir"]="$PANDORA_CONSOLE";
|
||||||
\$config["homeurl"]="/pandora_console";
|
\$config["homeurl"]="/pandora_console";
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
@ -437,9 +500,9 @@ sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/images/.htaccess
|
|||||||
sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/attachment/.htaccess
|
sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/attachment/.htaccess
|
||||||
|
|
||||||
# Fixing console permissions
|
# Fixing console permissions
|
||||||
chmod 600 $CONSOLE_PATH/include/config.php
|
chmod 600 $PANDORA_CONSOLE/include/config.php
|
||||||
chown apache. $CONSOLE_PATH/include/config.php
|
chown apache. $PANDORA_CONSOLE/include/config.php
|
||||||
mv $CONSOLE_PATH/install.php $CONSOLE_PATH/install.done
|
mv $PANDORA_CONSOLE/install.php $PANDORA_CONSOLE/install.done &>> "$LOGFILE"
|
||||||
|
|
||||||
# Prepare php.ini
|
# Prepare php.ini
|
||||||
sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini
|
sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini
|
||||||
@ -466,6 +529,10 @@ sed -i -e "s/^dbname.*/dbname $DBNAME/g" $PANDORA_SERVER_CONF
|
|||||||
sed -i -e "s/^dbuser.*/dbuser $DBUSER/g" $PANDORA_SERVER_CONF
|
sed -i -e "s/^dbuser.*/dbuser $DBUSER/g" $PANDORA_SERVER_CONF
|
||||||
sed -i -e "s|^dbpass.*|dbpass $DBPASS|g" $PANDORA_SERVER_CONF
|
sed -i -e "s|^dbpass.*|dbpass $DBPASS|g" $PANDORA_SERVER_CONF
|
||||||
sed -i -e "s/^dbport.*/dbport $DBPORT/g" $PANDORA_SERVER_CONF
|
sed -i -e "s/^dbport.*/dbport $DBPORT/g" $PANDORA_SERVER_CONF
|
||||||
|
sed -i -e "s/^#.mssql_driver.*/mssql_driver $MS_ID/g" $PANDORA_SERVER_CONF
|
||||||
|
|
||||||
|
# Enable agent remote config
|
||||||
|
sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF
|
||||||
|
|
||||||
# Set Oracle environment for pandora_server
|
# Set Oracle environment for pandora_server
|
||||||
cat > /etc/pandora/pandora_server.env << 'EOF_ENV'
|
cat > /etc/pandora/pandora_server.env << 'EOF_ENV'
|
||||||
@ -477,6 +544,8 @@ export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64
|
|||||||
EOF_ENV
|
EOF_ENV
|
||||||
|
|
||||||
# Kernel optimization
|
# Kernel optimization
|
||||||
|
|
||||||
|
if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then
|
||||||
cat >> /etc/sysctl.conf <<EO_KO
|
cat >> /etc/sysctl.conf <<EO_KO
|
||||||
# Pandora FMS Optimization
|
# Pandora FMS Optimization
|
||||||
|
|
||||||
@ -504,6 +573,7 @@ net.core.optmem_max = 81920
|
|||||||
EO_KO
|
EO_KO
|
||||||
|
|
||||||
[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
|
[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
|
||||||
|
fi
|
||||||
|
|
||||||
# Fix pandora_server.{log,error} permissions to allow Console check them
|
# Fix pandora_server.{log,error} permissions to allow Console check them
|
||||||
chown pandora:apache /var/log/pandora
|
chown pandora:apache /var/log/pandora
|
||||||
@ -558,7 +628,7 @@ chmod 0644 /etc/logrotate.d/pandora_server
|
|||||||
chmod 0644 /etc/logrotate.d/pandora_agent
|
chmod 0644 /etc/logrotate.d/pandora_agent
|
||||||
|
|
||||||
# Add websocket engine start script.
|
# Add websocket engine start script.
|
||||||
mv /var/www/html/pandora_console/pandora_websocket_engine /etc/init.d/
|
mv /var/www/html/pandora_console/pandora_websocket_engine /etc/init.d/ &>> "$LOGFILE"
|
||||||
chmod +x /etc/init.d/pandora_websocket_engine
|
chmod +x /etc/init.d/pandora_websocket_engine
|
||||||
|
|
||||||
# Start Websocket engine
|
# Start Websocket engine
|
||||||
@ -569,7 +639,7 @@ systemctl enable pandora_websocket_engine &>> "$LOGFILE"
|
|||||||
|
|
||||||
# Enable pandora ha service
|
# Enable pandora ha service
|
||||||
systemctl enable pandora_server --now &>> "$LOGFILE"
|
systemctl enable pandora_server --now &>> "$LOGFILE"
|
||||||
execute_cmd "systemctl start pandora_server" "Starting Pandora FMS Server"
|
execute_cmd "/etc/init.d/pandora_server start" "Starting Pandora FMS Server"
|
||||||
|
|
||||||
# starting tentacle server
|
# starting tentacle server
|
||||||
systemctl enable tentacle_serverd &>> "$LOGFILE"
|
systemctl enable tentacle_serverd &>> "$LOGFILE"
|
||||||
@ -580,7 +650,7 @@ execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://12
|
|||||||
echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
|
echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
|
||||||
## Enabling agent
|
## Enabling agent
|
||||||
systemctl enable pandora_agent_daemon &>> "$LOGFILE"
|
systemctl enable pandora_agent_daemon &>> "$LOGFILE"
|
||||||
execute_cmd "systemctl start pandora_agent_daemon" "starting Pandora FMS Agent"
|
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
|
||||||
|
|
||||||
#SSH banner
|
#SSH banner
|
||||||
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)
|
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.759-220202
|
Version: 7.0NG.759-220216
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.759-220202"
|
pandora_version="7.0NG.759-220216"
|
||||||
|
|
||||||
echo "Test if you has the tools for to make the packages."
|
echo "Test if you has the tools for to make the packages."
|
||||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||||
|
@ -47,4 +47,3 @@ License
|
|||||||
|
|
||||||
The project is distributed under the GPL License v2 or later.
|
The project is distributed under the GPL License v2 or later.
|
||||||
Copyright (C) 2004-2011 Pandora FMS development team
|
Copyright (C) 2004-2011 Pandora FMS development team
|
||||||
|
|
||||||
|
@ -1015,7 +1015,7 @@ my $Sem = undef;
|
|||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
use constant AGENT_VERSION => '7.0NG.759';
|
use constant AGENT_VERSION => '7.0NG.759';
|
||||||
use constant AGENT_BUILD => '220202';
|
use constant AGENT_BUILD => '220216';
|
||||||
|
|
||||||
# Agent log default file size maximum and instances
|
# Agent log default file size maximum and instances
|
||||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.759
|
%define version 7.0NG.759
|
||||||
%define release 220202
|
%define release 220216
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.759
|
%define version 7.0NG.759
|
||||||
%define release 220202
|
%define release 220216
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.759"
|
PI_VERSION="7.0NG.759"
|
||||||
PI_BUILD="220202"
|
PI_BUILD="220216"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Version
|
Version
|
||||||
{220202}
|
{220216}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||||||
using namespace Pandora_Strutils;
|
using namespace Pandora_Strutils;
|
||||||
|
|
||||||
#define PATH_SIZE _MAX_PATH+1
|
#define PATH_SIZE _MAX_PATH+1
|
||||||
#define PANDORA_VERSION ("7.0NG.759 Build 220202")
|
#define PANDORA_VERSION ("7.0NG.759 Build 220216")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
@ -11,7 +11,7 @@ BEGIN
|
|||||||
VALUE "LegalCopyright", "Artica ST"
|
VALUE "LegalCopyright", "Artica ST"
|
||||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||||
VALUE "ProductVersion", "(7.0NG.759(Build 220202))"
|
VALUE "ProductVersion", "(7.0NG.759(Build 220216))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.759-220202
|
Version: 7.0NG.759-220216
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.759-220202"
|
pandora_version="7.0NG.759-220216"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -89,7 +89,11 @@ if (isset($_GET['loginhash']) === true) {
|
|||||||
$config['id_user'] = $loginhash_user;
|
$config['id_user'] = $loginhash_user;
|
||||||
} else {
|
} else {
|
||||||
include_once 'general/login_page.php';
|
include_once 'general/login_page.php';
|
||||||
db_pandora_audit('Logon Failed (loginhash', '', 'system');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_USER_REGISTRATION,
|
||||||
|
'Loginhash failed',
|
||||||
|
'system'
|
||||||
|
);
|
||||||
while (ob_get_length() > 0) {
|
while (ob_get_length() > 0) {
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
}
|
}
|
||||||
@ -111,8 +115,8 @@ if (class_exists($auth_class) === false || $public_hash === false) {
|
|||||||
} else {
|
} else {
|
||||||
if ($auth_class::validatePublicHash($public_hash) === false) {
|
if ($auth_class::validatePublicHash($public_hash) === false) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Invalid public hash',
|
AUDIT_LOG_USER_REGISTRATION,
|
||||||
'Trying to access public dashboard'
|
'Trying to access public dashboard (Invalid public hash)'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
exit;
|
exit;
|
||||||
|
@ -284,7 +284,7 @@ function mainAgentsModules()
|
|||||||
// ACL Check.
|
// ACL Check.
|
||||||
if (! check_acl($config['id_user'], 0, 'AR')) {
|
if (! check_acl($config['id_user'], 0, 'AR')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Agent view (Grouped)'
|
'Trying to access Agent view (Grouped)'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -304,7 +304,10 @@ function mainAgentsModules()
|
|||||||
|
|
||||||
db_process_sql_update('tagente_modulo', ['flag' => 1], $where);
|
db_process_sql_update('tagente_modulo', ['flag' => 1], $where);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to set flag for groups');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to set flag for groups'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ function extension_api_checker()
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Profile Management'
|
'Trying to access Profile Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -32,7 +32,7 @@ function extension_db_status()
|
|||||||
|
|
||||||
if (!is_user_admin($config['id_user'])) {
|
if (!is_user_admin($config['id_user'])) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access db status'
|
'Trying to access db status'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -89,7 +89,10 @@ function dbmgr_extension_main()
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (!is_user_admin($config['id_user'])) {
|
if (!is_user_admin($config['id_user'])) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access Setup Management');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Setup Management'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -143,7 +146,13 @@ function dbmgr_extension_main()
|
|||||||
echo '<strong>An error has occured when querying the database.</strong><br />';
|
echo '<strong>An error has occured when querying the database.</strong><br />';
|
||||||
echo $error;
|
echo $error;
|
||||||
|
|
||||||
db_pandora_audit('DB Interface Extension', 'Error in SQL', false, false, $sql);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_SYSTEM,
|
||||||
|
'DB Interface Extension. Error in SQL',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$sql
|
||||||
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -151,7 +160,13 @@ function dbmgr_extension_main()
|
|||||||
if (! is_array($result)) {
|
if (! is_array($result)) {
|
||||||
echo '<strong>Output: <strong>'.$result;
|
echo '<strong>Output: <strong>'.$result;
|
||||||
|
|
||||||
db_pandora_audit('DB Interface Extension', 'SQL', false, false, $sql);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_SYSTEM,
|
||||||
|
'DB Interface Extension. SQL',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$sql
|
||||||
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,10 @@ function load_matrix_console()
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'ER')) {
|
if (! check_acl($config['id_user'], 0, 'ER')) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access event viewer');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access event viewer'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ function extension_uploader_extensions()
|
|||||||
|
|
||||||
if (!check_acl($config['id_user'], 0, 'PM')) {
|
if (!check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Group Management'
|
'Trying to access Group Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -61,7 +61,10 @@ function extension_uploader_extensions()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Extension manager', 'Upload extension '.$_FILES['extension']['name']);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_EXTENSION_MANAGER,
|
||||||
|
'Upload extension '.$_FILES['extension']['name']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
|
@ -106,7 +106,10 @@ function pandora_files_repo_godmode()
|
|||||||
// ACL Check
|
// ACL Check
|
||||||
check_login();
|
check_login();
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access to Files repository');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access to Files repository'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,10 @@ function mainInsertData()
|
|||||||
ui_print_page_header(__('Insert data'), 'images/extensions.png', false, '', true, '');
|
ui_print_page_header(__('Insert data'), 'images/extensions.png', false, '', true, '');
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW') && ! is_user_admin($config['id_user'])) {
|
if (! check_acl($config['id_user'], 0, 'AW') && ! is_user_admin($config['id_user'])) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access Setup Management');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Setup Management'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,10 @@ global $config;
|
|||||||
|
|
||||||
if (is_ajax()) {
|
if (is_ajax()) {
|
||||||
if (! check_acl($config['id_user'], 0, 'ER')) {
|
if (! check_acl($config['id_user'], 0, 'ER')) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access event viewer');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access event viewer'
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ check_login();
|
|||||||
// ACL Check.
|
// ACL Check.
|
||||||
if (!check_acl($config['id_user'], 0, 'AR')) {
|
if (!check_acl($config['id_user'], 0, 'AR')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Module Groups view'
|
'Trying to access Module Groups view'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -56,7 +56,10 @@ function pandoralogs_extension_main()
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access Setup Management');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Setup Management'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ function quickShell()
|
|||||||
|
|
||||||
if (check_acl($config['id_user'], 0, 'PM') === false) {
|
if (check_acl($config['id_user'], 0, 'PM') === false) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Profile Management'
|
'Trying to access Profile Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -29,7 +29,10 @@ if (isset($_GET['get_ptr'])) {
|
|||||||
|
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access Setup Management');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Setup Management'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -404,7 +407,10 @@ function resource_exportation_extension_main()
|
|||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access Setup Management');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Setup Management'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -143,14 +143,14 @@ function process_upload_xml_report($xml, $group_filter=0)
|
|||||||
|
|
||||||
if ($id_report) {
|
if ($id_report) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Report management',
|
AUDIT_LOG_REPORT_MANAGEMENT,
|
||||||
'Create report '.$id_report,
|
'Create report '.$id_report,
|
||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Report management',
|
AUDIT_LOG_REPORT_MANAGEMENT,
|
||||||
'Fail to create report',
|
'Fail to create report',
|
||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
@ -554,7 +554,11 @@ function process_upload_xml_visualmap($xml, $filter_group=0)
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($id_visual_map !== false) {
|
if ($id_visual_map !== false) {
|
||||||
db_pandora_audit('CREATE VISUAL CONSOLE', $id_visual_map, $config['id_user']);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
|
||||||
|
sprintf('Create Visual Console #%s', $id_visual_map),
|
||||||
|
$config['id_user']
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -716,7 +720,11 @@ function process_upload_xml_visualmap($xml, $filter_group=0)
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($id_item !== false) {
|
if ($id_item !== false) {
|
||||||
db_pandora_audit('CREATE ITEM VISUAL CONSOLE', $values['id_layout'].' - '.$id_item, $config['id_user']);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
|
||||||
|
sprintf('Create Item %s in Visual Console #%s', $id_item, $values['id_layout']),
|
||||||
|
$config['id_user']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($agents_in_item as $id => $agent) {
|
foreach ($agents_in_item as $id => $agent) {
|
||||||
@ -725,7 +733,7 @@ function process_upload_xml_visualmap($xml, $filter_group=0)
|
|||||||
|
|
||||||
$id_item = db_process_sql_insert('tlayout_data', $values);
|
$id_item = db_process_sql_insert('tlayout_data', $values);
|
||||||
|
|
||||||
if (isset($item->other_id)) {
|
if (isset($item->other_id) === true) {
|
||||||
$relation_other_ids[(string) $item->other_id] = $id_item;
|
$relation_other_ids[(string) $item->other_id] = $id_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -736,9 +744,14 @@ function process_upload_xml_visualmap($xml, $filter_group=0)
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($id_item !== false) {
|
if ($id_item !== false) {
|
||||||
db_pandora_audit('CREATE ITEM VISUAL CONSOLE', $values['id_layout'].' - '.$id_item, $config['id_user']);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
|
||||||
|
sprintf('Create Item %s in Visual Console #%s', $id_item, $values['id_layout']),
|
||||||
|
$config['id_user']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// TODO: Review this else.
|
||||||
foreach ($agent['modules'] as $id_module => $module) {
|
foreach ($agent['modules'] as $id_module => $module) {
|
||||||
$values['id_agent'] = $id;
|
$values['id_agent'] = $id;
|
||||||
$values['id_agente_modulo'] = $id_module;
|
$values['id_agente_modulo'] = $id_module;
|
||||||
@ -752,7 +765,11 @@ function process_upload_xml_visualmap($xml, $filter_group=0)
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($id_item !== false) {
|
if ($id_item !== false) {
|
||||||
db_pandora_audit('CREATE ITEM VISUAL CONSOLE', $values['id_layout'].' - '.$id_item, $config['id_user']);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
|
||||||
|
sprintf('Create Item %s in Visual Console #%s', $id_item, $values['id_layout']),
|
||||||
|
$config['id_user']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1063,7 +1080,10 @@ function resource_registration_extension_main()
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access Setup Management');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Setup Management'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1100,7 +1120,7 @@ function resource_registration_extension_main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class=notify>';
|
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="http://pandorafms.com/Library/Library/">Public Resource Library</a>');
|
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>';
|
echo '</div>';
|
||||||
|
|
||||||
echo '<br /><br />';
|
echo '<br /><br />';
|
||||||
|
@ -117,4 +117,6 @@ mobile/include/style/jquery.mobile-1.3.1.css
|
|||||||
godmode/alerts/configure_alert_special_days.php
|
godmode/alerts/configure_alert_special_days.php
|
||||||
godmode/admin_access_logs.php
|
godmode/admin_access_logs.php
|
||||||
enterprise/extensions/backup/main.php
|
enterprise/extensions/backup/main.php
|
||||||
enterprise/extensions/backup.php
|
enterprise/extensions/backup.php
|
||||||
|
mobile/include/javascript/jquery.mobile-1.4.5.js
|
||||||
|
mobile/include/style/jquery.mobile-1.4.5.css
|
@ -9,4 +9,17 @@ ALTER TABLE `talert_execution_queue`
|
|||||||
DROP COLUMN `extra_macros`,
|
DROP COLUMN `extra_macros`,
|
||||||
MODIFY COLUMN `data` LONGTEXT;
|
MODIFY COLUMN `data` LONGTEXT;
|
||||||
|
|
||||||
COMMIT;
|
ALTER TABLE `talert_templates` ADD COLUMN `schedule` TEXT;
|
||||||
|
ALTER TABLE `tevent_alert` ADD COLUMN `schedule` TEXT;
|
||||||
|
|
||||||
|
SOURCE procedures/alertTemplates.sql;
|
||||||
|
CALL `migrateRanges`();
|
||||||
|
DROP PROCEDURE `migrateRanges`;
|
||||||
|
|
||||||
|
SOURCE procedures/alertEvents.sql;
|
||||||
|
CALL `migrateEventRanges`();
|
||||||
|
DROP PROCEDURE `migrateEventRanges`;
|
||||||
|
|
||||||
|
ALTER TABLE `tautoconfig` ADD COLUMN `disabled` TINYINT DEFAULT 0;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
40
pandora_console/extras/mr/procedures/alertEvents.sql
Normal file
40
pandora_console/extras/mr/procedures/alertEvents.sql
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
CREATE PROCEDURE migrateEventRanges()
|
||||||
|
BEGIN
|
||||||
|
DECLARE done INT DEFAULT FALSE;
|
||||||
|
DECLARE i INT;
|
||||||
|
DECLARE r TEXT;
|
||||||
|
DECLARE cur1 CURSOR FOR SELECT `id` FROM `tevent_alert`;
|
||||||
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||||
|
|
||||||
|
UPDATE `tevent_alert` SET `schedule` = '{"monday":_1_,"tuesday":_2_,"wednesday":_3_,"thursday":_4_,"friday":_5_,"saturday":_6_,"sunday":_7_}';
|
||||||
|
UPDATE `tevent_alert` SET `time_from` = "00:00:00", `time_to` = "00:00:00" WHERE `time_from` = `time_to`;
|
||||||
|
|
||||||
|
OPEN cur1;
|
||||||
|
read_loop: LOOP
|
||||||
|
FETCH cur1 INTO i;
|
||||||
|
|
||||||
|
IF done THEN
|
||||||
|
LEAVE read_loop;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SELECT concat('[{"start":"', `time_from`, '","end":"', `time_to`, '"}]') into r FROM `tevent_alert` WHERE `id` = i;
|
||||||
|
|
||||||
|
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_1_", r) WHERE `monday` > 0 AND `id` = i;
|
||||||
|
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_2_", r) WHERE `tuesday` > 0 AND `id` = i;
|
||||||
|
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_3_", r) WHERE `wednesday` > 0 AND `id` = i;
|
||||||
|
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_4_", r) WHERE `thursday` > 0 AND `id` = i;
|
||||||
|
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_5_", r) WHERE `friday` > 0 AND `id` = i;
|
||||||
|
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_6_", r) WHERE `saturday` > 0 AND `id` = i;
|
||||||
|
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_7_", r) WHERE `sunday` > 0 AND `id` = i;
|
||||||
|
|
||||||
|
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_1_", '""') WHERE `monday` = 0 AND `id` = i;
|
||||||
|
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_2_", '""') WHERE `tuesday` = 0 AND `id` = i;
|
||||||
|
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_3_", '""') WHERE `wednesday` = 0 AND `id` = i;
|
||||||
|
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_4_", '""') WHERE `thursday` = 0 AND `id` = i;
|
||||||
|
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_5_", '""') WHERE `friday` = 0 AND `id` = i;
|
||||||
|
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_6_", '""') WHERE `saturday` = 0 AND `id` = i;
|
||||||
|
UPDATE `tevent_alert` SET `schedule` = REPLACE(`schedule`, "_7_", '""') WHERE `sunday` = 0 AND `id` = i;
|
||||||
|
END LOOP;
|
||||||
|
CLOSE cur1;
|
||||||
|
END ;
|
40
pandora_console/extras/mr/procedures/alertTemplates.sql
Normal file
40
pandora_console/extras/mr/procedures/alertTemplates.sql
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
CREATE PROCEDURE migrateRanges()
|
||||||
|
BEGIN
|
||||||
|
DECLARE done INT DEFAULT FALSE;
|
||||||
|
DECLARE i INT;
|
||||||
|
DECLARE r TEXT;
|
||||||
|
DECLARE cur1 CURSOR FOR SELECT `id` FROM `talert_templates`;
|
||||||
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||||
|
|
||||||
|
UPDATE `talert_templates` SET `schedule` = '{"monday":_1_,"tuesday":_2_,"wednesday":_3_,"thursday":_4_,"friday":_5_,"saturday":_6_,"sunday":_7_}';
|
||||||
|
UPDATE `talert_templates` SET `time_from` = "00:00:00", `time_to` = "00:00:00" WHERE `time_from` = `time_to`;
|
||||||
|
|
||||||
|
OPEN cur1;
|
||||||
|
read_loop: LOOP
|
||||||
|
FETCH cur1 INTO i;
|
||||||
|
|
||||||
|
IF done THEN
|
||||||
|
LEAVE read_loop;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SELECT concat('[{"start":"', `time_from`, '","end":"', `time_to`, '"}]') into r FROM `talert_templates` WHERE `id` = i;
|
||||||
|
|
||||||
|
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_1_", r) WHERE `monday` > 0 AND `id` = i;
|
||||||
|
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_2_", r) WHERE `tuesday` > 0 AND `id` = i;
|
||||||
|
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_3_", r) WHERE `wednesday` > 0 AND `id` = i;
|
||||||
|
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_4_", r) WHERE `thursday` > 0 AND `id` = i;
|
||||||
|
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_5_", r) WHERE `friday` > 0 AND `id` = i;
|
||||||
|
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_6_", r) WHERE `saturday` > 0 AND `id` = i;
|
||||||
|
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_7_", r) WHERE `sunday` > 0 AND `id` = i;
|
||||||
|
|
||||||
|
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_1_", '""') WHERE `monday` = 0 AND `id` = i;
|
||||||
|
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_2_", '""') WHERE `tuesday` = 0 AND `id` = i;
|
||||||
|
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_3_", '""') WHERE `wednesday` = 0 AND `id` = i;
|
||||||
|
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_4_", '""') WHERE `thursday` = 0 AND `id` = i;
|
||||||
|
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_5_", '""') WHERE `friday` = 0 AND `id` = i;
|
||||||
|
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_6_", '""') WHERE `saturday` = 0 AND `id` = i;
|
||||||
|
UPDATE `talert_templates` SET `schedule` = REPLACE(`schedule`, "_7_", '""') WHERE `sunday` = 0 AND `id` = i;
|
||||||
|
END LOOP;
|
||||||
|
CLOSE cur1;
|
||||||
|
END ;
|
@ -715,6 +715,7 @@ ALTER TABLE `tevent_alert` ADD COLUMN `id_template_conditions` int(10) unsigned
|
|||||||
ALTER TABLE `tevent_alert` ADD COLUMN `id_template_fields` int(10) unsigned NOT NULL default 0;
|
ALTER TABLE `tevent_alert` ADD COLUMN `id_template_fields` int(10) unsigned NOT NULL default 0;
|
||||||
ALTER TABLE `tevent_alert` ADD COLUMN `last_evaluation` bigint(20) NOT NULL default 0;
|
ALTER TABLE `tevent_alert` ADD COLUMN `last_evaluation` bigint(20) NOT NULL default 0;
|
||||||
ALTER TABLE `tevent_alert` ADD COLUMN `pool_occurrences` int unsigned not null default 0;
|
ALTER TABLE `tevent_alert` ADD COLUMN `pool_occurrences` int unsigned not null default 0;
|
||||||
|
ALTER TABLE `tevent_alert` ADD COLUMN `schedule` TEXT;
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `tevent_alert_action`
|
-- Table `tevent_alert_action`
|
||||||
@ -1317,6 +1318,7 @@ ALTER TABLE talert_templates ADD COLUMN `field18_recovery` TEXT NOT NULL DEFAULT
|
|||||||
ALTER TABLE talert_templates ADD COLUMN `field19_recovery` TEXT NOT NULL DEFAULT "";
|
ALTER TABLE talert_templates ADD COLUMN `field19_recovery` TEXT NOT NULL DEFAULT "";
|
||||||
ALTER TABLE talert_templates ADD COLUMN `field20_recovery` TEXT NOT NULL DEFAULT "";
|
ALTER TABLE talert_templates ADD COLUMN `field20_recovery` TEXT NOT NULL DEFAULT "";
|
||||||
ALTER TABLE `talert_templates` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
|
ALTER TABLE `talert_templates` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
|
||||||
|
ALTER TABLE `talert_templates` ADD COLUMN `schedule` TEXT;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `talert_snmp`
|
-- Table `talert_snmp`
|
||||||
@ -1451,13 +1453,13 @@ ALTER TABLE `ttag` MODIFY COLUMN `name` text NOT NULL default '';
|
|||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 51);
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 52);
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 759);
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 760);
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||||
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
|
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
|
||||||
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
|
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
|
||||||
@ -2185,6 +2187,7 @@ CREATE TABLE IF NOT EXISTS `tautoconfig` (
|
|||||||
`name` varchar(100) NOT NULL,
|
`name` varchar(100) NOT NULL,
|
||||||
`order` int(11) NOT NULL DEFAULT '0',
|
`order` int(11) NOT NULL DEFAULT '0',
|
||||||
`description` text,
|
`description` text,
|
||||||
|
`disabled` TINYINT,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access HA cluster'
|
'Trying to access HA cluster'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -17,7 +17,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Inventory'
|
'Trying to access Inventory'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -27,7 +27,7 @@ $group = $id_grupo;
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], $group, 'AW', $id_agente)) {
|
if (! check_acl($config['id_user'], $group, 'AW', $id_agente)) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access agent manager'
|
'Trying to access agent manager'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -154,7 +154,10 @@ ui_require_javascript_file('openlayers.pandora');
|
|||||||
$new_agent = (empty($id_agente)) ? true : false;
|
$new_agent = (empty($id_agente)) ? true : false;
|
||||||
|
|
||||||
if (! isset($id_agente) && ! $new_agent) {
|
if (! isset($id_agente) && ! $new_agent) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access agent manager witout an agent');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access agent manager witout an agent'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
|||||||
|
|
||||||
if (!$access_granted) {
|
if (!$access_granted) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access agent manager'
|
'Trying to access agent manager'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -198,7 +198,10 @@ if ($create_agent) {
|
|||||||
$grupo = (int) get_parameter_post('grupo');
|
$grupo = (int) get_parameter_post('grupo');
|
||||||
|
|
||||||
if ((bool) check_acl($config['id_user'], $grupo, 'AW') === false) {
|
if ((bool) check_acl($config['id_user'], $grupo, 'AW') === false) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access agent manager');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access agent manager'
|
||||||
|
);
|
||||||
include $config['homedir'].'/general/noaccess.php';
|
include $config['homedir'].'/general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -352,7 +355,7 @@ if ($create_agent) {
|
|||||||
|
|
||||||
$unsafe_alias = io_safe_output($alias);
|
$unsafe_alias = io_safe_output($alias);
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||||
'Created agent '.$unsafe_alias,
|
'Created agent '.$unsafe_alias,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
@ -1243,7 +1246,7 @@ if ($update_agent) {
|
|||||||
|
|
||||||
ui_print_success_message(__('Successfully updated'));
|
ui_print_success_message(__('Successfully updated'));
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||||
'Updated agent '.io_safe_output($alias),
|
'Updated agent '.io_safe_output($alias),
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
@ -1259,7 +1262,10 @@ if ($id_agente) {
|
|||||||
// This has been done in the beginning of the page, but if an agent was created, this id might change.
|
// This has been done in the beginning of the page, but if an agent was created, this id might change.
|
||||||
$id_grupo = agents_get_agent_group($id_agente);
|
$id_grupo = agents_get_agent_group($id_agente);
|
||||||
if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') && !check_acl_one_of_groups($config['id_user'], $all_groups, 'AD')) {
|
if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') && !check_acl_one_of_groups($config['id_user'], $all_groups, 'AD')) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to admin an agent without access');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to admin an agent without access'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -1319,7 +1325,7 @@ if ($update_module || $create_module) {
|
|||||||
|
|
||||||
if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to create a module without admin rights'
|
'Trying to create a module without admin rights'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -1803,7 +1809,7 @@ if ($update_module) {
|
|||||||
$edit_module = true;
|
$edit_module = true;
|
||||||
|
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||||
"Fail to try update module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
|
"Fail to try update module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -1827,7 +1833,7 @@ if ($update_module) {
|
|||||||
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
||||||
|
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||||
"Updated module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']),
|
"Updated module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']),
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
@ -1989,7 +1995,7 @@ if ($create_module) {
|
|||||||
$edit_module = true;
|
$edit_module = true;
|
||||||
$moduletype = $id_module;
|
$moduletype = $id_module;
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||||
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
|
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -2014,7 +2020,7 @@ if ($create_module) {
|
|||||||
|
|
||||||
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||||
"Added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']),
|
"Added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']),
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
@ -2049,12 +2055,12 @@ if ($enable_module) {
|
|||||||
$success_action = $result;
|
$success_action = $result;
|
||||||
if ($result === NOERR) {
|
if ($result === NOERR) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Module management',
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
'Enable #'.$enable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
|
'Enable #'.$enable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Module management',
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
'Fail to enable #'.$enable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
|
'Fail to enable #'.$enable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -2084,12 +2090,12 @@ if ($disable_module) {
|
|||||||
|
|
||||||
if ($result === NOERR) {
|
if ($result === NOERR) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Module management',
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
'Disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
|
'Disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Module management',
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
'Fail to disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
|
'Fail to disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -2133,7 +2139,7 @@ if ($delete_module) {
|
|||||||
|
|
||||||
if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to delete a module without admin rights'
|
'Trying to delete a module without admin rights'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -2143,7 +2149,7 @@ if ($delete_module) {
|
|||||||
|
|
||||||
if (empty($module_data) || $id_borrar_modulo < 1) {
|
if (empty($module_data) || $id_borrar_modulo < 1) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'HACK Attempt',
|
AUDIT_LOG_HACK_ATTEMPT,
|
||||||
'Expected variable from form is not correct'
|
'Expected variable from form is not correct'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -2165,7 +2171,7 @@ if ($delete_module) {
|
|||||||
|
|
||||||
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||||
"Deleted module '".io_safe_output($module_data['nombre'])."' for agent ".io_safe_output($agent['alias'])
|
"Deleted module '".io_safe_output($module_data['nombre'])."' for agent ".io_safe_output($agent['alias'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -2206,12 +2212,12 @@ if (!empty($duplicate_module)) {
|
|||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||||
"Duplicate module '".$id_duplicate_module."' for agent ".$agent['alias'].' with the new id for clon '.$result
|
"Duplicate module '".$id_duplicate_module."' for agent ".$agent['alias'].' with the new id for clon '.$result
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||||
"Fail to try duplicate module '".$id_duplicate_module."' for agent ".$agent['alias']
|
"Fail to try duplicate module '".$id_duplicate_module."' for agent ".$agent['alias']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -2225,9 +2231,15 @@ if ($enable_module) {
|
|||||||
|
|
||||||
if ($result === NOERR) {
|
if ($result === NOERR) {
|
||||||
enterprise_hook('config_agents_enable_module_conf', [$id_agente, $enable_module]);
|
enterprise_hook('config_agents_enable_module_conf', [$id_agente, $enable_module]);
|
||||||
db_pandora_audit('Module management', 'Enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
|
'Enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Module management', 'Fail to enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
|
'Fail to enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
@ -2244,9 +2256,15 @@ if ($disable_module) {
|
|||||||
|
|
||||||
if ($result === NOERR) {
|
if ($result === NOERR) {
|
||||||
enterprise_hook('config_agents_disable_module_conf', [$id_agente, $disable_module]);
|
enterprise_hook('config_agents_disable_module_conf', [$id_agente, $disable_module]);
|
||||||
db_pandora_audit('Module management', 'Disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
|
'Disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Module management', 'Fail to disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
|
'Fail to disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
|
@ -16,7 +16,10 @@ global $config;
|
|||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access Group Management2');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Group Management'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ check_login();
|
|||||||
|
|
||||||
if (!check_acl($config['id_user'], 0, 'PM')) {
|
if (!check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Group Management'
|
'Trying to access Group Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -58,7 +58,7 @@ if (! check_acl(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access agent manager'
|
'Trying to access agent manager'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -158,7 +158,7 @@ if ($agent_to_delete) {
|
|||||||
} else {
|
} else {
|
||||||
// NO permissions.
|
// NO permissions.
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
"Trying to delete agent \'".agents_get_name($id_agente)."\'"
|
"Trying to delete agent \'".agents_get_name($id_agente)."\'"
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -219,12 +219,12 @@ if ($enable_agent) {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||||
'Enable '.$alias
|
'Enable '.$alias
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||||
'Fail to enable '.$alias
|
'Fail to enable '.$alias
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -262,12 +262,12 @@ if ($disable_agent) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||||
'Disable '.$alias
|
'Disable '.$alias
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||||
'Fail to disable '.$alias
|
'Fail to disable '.$alias
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ if ($prediction_available) {
|
|||||||
$modules['predictionserver'] = __('Create a new prediction server module');
|
$modules['predictionserver'] = __('Create a new prediction server module');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_metaconsole() === true || $web_available === '1') {
|
if (is_metaconsole() === true || $web_available >= '1') {
|
||||||
$modules['webserver'] = __('Create a new web Server module');
|
$modules['webserver'] = __('Create a new web Server module');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ echo '</table>';
|
|||||||
if (!$config['disable_help']) {
|
if (!$config['disable_help']) {
|
||||||
echo '<div class="disable_help">';
|
echo '<div class="disable_help">';
|
||||||
echo '<strong>';
|
echo '<strong>';
|
||||||
echo "<a class='color-black-grey invert_filter' target='_blank' href='http://pandorafms.com/Library/Library/'>".__('Get more modules on Monitoring Library').'</a>';
|
echo "<a class='color-black-grey invert_filter' target='_blank' href='https://pandorafms.com/Library/Library/'>".__('Get more modules on Monitoring Library').'</a>';
|
||||||
echo '</strong>';
|
echo '</strong>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
@ -261,7 +261,7 @@ if ($module_action === 'delete') {
|
|||||||
|
|
||||||
if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to delete a module without admin rights'
|
'Trying to delete a module without admin rights'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -549,7 +549,7 @@ if ($is_function_policies !== ENTERPRISE_NOT_HOOK) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||||
'Re-link module '.$id_agent_module
|
'Re-link module '.$id_agent_module
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -562,7 +562,10 @@ if ($is_function_policies !== ENTERPRISE_NOT_HOOK) {
|
|||||||
__('Module will be unlinked in the next application')
|
__('Module will be unlinked in the next application')
|
||||||
);
|
);
|
||||||
|
|
||||||
db_pandora_audit('Agent management', 'Unlink module '.$id_agent_module);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||||
|
'Unlink module '.$id_agent_module
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,7 +585,7 @@ if ($__code_from !== 'policies') {
|
|||||||
|
|
||||||
if (!$tag_acl) {
|
if (!$tag_acl) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access agent manager'
|
'Trying to access agent manager'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -73,7 +73,7 @@ if ($edit_networkmap) {
|
|||||||
|
|
||||||
if (!$networkmap_write && !$networkmap_manage) {
|
if (!$networkmap_write && !$networkmap_manage) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access networkmap'
|
'Trying to access networkmap'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -38,7 +38,7 @@ $agent_w = check_acl($config['id_user'], 0, 'AW');
|
|||||||
$access = ($agent_d == true) ? 'AD' : (($agent_w == true) ? 'AW' : 'AD');
|
$access = ($agent_d == true) ? 'AD' : (($agent_w == true) ? 'AW' : 'AD');
|
||||||
if (!$agent_d && !$agent_w) {
|
if (!$agent_d && !$agent_w) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access downtime scheduler'
|
'Trying to access downtime scheduler'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -170,7 +170,7 @@ if ($delete_downtime_agent === 1) {
|
|||||||
|| !in_array($downtime_group, $user_groups_ad)
|
|| !in_array($downtime_group, $user_groups_ad)
|
||||||
) {
|
) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access downtime scheduler'
|
'Trying to access downtime scheduler'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -189,7 +189,7 @@ if ($delete_downtime_agent === 1) {
|
|||||||
|| !in_array($agent_group, $user_groups_ad)
|
|| !in_array($agent_group, $user_groups_ad)
|
||||||
) {
|
) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access downtime scheduler'
|
'Trying to access downtime scheduler'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -266,7 +266,7 @@ if ($create_downtime || $update_downtime) {
|
|||||||
// Check AD permission on new downtime.
|
// Check AD permission on new downtime.
|
||||||
if (!in_array($id_group, $user_groups_ad)) {
|
if (!in_array($id_group, $user_groups_ad)) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access downtime scheduler'
|
'Trying to access downtime scheduler'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -324,7 +324,7 @@ if ($create_downtime || $update_downtime) {
|
|||||||
// Check AD permission on OLD downtime.
|
// Check AD permission on OLD downtime.
|
||||||
if (empty($old_downtime) || !in_array($old_downtime['id_group'], $user_groups_ad)) {
|
if (empty($old_downtime) || !in_array($old_downtime['id_group'], $user_groups_ad)) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access downtime scheduler'
|
'Trying to access downtime scheduler'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -334,7 +334,7 @@ if ($create_downtime || $update_downtime) {
|
|||||||
// Check AD permission on NEW downtime group.
|
// Check AD permission on NEW downtime group.
|
||||||
if (!in_array($id_group, $user_groups_ad)) {
|
if (!in_array($id_group, $user_groups_ad)) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access downtime scheduler'
|
'Trying to access downtime scheduler'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -498,7 +498,7 @@ if ($id_downtime > 0) {
|
|||||||
// Permission check for the downtime with the AD user groups
|
// Permission check for the downtime with the AD user groups
|
||||||
if (empty($result) || !in_array($result['id_group'], $user_groups_ad)) {
|
if (empty($result) || !in_array($result['id_group'], $user_groups_ad)) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access downtime scheduler'
|
'Trying to access downtime scheduler'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -639,20 +639,20 @@ $table->data[5][1] = "
|
|||||||
<tr><td>".ui_get_using_system_timezone_warning().'</td></tr>
|
<tr><td>".ui_get_using_system_timezone_warning().'</td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.__('Type Periodicity:').' '.html_print_select(
|
<td>'.__('Type Periodicity:').' '.html_print_select(
|
||||||
[
|
[
|
||||||
'weekly' => __('Weekly'),
|
'weekly' => __('Weekly'),
|
||||||
'monthly' => __('Monthly'),
|
'monthly' => __('Monthly'),
|
||||||
],
|
],
|
||||||
'type_periodicity',
|
'type_periodicity',
|
||||||
$type_periodicity,
|
$type_periodicity,
|
||||||
'change_type_periodicity();',
|
'change_type_periodicity();',
|
||||||
'',
|
'',
|
||||||
0,
|
0,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
$disabled_in_execution
|
$disabled_in_execution
|
||||||
)."</td>
|
)."</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -672,31 +672,31 @@ $table->data[5][1] = "
|
|||||||
<tr>
|
<tr>
|
||||||
<td>".__('From day:').'</td>
|
<td>".__('From day:').'</td>
|
||||||
<td>'.html_print_select(
|
<td>'.html_print_select(
|
||||||
$days,
|
$days,
|
||||||
'periodically_day_from',
|
'periodically_day_from',
|
||||||
$periodically_day_from,
|
$periodically_day_from,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
0,
|
0,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
$disabled_in_execution
|
$disabled_in_execution
|
||||||
).'</td>
|
).'</td>
|
||||||
<td>'.__('To day:').'</td>
|
<td>'.__('To day:').'</td>
|
||||||
<td>'.html_print_select(
|
<td>'.html_print_select(
|
||||||
$days,
|
$days,
|
||||||
'periodically_day_to',
|
'periodically_day_to',
|
||||||
$periodically_day_to,
|
$periodically_day_to,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
0,
|
0,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
$disabled_in_execution
|
$disabled_in_execution
|
||||||
).'</td>
|
).'</td>
|
||||||
<td>'.ui_print_help_tip(__('The end day must be higher than the start day'), true).'</td>
|
<td>'.ui_print_help_tip(__('The end day must be higher than the start day'), true).'</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -705,26 +705,26 @@ $table->data[5][1] = "
|
|||||||
<tr>
|
<tr>
|
||||||
<td>'.__('From hour:').'</td>
|
<td>'.__('From hour:').'</td>
|
||||||
<td>'.html_print_input_text(
|
<td>'.html_print_input_text(
|
||||||
'periodically_time_from',
|
'periodically_time_from',
|
||||||
$periodically_time_from,
|
$periodically_time_from,
|
||||||
'',
|
'',
|
||||||
7,
|
7,
|
||||||
7,
|
7,
|
||||||
true,
|
true,
|
||||||
$disabled_in_execution
|
$disabled_in_execution
|
||||||
).ui_print_help_tip(
|
).ui_print_help_tip(
|
||||||
__('The end time must be higher than the start time'),
|
__('The end time must be higher than the start time'),
|
||||||
true
|
true
|
||||||
).'</td>
|
).'</td>
|
||||||
<td>'.__('To hour:').'</td>
|
<td>'.__('To hour:').'</td>
|
||||||
<td>'.html_print_input_text(
|
<td>'.html_print_input_text(
|
||||||
'periodically_time_to',
|
'periodically_time_to',
|
||||||
$periodically_time_to,
|
$periodically_time_to,
|
||||||
'',
|
'',
|
||||||
7,
|
7,
|
||||||
7,
|
7,
|
||||||
true,
|
true,
|
||||||
$disabled_in_execution
|
$disabled_in_execution
|
||||||
).ui_print_help_tip(
|
).ui_print_help_tip(
|
||||||
__('The end time must be higher than the start time'),
|
__('The end time must be higher than the start time'),
|
||||||
true
|
true
|
||||||
@ -1008,13 +1008,13 @@ $table->data['module'][1] = "
|
|||||||
<td class='cell_delete_button' style='text-align: right; width:10%;' id=''>".'<a class="link_delete"
|
<td class='cell_delete_button' style='text-align: right; width:10%;' id=''>".'<a class="link_delete"
|
||||||
onclick="if(!confirm(\''.__('Are you sure?').'\')) return false;"
|
onclick="if(!confirm(\''.__('Are you sure?').'\')) return false;"
|
||||||
href="">'.html_print_image(
|
href="">'.html_print_image(
|
||||||
'images/cross.png',
|
'images/cross.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'border' => '0',
|
'border' => '0',
|
||||||
'alt' => __('Delete'),
|
'alt' => __('Delete'),
|
||||||
'class' => 'invert_filter',
|
'class' => 'invert_filter',
|
||||||
]
|
]
|
||||||
).'</a>'."</td>
|
).'</a>'."</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='datos2' id='add_modules_row'>
|
<tr class='datos2' id='add_modules_row'>
|
||||||
@ -1093,7 +1093,7 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
|
|||||||
|| !in_array($downtime_group, $user_groups_ad)
|
|| !in_array($downtime_group, $user_groups_ad)
|
||||||
) {
|
) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access downtime scheduler'
|
'Trying to access downtime scheduler'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -23,7 +23,10 @@ require_once '../../include/functions_reporting.php';
|
|||||||
|
|
||||||
$config['id_user'] = $_SESSION['id_usuario'];
|
$config['id_user'] = $_SESSION['id_usuario'];
|
||||||
if (! check_acl($config['id_user'], 0, 'AR')) {
|
if (! check_acl($config['id_user'], 0, 'AR')) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access downtime scheduler');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access downtime scheduler'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ $access = ($read_permisson == true) ? 'AR' : (($write_permisson == true) ? 'AD'
|
|||||||
|
|
||||||
if (! $read_permisson && !$manage_permisson) {
|
if (! $read_permisson && !$manage_permisson) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access downtime scheduler'
|
'Trying to access downtime scheduler'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -70,7 +70,7 @@ if ($stop_downtime) {
|
|||||||
// Check AD permission on the downtime
|
// Check AD permission on the downtime
|
||||||
if (empty($downtime) || (! check_acl($config['id_user'], $downtime['id_group'], 'AD') && ! check_acl($config['id_user'], $downtime['id_group'], 'AW'))) {
|
if (empty($downtime) || (! check_acl($config['id_user'], $downtime['id_group'], 'AD') && ! check_acl($config['id_user'], $downtime['id_group'], 'AW'))) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access downtime scheduler'
|
'Trying to access downtime scheduler'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -94,7 +94,7 @@ if ($delete_downtime) {
|
|||||||
// Check AD permission on the downtime
|
// Check AD permission on the downtime
|
||||||
if (empty($downtime) || (! check_acl($config['id_user'], $downtime['id_group'], 'AD') && ! check_acl($config['id_user'], $downtime['id_group'], 'AW'))) {
|
if (empty($downtime) || (! check_acl($config['id_user'], $downtime['id_group'], 'AD') && ! check_acl($config['id_user'], $downtime['id_group'], 'AW'))) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access downtime scheduler'
|
'Trying to access downtime scheduler'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -20,7 +20,7 @@ if (! check_acl($config['id_user'], 0, 'AR')
|
|||||||
&& ! check_acl($config['id_user'], 0, 'AM')
|
&& ! check_acl($config['id_user'], 0, 'AM')
|
||||||
) {
|
) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Agent Management'
|
'Trying to access Agent Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -42,7 +42,7 @@ enterprise_hook('open_meta_frame');
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'LM')) {
|
if (! check_acl($config['id_user'], 0, 'LM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert actions'
|
'Trying to access Alert actions'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -104,7 +104,7 @@ if ($copy_action) {
|
|||||||
// Then action group have to be in his own groups.
|
// Then action group have to be in his own groups.
|
||||||
if (!$is_in_group) {
|
if (!$is_in_group) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -115,17 +115,14 @@ if ($copy_action) {
|
|||||||
|
|
||||||
$result = alerts_clone_alert_action($id, $al_action['id_group']);
|
$result = alerts_clone_alert_action($id, $al_action['id_group']);
|
||||||
|
|
||||||
if ($result) {
|
$auditMessage = ((bool) $result === true)
|
||||||
db_pandora_audit(
|
? sprintf('Duplicate alert action %s clone to %s', $id, $result)
|
||||||
'Command management',
|
: sprintf('Fail try to duplicate alert action %s', $id);
|
||||||
'Duplicate alert action '.$id.' clone to '.$result
|
|
||||||
);
|
db_pandora_audit(
|
||||||
} else {
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
db_pandora_audit(
|
$auditMessage
|
||||||
'Command management',
|
);
|
||||||
'Fail try to duplicate alert action '.$id
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
$result,
|
$result,
|
||||||
@ -145,7 +142,7 @@ if ($delete_action) {
|
|||||||
|
|
||||||
if (!check_acl_restricted_all($config['id_user'], $al_action['id_group'], 'LM')) {
|
if (!check_acl_restricted_all($config['id_user'], $al_action['id_group'], 'LM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -158,7 +155,7 @@ if ($delete_action) {
|
|||||||
// Then must have "PM" access privileges.
|
// Then must have "PM" access privileges.
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -182,7 +179,7 @@ if ($delete_action) {
|
|||||||
// Then action group have to be in his own groups.
|
// Then action group have to be in his own groups.
|
||||||
if (!$is_in_group) {
|
if (!$is_in_group) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -194,17 +191,14 @@ if ($delete_action) {
|
|||||||
|
|
||||||
$result = alerts_delete_alert_action($id);
|
$result = alerts_delete_alert_action($id);
|
||||||
|
|
||||||
if ($result) {
|
$auditMessage = ((bool) $result === true)
|
||||||
db_pandora_audit(
|
? sprintf('Delete alert action #%s', $id)
|
||||||
'Command management',
|
: sprintf('Fail try to delete alert action #%s', $id);
|
||||||
'Delete alert action #'.$id
|
|
||||||
);
|
db_pandora_audit(
|
||||||
} else {
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
db_pandora_audit(
|
$auditMessage
|
||||||
'Command management',
|
);
|
||||||
'Fail try to delete alert action #'.$id
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
$result,
|
$result,
|
||||||
|
@ -21,7 +21,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'LM')) {
|
if (! check_acl($config['id_user'], 0, 'LM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -538,9 +538,20 @@ if ($create_command) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Command management', 'Create alert command #'.$result, false, false, $info);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Create alert command #'.$result,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$info
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Command management', 'Fail try to create alert command', false, false);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Fail try to create alert command',
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show errors.
|
// Show errors.
|
||||||
@ -570,7 +581,7 @@ if ($delete_command) {
|
|||||||
// Internal commands cannot be deleted.
|
// Internal commands cannot be deleted.
|
||||||
if (alerts_get_alert_command_internal($id)) {
|
if (alerts_get_alert_command_internal($id)) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -579,11 +590,14 @@ if ($delete_command) {
|
|||||||
|
|
||||||
$result = alerts_delete_alert_command($id);
|
$result = alerts_delete_alert_command($id);
|
||||||
|
|
||||||
if ($result) {
|
$auditMessage = ((bool) $result === true)
|
||||||
db_pandora_audit('Command management', 'Delete alert command #'.$id);
|
? sprintf('Delete alert command #%s', $id)
|
||||||
} else {
|
: sprintf('Fail try to delete alert command #%s', $id);
|
||||||
db_pandora_audit('Command management', 'Fail try to delete alert command #'.$id);
|
|
||||||
}
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
$auditMessage
|
||||||
|
);
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
$result,
|
$result,
|
||||||
|
@ -18,7 +18,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'LW')) {
|
if (! check_acl($config['id_user'], 0, 'LW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -22,7 +22,7 @@ if (! check_acl($config['id_user'], 0, 'LW')
|
|||||||
&& ! check_acl($config['id_user'], 0, 'LM')
|
&& ! check_acl($config['id_user'], 0, 'LM')
|
||||||
) {
|
) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -21,7 +21,7 @@ if (! check_acl($config['id_user'], 0, 'LW')
|
|||||||
&& ! check_acl($config['id_user'], 0, 'LM')
|
&& ! check_acl($config['id_user'], 0, 'LM')
|
||||||
) {
|
) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -146,7 +146,7 @@ if ($create_alert) {
|
|||||||
$unsafe_agent_alias = io_safe_output($agent_alias);
|
$unsafe_agent_alias = io_safe_output($agent_alias);
|
||||||
if ($id) {
|
if ($id) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Alert management',
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
"Added alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'",
|
"Added alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'",
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
@ -154,7 +154,7 @@ if ($create_alert) {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Alert management',
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
"Fail Added alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'"
|
"Fail Added alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -217,12 +217,12 @@ if ($delete_alert) {
|
|||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Alert management',
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
"Deleted alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'"
|
"Deleted alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Alert management',
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
"Fail to deleted alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'"
|
"Fail to deleted alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -255,9 +255,15 @@ if ($add_action) {
|
|||||||
$result = alerts_add_alert_agent_module_action($id_alert_module, $id_action, $values);
|
$result = alerts_add_alert_agent_module_action($id_alert_module, $id_action, $values);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Alert management', 'Add action '.$id_action.' in alert '.$id_alert_module);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Add action '.$id_action.' in alert '.$id_alert_module
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Alert management', 'Fail to add action '.$id_action.' in alert '.$id_alert_module);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Fail to add action '.$id_action.' in alert '.$id_alert_module
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$messageAction = ui_print_result_message(
|
$messageAction = ui_print_result_message(
|
||||||
@ -290,9 +296,15 @@ if ($update_action) {
|
|||||||
|
|
||||||
$result = alerts_update_alert_agent_module_action($id_module_action, $values);
|
$result = alerts_update_alert_agent_module_action($id_module_action, $values);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Alert management', 'Update action '.$id_action.' in alert '.$id_alert_module);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Update action '.$id_action.' in alert '.$id_alert_module
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Alert management', 'Fail to updated action '.$id_action.' in alert '.$id_alert_module);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Fail to updated action '.$id_action.' in alert '.$id_alert_module
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$messageAction = ui_print_result_message(
|
$messageAction = ui_print_result_message(
|
||||||
@ -311,9 +323,15 @@ if ($delete_action) {
|
|||||||
$result = alerts_delete_alert_agent_module_action($id_action);
|
$result = alerts_delete_alert_agent_module_action($id_action);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Alert management', 'Delete action '.$id_action.' in alert '.$id_alert);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Delete action '.$id_action.' in alert '.$id_alert
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Alert management', 'Fail to delete action '.$id_action.' in alert '.$id_alert);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Fail to delete action '.$id_action.' in alert '.$id_alert
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$messageAction = ui_print_result_message(
|
$messageAction = ui_print_result_message(
|
||||||
@ -332,9 +350,15 @@ if ($enable_alert) {
|
|||||||
$result = alerts_agent_module_disable($id_alert, false);
|
$result = alerts_agent_module_disable($id_alert, false);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Alert management', 'Enable '.$id_alert);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Enable '.$id_alert
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Alert management', 'Fail to enable '.$id_alert);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Fail to enable '.$id_alert
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$messageAction = ui_print_result_message(
|
$messageAction = ui_print_result_message(
|
||||||
@ -353,9 +377,15 @@ if ($disable_alert) {
|
|||||||
$result = alerts_agent_module_disable($id_alert, true);
|
$result = alerts_agent_module_disable($id_alert, true);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Alert management', 'Disable '.$id_alert);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Disable '.$id_alert
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Alert management', 'Fail to disable '.$id_alert);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Fail to disable '.$id_alert
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$messageAction = ui_print_result_message(
|
$messageAction = ui_print_result_message(
|
||||||
@ -374,9 +404,15 @@ if ($standbyon_alert) {
|
|||||||
$result = alerts_agent_module_standby($id_alert, true);
|
$result = alerts_agent_module_standby($id_alert, true);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Alert management', 'Standby '.$id_alert);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Standby '.$id_alert
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Alert management', 'Fail to standby '.$id_alert);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Fail to standby '.$id_alert
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$messageAction = ui_print_result_message(
|
$messageAction = ui_print_result_message(
|
||||||
@ -395,9 +431,15 @@ if ($standbyoff_alert) {
|
|||||||
$result = alerts_agent_module_standby($id_alert, false);
|
$result = alerts_agent_module_standby($id_alert, false);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Alert management', 'Standbyoff '.$id_alert);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Standbyoff '.$id_alert
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Alert management', 'Fail to standbyoff '.$id_alert);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
|
'Fail to standbyoff '.$id_alert
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$messageAction = ui_print_result_message(
|
$messageAction = ui_print_result_message(
|
||||||
|
@ -108,7 +108,7 @@ if (is_ajax()) {
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'LM')) {
|
if (! check_acl($config['id_user'], 0, 'LM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -118,12 +118,7 @@ if (! check_acl($config['id_user'], 0, 'LM')) {
|
|||||||
$update_template = (bool) get_parameter('update_template');
|
$update_template = (bool) get_parameter('update_template');
|
||||||
$delete_template = (bool) get_parameter('delete_template');
|
$delete_template = (bool) get_parameter('delete_template');
|
||||||
$pure = get_parameter('pure', 0);
|
$pure = get_parameter('pure', 0);
|
||||||
|
$sec = (is_metaconsole() === true) ? 'advanced' : 'galertas';
|
||||||
if (defined('METACONSOLE')) {
|
|
||||||
$sec = 'advanced';
|
|
||||||
} else {
|
|
||||||
$sec = 'galertas';
|
|
||||||
}
|
|
||||||
|
|
||||||
// This prevents to duplicate the header in
|
// This prevents to duplicate the header in
|
||||||
// case delete_templete action is performed.
|
// case delete_templete action is performed.
|
||||||
@ -175,7 +170,7 @@ if ($delete_template) {
|
|||||||
if ($al_template['id_group'] == 0) {
|
if ($al_template['id_group'] == 0) {
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -217,7 +212,7 @@ if ($delete_template) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -242,12 +237,12 @@ if ($delete_template) {
|
|||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Template alert management',
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
'Delete alert template #'.$id
|
'Delete alert template #'.$id
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Template alert management',
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
'Fail try to delete alert template #'.$id
|
'Fail try to delete alert template #'.$id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Alerts details for agent.
|
||||||
|
*
|
||||||
|
* @category Alert
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Load global vars.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation for version 2.
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
// Load global vars
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'LM')) {
|
if (! check_acl($config['id_user'], 0, 'LM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert View (In management section)'
|
'Trying to access Alert View (In management section)'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -28,7 +43,7 @@ if (! check_acl($config['id_user'], 0, 'LM')) {
|
|||||||
enterprise_include_once('include/functions_policies.php');
|
enterprise_include_once('include/functions_policies.php');
|
||||||
|
|
||||||
$id_alert = get_parameter('id_alert', 0);
|
$id_alert = get_parameter('id_alert', 0);
|
||||||
// ID given as parameter
|
// ID given as parameter.
|
||||||
$alert = alerts_get_alert_agent_module($id_alert);
|
$alert = alerts_get_alert_agent_module($id_alert);
|
||||||
$template = alerts_get_alert_template($alert['id_alert_template']);
|
$template = alerts_get_alert_template($alert['id_alert_template']);
|
||||||
$actions = alerts_get_alert_agent_module_actions($id_alert);
|
$actions = alerts_get_alert_agent_module_actions($id_alert);
|
||||||
@ -36,19 +51,27 @@ $agent_alias = modules_get_agentmodule_agent_alias($alert['id_agent_module']);
|
|||||||
$agent = modules_get_agentmodule_agent($alert['id_agent_module']);
|
$agent = modules_get_agentmodule_agent($alert['id_agent_module']);
|
||||||
$module_name = modules_get_agentmodule_name($alert['id_agent_module']);
|
$module_name = modules_get_agentmodule_name($alert['id_agent_module']);
|
||||||
|
|
||||||
// Default action
|
// Default action.
|
||||||
$default_action = $template['id_alert_action'];
|
$default_action = $template['id_alert_action'];
|
||||||
if ($default_action != 0) {
|
if ($default_action != 0) {
|
||||||
$default_action = alerts_get_alert_action($default_action);
|
$default_action = alerts_get_alert_action($default_action);
|
||||||
$default_action['name'] .= ' '.'('.__('Default').')';
|
$default_action['name'] .= ' ('.__('Default').')';
|
||||||
$default_action['default'] = 1;
|
$default_action['default'] = 1;
|
||||||
$default_action['module_action_threshold'] = '0';
|
$default_action['module_action_threshold'] = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header
|
// Header.
|
||||||
ui_print_page_header(__('Alert details'), 'images/op_alerts.png', false, '', false, '');
|
ui_print_page_header(
|
||||||
|
__('Alert details'),
|
||||||
|
'images/op_alerts.png',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
// TABLE DETAILS
|
// TABLE DETAILS.
|
||||||
|
$table_details = new stdClass;
|
||||||
$table_details->class = 'databox';
|
$table_details->class = 'databox';
|
||||||
$table_details->width = '100%';
|
$table_details->width = '100%';
|
||||||
$table_details->size = [];
|
$table_details->size = [];
|
||||||
@ -103,7 +126,7 @@ $data[1] = '<span title="'.$priorities[$template['priority']].'" class="'.get_pr
|
|||||||
$table_details->data[] = $data;
|
$table_details->data[] = $data;
|
||||||
|
|
||||||
$data[0] = __('Stand by');
|
$data[0] = __('Stand by');
|
||||||
$data[1] = $alert['standby'] == 1 ? __('Yes') : __('No');
|
$data[1] = ($alert['standby'] == 1) ? __('Yes') : __('No');
|
||||||
$table_details->data[] = $data;
|
$table_details->data[] = $data;
|
||||||
|
|
||||||
if (enterprise_installed() && $alert['id_policy_alerts'] != 0) {
|
if (enterprise_installed() && $alert['id_policy_alerts'] != 0) {
|
||||||
@ -113,7 +136,13 @@ if (enterprise_installed() && $alert['id_policy_alerts'] != 0) {
|
|||||||
} else {
|
} else {
|
||||||
$img = 'images/policies_mc.png';
|
$img = 'images/policies_mc.png';
|
||||||
|
|
||||||
$policy = '<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&id='.$policyInfo['id'].'">'.html_print_image($img, true, ['title' => $policyInfo['name']]).'</a>';
|
$policy = '<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&id='.$policyInfo['id'].'">';
|
||||||
|
$policy .= html_print_image(
|
||||||
|
$img,
|
||||||
|
true,
|
||||||
|
['title' => $policyInfo['name']]
|
||||||
|
);
|
||||||
|
$policy .= '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[0] = __('Policy');
|
$data[0] = __('Policy');
|
||||||
@ -121,8 +150,7 @@ if (enterprise_installed() && $alert['id_policy_alerts'] != 0) {
|
|||||||
$table_details->data[] = $data;
|
$table_details->data[] = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TABLE DETAILS END
|
$table_conditions = new stdClass;
|
||||||
// TABLE CONDITIONS
|
|
||||||
$table_conditions->class = 'databox';
|
$table_conditions->class = 'databox';
|
||||||
$table_conditions->width = '100%';
|
$table_conditions->width = '100%';
|
||||||
$table_conditions->size = [];
|
$table_conditions->size = [];
|
||||||
@ -155,9 +183,13 @@ switch ($template['type']) {
|
|||||||
|
|
||||||
case 'max_min':
|
case 'max_min':
|
||||||
if ($template['matches_value']) {
|
if ($template['matches_value']) {
|
||||||
$condition = __('The alert would fire when the value is between <span id="min"></span> and <span id="max"></span>');
|
$condition = __(
|
||||||
|
'The alert would fire when the value is between <span id="min"></span> and <span id="max"></span>'
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$condition = __('The alert would fire when the value is not between <span id="min"></span> and <span id="max"></span>');
|
$condition = __(
|
||||||
|
'The alert would fire when the value is not between <span id="min"></span> and <span id="max"></span>'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$condition = str_replace('<span id="min"></span>', $template['min_value'], $condition);
|
$condition = str_replace('<span id="min"></span>', $template['min_value'], $condition);
|
||||||
@ -200,111 +232,27 @@ switch ($template['type']) {
|
|||||||
|
|
||||||
case 'always':
|
case 'always':
|
||||||
$condition = __('Always');
|
$condition = __('Always');
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Not possible.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[0] = $condition;
|
$data[0] = $condition;
|
||||||
|
|
||||||
$table_conditions->data[] = $data;
|
$table_conditions->data[] = $data;
|
||||||
|
|
||||||
// DAYS
|
$table_conditions->colspan[1][0] = 2;
|
||||||
$table_days->class = 'databox alert_days';
|
$schedule = io_safe_output(
|
||||||
$table_days->width = '100%';
|
$template['schedule']
|
||||||
$table_days->size = [];
|
);
|
||||||
$table_days->data = [];
|
|
||||||
$table_days->style = [];
|
|
||||||
$table_days->styleTable = 'padding: 1px; margin: 0px; text-align: center; height: 80px;';
|
|
||||||
$table_days->head[0] = __('Mon');
|
|
||||||
$table_days->head[1] = __('Tue');
|
|
||||||
$table_days->head[2] = __('Wed');
|
|
||||||
$table_days->head[3] = __('Thu');
|
|
||||||
$table_days->head[4] = __('Fri');
|
|
||||||
$table_days->head[5] = __('Sat');
|
|
||||||
$table_days->head[6] = __('Sun');
|
|
||||||
$table_days->data[0] = array_fill(0, 7, html_print_image('images/blade.png', true));
|
|
||||||
|
|
||||||
$days = [];
|
$data[0] = '';
|
||||||
if ($template['monday']) {
|
$data[0] .= html_print_input_hidden('schedule', $schedule, true);
|
||||||
$table_days->data[0][0] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
|
$data[0] .= '<div id="calendar_map"></div>';
|
||||||
}
|
|
||||||
|
|
||||||
if ($template['tuesday']) {
|
|
||||||
$table_days->data[0][1] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($template['wednesday']) {
|
|
||||||
$table_days->data[0][2] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($template['thursday']) {
|
|
||||||
$table_days->data[0][3] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($template['friday']) {
|
|
||||||
$table_days->data[0][4] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($template['saturday']) {
|
|
||||||
$table_days->data[0][5] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($template['sunday']) {
|
|
||||||
$table_days->data[0][6] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[0] = html_print_table($table_days, true);
|
|
||||||
unset($table_days);
|
|
||||||
|
|
||||||
// TIME
|
|
||||||
$table_time->class = 'databox alert_time';
|
|
||||||
$table_time->width = '100%';
|
|
||||||
$table_time->size = [];
|
|
||||||
$table_time->data = [];
|
|
||||||
$table_time->style = [];
|
|
||||||
$table_time->styleTable = 'padding: 1px; margin: 0px; text-align: center; height: 80px; width: 100%;';
|
|
||||||
|
|
||||||
// $data[0] = __('Time from') . ' / ' . __('Time to');
|
|
||||||
if ($template['time_from'] == $template['time_to']) {
|
|
||||||
$table_time->head[0] = '00:00:00<br>-<br>23:59:59';
|
|
||||||
$table_time->data[0][0] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
|
|
||||||
} else {
|
|
||||||
$from_array = explode(':', $template['time_from']);
|
|
||||||
$from = ($from_array[0] * SECONDS_1HOUR + $from_array[1] * SECONDS_1MINUTE + $from_array[2]);
|
|
||||||
$to_array = explode(':', $template['time_to']);
|
|
||||||
$to = ($to_array[0] * SECONDS_1HOUR + $to_array[1] * SECONDS_1MINUTE + $to_array[2]);
|
|
||||||
if ($to > $from) {
|
|
||||||
if ($template['time_from'] != '00:00:00') {
|
|
||||||
$table_time->head[0] = '00:00:00<br>-<br>'.$template['time_from'];
|
|
||||||
$table_time->data[0][0] = html_print_image('images/blade.png', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$table_time->head[1] = $template['time_from'].'<br>-<br>'.$template['time_to'];
|
|
||||||
$table_time->data[0][1] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
|
|
||||||
|
|
||||||
if ($template['time_to'] != '23:59:59') {
|
|
||||||
$table_time->head[2] = $template['time_to'].'<br>-<br>23:59:59';
|
|
||||||
$table_time->data[0][2] = html_print_image('images/blade.png', true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($template['time_to'] != '00:00:00') {
|
|
||||||
$table_time->head[0] = '00:00:00<br>-<br>'.$template['time_to'];
|
|
||||||
$table_time->data[0][0] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$table_time->head[1] = $template['time_to'].'<br>-<br>'.$template['time_from'];
|
|
||||||
$table_time->data[0][1] = html_print_image('images/blade.png', true, ['class' => 'invert_filter']);
|
|
||||||
|
|
||||||
if ($template['time_from'] != '23:59:59') {
|
|
||||||
$table_time->head[2] = $template['time_from'].'<br>-<br>23:59:59';
|
|
||||||
$table_time->data[0][2] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[1] = $template['time_from'].' / '.$template['time_to'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[1] = html_print_table($table_time, true);
|
|
||||||
unset($table_time);
|
|
||||||
|
|
||||||
|
$data[1] = '';
|
||||||
$table_conditions->data[] = $data;
|
$table_conditions->data[] = $data;
|
||||||
|
|
||||||
$data[0] = __('Use special days list');
|
$data[0] = __('Use special days list');
|
||||||
@ -319,7 +267,8 @@ $data[0] = __('Number of alerts').' ('.__('Min').'/'.__('Max').')';
|
|||||||
$data[1] = $template['min_alerts'].'/'.$template['max_alerts'];
|
$data[1] = $template['min_alerts'].'/'.$template['max_alerts'];
|
||||||
$table_conditions->data[] = $data;
|
$table_conditions->data[] = $data;
|
||||||
|
|
||||||
// TABLE CONDITIONS END
|
// TABLE CONDITIONS END.
|
||||||
|
$table = new stdClass;
|
||||||
$table->class = 'alert_list databox';
|
$table->class = 'alert_list databox';
|
||||||
$table->width = '98%';
|
$table->width = '98%';
|
||||||
$table->size = [];
|
$table->size = [];
|
||||||
@ -339,7 +288,8 @@ unset($table);
|
|||||||
|
|
||||||
$actions = alerts_get_actions_escalation($actions, $default_action);
|
$actions = alerts_get_actions_escalation($actions, $default_action);
|
||||||
|
|
||||||
// ESCALATION
|
// ESCALATION.
|
||||||
|
$table = new stdClass;
|
||||||
$table->class = 'alert_list databox alternate alert_escalation';
|
$table->class = 'alert_list databox alternate alert_escalation';
|
||||||
$table->width = '98%';
|
$table->width = '98%';
|
||||||
$table->size = [];
|
$table->size = [];
|
||||||
@ -354,19 +304,33 @@ $table->style[0] = 'font-weight: bold; text-align: left;';
|
|||||||
if (count($actions) == 1 && isset($actions[0])) {
|
if (count($actions) == 1 && isset($actions[0])) {
|
||||||
$table->head[1] = __('Every time that the alert is fired');
|
$table->head[1] = __('Every time that the alert is fired');
|
||||||
$table->data[0][0] = $actions[0]['name'];
|
$table->data[0][0] = $actions[0]['name'];
|
||||||
$table->data[0][1] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
|
$table->data[0][1] = html_print_image(
|
||||||
|
'images/tick.png',
|
||||||
|
true,
|
||||||
|
['class' => 'invert_filter']
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
foreach ($actions as $kaction => $action) {
|
foreach ($actions as $kaction => $action) {
|
||||||
$table->data[$kaction][0] = $action['name'];
|
$table->data[$kaction][0] = $action['name'];
|
||||||
if ($kaction == 0) {
|
if ((int) $kaction === 0) {
|
||||||
$table->data[$kaction][0] .= ui_print_help_tip(__('The default actions will be executed every time that the alert is fired and no other action is executed'), true);
|
$table->data[$kaction][0] .= ui_print_help_tip(
|
||||||
|
__('The default actions will be executed every time that the alert is fired and no other action is executed'),
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($action['escalation'] as $k => $v) {
|
foreach ($action['escalation'] as $k => $v) {
|
||||||
if ($v > 0) {
|
if ($v > 0) {
|
||||||
$table->data[$kaction][$k] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
|
$table->data[$kaction][$k] = html_print_image(
|
||||||
|
'images/tick.png',
|
||||||
|
true,
|
||||||
|
['class' => 'invert_filter']
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$table->data[$kaction][$k] = html_print_image('images/blade.png', true);
|
$table->data[$kaction][$k] = html_print_image(
|
||||||
|
'images/blade.png',
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($table->head) <= count($action['escalation'])) {
|
if (count($table->head) <= count($action['escalation'])) {
|
||||||
@ -382,12 +346,16 @@ if (count($actions) == 1 && isset($actions[0])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$action_threshold = $action['module_action_threshold'] > 0 ? $action['module_action_threshold'] : $action['action_threshold'];
|
$action_threshold = ($action['module_action_threshold'] > 0) ? $action['module_action_threshold'] : $action['action_threshold'];
|
||||||
|
|
||||||
if ($action_threshold == 0) {
|
if ($action_threshold == 0) {
|
||||||
$table->data[$kaction][($k + 1)] = __('No');
|
$table->data[$kaction][($k + 1)] = __('No');
|
||||||
} else {
|
} else {
|
||||||
$table->data[$kaction][($k + 1)] = human_time_description_raw($action_threshold, true, 'tiny');
|
$table->data[$kaction][($k + 1)] = human_time_description_raw(
|
||||||
|
$action_threshold,
|
||||||
|
true,
|
||||||
|
'tiny'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->head[($k + 1)] = __('Threshold');
|
$table->head[($k + 1)] = __('Threshold');
|
||||||
@ -397,7 +365,8 @@ if (count($actions) == 1 && isset($actions[0])) {
|
|||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
unset($table);
|
unset($table);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
// ESCALATION TABLE
|
// ESCALATION TABLE.
|
||||||
|
$table = new stdClass;
|
||||||
$table->class = 'alert_list databox';
|
$table->class = 'alert_list databox';
|
||||||
$table->width = '98%';
|
$table->width = '98%';
|
||||||
$table->size = [];
|
$table->size = [];
|
||||||
@ -405,7 +374,7 @@ $table->head = [];
|
|||||||
$table->data = [];
|
$table->data = [];
|
||||||
$table->rowstyle[1] = 'font-weight: bold;';
|
$table->rowstyle[1] = 'font-weight: bold;';
|
||||||
|
|
||||||
if ($default_action != 0) {
|
if ((int) $default_action != 0) {
|
||||||
$actions_select[0] = $default_action['name'];
|
$actions_select[0] = $default_action['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,17 +385,43 @@ foreach ($actions as $kaction => $action) {
|
|||||||
$table->data[0][0] = __('Select the desired action and mode to see the Firing/Recovery fields for this action');
|
$table->data[0][0] = __('Select the desired action and mode to see the Firing/Recovery fields for this action');
|
||||||
$table->colspan[0][0] = 2;
|
$table->colspan[0][0] = 2;
|
||||||
|
|
||||||
$table->data[1][0] = __('Action').'<br>'.html_print_select($actions_select, 'firing_action_select', -1, '', __('Select the action'), -1, true, false, false);
|
$table->data[1][0] = __('Action');
|
||||||
|
$table->data[1][0] .= '<br>';
|
||||||
|
$table->data[1][0] .= html_print_select(
|
||||||
|
$actions_select,
|
||||||
|
'firing_action_select',
|
||||||
|
-1,
|
||||||
|
'',
|
||||||
|
__('Select the action'),
|
||||||
|
-1,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
$modes = [];
|
$modes = [];
|
||||||
$modes['firing'] = __('Firing');
|
$modes['firing'] = __('Firing');
|
||||||
$modes['recovering'] = __('Recovering');
|
$modes['recovering'] = __('Recovering');
|
||||||
|
|
||||||
$table->data[1][1] = '<div class="action_details invisible" >'.__('Mode').'<br>'.html_print_select($modes, 'modes', 'firing', '', '', 0, true, false, false).'</div>';
|
$table->data[1][1] = '<div class="action_details invisible" >';
|
||||||
|
$table->data[1][1] .= __('Mode');
|
||||||
|
$table->data[1][1] .= '<br>';
|
||||||
|
$table->data[1][1] .= html_print_select(
|
||||||
|
$modes,
|
||||||
|
'modes',
|
||||||
|
'firing',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
$table->data[1][1] .= '</div>';
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
unset($table);
|
|
||||||
|
|
||||||
|
$table = new stdClass;
|
||||||
$table->class = 'alert_list databox alternate';
|
$table->class = 'alert_list databox alternate';
|
||||||
$table->width = '98%';
|
$table->width = '98%';
|
||||||
$table->size = [];
|
$table->size = [];
|
||||||
@ -437,13 +432,33 @@ $table->style[1] = 'width: 30%;';
|
|||||||
$table->style[2] = 'width: 30%;';
|
$table->style[2] = 'width: 30%;';
|
||||||
$table->style[3] = 'font-weight: bold; width: 30%;';
|
$table->style[3] = 'font-weight: bold; width: 30%;';
|
||||||
|
|
||||||
$table->title = __('Firing fields').ui_print_help_tip(__('Fields passed to the command executed by this action when the alert is fired'), true);
|
$table->title = __('Firing fields');
|
||||||
|
$table->title .= ui_print_help_tip(
|
||||||
|
__('Fields passed to the command executed by this action when the alert is fired'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$table->head[0] = __('Field').ui_print_help_tip(__('Fields configured on the command associated to the action'), true);
|
$table->head[0] = __('Field');
|
||||||
$table->head[1] = __('Template fields').ui_print_help_tip(__('Triggering fields configured in template'), true);
|
$table->head[0] .= ui_print_help_tip(
|
||||||
$table->head[2] = __('Action fields').ui_print_help_tip(__('Triggering fields configured in action'), true);
|
__('Fields configured on the command associated to the action'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table->head[1] = __('Template fields');
|
||||||
|
$table->head[1] .= ui_print_help_tip(
|
||||||
|
__('Triggering fields configured in template'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table->head[2] = __('Action fields');
|
||||||
|
$table->head[2] .= ui_print_help_tip(
|
||||||
|
__('Triggering fields configured in action'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$table->head[3] = __('Executed on firing').ui_print_help_tip(__('Fields used on execution when the alert is fired'), true);
|
$table->head[3] = __('Executed on firing');
|
||||||
|
$table->head[3] .= ui_print_help_tip(
|
||||||
|
__('Fields used on execution when the alert is fired'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$firing_fields = [];
|
$firing_fields = [];
|
||||||
|
|
||||||
@ -456,14 +471,12 @@ foreach ($actions as $kaction => $action) {
|
|||||||
$descriptions = json_decode($command['fields_descriptions'], true);
|
$descriptions = json_decode($command['fields_descriptions'], true);
|
||||||
|
|
||||||
foreach ($descriptions as $kdesc => $desc) {
|
foreach ($descriptions as $kdesc => $desc) {
|
||||||
if (empty($desc)) {
|
|
||||||
// continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$field = 'field'.($kdesc + 1);
|
$field = 'field'.($kdesc + 1);
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = $firing_fields[$kaction]['description'][$field] = $desc;
|
$data[0] = $desc;
|
||||||
if (!empty($data[0])) {
|
$firing_fields[$kaction]['description'][$field] = $desc;
|
||||||
|
|
||||||
|
if (empty($data[0]) === false) {
|
||||||
$data[0] = '<b>'.$data[0].'</b><br>';
|
$data[0] = '<b>'.$data[0].'</b><br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,12 +486,14 @@ foreach ($actions as $kaction => $action) {
|
|||||||
).')</span>';
|
).')</span>';
|
||||||
$data[1] = $template[$field];
|
$data[1] = $template[$field];
|
||||||
$data[2] = $action[$field];
|
$data[2] = $action[$field];
|
||||||
$data[3] = $firing_fields[$kaction]['value'][$field] = empty($action[$field]) ? $template[$field] : $action[$field];
|
$data[3] = (empty($action[$field]) === true) ? $template[$field] : $action[$field];
|
||||||
|
|
||||||
|
$firing_fields[$kaction]['value'][$field] = (empty($action[$field]) === true) ? $template[$field] : $action[$field];
|
||||||
|
|
||||||
$first_level = $template[$field];
|
$first_level = $template[$field];
|
||||||
$second_level = $action[$field];
|
$second_level = $action[$field];
|
||||||
if (!empty($second_level) || !empty($first_level)) {
|
if (empty($second_level) === false || empty($first_level) === false) {
|
||||||
if (empty($second_level)) {
|
if (empty($second_level) === false) {
|
||||||
$table->cellclass[count($table->data)][1] = 'used_field';
|
$table->cellclass[count($table->data)][1] = 'used_field';
|
||||||
$table->cellclass[count($table->data)][2] = 'empty_field';
|
$table->cellclass[count($table->data)][2] = 'empty_field';
|
||||||
} else {
|
} else {
|
||||||
@ -493,7 +508,7 @@ foreach ($actions as $kaction => $action) {
|
|||||||
|
|
||||||
$table->rowclass[] = 'firing_action firing_action_'.$kaction;
|
$table->rowclass[] = 'firing_action firing_action_'.$kaction;
|
||||||
|
|
||||||
if ($command_preview != 'Internal type') {
|
if ($command_preview !== 'Internal type') {
|
||||||
$command_preview = str_replace('_'.$field.'_', $data[3], $command_preview);
|
$command_preview = str_replace('_'.$field.'_', $data[3], $command_preview);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -504,20 +519,32 @@ foreach ($actions as $kaction => $action) {
|
|||||||
echo '<div class="mode_table mode_table_firing action_details invisible w100p">';
|
echo '<div class="mode_table mode_table_firing action_details invisible w100p">';
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
unset($table);
|
|
||||||
|
|
||||||
foreach ($actions as $kaction => $action) {
|
foreach ($actions as $kaction => $action) {
|
||||||
echo '<div class="firing_action firing_action_'.$kaction.' invisible">';
|
echo '<div class="firing_action firing_action_'.$kaction.' invisible">';
|
||||||
ui_print_info_message(['title' => __('Command preview'), 'message' => $firing_fields[$kaction]['command_preview'], 'no_close' => true]);
|
ui_print_info_message(
|
||||||
|
[
|
||||||
|
'title' => __('Command preview'),
|
||||||
|
'message' => $firing_fields[$kaction]['command_preview'],
|
||||||
|
'no_close' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
// Firing table
|
// Firing table.
|
||||||
echo '<div class="mode_table mode_table_recovering action_details invisible w100p" >';
|
echo '<div class="mode_table mode_table_recovering action_details invisible w100p" >';
|
||||||
if ($template['recovery_notify'] == 0) {
|
if ((int) $template['recovery_notify'] === 0) {
|
||||||
ui_print_info_message(['title' => __('Disabled'), 'message' => __('The alert recovering is disabled on this template.'), 'no_close' => true]);
|
ui_print_info_message(
|
||||||
|
[
|
||||||
|
'title' => __('Disabled'),
|
||||||
|
'message' => __('The alert recovering is disabled on this template.'),
|
||||||
|
'no_close' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
|
$table = new stdClass;
|
||||||
$table->class = 'alert_list databox alternate';
|
$table->class = 'alert_list databox alternate';
|
||||||
$table->width = '98%';
|
$table->width = '98%';
|
||||||
$table->size = [];
|
$table->size = [];
|
||||||
@ -528,13 +555,37 @@ if ($template['recovery_notify'] == 0) {
|
|||||||
$table->style[2] = 'width: 25%;';
|
$table->style[2] = 'width: 25%;';
|
||||||
$table->style[3] = 'width: 25%;';
|
$table->style[3] = 'width: 25%;';
|
||||||
$table->style[3] = 'font-weight: bold; width: 25%;';
|
$table->style[3] = 'font-weight: bold; width: 25%;';
|
||||||
$table->title = __('Recovering fields').ui_print_help_tip(__('Fields passed to the command executed by this action when the alert is recovered'), true);
|
$table->title = __('Recovering fields');
|
||||||
|
$table->title .= ui_print_help_tip(
|
||||||
|
__('Fields passed to the command executed by this action when the alert is recovered'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$table->head[0] = __('Field').ui_print_help_tip(__('Fields configured on the command associated to the action'), true);
|
$table->head[0] = __('Field');
|
||||||
$table->head[1] = __('Firing fields').ui_print_help_tip(__('Fields used on execution when the alert is fired'), true);
|
$table->head[0] .= ui_print_help_tip(
|
||||||
$table->head[2] = __('Template recovery fields').ui_print_help_tip(__('Recovery fields configured in alert template'), true);
|
__('Fields configured on the command associated to the action'),
|
||||||
$table->head[3] = __('Action recovery fields').ui_print_help_tip(__('Recovery fields configured in alert action'), true);
|
true
|
||||||
$table->head[4] = __('Executed on recovery').ui_print_help_tip(__('Fields used on execution when the alert is recovered'), true);
|
);
|
||||||
|
$table->head[1] = __('Firing fields');
|
||||||
|
$table->head[1] .= ui_print_help_tip(
|
||||||
|
__('Fields used on execution when the alert is fired'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table->head[2] = __('Template recovery fields');
|
||||||
|
$table->head[2] .= ui_print_help_tip(
|
||||||
|
__('Recovery fields configured in alert template'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table->head[3] = __('Action recovery fields');
|
||||||
|
$table->head[3] .= ui_print_help_tip(
|
||||||
|
__('Recovery fields configured in alert action'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table->head[4] = __('Executed on recovery');
|
||||||
|
$table->head[4] .= ui_print_help_tip(
|
||||||
|
__('Fields used on execution when the alert is recovered'),
|
||||||
|
true
|
||||||
|
);
|
||||||
$table->style[4] = 'font-weight: bold;';
|
$table->style[4] = 'font-weight: bold;';
|
||||||
|
|
||||||
foreach ($firing_fields as $kaction => $firing) {
|
foreach ($firing_fields as $kaction => $firing) {
|
||||||
@ -544,7 +595,7 @@ if ($template['recovery_notify'] == 0) {
|
|||||||
foreach ($firing['description'] as $field => $desc) {
|
foreach ($firing['description'] as $field => $desc) {
|
||||||
$data[0] = $desc;
|
$data[0] = $desc;
|
||||||
|
|
||||||
if (!empty($data[0])) {
|
if (empty($data[0]) === false) {
|
||||||
$data[0] = '<b>'.$data[0].'</b><br>';
|
$data[0] = '<b>'.$data[0].'</b><br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,14 +611,14 @@ if ($template['recovery_notify'] == 0) {
|
|||||||
$first_level = $data[1];
|
$first_level = $data[1];
|
||||||
$second_level = $data[2];
|
$second_level = $data[2];
|
||||||
$third_level = $data[3];
|
$third_level = $data[3];
|
||||||
if (!empty($third_level) || !empty($second_level) || !empty($first_level)) {
|
if (empty($third_level) === false || empty($second_level) === false || empty($first_level) === false) {
|
||||||
if (!empty($third_level)) {
|
if (empty($third_level) === false) {
|
||||||
$table->cellclass[count($table->data)][1] = 'overrided_field';
|
$table->cellclass[count($table->data)][1] = 'overrided_field';
|
||||||
$table->cellclass[count($table->data)][2] = 'overrided_field';
|
$table->cellclass[count($table->data)][2] = 'overrided_field';
|
||||||
$table->cellclass[count($table->data)][3] = 'used_field';
|
$table->cellclass[count($table->data)][3] = 'used_field';
|
||||||
|
|
||||||
$data[4] = $data[3];
|
$data[4] = $data[3];
|
||||||
} else if (!empty($second_level)) {
|
} else if (empty($second_level) === false) {
|
||||||
$table->cellclass[count($table->data)][1] = 'overrided_field';
|
$table->cellclass[count($table->data)][1] = 'overrided_field';
|
||||||
$table->cellclass[count($table->data)][2] = 'used_field';
|
$table->cellclass[count($table->data)][2] = 'used_field';
|
||||||
$table->cellclass[count($table->data)][3] = 'empty_field';
|
$table->cellclass[count($table->data)][3] = 'empty_field';
|
||||||
@ -578,8 +629,8 @@ if ($template['recovery_notify'] == 0) {
|
|||||||
$table->cellclass[count($table->data)][2] = 'empty_field';
|
$table->cellclass[count($table->data)][2] = 'empty_field';
|
||||||
$table->cellclass[count($table->data)][3] = 'empty_field';
|
$table->cellclass[count($table->data)][3] = 'empty_field';
|
||||||
|
|
||||||
// All fields but field1 will have [RECOVER] prefix if no recovery fields are configured
|
// All fields but field1 will have [RECOVER] prefix if no recovery fields are configured.
|
||||||
$data[4] = $fieldn == 1 ? $data[1] : '[RECOVER]'.$data[1];
|
$data[4] = ((int) $fieldn === 1) ? $data[1] : '[RECOVER]'.$data[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -588,7 +639,7 @@ if ($template['recovery_notify'] == 0) {
|
|||||||
|
|
||||||
$table->rowclass[] = 'firing_action firing_action_'.$kaction;
|
$table->rowclass[] = 'firing_action firing_action_'.$kaction;
|
||||||
|
|
||||||
if ($command_preview != 'Internal type') {
|
if ($command_preview !== 'Internal type') {
|
||||||
$command_preview = str_replace('_'.$field.'_', $data[4], $command_preview);
|
$command_preview = str_replace('_'.$field.'_', $data[4], $command_preview);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,16 +649,85 @@ if ($template['recovery_notify'] == 0) {
|
|||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
unset($table);
|
unset($table);
|
||||||
ui_print_info_message(['title' => __('Command preview'), 'message' => $command_preview, 'no_close' => true]);
|
ui_print_info_message(
|
||||||
|
[
|
||||||
|
'title' => __('Command preview'),
|
||||||
|
'message' => $command_preview,
|
||||||
|
'no_close' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
// Recovering table
|
|
||||||
|
ui_require_css_file('main.min', 'include/javascript/fullcalendar/');
|
||||||
|
ui_require_javascript_file('main.min', 'include/javascript/fullcalendar/');
|
||||||
|
ui_require_javascript_file('pandora_fullcalendar');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
|
var calendarEl = document.getElementById('calendar_map');
|
||||||
|
if(calendarEl){
|
||||||
|
var eventsBBDD = $("#hidden-schedule").val();
|
||||||
|
if(eventsBBDD === '' || eventsBBDD === 'Array') {
|
||||||
|
eventsBBDD = '';
|
||||||
|
}
|
||||||
|
var events = loadEventBBDD(eventsBBDD);
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
contentHeight: "auto",
|
||||||
|
headerToolbar: {
|
||||||
|
left: "",
|
||||||
|
center: "",
|
||||||
|
right: ''
|
||||||
|
},
|
||||||
|
buttonText: {},
|
||||||
|
dayHeaderFormat: { weekday: "short" },
|
||||||
|
initialView: "dayGridWeek",
|
||||||
|
navLinks: false,
|
||||||
|
selectable: true,
|
||||||
|
selectMirror: true,
|
||||||
|
slotDuration: "01:00:00",
|
||||||
|
slotLabelInterval: "02:00:00",
|
||||||
|
snapDuration: "01:00:00",
|
||||||
|
slotMinTime: "00:00:00",
|
||||||
|
slotMaxTime: "24:00:00",
|
||||||
|
scrollTime: "01:00:00",
|
||||||
|
locale: "en-GB",
|
||||||
|
firstDay: 1,
|
||||||
|
eventTimeFormat: {
|
||||||
|
hour: "numeric",
|
||||||
|
minute: "2-digit",
|
||||||
|
hour12: false
|
||||||
|
},
|
||||||
|
eventColor: "#82b92e",
|
||||||
|
editable: false,
|
||||||
|
dayMaxEvents: 3,
|
||||||
|
dayPopoverFormat: { weekday: "long" },
|
||||||
|
defaultAllDay: false,
|
||||||
|
displayEventTime: true,
|
||||||
|
displayEventEnd: true,
|
||||||
|
selectOverlap: false,
|
||||||
|
eventOverlap: false,
|
||||||
|
allDaySlot: true,
|
||||||
|
droppable: false,
|
||||||
|
select: false,
|
||||||
|
selectAllow: false,
|
||||||
|
eventAllow: false,
|
||||||
|
eventDrop: false,
|
||||||
|
eventDragStop: false,
|
||||||
|
eventResize: false,
|
||||||
|
eventMouseEnter: false,
|
||||||
|
eventMouseLeave: false,
|
||||||
|
eventClick: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
var settings = {}
|
||||||
|
|
||||||
|
var calendar = fullCalendarPandora(calendarEl, options, settings, events);
|
||||||
|
calendar.render();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#firing_action_select').change(function() {
|
$('#firing_action_select').change(function() {
|
||||||
@ -619,8 +739,7 @@ $('#firing_action_select').change(function() {
|
|||||||
else {
|
else {
|
||||||
$('.action_details').show();
|
$('.action_details').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$('.firing_action').hide();
|
$('.firing_action').hide();
|
||||||
if($(this).val() != -1) {
|
if($(this).val() != -1) {
|
||||||
$('.firing_action_' + $(this).val()).show();
|
$('.firing_action_' + $(this).val()).show();
|
||||||
|
@ -23,7 +23,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'LM')) {
|
if (! check_acl($config['id_user'], 0, 'LM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -96,7 +96,10 @@ if ($al_action !== false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$is_in_group && $al_action['id_group'] != 0) {
|
if (!$is_in_group && $al_action['id_group'] != 0) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access unauthorized alert action configuration');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access unauthorized alert action configuration'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
/**
|
||||||
// ==================================================
|
* Configure Alert commands
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
*
|
||||||
// Please see http://pandorafms.org for full contribution list
|
* @category Alert management
|
||||||
// This program is free software; you can redistribute it and/or
|
* @package Pandora FMS
|
||||||
// modify it under the terms of the GNU General Public License
|
* @subpackage Community
|
||||||
// as published by the Free Software Foundation for version 2.
|
* @version 1.0.0
|
||||||
// This program is distributed in the hope that it will be useful,
|
* @license See below
|
||||||
// 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.
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* 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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
require_once $config['homedir'].'/include/functions_alerts.php';
|
require_once $config['homedir'].'/include/functions_alerts.php';
|
||||||
@ -23,7 +40,7 @@ enterprise_hook('open_meta_frame');
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -52,7 +69,10 @@ if ($id > 0) {
|
|||||||
$alert = alerts_get_alert_command($id);
|
$alert = alerts_get_alert_command($id);
|
||||||
|
|
||||||
if ($alert['internal'] || !check_acl_restricted_all($config['id_user'], $alert['id_group'], 'PM')) {
|
if ($alert['internal'] || !check_acl_restricted_all($config['id_user'], $alert['id_group'], 'PM')) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access Alert Management');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Alert Management'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -87,17 +107,17 @@ if ($update_command) {
|
|||||||
$values['description'] = $description;
|
$values['description'] = $description;
|
||||||
$values['id_group'] = $id_group;
|
$values['id_group'] = $id_group;
|
||||||
// Only for Metaconsole. Save the previous name for synchronizing.
|
// Only for Metaconsole. Save the previous name for synchronizing.
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole() === true) {
|
||||||
$values['previous_name'] = db_get_value('name', 'talert_commands', 'id', $id);
|
$values['previous_name'] = db_get_value('name', 'talert_commands', 'id', $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check it the new name is used in the other command.
|
// Check it the new name is used in the other command.
|
||||||
$id_check = db_get_value('id', 'talert_commands', 'name', $name);
|
$id_check = db_get_value('id', 'talert_commands', 'name', $name);
|
||||||
if (($id_check != $id) && (!empty($id_check))) {
|
if (($id_check != $id) && (!empty($id_check))) {
|
||||||
$result = '';
|
$result = false;
|
||||||
} else {
|
} else {
|
||||||
$result = alerts_update_alert_command($id, $values);
|
$result = (bool) alerts_update_alert_command($id, $values);
|
||||||
if ($result) {
|
if ($result === true) {
|
||||||
$info = '{"Name":"'.$name.'","Command":"'.$command.'","Description":"'.$description.' '.$info_fields.'"}';
|
$info = '{"Name":"'.$name.'","Command":"'.$command.'","Description":"'.$description.' '.$info_fields.'"}';
|
||||||
$alert['fields_values'] = io_json_mb_encode($fields_values);
|
$alert['fields_values'] = io_json_mb_encode($fields_values);
|
||||||
$alert['fields_descriptions'] = io_json_mb_encode($fields_descriptions);
|
$alert['fields_descriptions'] = io_json_mb_encode($fields_descriptions);
|
||||||
@ -109,11 +129,15 @@ if ($update_command) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result) {
|
$auditMessage = ((bool) $result === true) ? 'Update alert command' : 'Fail to update alert command';
|
||||||
db_pandora_audit('Command management', 'Update alert command #'.$id, false, false, $info);
|
|
||||||
} else {
|
db_pandora_audit(
|
||||||
db_pandora_audit('Command management', 'Fail to update alert command #'.$id, false, false);
|
AUDIT_LOG_ALERT_MANAGEMENT,
|
||||||
}
|
sprintf('%s #%s', $auditMessage, $id),
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$info
|
||||||
|
);
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
$result,
|
$result,
|
||||||
@ -130,7 +154,7 @@ $fields_descriptions = '';
|
|||||||
$fields_values = '';
|
$fields_values = '';
|
||||||
$id_group = 0;
|
$id_group = 0;
|
||||||
if ($id) {
|
if ($id) {
|
||||||
if (!$result) {
|
if ($result === false) {
|
||||||
$alert = alerts_get_alert_command($id);
|
$alert = alerts_get_alert_command($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -32,7 +32,10 @@ if (!isset($_SESSION['id_usuario'])) {
|
|||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access audit CSV export');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access audit CSV export'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,10 @@ check_login();
|
|||||||
enterprise_hook('open_meta_frame');
|
enterprise_hook('open_meta_frame');
|
||||||
|
|
||||||
if (!check_acl($config['id_user'], 0, 'PM') && !is_user_admin($config['id_user'])) {
|
if (!check_acl($config['id_user'], 0, 'PM') && !is_user_admin($config['id_user'])) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access Categories Management');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Categories Management'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -113,10 +116,16 @@ if (is_management_allowed() === false) {
|
|||||||
if ($is_management_allowed === true && $delete != 0) {
|
if ($is_management_allowed === true && $delete != 0) {
|
||||||
$return_delete = categories_delete_category($delete);
|
$return_delete = categories_delete_category($delete);
|
||||||
if (!$return_delete) {
|
if (!$return_delete) {
|
||||||
db_pandora_audit('Category management', 'Fail try to delete category #'.$delete);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_CATEGORY_MANAGEMENT,
|
||||||
|
'Fail try to delete category #'.$delete
|
||||||
|
);
|
||||||
ui_print_error_message(__('Error deleting category'));
|
ui_print_error_message(__('Error deleting category'));
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Category management', 'Delete category #'.$delete);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_CATEGORY_MANAGEMENT,
|
||||||
|
'Delete category #'.$delete
|
||||||
|
);
|
||||||
ui_print_success_message(__('Successfully deleted category'));
|
ui_print_success_message(__('Successfully deleted category'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,10 @@ enterprise_hook('open_meta_frame');
|
|||||||
require_once $config['homedir'].'/include/functions_categories.php';
|
require_once $config['homedir'].'/include/functions_categories.php';
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access Edit Category');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Edit Category'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -85,34 +88,46 @@ if ($update_category && $id_category != 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
db_pandora_audit('Category management', "Fail try to update category #$id_category");
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_CATEGORY_MANAGEMENT,
|
||||||
|
'Fail try to update category #'.$id_category
|
||||||
|
);
|
||||||
ui_print_error_message(__('Error updating category'));
|
ui_print_error_message(__('Error updating category'));
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Category management', "Update category #$id_category");
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_CATEGORY_MANAGEMENT,
|
||||||
|
'Update category #'.$id_category
|
||||||
|
);
|
||||||
ui_print_success_message(__('Successfully updated category'));
|
ui_print_success_message(__('Successfully updated category'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create category: creates a new category
|
// Create category: creates a new category.
|
||||||
if ($create_category) {
|
if ($create_category) {
|
||||||
$return_create = true;
|
$return_create = true;
|
||||||
|
|
||||||
$values = [];
|
$values = [];
|
||||||
$values['name'] = $name_category;
|
$values['name'] = $name_category;
|
||||||
|
|
||||||
// DB insert
|
// DB insert.
|
||||||
$return_create = false;
|
$return_create = false;
|
||||||
if ($values['name'] != '') {
|
if ($values['name'] != '') {
|
||||||
$return_create = db_process_sql_insert('tcategory', $values);
|
$return_create = db_process_sql_insert('tcategory', $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($return_create === false) {
|
if ($return_create === false) {
|
||||||
db_pandora_audit('Category management', 'Fail try to create category');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_CATEGORY_MANAGEMENT,
|
||||||
|
'Fail try to create category'
|
||||||
|
);
|
||||||
ui_print_error_message(__('Error creating category'));
|
ui_print_error_message(__('Error creating category'));
|
||||||
$action = 'new';
|
$action = 'new';
|
||||||
// If create action ends successfully then current action is update
|
// If create action ends successfully then current action is update.
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Category management', "Create category #$return_create");
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_CATEGORY_MANAGEMENT,
|
||||||
|
'Create category #'.$return_create
|
||||||
|
);
|
||||||
ui_print_success_message(__('Successfully created category'));
|
ui_print_success_message(__('Successfully created category'));
|
||||||
$id_category = $return_create;
|
$id_category = $return_create;
|
||||||
$action = 'update';
|
$action = 'update';
|
||||||
@ -120,7 +135,7 @@ if ($create_category) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Form fields are filled here
|
// Form fields are filled here
|
||||||
// Get results when update action is performed
|
// Get results when update action is performed.
|
||||||
if ($action == 'update' && $id_category != 0) {
|
if ($action == 'update' && $id_category != 0) {
|
||||||
$result_category = db_get_row_filter('tcategory', ['id' => $id_category]);
|
$result_category = db_get_row_filter('tcategory', ['id' => $id_category]);
|
||||||
$name_category = $result_category['name'];
|
$name_category = $result_category['name'];
|
||||||
|
@ -18,7 +18,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'DM')) {
|
if (! check_acl($config['id_user'], 0, 'DM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Database Management'
|
'Trying to access Database Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -17,7 +17,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Custom events Management'
|
'Trying to access Custom events Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -21,7 +21,7 @@ $access = ($event_w == true) ? 'EW' : (($event_m == true) ? 'EM' : 'EW');
|
|||||||
|
|
||||||
if (!$event_w && !$event_m) {
|
if (!$event_w && !$event_m) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access events filter editor'
|
'Trying to access events filter editor'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -22,7 +22,7 @@ $access = ($event_w == true) ? 'EW' : (($event_m == true) ? 'EM' : 'EW');
|
|||||||
|
|
||||||
if (!$event_w && !$event_m) {
|
if (!$event_w && !$event_m) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access events filter editor'
|
'Trying to access events filter editor'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -43,7 +43,7 @@ if ($delete) {
|
|||||||
&& !check_acl_restricted_all($config['id_user'], $filter_group, 'EM')
|
&& !check_acl_restricted_all($config['id_user'], $filter_group, 'EM')
|
||||||
) {
|
) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access events filter editor'
|
'Trying to access events filter editor'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -17,7 +17,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Group Management'
|
'Trying to access Group Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -43,7 +43,7 @@ if ($event_response_id > 0) {
|
|||||||
// ACL check for event response edition.
|
// ACL check for event response edition.
|
||||||
if (!check_acl_restricted_all($config['id_user'], $event_response['id_group'], 'PM')) {
|
if (!check_acl_restricted_all($config['id_user'], $event_response['id_group'], 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Group Management'
|
'Trying to access Group Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -19,7 +19,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Group Management'
|
'Trying to access Group Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -19,7 +19,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Group Management'
|
'Trying to access Group Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -20,7 +20,7 @@ enterprise_hook('open_meta_frame');
|
|||||||
|
|
||||||
if (!check_acl($config['id_user'], 0, 'EW') && !check_acl($config['id_user'], 0, 'EM') && ! check_acl($config['id_user'], 0, 'PM')) {
|
if (!check_acl($config['id_user'], 0, 'EW') && !check_acl($config['id_user'], 0, 'EM') && ! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access event manage'
|
'Trying to access event manage'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -17,7 +17,7 @@ global $config;
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access extensions list'
|
'Trying to access extensions list'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -20,7 +20,10 @@ $gis_m = check_acl($config['id_user'], 0, 'MM');
|
|||||||
$access = ($gis_w == true) ? 'MW' : (($gis_m == true) ? 'MM' : 'MW');
|
$access = ($gis_w == true) ? 'MW' : (($gis_m == true) ? 'MM' : 'MW');
|
||||||
|
|
||||||
if (!$gis_w && !$gis_m) {
|
if (!$gis_w && !$gis_m) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access map builder');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access map builder'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -33,7 +36,10 @@ $action = get_parameter('action', 'new_map');
|
|||||||
$gis_map_group = db_get_value('group_id', 'tgis_map', 'id_tgis_map', $idMap);
|
$gis_map_group = db_get_value('group_id', 'tgis_map', 'id_tgis_map', $idMap);
|
||||||
|
|
||||||
if ($idMap > 0 && !check_acl_restricted_all($config['id_user'], $gis_map_group, 'MW') && !check_acl_restricted_all($config['id_user'], $gis_map_group, 'MW')) {
|
if ($idMap > 0 && !check_acl_restricted_all($config['id_user'], $gis_map_group, 'MW') && !check_acl_restricted_all($config['id_user'], $gis_map_group, 'MW')) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access map builder');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access map builder'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -71,6 +77,40 @@ foreach ($layer_ids as $layer_id) {
|
|||||||
|
|
||||||
$next_action = 'new_map';
|
$next_action = 'new_map';
|
||||||
|
|
||||||
|
$buttons['gis_maps_list'] = [
|
||||||
|
'active' => false,
|
||||||
|
'text' => '<a href="index.php?sec=godgismaps&sec2=operation/gis_maps/gis_map">'.html_print_image(
|
||||||
|
'images/list.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('GIS Maps list'),
|
||||||
|
'class' => 'invert_filter',
|
||||||
|
]
|
||||||
|
).'</a>',
|
||||||
|
];
|
||||||
|
if ($idMap) {
|
||||||
|
$buttons['view_gis'] = [
|
||||||
|
'active' => false,
|
||||||
|
'text' => '<a href="index.php?sec=gismaps&sec2=operation/gis_maps/render_view&map_id='.$idMap.'">'.html_print_image(
|
||||||
|
'images/op_gis.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('View GIS'),
|
||||||
|
'class' => 'invert_filter',
|
||||||
|
]
|
||||||
|
).'</a>',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_print_page_header(
|
||||||
|
__('GIS Maps builder'),
|
||||||
|
'images/gm_gis.png',
|
||||||
|
false,
|
||||||
|
'configure_gis_map_edit',
|
||||||
|
true,
|
||||||
|
$buttons
|
||||||
|
);
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'save_new':
|
case 'save_new':
|
||||||
$map_name = get_parameter('map_name');
|
$map_name = get_parameter('map_name');
|
||||||
@ -269,42 +309,6 @@ switch ($action) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = 'index.php?sec='.$sec.'&sec2='.$sec2.'&map_id='.$idMap.'&action='.$next_action;
|
|
||||||
|
|
||||||
$buttons['gis_maps_list'] = [
|
|
||||||
'active' => false,
|
|
||||||
'text' => '<a href="index.php?sec=godgismaps&sec2=operation/gis_maps/gis_map">'.html_print_image(
|
|
||||||
'images/list.png',
|
|
||||||
true,
|
|
||||||
[
|
|
||||||
'title' => __('GIS Maps list'),
|
|
||||||
'class' => 'invert_filter',
|
|
||||||
]
|
|
||||||
).'</a>',
|
|
||||||
];
|
|
||||||
if ($idMap) {
|
|
||||||
$buttons['view_gis'] = [
|
|
||||||
'active' => false,
|
|
||||||
'text' => '<a href="index.php?sec=gismaps&sec2=operation/gis_maps/render_view&map_id='.$idMap.'">'.html_print_image(
|
|
||||||
'images/op_gis.png',
|
|
||||||
true,
|
|
||||||
[
|
|
||||||
'title' => __('View GIS'),
|
|
||||||
'class' => 'invert_filter',
|
|
||||||
]
|
|
||||||
).'</a>',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_print_page_header(
|
|
||||||
__('GIS Maps builder'),
|
|
||||||
'images/gm_gis.png',
|
|
||||||
false,
|
|
||||||
'configure_gis_map_edit',
|
|
||||||
true,
|
|
||||||
$buttons
|
|
||||||
);
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -411,6 +415,7 @@ function addConnectionMap() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
$url = 'index.php?sec='.$sec.'&sec2='.$sec2.'&map_id='.$idMap.'&action='.$next_action;
|
||||||
echo '<form action="'.$url.'" id="form_setup" method="post">';
|
echo '<form action="'.$url.'" id="form_setup" method="post">';
|
||||||
|
|
||||||
// Load the data in edit or reload in update.
|
// Load the data in edit or reload in update.
|
||||||
|
@ -34,7 +34,10 @@ check_login();
|
|||||||
enterprise_hook('open_meta_frame');
|
enterprise_hook('open_meta_frame');
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access Group Management2');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Group Management2'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,10 @@ check_login();
|
|||||||
enterprise_hook('open_meta_frame');
|
enterprise_hook('open_meta_frame');
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access Group Management2');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Group Management2'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,10 @@ if (is_metaconsole() === true) {
|
|||||||
|
|
||||||
if (is_ajax() === true) {
|
if (is_ajax() === true) {
|
||||||
if ((bool) check_acl($config['id_user'], 0, 'AR') === false) {
|
if ((bool) check_acl($config['id_user'], 0, 'AR') === false) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access Group Management');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Group Management'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -74,7 +77,7 @@ if (is_ajax() === true) {
|
|||||||
|
|
||||||
if ((bool) check_acl($config['id_user'], $id_group, 'AR') === false) {
|
if ((bool) check_acl($config['id_user'], $id_group, 'AR') === false) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
echo json_encode(false);
|
echo json_encode(false);
|
||||||
@ -117,7 +120,7 @@ if (is_ajax() === true) {
|
|||||||
|
|
||||||
if ((bool) check_acl($config['id_user'], $id_group, 'AR') === false) {
|
if ((bool) check_acl($config['id_user'], $id_group, 'AR') === false) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
echo json_encode(false);
|
echo json_encode(false);
|
||||||
@ -275,7 +278,7 @@ if ($tab !== 'credbox'
|
|||||||
&& (bool) check_acl($config['id_user'], 0, 'AW') === false
|
&& (bool) check_acl($config['id_user'], 0, 'AW') === false
|
||||||
) {
|
) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Group Management'
|
'Trying to access Group Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -285,7 +288,7 @@ if ($tab !== 'credbox'
|
|||||||
&& (bool) check_acl($config['id_user'], 0, 'PM') === false
|
&& (bool) check_acl($config['id_user'], 0, 'PM') === false
|
||||||
) {
|
) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Credential Store'
|
'Trying to access Credential Store'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -32,7 +32,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Group Management'
|
'Trying to access Group Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -48,7 +48,7 @@ if (is_ajax() === true) {
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], $id_group, 'AR')) {
|
if (! check_acl($config['id_user'], $id_group, 'AR')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Alert Management'
|
'Trying to access Alert Management'
|
||||||
);
|
);
|
||||||
echo json_encode(false);
|
echo json_encode(false);
|
||||||
|
@ -31,7 +31,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access massive agent deletion section'
|
'Trying to access massive agent deletion section'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -150,7 +150,13 @@ if ($add) {
|
|||||||
'Fires_max' => $fires_max,
|
'Fires_max' => $fires_max,
|
||||||
'Actions' => implode(',', $actions),
|
'Actions' => implode(',', $actions),
|
||||||
];
|
];
|
||||||
db_pandora_audit('Massive management', 'Add alert action '.json_encode($id_agents), false, false, json_encode($info));
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Add alert action '.json_encode($id_agents),
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
json_encode($info)
|
||||||
|
);
|
||||||
ui_print_result_message($results, __('Successfully added'), __('Could not be added'));
|
ui_print_result_message($results, __('Successfully added'), __('Could not be added'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -31,7 +31,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access massive alert deletion'
|
'Trying to access massive alert deletion'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -139,16 +139,28 @@ function process_manage_add($id_alert_template, $id_agents, $module_names)
|
|||||||
$success = alerts_create_alert_agent_module($module, $id_alert_template);
|
$success = alerts_create_alert_agent_module($module, $id_alert_template);
|
||||||
|
|
||||||
if ($success) {
|
if ($success) {
|
||||||
$contsuccess ++;
|
$contsuccess++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$conttotal ++;
|
$conttotal++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($contsuccess > 0) {
|
if ($contsuccess > 0) {
|
||||||
db_pandora_audit('Massive management', 'Add alert', false, false, 'Alert template: '.$id_alert_template.' Modules: '.json_encode($modules_id));
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Add alert',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'Alert template: '.$id_alert_template.' Modules: '.json_encode($modules_id)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Massive management', 'Fail try to add alert', false, false, 'Alert template: '.$id_alert_template.' Modules: '.json_encode($modules_id));
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Fail try to add alert',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'Alert template: '.$id_alert_template.' Modules: '.json_encode($modules_id)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
|
@ -31,7 +31,7 @@ check_login();
|
|||||||
|
|
||||||
if (!check_acl($config['id_user'], 0, 'UM')) {
|
if (!check_acl($config['id_user'], 0, 'UM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access massive profile addition'
|
'Trying to access massive profile addition'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -80,7 +80,7 @@ if ($create_profiles) {
|
|||||||
// If the profile doesnt exist, we create it
|
// If the profile doesnt exist, we create it
|
||||||
if ($profile_data === false) {
|
if ($profile_data === false) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'User management',
|
AUDIT_LOG_USER_MANAGEMENT,
|
||||||
'Added profile for user '.io_safe_input($user)
|
'Added profile for user '.io_safe_input($user)
|
||||||
);
|
);
|
||||||
$return = profile_create_user_profile($user, $profile, $group);
|
$return = profile_create_user_profile($user, $profile, $group);
|
||||||
@ -95,7 +95,7 @@ if ($create_profiles) {
|
|||||||
|
|
||||||
if ($n_added > 0) {
|
if ($n_added > 0) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Massive management',
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
'Add profiles',
|
'Add profiles',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
@ -103,7 +103,7 @@ if ($create_profiles) {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Massive management',
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
'Fail to try add profiles',
|
'Fail to try add profiles',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
@ -31,7 +31,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Agent Config Management Admin section'
|
'Trying to access Agent Config Management Admin section'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -66,7 +66,7 @@ if ($do_operation) {
|
|||||||
];
|
];
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Massive management',
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
'Copy modules',
|
'Copy modules',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
@ -74,7 +74,7 @@ if ($do_operation) {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Massive management',
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
'Fail to try copy modules',
|
'Fail to try copy modules',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
@ -31,7 +31,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access massive agent deletion section'
|
'Trying to access massive agent deletion section'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -148,9 +148,21 @@ if ($delete) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
if ($results) {
|
if ($results) {
|
||||||
db_pandora_audit('Massive management', 'Delete alert action', false, false, json_encode($info));
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Delete alert action',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
json_encode($info)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Massive management', 'Fail try to delete alert action', false, false, json_encode($info));
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Fail try to delete alert action',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
json_encode($info)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
|
@ -34,7 +34,7 @@ check_login();
|
|||||||
|
|
||||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === false) {
|
if ((bool) check_acl($config['id_user'], 0, 'AW') === false) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access massive agent deletion section'
|
'Trying to access massive agent deletion section'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -149,9 +149,10 @@ if ($delete === true) {
|
|||||||
$result = process_manage_delete($id_agents);
|
$result = process_manage_delete($id_agents);
|
||||||
|
|
||||||
$info = '{"Agent":"'.implode(',', $id_agents).'"}';
|
$info = '{"Agent":"'.implode(',', $id_agents).'"}';
|
||||||
|
|
||||||
if ($result === true) {
|
if ($result === true) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Massive management',
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
'Delete agent ',
|
'Delete agent ',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
@ -159,7 +160,7 @@ if ($delete === true) {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Massive management',
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
'Fail try to delete agent',
|
'Fail try to delete agent',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
@ -31,7 +31,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access massive alert deletion'
|
'Trying to access massive alert deletion'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -190,10 +190,10 @@ function process_manage_delete($id_alert_template, $id_agents, $module_names)
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($success) {
|
if ($success) {
|
||||||
$contsuccess ++;
|
$contsuccess++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$conttotal ++;
|
$conttotal++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
@ -223,9 +223,21 @@ if ($delete) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Massive management', 'Delete alert ', false, false, json_encode($info));
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Delete alert ',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
json_encode($info)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Massive management', 'Fail try to delete alert', false, false, json_encode($info));
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Fail try to delete alert',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
json_encode($info)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access agent massive deletion'
|
'Trying to access agent massive deletion'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -230,7 +230,7 @@ if ($delete) {
|
|||||||
|
|
||||||
foreach ($module_name as $mod_name) {
|
foreach ($module_name as $mod_name) {
|
||||||
$result = process_manage_delete($mod_name['nombre'], $id_agent['id_agente'], $modules_selection_mode);
|
$result = process_manage_delete($mod_name['nombre'], $id_agent['id_agente'], $modules_selection_mode);
|
||||||
$count ++;
|
$count++;
|
||||||
$success += (int) $result;
|
$success += (int) $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,11 +266,16 @@ if ($delete) {
|
|||||||
'Agent' => implode(',', $agents_),
|
'Agent' => implode(',', $agents_),
|
||||||
'Module' => implode(',', $modules_),
|
'Module' => implode(',', $modules_),
|
||||||
];
|
];
|
||||||
if ($result) {
|
|
||||||
db_pandora_audit('Massive management', 'Delete module ', false, false, json_encode($info));
|
$auditMessage = ((bool) $result === true) ? 'Delete module' : 'Fail try to delete module';
|
||||||
} else {
|
|
||||||
db_pandora_audit('Massive management', 'Fail try to delete module', false, false, json_encode($info));
|
db_pandora_audit(
|
||||||
}
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
$auditMessage,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
json_encode($info)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$groups = users_get_groups();
|
$groups = users_get_groups();
|
||||||
|
@ -31,7 +31,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'UM')) {
|
if (! check_acl($config['id_user'], 0, 'UM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access massive profile deletion'
|
'Trying to access massive profile deletion'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -96,7 +96,7 @@ if ($delete_profiles) {
|
|||||||
} else {
|
} else {
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'User management',
|
AUDIT_LOG_USER_MANAGEMENT,
|
||||||
'Deleted profile for user '.io_safe_input($user)
|
'Deleted profile for user '.io_safe_input($user)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -111,9 +111,21 @@ if ($delete_profiles) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Massive management', 'Delete profile ', false, false, json_encode($info));
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Delete profile ',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
json_encode($info)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Massive management', 'Fail try to delete profile', false, false, json_encode($info));
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Fail try to delete profile',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
json_encode($info)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
|
@ -31,7 +31,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access massive agent deletion section'
|
'Trying to access massive agent deletion section'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -189,9 +189,15 @@ if ($update_agents) {
|
|||||||
|
|
||||||
|
|
||||||
if ($n_deleted > 0) {
|
if ($n_deleted > 0) {
|
||||||
db_pandora_audit('Massive management', 'Delete conf file '.$id_agent);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Delete conf file '.$id_agent
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Massive management', 'Try to delete conf file '.$id_agent);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Try to delete conf file '.$id_agent
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -383,10 +389,22 @@ if ($update_agents) {
|
|||||||
|
|
||||||
|
|
||||||
if ($result !== false) {
|
if ($result !== false) {
|
||||||
db_pandora_audit('Massive management', 'Update agent '.$id_agent, false, false, json_encode($info));
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Update agent '.$id_agent,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
json_encode($info)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
if (isset($id_agent)) {
|
if (isset($id_agent)) {
|
||||||
db_pandora_audit('Massive management', 'Try to update agent '.$id_agent, false, false, json_encode($info));
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Try to update agent '.$id_agent,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
json_encode($info)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access massive module update'
|
'Trying to access massive module update'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -187,9 +187,21 @@ if ($update) {
|
|||||||
|
|
||||||
$info = '{"Modules":"'.implode(',', $modules_).'","Agents":"'.implode(',', $agents_).'"}';
|
$info = '{"Modules":"'.implode(',', $modules_).'","Agents":"'.implode(',', $agents_).'"}';
|
||||||
if ($success > 0) {
|
if ($success > 0) {
|
||||||
db_pandora_audit('Massive management', 'Edit module', false, false, $info);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Edit module',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$info
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Massive management', 'Fail try to edit module', false, false, $info);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Fail try to edit module',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$info
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
*
|
*
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||||
* Please see http://pandorafms.org for full contribution list
|
* Please see http://pandorafms.org for full contribution list
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -33,7 +33,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access massive plugin edition section'
|
'Trying to access massive plugin edition section'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -45,7 +45,7 @@ $agent_ids = get_parameter('agent_ids', []);
|
|||||||
$module_ids = get_parameter('module_ids', []);
|
$module_ids = get_parameter('module_ids', []);
|
||||||
$module_names = get_parameter('module_names', []);
|
$module_names = get_parameter('module_names', []);
|
||||||
|
|
||||||
if (is_ajax()) {
|
if (is_ajax() === true) {
|
||||||
$get_plugin = (bool) get_parameter('get_plugin');
|
$get_plugin = (bool) get_parameter('get_plugin');
|
||||||
$get_agents = (bool) get_parameter('get_agents');
|
$get_agents = (bool) get_parameter('get_agents');
|
||||||
$get_modules = (bool) get_parameter('get_modules');
|
$get_modules = (bool) get_parameter('get_modules');
|
||||||
@ -54,21 +54,21 @@ if (is_ajax()) {
|
|||||||
if ($get_plugin) {
|
if ($get_plugin) {
|
||||||
$plugin = db_get_row('tplugin', 'id', $plugin_id);
|
$plugin = db_get_row('tplugin', 'id', $plugin_id);
|
||||||
|
|
||||||
if (empty($plugin)) {
|
if (empty($plugin) === true) {
|
||||||
$plugin = [];
|
$plugin = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($plugin['description'])) {
|
if (isset($plugin['description']) === true) {
|
||||||
$plugin['description'] = io_safe_output($plugin['description']);
|
$plugin['description'] = io_safe_output($plugin['description']);
|
||||||
$plugin['description'] = str_replace("\n", '<br>', $plugin['description']);
|
$plugin['description'] = str_replace("\n", '<br>', $plugin['description']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($plugin['macros'])) {
|
if (isset($plugin['macros']) === true) {
|
||||||
$macros = json_decode($plugin['macros'], true);
|
$macros = json_decode($plugin['macros'], true);
|
||||||
if (!empty($macros)) {
|
if (empty($macros) === false) {
|
||||||
$macros = array_values($macros);
|
$macros = array_values($macros);
|
||||||
|
|
||||||
if (!empty($macros)) {
|
if (empty($macros) === false) {
|
||||||
$plugin['macros'] = $macros;
|
$plugin['macros'] = $macros;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,15 +79,15 @@ if (is_ajax()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($get_agents) {
|
if ($get_agents) {
|
||||||
$sql = "SELECT ta.id_agente, ta.alias AS agent_alias,
|
$sql = 'SELECT ta.id_agente, ta.alias AS agent_alias,
|
||||||
tam.nombre AS module_name
|
tam.nombre AS module_name
|
||||||
FROM tagente ta
|
FROM tagente ta
|
||||||
INNER JOIN tagente_modulo tam
|
INNER JOIN tagente_modulo tam
|
||||||
ON ta.id_agente = tam.id_agente
|
ON ta.id_agente = tam.id_agente
|
||||||
AND tam.id_plugin = $plugin_id
|
AND tam.id_plugin = '.$plugin_id.'
|
||||||
ORDER BY ta.alias, tam.nombre";
|
ORDER BY ta.alias, tam.nombre';
|
||||||
$result = db_get_all_rows_sql($sql);
|
$result = db_get_all_rows_sql($sql);
|
||||||
if (empty($result)) {
|
if (empty($result) === true) {
|
||||||
$result = [];
|
$result = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ if (is_ajax()) {
|
|||||||
$name = io_safe_output($value['agent_alias']);
|
$name = io_safe_output($value['agent_alias']);
|
||||||
$module_name = $value['module_name'];
|
$module_name = $value['module_name'];
|
||||||
|
|
||||||
if (!empty($current_element) && $current_element['id'] !== $id) {
|
if (empty($current_element) === false && $current_element['id'] !== $id) {
|
||||||
$agents[] = $current_element;
|
$agents[] = $current_element;
|
||||||
$current_element = [];
|
$current_element = [];
|
||||||
}
|
}
|
||||||
@ -107,14 +107,14 @@ if (is_ajax()) {
|
|||||||
$current_element['id'] = $id;
|
$current_element['id'] = $id;
|
||||||
$current_element['name'] = $name;
|
$current_element['name'] = $name;
|
||||||
|
|
||||||
if (!isset($current_element['module_names'])) {
|
if (isset($current_element['module_names']) === false) {
|
||||||
$current_element['module_names'] = [];
|
$current_element['module_names'] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$current_element['module_names'][] = $module_name;
|
$current_element['module_names'][] = $module_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($current_element)) {
|
if (empty($current_element) === false) {
|
||||||
$agents[] = $current_element;
|
$agents[] = $current_element;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ if (is_ajax()) {
|
|||||||
];
|
];
|
||||||
$module_plugin_macros = db_get_all_rows_filter('tagente_modulo', $filter, $fields);
|
$module_plugin_macros = db_get_all_rows_filter('tagente_modulo', $filter, $fields);
|
||||||
$module_plugin_macros = io_safe_output($module_plugin_macros);
|
$module_plugin_macros = io_safe_output($module_plugin_macros);
|
||||||
if (empty($module_plugin_macros)) {
|
if (empty($module_plugin_macros) === true) {
|
||||||
$module_plugin_macros = [];
|
$module_plugin_macros = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,9 +139,9 @@ if (is_ajax()) {
|
|||||||
$module_plugin_macros,
|
$module_plugin_macros,
|
||||||
function ($carry, $item) {
|
function ($carry, $item) {
|
||||||
$macros = json_decode($item['macros'], true);
|
$macros = json_decode($item['macros'], true);
|
||||||
if (!empty($macros)) {
|
if (empty($macros) === false) {
|
||||||
$macros = array_values($macros);
|
$macros = array_values($macros);
|
||||||
if (!empty($macros)) {
|
if (empty($macros) === false) {
|
||||||
$carry[] = $macros;
|
$carry[] = $macros;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,28 +160,28 @@ if (is_ajax()) {
|
|||||||
|
|
||||||
$update = (bool) get_parameter('update');
|
$update = (bool) get_parameter('update');
|
||||||
|
|
||||||
if ($update) {
|
if ($update === true) {
|
||||||
try {
|
try {
|
||||||
$plugin = db_get_row('tplugin', 'id', $plugin_id);
|
$plugin = db_get_row('tplugin', 'id', $plugin_id);
|
||||||
// Macros retrieved from the plugin definition
|
// Macros retrieved from the plugin definition.
|
||||||
$plugin_macros = [];
|
$plugin_macros = [];
|
||||||
if (isset($plugin['macros'])) {
|
if (isset($plugin['macros']) === true) {
|
||||||
$plugin_macros = json_decode($plugin['macros'], true);
|
$plugin_macros = json_decode($plugin['macros'], true);
|
||||||
if (!empty($plugin_macros)) {
|
if (empty($plugin_macros) === false) {
|
||||||
$plugin_macros = array_values($plugin_macros);
|
$plugin_macros = array_values($plugin_macros);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error
|
// Error.
|
||||||
if (empty($plugin_macros)) {
|
if (empty($plugin_macros)) {
|
||||||
throw new Exception(__('Error retrieving the plugin macros'));
|
throw new Exception(__('Error retrieving the plugin macros'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Macros returned by the form
|
// Macros returned by the form.
|
||||||
$macros = get_parameter('macros', []);
|
$macros = get_parameter('macros', []);
|
||||||
|
|
||||||
// Error
|
// Error.
|
||||||
if (empty($macros)) {
|
if (empty($macros) === true) {
|
||||||
throw new Exception(__('Error retrieving the modified macros'));
|
throw new Exception(__('Error retrieving the modified macros'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,36 +199,36 @@ if ($update) {
|
|||||||
$filter,
|
$filter,
|
||||||
$fields
|
$fields
|
||||||
);
|
);
|
||||||
if (empty($module_plugin_macros)) {
|
if (empty($module_plugin_macros) === true) {
|
||||||
$module_plugin_macros = [];
|
$module_plugin_macros = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error
|
// Error.
|
||||||
if (empty($module_plugin_macros)) {
|
if (empty($module_plugin_macros) === true) {
|
||||||
throw new Exception(__('Error retrieving the module plugin macros'));
|
throw new Exception(__('Error retrieving the module plugin macros'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Begin transaction
|
// Begin transaction
|
||||||
// db_process_sql_begin();
|
// db_process_sql_begin();.
|
||||||
$errors = 0;
|
$errors = 0;
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
foreach ($module_plugin_macros as $item) {
|
foreach ($module_plugin_macros as $item) {
|
||||||
$module_id = $item['id_agente_modulo'];
|
$module_id = $item['id_agente_modulo'];
|
||||||
$module_macros_str = $item['macros'];
|
$module_macros_str = $item['macros'];
|
||||||
// Macros retrieved from the agent module
|
// Macros retrieved from the agent module.
|
||||||
$module_macros = json_decode($module_macros_str, true);
|
$module_macros = json_decode($module_macros_str, true);
|
||||||
|
|
||||||
|
|
||||||
// Error
|
// Error.
|
||||||
if (empty($module_macros)) {
|
if (empty($module_macros) === true) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
__('Error retrieving the module plugin macros data')
|
__('Error retrieving the module plugin macros data')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get the new module plugin macros
|
// Get the new module plugin macros.
|
||||||
$result_macros = array_map(
|
$result_macros = array_map(
|
||||||
function ($item) use ($macros, $module_macros) {
|
function ($item) use ($macros, $module_macros) {
|
||||||
$result = [
|
$result = [
|
||||||
@ -238,7 +238,7 @@ if ($update) {
|
|||||||
'hide' => $item['hide'],
|
'hide' => $item['hide'],
|
||||||
];
|
];
|
||||||
|
|
||||||
// Get the default value os the module plugin macro
|
// Get the default value os the module plugin macro.
|
||||||
$default = array_reduce(
|
$default = array_reduce(
|
||||||
$module_macros,
|
$module_macros,
|
||||||
function ($carry, $module_macro) use ($result) {
|
function ($carry, $module_macro) use ($result) {
|
||||||
@ -259,41 +259,48 @@ if ($update) {
|
|||||||
$plugin_macros
|
$plugin_macros
|
||||||
);
|
);
|
||||||
|
|
||||||
// Error
|
// Error.
|
||||||
if (empty($result_macros)) {
|
if (empty($result_macros) === true) {
|
||||||
throw new Exception(__('Error building the new macros'));
|
throw new Exception(__('Error building the new macros'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$module_macros = io_json_mb_encode($result_macros, JSON_FORCE_OBJECT);
|
$module_macros = io_json_mb_encode($result_macros, JSON_FORCE_OBJECT);
|
||||||
if (empty($module_macros)) {
|
if (empty($module_macros) === true) {
|
||||||
$module_macros = $module_macros_str;
|
$module_macros = $module_macros_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
$values = ['macros' => $module_macros];
|
$values = ['macros' => $module_macros];
|
||||||
$where = ['id_agente_modulo' => $module_id];
|
$where = ['id_agente_modulo' => $module_id];
|
||||||
// $result = db_process_sql_update('tagente_modulo', $values, $where, 'AND', false);
|
|
||||||
$result = db_process_sql_update('tagente_modulo', $values, $where);
|
$result = db_process_sql_update('tagente_modulo', $values, $where);
|
||||||
|
|
||||||
if (!$result) {
|
if ((bool) $result === false) {
|
||||||
$errors++;
|
$errors++;
|
||||||
} else {
|
} else {
|
||||||
$count += $result;
|
$count += $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!$errors) {
|
// Result message.
|
||||||
// db_process_sql_commit();
|
$auditMessage = sprintf(
|
||||||
// }
|
'Plugin #%s modules updated',
|
||||||
// else {
|
$plugin_id
|
||||||
// db_process_sql_rollback();
|
);
|
||||||
// }
|
|
||||||
// Result message
|
|
||||||
ui_print_info_message(sprintf(__('%d modules updated'), $count));
|
ui_print_info_message(sprintf(__('%d modules updated'), $count));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
$auditMessage = sprintf(
|
||||||
|
'Try to update plugin #%s modules: %s',
|
||||||
|
$plugin_id,
|
||||||
|
$e->getMessage()
|
||||||
|
);
|
||||||
ui_print_error_message($e->getMessage());
|
ui_print_error_message($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
$auditMessage
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = new StdClass();
|
$table = new StdClass();
|
||||||
@ -302,7 +309,7 @@ $table->width = '100%';
|
|||||||
$table->rowstyle = [];
|
$table->rowstyle = [];
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
|
||||||
// Plugins
|
// Plugins.
|
||||||
$filter = ['order' => 'name'];
|
$filter = ['order' => 'name'];
|
||||||
$fields = [
|
$fields = [
|
||||||
'id',
|
'id',
|
||||||
@ -341,10 +348,10 @@ $row[] = $plugins_select;
|
|||||||
|
|
||||||
$table->data['plugin-ids-row'] = $row;
|
$table->data['plugin-ids-row'] = $row;
|
||||||
|
|
||||||
// Agents & modules
|
// Agents & modules.
|
||||||
$row = [];
|
$row = [];
|
||||||
|
|
||||||
// Agents
|
// Agents.
|
||||||
$agents_select = html_print_select(
|
$agents_select = html_print_select(
|
||||||
$agent_ids,
|
$agent_ids,
|
||||||
'agent_ids[]',
|
'agent_ids[]',
|
||||||
@ -360,9 +367,7 @@ $agents_select = html_print_select(
|
|||||||
$row[] = '<b>'.__('Agents').'</b>';
|
$row[] = '<b>'.__('Agents').'</b>';
|
||||||
$row[] = $agents_select;
|
$row[] = $agents_select;
|
||||||
|
|
||||||
// Modules
|
// Modules.
|
||||||
// $modules_select = html_print_select ($module_ids, 'module_ids',
|
|
||||||
// false, '', '', 0, true, true, false);
|
|
||||||
$modules_select = html_print_select(
|
$modules_select = html_print_select(
|
||||||
$module_names,
|
$module_names,
|
||||||
'module_names[]',
|
'module_names[]',
|
||||||
@ -393,7 +398,7 @@ echo '</form>';
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var $table = $('table#massive_plugin_edition'),
|
var $table = $('table#massive_plugin_edition'),
|
||||||
$form = $('form#form-massive_plugin_edition'),
|
$form = $('form#form-massive_plugin_edition'),
|
||||||
$submitButton = $('input#submit-upd-btn'),
|
$submitButton = $('input#submit-upd-btn'),
|
||||||
@ -401,7 +406,7 @@ echo '</form>';
|
|||||||
$pluginsSelect = $('select#plugin_id'),
|
$pluginsSelect = $('select#plugin_id'),
|
||||||
$agentsSelect = $('select#agent_ids'),
|
$agentsSelect = $('select#agent_ids'),
|
||||||
$modulesSelect = $('select#module_names');
|
$modulesSelect = $('select#module_names');
|
||||||
|
|
||||||
var agents = [],
|
var agents = [],
|
||||||
ajaxPage = "<?php echo $config['homeurl'].'/'; ?>ajax.php",
|
ajaxPage = "<?php echo $config['homeurl'].'/'; ?>ajax.php",
|
||||||
canSubmit = false,
|
canSubmit = false,
|
||||||
@ -409,15 +414,15 @@ echo '</form>';
|
|||||||
agentsXHR,
|
agentsXHR,
|
||||||
modulesXHR,
|
modulesXHR,
|
||||||
modulePluginMacrosXHR;
|
modulePluginMacrosXHR;
|
||||||
|
|
||||||
var allowSubmit = function (val) {
|
var allowSubmit = function (val) {
|
||||||
if (typeof val === 'undefined')
|
if (typeof val === 'undefined')
|
||||||
val = true;
|
val = true;
|
||||||
|
|
||||||
canSubmit = val;
|
canSubmit = val;
|
||||||
$submitButton.prop('disabled', !val);
|
$submitButton.prop('disabled', !val);
|
||||||
}
|
}
|
||||||
|
|
||||||
var clearModulePluginMacrosValues = function () {
|
var clearModulePluginMacrosValues = function () {
|
||||||
$('input.plugin-macro')
|
$('input.plugin-macro')
|
||||||
.val('')
|
.val('')
|
||||||
@ -428,47 +433,47 @@ echo '</form>';
|
|||||||
.siblings('button')
|
.siblings('button')
|
||||||
.remove();
|
.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
var hidePluginData = function () {
|
var hidePluginData = function () {
|
||||||
$('table#massive_plugin_edition tr.plugin-data-row').hide();
|
$('table#massive_plugin_edition tr.plugin-data-row').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
var clearPluginData = function () {
|
var clearPluginData = function () {
|
||||||
hidePluginData();
|
hidePluginData();
|
||||||
clearModulePluginMacrosValues();
|
clearModulePluginMacrosValues();
|
||||||
$('table#massive_plugin_edition tr.plugin-data-row').remove();
|
$('table#massive_plugin_edition tr.plugin-data-row').remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
var clearAgentsData = function () {
|
var clearAgentsData = function () {
|
||||||
$agentsSelect.empty();
|
$agentsSelect.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
var clearModulesData = function () {
|
var clearModulesData = function () {
|
||||||
$modulesSelect.empty();
|
$modulesSelect.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates the plugin info and macros columns
|
// Creates the plugin info and macros columns.
|
||||||
var fillPlugin = function (plugin) {
|
var fillPlugin = function (plugin) {
|
||||||
clearPluginData();
|
clearPluginData();
|
||||||
|
|
||||||
if (typeof plugin === 'undefined'
|
if (typeof plugin === 'undefined'
|
||||||
|| typeof plugin.execute === 'undefined'
|
|| typeof plugin.execute === 'undefined'
|
||||||
|| typeof plugin.parameters === 'undefined'
|
|| typeof plugin.parameters === 'undefined'
|
||||||
|| typeof plugin.description === 'undefined'
|
|| typeof plugin.description === 'undefined'
|
||||||
|| typeof plugin.macros === 'undefined')
|
|| typeof plugin.macros === 'undefined')
|
||||||
throw new Error('<?php echo __('Invalid plugin data'); ?>');
|
throw new Error('<?php echo __('Invalid plugin data'); ?>');
|
||||||
|
|
||||||
if (_.isString(plugin.macros)) {
|
if (_.isString(plugin.macros)) {
|
||||||
plugin.macros = JSON.parse(plugin.macros);
|
plugin.macros = JSON.parse(plugin.macros);
|
||||||
}
|
}
|
||||||
|
|
||||||
var $commandRow = $('<tr></tr>'),
|
var $commandRow = $('<tr></tr>'),
|
||||||
$commandCellTitle = $('<td></td>'),
|
$commandCellTitle = $('<td></td>'),
|
||||||
$commandCellData = $('<td></td>'),
|
$commandCellData = $('<td></td>'),
|
||||||
$descriptionRow = $('<tr></tr>'),
|
$descriptionRow = $('<tr></tr>'),
|
||||||
$descriptionCellTitle = $('<td></td>'),
|
$descriptionCellTitle = $('<td></td>'),
|
||||||
$descriptionCellData = $('<td></td>');
|
$descriptionCellData = $('<td></td>');
|
||||||
|
|
||||||
$commandCellTitle
|
$commandCellTitle
|
||||||
.addClass('plugin-data-cell')
|
.addClass('plugin-data-cell')
|
||||||
.css('font-weight', 'bold')
|
.css('font-weight', 'bold')
|
||||||
@ -482,7 +487,7 @@ echo '</form>';
|
|||||||
.addClass('plugin-data-row')
|
.addClass('plugin-data-row')
|
||||||
.css('vertical-align', 'top')
|
.css('vertical-align', 'top')
|
||||||
.append($commandCellTitle, $commandCellData);
|
.append($commandCellTitle, $commandCellData);
|
||||||
|
|
||||||
$descriptionCellTitle
|
$descriptionCellTitle
|
||||||
.addClass('plugin-data-cell')
|
.addClass('plugin-data-cell')
|
||||||
.css('font-weight', 'bold')
|
.css('font-weight', 'bold')
|
||||||
@ -495,16 +500,16 @@ echo '</form>';
|
|||||||
.addClass('plugin-data-row')
|
.addClass('plugin-data-row')
|
||||||
.css('vertical-align', 'top')
|
.css('vertical-align', 'top')
|
||||||
.append($descriptionCellTitle, $descriptionCellData);
|
.append($descriptionCellTitle, $descriptionCellData);
|
||||||
|
|
||||||
$table.append($commandRow, $descriptionRow);
|
$table.append($commandRow, $descriptionRow);
|
||||||
|
|
||||||
_.each(plugin.macros, function (macro, index) {
|
_.each(plugin.macros, function (macro, index) {
|
||||||
var $macroRow = $('<tr></tr>'),
|
var $macroRow = $('<tr></tr>'),
|
||||||
$macroCellTitle = $('<td></td>'),
|
$macroCellTitle = $('<td></td>'),
|
||||||
$macroCellData = $('<td></td>'),
|
$macroCellData = $('<td></td>'),
|
||||||
$macroInput = $('<input>'),
|
$macroInput = $('<input>'),
|
||||||
$macroIdentifier = $('<span></span>');
|
$macroIdentifier = $('<span></span>');
|
||||||
|
|
||||||
$macroInput
|
$macroInput
|
||||||
.prop('id', macro.macro)
|
.prop('id', macro.macro)
|
||||||
.prop('name', 'macros[' + macro.macro + ']')
|
.prop('name', 'macros[' + macro.macro + ']')
|
||||||
@ -526,12 +531,12 @@ echo '</form>';
|
|||||||
.bind('focus', function() {
|
.bind('focus', function() {
|
||||||
$(this).autocomplete("search");
|
$(this).autocomplete("search");
|
||||||
});
|
});
|
||||||
|
|
||||||
$macroIdentifier
|
$macroIdentifier
|
||||||
.css('font-weight', 'normal')
|
.css('font-weight', 'normal')
|
||||||
.css('padding-left', '5px')
|
.css('padding-left', '5px')
|
||||||
.append('(' + macro.macro + ')');
|
.append('(' + macro.macro + ')');
|
||||||
|
|
||||||
$macroCellTitle
|
$macroCellTitle
|
||||||
.addClass('plugin-data-cell')
|
.addClass('plugin-data-cell')
|
||||||
.css('font-weight', 'bold')
|
.css('font-weight', 'bold')
|
||||||
@ -544,22 +549,22 @@ echo '</form>';
|
|||||||
$macroRow
|
$macroRow
|
||||||
.addClass('plugin-data-row')
|
.addClass('plugin-data-row')
|
||||||
.append($macroCellTitle, $macroCellData);
|
.append($macroCellTitle, $macroCellData);
|
||||||
|
|
||||||
$table.append($macroRow);
|
$table.append($macroRow);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var removeMultipleElementsButton = function (element) {
|
var removeMultipleElementsButton = function (element) {
|
||||||
element
|
element
|
||||||
.css('width', '99%')
|
.css('width', '99%')
|
||||||
.siblings('button')
|
.siblings('button')
|
||||||
.remove();
|
.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This button removes the special properties of the multiple values macro input
|
// This button removes the special properties of the multiple values macro input
|
||||||
var addMultipleElementsButton = function (element) {
|
var addMultipleElementsButton = function (element) {
|
||||||
$button = $('<button>');
|
$button = $('<button>');
|
||||||
|
|
||||||
$button
|
$button
|
||||||
.css('display', 'inline')
|
.css('display', 'inline')
|
||||||
.css('margin-left', '3px')
|
.css('margin-left', '3px')
|
||||||
@ -567,49 +572,49 @@ echo '</form>';
|
|||||||
.click(function (e) {
|
.click(function (e) {
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (!confirm("<?php echo __('Are you sure?'); ?>"))
|
if (!confirm("<?php echo __('Are you sure?'); ?>"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
removeMultipleElementsButton(element);
|
removeMultipleElementsButton(element);
|
||||||
|
|
||||||
element
|
element
|
||||||
.val('')
|
.val('')
|
||||||
.data('multiple_values', false)
|
.data('multiple_values', false)
|
||||||
.prop('placeholder', '');
|
.prop('placeholder', '');
|
||||||
});
|
});
|
||||||
|
|
||||||
element
|
element
|
||||||
.css('width', '90%')
|
.css('width', '90%')
|
||||||
.css('display', 'inline')
|
.css('display', 'inline')
|
||||||
.parent()
|
.parent()
|
||||||
.append($button);
|
.append($button);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fills the module plugin macros values
|
// Fills the module plugin macros values
|
||||||
var fillPluginMacros = function (moduleMacros) {
|
var fillPluginMacros = function (moduleMacros) {
|
||||||
clearModulePluginMacrosValues();
|
clearModulePluginMacrosValues();
|
||||||
|
|
||||||
if (!(moduleMacros instanceof Array))
|
if (!(moduleMacros instanceof Array))
|
||||||
throw new Error('<?php echo __('Invalid macros array'); ?>');
|
throw new Error('<?php echo __('Invalid macros array'); ?>');
|
||||||
|
|
||||||
$("input.plugin-macro").each(function(index, el) {
|
$("input.plugin-macro").each(function(index, el) {
|
||||||
var id = $(el).prop('id');
|
var id = $(el).prop('id');
|
||||||
|
|
||||||
var values = _.chain(moduleMacros)
|
var values = _.chain(moduleMacros)
|
||||||
.flatten()
|
.flatten()
|
||||||
.where({ macro: id })
|
.where({ macro: id })
|
||||||
.pluck('value')
|
.pluck('value')
|
||||||
.uniq()
|
.uniq()
|
||||||
.value();
|
.value();
|
||||||
|
|
||||||
$(el).prop('disabled', false);
|
$(el).prop('disabled', false);
|
||||||
|
|
||||||
// Remove the [""] element
|
// Remove the [""] element
|
||||||
if (values.length == 1 && _.first(values) === '') {
|
if (values.length == 1 && _.first(values) === '') {
|
||||||
values = [];
|
values = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (values.length == 1) {
|
if (values.length == 1) {
|
||||||
$(el).val(_.first(values));
|
$(el).val(_.first(values));
|
||||||
}
|
}
|
||||||
@ -622,9 +627,9 @@ echo '</form>';
|
|||||||
else {
|
else {
|
||||||
$(el).val('');
|
$(el).val('');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($(el).prop('type') !== 'password' && values.length > 0) {
|
if ($(el).prop('type') !== 'password' && values.length > 0) {
|
||||||
|
|
||||||
$(el).autocomplete("option", {
|
$(el).autocomplete("option", {
|
||||||
disabled: false,
|
disabled: false,
|
||||||
source: values
|
source: values
|
||||||
@ -642,14 +647,14 @@ echo '</form>';
|
|||||||
.css('padding-right', '20px')
|
.css('padding-right', '20px')
|
||||||
.css('text-align', 'left');
|
.css('text-align', 'left');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fills the agents select
|
// Fills the agents select
|
||||||
var fillAgents = function (agents, selected) {
|
var fillAgents = function (agents, selected) {
|
||||||
clearAgentsData();
|
clearAgentsData();
|
||||||
|
|
||||||
if (!(agents instanceof Array))
|
if (!(agents instanceof Array))
|
||||||
throw new Error('<?php echo __('Invalid agents array'); ?>');
|
throw new Error('<?php echo __('Invalid agents array'); ?>');
|
||||||
|
|
||||||
_.each(agents, function (agent, index) {
|
_.each(agents, function (agent, index) {
|
||||||
if (typeof agent.id !== 'undefined' && typeof agent.name !== 'undefined') {
|
if (typeof agent.id !== 'undefined' && typeof agent.name !== 'undefined') {
|
||||||
$('<option>')
|
$('<option>')
|
||||||
@ -658,7 +663,7 @@ echo '</form>';
|
|||||||
.prop('selected', function () {
|
.prop('selected', function () {
|
||||||
if (typeof selected !== 'undefined')
|
if (typeof selected !== 'undefined')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return _.contains(selected, agent.id.toString());
|
return _.contains(selected, agent.id.toString());
|
||||||
})
|
})
|
||||||
.appendTo($agentsSelect);
|
.appendTo($agentsSelect);
|
||||||
@ -669,14 +674,14 @@ echo '</form>';
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fills the modules select
|
// Fills the modules select
|
||||||
var fillModules = function (modules, selected) {
|
var fillModules = function (modules, selected) {
|
||||||
clearModulesData();
|
clearModulesData();
|
||||||
|
|
||||||
if (!(modules instanceof Array))
|
if (!(modules instanceof Array))
|
||||||
throw new Error('<?php echo __('Invalid modules array'); ?>');
|
throw new Error('<?php echo __('Invalid modules array'); ?>');
|
||||||
|
|
||||||
_.each(modules, function (module, index) {
|
_.each(modules, function (module, index) {
|
||||||
if (_.isString(module)) {
|
if (_.isString(module)) {
|
||||||
$('<option>')
|
$('<option>')
|
||||||
@ -685,7 +690,7 @@ echo '</form>';
|
|||||||
.prop('selected', function () {
|
.prop('selected', function () {
|
||||||
if (typeof selected === 'undefined')
|
if (typeof selected === 'undefined')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return _.contains(selected, module);
|
return _.contains(selected, module);
|
||||||
})
|
})
|
||||||
.appendTo($modulesSelect);
|
.appendTo($modulesSelect);
|
||||||
@ -697,7 +702,7 @@ echo '</form>';
|
|||||||
.prop('selected', function () {
|
.prop('selected', function () {
|
||||||
if (typeof selected === 'undefined')
|
if (typeof selected === 'undefined')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return _.contains(selected, module.name);
|
return _.contains(selected, module.name);
|
||||||
})
|
})
|
||||||
.appendTo($modulesSelect);
|
.appendTo($modulesSelect);
|
||||||
@ -707,9 +712,9 @@ echo '</form>';
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var processGet = function (params, callback) {
|
var processGet = function (params, callback) {
|
||||||
return jQuery.post(ajaxPage, params, 'json')
|
return jQuery.post(ajaxPage, params, 'json')
|
||||||
.done(function (data, textStatus, jqXHR) {
|
.done(function (data, textStatus, jqXHR) {
|
||||||
@ -726,34 +731,34 @@ echo '</form>';
|
|||||||
callback(errorThrown);
|
callback(errorThrown);
|
||||||
})
|
})
|
||||||
.always(function (jqXHR, textStatus) {
|
.always(function (jqXHR, textStatus) {
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var getPlugin = function (pluginID, callback) {
|
var getPlugin = function (pluginID, callback) {
|
||||||
var params = {
|
var params = {
|
||||||
page: 'godmode/massive/massive_edit_plugins',
|
page: 'godmode/massive/massive_edit_plugins',
|
||||||
get_plugin: 1,
|
get_plugin: 1,
|
||||||
plugin_id: pluginID
|
plugin_id: pluginID
|
||||||
};
|
};
|
||||||
|
|
||||||
pluginXHR = processGet(params, function (error, data) {
|
pluginXHR = processGet(params, function (error, data) {
|
||||||
callback(error, data);
|
callback(error, data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var getAgents = function (pluginID, callback) {
|
var getAgents = function (pluginID, callback) {
|
||||||
var params = {
|
var params = {
|
||||||
page: 'godmode/massive/massive_edit_plugins',
|
page: 'godmode/massive/massive_edit_plugins',
|
||||||
get_agents: 1,
|
get_agents: 1,
|
||||||
plugin_id: pluginID
|
plugin_id: pluginID
|
||||||
};
|
};
|
||||||
|
|
||||||
agentsXHR = processGet(params, function (error, data) {
|
agentsXHR = processGet(params, function (error, data) {
|
||||||
callback(error, data);
|
callback(error, data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var getModules = function (pluginID, agentIDs, callback) {
|
var getModules = function (pluginID, agentIDs, callback) {
|
||||||
var params = {
|
var params = {
|
||||||
page: 'godmode/massive/massive_edit_plugins',
|
page: 'godmode/massive/massive_edit_plugins',
|
||||||
@ -761,12 +766,12 @@ echo '</form>';
|
|||||||
plugin_id: pluginID,
|
plugin_id: pluginID,
|
||||||
agent_ids: agentIDs
|
agent_ids: agentIDs
|
||||||
};
|
};
|
||||||
|
|
||||||
modulesXHR = processGet(params, function (error, data) {
|
modulesXHR = processGet(params, function (error, data) {
|
||||||
callback(error, data);
|
callback(error, data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var getModulePluginMacros = function (pluginID, agentIDs, moduleNames, callback) {
|
var getModulePluginMacros = function (pluginID, agentIDs, moduleNames, callback) {
|
||||||
var params = {
|
var params = {
|
||||||
page: 'godmode/massive/massive_edit_plugins',
|
page: 'godmode/massive/massive_edit_plugins',
|
||||||
@ -775,17 +780,17 @@ echo '</form>';
|
|||||||
agent_ids: agentIDs,
|
agent_ids: agentIDs,
|
||||||
module_names: moduleNames
|
module_names: moduleNames
|
||||||
};
|
};
|
||||||
|
|
||||||
modulePluginMacrosXHR = processGet(params, function (error, data) {
|
modulePluginMacrosXHR = processGet(params, function (error, data) {
|
||||||
callback(error, data);
|
callback(error, data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract the a module names array from the agents
|
// Extract the a module names array from the agents
|
||||||
var moduleNamesFromAgents = function (agents) {
|
var moduleNamesFromAgents = function (agents) {
|
||||||
if (!(agents instanceof Array))
|
if (!(agents instanceof Array))
|
||||||
throw new Error('<?php echo __('Invalid agents array'); ?>');
|
throw new Error('<?php echo __('Invalid agents array'); ?>');
|
||||||
|
|
||||||
var moduleNames = _.map(agents, function (agent) {
|
var moduleNames = _.map(agents, function (agent) {
|
||||||
return agent['module_names'];
|
return agent['module_names'];
|
||||||
});
|
});
|
||||||
@ -794,28 +799,28 @@ echo '</form>';
|
|||||||
.flatten()
|
.flatten()
|
||||||
.uniq()
|
.uniq()
|
||||||
.value();
|
.value();
|
||||||
|
|
||||||
return moduleNames;
|
return moduleNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
var agentsFilteredWithAgents = function (agents, agentIDs) {
|
var agentsFilteredWithAgents = function (agents, agentIDs) {
|
||||||
if (!(agents instanceof Array))
|
if (!(agents instanceof Array))
|
||||||
throw new Error('<?php echo __('Invalid agents array'); ?>');
|
throw new Error('<?php echo __('Invalid agents array'); ?>');
|
||||||
|
|
||||||
var agentsFiltered = _.filter(agents, function (agent) {
|
var agentsFiltered = _.filter(agents, function (agent) {
|
||||||
return _.contains(agentIDs, agent.id.toString());
|
return _.contains(agentIDs, agent.id.toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
// Hack. Is possible that find returns an object instead of an array
|
// Hack. Is possible that find returns an object instead of an array
|
||||||
// when the only array item is an object. Probably an Underscore.js bug
|
// when the only array item is an object. Probably an Underscore.js bug
|
||||||
if (typeof agentsFiltered !== 'undefined'
|
if (typeof agentsFiltered !== 'undefined'
|
||||||
&& !(agentsFiltered instanceof Array)
|
&& !(agentsFiltered instanceof Array)
|
||||||
&& (agentsFiltered instanceof Object))
|
&& (agentsFiltered instanceof Object))
|
||||||
agentsFiltered = [agentsFiltered];
|
agentsFiltered = [agentsFiltered];
|
||||||
|
|
||||||
return agentsFiltered;
|
return agentsFiltered;
|
||||||
}
|
}
|
||||||
|
|
||||||
var resetController = function () {
|
var resetController = function () {
|
||||||
if (typeof pluginXHR !== 'undefined') {
|
if (typeof pluginXHR !== 'undefined') {
|
||||||
pluginXHR.abort();
|
pluginXHR.abort();
|
||||||
@ -833,54 +838,54 @@ echo '</form>';
|
|||||||
modulePluginMacrosXHR.abort();
|
modulePluginMacrosXHR.abort();
|
||||||
modulePluginMacrosXHR = undefined;
|
modulePluginMacrosXHR = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
allowSubmit(false);
|
allowSubmit(false);
|
||||||
|
|
||||||
agents = [];
|
agents = [];
|
||||||
|
|
||||||
hideSpinner();
|
hideSpinner();
|
||||||
clearPluginData();
|
clearPluginData();
|
||||||
|
|
||||||
$agentModulesRow.hide();
|
$agentModulesRow.hide();
|
||||||
clearAgentsData();
|
clearAgentsData();
|
||||||
clearModulesData();
|
clearModulesData();
|
||||||
}
|
}
|
||||||
|
|
||||||
var errorHandler = function (error) {
|
var errorHandler = function (error) {
|
||||||
hideSpinner();
|
hideSpinner();
|
||||||
console.log("<?php echo __('Error'); ?>: " + error.message);
|
console.log("<?php echo __('Error'); ?>: " + error.message);
|
||||||
// alert("<?php echo __('Error'); ?>: " + err.message);
|
// alert("<?php echo __('Error'); ?>: " + err.message);
|
||||||
|
|
||||||
// Init the plugin id select
|
// Init the plugin id select
|
||||||
$pluginsSelect.val(0).change();
|
$pluginsSelect.val(0).change();
|
||||||
}
|
}
|
||||||
|
|
||||||
$pluginsSelect.change(function (e) {
|
$pluginsSelect.change(function (e) {
|
||||||
allowSubmit(false);
|
allowSubmit(false);
|
||||||
|
|
||||||
// Plugin id
|
// Plugin id
|
||||||
var currentVal = $(this).val();
|
var currentVal = $(this).val();
|
||||||
|
|
||||||
resetController();
|
resetController();
|
||||||
|
|
||||||
if (currentVal == 0)
|
if (currentVal == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
showSpinner();
|
showSpinner();
|
||||||
|
|
||||||
// This asyc functions are executed at the same time
|
// This asyc functions are executed at the same time
|
||||||
getPlugin(currentVal, function (error, data) {
|
getPlugin(currentVal, function (error, data) {
|
||||||
if (error) {
|
if (error) {
|
||||||
errorHandler(error);
|
errorHandler(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin = data;
|
plugin = data;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fillPlugin(plugin);
|
fillPlugin(plugin);
|
||||||
|
|
||||||
// Hide spinner only if the another call has finished
|
// Hide spinner only if the another call has finished
|
||||||
if (typeof agentsXHR === 'undefined'
|
if (typeof agentsXHR === 'undefined'
|
||||||
|| agentsXHR.state() === 'resolved'
|
|| agentsXHR.state() === 'resolved'
|
||||||
@ -893,21 +898,21 @@ echo '</form>';
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// This asyc functions are executed at the same time
|
// This asyc functions are executed at the same time
|
||||||
getAgents(currentVal, function (error, data) {
|
getAgents(currentVal, function (error, data) {
|
||||||
if (error) {
|
if (error) {
|
||||||
errorHandler(error);
|
errorHandler(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This agent variable is global to this script scope
|
// This agent variable is global to this script scope
|
||||||
agents = data;
|
agents = data;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (agents.length > 0) {
|
if (agents.length > 0) {
|
||||||
fillAgents(agents);
|
fillAgents(agents);
|
||||||
|
|
||||||
$agentModulesRow.show();
|
$agentModulesRow.show();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -915,14 +920,14 @@ echo '</form>';
|
|||||||
contents.html = '<?php echo __('There are no modules using this plugin'); ?>';
|
contents.html = '<?php echo __('There are no modules using this plugin'); ?>';
|
||||||
contents.title = '<?php echo __('Massive operations'); ?>';
|
contents.title = '<?php echo __('Massive operations'); ?>';
|
||||||
showMassiveModal(contents);
|
showMassiveModal(contents);
|
||||||
|
|
||||||
// Abort the another call
|
// Abort the another call
|
||||||
if (typeof pluginXHR !== 'undefined') {
|
if (typeof pluginXHR !== 'undefined') {
|
||||||
pluginXHR.abort();
|
pluginXHR.abort();
|
||||||
pluginXHR = undefined;
|
pluginXHR = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide spinner only if the another call has finished
|
// Hide spinner only if the another call has finished
|
||||||
if (typeof pluginXHR === 'undefined'
|
if (typeof pluginXHR === 'undefined'
|
||||||
|| pluginXHR.state() === 'resolved'
|
|| pluginXHR.state() === 'resolved'
|
||||||
@ -940,23 +945,23 @@ echo '</form>';
|
|||||||
errorHandler(err);
|
errorHandler(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}).change(); // Trigger the change
|
}).change(); // Trigger the change
|
||||||
|
|
||||||
$agentsSelect.change(function (e) {
|
$agentsSelect.change(function (e) {
|
||||||
allowSubmit(false);
|
allowSubmit(false);
|
||||||
|
|
||||||
var ids = $(this).val();
|
var ids = $(this).val();
|
||||||
var modulesSelected = $modulesSelect.val();
|
var modulesSelected = $modulesSelect.val();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var agentsFiltered = agentsFilteredWithAgents(agents, ids);
|
var agentsFiltered = agentsFilteredWithAgents(agents, ids);
|
||||||
var modules = moduleNamesFromAgents(agentsFiltered);
|
var modules = moduleNamesFromAgents(agentsFiltered);
|
||||||
|
|
||||||
for (var i = 0; i < modules.length; i++) {
|
for (var i = 0; i < modules.length; i++) {
|
||||||
modules[i] = htmlDecode(modules[i]);
|
modules[i] = htmlDecode(modules[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fillModules(modules, modulesSelected);
|
fillModules(modules, modulesSelected);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@ -964,42 +969,42 @@ echo '</form>';
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$modulesSelect.change(function (e) {
|
$modulesSelect.change(function (e) {
|
||||||
allowSubmit(false);
|
allowSubmit(false);
|
||||||
|
|
||||||
var pluginID = $pluginsSelect.val();
|
var pluginID = $pluginsSelect.val();
|
||||||
var moduleNames = $(this).val();
|
var moduleNames = $(this).val();
|
||||||
var agentIDs = $agentsSelect.val();
|
var agentIDs = $agentsSelect.val();
|
||||||
|
|
||||||
if (_.isNull(moduleNames) || _.isUndefined(moduleNames)) {
|
if (_.isNull(moduleNames) || _.isUndefined(moduleNames)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
showSpinner();
|
showSpinner();
|
||||||
|
|
||||||
clearModulePluginMacrosValues();
|
clearModulePluginMacrosValues();
|
||||||
|
|
||||||
getModulePluginMacros(pluginID, agentIDs, moduleNames, function (error, data) {
|
getModulePluginMacros(pluginID, agentIDs, moduleNames, function (error, data) {
|
||||||
if (error) {
|
if (error) {
|
||||||
errorHandler(error);
|
errorHandler(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var modulePluginMacros = data;
|
var modulePluginMacros = data;
|
||||||
|
|
||||||
if (_.isArray(modulePluginMacros) && modulePluginMacros.length > 0) {
|
if (_.isArray(modulePluginMacros) && modulePluginMacros.length > 0) {
|
||||||
fillPluginMacros(modulePluginMacros);
|
fillPluginMacros(modulePluginMacros);
|
||||||
|
|
||||||
allowSubmit(true);
|
allowSubmit(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new Error('<?php echo __('There was a problem loading the module plugin macros data'); ?>');
|
throw new Error('<?php echo __('There was a problem loading the module plugin macros data'); ?>');
|
||||||
}
|
}
|
||||||
|
|
||||||
hideSpinner();
|
hideSpinner();
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@ -1013,7 +1018,7 @@ echo '</form>';
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$form.submit(function(e) {
|
$form.submit(function(e) {
|
||||||
if (!canSubmit) {
|
if (!canSubmit) {
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
@ -1023,20 +1028,20 @@ echo '</form>';
|
|||||||
$form.find('input.plugin-macro')
|
$form.find('input.plugin-macro')
|
||||||
.filter(function() {
|
.filter(function() {
|
||||||
var val = $(this).val();
|
var val = $(this).val();
|
||||||
|
|
||||||
if ($(this).data("multiple_values") == true
|
if ($(this).data("multiple_values") == true
|
||||||
&& (typeof val === 'undefined'
|
&& (typeof val === 'undefined'
|
||||||
|| val.length == 0))
|
|| val.length == 0))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}).prop('disabled', true);
|
}).prop('disabled', true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -31,7 +31,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access massive alert deletion'
|
'Trying to access massive alert deletion'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -102,11 +102,15 @@ switch ($action) {
|
|||||||
ui_print_result_message($result, __('Successfully enabled'), __('Could not be enabled'));
|
ui_print_result_message($result, __('Successfully enabled'), __('Could not be enabled'));
|
||||||
|
|
||||||
$info = '{"Alert":"'.implode(',', $id_disabled_alerts).'"}';
|
$info = '{"Alert":"'.implode(',', $id_disabled_alerts).'"}';
|
||||||
if ($result) {
|
|
||||||
db_pandora_audit('Massive management', 'Enable alert', false, false, $info);
|
$auditMessage = ((bool) $result === true) ? 'Enable alert' : 'Fail try to enable alert';
|
||||||
} else {
|
db_pandora_audit(
|
||||||
db_pandora_audit('Massive management', 'Fail try to enable alert', false, false, $info);
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
}
|
$auditMessage,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$info
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'disable_alerts':
|
case 'disable_alerts':
|
||||||
@ -120,11 +124,15 @@ switch ($action) {
|
|||||||
ui_print_result_message($result, __('Successfully disabled'), __('Could not be disabled'));
|
ui_print_result_message($result, __('Successfully disabled'), __('Could not be disabled'));
|
||||||
|
|
||||||
$info = '{"Alert":"'.implode(',', $id_enabled_alerts).'"}';
|
$info = '{"Alert":"'.implode(',', $id_enabled_alerts).'"}';
|
||||||
if ($result) {
|
|
||||||
db_pandora_audit('Massive management', 'Disable alert', false, false, $info);
|
$auditMessage = ((bool) $result === true) ? 'Disable alert' : 'Fail try to disable alert';
|
||||||
} else {
|
db_pandora_audit(
|
||||||
db_pandora_audit('Massive management', 'Fail try to Disable alert', false, false, $info);
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
}
|
$auditMessage,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$info
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -33,7 +33,7 @@ global $config;
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access massive operation section'
|
'Trying to access massive operation section'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -31,7 +31,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access massive alert deletion'
|
'Trying to access massive alert deletion'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -103,9 +103,21 @@ switch ($action) {
|
|||||||
|
|
||||||
$info = '{"Alert":"'.implode(',', $id_standby_alerts).'"}';
|
$info = '{"Alert":"'.implode(',', $id_standby_alerts).'"}';
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Massive management', 'Set off standby alerts', false, false, $info);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Set off standby alerts',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$info
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Massive management', 'Fail try to set off standby alerts', false, false, $info);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Fail try to set off standby alerts',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$info
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -121,9 +133,21 @@ switch ($action) {
|
|||||||
|
|
||||||
$info = '{"Alert":"'.implode(',', $id_not_standby_alerts).'"}';
|
$info = '{"Alert":"'.implode(',', $id_not_standby_alerts).'"}';
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Massive management', 'Set on standby alerts', false, false, $info);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Set on standby alerts',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$info
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Massive management', 'Fail try to set on standby alerts', false, false, $info);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MASSIVE_MANAGEMENT,
|
||||||
|
'Fail try to set on standby alerts',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$info
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -32,7 +32,10 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'AR')) {
|
if (! check_acl($config['id_user'], 0, 'AR')) {
|
||||||
// Doesn't have access to this page.
|
// Doesn't have access to this page.
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access Module Library View');
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Module Library View'
|
||||||
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -156,8 +159,8 @@ var more_details = '<?php echo __('More details'); ?>';
|
|||||||
var total_modules_text = '<?php echo __('Total modules'); ?>';
|
var total_modules_text = '<?php echo __('Total modules'); ?>';
|
||||||
var view_web = '<?php echo __('View in Module Library'); ?>';
|
var view_web = '<?php echo __('View in Module Library'); ?>';
|
||||||
var empty_result = '<?php echo __('No module found'); ?>';
|
var empty_result = '<?php echo __('No module found'); ?>';
|
||||||
var error_get_token = '<?php echo __('Problem with authentication. Check your internet connection'); ?>';
|
var error_get_token = '<?php echo __('Problem with authentication. Check your internet connection'); ?>';
|
||||||
var invalid_user = '<?php echo __('Invalid username or password'); ?>';
|
var invalid_user = '<?php echo __('Invalid username or password'); ?>';
|
||||||
var error_main = '<?php echo __('Error loading Module Library'); ?>';
|
var error_main = '<?php echo __('Error loading Module Library'); ?>';
|
||||||
var error_category = '<?php echo __('Error loading category'); ?>';
|
var error_category = '<?php echo __('Error loading category'); ?>';
|
||||||
var error_categories = '<?php echo __('Error loading categories'); ?>';
|
var error_categories = '<?php echo __('Error loading categories'); ?>';
|
||||||
|
@ -25,7 +25,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Network Profile Management'
|
'Trying to access Network Profile Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -20,7 +20,7 @@ enterprise_hook('open_meta_frame');
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access SNMP Group Management'
|
'Trying to access SNMP Group Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -72,11 +72,12 @@ if ($create) {
|
|||||||
'parent' => $parent,
|
'parent' => $parent,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
if ($result) {
|
|
||||||
db_pandora_audit('Module management', "Create component group #$result");
|
$auditMessage = ((bool) $result === true) ? sprintf('Create component group #%s', $result) : 'Fail try to create component group';
|
||||||
} else {
|
db_pandora_audit(
|
||||||
db_pandora_audit('Module management', 'Fail try to create component group');
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
}
|
$auditMessage
|
||||||
|
);
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
$result,
|
$result,
|
||||||
@ -101,11 +102,16 @@ if ($update) {
|
|||||||
],
|
],
|
||||||
['id_sg' => $id]
|
['id_sg' => $id]
|
||||||
);
|
);
|
||||||
if ($result) {
|
|
||||||
db_pandora_audit('Module management', "Update component group #$id");
|
$auditMessage = ((bool) $result === true) ? 'Update component group' : 'Fail try to update component group';
|
||||||
} else {
|
db_pandora_audit(
|
||||||
db_pandora_audit('Module management', "Fail try to update component group #$id");
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
}
|
sprintf(
|
||||||
|
'%s #%s',
|
||||||
|
$auditMessage,
|
||||||
|
$id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
$result,
|
$result,
|
||||||
@ -131,11 +137,15 @@ if ($delete) {
|
|||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result) {
|
$auditMessage = ((bool) $result === true) ? 'Delete component group' : 'Fail try to delete component group';
|
||||||
db_pandora_audit('Module management', "Delete component group #$id");
|
db_pandora_audit(
|
||||||
} else {
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
db_pandora_audit('Module management', "Fail try to delete component group #$id");
|
sprintf(
|
||||||
}
|
'%s #%s',
|
||||||
|
$auditMessage,
|
||||||
|
$id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
$result,
|
$result,
|
||||||
@ -168,17 +178,16 @@ if ($multiple_delete) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$str_ids = implode(',', $ids);
|
$str_ids = implode(',', $ids);
|
||||||
if ($result) {
|
|
||||||
db_pandora_audit(
|
$auditMessage = ((bool) $result === true) ? 'Multiple delete component group' : 'Fail try to delete multiple component group';
|
||||||
'Module management',
|
db_pandora_audit(
|
||||||
"Multiple delete component group: $str_ids"
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
);
|
sprintf(
|
||||||
} else {
|
'%s #%s',
|
||||||
db_pandora_audit(
|
$auditMessage,
|
||||||
'Module management',
|
$str_ids
|
||||||
"Fail try to delete component group: $str_ids"
|
)
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
$result,
|
$result,
|
||||||
|
@ -18,7 +18,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access SNMO Groups Management'
|
'Trying to access SNMO Groups Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -34,7 +34,7 @@ enterprise_hook('open_meta_frame');
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Agent Management'
|
'Trying to access Agent Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
@ -415,7 +415,7 @@ if ($is_management_allowed === true && $create_component) {
|
|||||||
|
|
||||||
if ($id === false || !$id) {
|
if ($id === false || !$id) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Module management',
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
'Fail try to create remote component'
|
'Fail try to create remote component'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -431,7 +431,10 @@ if ($is_management_allowed === true && $create_component) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
db_pandora_audit('Module management', 'Create network component #'.$id);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
|
'Create network component #'.$id
|
||||||
|
);
|
||||||
ui_print_success_message(__('Created successfully'));
|
ui_print_success_message(__('Created successfully'));
|
||||||
$id = 0;
|
$id = 0;
|
||||||
}
|
}
|
||||||
@ -516,7 +519,7 @@ if ($is_management_allowed === true && $update_component) {
|
|||||||
|
|
||||||
if ($result === false || !$result) {
|
if ($result === false || !$result) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Module management',
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
'Fail try to update network component #'.$id
|
'Fail try to update network component #'.$id
|
||||||
);
|
);
|
||||||
ui_print_error_message(__('Could not be updated'));
|
ui_print_error_message(__('Could not be updated'));
|
||||||
@ -524,7 +527,10 @@ if ($is_management_allowed === true && $update_component) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
db_pandora_audit('Module management', 'Update network component #'.$id);
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
|
'Update network component #'.$id
|
||||||
|
);
|
||||||
ui_print_success_message(__('Updated successfully'));
|
ui_print_success_message(__('Updated successfully'));
|
||||||
|
|
||||||
$id = 0;
|
$id = 0;
|
||||||
@ -535,17 +541,11 @@ if ($is_management_allowed === true && $delete_component) {
|
|||||||
|
|
||||||
$result = network_components_delete_network_component($id);
|
$result = network_components_delete_network_component($id);
|
||||||
|
|
||||||
if ($result) {
|
$auditMessage = ((bool) $result === true) ? 'Delete network component' : 'Fail try to delete network component';
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Module management',
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
'Delete network component #'.$id
|
sprintf('%s #%s', $auditMessage, $id)
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
db_pandora_audit(
|
|
||||||
'Module management',
|
|
||||||
'Fail try to delete network component #'.$id
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
$result,
|
$result,
|
||||||
@ -567,17 +567,11 @@ if ($is_management_allowed === true && $multiple_delete) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$str_ids = implode(',', $ids);
|
$str_ids = implode(',', $ids);
|
||||||
if ($result) {
|
$auditMessage = ((bool) $result === true) ? 'Multiple delete network component' : 'Fail try to delete multiple network component';
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Module management',
|
AUDIT_LOG_MODULE_MANAGEMENT,
|
||||||
'Multiple delete network component:'.$str_ids
|
sprintf('%s :%s', $auditMessage, $str_ids)
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
db_pandora_audit(
|
|
||||||
'Module management',
|
|
||||||
'Fail try to delete network component:'.$str_ids
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
$result,
|
$result,
|
||||||
|
@ -33,7 +33,7 @@ check_login();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Agent Management'
|
'Trying to access Agent Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
@ -18,7 +18,7 @@ include_javascript_d3();
|
|||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
'Trying to access Agent Management'
|
'Trying to access Agent Management'
|
||||||
);
|
);
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user