Merge remote-tracking branch 'origin/develop' into ent-7749-mover-operaciones-masivas-sobre-servicios-a-wizard-de-servicios-en-nodo
Conflicts: pandora_console/godmode/menu.php
This commit is contained in:
commit
da0998e7c7
|
@ -1,62 +0,0 @@
|
|||
# Dockerfile for the Pandora FMS image.
|
||||
FROM debian:jessie
|
||||
|
||||
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
|
||||
RUN groupadd -r mysql && useradd -r -g mysql mysql
|
||||
|
||||
RUN mkdir /docker-entrypoint-initdb.d
|
||||
|
||||
# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db:
|
||||
# File::Basename
|
||||
# File::Copy
|
||||
# Sys::Hostname
|
||||
# Data::Dumper
|
||||
RUN apt-get update && apt-get install -y perl pwgen git openssh-client --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# gpg: key 5072E1F5: public key "MySQL Release Engineering <mysql-build@oss.oracle.com>" imported
|
||||
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
|
||||
|
||||
ENV MYSQL_MAJOR 5.6
|
||||
ENV MYSQL_VERSION 5.6.29-1debian8
|
||||
|
||||
RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list
|
||||
|
||||
# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql)
|
||||
# also, we set debconf keys to make APT a little quieter
|
||||
RUN { \
|
||||
echo mysql-community-server mysql-community-server/data-dir select ''; \
|
||||
echo mysql-community-server mysql-community-server/root-pass password ''; \
|
||||
echo mysql-community-server mysql-community-server/re-root-pass password ''; \
|
||||
echo mysql-community-server mysql-community-server/remove-test-db select false; \
|
||||
} | debconf-set-selections \
|
||||
&& apt-get update && apt-get install -y mysql-server="${MYSQL_VERSION}" && rm -rf /var/lib/apt/lists/* \
|
||||
&& rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql
|
||||
|
||||
# comment out a few problematic configuration values
|
||||
# don't reverse lookup hostnames, they are usually another container
|
||||
RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/mysql/my.cnf \
|
||||
&& echo 'skip-host-cache\nskip-name-resolve' | awk '{ print } $1 == "[mysqld]" && c == 0 { c = 1; system("cat") }' /etc/mysql/my.cnf > /tmp/my.cnf \
|
||||
&& mv /tmp/my.cnf /etc/mysql/my.cnf
|
||||
|
||||
VOLUME /var/lib/mysql
|
||||
|
||||
COPY docker-entrypoint.sh /entrypoint.sh
|
||||
COPY pandora.cnf /etc/mysql/conf.d
|
||||
COPY pandora_initdb.sh /docker-entrypoint-initdb.d
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
# Make ssh dir
|
||||
RUN mkdir /root/.ssh/
|
||||
# Copy over private key, and set permissions
|
||||
RUN echo "Host github.com\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config
|
||||
RUN chown -R root:root /root/.ssh
|
||||
|
||||
|
||||
#Clone the repo
|
||||
RUN git config --global http.sslVerify false
|
||||
RUN git clone -b develop --single-branch https://github.com/pandorafms/pandorafms.git /tmp/pandorafms
|
||||
#RUN mv -f /tmp/pandorafms/pandora_console/pandoradb.sql /docker-entrypoint-initdb.d
|
||||
#RUN mv -f /tmp/pandorafms/pandora_console/pandoradb_data.sql /docker-entrypoint-initdb.d
|
||||
|
||||
EXPOSE 3306
|
||||
CMD ["mysqld"]
|
|
@ -72,7 +72,7 @@ check_pre_pandora () {
|
|||
export MYSQL_PWD=$DBPASS
|
||||
|
||||
echo -en "${cyan}Checking environment ... ${reset}"
|
||||
rpm -qa | grep pandora &>> /dev/null && local fail=true
|
||||
rpm -qa | grep 'pandorafms_' &>> /dev/null && local fail=true
|
||||
[ -d "$PANDORA_CONSOLE" ] && 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
|
||||
|
|
|
@ -76,7 +76,7 @@ check_pre_pandora () {
|
|||
export MYSQL_PWD=$DBPASS
|
||||
|
||||
echo -en "${cyan}Checking environment ... ${reset}"
|
||||
rpm -qa | grep pandora &>> /dev/null && local fail=true
|
||||
rpm -qa | grep 'pandorafms_' &>> /dev/null && local fail=true
|
||||
[ -d "$PANDORA_CONSOLE" ] && 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
|
||||
|
@ -350,8 +350,8 @@ vmware_dependencies=" \
|
|||
perl-Crypt-Random-Seed \
|
||||
perl-Math-Random-ISAAC \
|
||||
perl-JSON \
|
||||
perl-Crypt-SSLeay \
|
||||
http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm \
|
||||
http://mirror.ghettoforge.org/distributions/gf/el/8/gf/x86_64/perl-Crypt-SSLeay-0.73_07-1.gf.el8.x86_64.rpm \
|
||||
http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm"
|
||||
execute_cmd "dnf install -y $vmware_dependencies" "Installing SDK VMware perl dependencies"
|
||||
|
||||
|
|
|
@ -1,113 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
# if command starts with an option, prepend mysqld
|
||||
if [ "${1:0:1}" = '-' ]; then
|
||||
set -- mysqld "$@"
|
||||
fi
|
||||
|
||||
if [ "$1" = 'mysqld' ]; then
|
||||
# Get config
|
||||
DATADIR="$("$@" --verbose --help --log-bin-index=`mktemp -u` 2>/dev/null | awk '$1 == "datadir" { print $2; exit }')"
|
||||
|
||||
if [ ! -d "$DATADIR/mysql" ]; then
|
||||
if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then
|
||||
echo >&2 'error: database is uninitialized and password option is not specified '
|
||||
echo >&2 ' You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$DATADIR"
|
||||
chown -R mysql:mysql "$DATADIR"
|
||||
|
||||
echo 'Initializing database'
|
||||
mysql_install_db --user=mysql --datadir="$DATADIR" --rpm --keep-my-cnf
|
||||
echo 'Database initialized'
|
||||
|
||||
"$@" --skip-networking &
|
||||
pid="$!"
|
||||
|
||||
mysql=( mysql --protocol=socket -uroot )
|
||||
|
||||
for i in {30..0}; do
|
||||
if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then
|
||||
break
|
||||
fi
|
||||
echo 'MySQL init process in progress...'
|
||||
sleep 1
|
||||
done
|
||||
if [ "$i" = 0 ]; then
|
||||
echo >&2 'MySQL init process failed.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then
|
||||
# sed is for https://bugs.mysql.com/bug.php?id=20545
|
||||
mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql
|
||||
fi
|
||||
|
||||
if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then
|
||||
MYSQL_ROOT_PASSWORD="$(pwgen -1 32)"
|
||||
echo "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD"
|
||||
fi
|
||||
"${mysql[@]}" <<-EOSQL
|
||||
-- What's done in this file shouldn't be replicated
|
||||
-- or products like mysql-fabric won't work
|
||||
SET @@SESSION.SQL_LOG_BIN=0;
|
||||
|
||||
DELETE FROM mysql.user ;
|
||||
CREATE USER 'root'@'%' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ;
|
||||
GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION ;
|
||||
DROP DATABASE IF EXISTS test ;
|
||||
FLUSH PRIVILEGES ;
|
||||
EOSQL
|
||||
|
||||
if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then
|
||||
mysql+=( -p"${MYSQL_ROOT_PASSWORD}" )
|
||||
fi
|
||||
|
||||
if [ "$MYSQL_DATABASE" ]; then
|
||||
echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" | "${mysql[@]}"
|
||||
mysql+=( "$MYSQL_DATABASE" )
|
||||
fi
|
||||
|
||||
if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then
|
||||
echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" | "${mysql[@]}"
|
||||
|
||||
if [ "$MYSQL_DATABASE" ]; then
|
||||
echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" | "${mysql[@]}"
|
||||
fi
|
||||
|
||||
echo 'FLUSH PRIVILEGES ;' | "${mysql[@]}"
|
||||
fi
|
||||
|
||||
echo
|
||||
for f in /docker-entrypoint-initdb.d/*; do
|
||||
case "$f" in
|
||||
*.sh) echo "$0: running $f"; . "$f" ;;
|
||||
*.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;;
|
||||
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;;
|
||||
*) echo "$0: ignoring $f" ;;
|
||||
esac
|
||||
echo
|
||||
done
|
||||
|
||||
if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then
|
||||
"${mysql[@]}" <<-EOSQL
|
||||
ALTER USER 'root'@'%' PASSWORD EXPIRE;
|
||||
EOSQL
|
||||
fi
|
||||
if ! kill -s TERM "$pid" || ! wait "$pid"; then
|
||||
echo >&2 'MySQL init process failed.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo 'MySQL init process done. Ready for start up.'
|
||||
echo
|
||||
fi
|
||||
|
||||
chown -R mysql:mysql "$DATADIR"
|
||||
fi
|
||||
|
||||
exec "$@"
|
|
@ -1,57 +0,0 @@
|
|||
FROM pandorafms/pandorafms-base:centos7
|
||||
|
||||
# Build variables.
|
||||
ARG BRANCH=develop
|
||||
ARG DB_PASS=pandora
|
||||
|
||||
# Clone the Pandora FMS repo.
|
||||
RUN git clone --depth 1 -b "$BRANCH" https://github.com/pandorafms/pandorafms.git /tmp/pandorafms || \
|
||||
git clone --depth 1 -b develop https://github.com/pandorafms/pandorafms.git /tmp/pandorafms
|
||||
|
||||
# Install the Pandora FMS Server.
|
||||
RUN cd /tmp/pandorafms/pandora_server && \
|
||||
yes | ./pandora_server_installer --install && \
|
||||
sed -i "s/^dbuser.*/dbuser root/" /etc/pandora/pandora_server.conf && \
|
||||
sed -i "s/^dbpass.*/dbpass $DB_PASS/" /etc/pandora/pandora_server.conf
|
||||
|
||||
# Install the Pandora FMS Agent.
|
||||
RUN cd /tmp/pandorafms/pandora_agents/unix && \
|
||||
./pandora_agent_installer --install
|
||||
|
||||
# Set the server's name in Apache's configuration file to avoid warnings.
|
||||
RUN sed -i "s/#ServerName.*/ServerName localhost:80/" /etc/httpd/conf/httpd.conf
|
||||
|
||||
# Install the Pandora FMS Console.
|
||||
RUN rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql && \
|
||||
mkdir -p /var/log/mysql/ && chown mysql. /var/log/mysql && \
|
||||
chown mysql. -R /var/lib/mysql && \
|
||||
sudo -u mysql mysqld --initialize --explicit_defaults_for_timestamp && \
|
||||
sudo -u mysql mysqld --daemonize & \
|
||||
sleep 50 && \
|
||||
mysql_default_pass=$(cat /var/log/mysqld.log | grep "temporary password" | awk '{print $NF}') && \
|
||||
mysqladmin -u root -p"$mysql_default_pass" --user=root password 'pandora' && \
|
||||
httpd -k start && \
|
||||
cp -r /tmp/pandorafms/pandora_console /var/www/html && \
|
||||
chown -R apache.apache /var/www/html/pandora_console/ && \
|
||||
python /tmp/pandorafms/tests/install_console.py
|
||||
|
||||
# Redirect HTTP requests to / to the Pandora FMS Console.
|
||||
RUN echo '<meta http-equiv="refresh" content="0;url=/pandora_console">' > /var/www/html/index.html
|
||||
|
||||
# Create the entrypoint script.
|
||||
RUN echo -e '#/bin/bash\n \
|
||||
sudo -u mysql mysqld --daemonize &&\n \
|
||||
httpd -k start &&\n \
|
||||
/usr/sbin/crond &&\n \
|
||||
/etc/init.d/pandora_agent_daemon start && \
|
||||
/etc/init.d/pandora_server start && \
|
||||
tail -f /var/log/pandora/pandora_server.log' \
|
||||
>> /entrypoint.sh && \
|
||||
chmod +x /entrypoint.sh
|
||||
|
||||
# Clean-up.
|
||||
RUN rm -rf /tmp/pandorafms
|
||||
RUN yum clean all
|
||||
|
||||
EXPOSE 80 3306 41121
|
||||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash
|
||||
docker build --rm=true --pull --no-cache --build-arg BRANCH="develop" --build-arg DB_PASS="pandora" -t pandorafms/pandorafms:7 . && \
|
||||
[ "$QA_ENV" == "" ] && \
|
||||
docker push pandorafms/pandorafms:7
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763, AIX version
|
||||
# Version 7.0NG.764, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763, FreeBSD Version
|
||||
# Version 7.0NG.764, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763, HP-UX Version
|
||||
# Version 7.0NG.764, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763, GNU/Linux
|
||||
# Version 7.0NG.764, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763, GNU/Linux
|
||||
# Version 7.0NG.764, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763, Solaris Version
|
||||
# Version 7.0NG.764, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.763
|
||||
# Version 7.0NG.764
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
# Foundation; either version 2 of the Licence or any later version
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.763, AIX version
|
||||
# Version 7.0NG.764, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.763
|
||||
# Version 7.0NG.764
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.763, HPUX Version
|
||||
# Version 7.0NG.764, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763
|
||||
# Version 7.0NG.764
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763
|
||||
# Version 7.0NG.764
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763
|
||||
# Version 7.0NG.764
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.763, Solaris version
|
||||
# Version 7.0NG.764, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763, AIX version
|
||||
# Version 7.0NG.764, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.763-220727
|
||||
Version: 7.0NG.764-220906
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.763-220727"
|
||||
pandora_version="7.0NG.764-220906"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -31,7 +31,7 @@ fi
|
|||
if [ "$#" -ge 2 ]; then
|
||||
VERSION="$2"
|
||||
else
|
||||
VERSION="7.0NG.763"
|
||||
VERSION="7.0NG.764"
|
||||
fi
|
||||
|
||||
# Path for the generated DMG file
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
<choice id="com.pandorafms.pandorafms_src" visible="false">
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src"/>
|
||||
</choice>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.763" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.764" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
|
||||
</choice>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.763" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.764" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<!-- <installation-check script="check()" />
|
||||
<script>
|
||||
<![CDATA[
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
|
||||
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
|
||||
|
||||
<key>CFBundleVersion</key> <string>7.0NG.763</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.763 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.763</string>
|
||||
<key>CFBundleVersion</key> <string>7.0NG.764</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.764 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.764</string>
|
||||
|
||||
<key>NSPrincipalClass</key><string>NSApplication</string>
|
||||
<key>NSMainNibFile</key><string>MainMenu</string>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763, GNU/Linux
|
||||
# Version 7.0NG.764, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763, FreeBSD Version
|
||||
# Version 7.0NG.764, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763, HP-UX Version
|
||||
# Version 7.0NG.764, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763, GNU/Linux
|
||||
# Version 7.0NG.764, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763, GNU/Linux
|
||||
# Version 7.0NG.764, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763, NetBSD Version
|
||||
# Version 7.0NG.764, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.763, Solaris Version
|
||||
# Version 7.0NG.764, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1014,8 +1014,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.763';
|
||||
use constant AGENT_BUILD => '220727';
|
||||
use constant AGENT_VERSION => '7.0NG.764';
|
||||
use constant AGENT_BUILD => '220906';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.763
|
||||
%define release 220727
|
||||
%define version 7.0NG.764
|
||||
%define release 220906
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.763
|
||||
%define release 220727
|
||||
%define version 7.0NG.764
|
||||
%define release 220906
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.763"
|
||||
PI_BUILD="220727"
|
||||
PI_VERSION="7.0NG.764"
|
||||
PI_BUILD="220906"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -7,4 +7,7 @@
|
|||
compress
|
||||
notifempty
|
||||
copytruncate
|
||||
postrotate
|
||||
/bin/systemctl restart pandora_agent_daemon
|
||||
endscript
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.763
|
||||
# Version 7.0NG.764
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
# Foundation; either version 2 of the Licence or any later version
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.763}
|
||||
{Pandora FMS Windows Agent v7.0NG.764}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{220727}
|
||||
{220906}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.763 Build 220727")
|
||||
#define PANDORA_VERSION ("7.0NG.764 Build 220906")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.763(Build 220727))"
|
||||
VALUE "ProductVersion", "(7.0NG.764(Build 220906))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
FROM mysql:5.5
|
||||
MAINTAINER Pandora FMS Team <info@pandorafms.com>
|
||||
|
||||
WORKDIR /pandorafms/pandora_console
|
||||
|
||||
ADD pandoradb.sql /docker-entrypoint-initdb.d
|
||||
ADD pandoradb_data.sql /docker-entrypoint-initdb.d
|
||||
RUN chown mysql /docker-entrypoint-initdb.d
|
||||
|
||||
ENV MYSQL_DATABASE=pandora
|
||||
|
||||
RUN echo " \n\
|
||||
sed -i \"1iUSE \$MYSQL_DATABASE\" /docker-entrypoint-initdb.d/pandoradb.sql \n\
|
||||
sed -i \"1iUSE \$MYSQL_DATABASE\" /docker-entrypoint-initdb.d/pandoradb_data.sql \n\
|
||||
" >> /docker-entrypoint-initdb.d/create_pandoradb.sh
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.763-220727
|
||||
Version: 7.0NG.764-220906
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.763-220727"
|
||||
pandora_version="7.0NG.764-220906"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
FROM centos:centos6
|
||||
MAINTAINER Pandora FMS Team <info@pandorafms.com>
|
||||
|
||||
RUN { \
|
||||
echo '[EPEL]'; \
|
||||
echo 'name = CentOS Epel'; \
|
||||
echo 'baseurl = http://dl.fedoraproject.org/pub/epel/6/x86_64'; \
|
||||
echo 'enabled=1'; \
|
||||
echo 'gpgcheck=0'; \
|
||||
} > /etc/yum.repos.d/extra_repos.repo
|
||||
|
||||
RUN { \
|
||||
echo '[artica_pandorafms]'; \
|
||||
echo 'name=CentOS6 - PandoraFMS official repo'; \
|
||||
echo 'baseurl=http://artica.es/centos6'; \
|
||||
echo 'gpgcheck=0'; \
|
||||
echo 'enabled=1'; \
|
||||
} > /etc/yum.repos.d/pandorafms.repo
|
||||
|
||||
RUN yum -y update; yum clean all;
|
||||
RUN yum install -y \
|
||||
git \
|
||||
httpd \
|
||||
cronie \
|
||||
ntp \
|
||||
openldap \
|
||||
nfdump \
|
||||
wget \
|
||||
curl \
|
||||
openldap \
|
||||
plymouth \
|
||||
xterm \
|
||||
php \
|
||||
php-gd \
|
||||
graphviz \
|
||||
php-mysql \
|
||||
php-pear-DB \
|
||||
php-pear \
|
||||
php-pdo \
|
||||
php-mbstring \
|
||||
php-ldap \
|
||||
php-snmp \
|
||||
php-ldap \
|
||||
php-common \
|
||||
php-zip \
|
||||
nmap \
|
||||
net-snmp-utils \
|
||||
mod_ssl \
|
||||
xprobe2
|
||||
|
||||
#Clone the repo
|
||||
RUN git clone -b develop https://github.com/pandorafms/pandorafms.git /tmp/pandorafms
|
||||
|
||||
#Exposing ports for: HTTP, SNMP Traps, Tentacle protocol
|
||||
EXPOSE 80 162/udp 443 41121
|
||||
|
||||
# Simple startup script to avoid some issues observed with container restart
|
||||
ADD docker_entrypoint.sh /entrypoint.sh
|
||||
RUN chmod -v +x /entrypoint.sh
|
||||
|
||||
CMD ["/entrypoint.sh"]
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
if [ -n "$MYSQL_PORT_3306_TCP" ]; then
|
||||
if [ -z "$PANDORA_DB_HOST" ]; then
|
||||
PANDORA_DB_HOST='mysql'
|
||||
else
|
||||
echo >&2 'warning: both PANDORA_DB_HOST and MYSQL_PORT_3306_TCP found'
|
||||
echo >&2 " Connecting to PANDORA_DB_HOST ($PANDORA_DB_HOST)"
|
||||
echo >&2 ' instead of the linked mysql container'
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$PANDORA_DB_HOST" ]; then
|
||||
echo >&2 'error: missing PANDORA_DB_HOST and MYSQL_PORT_3306_TCP environment variables'
|
||||
echo >&2 ' Did you forget to --link some_mysql_container:mysql or set an external db'
|
||||
echo >&2 ' with -e PANDORA_DB_HOST=hostname:port?'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if we're linked to MySQL and thus have credentials already, let's use them
|
||||
: ${PANDORA_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}
|
||||
if [ "$PANDORA_DB_USER" = 'root' ]; then
|
||||
: ${PANDORA_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD}
|
||||
fi
|
||||
: ${PANDORA_DB_PASSWORD:=$MYSQL_ENV_MYSQL_PASSWORD}
|
||||
if [ -z "$PANDORA_DB_NAME" ]; then
|
||||
: ${PANDORA_DB_NAME:=${MYSQL_ENV_MYSQL_DATABASE:-pandora}}
|
||||
fi
|
||||
|
||||
if [ -z "$PANDORA_DB_PASSWORD" ]; then
|
||||
echo >&2 'error: missing required PANDORA_DB_PASSWORD environment variable'
|
||||
echo >&2 ' Did you forget to -e PANDORA_DB_PASSWORD=... ?'
|
||||
echo >&2
|
||||
echo >&2 ' (Also of interest might be PANDORA_DB_USER and PANDORA_DB_NAME.)'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mv -f /tmp/pandorafms/pandora_console /var/www/html
|
||||
cd /var/www/html/pandora_console/include
|
||||
cat > config.php <<- 'EOF'
|
||||
<?php
|
||||
$config["dbtype"] = "mysql";
|
||||
$config["homedir"]="/var/www/html/pandora_console"; // Config homedir
|
||||
$config["homeurl"]="/pandora_console"; // Base URL
|
||||
$config["homeurl_static"]="/pandora_console"; // Don't delete
|
||||
error_reporting(E_ALL);
|
||||
$ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
|
||||
EOF
|
||||
|
||||
echo "\$config[\"dbname\"]=\"$PANDORA_DB_NAME\";" >> config.php
|
||||
echo "\$config[\"dbuser\"]=\"$PANDORA_DB_USER\";" >> config.php
|
||||
echo "\$config[\"dbpass\"]=\"$PANDORA_DB_PASSWORD\";" >> config.php
|
||||
echo "\$config[\"dbhost\"]=\"$PANDORA_DB_HOST\";" >> config.php
|
||||
echo "include (\$ownDir . \"config_process.php\");" >> config.php
|
||||
echo "?>" >> config.php
|
||||
|
||||
echo "Granting apache permissions to the console directory"
|
||||
chown -R apache:apache /var/www/html/pandora_console
|
||||
chmod 600 /var/www/html/pandora_console/include/config.php
|
||||
|
||||
# Customize php.iniA
|
||||
echo "Configuring Pandora FMS elements and depending services"
|
||||
sed "s/.*error_reporting =.*/error_reporting = E_ALL \& \~E_DEPRECATED \& \~E_NOTICE \& \~E_USER_WARNING/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
|
||||
sed "s/.*max_execution_time =.*/max_execution_time = 0/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
|
||||
sed "s/.*max_input_time =.*/max_input_time = -1/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
|
||||
sed "s/.*upload_max_filesize =.*/upload_max_filesize = 800M/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
|
||||
sed "s/.*memory_limit =.*/memory_limit = 800M/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
|
||||
sed "s/.*post_max_size =.*/post_max_size = 100M/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
|
||||
|
||||
cd /var/www/html/pandora_console && mv -f install.php install.php.done
|
||||
|
||||
#Create the pandora user
|
||||
/usr/sbin/useradd -d /home/pandora -s /bin/false -M -g 0 pandora
|
||||
|
||||
#Rock n' roll!
|
||||
/etc/init.d/crond start &
|
||||
/etc/init.d/ntpd start &
|
||||
|
||||
rm -rf /run/httpd/*
|
||||
exec /usr/sbin/apachectl -D FOREGROUND
|
|
@ -43,20 +43,11 @@ function dbmanager_query($sql, &$error, $dbconnection)
|
|||
$error = mysqli_error($dbconnection);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$result = mysql_query($sql, $dbconnection);
|
||||
if ($result === false) {
|
||||
$backtrace = debug_backtrace();
|
||||
$error = mysql_error();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($result === true) {
|
||||
if ($config['mysqli']) {
|
||||
return mysqli_affected_rows($dbconnection);
|
||||
} else {
|
||||
return mysql_affected_rows();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,23 +55,17 @@ function dbmanager_query($sql, &$error, $dbconnection)
|
|||
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
|
||||
array_push($retval, $row);
|
||||
}
|
||||
} else {
|
||||
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
||||
array_push($retval, $row);
|
||||
}
|
||||
}
|
||||
|
||||
if ($config['mysqli']) {
|
||||
mysqli_free_result($result);
|
||||
} else {
|
||||
mysql_free_result($result);
|
||||
}
|
||||
|
||||
if (! empty($retval)) {
|
||||
return $retval;
|
||||
}
|
||||
|
||||
// Return false, check with === or !==
|
||||
// Return false, check with === or !== .
|
||||
return 'Empty';
|
||||
}
|
||||
|
||||
|
@ -171,20 +156,6 @@ function dbmgr_extension_main()
|
|||
|
||||
$data[1][0] = "Some samples of usage: <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>";
|
||||
|
||||
\enterprise_include_once('include/functions_metaconsole.php');
|
||||
$servers = \metaconsole_get_servers();
|
||||
if (is_array($servers) === true) {
|
||||
$servers = array_reduce(
|
||||
$servers,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['id']] = $item['server_name'];
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
} else {
|
||||
$servers = [];
|
||||
}
|
||||
|
||||
$data[2][0] = html_print_textarea(
|
||||
'sql',
|
||||
5,
|
||||
|
@ -195,6 +166,21 @@ function dbmgr_extension_main()
|
|||
);
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
// Get the servers.
|
||||
\enterprise_include_once('include/functions_metaconsole.php');
|
||||
$servers = \metaconsole_get_servers();
|
||||
if (is_array($servers) === true) {
|
||||
$servers = array_reduce(
|
||||
$servers,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['id']] = $item['server_name'];
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
} else {
|
||||
$servers = [];
|
||||
}
|
||||
|
||||
$data[3][2] = html_print_input(
|
||||
[
|
||||
'name' => 'node_id',
|
||||
|
@ -223,7 +209,7 @@ function dbmgr_extension_main()
|
|||
html_print_table($table);
|
||||
echo '</form>';
|
||||
|
||||
// Processing SQL Code
|
||||
// Processing SQL Code.
|
||||
if ($sql == '') {
|
||||
return;
|
||||
}
|
||||
|
@ -271,7 +257,7 @@ function dbmgr_extension_main()
|
|||
return;
|
||||
}
|
||||
|
||||
if (! is_array($result)) {
|
||||
if (is_array($result) === false) {
|
||||
echo '<strong>Output: <strong>'.$result;
|
||||
|
||||
db_pandora_audit(
|
||||
|
@ -315,11 +301,10 @@ if (is_metaconsole() === true) {
|
|||
);
|
||||
|
||||
extensions_add_meta_function('dbmgr_extension_main');
|
||||
} else {
|
||||
}
|
||||
|
||||
// This adds a option in the operation menu
|
||||
// This adds a option in the operation menu.
|
||||
extensions_add_godmode_menu_option(__('DB interface'), 'PM', 'gextensions', 'dbmanager/icon.png', 'v1r1', 'gdbman');
|
||||
|
||||
// This sets the function to be called when the extension is selected in the operation menu
|
||||
// This sets the function to be called when the extension is selected in the operation menu.
|
||||
extensions_add_godmode_function('dbmgr_extension_main');
|
||||
|
|
|
@ -38,6 +38,12 @@ ALTER TABLE `tautoconfig` ADD COLUMN `executed` TINYINT UNSIGNED NOT NULL DEFAUL
|
|||
|
||||
ALTER TABLE `tusuario` DROP COLUMN `metaconsole_assigned_server`;
|
||||
|
||||
ALTER TABLE `tagente` ADD COLUMN `fixed_ip` TINYINT UNSIGNED NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `tmetaconsole_agent` ADD COLUMN `fixed_ip` TINYINT UNSIGNED NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `tipam_network` DROP FOREIGN KEY `tipam_network_ibfk_1`;
|
||||
ALTER TABLE `tipam_network` MODIFY COLUMN `id_recon_task` INT UNSIGNED DEFAULT 0;
|
||||
ALTER TABLE `tipam_network` ADD CONSTRAINT `tipam_network_ibfk_1` FOREIGN KEY (`id_recon_task`) REFERENCES trecon_task(`id_rt`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `tevent_filter` ADD COLUMN `search_secondary_groups` INT NOT NULL DEFAULT 0;
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tplanned_downtime` ADD COLUMN `cron_interval_from` VARCHAR(100) DEFAULT '';
|
||||
ALTER TABLE `tplanned_downtime` ADD COLUMN `cron_interval_to` VARCHAR(100) DEFAULT '';
|
||||
|
||||
SET @id_config := (SELECT id_config FROM tconfig WHERE `token` = 'metaconsole_node_id' AND `value` IS NOT NULL ORDER BY id_config DESC LIMIT 1);
|
||||
DELETE FROM tconfig WHERE `token` = 'metaconsole_node_id' AND (id_config < @id_config OR `value` IS NULL);
|
||||
|
||||
COMMIT;
|
|
@ -436,9 +436,22 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||
);
|
||||
$header_logout .= '</a></div>';
|
||||
|
||||
echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div>
|
||||
if (is_reporting_console_node() === true) {
|
||||
echo '<div class="header_left">';
|
||||
echo '<span class="header_title">';
|
||||
echo $config['custom_title_header'];
|
||||
echo '</span>';
|
||||
echo '<span class="header_subtitle">';
|
||||
echo $config['custom_subtitle_header'];
|
||||
echo '</span>';
|
||||
echo '</div>';
|
||||
echo '<div class="header_center"></div>';
|
||||
echo '<div class="header_right">'.$header_support, $header_docu, $header_user, $header_logout.'</div>';
|
||||
} else {
|
||||
echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div>
|
||||
<div class="header_center">'.$header_searchbar.'</div>
|
||||
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $servers_list, $header_feedback, $header_support, $header_docu, $header_user, $header_logout.'</div>';
|
||||
}
|
||||
?>
|
||||
</div> <!-- Closes #table_header_inner -->
|
||||
</div> <!-- Closes #table_header -->
|
||||
|
|
|
@ -137,7 +137,16 @@ $table->data[] = $tdata;
|
|||
|
||||
// Modules by status.
|
||||
$tdata = [];
|
||||
$tdata[0] = reporting_get_stats_modules_status($data, 180, 100);
|
||||
|
||||
$data_agents = [
|
||||
__('Critical') => $data['monitor_critical'],
|
||||
__('Warning') => $data['monitor_warning'],
|
||||
__('Normal') => $data['monitor_ok'],
|
||||
__('Unknown') => $data['monitor_unknown'],
|
||||
__('Not init') => $data['monitor_not_init'],
|
||||
];
|
||||
|
||||
$tdata[0] = reporting_get_stats_modules_status($data, 180, 100, false, $data_agents);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
|
||||
|
|
|
@ -58,6 +58,10 @@ if (isset($config['autohidden_menu']) === true && (bool) $config['autohidden_men
|
|||
|
||||
// Start of full lateral menu.
|
||||
echo sprintf('<div id="menu_full" class="menu_full_%s">', $menuTypeClass);
|
||||
$url_logo = ui_get_full_url('index.php');
|
||||
if (is_reporting_console_node() === true) {
|
||||
$url_logo = 'index.php?logged=1&sec=discovery&sec2=godmode/servers/discovery&wiz=tasklist';
|
||||
}
|
||||
|
||||
// Header logo.
|
||||
html_print_div(
|
||||
|
@ -65,7 +69,7 @@ html_print_div(
|
|||
'class' => 'logo_green',
|
||||
'content' => html_print_anchor(
|
||||
[
|
||||
'href' => ui_get_full_url('index.php'),
|
||||
'href' => $url_logo,
|
||||
'content' => html_print_header_logo_image(
|
||||
$menuCollapsed,
|
||||
true
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
/**
|
||||
* Static page to lock access to console but console reporting
|
||||
*
|
||||
* @category Reporting
|
||||
* @package Pandora FMS
|
||||
* @subpackage Applications
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
// Begin.
|
||||
echo ui_require_css_file('maintenance', 'include/styles/', true);
|
||||
|
||||
$data = [];
|
||||
$data['id_node'] = $config['metaconsole_node_id'];
|
||||
$data['check_ver'] = $config['current_package'];
|
||||
$data['check_mr'] = $config['MR'];
|
||||
$data['collection_max_size'] = $config['collection_max_size'];
|
||||
$data['check_post_max_size'] = ini_get('post_max_size');
|
||||
$data['check_upload_max_filesize'] = ini_get('upload_max_filesize');
|
||||
$data['check_memory_limit'] = ini_get('memory_limit');
|
||||
$data['check_php_version'] = phpversion();
|
||||
|
||||
?>
|
||||
<html>
|
||||
<body class="responsive-height">
|
||||
<div class="responsive center padding-6">
|
||||
<p><?php echo __('Console only reporting node'); ?></p>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
html_print_image(
|
||||
'images/maintenance.png',
|
||||
false,
|
||||
[
|
||||
'class' => 'responsive',
|
||||
'width' => 800,
|
||||
]
|
||||
);
|
||||
?>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<p><?php echo __('Info'); ?></p>
|
||||
<ul class="container-list">
|
||||
<li>
|
||||
<span class=title>
|
||||
<?php echo __('Version'); ?>:
|
||||
</span>
|
||||
<span>
|
||||
<?php echo $config['current_package']; ?>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class=title>
|
||||
<?php echo __('Mr'); ?>:
|
||||
</span>
|
||||
<span>
|
||||
<?php echo $config['MR']; ?>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class=title>
|
||||
<?php echo __('Memory limit'); ?>:
|
||||
</span>
|
||||
<span>
|
||||
<?php echo ini_get('memory_limit'); ?>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class=title>
|
||||
<?php echo __('Php version'); ?>:
|
||||
</span>
|
||||
<span>
|
||||
<?php echo phpversion(); ?>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -302,6 +302,15 @@ $table_ip = '<div class="label_select"><p class="input_label">'.__('IP Address')
|
|||
$table_ip .= '<div class="label_select_parent">';
|
||||
$table_ip .= '<div class="label_select_child_left">'.html_print_input_text('direccion', $direccion_agente, '', 16, 100, true).'</div>';
|
||||
$table_ip .= '<div class="label_select_child_right">'.html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true).__('Unique IP').'</div>';
|
||||
$table_ip .= '<div class="label_select_child_right">'.html_print_input(
|
||||
[
|
||||
'type' => 'switch',
|
||||
'id' => 'fixed_ip',
|
||||
'name' => 'fixed_ip',
|
||||
'value' => $fixed_ip,
|
||||
]
|
||||
).__('Fix IP address').ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true).'</div>';
|
||||
|
||||
$table_ip .= '</div></div>';
|
||||
|
||||
if ($id_agente) {
|
||||
|
@ -310,7 +319,7 @@ if ($id_agente) {
|
|||
$table_ip .= '<div class="label_select">';
|
||||
$table_ip .= '<div class="label_select_parent">';
|
||||
$table_ip .= '<div class="label_select_child_left">'.html_print_select($ip_all, 'address_list', $direccion_agente, '', '', 0, true).'</div>';
|
||||
$table_ip .= '<div class="label_select_child_right">'.html_print_checkbox_switch('delete_ip', 1, false, true).__('Delete selected').'</div>';
|
||||
$table_ip .= '<div class="label_select_child_right">'.html_print_checkbox_switch('delete_ip', 1, false, true).__('Delete selected IPs').'</div>';
|
||||
$table_ip .= '</div></div>';
|
||||
}
|
||||
|
||||
|
@ -1114,5 +1123,19 @@ ui_require_jquery_file('bgiframe');
|
|||
}
|
||||
$("#text-agente").prop('readonly', true);
|
||||
|
||||
|
||||
// Disable fixed ip button if empty.
|
||||
if($("#text-direccion").val() == '') {
|
||||
$("#fixed_ip").prop('disabled',true);
|
||||
}
|
||||
|
||||
$("#text-direccion").on('input',function(e){
|
||||
if($("#text-direccion").val() == '') {
|
||||
$("#fixed_ip").prop('disabled',true);
|
||||
} else {
|
||||
$("#fixed_ip").prop('disabled',false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -173,6 +173,7 @@ $url_description = '';
|
|||
$quiet = 0;
|
||||
$macros = '';
|
||||
$cps = 0;
|
||||
$fixed_ip = 0;
|
||||
|
||||
$create_agent = (bool) get_parameter('create_agent');
|
||||
$module_macros = [];
|
||||
|
@ -225,6 +226,7 @@ if ($create_agent) {
|
|||
$url_description = (string) get_parameter('url_description');
|
||||
$quiet = (int) get_parameter('quiet', 0);
|
||||
$cps = (int) get_parameter_switch('cps', -1);
|
||||
$fixed_ip = (int) get_parameter_switch('fixed_ip', 0);
|
||||
|
||||
$secondary_groups = (string) get_parameter('secondary_hidden', '');
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
|
@ -282,6 +284,7 @@ if ($create_agent) {
|
|||
'url_address' => $url_description,
|
||||
'quiet' => $quiet,
|
||||
'cps' => $cps,
|
||||
'fixed_ip' => $fixed_ip,
|
||||
]
|
||||
);
|
||||
enterprise_hook('update_agent', [$id_agente]);
|
||||
|
@ -326,7 +329,7 @@ if ($create_agent) {
|
|||
"Update GIS data":"'.$update_gis_data.'",
|
||||
"Url description":"'.$url_description.'",
|
||||
"Quiet":"'.(int) $quiet.'",
|
||||
"Cps":"'.(int) $cps.'"}';
|
||||
"Cps":"'.(int) $cps.'",}';
|
||||
|
||||
// Create the secondary groups.
|
||||
enterprise_hook(
|
||||
|
@ -987,6 +990,7 @@ if ($update_agent) {
|
|||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
$secondary_groups = (string) get_parameter('secondary_hidden', '');
|
||||
$satellite_server = (int) get_parameter('satellite_server', 0);
|
||||
$fixed_ip = (int) get_parameter_switch('fixed_ip', 0);
|
||||
|
||||
if ($fields === false) {
|
||||
$fields = [];
|
||||
|
@ -1095,6 +1099,7 @@ if ($update_agent) {
|
|||
'cps' => $cps,
|
||||
'safe_mode_module' => $safe_mode_module,
|
||||
'satellite_server' => $satellite_server,
|
||||
'fixed_ip' => $fixed_ip,
|
||||
];
|
||||
|
||||
if ($config['metaconsole_agent_cache'] == 1) {
|
||||
|
@ -1234,6 +1239,7 @@ if ($id_agente) {
|
|||
$safe_mode_module = $agent['safe_mode_module'];
|
||||
$safe_mode = ($safe_mode_module) ? 1 : 0;
|
||||
$satellite_server = (int) $agent['satellite_server'];
|
||||
$fixed_ip = (int) $agent['fixed_ip'];
|
||||
}
|
||||
|
||||
$update_module = (bool) get_parameter('update_module');
|
||||
|
|
|
@ -754,7 +754,8 @@ if ($agents !== false) {
|
|||
$in_planned_downtime = db_get_sql(
|
||||
'SELECT executed FROM tplanned_downtime
|
||||
INNER JOIN tplanned_downtime_agents ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime
|
||||
WHERE tplanned_downtime_agents.id_agent = '.$agent['id_agente'].' AND tplanned_downtime.executed = 1'
|
||||
WHERE tplanned_downtime_agents.id_agent = '.$agent['id_agente'].' AND tplanned_downtime.executed = 1
|
||||
AND tplanned_downtime.type_downtime <> "disable_agent_modules"'
|
||||
);
|
||||
|
||||
if ($agent['disabled']) {
|
||||
|
|
|
@ -466,7 +466,14 @@ if ($module_action === 'delete') {
|
|||
$id_agent_module_disable
|
||||
);
|
||||
|
||||
if (db_process_sql($sql)) {
|
||||
$id_agent_changed[] = modules_get_agentmodule_agent($id_agent_module_disable);
|
||||
$agent_update_result = db_process_sql_update(
|
||||
'tagente',
|
||||
['update_module_count' => 1],
|
||||
['id_agente' => $id_agent_changed]
|
||||
);
|
||||
|
||||
if (db_process_sql($sql) !== false && $agent_update_result !== false) {
|
||||
$updated_count++;
|
||||
}
|
||||
}
|
||||
|
@ -993,6 +1000,24 @@ foreach ($modules as $module) {
|
|||
}
|
||||
|
||||
if ($module['disabled']) {
|
||||
$dt_disabled_icon = '';
|
||||
|
||||
$in_planned_downtime = db_get_sql(
|
||||
'SELECT executed FROM tplanned_downtime
|
||||
INNER JOIN tplanned_downtime_modules ON tplanned_downtime.id = tplanned_downtime_modules.id_downtime
|
||||
WHERE tplanned_downtime.executed = 1
|
||||
AND tplanned_downtime.type_downtime = "disable_agent_modules"
|
||||
AND tplanned_downtime_modules.id_agent_module = '.$module['id_agente_modulo']
|
||||
);
|
||||
|
||||
if ($in_planned_downtime !== false) {
|
||||
$dt_disabled_icon = ui_print_help_tip(
|
||||
__('Module in scheduled downtime'),
|
||||
true,
|
||||
'images/minireloj-16.png'
|
||||
);
|
||||
}
|
||||
|
||||
$data[0] .= '<em class="disabled_module">'.ui_print_truncate_text(
|
||||
$module['nombre'],
|
||||
'module_medium',
|
||||
|
@ -1001,7 +1026,7 @@ foreach ($modules as $module) {
|
|||
true,
|
||||
'[…]',
|
||||
'font-size: 7.2pt'
|
||||
).'</em>';
|
||||
).$dt_disabled_icon.'</em>';
|
||||
} else {
|
||||
$data[0] .= ui_print_truncate_text(
|
||||
$module['nombre'],
|
||||
|
|
|
@ -1518,7 +1518,7 @@ $(document).ready (function () {
|
|||
}
|
||||
else{
|
||||
window.open(
|
||||
'https://pandorafms.com/manual/en/documentation/03_monitoring/03_remote_monitorins#monitoring_through_network_modules_with_snmp',
|
||||
'https://pandorafms.com/manual/en/documentation/03_monitoring/03_remote_monitoring#monitoring_through_network_modules_with_snmp',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
|
|
|
@ -49,6 +49,7 @@ if (!$agent_d && !$agent_w) {
|
|||
set_unless_defined($config['past_planned_downtimes'], 1);
|
||||
|
||||
require_once 'include/functions_users.php';
|
||||
require_once $config['homedir'].'/include/functions_cron.php';
|
||||
|
||||
// Buttons.
|
||||
$buttons = [
|
||||
|
@ -123,6 +124,18 @@ $periodically_time_to = (string) get_parameter(
|
|||
date(TIME_FORMAT, ($system_time + SECONDS_1HOUR))
|
||||
);
|
||||
|
||||
$hour_from = get_parameter('cron_hour_from', '*');
|
||||
$minute_from = get_parameter('cron_minute_from', '*');
|
||||
$mday_from = get_parameter('cron_mday_from', '*');
|
||||
$month_from = get_parameter('cron_month_from', '*');
|
||||
$wday_from = get_parameter('cron_wday_from', '*');
|
||||
|
||||
$hour_to = get_parameter('cron_hour_to', '*');
|
||||
$minute_to = get_parameter('cron_minute_to', '*');
|
||||
$mday_to = get_parameter('cron_mday_to', '*');
|
||||
$month_to = get_parameter('cron_month_to', '*');
|
||||
$wday_to = get_parameter('cron_wday_to', '*');
|
||||
|
||||
$monday = (bool) get_parameter('monday');
|
||||
$tuesday = (bool) get_parameter('tuesday');
|
||||
$wednesday = (bool) get_parameter('wednesday');
|
||||
|
@ -262,6 +275,193 @@ if ($create_downtime || $update_downtime) {
|
|||
);
|
||||
} else {
|
||||
$sql = '';
|
||||
$error_cron_from = false;
|
||||
$error_cron_to = false;
|
||||
$error_field = '';
|
||||
|
||||
if ($type_execution === 'cron') {
|
||||
// Validate 'from' cron values.
|
||||
$hour_from = io_safe_output(trim($hour_from));
|
||||
if (preg_match('/^((?:([0-1]?[0-9]|2[0-3])|\*)\s*(?:(?:[\/-]([0-1]?[0-9]|2[0-3])))?\s*)$/', $hour_from, $matches) !== 1) {
|
||||
$error_cron_from = true;
|
||||
$error_field = __('hour (from)');
|
||||
} else {
|
||||
$interval_values = explode('-', $hour_from);
|
||||
|
||||
if (count($interval_values) > 1) {
|
||||
$interval_from = $interval_values[0];
|
||||
$interval_to = $interval_values[1];
|
||||
|
||||
if ((int) $interval_to < (int) $interval_from) {
|
||||
$error_cron_from = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$minute_from = io_safe_output(trim($minute_from));
|
||||
if (preg_match('/^((?:(5[0-9]|[0-5]?[0-9])|\*)\s*(?:(?:[\/-](5[0-9]|[0-5]?[0-9])))?\s*)$/', $minute_from, $matches) !== 1) {
|
||||
$error_cron_from = true;
|
||||
$error_field = __('minute (from)');
|
||||
} else {
|
||||
$interval_values = explode('-', $minute_from);
|
||||
|
||||
if (count($interval_values) > 1) {
|
||||
$interval_from = $interval_values[0];
|
||||
$interval_to = $interval_values[1];
|
||||
|
||||
if ((int) $interval_to < (int) $interval_from) {
|
||||
$error_cron_from = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mday_from = io_safe_output(trim($mday_from));
|
||||
if (preg_match('/^((?:(0?[1-9]|[12][0-9]|3[01])|\*)\s*(?:(?:[\/-](0?[1-9]|[12][0-9]|3[01])))?\s*)$/', $mday_from, $matches) !== 1) {
|
||||
$error_cron_from = true;
|
||||
$error_field = __('month day (from)');
|
||||
} else {
|
||||
$interval_values = explode('-', $mday_from);
|
||||
|
||||
if (count($interval_values) > 1) {
|
||||
$interval_from = $interval_values[0];
|
||||
$interval_to = $interval_values[1];
|
||||
|
||||
if ((int) $interval_to < (int) $interval_from) {
|
||||
$error_cron_from = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$month_from = io_safe_output(trim($month_from));
|
||||
if (preg_match('/^((?:([1-9]|1[012])|\*)\s*(?:(?:[\/-]([1-9]|1[012])))?\s*)$/', $month_from, $matches) !== 1) {
|
||||
$error_cron_from = true;
|
||||
$error_field = __('month (from)');
|
||||
} else {
|
||||
$interval_values = explode('-', $month_from);
|
||||
|
||||
if (count($interval_values) > 1) {
|
||||
$interval_from = $interval_values[0];
|
||||
$interval_to = $interval_values[1];
|
||||
|
||||
if ((int) $interval_to < (int) $interval_from) {
|
||||
$error_cron_from = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$wday_from = io_safe_output(trim($wday_from));
|
||||
if (preg_match('/^((?:[0-6]|\*)\s*(?:(?:[\/-][0-6]))?\s*)$/', $wday_from, $matches) !== 1) {
|
||||
$error_cron_from = true;
|
||||
$error_field = __('week day (from)');
|
||||
} else {
|
||||
$interval_values = explode('-', $wday_from);
|
||||
if (count($interval_values) > 1) {
|
||||
$interval_from = $interval_values[0];
|
||||
$interval_to = $interval_values[1];
|
||||
|
||||
if ((int) $interval_to < (int) $interval_from) {
|
||||
$error_cron_from = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validate 'to' cron values.
|
||||
$hour_to = io_safe_output(trim($hour_to));
|
||||
if (preg_match('/^((?:([0-1]?[0-9]|2[0-3])|\*)\s*(?:(?:[\/-]([0-1]?[0-9]|2[0-3])))?\s*)$/', $hour_to, $matches) !== 1) {
|
||||
$error_cron_to = true;
|
||||
$error_field = __('hour (to)');
|
||||
} else {
|
||||
$interval_values = explode('-', $hour_to);
|
||||
|
||||
if (count($interval_values) > 1) {
|
||||
$interval_from = $interval_values[0];
|
||||
$interval_to = $interval_values[1];
|
||||
|
||||
if ((int) $interval_to < (int) $interval_from) {
|
||||
$error_cron_to = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$minute_to = io_safe_output(trim($minute_to));
|
||||
if (preg_match('/^((?:(5[0-9]|[0-5]?[0-9])|\*)\s*(?:(?:[\/-](5[0-9]|[0-5]?[0-9])))?\s*)$/', $minute_to, $matches) !== 1) {
|
||||
$error_cron_to = true;
|
||||
$error_field = __('minute (to)');
|
||||
} else {
|
||||
$interval_values = explode('-', $minute_to);
|
||||
|
||||
if (count($interval_values) > 1) {
|
||||
$interval_from = $interval_values[0];
|
||||
$interval_to = $interval_values[1];
|
||||
|
||||
if ((int) $interval_to < (int) $interval_from) {
|
||||
$error_cron_to = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mday_to = io_safe_output(trim($mday_to));
|
||||
if (preg_match('/^((?:(0?[1-9]|[12][0-9]|3[01])|\*)\s*(?:(?:[\/-](0?[1-9]|[12][0-9]|3[01])))?\s*)$/', $mday_to, $matches) !== 1) {
|
||||
$error_cron_to = true;
|
||||
$error_field = __('month day (to)');
|
||||
} else {
|
||||
$interval_values = explode('-', $mday_to);
|
||||
|
||||
if (count($interval_values) > 1) {
|
||||
$interval_from = $interval_values[0];
|
||||
$interval_to = $interval_values[1];
|
||||
|
||||
if ((int) $interval_to < (int) $interval_from) {
|
||||
$error_cron_to = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$month_to = io_safe_output(trim($month_to));
|
||||
if (preg_match('/^((?:([1-9]|1[012])|\*)\s*(?:(?:[\/-]([1-9]|1[012])))?\s*)$/', $month_to, $matches) !== 1) {
|
||||
$error_cron_to = true;
|
||||
$error_field = __('month (to)');
|
||||
} else {
|
||||
$interval_values = explode('-', $month_to);
|
||||
|
||||
if (count($interval_values) > 1) {
|
||||
$interval_from = $interval_values[0];
|
||||
$interval_to = $interval_values[1];
|
||||
|
||||
if ((int) $interval_to < (int) $interval_from) {
|
||||
$error_cron_to = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$wday_to = io_safe_output(trim($wday_to));
|
||||
if (preg_match('/^((?:[0-6]|\*)\s*(?:(?:[\/-][0-6]))?\s*)$/', $wday_to, $matches) !== 1) {
|
||||
$error_cron_to = true;
|
||||
$error_field = __('week day (to)');
|
||||
} else {
|
||||
$interval_values = explode('-', $wday_to);
|
||||
if (count($interval_values) > 1) {
|
||||
$interval_from = $interval_values[0];
|
||||
$interval_to = $interval_values[1];
|
||||
|
||||
if ((int) $interval_to < (int) $interval_from) {
|
||||
$error_cron_to = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$cron_interval_from = io_safe_output($minute_from.' '.$hour_from.' '.$mday_from.' '.$month_from.' '.$wday_from);
|
||||
$cron_interval_to = io_safe_output($minute_to.' '.$hour_to.' '.$mday_to.' '.$month_to.' '.$wday_to);
|
||||
}
|
||||
|
||||
if (cron_check_syntax($cron_interval_from) !== 1) {
|
||||
$cron_interval_from = '';
|
||||
}
|
||||
|
||||
if (cron_check_syntax($cron_interval_to) !== 1) {
|
||||
$cron_interval_to = '';
|
||||
}
|
||||
|
||||
if ($create_downtime) {
|
||||
// Check AD permission on new downtime.
|
||||
if (!in_array($id_group, $user_groups_ad)) {
|
||||
|
@ -273,50 +473,68 @@ if ($create_downtime || $update_downtime) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (trim(io_safe_output($name)) != '') {
|
||||
if (!$check) {
|
||||
$values = [
|
||||
'name' => $name,
|
||||
'description' => $description,
|
||||
'date_from' => $datetime_from,
|
||||
'date_to' => $datetime_to,
|
||||
'executed' => 0,
|
||||
'id_group' => $id_group,
|
||||
'only_alerts' => 0,
|
||||
'monday' => $monday,
|
||||
'tuesday' => $tuesday,
|
||||
'wednesday' => $wednesday,
|
||||
'thursday' => $thursday,
|
||||
'friday' => $friday,
|
||||
'saturday' => $saturday,
|
||||
'sunday' => $sunday,
|
||||
'periodically_time_from' => $periodically_time_from,
|
||||
'periodically_time_to' => $periodically_time_to,
|
||||
'periodically_day_from' => $periodically_day_from,
|
||||
'periodically_day_to' => $periodically_day_to,
|
||||
'type_downtime' => $type_downtime,
|
||||
'type_execution' => $type_execution,
|
||||
'type_periodicity' => $type_periodicity,
|
||||
'id_user' => $config['id_user'],
|
||||
];
|
||||
if ($config['dbtype'] == 'oracle') {
|
||||
$values['periodically_time_from'] = '1970/01/01 '.$values['periodically_time_from'];
|
||||
$values['periodically_time_to'] = '1970/01/01 '.$values['periodically_time_to'];
|
||||
}
|
||||
|
||||
$result = db_process_sql_insert(
|
||||
'tplanned_downtime',
|
||||
$values
|
||||
);
|
||||
} else {
|
||||
if ($error_cron_to === true || $error_cron_from === true) {
|
||||
if ($error_cron_from === true) {
|
||||
ui_print_error_message(
|
||||
__('Each scheduled downtime must have a different name')
|
||||
__('Downtime start cron expression is not correct').': '.$error_field
|
||||
);
|
||||
}
|
||||
|
||||
if ($error_cron_to === true) {
|
||||
ui_print_error_message(
|
||||
__('Downtime stop cron expression is not correct').': '.$error_field
|
||||
);
|
||||
}
|
||||
|
||||
$result = false;
|
||||
} else {
|
||||
ui_print_error_message(
|
||||
__('Scheduled downtime must have a name')
|
||||
);
|
||||
if (trim(io_safe_output($name)) != '') {
|
||||
if (!$check) {
|
||||
$values = [
|
||||
'name' => $name,
|
||||
'description' => $description,
|
||||
'date_from' => $datetime_from,
|
||||
'date_to' => $datetime_to,
|
||||
'executed' => 0,
|
||||
'id_group' => $id_group,
|
||||
'only_alerts' => 0,
|
||||
'monday' => $monday,
|
||||
'tuesday' => $tuesday,
|
||||
'wednesday' => $wednesday,
|
||||
'thursday' => $thursday,
|
||||
'friday' => $friday,
|
||||
'saturday' => $saturday,
|
||||
'sunday' => $sunday,
|
||||
'periodically_time_from' => $periodically_time_from,
|
||||
'periodically_time_to' => $periodically_time_to,
|
||||
'periodically_day_from' => $periodically_day_from,
|
||||
'periodically_day_to' => $periodically_day_to,
|
||||
'type_downtime' => $type_downtime,
|
||||
'type_execution' => $type_execution,
|
||||
'type_periodicity' => $type_periodicity,
|
||||
'id_user' => $config['id_user'],
|
||||
'cron_interval_from' => $cron_interval_from,
|
||||
'cron_interval_to' => $cron_interval_to,
|
||||
];
|
||||
if ($config['dbtype'] == 'oracle') {
|
||||
$values['periodically_time_from'] = '1970/01/01 '.$values['periodically_time_from'];
|
||||
$values['periodically_time_to'] = '1970/01/01 '.$values['periodically_time_to'];
|
||||
}
|
||||
|
||||
$result = db_process_sql_insert(
|
||||
'tplanned_downtime',
|
||||
$values
|
||||
);
|
||||
} else {
|
||||
ui_print_error_message(
|
||||
__('Each scheduled downtime must have a different name')
|
||||
);
|
||||
}
|
||||
} else {
|
||||
ui_print_error_message(
|
||||
__('Scheduled downtime must have a name')
|
||||
);
|
||||
}
|
||||
}
|
||||
} else if ($update_downtime) {
|
||||
$old_downtime = db_get_row('tplanned_downtime', 'id', $id_downtime);
|
||||
|
@ -381,6 +599,8 @@ if ($create_downtime || $update_downtime) {
|
|||
'type_execution' => $type_execution,
|
||||
'type_periodicity' => $type_periodicity,
|
||||
'id_user' => $config['id_user'],
|
||||
'cron_interval_from' => $cron_interval_from,
|
||||
'cron_interval_to' => $cron_interval_to,
|
||||
];
|
||||
if ($config['dbtype'] == 'oracle') {
|
||||
$values['periodically_time_from'] = '1970/01/01 '.$values['periodically_time_from'];
|
||||
|
@ -388,15 +608,31 @@ if ($create_downtime || $update_downtime) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($is_running) {
|
||||
if ($error_cron_to === true || $error_cron_from === true) {
|
||||
if ($error_cron_from === true) {
|
||||
ui_print_error_message(
|
||||
__('Downtime start cron expression is not correct').': '.$error_field
|
||||
);
|
||||
}
|
||||
|
||||
if ($error_cron_to === true) {
|
||||
ui_print_error_message(
|
||||
__('Downtime stop cron expression is not correct').': '.$error_field
|
||||
);
|
||||
}
|
||||
|
||||
$result = false;
|
||||
} else {
|
||||
if (!empty($values)) {
|
||||
$result = db_process_sql_update(
|
||||
'tplanned_downtime',
|
||||
$values,
|
||||
['id' => $id_downtime]
|
||||
);
|
||||
if ($is_running) {
|
||||
$result = false;
|
||||
} else {
|
||||
if (!empty($values)) {
|
||||
$result = db_process_sql_update(
|
||||
'tplanned_downtime',
|
||||
$values,
|
||||
['id' => $id_downtime]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -458,6 +694,8 @@ if ($id_downtime > 0) {
|
|||
'type_execution',
|
||||
'type_periodicity',
|
||||
'id_user',
|
||||
'cron_interval_from',
|
||||
'cron_interval_to',
|
||||
];
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
|
@ -532,6 +770,36 @@ if ($id_downtime > 0) {
|
|||
$saturday = (bool) $result['saturday'];
|
||||
$sunday = (bool) $result['sunday'];
|
||||
|
||||
$cron_interval_from = explode(' ', $result['cron_interval_from']);
|
||||
if (isset($cron_interval_from[4]) === true) {
|
||||
$minute_from = $cron_interval_from[0];
|
||||
$hour_from = $cron_interval_from[1];
|
||||
$mday_from = $cron_interval_from[2];
|
||||
$month_from = $cron_interval_from[3];
|
||||
$wday_from = $cron_interval_from[4];
|
||||
} else {
|
||||
$minute_from = '*';
|
||||
$hour_from = '*';
|
||||
$mday_from = '*';
|
||||
$month_from = '*';
|
||||
$wday_from = '*';
|
||||
}
|
||||
|
||||
$cron_interval_to = explode(' ', $result['cron_interval_to']);
|
||||
if (isset($cron_interval_to[4]) === true) {
|
||||
$minute_to = $cron_interval_to[0];
|
||||
$hour_to = $cron_interval_to[1];
|
||||
$mday_to = $cron_interval_to[2];
|
||||
$month_to = $cron_interval_to[3];
|
||||
$wday_to = $cron_interval_to[4];
|
||||
} else {
|
||||
$minute_to = '*';
|
||||
$hour_to = '*';
|
||||
$mday_to = '*';
|
||||
$month_to = '*';
|
||||
$wday_to = '*';
|
||||
}
|
||||
|
||||
$running = (bool) $result['executed'];
|
||||
}
|
||||
|
||||
|
@ -593,6 +861,7 @@ $table->data[3][1] = html_print_select(
|
|||
[
|
||||
'quiet' => __('Quiet'),
|
||||
'disable_agents' => __('Disabled Agents'),
|
||||
'disable_agent_modules' => __('Disable Modules'),
|
||||
'disable_agents_alerts' => __('Disabled only Alerts'),
|
||||
],
|
||||
'type_downtime',
|
||||
|
@ -611,6 +880,7 @@ $table->data[4][1] = html_print_select(
|
|||
[
|
||||
'once' => __('Once'),
|
||||
'periodically' => __('Periodically'),
|
||||
'cron' => __('Cron from/to'),
|
||||
],
|
||||
'type_execution',
|
||||
$type_execution,
|
||||
|
@ -740,6 +1010,18 @@ $table->data[5][1] = "
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="cron_time" style="display: none;">
|
||||
<table class="w100p">
|
||||
<tr>
|
||||
<td>'.__('Cron from:').'</td>
|
||||
<td>'.html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, false, false, true, 'from').'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>'.__('Cron to:').'</td>
|
||||
<td>'.html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, false, true, true, 'to').'</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>';
|
||||
|
||||
if ($id_downtime > 0) {
|
||||
|
@ -797,13 +1079,29 @@ $table = new StdClass();
|
|||
$table->class = 'databox filters';
|
||||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$table->size[0] = '25%';
|
||||
|
||||
$table->data[0][0] = __('Group filter');
|
||||
$table->data[0][1] = html_print_select_groups(false, $access, $return_all_group, 'filter_group', $filter_group, '', '', '', true, false, true, '', false, 'min-width:180px;margin-right:15px;');
|
||||
$table->data[0][1] = html_print_select_groups(
|
||||
false,
|
||||
$access,
|
||||
$return_all_group,
|
||||
'filter_group',
|
||||
$filter_group,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'min-width:180px;margin-right:15px;'
|
||||
);
|
||||
$table->data[0][2] = __('Recursion').'  '.html_print_checkbox('recursion', 1, $recursion, true, false, '');
|
||||
|
||||
$table->data[1][0] = __('Available agents');
|
||||
$table->data[1][1] = html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, true, true, true, '', false, 'width: 180px;');
|
||||
$table->data[1][1] = html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, true, true, true, '', false, 'min-width: 250px;width: 70%;');
|
||||
|
||||
|
||||
if ($type_downtime != 'quiet') {
|
||||
|
@ -855,7 +1153,7 @@ $table->data[3][1] = html_print_select(
|
|||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 180px;'
|
||||
'min-width: 250px;width: 70%;'
|
||||
);
|
||||
echo '</div>';
|
||||
|
||||
|
@ -1238,12 +1536,19 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
|
|||
switch ($("#type_execution").val()) {
|
||||
case 'once':
|
||||
$("#periodically_time").hide();
|
||||
$("#cron_time").hide();
|
||||
$("#once_time").show();
|
||||
break;
|
||||
case 'periodically':
|
||||
$("#once_time").hide();
|
||||
$("#cron_time").hide();
|
||||
$("#periodically_time").show();
|
||||
break;
|
||||
case 'cron':
|
||||
$("#once_time").hide();
|
||||
$("#periodically_time").hide();
|
||||
$("#cron_time").show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -317,6 +317,7 @@ $row = [];
|
|||
$execution_type_fields = [
|
||||
'once' => __('Once'),
|
||||
'periodically' => __('Periodically'),
|
||||
'cron' => __('Cron'),
|
||||
];
|
||||
$row[] = __('Execution type').' '.html_print_select(
|
||||
$execution_type_fields,
|
||||
|
@ -460,10 +461,15 @@ if (empty($groups) === false) {
|
|||
strtotime($date_to.' 23:59:59')
|
||||
);
|
||||
|
||||
$cron = sprintf(
|
||||
'type_execution = "cron"'
|
||||
);
|
||||
|
||||
$where_values .= sprintf(
|
||||
' AND ((%s) OR (%s))',
|
||||
' AND ((%s) OR (%s) OR (%s))',
|
||||
$periodically_w,
|
||||
$once_w
|
||||
$once_w,
|
||||
$cron
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -471,6 +477,7 @@ if (empty($groups) === false) {
|
|||
$filter_performed = true;
|
||||
$where_values .= sprintf(
|
||||
' AND (type_execution = "periodically"
|
||||
OR type_execution = "cron"
|
||||
OR (type_execution = "once"
|
||||
AND date_to >= "%s"))',
|
||||
time()
|
||||
|
@ -530,6 +537,8 @@ if (empty($groups) === false) {
|
|||
'type_execution',
|
||||
'type_periodicity',
|
||||
'id_user',
|
||||
'cron_interval_from',
|
||||
'cron_interval_to',
|
||||
];
|
||||
|
||||
$columns_str = implode(',', $columns);
|
||||
|
@ -660,8 +669,9 @@ if ($downtimes === false && $filter_performed === false) {
|
|||
$data['type'] = $type_text[$downtime['type_downtime']];
|
||||
|
||||
$execution_text = [
|
||||
'once' => __('once'),
|
||||
'once' => __('Once'),
|
||||
'periodically' => __('Periodically'),
|
||||
'cron' => __('Cron'),
|
||||
];
|
||||
|
||||
$data['execution'] = $execution_text[$downtime['type_execution']];
|
||||
|
|
|
@ -195,56 +195,55 @@ $simple_alerts = [];
|
|||
|
||||
$total = 0;
|
||||
$where = '';
|
||||
if ($searchFlag) {
|
||||
if ($status_alert === 'fired') {
|
||||
$where .= ' AND talert_template_modules.times_fired > 0';
|
||||
}
|
||||
|
||||
if ($status_alert === 'notfired') {
|
||||
$where .= ' AND talert_template_modules.times_fired = 0';
|
||||
}
|
||||
if ($status_alert === 'fired') {
|
||||
$where .= ' AND talert_template_modules.times_fired > 0';
|
||||
}
|
||||
|
||||
if ($priority != -1 && $priority != '') {
|
||||
$where .= ' AND id_alert_template IN (SELECT id FROM talert_templates WHERE priority = '.$priority.')';
|
||||
}
|
||||
if ($status_alert === 'notfired') {
|
||||
$where .= ' AND talert_template_modules.times_fired = 0';
|
||||
}
|
||||
|
||||
if (strlen(trim($templateName)) > 0) {
|
||||
$where .= " AND id_alert_template IN (SELECT id FROM talert_templates WHERE name LIKE '%".trim($templateName)."%')";
|
||||
}
|
||||
if ($priority != -1 && $priority != '') {
|
||||
$where .= ' AND id_alert_template IN (SELECT id FROM talert_templates WHERE priority = '.$priority.')';
|
||||
}
|
||||
|
||||
if (strlen(trim($fieldContent)) > 0) {
|
||||
$where .= " AND id_alert_template IN (SELECT id FROM talert_templates
|
||||
if (strlen(trim($templateName)) > 0) {
|
||||
$where .= " AND id_alert_template IN (SELECT id FROM talert_templates WHERE name LIKE '%".trim($templateName)."%')";
|
||||
}
|
||||
|
||||
if (strlen(trim($fieldContent)) > 0) {
|
||||
$where .= " AND id_alert_template IN (SELECT id FROM talert_templates
|
||||
WHERE field1 LIKE '%".trim($fieldContent)."%' OR field2 LIKE '%".trim($fieldContent)."%' OR
|
||||
field3 LIKE '%".trim($fieldContent)."%' OR
|
||||
field2_recovery LIKE '%".trim($fieldContent)."%' OR
|
||||
field3_recovery LIKE '%".trim($fieldContent)."%')";
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(trim($moduleName)) > 0) {
|
||||
$where .= " AND id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE nombre LIKE '%".trim($moduleName)."%')";
|
||||
}
|
||||
if (strlen(trim($moduleName)) > 0) {
|
||||
$where .= " AND id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE nombre LIKE '%".trim($moduleName)."%')";
|
||||
}
|
||||
|
||||
if (strlen(trim($agentName)) > 0) {
|
||||
$where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo
|
||||
if (strlen(trim($agentName)) > 0) {
|
||||
$where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo
|
||||
FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente
|
||||
WHERE t1.alias LIKE '".trim($agentName)."')";
|
||||
}
|
||||
}
|
||||
|
||||
if ($actionID != -1 && $actionID != '') {
|
||||
$where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.'))';
|
||||
}
|
||||
if ($actionID != -1 && $actionID != '') {
|
||||
$where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.'))';
|
||||
}
|
||||
|
||||
if ($status_alert === 'disabled') {
|
||||
$where .= ' AND talert_template_modules.disabled = 1';
|
||||
}
|
||||
if ($status_alert === 'disabled') {
|
||||
$where .= ' AND talert_template_modules.disabled = 1';
|
||||
}
|
||||
|
||||
if ($status_alert === 'all_enabled') {
|
||||
$where .= ' AND talert_template_modules.disabled = 0';
|
||||
}
|
||||
if ($status_alert === 'all_enabled') {
|
||||
$where .= ' AND talert_template_modules.disabled = 0';
|
||||
}
|
||||
|
||||
if ($standby != -1 && $standby != '') {
|
||||
$where .= ' AND talert_template_modules.standby = '.$standby;
|
||||
}
|
||||
if ($standby != -1 && $standby != '') {
|
||||
$where .= ' AND talert_template_modules.standby = '.$standby;
|
||||
}
|
||||
|
||||
$id_agents = array_keys($agents);
|
||||
|
|
|
@ -169,154 +169,6 @@ if ($delete === true) {
|
|||
}
|
||||
}
|
||||
|
||||
$table = new stdClass;
|
||||
$table->id = 'delete_table';
|
||||
$table->class = 'databox filters';
|
||||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold;';
|
||||
$table->style[2] = 'font-weight: bold';
|
||||
$table->size = [];
|
||||
$table->size[0] = '15%';
|
||||
$table->size[1] = '35%';
|
||||
$table->size[2] = '15%';
|
||||
$table->size[3] = '35%';
|
||||
|
||||
$table->data = [];
|
||||
$table->data[0][0] = __('Group');
|
||||
$table->data[0][1] = html_print_select_groups(
|
||||
false,
|
||||
'AW',
|
||||
true,
|
||||
'id_group',
|
||||
$id_group,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table->data[0][2] = __('Group recursion');
|
||||
$table->data[0][3] = html_print_checkbox(
|
||||
'recursion',
|
||||
1,
|
||||
$recursion,
|
||||
true,
|
||||
false
|
||||
);
|
||||
|
||||
$status_list = [];
|
||||
$status_list[AGENT_STATUS_NORMAL] = __('Normal');
|
||||
$status_list[AGENT_STATUS_WARNING] = __('Warning');
|
||||
$status_list[AGENT_STATUS_CRITICAL] = __('Critical');
|
||||
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
|
||||
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
|
||||
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
|
||||
$table->data[1][0] = __('Status');
|
||||
$table->data[1][1] = html_print_select(
|
||||
$status_list,
|
||||
'status_agents',
|
||||
'selected',
|
||||
'',
|
||||
__('All'),
|
||||
AGENT_STATUS_ALL,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[1][2] = __('Show agents');
|
||||
$table->data[1][3] = html_print_select(
|
||||
[
|
||||
0 => 'Only enabled',
|
||||
1 => 'Only disabled',
|
||||
],
|
||||
'disabled',
|
||||
2,
|
||||
'',
|
||||
__('All'),
|
||||
2,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:30%;'
|
||||
);
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$servers = metaconsole_get_servers();
|
||||
$server_fields = [];
|
||||
foreach ($servers as $key => $server) {
|
||||
$server_fields[$key] = $server['server_name'];
|
||||
}
|
||||
|
||||
$table->data[2][2] = __('Node');
|
||||
$table->data[2][3] = html_print_select(
|
||||
$server_fields,
|
||||
'nodes[]',
|
||||
0,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'min-width: 500px; max-width: 500px; max-height: 100px',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$table->data[3][0] = __('Agents');
|
||||
$table->data[3][0] .= '<span id="agent_loading" class="invisible">';
|
||||
$table->data[3][0] .= html_print_image('images/spinner.png', true);
|
||||
$table->data[3][0] .= '</span>';
|
||||
|
||||
$agents = [];
|
||||
if (is_metaconsole() === false) {
|
||||
$agents = agents_get_group_agents(
|
||||
array_keys(users_get_groups($config['id_user'], 'AW', false)),
|
||||
['disabled' => 2],
|
||||
'none'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$table->data[3][1] = html_print_select(
|
||||
$agents,
|
||||
'id_agents[]',
|
||||
0,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'min-width: 500px; max-width: 500px; max-height: 100px',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
$url = 'index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents';
|
||||
if (is_metaconsole() === true) {
|
||||
|
@ -324,10 +176,15 @@ if (is_metaconsole() === true) {
|
|||
}
|
||||
|
||||
echo '<form method="post" id="form_agent" action="'.$url.'">';
|
||||
html_print_table($table);
|
||||
|
||||
$params = [
|
||||
'id_group' => $id_group,
|
||||
'recursion' => $recursion,
|
||||
];
|
||||
echo get_table_inputs_masive_agents($params);
|
||||
|
||||
if (is_metaconsole() === true || is_management_allowed() === true) {
|
||||
attachActionButton('delete', 'delete', $table->width);
|
||||
attachActionButton('delete', 'delete', '100%');
|
||||
}
|
||||
|
||||
echo '</form>';
|
||||
|
@ -342,54 +199,6 @@ ui_require_jquery_file('pandora.controls');
|
|||
$(document).ready (function () {
|
||||
// Check Metaconsole.
|
||||
var metaconsole = '<?php echo (is_metaconsole() === true) ? 1 : 0; ?>';
|
||||
|
||||
// Listeners.
|
||||
var recursion;
|
||||
$("#checkbox-recursion").click(function () {
|
||||
recursion = this.checked ? 1 : 0;
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
||||
var disabled;
|
||||
$("#disabled").change(function () {
|
||||
disabled = this.value;
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
||||
var nodes;
|
||||
$("#nodes").change(function () {
|
||||
nodes = $("#nodes").val();
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
||||
$("#status_agents").change(function() {
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
||||
// Build data.
|
||||
var data = {
|
||||
status_agents: function () {
|
||||
return $("#status_agents").val();
|
||||
},
|
||||
agentSelect: "select#id_agents",
|
||||
privilege: "AW",
|
||||
recursion: function() {
|
||||
return recursion;
|
||||
},
|
||||
disabled: function() {
|
||||
return disabled;
|
||||
},
|
||||
}
|
||||
|
||||
if (metaconsole == 1) {
|
||||
data.serialized = true;
|
||||
data.serialized_separator = '|';
|
||||
data.nodes = function() {
|
||||
return nodes;
|
||||
};
|
||||
}
|
||||
|
||||
// Change agents.
|
||||
$("#id_group").pandoraSelectGroupAgent(data);
|
||||
form_controls_massive_operations_agents(metaconsole);
|
||||
});
|
||||
</script>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -68,11 +68,6 @@ $options_agents = [
|
|||
'edit_agents' => __('Bulk agent edit'),
|
||||
'delete_agents' => __('Bulk agent delete'),
|
||||
];
|
||||
if (is_metaconsole() === true) {
|
||||
$options_agents = [
|
||||
'delete_agents' => __('Bulk agent delete'),
|
||||
];
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'UM')) {
|
||||
$options_users = [
|
||||
|
|
|
@ -28,15 +28,18 @@
|
|||
|
||||
// Begin.
|
||||
require_once 'include/config.php';
|
||||
require_once 'include/functions_menu.php';
|
||||
|
||||
check_login();
|
||||
|
||||
enterprise_include('godmode/menu.php');
|
||||
require_once 'include/functions_menu.php';
|
||||
|
||||
$access_console_node = !is_reporting_console_node();
|
||||
$menu_godmode = [];
|
||||
$menu_godmode['class'] = 'godmode';
|
||||
|
||||
if ($access_console_node === true) {
|
||||
enterprise_include('godmode/menu.php');
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AR') === true
|
||||
|| (bool) check_acl($config['id_user'], 0, 'AW') === true
|
||||
|| (bool) check_acl($config['id_user'], 0, 'RR') === true
|
||||
|
@ -46,32 +49,35 @@ if ((bool) check_acl($config['id_user'], 0, 'AR') === true
|
|||
$sub = [];
|
||||
$sub['godmode/servers/discovery&wiz=main']['text'] = __('Start');
|
||||
$sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery';
|
||||
|
||||
$sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list');
|
||||
$sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist';
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true
|
||||
|| (bool) check_acl($config['id_user'], 0, 'PM') === true
|
||||
) {
|
||||
if ($access_console_node === true) {
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true
|
||||
|| (bool) check_acl($config['id_user'], 0, 'PM') === true
|
||||
) {
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||
$sub2 = [];
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=netscan']['text'] = __('Network scan');
|
||||
enterprise_hook('hostdevices_submenu');
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=customnetscan']['text'] = __('Custom network scan');
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=managenetscanscripts']['text'] = __('Manage scan scripts');
|
||||
}
|
||||
|
||||
$sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices');
|
||||
$sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd';
|
||||
$sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2;
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||
$sub2 = [];
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=netscan']['text'] = __('Network scan');
|
||||
enterprise_hook('hostdevices_submenu');
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=customnetscan']['text'] = __('Custom network scan');
|
||||
enterprise_hook('applications_menu');
|
||||
enterprise_hook('cloud_menu');
|
||||
enterprise_hook('console_task_menu');
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=managenetscanscripts']['text'] = __('Manage scan scripts');
|
||||
}
|
||||
|
||||
$sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices');
|
||||
$sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd';
|
||||
$sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2;
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||
enterprise_hook('applications_menu');
|
||||
enterprise_hook('cloud_menu');
|
||||
enterprise_hook('console_task_menu');
|
||||
}
|
||||
|
||||
// Add to menu.
|
||||
|
@ -81,308 +87,311 @@ if ((bool) check_acl($config['id_user'], 0, 'AR') === true
|
|||
$menu_godmode['discovery']['sub'] = $sub;
|
||||
}
|
||||
|
||||
|
||||
$sub = [];
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true || (bool) check_acl($config['id_user'], 0, 'AD') === true) {
|
||||
$sub['godmode/agentes/modificar_agente']['text'] = __('Manage agents');
|
||||
$sub['godmode/agentes/modificar_agente']['id'] = 'Manage agents';
|
||||
$sub['godmode/agentes/modificar_agente']['subsecs'] = ['godmode/agentes/configurar_agente'];
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
$sub['godmode/agentes/fields_manager']['text'] = __('Custom fields');
|
||||
$sub['godmode/agentes/fields_manager']['id'] = 'Custom fields';
|
||||
|
||||
$sub['godmode/modules/manage_nc_groups']['text'] = __('Component groups');
|
||||
$sub['godmode/modules/manage_nc_groups']['id'] = 'Component groups';
|
||||
// Category.
|
||||
$sub['godmode/category/category']['text'] = __('Module categories');
|
||||
$sub['godmode/category/category']['id'] = 'Module categories';
|
||||
$sub['godmode/category/category']['subsecs'] = 'godmode/category/edit_category';
|
||||
|
||||
$sub['godmode/modules/module_list']['text'] = __('Module types');
|
||||
$sub['godmode/modules/module_list']['id'] = 'Module types';
|
||||
|
||||
$sub['godmode/groups/modu_group_list']['text'] = __('Module groups');
|
||||
$sub['godmode/groups/modu_group_list']['id'] = 'Module groups';
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||
// Netflow.
|
||||
if ((bool) $config['activate_netflow'] === true) {
|
||||
$sub['godmode/netflow/nf_edit']['text'] = __('Netflow filters');
|
||||
$sub['godmode/netflow/nf_edit']['id'] = 'Netflow filters';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($sub) === false) {
|
||||
$menu_godmode['gagente']['text'] = __('Resources');
|
||||
$menu_godmode['gagente']['sec2'] = 'godmode/agentes/modificar_agente';
|
||||
$menu_godmode['gagente']['id'] = 'god-resources';
|
||||
$menu_godmode['gagente']['sub'] = $sub;
|
||||
}
|
||||
|
||||
$sub = [];
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
$sub['godmode/groups/group_list']['text'] = __('Manage agents groups');
|
||||
$sub['godmode/groups/group_list']['id'] = 'Manage agents groups';
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
// Tag.
|
||||
$sub['godmode/tag/tag']['text'] = __('Module tags');
|
||||
$sub['godmode/tag/tag']['id'] = 'Module tags';
|
||||
$sub['godmode/tag/tag']['subsecs'] = 'godmode/tag/edit_tag';
|
||||
|
||||
enterprise_hook('enterprise_acl_submenu');
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'UM') === true) {
|
||||
$sub['godmode/users/user_list']['text'] = __('Users management');
|
||||
$sub['godmode/users/user_list']['id'] = 'Users management';
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
$sub['godmode/users/profile_list']['text'] = __('Profile management');
|
||||
$sub['godmode/users/profile_list']['id'] = 'Profile management';
|
||||
}
|
||||
|
||||
if (empty($sub) === false) {
|
||||
$menu_godmode['gusuarios']['sub'] = $sub;
|
||||
$menu_godmode['gusuarios']['text'] = __('Profiles');
|
||||
$menu_godmode['gusuarios']['sec2'] = 'godmode/users/user_list';
|
||||
$menu_godmode['gusuarios']['id'] = 'god-users';
|
||||
}
|
||||
|
||||
$sub = [];
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
$sub['templates']['text'] = __('Templates');
|
||||
$sub['templates']['id'] = 'Templates';
|
||||
$sub['templates']['type'] = 'direct';
|
||||
$sub['templates']['subtype'] = 'nolink';
|
||||
$sub2 = [];
|
||||
$sub2['godmode/modules/manage_module_templates']['text'] = __('Module templates');
|
||||
$sub2['godmode/modules/manage_module_templates']['id'] = 'Module templates';
|
||||
$sub2['godmode/modules/private_enterprise_numbers']['text'] = __('Private Enterprise Numbers');
|
||||
$sub2['godmode/modules/private_enterprise_numbers']['id'] = 'Private Enterprise Numbers';
|
||||
$sub2['enterprise/godmode/modules/local_components']['text'] = __('Local components');
|
||||
$sub2['enterprise/godmode/modules/local_components']['id'] = 'Local components';
|
||||
$sub2['godmode/modules/manage_network_components']['text'] = __('Remote components');
|
||||
$sub2['godmode/modules/manage_network_components']['id'] = 'Network components';
|
||||
$sub['templates']['sub2'] = $sub2;
|
||||
|
||||
enterprise_hook('inventory_submenu');
|
||||
enterprise_hook('autoconfiguration_menu');
|
||||
enterprise_hook('agent_repository_menu');
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||
enterprise_hook('policies_menu');
|
||||
enterprise_hook('agents_submenu');
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'NW') === true) {
|
||||
enterprise_hook('agents_ncm_submenu');
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||
$sub['gmassive']['text'] = __('Bulk operations');
|
||||
$sub['gmassive']['id'] = 'Bulk operations';
|
||||
$sub['gmassive']['type'] = 'direct';
|
||||
$sub['gmassive']['subtype'] = 'nolink';
|
||||
$sub2 = [];
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_agents']['text'] = __('Agents operations');
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_modules']['text'] = __('Modules operations');
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_plugins']['text'] = __('Plugins operations');
|
||||
if ((bool) check_acl($config['id_user'], 0, 'UM') === true) {
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_users']['text'] = __('Users operations');
|
||||
}
|
||||
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_alerts']['text'] = __('Alerts operations');
|
||||
enterprise_hook('massivepolicies_submenu');
|
||||
enterprise_hook('massivesnmp_submenu');
|
||||
enterprise_hook('massivesatellite_submenu');
|
||||
|
||||
$sub['gmassive']['sub2'] = $sub2;
|
||||
$sub2 = [];
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'UM') === true) {
|
||||
$sub['godmode/groups/group_list&tab=credbox']['text'] = __('Credential store');
|
||||
$sub['godmode/groups/group_list&tab=credbox']['id'] = 'credential store';
|
||||
}
|
||||
|
||||
// Manage events.
|
||||
$sub2 = [];
|
||||
if ((bool) check_acl($config['id_user'], 0, 'EW') === true || (bool) check_acl($config['id_user'], 0, 'EM') === true) {
|
||||
// Custom event fields.
|
||||
$sub2['godmode/events/events§ion=filter']['text'] = __('Event filters');
|
||||
$sub2['godmode/events/events§ion=filter']['id'] = 'Event filters';
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
$sub2['godmode/events/events§ion=fields']['text'] = __('Custom columns');
|
||||
$sub2['godmode/events/events§ion=fields']['id'] = 'Custom events';
|
||||
$sub2['godmode/events/events§ion=responses']['text'] = __('Event responses');
|
||||
$sub2['godmode/events/events§ion=responses']['id'] = 'Event responses';
|
||||
}
|
||||
|
||||
if (empty($sub2) === false) {
|
||||
$sub['geventos']['text'] = __('Events');
|
||||
$sub['geventos']['id'] = 'events';
|
||||
$sub['geventos']['sec2'] = 'godmode/events/events§ion=filter';
|
||||
$sub['geventos']['type'] = 'direct';
|
||||
$sub['geventos']['subtype'] = 'nolink';
|
||||
$sub['geventos']['sub2'] = $sub2;
|
||||
}
|
||||
|
||||
if (empty($sub) === false) {
|
||||
$menu_godmode['gmodules']['text'] = __('Configuration');
|
||||
$menu_godmode['gmodules']['sec2'] = 'godmode/modules/manage_network_templates';
|
||||
$menu_godmode['gmodules']['id'] = 'god-configuration';
|
||||
$menu_godmode['gmodules']['sub'] = $sub;
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'LW') === true
|
||||
|| (bool) check_acl($config['id_user'], 0, 'LM') === true
|
||||
|| (bool) check_acl($config['id_user'], 0, 'AD') === true
|
||||
) {
|
||||
$menu_godmode['galertas']['text'] = __('Alerts');
|
||||
$menu_godmode['galertas']['sec2'] = 'godmode/alerts/alert_list';
|
||||
$menu_godmode['galertas']['id'] = 'god-alerts';
|
||||
|
||||
if ($access_console_node === true) {
|
||||
$sub = [];
|
||||
$sub['godmode/alerts/alert_list']['text'] = __('List of Alerts');
|
||||
$sub['godmode/alerts/alert_list']['id'] = 'List of Alerts';
|
||||
$sub['godmode/alerts/alert_list']['pages'] = ['godmode/alerts/alert_view'];
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
|
||||
$sub['godmode/alerts/alert_templates']['text'] = __('Templates');
|
||||
$sub['godmode/alerts/alert_templates']['id'] = 'Templates';
|
||||
$sub['godmode/alerts/alert_templates']['pages'] = ['godmode/alerts/configure_alert_template'];
|
||||
|
||||
$sub['godmode/alerts/alert_actions']['text'] = __('Actions');
|
||||
$sub['godmode/alerts/alert_actions']['id'] = 'Actions';
|
||||
$sub['godmode/alerts/alert_actions']['pages'] = ['godmode/alerts/configure_alert_action'];
|
||||
$sub['godmode/alerts/alert_commands']['text'] = __('Commands');
|
||||
$sub['godmode/alerts/alert_commands']['id'] = 'Commands';
|
||||
$sub['godmode/alerts/alert_commands']['pages'] = ['godmode/alerts/configure_alert_command'];
|
||||
$sub['godmode/alerts/alert_special_days']['text'] = __('Special days list');
|
||||
$sub['godmode/alerts/alert_special_days']['id'] = __('Special days list');
|
||||
$sub['godmode/alerts/alert_special_days']['pages'] = ['godmode/alerts/configure_alert_special_days'];
|
||||
|
||||
enterprise_hook('eventalerts_submenu');
|
||||
$sub['godmode/snmpconsole/snmp_alert']['text'] = __('SNMP alerts');
|
||||
$sub['godmode/snmpconsole/snmp_alert']['id'] = 'SNMP alerts';
|
||||
enterprise_hook('alert_inventory_submenu');
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true || (bool) check_acl($config['id_user'], 0, 'AD') === true) {
|
||||
$sub['godmode/agentes/modificar_agente']['text'] = __('Manage agents');
|
||||
$sub['godmode/agentes/modificar_agente']['id'] = 'Manage agents';
|
||||
$sub['godmode/agentes/modificar_agente']['subsecs'] = ['godmode/agentes/configurar_agente'];
|
||||
}
|
||||
|
||||
$menu_godmode['galertas']['sub'] = $sub;
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true || (bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
// Servers.
|
||||
$menu_godmode['gservers']['text'] = __('Servers');
|
||||
$menu_godmode['gservers']['sec2'] = 'godmode/servers/modificar_server';
|
||||
$menu_godmode['gservers']['id'] = 'god-servers';
|
||||
|
||||
$sub = [];
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||
$sub['godmode/servers/modificar_server']['text'] = __('Manage servers');
|
||||
$sub['godmode/servers/modificar_server']['id'] = 'Manage servers';
|
||||
}
|
||||
|
||||
// This subtabs are only for Pandora Admin.
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
enterprise_hook('ha_cluster');
|
||||
$sub['godmode/agentes/fields_manager']['text'] = __('Custom fields');
|
||||
$sub['godmode/agentes/fields_manager']['id'] = 'Custom fields';
|
||||
|
||||
$sub['godmode/servers/plugin']['text'] = __('Plugins');
|
||||
$sub['godmode/servers/plugin']['id'] = 'Plugins';
|
||||
$sub['godmode/modules/manage_nc_groups']['text'] = __('Component groups');
|
||||
$sub['godmode/modules/manage_nc_groups']['id'] = 'Component groups';
|
||||
// Category.
|
||||
$sub['godmode/category/category']['text'] = __('Module categories');
|
||||
$sub['godmode/category/category']['id'] = 'Module categories';
|
||||
$sub['godmode/category/category']['subsecs'] = 'godmode/category/edit_category';
|
||||
|
||||
$sub['godmode/servers/plugin_registration']['text'] = __('Register Plugin');
|
||||
$sub['godmode/servers/plugin_registration']['id'] = 'register_plugin';
|
||||
$sub['godmode/modules/module_list']['text'] = __('Module types');
|
||||
$sub['godmode/modules/module_list']['id'] = 'Module types';
|
||||
|
||||
enterprise_hook('export_target_submenu');
|
||||
$sub['godmode/groups/modu_group_list']['text'] = __('Module groups');
|
||||
$sub['godmode/groups/modu_group_list']['id'] = 'Module groups';
|
||||
|
||||
enterprise_hook('manage_satellite_submenu');
|
||||
$sub['godmode/setup/os']['text'] = __('Operating systems');
|
||||
$sub['godmode/setup/os']['id'] = 'Edit OS';
|
||||
}
|
||||
|
||||
$menu_godmode['gservers']['sub'] = $sub;
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
// Setup.
|
||||
$menu_godmode['gsetup']['text'] = __('Setup');
|
||||
$menu_godmode['gsetup']['sec2'] = 'general';
|
||||
$menu_godmode['gsetup']['id'] = 'god-setup';
|
||||
|
||||
$sub = [];
|
||||
|
||||
// Options Setup.
|
||||
$sub['general']['text'] = __('Setup');
|
||||
$sub['general']['id'] = 'Setup';
|
||||
$sub['general']['type'] = 'direct';
|
||||
$sub['general']['subtype'] = 'nolink';
|
||||
$sub2 = [];
|
||||
|
||||
$sub2['godmode/setup/setup§ion=general']['text'] = __('General Setup');
|
||||
$sub2['godmode/setup/setup§ion=general']['id'] = 'General Setup';
|
||||
$sub2['godmode/setup/setup§ion=general']['refr'] = 0;
|
||||
|
||||
enterprise_hook('password_submenu');
|
||||
enterprise_hook('enterprise_submenu');
|
||||
enterprise_hook('historydb_submenu');
|
||||
enterprise_hook('log_collector_submenu');
|
||||
|
||||
$sub2['godmode/setup/setup§ion=auth']['text'] = __('Authentication');
|
||||
$sub2['godmode/setup/setup§ion=auth']['refr'] = 0;
|
||||
|
||||
$sub2['godmode/setup/setup§ion=perf']['text'] = __('Performance');
|
||||
$sub2['godmode/setup/setup§ion=perf']['refr'] = 0;
|
||||
|
||||
$sub2['godmode/setup/setup§ion=vis']['text'] = __('Visual styles');
|
||||
$sub2['godmode/setup/setup§ion=vis']['refr'] = 0;
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||
// Netflow.
|
||||
if ((bool) $config['activate_netflow'] === true) {
|
||||
$sub2['godmode/setup/setup§ion=net']['text'] = __('Netflow');
|
||||
$sub2['godmode/setup/setup§ion=net']['refr'] = 0;
|
||||
$sub['godmode/netflow/nf_edit']['text'] = __('Netflow filters');
|
||||
$sub['godmode/netflow/nf_edit']['id'] = 'Netflow filters';
|
||||
}
|
||||
}
|
||||
|
||||
$sub2['godmode/setup/setup§ion=ehorus']['text'] = __('eHorus');
|
||||
$sub2['godmode/setup/setup§ion=ehorus']['refr'] = 0;
|
||||
|
||||
$sub2['godmode/setup/setup§ion=integria']['text'] = __('Integria IMS');
|
||||
$sub2['godmode/setup/setup§ion=integria']['refr'] = 0;
|
||||
|
||||
enterprise_hook('module_library_submenu');
|
||||
|
||||
$sub2['godmode/setup/setup§ion=notifications']['text'] = __('Notifications');
|
||||
$sub2['godmode/setup/setup§ion=notifications']['refr'] = 0;
|
||||
|
||||
$sub2['godmode/setup/setup§ion=websocket_engine']['text'] = __('Websocket Engine');
|
||||
$sub2['godmode/setup/setup§ion=websocket_engine']['refr'] = 0;
|
||||
|
||||
$sub2['godmode/setup/setup§ion=external_tools']['text'] = __('External Tools');
|
||||
$sub2['godmode/setup/setup§ion=external_tools']['refr'] = 0;
|
||||
|
||||
if ((bool) $config['activate_gis'] === true) {
|
||||
$sub2['godmode/setup/setup§ion=gis']['text'] = __('Map conections GIS');
|
||||
if (empty($sub) === false) {
|
||||
$menu_godmode['gagente']['text'] = __('Resources');
|
||||
$menu_godmode['gagente']['sec2'] = 'godmode/agentes/modificar_agente';
|
||||
$menu_godmode['gagente']['id'] = 'god-resources';
|
||||
$menu_godmode['gagente']['sub'] = $sub;
|
||||
}
|
||||
|
||||
$sub['general']['sub2'] = $sub2;
|
||||
$sub['godmode/setup/os']['text'] = __('Edit OS');
|
||||
$sub['godmode/setup/os']['id'] = 'Edit OS';
|
||||
$sub['godmode/setup/license']['text'] = __('License');
|
||||
$sub['godmode/setup/license']['id'] = 'License';
|
||||
$sub = [];
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
$sub['godmode/groups/group_list']['text'] = __('Manage agents groups');
|
||||
$sub['godmode/groups/group_list']['id'] = 'Manage agents groups';
|
||||
}
|
||||
|
||||
enterprise_hook('skins_submenu');
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
// Tag.
|
||||
$sub['godmode/tag/tag']['text'] = __('Module tags');
|
||||
$sub['godmode/tag/tag']['id'] = 'Module tags';
|
||||
$sub['godmode/tag/tag']['subsecs'] = 'godmode/tag/edit_tag';
|
||||
|
||||
$menu_godmode['gsetup']['sub'] = $sub;
|
||||
enterprise_hook('enterprise_acl_submenu');
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'UM') === true) {
|
||||
$sub['godmode/users/user_list']['text'] = __('Users management');
|
||||
$sub['godmode/users/user_list']['id'] = 'Users management';
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
$sub['godmode/users/profile_list']['text'] = __('Profile management');
|
||||
$sub['godmode/users/profile_list']['id'] = 'Profile management';
|
||||
}
|
||||
|
||||
if (empty($sub) === false) {
|
||||
$menu_godmode['gusuarios']['sub'] = $sub;
|
||||
$menu_godmode['gusuarios']['text'] = __('Profiles');
|
||||
$menu_godmode['gusuarios']['sec2'] = 'godmode/users/user_list';
|
||||
$menu_godmode['gusuarios']['id'] = 'god-users';
|
||||
}
|
||||
|
||||
$sub = [];
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
$sub['templates']['text'] = __('Templates');
|
||||
$sub['templates']['id'] = 'Templates';
|
||||
$sub['templates']['type'] = 'direct';
|
||||
$sub['templates']['subtype'] = 'nolink';
|
||||
$sub2 = [];
|
||||
$sub2['godmode/modules/manage_module_templates']['text'] = __('Module templates');
|
||||
$sub2['godmode/modules/manage_module_templates']['id'] = 'Module templates';
|
||||
$sub2['godmode/modules/private_enterprise_numbers']['text'] = __('Private Enterprise Numbers');
|
||||
$sub2['godmode/modules/private_enterprise_numbers']['id'] = 'Private Enterprise Numbers';
|
||||
$sub2['enterprise/godmode/modules/local_components']['text'] = __('Local components');
|
||||
$sub2['enterprise/godmode/modules/local_components']['id'] = 'Local components';
|
||||
$sub2['godmode/modules/manage_network_components']['text'] = __('Remote components');
|
||||
$sub2['godmode/modules/manage_network_components']['id'] = 'Network components';
|
||||
$sub['templates']['sub2'] = $sub2;
|
||||
|
||||
enterprise_hook('inventory_submenu');
|
||||
enterprise_hook('autoconfiguration_menu');
|
||||
enterprise_hook('agent_repository_menu');
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||
enterprise_hook('policies_menu');
|
||||
enterprise_hook('agents_submenu');
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'NW') === true) {
|
||||
enterprise_hook('agents_ncm_submenu');
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||
$sub['gmassive']['text'] = __('Bulk operations');
|
||||
$sub['gmassive']['id'] = 'Bulk operations';
|
||||
$sub['gmassive']['type'] = 'direct';
|
||||
$sub['gmassive']['subtype'] = 'nolink';
|
||||
$sub2 = [];
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_agents']['text'] = __('Agents operations');
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_modules']['text'] = __('Modules operations');
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_plugins']['text'] = __('Plugins operations');
|
||||
if ((bool) check_acl($config['id_user'], 0, 'UM') === true) {
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_users']['text'] = __('Users operations');
|
||||
}
|
||||
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_alerts']['text'] = __('Alerts operations');
|
||||
enterprise_hook('massivepolicies_submenu');
|
||||
enterprise_hook('massivesnmp_submenu');
|
||||
enterprise_hook('massivesatellite_submenu');
|
||||
|
||||
$sub['gmassive']['sub2'] = $sub2;
|
||||
$sub2 = [];
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'UM') === true) {
|
||||
$sub['godmode/groups/group_list&tab=credbox']['text'] = __('Credential store');
|
||||
$sub['godmode/groups/group_list&tab=credbox']['id'] = 'credential store';
|
||||
}
|
||||
|
||||
// Manage events.
|
||||
$sub2 = [];
|
||||
if ((bool) check_acl($config['id_user'], 0, 'EW') === true || (bool) check_acl($config['id_user'], 0, 'EM') === true) {
|
||||
// Custom event fields.
|
||||
$sub2['godmode/events/events§ion=filter']['text'] = __('Event filters');
|
||||
$sub2['godmode/events/events§ion=filter']['id'] = 'Event filters';
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
$sub2['godmode/events/events§ion=fields']['text'] = __('Custom columns');
|
||||
$sub2['godmode/events/events§ion=fields']['id'] = 'Custom events';
|
||||
$sub2['godmode/events/events§ion=responses']['text'] = __('Event responses');
|
||||
$sub2['godmode/events/events§ion=responses']['id'] = 'Event responses';
|
||||
}
|
||||
|
||||
if (empty($sub2) === false) {
|
||||
$sub['geventos']['text'] = __('Events');
|
||||
$sub['geventos']['id'] = 'events';
|
||||
$sub['geventos']['sec2'] = 'godmode/events/events§ion=filter';
|
||||
$sub['geventos']['type'] = 'direct';
|
||||
$sub['geventos']['subtype'] = 'nolink';
|
||||
$sub['geventos']['sub2'] = $sub2;
|
||||
}
|
||||
|
||||
if (empty($sub) === false) {
|
||||
$menu_godmode['gmodules']['text'] = __('Configuration');
|
||||
$menu_godmode['gmodules']['sec2'] = 'godmode/modules/manage_network_templates';
|
||||
$menu_godmode['gmodules']['id'] = 'god-configuration';
|
||||
$menu_godmode['gmodules']['sub'] = $sub;
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'LW') === true
|
||||
|| (bool) check_acl($config['id_user'], 0, 'LM') === true
|
||||
|| (bool) check_acl($config['id_user'], 0, 'AD') === true
|
||||
) {
|
||||
$menu_godmode['galertas']['text'] = __('Alerts');
|
||||
$menu_godmode['galertas']['sec2'] = 'godmode/alerts/alert_list';
|
||||
$menu_godmode['galertas']['id'] = 'god-alerts';
|
||||
|
||||
$sub = [];
|
||||
$sub['godmode/alerts/alert_list']['text'] = __('List of Alerts');
|
||||
$sub['godmode/alerts/alert_list']['id'] = 'List of Alerts';
|
||||
$sub['godmode/alerts/alert_list']['pages'] = ['godmode/alerts/alert_view'];
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
|
||||
$sub['godmode/alerts/alert_templates']['text'] = __('Templates');
|
||||
$sub['godmode/alerts/alert_templates']['id'] = 'Templates';
|
||||
$sub['godmode/alerts/alert_templates']['pages'] = ['godmode/alerts/configure_alert_template'];
|
||||
|
||||
$sub['godmode/alerts/alert_actions']['text'] = __('Actions');
|
||||
$sub['godmode/alerts/alert_actions']['id'] = 'Actions';
|
||||
$sub['godmode/alerts/alert_actions']['pages'] = ['godmode/alerts/configure_alert_action'];
|
||||
$sub['godmode/alerts/alert_commands']['text'] = __('Commands');
|
||||
$sub['godmode/alerts/alert_commands']['id'] = 'Commands';
|
||||
$sub['godmode/alerts/alert_commands']['pages'] = ['godmode/alerts/configure_alert_command'];
|
||||
$sub['godmode/alerts/alert_special_days']['text'] = __('Special days list');
|
||||
$sub['godmode/alerts/alert_special_days']['id'] = __('Special days list');
|
||||
$sub['godmode/alerts/alert_special_days']['pages'] = ['godmode/alerts/configure_alert_special_days'];
|
||||
|
||||
enterprise_hook('eventalerts_submenu');
|
||||
$sub['godmode/snmpconsole/snmp_alert']['text'] = __('SNMP alerts');
|
||||
$sub['godmode/snmpconsole/snmp_alert']['id'] = 'SNMP alerts';
|
||||
enterprise_hook('alert_inventory_submenu');
|
||||
}
|
||||
|
||||
$menu_godmode['galertas']['sub'] = $sub;
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true || (bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
// Servers.
|
||||
$menu_godmode['gservers']['text'] = __('Servers');
|
||||
$menu_godmode['gservers']['sec2'] = 'godmode/servers/modificar_server';
|
||||
$menu_godmode['gservers']['id'] = 'god-servers';
|
||||
|
||||
$sub = [];
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||
$sub['godmode/servers/modificar_server']['text'] = __('Manage servers');
|
||||
$sub['godmode/servers/modificar_server']['id'] = 'Manage servers';
|
||||
}
|
||||
|
||||
// This subtabs are only for Pandora Admin.
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
enterprise_hook('ha_cluster');
|
||||
|
||||
$sub['godmode/servers/plugin']['text'] = __('Plugins');
|
||||
$sub['godmode/servers/plugin']['id'] = 'Plugins';
|
||||
|
||||
$sub['godmode/servers/plugin_registration']['text'] = __('Register Plugin');
|
||||
$sub['godmode/servers/plugin_registration']['id'] = 'register_plugin';
|
||||
|
||||
enterprise_hook('export_target_submenu');
|
||||
|
||||
enterprise_hook('manage_satellite_submenu');
|
||||
}
|
||||
|
||||
$menu_godmode['gservers']['sub'] = $sub;
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
// Setup.
|
||||
$menu_godmode['gsetup']['text'] = __('Setup');
|
||||
$menu_godmode['gsetup']['sec2'] = 'general';
|
||||
$menu_godmode['gsetup']['id'] = 'god-setup';
|
||||
|
||||
$sub = [];
|
||||
|
||||
// Options Setup.
|
||||
$sub['general']['text'] = __('Setup');
|
||||
$sub['general']['id'] = 'Setup';
|
||||
$sub['general']['type'] = 'direct';
|
||||
$sub['general']['subtype'] = 'nolink';
|
||||
$sub2 = [];
|
||||
|
||||
$sub2['godmode/setup/setup§ion=general']['text'] = __('General Setup');
|
||||
$sub2['godmode/setup/setup§ion=general']['id'] = 'General Setup';
|
||||
$sub2['godmode/setup/setup§ion=general']['refr'] = 0;
|
||||
|
||||
enterprise_hook('password_submenu');
|
||||
enterprise_hook('enterprise_submenu');
|
||||
enterprise_hook('historydb_submenu');
|
||||
enterprise_hook('log_collector_submenu');
|
||||
|
||||
$sub2['godmode/setup/setup§ion=auth']['text'] = __('Authentication');
|
||||
$sub2['godmode/setup/setup§ion=auth']['refr'] = 0;
|
||||
|
||||
$sub2['godmode/setup/setup§ion=perf']['text'] = __('Performance');
|
||||
$sub2['godmode/setup/setup§ion=perf']['refr'] = 0;
|
||||
|
||||
$sub2['godmode/setup/setup§ion=vis']['text'] = __('Visual styles');
|
||||
$sub2['godmode/setup/setup§ion=vis']['refr'] = 0;
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||
if ((bool) $config['activate_netflow'] === true) {
|
||||
$sub2['godmode/setup/setup§ion=net']['text'] = __('Netflow');
|
||||
$sub2['godmode/setup/setup§ion=net']['refr'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$sub2['godmode/setup/setup§ion=ehorus']['text'] = __('eHorus');
|
||||
$sub2['godmode/setup/setup§ion=ehorus']['refr'] = 0;
|
||||
|
||||
$sub2['godmode/setup/setup§ion=integria']['text'] = __('Integria IMS');
|
||||
$sub2['godmode/setup/setup§ion=integria']['refr'] = 0;
|
||||
|
||||
enterprise_hook('module_library_submenu');
|
||||
|
||||
$sub2['godmode/setup/setup§ion=notifications']['text'] = __('Notifications');
|
||||
$sub2['godmode/setup/setup§ion=notifications']['refr'] = 0;
|
||||
|
||||
$sub2['godmode/setup/setup§ion=websocket_engine']['text'] = __('Websocket Engine');
|
||||
$sub2['godmode/setup/setup§ion=websocket_engine']['refr'] = 0;
|
||||
|
||||
$sub2['godmode/setup/setup§ion=external_tools']['text'] = __('External Tools');
|
||||
$sub2['godmode/setup/setup§ion=external_tools']['refr'] = 0;
|
||||
|
||||
if ((bool) $config['activate_gis'] === true) {
|
||||
$sub2['godmode/setup/setup§ion=gis']['text'] = __('Map conections GIS');
|
||||
}
|
||||
|
||||
$sub['general']['sub2'] = $sub2;
|
||||
$sub['godmode/setup/license']['text'] = __('License');
|
||||
$sub['godmode/setup/license']['id'] = 'License';
|
||||
|
||||
enterprise_hook('skins_submenu');
|
||||
|
||||
$menu_godmode['gsetup']['sub'] = $sub;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true) {
|
||||
$menu_godmode['gextensions']['text'] = __('Admin tools');
|
||||
$menu_godmode['gextensions']['sec2'] = 'godmode/extensions';
|
||||
|
@ -391,142 +400,148 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($
|
|||
$sub = [];
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
// Audit //meter en extensiones.
|
||||
$sub['godmode/audit_log']['text'] = __('System audit log');
|
||||
$sub['godmode/audit_log']['id'] = 'System audit log';
|
||||
$sub['godmode/setup/links']['text'] = __('Links');
|
||||
$sub['godmode/setup/links']['id'] = 'Links';
|
||||
$sub['tools/diagnostics']['text'] = __('Diagnostic info');
|
||||
$sub['tools/diagnostics']['id'] = 'Diagnostic info';
|
||||
enterprise_hook('omnishell');
|
||||
enterprise_hook('ipam_submenu');
|
||||
if ($access_console_node === true) {
|
||||
// Audit //meter en extensiones.
|
||||
$sub['godmode/audit_log']['text'] = __('System audit log');
|
||||
$sub['godmode/audit_log']['id'] = 'System audit log';
|
||||
$sub['godmode/setup/links']['text'] = __('Links');
|
||||
$sub['godmode/setup/links']['id'] = 'Links';
|
||||
$sub['tools/diagnostics']['text'] = __('Diagnostic info');
|
||||
$sub['tools/diagnostics']['id'] = 'Diagnostic info';
|
||||
enterprise_hook('omnishell');
|
||||
enterprise_hook('ipam_submenu');
|
||||
|
||||
$sub['godmode/setup/news']['text'] = __('Site news');
|
||||
$sub['godmode/setup/news']['id'] = 'Site news';
|
||||
}
|
||||
|
||||
$sub['godmode/setup/news']['text'] = __('Site news');
|
||||
$sub['godmode/setup/news']['id'] = 'Site news';
|
||||
$sub['godmode/setup/file_manager']['text'] = __('File manager');
|
||||
$sub['godmode/setup/file_manager']['id'] = 'File manager';
|
||||
|
||||
if (is_user_admin($config['id_user']) === true) {
|
||||
$sub['extensions/db_status']['text'] = __('DB Schema Check');
|
||||
$sub['extensions/db_status']['id'] = 'DB Schema Check';
|
||||
$sub['extensions/db_status']['sec'] = 'gbman';
|
||||
$sub['extensions/dbmanager']['text'] = __('DB Interface');
|
||||
$sub['extensions/dbmanager']['id'] = 'DB Interface';
|
||||
$sub['extensions/dbmanager']['sec'] = 'gbman';
|
||||
enterprise_hook('dbBackupManager');
|
||||
enterprise_hook('elasticsearch_interface_menu');
|
||||
if ($access_console_node === true) {
|
||||
if (is_user_admin($config['id_user']) === true) {
|
||||
$sub['extensions/db_status']['text'] = __('DB Schema Check');
|
||||
$sub['extensions/db_status']['id'] = 'DB Schema Check';
|
||||
$sub['extensions/db_status']['sec'] = 'gbman';
|
||||
$sub['extensions/dbmanager']['text'] = __('DB Interface');
|
||||
$sub['extensions/dbmanager']['id'] = 'DB Interface';
|
||||
$sub['extensions/dbmanager']['sec'] = 'gbman';
|
||||
enterprise_hook('dbBackupManager');
|
||||
enterprise_hook('elasticsearch_interface_menu');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$menu_godmode['gextensions']['sub'] = $sub;
|
||||
}
|
||||
|
||||
if (is_array($config['extensions']) === true) {
|
||||
$sub = [];
|
||||
$sub2 = [];
|
||||
if ($access_console_node === true) {
|
||||
if (is_array($config['extensions']) === true) {
|
||||
$sub = [];
|
||||
$sub2 = [];
|
||||
|
||||
foreach ($config['extensions'] as $extension) {
|
||||
// If no godmode_menu is a operation extension.
|
||||
if (empty($extension['godmode_menu']) === true) {
|
||||
continue;
|
||||
}
|
||||
foreach ($config['extensions'] as $extension) {
|
||||
// If no godmode_menu is a operation extension.
|
||||
if (empty($extension['godmode_menu']) === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($extension['godmode_menu']['name'] === 'System Info') {
|
||||
continue;
|
||||
}
|
||||
if ($extension['godmode_menu']['name'] === 'System Info') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($extension['godmode_menu']['name'] !== __('DB Schema check') && $extension['godmode_menu']['name'] !== __('DB interface')) {
|
||||
$extmenu = $extension['godmode_menu'];
|
||||
}
|
||||
if ($extension['godmode_menu']['name'] !== __('DB Schema check') && $extension['godmode_menu']['name'] !== __('DB interface')) {
|
||||
$extmenu = $extension['godmode_menu'];
|
||||
}
|
||||
|
||||
// Check the ACL for this user.
|
||||
if ((bool) check_acl($config['id_user'], 0, $extmenu['acl']) === false) {
|
||||
continue;
|
||||
}
|
||||
// Check the ACL for this user.
|
||||
if ((bool) check_acl($config['id_user'], 0, $extmenu['acl']) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if was displayed inside other menu.
|
||||
if (empty($extension['godmode_menu']['fatherId']) === true) {
|
||||
$sub2[$extmenu['sec2']]['text'] = __($extmenu['name']);
|
||||
$sub2[$extmenu['sec2']]['id'] = $extmenu['name'];
|
||||
$sub2[$extmenu['sec2']]['refr'] = 0;
|
||||
} else {
|
||||
if (is_array($extmenu) === true && array_key_exists('fatherId', $extmenu) === true) {
|
||||
if (strlen($extmenu['fatherId']) > 0) {
|
||||
if (array_key_exists('subfatherId', $extmenu) === true) {
|
||||
if (strlen($extmenu['subfatherId']) > 0) {
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['text'] = __($extmenu['name']);
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['id'] = $extmenu['name'];
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['refr'] = 0;
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['icon'] = $extmenu['icon'];
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['sec'] = 'extensions';
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['extension'] = true;
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['enterprise'] = $extension['enterprise'];
|
||||
$menu_godmode[$extmenu['fatherId']]['hasExtensions'] = true;
|
||||
// Check if was displayed inside other menu.
|
||||
if (empty($extension['godmode_menu']['fatherId']) === true) {
|
||||
$sub2[$extmenu['sec2']]['text'] = __($extmenu['name']);
|
||||
$sub2[$extmenu['sec2']]['id'] = $extmenu['name'];
|
||||
$sub2[$extmenu['sec2']]['refr'] = 0;
|
||||
} else {
|
||||
if (is_array($extmenu) === true && array_key_exists('fatherId', $extmenu) === true) {
|
||||
if (strlen($extmenu['fatherId']) > 0) {
|
||||
if (array_key_exists('subfatherId', $extmenu) === true) {
|
||||
if (strlen($extmenu['subfatherId']) > 0) {
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['text'] = __($extmenu['name']);
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['id'] = $extmenu['name'];
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['refr'] = 0;
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['icon'] = $extmenu['icon'];
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['sec'] = 'extensions';
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['extension'] = true;
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['enterprise'] = $extension['enterprise'];
|
||||
$menu_godmode[$extmenu['fatherId']]['hasExtensions'] = true;
|
||||
} else {
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['text'] = __($extmenu['name']);
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['id'] = $extmenu['name'];
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['refr'] = 0;
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['icon'] = $extmenu['icon'];
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = $extmenu['fatherId'];
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['extension'] = true;
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['enterprise'] = $extension['enterprise'];
|
||||
$menu_godmode[$extmenu['fatherId']]['hasExtensions'] = true;
|
||||
}
|
||||
} else {
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['text'] = __($extmenu['name']);
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['id'] = $extmenu['name'];
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['refr'] = 0;
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['icon'] = $extmenu['icon'];
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = $extmenu['fatherId'];
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = 'gextensions';
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['extension'] = true;
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['enterprise'] = $extension['enterprise'];
|
||||
$menu_godmode[$extmenu['fatherId']]['hasExtensions'] = true;
|
||||
}
|
||||
} else {
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['text'] = __($extmenu['name']);
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['id'] = $extmenu['name'];
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['refr'] = 0;
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['icon'] = $extmenu['icon'];
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = 'gextensions';
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['extension'] = true;
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['enterprise'] = $extension['enterprise'];
|
||||
$menu_godmode[$extmenu['fatherId']]['hasExtensions'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Complete the submenu.
|
||||
$extension_view = [];
|
||||
$extension_view['godmode/extensions']['id'] = 'Extension manager view';
|
||||
$extension_view['godmode/extensions']['text'] = __('Extension manager view');
|
||||
$extension_submenu = array_merge($extension_view, $sub2);
|
||||
// Complete the submenu.
|
||||
$extension_view = [];
|
||||
$extension_view['godmode/extensions']['id'] = 'Extension manager view';
|
||||
$extension_view['godmode/extensions']['text'] = __('Extension manager view');
|
||||
$extension_submenu = array_merge($extension_view, $sub2);
|
||||
|
||||
$sub['godmode/extensions']['sub2'] = $extension_submenu;
|
||||
$sub['godmode/extensions']['text'] = __('Extension manager');
|
||||
$sub['godmode/extensions']['id'] = 'Extension manager';
|
||||
$sub['godmode/extensions']['type'] = 'direct';
|
||||
$sub['godmode/extensions']['subtype'] = 'nolink';
|
||||
$sub['godmode/extensions']['sub2'] = $extension_submenu;
|
||||
$sub['godmode/extensions']['text'] = __('Extension manager');
|
||||
$sub['godmode/extensions']['id'] = 'Extension manager';
|
||||
$sub['godmode/extensions']['type'] = 'direct';
|
||||
$sub['godmode/extensions']['subtype'] = 'nolink';
|
||||
|
||||
if (is_array($menu_godmode['gextensions']['sub']) === true) {
|
||||
$submenu = array_merge($menu_godmode['gextensions']['sub'], $sub);
|
||||
if ($menu_godmode['gextensions']['sub'] != null) {
|
||||
$menu_godmode['gextensions']['sub'] = $submenu;
|
||||
if (is_array($menu_godmode['gextensions']['sub']) === true) {
|
||||
$submenu = array_merge($menu_godmode['gextensions']['sub'], $sub);
|
||||
if ($menu_godmode['gextensions']['sub'] != null) {
|
||||
$menu_godmode['gextensions']['sub'] = $submenu;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$menu_godmode['links']['text'] = __('Links');
|
||||
$menu_godmode['links']['sec2'] = '';
|
||||
$menu_godmode['links']['id'] = 'god-links';
|
||||
|
||||
$sub = [];
|
||||
$rows = db_get_all_rows_in_table('tlink', 'name');
|
||||
foreach ($rows as $row) {
|
||||
// Audit //meter en extensiones.
|
||||
$sub[$row['link']]['text'] = $row['name'];
|
||||
$sub[$row['link']]['id'] = $row['name'];
|
||||
$sub[$row['link']]['type'] = 'direct';
|
||||
$sub[$row['link']]['subtype'] = 'new_blank';
|
||||
}
|
||||
|
||||
$menu_godmode['links']['sub'] = $sub;
|
||||
}
|
||||
|
||||
$menu_godmode['links']['text'] = __('Links');
|
||||
$menu_godmode['links']['sec2'] = '';
|
||||
$menu_godmode['links']['id'] = 'god-links';
|
||||
|
||||
$sub = [];
|
||||
$rows = db_get_all_rows_in_table('tlink', 'name');
|
||||
foreach ($rows as $row) {
|
||||
// Audit //meter en extensiones.
|
||||
$sub[$row['link']]['text'] = $row['name'];
|
||||
$sub[$row['link']]['id'] = $row['name'];
|
||||
$sub[$row['link']]['type'] = 'direct';
|
||||
$sub[$row['link']]['subtype'] = 'new_blank';
|
||||
}
|
||||
|
||||
$menu_godmode['links']['sub'] = $sub;
|
||||
|
||||
// Warp Manager.
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true && (bool) $config['enable_update_manager'] === true) {
|
||||
$menu_godmode['messages']['text'] = __('Warp Update');
|
||||
;
|
||||
$menu_godmode['messages']['id'] = 'god-um_messages';
|
||||
$menu_godmode['messages']['sec2'] = '';
|
||||
|
||||
|
@ -546,19 +561,21 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true && (bool) $config['en
|
|||
$menu_godmode['messages']['sub'] = $sub;
|
||||
}
|
||||
|
||||
// Module library.
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AR') === true) {
|
||||
$menu_godmode['gmodule_library']['text'] = __('Module library');
|
||||
$menu_godmode['gmodule_library']['id'] = 'god-module_library';
|
||||
if ($access_console_node === true) {
|
||||
// Module library.
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AR') === true) {
|
||||
$menu_godmode['gmodule_library']['text'] = __('Module library');
|
||||
$menu_godmode['gmodule_library']['id'] = 'god-module_library';
|
||||
|
||||
$sub = [];
|
||||
$sub['godmode/module_library/module_library_view']['text'] = __('View');
|
||||
$sub['godmode/module_library/module_library_view']['id'] = 'View';
|
||||
$sub = [];
|
||||
$sub['godmode/module_library/module_library_view']['text'] = __('View');
|
||||
$sub['godmode/module_library/module_library_view']['id'] = 'View';
|
||||
|
||||
$sub['godmode/module_library/module_library_view&tab=categories']['text'] = __('Categories');
|
||||
$sub['godmode/module_library/module_library_view&tab=categories']['id'] = 'categories';
|
||||
$sub['godmode/module_library/module_library_view&tab=categories']['text'] = __('Categories');
|
||||
$sub['godmode/module_library/module_library_view&tab=categories']['id'] = 'categories';
|
||||
|
||||
$menu_godmode['gmodule_library']['sub'] = $sub;
|
||||
$menu_godmode['gmodule_library']['sub'] = $sub;
|
||||
}
|
||||
}
|
||||
|
||||
if ((bool) $config['pure'] === false) {
|
||||
|
|
|
@ -78,6 +78,14 @@ $agents_inventory_display_options['estado'] = __('Status');
|
|||
$agents_inventory_display_options['agent_version'] = __('Version');
|
||||
$agents_inventory_display_options['remote'] = __('Remote configuration');
|
||||
|
||||
// Modules inventory display options.
|
||||
$modules_inventory_display_options = [];
|
||||
$modules_inventory_display_options['alias'] = __('Name');
|
||||
$modules_inventory_display_options['direccion'] = __('Description');
|
||||
$modules_inventory_display_options['id_os'] = __('Tags');
|
||||
$modules_inventory_display_options['id_grupo'] = __('Module groups');
|
||||
$modules_inventory_display_options['secondary_groups'] = __('Group');
|
||||
|
||||
enterprise_include('/godmode/reporting/reporting_builder.item_editor.php');
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
if (enterprise_include_once('include/functions_metaconsole.php')) {
|
||||
|
@ -901,6 +909,14 @@ switch ($action) {
|
|||
$idAgentModule = $inventory_modules;
|
||||
break;
|
||||
|
||||
case 'modules_inventory':
|
||||
$description = $item['description'];
|
||||
$es = json_decode($item['external_source'], true);
|
||||
|
||||
$selected_agent_group_filter = $es['agent_group_filter'];
|
||||
$selected_module_group = $es['module_group'];
|
||||
break;
|
||||
|
||||
case 'inventory':
|
||||
$description = $item['description'];
|
||||
$es = json_decode($item['external_source'], true);
|
||||
|
@ -3644,7 +3660,22 @@ $class = 'databox filters';
|
|||
true,
|
||||
'agent_group_filter',
|
||||
$selected_agent_group_filter,
|
||||
''
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'id_grupo',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
120
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
|
@ -3820,6 +3851,48 @@ $class = 'databox filters';
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_module_group_filter" class="datos">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
echo __('Module group filter');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
$rows_select = [];
|
||||
$rows_select[0] = __('Not assigned');
|
||||
if ($is_metaconsole === false) {
|
||||
$rows = db_get_all_rows_sql(
|
||||
'SELECT * FROM tmodule_group ORDER BY name'
|
||||
);
|
||||
$rows = io_safe_output($rows);
|
||||
if (empty($rows) === false) {
|
||||
foreach ($rows as $module_group) {
|
||||
$rows_select[$module_group['id_mg']] = $module_group['name'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$rows_select = modules_get_modulegroups();
|
||||
}
|
||||
|
||||
html_print_select($rows_select, 'modulegroup', $modulegroup, '', __($is_none), -1, true, false, true, '', false, 'width: 120px;');
|
||||
html_print_select(
|
||||
$rows_select,
|
||||
'module_group',
|
||||
$selected_module_group,
|
||||
'',
|
||||
__('All'),
|
||||
-1,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 120px;'
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -6139,6 +6212,8 @@ function chooseType() {
|
|||
$("#row_agents_inventory_display_options").hide();
|
||||
$("#row_agent_server_filter").hide();
|
||||
$("#row_agent_group_filter").hide();
|
||||
$("#row_module_group_filter").hide();
|
||||
$("#row_module_group_filter").hide();
|
||||
$("#row_os").hide();
|
||||
$("#row_custom_field_filter").hide();
|
||||
$("#row_custom_field").hide();
|
||||
|
@ -6768,6 +6843,14 @@ function chooseType() {
|
|||
|
||||
break;
|
||||
|
||||
case 'modules_inventory':
|
||||
$("#row_group").show();
|
||||
$("#row_agent_server_filter").show();
|
||||
$("#row_agent_group_filter").show();
|
||||
$("#row_module_group_filter").show();
|
||||
|
||||
break;
|
||||
|
||||
case 'inventory':
|
||||
$("#row_description").show();
|
||||
$("#row_group").show();
|
||||
|
|
|
@ -2313,6 +2313,14 @@ switch ($action) {
|
|||
$values['external_source'] = json_encode($es);
|
||||
break;
|
||||
|
||||
case 'modules_inventory':
|
||||
$es['agent_server_filter'] = get_parameter('agent_server_filter');
|
||||
$es['module_group'] = get_parameter('module_group');
|
||||
$es['agent_group_filter'] = get_parameter('agent_group_filter');
|
||||
|
||||
$values['external_source'] = json_encode($es);
|
||||
break;
|
||||
|
||||
case 'IPAM_network':
|
||||
$es['network_filter'] = get_parameter('network_filter');
|
||||
$es['alive_ip'] = get_parameter('alive_ip');
|
||||
|
@ -3081,6 +3089,14 @@ switch ($action) {
|
|||
$values['external_source'] = json_encode($es);
|
||||
break;
|
||||
|
||||
case 'modules_inventory':
|
||||
$es['agent_server_filter'] = get_parameter('agent_server_filter');
|
||||
$es['module_group'] = get_parameter('module_group');
|
||||
$es['agent_group_filter'] = get_parameter('agent_group_filter');
|
||||
|
||||
$values['external_source'] = json_encode($es);
|
||||
break;
|
||||
|
||||
case 'IPAM_network':
|
||||
$es['network_filter'] = get_parameter('network_filter');
|
||||
$es['alive_ip'] = get_parameter('alive_ip');
|
||||
|
|
|
@ -833,23 +833,21 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
|
|||
|
||||
var added_config = {
|
||||
"selector": "#tinyMCE_editor",
|
||||
"elements": "text-label",
|
||||
"elements": "tinyMCE_editor",
|
||||
"plugins": "noneditable",
|
||||
"theme_advanced_buttons1":
|
||||
"bold,italic,|,justifyleft,justifycenter,justifyright,|,undo,redo,|,image,link,|,fontselect,|,forecolor,fontsizeselect,|,code",
|
||||
"theme_advanced_buttons1": "bold,italic,|,justifyleft,justifycenter,justifyright,|,undo,redo,|,image,link,|,fontselect,|,forecolor,fontsizeselect,|,code",
|
||||
"valid_children": "+body[style]",
|
||||
"theme_advanced_font_sizes": "true",
|
||||
"content_css":
|
||||
<?php echo '"'.ui_get_full_url('include/styles/pandora.css', false, false, false).'"'; ?>,
|
||||
"content_css": <?php echo '"'.ui_get_full_url('include/styles/pandora.css', false, false, false).'"'; ?>,
|
||||
"editor_deselector": "noselected",
|
||||
"inline_styles": true,
|
||||
"nowrap": true,
|
||||
"width": "400",
|
||||
"height": "200",
|
||||
}
|
||||
|
||||
defineTinyMCE(added_config);
|
||||
|
||||
"body_class": "tinyMCEBody",
|
||||
}
|
||||
|
||||
defineTinyMCE(added_config);
|
||||
$("#dialog_label_editor").hide ()
|
||||
.dialog ({
|
||||
title: "<?php echo __('Edit label'); ?>",
|
||||
|
@ -860,38 +858,33 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
|
|||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 450,
|
||||
width: 530,
|
||||
height: 300,
|
||||
autoOpen: false,
|
||||
beforeClose: function() {
|
||||
var id_layout_data = $("#active_id_layout_data").val();
|
||||
var label = tinyMCE.activeEditor.getContent();
|
||||
|
||||
$("#hidden-label_" + id_layout_data).val(label);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var idText = $("#ip_text").html();
|
||||
});
|
||||
|
||||
var idText = $("#ip_text").html();
|
||||
|
||||
|
||||
function show_dialog_label_editor(id_layout_data) {
|
||||
var label = $("#hidden-label_" + id_layout_data).val();
|
||||
|
||||
$("#active_id_layout_data").val(id_layout_data);
|
||||
|
||||
$("#tinyMCE_editor").val(label);
|
||||
tinyMCE.activeEditor.setContent(label);
|
||||
$("#dialog_label_editor").dialog("open");
|
||||
}
|
||||
|
||||
|
||||
function toggle_checkbox_multiple_delete() {
|
||||
checked_head_multiple = $("input[name='head_multiple_delete']")
|
||||
.is(":checked");
|
||||
|
||||
$("input[name='multiple_delete_items']")
|
||||
.prop("checked", checked_head_multiple);
|
||||
}
|
||||
|
||||
|
||||
function submit_delete_multiple_items() {
|
||||
delete_items = [];
|
||||
jQuery.each($("input[name='multiple_delete_items']:checked"),
|
||||
|
@ -899,8 +892,7 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
|
|||
delete_items.push($(item).val());
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
$("input[name='id_item_json']").val(JSON.stringify(delete_items));
|
||||
$("#form_multiple_delete").submit();
|
||||
}
|
||||
|
|
|
@ -158,6 +158,12 @@ if ($classname_selected === null) {
|
|||
// Load classes and print selector.
|
||||
$wiz_data = [];
|
||||
foreach ($classes as $classpath) {
|
||||
if (is_reporting_console_node() === true) {
|
||||
if ($classpath !== '/var/www/html/pandora_console/godmode/wizards/DiscoveryTaskList.class.php') {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$classname = basename($classpath, '.class.php');
|
||||
$obj = new $classname();
|
||||
|
||||
|
|
|
@ -122,26 +122,44 @@ if (isset($_GET['server'])) {
|
|||
|
||||
$buttons = '';
|
||||
|
||||
if ($server_type !== 13) {
|
||||
// Buttons.
|
||||
$buttons = [
|
||||
'standard_editor' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$id_server.'&ext='.$ext.'&tab=standard_editor&pure='.$pure.'">'.html_print_image('images/list.png', true, ['title' => __('Standard editor')]).'</a>',
|
||||
],
|
||||
'advanced_editor' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$id_server.'&ext='.$ext.'&tab=advanced_editor&pure='.$pure.'">'.html_print_image('images/pen.png', true, ['title' => __('Advanced editor')]).'</a>',
|
||||
],
|
||||
];
|
||||
// Buttons.
|
||||
$buttons = [
|
||||
'standard_editor' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$id_server.'&ext='.$ext.'&tab=standard_editor&pure='.$pure.'">'.html_print_image('images/list.png', true, ['title' => __('Standard editor')]).'</a>',
|
||||
],
|
||||
'advanced_editor' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$id_server.'&ext='.$ext.'&tab=advanced_editor&pure='.$pure.'">'.html_print_image('images/pen.png', true, ['title' => __('Advanced editor')]).'</a>',
|
||||
],
|
||||
];
|
||||
|
||||
$buttons[$tab]['active'] = true;
|
||||
if ($server_type === SERVER_TYPE_ENTERPRISE_SATELLITE) {
|
||||
$buttons['agent_editor'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$id_server.'&ext='.$ext.'&tab=agent_editor&pure='.$pure.'">'.html_print_image('images/agent.png', true, ['title' => __('Advanced editor')]).'</a>',
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
$buttons[$tab]['active'] = true;
|
||||
|
||||
ui_print_page_header(__('Remote Configuration'), 'images/gm_servers.png', false, 'servers', true, $buttons);
|
||||
|
||||
if ($server_type !== 13 && $tab == 'standard_editor') {
|
||||
if ($tab === 'standard_editor') {
|
||||
$advanced_editor = false;
|
||||
|
||||
if ($server_type === 13) {
|
||||
echo "<table cellpadding='4' cellspacing='4' class='databox filters font_bold margin-bottom-10' width='100%'>
|
||||
<tr>";
|
||||
echo '<td class="w100p">';
|
||||
echo __('Dynamic search').' ';
|
||||
html_print_input_text('search_config_token', $search, '', 12);
|
||||
echo '</td>';
|
||||
echo '</tr></table>';
|
||||
}
|
||||
} else if ($tab === 'agent_editor' && $server_type === SERVER_TYPE_ENTERPRISE_SATELLITE) {
|
||||
$advanced_editor = 'agent_editor';
|
||||
}
|
||||
|
||||
enterprise_include('godmode/servers/server_disk_conf_editor.php');
|
||||
|
|
|
@ -208,7 +208,7 @@ if ($is_management_allowed === true) {
|
|||
|
||||
$buttons[$tab]['active'] = true;
|
||||
|
||||
$headerTitle = ($tab === 'builder') ? __('Edit OS') : __('List of OS');
|
||||
$headerTitle = ($tab === 'builder') ? __('Edit OS') : __('List of Operating Systems');
|
||||
|
||||
if (is_metaconsole() === false) {
|
||||
// Header.
|
||||
|
|
|
@ -340,8 +340,19 @@ $table->data[8][1] = html_print_input_text(
|
|||
true
|
||||
);
|
||||
|
||||
$table->data[9][0] = __('Max. days before delete autodisabled agents');
|
||||
|
||||
$table->data[9][0] = __('Max. days before delete not initialized modules');
|
||||
$table->data[9][1] = html_print_input_text(
|
||||
'days_delete_not_initialized',
|
||||
$config['days_delete_not_initialized'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[10][0] = __('Max. days before delete autodisabled agents');
|
||||
$table->data[10][1] = html_print_input_text(
|
||||
'days_autodisable_deletion',
|
||||
$config['days_autodisable_deletion'],
|
||||
'',
|
||||
|
@ -350,8 +361,8 @@ $table->data[9][1] = html_print_input_text(
|
|||
true
|
||||
);
|
||||
|
||||
$table->data[10][0] = __('Retention period of past special days');
|
||||
$table->data[10][1] = html_print_input_text(
|
||||
$table->data[11][0] = __('Retention period of past special days');
|
||||
$table->data[11][1] = html_print_input_text(
|
||||
'num_past_special_days',
|
||||
$config['num_past_special_days'],
|
||||
'',
|
||||
|
@ -360,8 +371,8 @@ $table->data[10][1] = html_print_input_text(
|
|||
true
|
||||
);
|
||||
|
||||
$table->data[11][0] = __('Max. macro data fields');
|
||||
$table->data[11][1] = html_print_input_text(
|
||||
$table->data[12][0] = __('Max. macro data fields');
|
||||
$table->data[12][1] = html_print_input_text(
|
||||
'max_macro_fields',
|
||||
$config['max_macro_fields'],
|
||||
'',
|
||||
|
@ -374,8 +385,8 @@ $table->data[11][1] = html_print_input_text(
|
|||
);
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$table->data[12][0] = __('Max. days before delete inventory data');
|
||||
$table->data[12][1] = html_print_input_text(
|
||||
$table->data[13][0] = __('Max. days before delete inventory data');
|
||||
$table->data[13][1] = html_print_input_text(
|
||||
'inventory_purge',
|
||||
$config['inventory_purge'],
|
||||
'',
|
||||
|
|
|
@ -324,7 +324,7 @@ switch ($section) {
|
|||
}
|
||||
|
||||
// Put header inside div for special sizing.(No right margin).
|
||||
echo '<div id="header_configuration" style="width: calc(100% + 3em);">';
|
||||
echo '<div id="header_configuration" style="width: calc(100%);">';
|
||||
// Header.
|
||||
ui_print_page_header(
|
||||
__('Configuration').$subpage,
|
||||
|
|
|
@ -497,6 +497,17 @@ $table->data[$i++][1] = html_print_checkbox_switch(
|
|||
true
|
||||
);
|
||||
|
||||
$table->data[$i][0] = __('Enable console report').ui_print_help_tip(
|
||||
__('Enable console report'),
|
||||
true
|
||||
);
|
||||
$table->data[$i++][1] = html_print_checkbox_switch(
|
||||
'reporting_console_enable',
|
||||
1,
|
||||
$config['reporting_console_enable'],
|
||||
true
|
||||
);
|
||||
|
||||
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=general&pure='.$config['pure'].'">';
|
||||
|
||||
echo '<fieldset>';
|
||||
|
|
|
@ -162,7 +162,9 @@ class DiscoveryTaskList extends HTML
|
|||
$ret = false;
|
||||
}
|
||||
|
||||
$ret2 = $this->showList();
|
||||
if (is_reporting_console_node() === false) {
|
||||
$ret2 = $this->showList();
|
||||
}
|
||||
|
||||
if ($ret === false && $ret2 === false) {
|
||||
include_once $config['homedir'].'/general/first_task/recon_view.php';
|
||||
|
|
|
@ -90,6 +90,7 @@ $node_id = (int) get_parameter('node_id', 0);
|
|||
|
||||
if ($get_comments === true) {
|
||||
$event = get_parameter('event', false);
|
||||
$event_rep = get_parameter('event_rep', false);
|
||||
if ($event === false) {
|
||||
return __('Failed to retrieve comments');
|
||||
}
|
||||
|
@ -97,27 +98,29 @@ if ($get_comments === true) {
|
|||
$eventsGrouped = [];
|
||||
// Consider if the event is grouped.
|
||||
$whereGrouped = '1=1';
|
||||
// Default grouped message filtering (evento and estado).
|
||||
$whereGrouped = sprintf(
|
||||
'`evento` = "%s" AND `estado` = "%s" AND `event_type` = "%s" ',
|
||||
$event['evento'],
|
||||
$event['estado'],
|
||||
$event['event_type']
|
||||
);
|
||||
|
||||
// If id_agente is reported, filter the messages by them as well.
|
||||
if ((int) $event['id_agente'] > 0) {
|
||||
$whereGrouped .= sprintf(
|
||||
' AND `id_agente` = %d',
|
||||
(int) $event['id_agente']
|
||||
if (isset($event_rep) === true && $event_rep > 0) {
|
||||
// Default grouped message filtering (evento and estado).
|
||||
$whereGrouped = sprintf(
|
||||
'`evento` = "%s"',
|
||||
$event['evento']
|
||||
);
|
||||
}
|
||||
|
||||
if ((int) $event['id_agentmodule'] > 0) {
|
||||
$whereGrouped .= sprintf(
|
||||
' AND `id_agentmodule` = %d',
|
||||
(int) $event['id_agentmodule']
|
||||
);
|
||||
// If id_agente is reported, filter the messages by them as well.
|
||||
if ((int) $event['id_agente'] > 0) {
|
||||
$whereGrouped .= sprintf(
|
||||
' AND `id_agente` = %d',
|
||||
(int) $event['id_agente']
|
||||
);
|
||||
}
|
||||
|
||||
if ((int) $event['id_agentmodule'] > 0) {
|
||||
$whereGrouped .= sprintf(
|
||||
' AND `id_agentmodule` = %d',
|
||||
(int) $event['id_agentmodule']
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$whereGrouped = sprintf('`id_evento` = %d', $event['id_evento']);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -774,7 +777,7 @@ if ($save_filter_modal) {
|
|||
|
||||
$data[1] .= html_print_select(
|
||||
$user_groups_array,
|
||||
'id_group_filter',
|
||||
'id_group_filter_dialog',
|
||||
$id_group_filter,
|
||||
'',
|
||||
'',
|
||||
|
@ -881,7 +884,7 @@ function save_new_filter() {
|
|||
"page" : "include/ajax/events",
|
||||
"save_event_filter" : 1,
|
||||
"id_name" : $("#text-id_name").val(),
|
||||
"id_group" : $("select#id_group").val(),
|
||||
"id_group" : $("#id_group_filter").val(),
|
||||
"event_type" : $("#event_type").val(),
|
||||
"severity" : $("#severity").val(),
|
||||
"status" : $("#status").val(),
|
||||
|
@ -897,7 +900,7 @@ function save_new_filter() {
|
|||
"tag_without": Base64.decode($("#hidden-tag_without").val()),
|
||||
"filter_only_alert" : $("#filter_only_alert").val(),
|
||||
"search_secondary_groups" : $("#checkbox-search_secondary_groups").val(),
|
||||
"id_group_filter": $("#id_group_filter").val(),
|
||||
"id_group_filter": $("#id_group_filter_dialog").val(),
|
||||
"date_from": $("#text-date_from").val(),
|
||||
"time_from": $("#text-time_from").val(),
|
||||
"date_to": $("#text-date_to").val(),
|
||||
|
@ -957,7 +960,7 @@ function save_update_filter() {
|
|||
{"page" : "include/ajax/events",
|
||||
"update_event_filter" : 1,
|
||||
"id" : $("#overwrite_filter").val(),
|
||||
"id_group" : $("select#id_group").val(),
|
||||
"id_group" : $("#id_group_filter").val(),
|
||||
"event_type" : $("#event_type").val(),
|
||||
"severity" : $("#severity").val(),
|
||||
"status" : $("#status").val(),
|
||||
|
@ -973,7 +976,7 @@ function save_update_filter() {
|
|||
"tag_without" : Base64.decode($("#hidden-tag_without").val()),
|
||||
"filter_only_alert" : $("#filter_only_alert").val(),
|
||||
"search_secondary_groups" : $("#checkbox-search_secondary_groups").val(),
|
||||
"id_group_filter": $("#id_group_filter").val(),
|
||||
"id_group_filter": $("#id_group_filter_dialog").val(),
|
||||
"date_from": $("#text-date_from").val(),
|
||||
"time_from": $("#text-time_from").val(),
|
||||
"date_to": $("#text-date_to").val(),
|
||||
|
@ -1629,7 +1632,7 @@ if ($get_extended_event) {
|
|||
$filter = get_parameter('filter', []);
|
||||
$similar_ids = get_parameter('similar_ids', $event_id);
|
||||
$group_rep = $filter['group_rep'];
|
||||
$event_rep = $event['event_rep'];
|
||||
$event_rep = $group_rep;
|
||||
$timestamp_first = $event['timestamp_first'];
|
||||
$timestamp_last = $event['timestamp_last'];
|
||||
$server_id = $event['server_id'];
|
||||
|
@ -1964,7 +1967,8 @@ if ($get_extended_event) {
|
|||
data : {
|
||||
page: "include/ajax/events",
|
||||
get_comments: 1,
|
||||
event: '.json_encode($event).'
|
||||
event: '.json_encode($event).',
|
||||
event_rep: '.$event_rep.'
|
||||
},
|
||||
dataType : "html",
|
||||
success: function (data) {
|
||||
|
|
|
@ -0,0 +1,768 @@
|
|||
<?php
|
||||
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||
/**
|
||||
* Controller for Audit Logs
|
||||
*
|
||||
* @category Controller
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
use Mpdf\Tag\Address;
|
||||
use PandoraFMS\Agent as PandoraFMSAgent;
|
||||
use PandoraFMS\Enterprise\Agent;
|
||||
|
||||
use function Composer\Autoload\includeFile;
|
||||
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
// Necessary classes for extends.
|
||||
require_once $config['homedir'].'/include/class/HTML.class.php';
|
||||
require_once $config['homedir'].'/include/functions_servers.php';
|
||||
enterprise_include_once('include/functions_satellite.php');
|
||||
|
||||
/**
|
||||
* Class SatelliteAgent
|
||||
*/
|
||||
class SatelliteAgent extends HTML
|
||||
{
|
||||
|
||||
/**
|
||||
* Allowed methods to be called using AJAX request.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $AJAXMethods = [
|
||||
'draw',
|
||||
'addAgent',
|
||||
'deleteAgent',
|
||||
'loadModal',
|
||||
];
|
||||
|
||||
/**
|
||||
* Ajax page.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $ajaxController;
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @param string $ajaxController Ajax controller.
|
||||
*/
|
||||
public function __construct(string $ajaxController)
|
||||
{
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM') === false
|
||||
&& is_user_admin($config['id_user']) === true
|
||||
) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access Satellite agents'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the ajax controller.
|
||||
$this->ajaxController = $ajaxController;
|
||||
// Capture all parameters before start.
|
||||
$this->satellite_server = (int) get_parameter('server_remote');
|
||||
if ($this->satellite_server !== 0) {
|
||||
$this->satellite_name = servers_get_name($this->satellite_server);
|
||||
$this->satellite_config = (array) config_satellite_get_config_file($this->satellite_name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Javascript.
|
||||
ui_require_jquery_file('pandora');
|
||||
// CSS.
|
||||
ui_require_css_file('wizard');
|
||||
ui_require_css_file('discovery');
|
||||
|
||||
global $config;
|
||||
// Datatables list.
|
||||
try {
|
||||
$columns = [
|
||||
'name',
|
||||
'address',
|
||||
'actions',
|
||||
];
|
||||
|
||||
$column_names = [
|
||||
__('Agent Name'),
|
||||
__('IP Adrress'),
|
||||
__('Actions'),
|
||||
];
|
||||
|
||||
$this->tableId = 'satellite_agents';
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
// Only in case of Metaconsole, format the frame.
|
||||
open_meta_frame();
|
||||
}
|
||||
|
||||
// Load datatables user interface.
|
||||
ui_print_datatable(
|
||||
[
|
||||
'id' => $this->tableId,
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 100%',
|
||||
'columns' => $columns,
|
||||
'column_names' => $column_names,
|
||||
'ajax_url' => $this->ajaxController,
|
||||
'ajax_data' => [
|
||||
'method' => 'draw',
|
||||
'server_remote' => $this->satellite_server,
|
||||
],
|
||||
'ajax_postprocces' => 'process_datatables_item(item)',
|
||||
'no_sortable_columns' => [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
],
|
||||
'search_button_class' => 'sub filter float-right',
|
||||
'form' => [
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Search').ui_print_help_tip(
|
||||
__('Search filter by alias, name, description, IP address or custom fields content'),
|
||||
true
|
||||
),
|
||||
'type' => 'text',
|
||||
'name' => 'filter_search',
|
||||
'size' => 12,
|
||||
],
|
||||
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
// Close the frame.
|
||||
close_meta_frame();
|
||||
}
|
||||
|
||||
// Auxiliar div.
|
||||
$modal = '<div id="modal" class="invisible"></div>';
|
||||
$msg = '<div id="msg" class="invisible"></div>';
|
||||
$aux = '<div id="aux" class="invisible"></div>';
|
||||
|
||||
echo $modal.$msg.$aux;
|
||||
|
||||
// Create button.
|
||||
echo '<div class="w100p flex-content-right">';
|
||||
html_print_submit_button(
|
||||
__('Add host'),
|
||||
'create',
|
||||
false,
|
||||
'class="sub next"'
|
||||
);
|
||||
|
||||
echo '</div>';
|
||||
// Load own javascript file.
|
||||
echo $this->loadJS();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the data for draw the table.
|
||||
*
|
||||
* @return void.
|
||||
*/
|
||||
public function draw()
|
||||
{
|
||||
global $config;
|
||||
// Initialice filter.
|
||||
$filter = '1=1';
|
||||
// Init data.
|
||||
$data = [];
|
||||
// Count of total records.
|
||||
$count = 0;
|
||||
// Catch post parameters.
|
||||
$start = get_parameter('start', 0);
|
||||
$length = get_parameter('length', $config['block_size']);
|
||||
$order = get_datatable_order(true);
|
||||
$filters = get_parameter('filter', []);
|
||||
|
||||
try {
|
||||
ob_start();
|
||||
$data = [];
|
||||
|
||||
foreach ($this->satellite_config as $line) {
|
||||
$re = '/^#*add_host \b(\S+) (\S*)$/m';
|
||||
|
||||
if (preg_match($re, $line, $matches, PREG_OFFSET_CAPTURE, 0) > 0) {
|
||||
$agent['address'] = $matches[1][0];
|
||||
if (isset($matches[2][0]) === false || empty($matches[2][0]) === true) {
|
||||
$agent['name'] = '';
|
||||
} else {
|
||||
$agent['name'] = $matches[2][0];
|
||||
}
|
||||
|
||||
if (empty($filters['filter_search']) === false) {
|
||||
if (empty(preg_grep('/'.$filters['filter_search'].'?/mi', array_values($agent))) === true) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
array_push($data, $agent);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($data) === false) {
|
||||
$data = array_reduce(
|
||||
$data,
|
||||
function ($carry, $item) {
|
||||
global $config;
|
||||
// Transforms array of arrays $data into an array
|
||||
// of objects, making a post-process of certain fields.
|
||||
$tmp = (object) $item;
|
||||
|
||||
$tmp->actions .= html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'border' => '0',
|
||||
'class' => 'action_button_img invert_filter',
|
||||
'onclick' => 'delete_agent(\''.$tmp->address.'\',\''.$tmp->name.'\')',
|
||||
]
|
||||
);
|
||||
|
||||
$carry[] = $tmp;
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$data = array_slice($data, $start, $length, true);
|
||||
$total = count($data);
|
||||
|
||||
echo json_encode(
|
||||
[
|
||||
'data' => $data,
|
||||
'recordsTotal' => $total,
|
||||
'recordsFiltered' => $total,
|
||||
]
|
||||
);
|
||||
// Capture output.
|
||||
$response = ob_get_clean();
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['error' => $e->getMessage()]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// If not valid, show error with issue.
|
||||
json_decode($response);
|
||||
if (json_last_error() == JSON_ERROR_NONE) {
|
||||
// If valid dump.
|
||||
echo $response;
|
||||
} else {
|
||||
echo json_encode(
|
||||
['error' => $response]
|
||||
);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prints inputs for modal "Add agent".
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loadModal()
|
||||
{
|
||||
$values['address'] = get_parameter('address', null);
|
||||
$values['name'] = get_parameter('name', null);
|
||||
|
||||
echo $this->printInputs($values);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for new/update agents.
|
||||
*
|
||||
* @param array $values Values or null.
|
||||
*
|
||||
* @return string Inputs.
|
||||
*/
|
||||
public function printInputs($values=null)
|
||||
{
|
||||
if (!is_array($values)) {
|
||||
$values = [];
|
||||
}
|
||||
|
||||
$return_all_group = false;
|
||||
|
||||
if (users_can_manage_group_all('AR') === true) {
|
||||
$return_all_group = true;
|
||||
}
|
||||
|
||||
$form = [
|
||||
'action' => '#',
|
||||
'id' => 'modal_form',
|
||||
'onsubmit' => 'return false;',
|
||||
'class' => 'modal',
|
||||
];
|
||||
|
||||
$inputs = [];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Agent address'),
|
||||
'id' => 'div-identifier',
|
||||
'arguments' => [
|
||||
'name' => 'address',
|
||||
'type' => 'text',
|
||||
'value' => $values['address'],
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Agent name'),
|
||||
'id' => 'div-identifier',
|
||||
'arguments' => [
|
||||
'name' => 'name',
|
||||
'type' => 'text',
|
||||
'value' => $values['name'],
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
return $this->printForm(
|
||||
[
|
||||
'form' => $form,
|
||||
'inputs' => $inputs,
|
||||
],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add agent to satellite conf.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addAgent()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$values['address'] = get_parameter('address');
|
||||
$values['name'] = get_parameter('name');
|
||||
|
||||
if ($this->parseSatelliteConf('save', $values) === false) {
|
||||
$this->ajaxMsg('error', __('Error saving agent'));
|
||||
} else {
|
||||
$this->ajaxMsg('result', _('Host '.$values['addres'].' added.'));
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete agent from satellite conf.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteAgent()
|
||||
{
|
||||
$values['address'] = get_parameter('address', '');
|
||||
$values['name'] = get_parameter('name', '');
|
||||
|
||||
if ($this->parseSatelliteConf('delete', $values) === false) {
|
||||
$this->ajaxMsg('error', __('Error saving agent'));
|
||||
} else {
|
||||
$this->ajaxMsg('result', _('Host '.$values['addres'].' added.'));
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse satellite configuration .
|
||||
*
|
||||
* @param string $action Action to perform (save, delete).
|
||||
* @param array $values.
|
||||
* @return void
|
||||
*/
|
||||
private function parseSatelliteConf(string $action, array $values)
|
||||
{
|
||||
switch ($action) {
|
||||
case 'save':
|
||||
if (isset($values['address']) === true && empty($values['address']) === false) {
|
||||
$string_hosts = 'add_host '.$values['address'].' '.$values['name']."\n";
|
||||
|
||||
// Add host to conf
|
||||
array_push($this->satellite_config, $string_hosts);
|
||||
|
||||
// Check config.
|
||||
if (empty($this->satellite_config)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$conf = implode('', $this->satellite_config);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$conf = implode('', $this->satellite_config);
|
||||
// Find agent to mark for deletion.
|
||||
$pattern = io_safe_expreg($values['address'].' '.$values['name']);
|
||||
$re = "/add_host ($pattern)/m";
|
||||
$subst = 'delete_host $1';
|
||||
$conf = preg_replace($re, $subst, $conf);
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->ajaxMsg('error', __('Error'));
|
||||
exit;
|
||||
}
|
||||
|
||||
return $this->saveAgent($conf);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves agent to satellite cofiguration file.
|
||||
*
|
||||
* @param array $values
|
||||
* @return void
|
||||
*/
|
||||
private function saveAgent(string $new_conf)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (empty($new_conf)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_SYSTEM,
|
||||
'Update remote config for server '.$this->satellite_name
|
||||
);
|
||||
|
||||
// Convert to config file encoding.
|
||||
$encoding = config_satellite_get_encoding($new_conf);
|
||||
if ($encoding !== false) {
|
||||
$converted_server_config = mb_convert_encoding($new_conf, $encoding, 'UTF-8');
|
||||
if ($converted_server_config !== false) {
|
||||
$new_conf = $converted_server_config;
|
||||
}
|
||||
}
|
||||
|
||||
// Get filenames.
|
||||
if ($this->satellite_server !== false) {
|
||||
$files = config_satellite_get_satellite_config_filenames($this->satellite_name);
|
||||
} else {
|
||||
$files = [];
|
||||
$files['conf'] = $config['remote_config'].'/conf/'.md5($this->satellite_name).'.srv.conf';
|
||||
$files['md5'] = $config['remote_config'].'/md5/'.md5($this->satellite_name).'.srv.md5';
|
||||
}
|
||||
|
||||
// Save configuration
|
||||
$result = file_put_contents($files['conf'], $new_conf);
|
||||
|
||||
if ($result === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Save configuration md5
|
||||
$result = file_put_contents($files['md5'], md5($new_conf));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if target method is available to be called using AJAX.
|
||||
*
|
||||
* @param string $method Target method.
|
||||
*
|
||||
* @return boolean True allowed, false not.
|
||||
*/
|
||||
public function ajaxMethod(string $method)
|
||||
{
|
||||
return in_array($method, $this->AJAXMethods);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Minor function to dump json message as ajax response.
|
||||
*
|
||||
* @param string $type Type: result || error.
|
||||
* @param string $msg Message.
|
||||
* @param boolean $delete Deletion messages.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function ajaxMsg($type, $msg, $delete=false)
|
||||
{
|
||||
$msg_err = 'Failed while saving: %s';
|
||||
$msg_ok = 'Successfully saved agent ';
|
||||
|
||||
if ($delete) {
|
||||
$msg_err = 'Failed while removing: %s';
|
||||
$msg_ok = 'Successfully deleted ';
|
||||
}
|
||||
|
||||
if ($type == 'error') {
|
||||
echo json_encode(
|
||||
[
|
||||
$type => ui_print_error_message(
|
||||
__(
|
||||
$msg_err,
|
||||
$msg
|
||||
),
|
||||
'',
|
||||
true
|
||||
),
|
||||
]
|
||||
);
|
||||
} else {
|
||||
echo json_encode(
|
||||
[
|
||||
$type => ui_print_success_message(
|
||||
__(
|
||||
$msg_ok,
|
||||
$msg
|
||||
),
|
||||
'',
|
||||
true
|
||||
),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load Javascript code.
|
||||
*
|
||||
* @return string.
|
||||
*/
|
||||
public function loadJS()
|
||||
{
|
||||
// Nothing for this moment.
|
||||
ob_start();
|
||||
|
||||
// Javascript content.
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
/**
|
||||
* Cleanup current dom entries.
|
||||
*/
|
||||
function cleanupDOM() {
|
||||
$('#div-address').empty();
|
||||
$('#div-name').empty();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process ajax responses and shows a dialog with results.
|
||||
*/
|
||||
function showMsg(data) {
|
||||
var title = "<?php echo __('Success'); ?>";
|
||||
var dt_satellite_agents = $("#satellite_agents").DataTable();
|
||||
|
||||
var text = '';
|
||||
var failed = 0;
|
||||
try {
|
||||
data = JSON.parse(data);
|
||||
text = data['result'];
|
||||
} catch (err) {
|
||||
title = "<?php echo __('Failed'); ?>";
|
||||
text = err.message;
|
||||
failed = 1;
|
||||
}
|
||||
if (!failed && data['error'] != undefined) {
|
||||
title = "<?php echo __('Failed'); ?>";
|
||||
text = data['error'];
|
||||
failed = 1;
|
||||
}
|
||||
if (data['report'] != undefined) {
|
||||
data['report'].forEach(function (item){
|
||||
text += '<br>'+item;
|
||||
});
|
||||
}
|
||||
|
||||
$('#msg').empty();
|
||||
$('#msg').html(text);
|
||||
$('#msg').dialog({
|
||||
width: 450,
|
||||
position: {
|
||||
my: 'center',
|
||||
at: 'center',
|
||||
of: window,
|
||||
collision: 'fit'
|
||||
},
|
||||
title: title,
|
||||
buttons: [
|
||||
{
|
||||
class: "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
||||
text: 'OK',
|
||||
click: function(e) {
|
||||
if (!failed) {
|
||||
$(".ui-dialog-content").dialog("close");
|
||||
$('.info').hide();
|
||||
cleanupDOM();
|
||||
dt_<?php echo $this->tableId; ?>.draw(false);
|
||||
} else {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads modal from AJAX to add a new agent.
|
||||
*/
|
||||
|
||||
function show_form(address) {
|
||||
var btn_ok_text = '<?php echo __('OK'); ?>';
|
||||
var btn_cancel_text = '<?php echo __('Cancel'); ?>';
|
||||
var title = '<?php echo __('Add agent to satellite'); ?>';
|
||||
var method = 'addAgent';
|
||||
|
||||
|
||||
load_modal({
|
||||
target: $('#modal'),
|
||||
form: 'modal_form',
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
ajax_callback: showMsg,
|
||||
cleanup: cleanupDOM,
|
||||
modal: {
|
||||
title: title,
|
||||
ok: btn_ok_text,
|
||||
cancel: btn_cancel_text,
|
||||
},
|
||||
extradata: [
|
||||
{
|
||||
name: 'server_remote',
|
||||
value: <?php echo $this->satellite_server; ?>,
|
||||
}
|
||||
],
|
||||
onshow: {
|
||||
page: '<?php echo $this->ajaxController; ?>',
|
||||
method: 'loadModal'
|
||||
},
|
||||
onsubmit: {
|
||||
page: '<?php echo $this->ajaxController; ?>',
|
||||
method: method
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete selected agent
|
||||
*/
|
||||
function delete_agent(address, name) {
|
||||
$('#aux').empty();
|
||||
$('#aux').text('<?php echo __('Are you sure?'); ?>');
|
||||
$('#aux').dialog({
|
||||
title: '<?php echo __('Delete'); ?> ' + address,
|
||||
buttons: [
|
||||
{
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
||||
text: '<?php echo __('Cancel'); ?>',
|
||||
click: function(e) {
|
||||
$(this).dialog('close');
|
||||
cleanupDOM();
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Delete',
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
||||
click: function(e) {
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'enterprise/godmode/servers/agents_satellite',
|
||||
method: 'deleteAgent',
|
||||
address: address,
|
||||
name: name,
|
||||
server_remote: <?php echo $this->satellite_server; ?>,
|
||||
},
|
||||
datatype: "json",
|
||||
success: function (data) {
|
||||
showMsg(data);
|
||||
},
|
||||
error: function(e) {
|
||||
showMsg(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#submit-create").on('click', function(){
|
||||
show_form();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
<?php
|
||||
// EOF Javascript content.
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -20,8 +20,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC220727';
|
||||
$pandora_version = 'v7.0NG.763';
|
||||
$build_version = 'PC220906';
|
||||
$pandora_version = 'v7.0NG.764';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -5996,6 +5996,26 @@ function send_test_email(
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check ip is valid into network
|
||||
*
|
||||
* @param string $ip Ip XXX.XXX.XXX.XXX.
|
||||
* @param string $cidr Network XXX.XXX.XXX.XXX/XX.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function cidr_match($ip, $cidr)
|
||||
{
|
||||
list($subnet, $mask) = explode('/', $cidr);
|
||||
|
||||
if ((ip2long($ip) & ~((1 << (32 - $mask)) - 1) ) == ip2long($subnet)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Microtime float number.
|
||||
*
|
||||
|
@ -6077,3 +6097,123 @@ if (function_exists('str_contains') === false) {
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is reporting console node.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function is_reporting_console_node()
|
||||
{
|
||||
global $config;
|
||||
if (isset($config['reporting_console_enable']) === true
|
||||
&& (bool) $config['reporting_console_enable'] === true
|
||||
&& isset($config['reporting_console_node']) === true
|
||||
&& (bool) $config['reporting_console_node'] === true
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Acl reporting console node.
|
||||
*
|
||||
* @param string $path Path.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function acl_reporting_console_node($path, $tab='')
|
||||
{
|
||||
global $config;
|
||||
if (is_reporting_console_node() === false) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
if ($path === 'advanced/metasetup') {
|
||||
switch ($tab) {
|
||||
case 'update_manager_online':
|
||||
case 'update_manager_offline':
|
||||
case 'update_manager_history':
|
||||
case 'update_manager_setup':
|
||||
case 'file_manager':
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($path === 'advanced/users_setup') {
|
||||
switch ($tab) {
|
||||
case 'user_edit':
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($path === $config['homedir'].'/godmode/users/configure_user'
|
||||
|| $path === 'advanced/links'
|
||||
|| $path === $config['homedir'].'/enterprise/extensions/cron'
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if ($path === 'godmode/servers/discovery') {
|
||||
switch ($tab) {
|
||||
case 'main':
|
||||
case 'tasklist':
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($path === 'operation/users/user_edit'
|
||||
|| $path === 'operation/users/user_edit_notifications'
|
||||
|| $path === 'godmode/setup/file_manager'
|
||||
|| $path === 'godmode/update_manager/update_manager'
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Necessary checks for the reporting console.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function notify_reporting_console_node()
|
||||
{
|
||||
$return = '';
|
||||
|
||||
// Check php memory limit.
|
||||
$PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit'));
|
||||
if ($PHPmemory_limit !== -1) {
|
||||
$url = 'http://php.net/manual/en/ini.core.php#ini.memory-limit';
|
||||
if ($config['language'] == 'es') {
|
||||
$url = 'http://php.net/manual/es/ini.core.php#ini.memory-limit';
|
||||
}
|
||||
|
||||
$msg = __("Not recommended '%s' value in PHP configuration", $PHPmemory_limit);
|
||||
$msg .= '<br>'.__('Recommended value is: -1');
|
||||
$msg .= '<br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator');
|
||||
$msg .= '<br><a href="'.$url.'" target="_blank">'.__('Documentation').'</a>';
|
||||
|
||||
$return = ui_print_error_message($msg, '', true);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ require_once $config['homedir'].'/include/functions_servers.php';
|
|||
require_once $config['homedir'].'/include/functions_planned_downtimes.php';
|
||||
require_once $config['homedir'].'/include/functions_db.php';
|
||||
require_once $config['homedir'].'/include/functions_event_responses.php';
|
||||
require_once $config['homedir'].'/include/functions_tactical.php';
|
||||
enterprise_include_once('include/functions_local_components.php');
|
||||
enterprise_include_once('include/functions_events.php');
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
|
@ -12706,7 +12707,7 @@ function api_get_total_modules($id_group, $trash1, $trash2, $returnType)
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -12715,20 +12716,9 @@ function api_get_total_modules($id_group, $trash1, $trash2, $returnType)
|
|||
return;
|
||||
}
|
||||
|
||||
$groups_clause = '1 = 1';
|
||||
if (!users_is_admin($config['id_user'])) {
|
||||
$user_groups = implode(',', array_keys(users_get_groups()));
|
||||
$groups_clause = "(ta.id_grupo IN ($user_groups) OR tasg.id_group IN ($user_groups))";
|
||||
}
|
||||
$partial = tactical_status_modules_agents($config['id_user'], false, 'AR');
|
||||
|
||||
$sql = "SELECT COUNT(DISTINCT(id_agente_modulo))
|
||||
FROM tagente_modulo tam, tagente ta
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE tam.id_agente = ta.id_agente AND id_module_group = $id_group
|
||||
AND delete_pending = 0 AND $groups_clause";
|
||||
|
||||
$total = db_get_value_sql($sql);
|
||||
$total = (int) $partial['_monitor_total_'];
|
||||
|
||||
$data = [
|
||||
'type' => 'string',
|
||||
|
|
|
@ -358,6 +358,10 @@ function config_update_config()
|
|||
$error_update[] = __('Module Custom ID read only');
|
||||
}
|
||||
|
||||
if (config_update_value('reporting_console_enable', get_parameter('reporting_console_enable'), true) === false) {
|
||||
$error_update[] = __('Enable console report');
|
||||
}
|
||||
|
||||
if (config_update_value('unique_ip', get_parameter('unique_ip'), true) === false) {
|
||||
$error_update[] = __('Unique IP');
|
||||
}
|
||||
|
@ -812,6 +816,10 @@ function config_update_config()
|
|||
$error_update[] = __('Max. days before delete unknown modules');
|
||||
}
|
||||
|
||||
if (config_update_value('days_delete_not_initialized', (int) get_parameter('days_delete_not_initialized'), true) === false) {
|
||||
$error_update[] = __('Max. days before delete not initialized modules');
|
||||
}
|
||||
|
||||
if (config_update_value('days_compact', (int) get_parameter('days_compact'), true) === false) {
|
||||
$error_update[] = __('Max. days before compact data');
|
||||
}
|
||||
|
@ -2193,6 +2201,10 @@ function config_process_config()
|
|||
config_update_value('module_custom_id_ro', 0);
|
||||
}
|
||||
|
||||
if (!isset($config['reporting_console_enable'])) {
|
||||
config_update_value('reporting_console_enable', 0);
|
||||
}
|
||||
|
||||
if (!isset($config['elasticsearch_ip'])) {
|
||||
config_update_value('elasticsearch_ip', '');
|
||||
}
|
||||
|
|
|
@ -422,11 +422,37 @@ function cron_list_table()
|
|||
array_keys(users_get_groups())
|
||||
);
|
||||
|
||||
$defined_tasks = db_get_all_rows_filter(
|
||||
'tuser_task_scheduled',
|
||||
'id_grupo IN ('.$user_groups.')'
|
||||
$filter = '';
|
||||
if (is_reporting_console_node() === true) {
|
||||
$write_perms = false;
|
||||
$manage_perms = false;
|
||||
$manage_pandora = false;
|
||||
|
||||
$filter .= sprintf(
|
||||
' AND (
|
||||
tuser_task.function_name = "cron_task_generate_report"
|
||||
OR tuser_task.function_name = "cron_task_generate_report_by_template"
|
||||
OR tuser_task.function_name = "cron_task_save_report_to_disk"
|
||||
)'
|
||||
);
|
||||
}
|
||||
|
||||
// Admin.
|
||||
$sql = sprintf(
|
||||
'SELECT tuser_task_scheduled.*
|
||||
FROM tuser_task_scheduled
|
||||
INNER JOIN tuser_task
|
||||
ON tuser_task_scheduled.id_user_task = tuser_task.id
|
||||
WHERE
|
||||
id_grupo IN (%s)
|
||||
%s
|
||||
',
|
||||
$user_groups,
|
||||
$filter
|
||||
);
|
||||
|
||||
$defined_tasks = db_get_all_rows_sql($sql);
|
||||
|
||||
if (!check_acl($config['id_user'], 0, 'PM')) {
|
||||
$read_tasks = [];
|
||||
foreach ($defined_tasks as $task) {
|
||||
|
@ -466,7 +492,10 @@ function cron_list_table()
|
|||
$table->head[4] = __('Next execution');
|
||||
$table->head[5] = __('Last run');
|
||||
$table->head[6] = __('Group');
|
||||
$table->head[7] = __('Actions');
|
||||
if ($manage_perms || $manage_pandora) {
|
||||
$table->head[7] = __('Actions');
|
||||
}
|
||||
|
||||
$table->align[7] = 'left';
|
||||
|
||||
foreach ($defined_tasks as $task) {
|
||||
|
@ -521,7 +550,7 @@ function cron_list_table()
|
|||
break;
|
||||
|
||||
case 'cron_task_generate_report':
|
||||
if ((bool) $task['enabled'] === true && ($write_perms === true || $manage_pandora === true)) {
|
||||
if ((bool) $task['enabled'] === true) {
|
||||
$data[0] = html_print_anchor(
|
||||
[
|
||||
'href' => sprintf(
|
||||
|
@ -576,7 +605,7 @@ function cron_list_table()
|
|||
break;
|
||||
|
||||
case 'cron_task_generate_report_by_template':
|
||||
if ((bool) $task['enabled'] === true && ($write_perms === true || $manage_pandora === true)) {
|
||||
if ((bool) $task['enabled'] === true) {
|
||||
$data[0] = html_print_anchor(
|
||||
[
|
||||
'href' => sprintf(
|
||||
|
@ -928,25 +957,27 @@ function cron_list_table()
|
|||
}
|
||||
}
|
||||
|
||||
$data[7] .= html_print_anchor(
|
||||
[
|
||||
'href' => sprintf(
|
||||
'%stoggle_console_task=%s&id_user_task=%s',
|
||||
$url,
|
||||
((bool) $task['enabled'] === true) ? '0' : '1',
|
||||
$task['id']
|
||||
),
|
||||
'content' => html_print_image(
|
||||
((bool) $task['enabled'] === true) ? 'images/lightbulb.png' : 'images/lightbulb_off.png',
|
||||
true,
|
||||
[
|
||||
'title' => ((bool) $task['enabled'] === true) ? __('Disable task') : __('Enable task'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
if ($manage_perms || $manage_pandora) {
|
||||
$data[7] .= html_print_anchor(
|
||||
[
|
||||
'href' => sprintf(
|
||||
'%stoggle_console_task=%s&id_user_task=%s',
|
||||
$url,
|
||||
((bool) $task['enabled'] === true) ? '0' : '1',
|
||||
$task['id']
|
||||
),
|
||||
'content' => html_print_image(
|
||||
((bool) $task['enabled'] === true) ? 'images/lightbulb.png' : 'images/lightbulb_off.png',
|
||||
true,
|
||||
[
|
||||
'title' => ((bool) $task['enabled'] === true) ? __('Disable task') : __('Enable task'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
|
|
@ -1091,18 +1091,36 @@ function events_get_all(
|
|||
|
||||
// Custom data.
|
||||
if (empty($filter['custom_data']) === false) {
|
||||
if ($filter['custom_data_filter_type'] === '1') {
|
||||
$sql_filters[] = sprintf(
|
||||
' AND JSON_VALID(custom_data) = 1
|
||||
AND (JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) ',
|
||||
io_safe_output($filter['custom_data'])
|
||||
);
|
||||
if (isset($config['dbconnection']->server_version) === true
|
||||
&& $config['dbconnection']->server_version > 80000
|
||||
) {
|
||||
if ($filter['custom_data_filter_type'] === '1') {
|
||||
$sql_filters[] = sprintf(
|
||||
' AND JSON_VALID(custom_data) = 1
|
||||
AND (JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) ',
|
||||
io_safe_output($filter['custom_data'])
|
||||
);
|
||||
} else {
|
||||
$sql_filters[] = sprintf(
|
||||
' AND JSON_VALID(custom_data) = 1
|
||||
AND (JSON_SEARCH(JSON_KEYS(custom_data), "all", lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) IS NOT NULL) ',
|
||||
io_safe_output($filter['custom_data'])
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$sql_filters[] = sprintf(
|
||||
' AND JSON_VALID(custom_data) = 1
|
||||
AND (JSON_SEARCH(JSON_KEYS(custom_data), "all", lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) IS NOT NULL) ',
|
||||
io_safe_output($filter['custom_data'])
|
||||
);
|
||||
if ($filter['custom_data_filter_type'] === '1') {
|
||||
$sql_filters[] = sprintf(
|
||||
' AND JSON_VALID(custom_data) = 1 AND JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") ',
|
||||
$filter['custom_data'],
|
||||
$filter['custom_data']
|
||||
);
|
||||
} else {
|
||||
$sql_filters[] = sprintf(
|
||||
' AND JSON_VALID(custom_data) = 1 AND JSON_KEYS(custom_data) REGEXP "%s" ',
|
||||
$filter['custom_data'],
|
||||
$filter['custom_data']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1261,7 +1279,8 @@ function events_get_all(
|
|||
// Table tag for id_grupo.
|
||||
'te.',
|
||||
// Alt table tag for id_grupo.
|
||||
$user_admin_group_all
|
||||
$user_admin_group_all,
|
||||
(bool) $filter['search_secondary_groups']
|
||||
);
|
||||
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
|
||||
} else if (check_acl($config['id_user'], 0, 'EW')) {
|
||||
|
@ -1287,7 +1306,8 @@ function events_get_all(
|
|||
// Table tag for id_grupo.
|
||||
'te.',
|
||||
// Alt table tag for id_grupo.
|
||||
$user_admin_group_all
|
||||
$user_admin_group_all,
|
||||
(bool) $filter['search_secondary_groups']
|
||||
);
|
||||
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
|
||||
} else if (check_acl($config['id_user'], 0, 'EM')) {
|
||||
|
@ -1313,7 +1333,8 @@ function events_get_all(
|
|||
// Table tag for id_grupo.
|
||||
'te.',
|
||||
// Alt table tag for id_grupo.
|
||||
$user_admin_group_all
|
||||
$user_admin_group_all,
|
||||
(bool) $filter['search_secondary_groups']
|
||||
);
|
||||
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
|
||||
}
|
||||
|
@ -1383,7 +1404,7 @@ function events_get_all(
|
|||
|
||||
case '1':
|
||||
// Group by events.
|
||||
$group_by .= 'te.evento, te.id_agente, te.id_agentmodule, te.estado';
|
||||
$group_by .= 'te.evento, te.id_agente, te.id_agentmodule';
|
||||
break;
|
||||
|
||||
case '2':
|
||||
|
@ -3737,7 +3758,7 @@ function events_get_response_target(
|
|||
|
||||
// Parse the event custom data.
|
||||
if (empty($event['custom_data']) === false) {
|
||||
$custom_data = json_decode(base64_decode($event['custom_data']));
|
||||
$custom_data = json_decode($event['custom_data']);
|
||||
foreach ($custom_data as $key => $value) {
|
||||
$target = str_replace('_customdata_'.$key.'_', $value, $target);
|
||||
}
|
||||
|
@ -4279,7 +4300,7 @@ function events_page_custom_data($event)
|
|||
$table->head = [];
|
||||
$table->class = 'table_modal_alternate';
|
||||
|
||||
$json_custom_data = base64_decode($event['custom_data']);
|
||||
$json_custom_data = $event['custom_data'];
|
||||
$custom_data = json_decode($json_custom_data);
|
||||
|
||||
if ($custom_data === null) {
|
||||
|
@ -5290,7 +5311,7 @@ function events_get_field_value_by_event_id(
|
|||
|
||||
// Parse the event custom data.
|
||||
if (!empty($event['custom_data'])) {
|
||||
$custom_data = json_decode(base64_decode($event['custom_data']));
|
||||
$custom_data = json_decode($event['custom_data']);
|
||||
foreach ($custom_data as $key => $val) {
|
||||
$value = str_replace('_customdata_'.$key.'_', $val, $value);
|
||||
}
|
||||
|
|
|
@ -2237,7 +2237,7 @@ function html_print_extended_select_for_time(
|
|||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function html_print_extended_select_for_cron($hour='*', $minute='*', $mday='*', $month='*', $wday='*', $return=false, $disabled=false, $to=false)
|
||||
function html_print_extended_select_for_cron($hour='*', $minute='*', $mday='*', $month='*', $wday='*', $return=false, $disabled=false, $to=false, $advanced=false, $adv_mode_name='')
|
||||
{
|
||||
// Hours
|
||||
for ($i = 0; $i < 24; $i++) {
|
||||
|
@ -2286,18 +2286,104 @@ function html_print_extended_select_for_cron($hour='*', $minute='*', $mday='*',
|
|||
$table->head[3] = __('Month');
|
||||
$table->head[4] = __('Week day');
|
||||
|
||||
if ($to) {
|
||||
$table->data[0][0] = html_print_select($hours, 'hour_to', $hour, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][1] = html_print_select($minutes, 'minute_to', $minute, '', __('Any'), '*', true, false, false, '', $disabled, false, $minutes_hidden_options);
|
||||
$table->data[0][2] = html_print_select($mdays, 'mday_to', $mday, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][3] = html_print_select($months, 'month_to', $month, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][4] = html_print_select($wdays, 'wday_to', $wday, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
if ($advanced === false) {
|
||||
if ($to) {
|
||||
$table->data[0][0] = html_print_select($hours, 'hour_to', $hour, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][1] = html_print_select($minutes, 'minute_to', $minute, '', __('Any'), '*', true, false, false, '', $disabled, false, $minutes_hidden_options);
|
||||
$table->data[0][2] = html_print_select($mdays, 'mday_to', $mday, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][3] = html_print_select($months, 'month_to', $month, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][4] = html_print_select($wdays, 'wday_to', $wday, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
} else {
|
||||
$table->data[0][0] = html_print_select($hours, 'hour_from', $hour, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][1] = html_print_select($minutes, 'minute_from', $minute, '', __('Any'), '*', true, false, false, '', $disabled, false, $minutes_hidden_options);
|
||||
$table->data[0][2] = html_print_select($mdays, 'mday_from', $mday, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][3] = html_print_select($months, 'month_from', $month, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][4] = html_print_select($wdays, 'wday_from', $wday, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
}
|
||||
} else {
|
||||
$table->data[0][0] = html_print_select($hours, 'hour_from', $hour, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][1] = html_print_select($minutes, 'minute_from', $minute, '', __('Any'), '*', true, false, false, '', $disabled, false, $minutes_hidden_options);
|
||||
$table->data[0][2] = html_print_select($mdays, 'mday_from', $mday, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][3] = html_print_select($months, 'month_from', $month, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][4] = html_print_select($wdays, 'wday_from', $wday, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
if ($adv_mode_name !== '') {
|
||||
$adv_mode_name = '_'.$adv_mode_name;
|
||||
}
|
||||
|
||||
$table->data[0][0] = html_print_extended_select_for_downtime_cron(
|
||||
'cron_hour'.$adv_mode_name,
|
||||
$hours,
|
||||
$hour,
|
||||
'',
|
||||
__('Any'),
|
||||
'*',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
'Valid values: [0-23], [0-23]-[0-23], *, or step value (example: */3, 10/5)'
|
||||
);
|
||||
|
||||
$table->data[0][1] = html_print_extended_select_for_downtime_cron(
|
||||
'cron_minute'.$adv_mode_name,
|
||||
$minutes,
|
||||
$minute,
|
||||
'',
|
||||
__('Any'),
|
||||
'*',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
'Valid values: [0-59], [0-59]-[0-59], *, or step value (example: */5, 10/1)'
|
||||
);
|
||||
|
||||
$table->data[0][2] = html_print_extended_select_for_downtime_cron(
|
||||
'cron_mday'.$adv_mode_name,
|
||||
$mdays,
|
||||
$mday,
|
||||
'',
|
||||
__('Any'),
|
||||
'*',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
'Valid values: [1-31], [1-31]-[1-31], *, or step value (example: */5, 7/2)'
|
||||
);
|
||||
|
||||
$table->data[0][3] = html_print_extended_select_for_downtime_cron(
|
||||
'cron_month'.$adv_mode_name,
|
||||
$months,
|
||||
$month,
|
||||
'',
|
||||
__('Any'),
|
||||
'*',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
'Valid values: [1-12], [1-12]-[1-12], *, or step value (example: */3, 9/1)'
|
||||
);
|
||||
|
||||
$table->data[0][4] = html_print_extended_select_for_downtime_cron(
|
||||
'cron_wday'.$adv_mode_name,
|
||||
$wdays,
|
||||
$wday,
|
||||
'',
|
||||
__('Any'),
|
||||
'*',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
'Valid values: [0-6], [0-6]-[0-6], *, or step value (example: */2, 3/1)'
|
||||
);
|
||||
}
|
||||
|
||||
return html_print_table($table, $return);
|
||||
|
@ -6171,3 +6257,112 @@ function html_print_go_back_button(string $url, array $options=[], bool $return=
|
|||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render select box for numeric values and text box for complex values.
|
||||
*
|
||||
* @param string $name Select form name.
|
||||
* @param string $fields Fields to populate select box.
|
||||
* @param mixed $selected Current selected value. It can be a single value or an array of selected values (in combination with multiple).
|
||||
* @param string $script Javascript onChange (select) code.
|
||||
* @param string $nothing Label when nothing is selected.
|
||||
* @param mixed $nothing_value Value when nothing is selected.
|
||||
* @param integer $size Size of the input.
|
||||
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param boolean $select_style Wherter to assign to combo a unique name (to have more than one on same page, like dashboard).
|
||||
* @param boolean $unique_name Uunique name value.
|
||||
* @param boolean $disabled Input renders as disabled.
|
||||
* @param boolean $no_change No change value.
|
||||
* @param boolean $text_help Tooltip.
|
||||
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function html_print_extended_select_for_downtime_cron(
|
||||
$name,
|
||||
$fields,
|
||||
$selected='',
|
||||
$script='',
|
||||
$nothing='',
|
||||
$nothing_value='0',
|
||||
$size=false,
|
||||
$return=false,
|
||||
$select_style=false,
|
||||
$unique_name=true,
|
||||
$disabled=false,
|
||||
$no_change=0,
|
||||
$text_help=''
|
||||
) {
|
||||
global $config;
|
||||
|
||||
if ($unique_name === true) {
|
||||
$uniq_name = uniqid($name);
|
||||
} else {
|
||||
$uniq_name = $name;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
echo '<div id="'.$uniq_name.'_default" class="w100p inline_line">';
|
||||
html_print_select(
|
||||
$fields,
|
||||
$uniq_name.'_select',
|
||||
$selected,
|
||||
''.$script,
|
||||
$nothing,
|
||||
$nothing_value,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabled,
|
||||
'font-size: xx-small;'.$select_style
|
||||
);
|
||||
echo ' <a href="javascript:">'.html_print_image(
|
||||
'images/pencil.png',
|
||||
true,
|
||||
[
|
||||
'class' => $uniq_name.'_toggler',
|
||||
'alt' => __('Custom'),
|
||||
'title' => __('Custom'),
|
||||
'style' => 'width: 18px;',
|
||||
]
|
||||
).'</a>';
|
||||
echo '</div>';
|
||||
|
||||
$help_tooltip = ($text_help !== '') ? ui_print_help_tip(__($text_help), true) : '';
|
||||
|
||||
echo '<div id="'.$uniq_name.'_manual" class="w100p inline_line">';
|
||||
html_print_input_text($uniq_name.'_text', $selected, '', 20);
|
||||
|
||||
html_print_input_hidden($name, $selected, false, $uniq_name);
|
||||
echo ' <a href="javascript:">'.$help_tooltip.' '.html_print_image(
|
||||
'images/default_list.png',
|
||||
true,
|
||||
[
|
||||
'class' => $uniq_name.'_toggler',
|
||||
'alt' => __('List'),
|
||||
'title' => __('List'),
|
||||
'style' => 'width: 18px;',
|
||||
]
|
||||
).'</a>';
|
||||
echo '</div>';
|
||||
|
||||
$select_init_func = (is_numeric($selected) === true || $selected === '*') ? 'post_process_select_init' : 'post_process_select_init_inv';
|
||||
|
||||
echo "<script type='text/javascript'>
|
||||
$(document).ready (function () {
|
||||
".$select_init_func."('$uniq_name','$selected');
|
||||
post_process_select_events_unit('$uniq_name','$selected');
|
||||
});
|
||||
|
||||
</script>";
|
||||
|
||||
$returnString = ob_get_clean();
|
||||
|
||||
if ($return) {
|
||||
return $returnString;
|
||||
} else {
|
||||
echo $returnString;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,3 +95,168 @@ function attachActionButton(
|
|||
$return
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get table inputs for massive operation agents edit and delete.
|
||||
*
|
||||
* @param array $params Params.
|
||||
*
|
||||
* @return string Output.
|
||||
*/
|
||||
function get_table_inputs_masive_agents($params)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$table = new stdClass;
|
||||
$table->id = 'delete_table';
|
||||
$table->class = 'databox filters';
|
||||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold;';
|
||||
$table->style[2] = 'font-weight: bold';
|
||||
$table->size = [];
|
||||
$table->size[0] = '15%';
|
||||
$table->size[1] = '35%';
|
||||
$table->size[2] = '15%';
|
||||
$table->size[3] = '35%';
|
||||
|
||||
$table->data = [];
|
||||
$table->data[0][0] = __('Group');
|
||||
$table->data[0][1] = html_print_select_groups(
|
||||
false,
|
||||
'AW',
|
||||
true,
|
||||
'id_group',
|
||||
$params['id_group'],
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table->data[0][2] = __('Group recursion');
|
||||
$table->data[0][3] = html_print_checkbox(
|
||||
'recursion',
|
||||
1,
|
||||
$params['recursion'],
|
||||
true,
|
||||
false
|
||||
);
|
||||
|
||||
$status_list = [];
|
||||
$status_list[AGENT_STATUS_NORMAL] = __('Normal');
|
||||
$status_list[AGENT_STATUS_WARNING] = __('Warning');
|
||||
$status_list[AGENT_STATUS_CRITICAL] = __('Critical');
|
||||
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
|
||||
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
|
||||
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
|
||||
$table->data[1][0] = __('Status');
|
||||
$table->data[1][1] = html_print_select(
|
||||
$status_list,
|
||||
'status_agents',
|
||||
'selected',
|
||||
'',
|
||||
__('All'),
|
||||
AGENT_STATUS_ALL,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[1][2] = __('Show agents');
|
||||
$table->data[1][3] = html_print_select(
|
||||
[
|
||||
0 => 'Only enabled',
|
||||
1 => 'Only disabled',
|
||||
],
|
||||
'disabled',
|
||||
2,
|
||||
'',
|
||||
__('All'),
|
||||
2,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:30%;'
|
||||
);
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$servers = metaconsole_get_servers();
|
||||
$server_fields = [];
|
||||
foreach ($servers as $key => $server) {
|
||||
$server_fields[$key] = $server['server_name'];
|
||||
}
|
||||
|
||||
$table->data[2][2] = __('Node');
|
||||
$table->data[2][3] = html_print_select(
|
||||
$server_fields,
|
||||
'nodes[]',
|
||||
0,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'min-width: 500px; max-width: 500px; max-height: 100px',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$table->data[3][0] = __('Agents');
|
||||
$table->data[3][0] .= '<span id="agent_loading" class="invisible">';
|
||||
$table->data[3][0] .= html_print_image('images/spinner.png', true);
|
||||
$table->data[3][0] .= '</span>';
|
||||
|
||||
$agents = [];
|
||||
if (is_metaconsole() === false) {
|
||||
$agents = agents_get_group_agents(
|
||||
array_keys(users_get_groups($config['id_user'], 'AW', false)),
|
||||
['disabled' => 2],
|
||||
'none'
|
||||
);
|
||||
}
|
||||
|
||||
$table->data[3][1] = html_print_select(
|
||||
$agents,
|
||||
'id_agents[]',
|
||||
0,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'min-width: 500px; max-width: 500px; max-height: 100px',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
$output = html_print_table($table, true);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
|
|
@ -539,6 +539,8 @@ function planned_downtimes_migrate_malformed_downtimes_copy_items($original_down
|
|||
*/
|
||||
function planned_downtimes_stop($downtime)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$result = false;
|
||||
$message = '';
|
||||
|
||||
|
@ -672,6 +674,21 @@ function planned_downtimes_stop($downtime)
|
|||
}
|
||||
break;
|
||||
|
||||
case 'disable_agent_modules':
|
||||
$update_sql = sprintf(
|
||||
'UPDATE tagente_modulo tam, tagente ta, tplanned_downtime_modules tpdm
|
||||
SET tam.disabled = 0, ta.update_module_count = 1
|
||||
WHERE tpdm.id_agent_module = tam.id_agente_modulo AND
|
||||
ta.id_agente = tam.id_agente AND
|
||||
tpdm.id_downtime = %d',
|
||||
$id_downtime
|
||||
);
|
||||
|
||||
db_process_sql($update_sql);
|
||||
|
||||
$count = '';
|
||||
break;
|
||||
|
||||
case 'disable_agents_alerts':
|
||||
$agents = db_get_all_rows_filter(
|
||||
'tplanned_downtime_agents',
|
||||
|
|
|
@ -774,6 +774,13 @@ function reporting_make_reporting_data(
|
|||
);
|
||||
break;
|
||||
|
||||
case 'modules_inventory':
|
||||
$report['contents'][] = reporting_modules_inventory(
|
||||
$report,
|
||||
$content
|
||||
);
|
||||
break;
|
||||
|
||||
case 'inventory':
|
||||
$report['contents'][] = reporting_inventory(
|
||||
$report,
|
||||
|
@ -2438,6 +2445,14 @@ function reporting_event_report_module(
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate agents inventory report.
|
||||
*
|
||||
* @param array $report Report info.
|
||||
* @param array $content Content info.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function reporting_agents_inventory($report, $content)
|
||||
{
|
||||
global $config;
|
||||
|
@ -2470,7 +2485,7 @@ function reporting_agents_inventory($report, $content)
|
|||
$custom_field_sql = '';
|
||||
$search_sql = '';
|
||||
|
||||
if (!empty($es_agent_custom_fields)) {
|
||||
if (empty(array_filter($es_agent_custom_fields)) === false) {
|
||||
$custom_field_sql = 'INNER JOIN tagent_custom_data tacd ON tacd.id_agent = tagente.id_agente';
|
||||
if ($es_agent_custom_fields[0] != 0) {
|
||||
$custom_field_sql .= ' AND tacd.id_field IN ('.implode(',', $es_agent_custom_fields).')';
|
||||
|
@ -2629,6 +2644,146 @@ function reporting_agents_inventory($report, $content)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate modules inventory report.
|
||||
*
|
||||
* @param array $report Report info.
|
||||
* @param array $content Content info.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function reporting_modules_inventory($report, $content)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$return['name'] = $content['name'];
|
||||
$return['type'] = 'modules_inventory';
|
||||
$return['title'] = $content['name'];
|
||||
$return['landscape'] = $content['landscape'];
|
||||
$return['pagebreak'] = $content['pagebreak'];
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
|
||||
$external_source = io_safe_input(json_decode($content['external_source'], true));
|
||||
$es_agent_group_filter = $external_source['agent_group_filter'];
|
||||
$module_group = $external_source['module_group'];
|
||||
$es_agent_server_filter = $external_source['agent_server_filter'];
|
||||
|
||||
$search_sql = '';
|
||||
|
||||
if (empty($es_agent_group_filter) === false) {
|
||||
$search_sql .= ' AND (ta.id_grupo = '.$es_agent_group_filter.' OR tasg.id_group = '.$es_agent_group_filter.')';
|
||||
}
|
||||
|
||||
if (empty($module_group) === false && $module_group > -1) {
|
||||
$search_sql .= ' AND tam.id_module_group = '.$module_group;
|
||||
}
|
||||
|
||||
$user_groups_to_sql = '';
|
||||
|
||||
$user_groupsAR = users_get_groups($config['id_user'], 'AR');
|
||||
|
||||
$user_groups = $user_groupsAR;
|
||||
$user_groups_to_sql = implode(',', array_keys($user_groups));
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT tam.id_agente_modulo,
|
||||
tam.nombre,
|
||||
tam.descripcion,
|
||||
tam.id_module_group,
|
||||
ttm.id_tag,
|
||||
ta.id_grupo AS group_id,
|
||||
tasg.id_group AS sec_group_id
|
||||
FROM tagente_modulo tam
|
||||
INNER JOIN tagente ta
|
||||
ON tam.id_agente = ta.id_agente
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
LEFT JOIN ttag_module ttm
|
||||
ON ttm.id_agente_modulo = tam.id_agente_modulo
|
||||
WHERE (ta.id_grupo IN (%s) OR tasg.id_group IN (%s)) %s',
|
||||
$user_groups_to_sql,
|
||||
$user_groups_to_sql,
|
||||
$search_sql
|
||||
);
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$servers_ids = array_column(metaconsole_get_servers(), 'id');
|
||||
} else {
|
||||
$servers_ids = [0];
|
||||
}
|
||||
|
||||
$return_data = [];
|
||||
|
||||
foreach ($servers_ids as $server_id) {
|
||||
if (is_metaconsole()) {
|
||||
$server = metaconsole_get_connection_by_id($server_id);
|
||||
|
||||
if ((int) $es_agent_server_filter !== 0
|
||||
&& (int) $es_agent_server_filter !== (int) $server_id
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$agents = db_get_all_rows_sql($sql);
|
||||
|
||||
$return_data[$server_id] = $agents;
|
||||
|
||||
if (is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
$all_data = [];
|
||||
|
||||
foreach ($return_data as $server_agents) {
|
||||
foreach ($server_agents as $agent) {
|
||||
$all_data[] = $agent;
|
||||
}
|
||||
}
|
||||
|
||||
$return['data'] = $all_data;
|
||||
|
||||
$module_row_data = [];
|
||||
|
||||
foreach ($return['data'] as $row) {
|
||||
if (is_array($module_row_data[$row['id_agente_modulo']]) === false) {
|
||||
$module_row_data[$row['id_agente_modulo']]['nombre'] = $row['nombre'];
|
||||
$module_row_data[$row['id_agente_modulo']]['descripcion'] = $row['descripcion'];
|
||||
$module_row_data[$row['id_agente_modulo']]['id_module_group'] = $row['id_module_group'];
|
||||
$module_row_data[$row['id_agente_modulo']]['id_tag'] = [];
|
||||
$module_row_data[$row['id_agente_modulo']]['group_id'] = [];
|
||||
$module_row_data[$row['id_agente_modulo']]['sec_group_id'] = [];
|
||||
}
|
||||
|
||||
if (in_array($row['id_tag'], $module_row_data[$row['id_agente_modulo']]['id_tag']) === false
|
||||
&& $row['id_tag'] !== null
|
||||
) {
|
||||
$module_row_data[$row['id_agente_modulo']]['id_tag'][] = $row['id_tag'];
|
||||
}
|
||||
|
||||
if (in_array($row['group_id'], $module_row_data[$row['id_agente_modulo']]['group_id']) === false
|
||||
&& $row['group_id'] !== null
|
||||
) {
|
||||
$module_row_data[$row['id_agente_modulo']]['group_id'][] = $row['group_id'];
|
||||
}
|
||||
|
||||
if (in_array($row['sec_group_id'], $module_row_data[$row['id_agente_modulo']]['sec_group_id']) === false
|
||||
&& $row['sec_group_id'] !== null
|
||||
) {
|
||||
$module_row_data[$row['id_agente_modulo']]['sec_group_id'][] = $row['sec_group_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$return['data'] = $module_row_data;
|
||||
|
||||
return reporting_check_structure_content($return);
|
||||
}
|
||||
|
||||
|
||||
function reporting_inventory_changes($report, $content, $type)
|
||||
{
|
||||
global $config;
|
||||
|
@ -7079,6 +7234,10 @@ function reporting_sql($report, $content)
|
|||
$historical_db = db_get_value_sql(
|
||||
'SELECT historical_db from treport_content where id_rc ='.$content['id_rc']
|
||||
);
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$historical_db = $content['historical_db'];
|
||||
}
|
||||
} else {
|
||||
$historical_db = $content['historical_db'];
|
||||
}
|
||||
|
@ -11462,7 +11621,7 @@ function reporting_get_stats_alerts($data, $links=false)
|
|||
{
|
||||
global $config;
|
||||
|
||||
// Link URLS
|
||||
// Link URLS.
|
||||
$mobile = false;
|
||||
if (isset($data['mobile'])) {
|
||||
if ($data['mobile']) {
|
||||
|
@ -11478,14 +11637,14 @@ function reporting_get_stats_alerts($data, $links=false)
|
|||
$urls = [];
|
||||
if ($links) {
|
||||
$urls['monitor_alerts'] = 'index.php?sec=estado&sec2=operation/agentes/alerts_status&pure='.$config['pure'];
|
||||
$urls['monitor_alerts_fired'] = 'index.php?sec=estado&sec2=operation/agentes/alerts_status&filter=fired&pure='.$config['pure'];
|
||||
$urls['monitor_alerts_fired'] = 'index.php?sec=estado&sec2=operation/agentes/alerts_status&disabled=fired&pure='.$config['pure'];
|
||||
} else {
|
||||
$urls['monitor_alerts'] = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60';
|
||||
$urls['monitor_alerts_fired'] = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&filter=fired';
|
||||
$urls['monitor_alerts_fired'] = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&disabled=fired';
|
||||
}
|
||||
}
|
||||
|
||||
// Alerts table
|
||||
// Alerts table.
|
||||
$table_al = html_get_predefined_table();
|
||||
|
||||
$tdata = [];
|
||||
|
@ -11524,7 +11683,7 @@ function reporting_get_stats_alerts($data, $links=false)
|
|||
$output = '<fieldset class="databox tactical_set">
|
||||
<legend>'.__('Defined and fired alerts').'</legend>'.html_print_table($table_al, true).'</fieldset>';
|
||||
} else {
|
||||
// Remove the defined alerts cause with the new cache table is difficult to retrieve them
|
||||
// Remove the defined alerts cause with the new cache table is difficult to retrieve them.
|
||||
unset($table_al->data[0][0], $table_al->data[0][1]);
|
||||
|
||||
$table_al->class = 'tactical_view';
|
||||
|
@ -14207,6 +14366,10 @@ function reporting_format_planned_downtime_dates($planned_downtime)
|
|||
$dates = date('Y-m-d H:i', $planned_downtime['date_from']).' '.__('to').' '.date('Y-m-d H:i', $planned_downtime['date_to']);
|
||||
break;
|
||||
|
||||
case 'cron':
|
||||
$dates = __('Start condition').': <span class="italic">'.$planned_downtime['cron_interval_from'].'</span> - '.__('Stop condition').': <span class="italic">'.$planned_downtime['cron_interval_to'].'</span>';
|
||||
break;
|
||||
|
||||
case 'periodically':
|
||||
if (!isset($planned_downtime['type_periodicity'])) {
|
||||
return '';
|
||||
|
|
|
@ -394,6 +394,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||
reporting_html_agents_inventory($table, $item);
|
||||
break;
|
||||
|
||||
case 'modules_inventory':
|
||||
reporting_html_modules_inventory($table, $item);
|
||||
break;
|
||||
|
||||
case 'inventory':
|
||||
reporting_html_inventory($table, $item);
|
||||
break;
|
||||
|
@ -1677,6 +1681,117 @@ function reporting_html_agents_inventory($table, $item, $pdf=0)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print html modules inventory
|
||||
*
|
||||
* @param object $table Head table or false if it comes from pdf.
|
||||
* @param array $item Items data.
|
||||
* @param boolean $pdf Print pdf true or false.
|
||||
*
|
||||
* @return string HTML code.
|
||||
*/
|
||||
function reporting_html_modules_inventory($table, $item, $pdf=0)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '100%';
|
||||
|
||||
$table1->style[0] = 'text-align: left;vertical-align: top;min-width: 100px;';
|
||||
$table1->class = 'databox data';
|
||||
$table1->cellpadding = 1;
|
||||
$table1->cellspacing = 1;
|
||||
$table1->styleTable = 'overflow: wrap; table-layout: fixed;';
|
||||
|
||||
$table1->style[0] = 'text-align: left;vertical-align: top;min-width: 100px;';
|
||||
$table1->style[1] = 'text-align: left;vertical-align: top;min-width: 100px;';
|
||||
$table1->style[2] = 'text-align: left;vertical-align: top; min-width: 100px';
|
||||
$table1->style[3] = 'text-align: left;vertical-align: top;min-width: 100px;';
|
||||
$table1->style[4] = 'text-align: left;vertical-align: top;min-width: 100px;';
|
||||
$table1->style[5] = 'text-align: left;vertical-align: top; min-width: 100px';
|
||||
|
||||
$table1->head = [];
|
||||
|
||||
$table1->head[] = __('Name');
|
||||
$table1->head[] = __('Description');
|
||||
$table1->head[] = __('Module group');
|
||||
$table1->head[] = __('Tags');
|
||||
$table1->head[] = __('Agent group');
|
||||
$table1->head[] = __('Agent secondary groups');
|
||||
|
||||
$table1->headstyle[0] = 'text-align: left';
|
||||
$table1->headstyle[1] = 'text-align: left';
|
||||
$table1->headstyle[2] = 'text-align: left';
|
||||
$table1->headstyle[3] = 'text-align: left';
|
||||
$table1->headstyle[4] = 'text-align: left';
|
||||
$table1->headstyle[5] = 'text-align: left';
|
||||
|
||||
$table1->data = [];
|
||||
|
||||
foreach ($item['data'] as $module_id => $module_data) {
|
||||
$row = [];
|
||||
$first_item = array_pop(array_reverse($module_data));
|
||||
|
||||
foreach ($module_data as $data_field_key => $data_field_value) {
|
||||
if ($data_field_key === 'nombre') {
|
||||
$column_value = $data_field_value;
|
||||
} else if ($data_field_key === 'descripcion') {
|
||||
$column_value = $data_field_value;
|
||||
} else if ($data_field_key === 'id_module_group') {
|
||||
$module_group_name = modules_get_modulegroup_name($data_field_value);
|
||||
|
||||
if ($module_group_name === '') {
|
||||
$module_group_name = '-';
|
||||
}
|
||||
|
||||
$column_value = $module_group_name;
|
||||
} else if ($data_field_key === 'id_tag') {
|
||||
$tags_names = array_map(
|
||||
function ($tag_id) {
|
||||
return db_get_value('name', 'ttag', 'id_tag', $tag_id);
|
||||
},
|
||||
$data_field_value
|
||||
);
|
||||
$column_value = implode('<br>', $tags_names);
|
||||
} else if ($data_field_key === 'group_id') {
|
||||
$column_value = groups_get_name($data_field_value[0]);
|
||||
} else if ($data_field_key === 'sec_group_id') {
|
||||
$sec_groups_names = array_map(
|
||||
function ($group_id) {
|
||||
return groups_get_name($group_id);
|
||||
},
|
||||
$data_field_value
|
||||
);
|
||||
|
||||
$column_value = implode('<br>', $sec_groups_names);
|
||||
}
|
||||
|
||||
$row[] = $column_value;
|
||||
}
|
||||
|
||||
$table1->data[] = $row;
|
||||
|
||||
if ($pdf !== 0) {
|
||||
$table1->data[] = '<br />';
|
||||
}
|
||||
}
|
||||
|
||||
if ($pdf === 0) {
|
||||
$table->colspan['permissions']['cell'] = 3;
|
||||
$table->cellstyle['permissions']['cell'] = 'text-align: center;';
|
||||
$table->data['permissions']['cell'] = html_print_table(
|
||||
$table1,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
return html_print_table(
|
||||
$table1,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print in html inventory changes reports
|
||||
*
|
||||
|
|
|
@ -880,6 +880,13 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||
];
|
||||
}
|
||||
|
||||
if (!$template) {
|
||||
$types['modules_inventory'] = [
|
||||
'optgroup' => __('Inventory'),
|
||||
'name' => __('Modules inventory'),
|
||||
];
|
||||
}
|
||||
|
||||
if ($config['enterprise_installed']) {
|
||||
$types['inventory'] = [
|
||||
'optgroup' => __('Inventory'),
|
||||
|
|
|
@ -751,7 +751,8 @@ function tags_get_acl_tags(
|
|||
$childrens_ids=[],
|
||||
$force_group_and_tag=false,
|
||||
$id_grupo_table_pretag='',
|
||||
$alt_id_grupo_table_pretag=''
|
||||
$alt_id_grupo_table_pretag='',
|
||||
$search_secondary_group=true
|
||||
) {
|
||||
global $config;
|
||||
|
||||
|
@ -831,7 +832,8 @@ function tags_get_acl_tags(
|
|||
$force_group_and_tag,
|
||||
false,
|
||||
$id_grupo_table_pretag,
|
||||
$alt_id_grupo_table_pretag
|
||||
$alt_id_grupo_table_pretag,
|
||||
$search_secondary_group
|
||||
);
|
||||
|
||||
if (!empty($condition)) {
|
||||
|
@ -933,7 +935,8 @@ function tags_get_acl_tags_event_condition(
|
|||
$force_group_and_tag=false,
|
||||
$force_equal=false,
|
||||
$id_grupo_table_pretag='',
|
||||
$alt_id_grupo_table_pretag=''
|
||||
$alt_id_grupo_table_pretag='',
|
||||
$search_secondary_group=true
|
||||
) {
|
||||
global $config;
|
||||
$condition = [];
|
||||
|
@ -951,7 +954,13 @@ function tags_get_acl_tags_event_condition(
|
|||
|
||||
// Group condition (The module belongs to an agent of the group X)
|
||||
// $group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_children_ids($group_id, true))));.
|
||||
$group_condition = '('.$id_grupo_table_pretag.'id_grupo = '.$group_id.' OR '.$alt_id_grupo_table_pretag.'id_group = '.$group_id.')';
|
||||
$group_condition = '('.$id_grupo_table_pretag.'id_grupo = '.$group_id;
|
||||
|
||||
if ($search_secondary_group === true) {
|
||||
$group_condition .= ' OR '.$alt_id_grupo_table_pretag.'id_group = '.$group_id;
|
||||
}
|
||||
|
||||
$group_condition .= ')';
|
||||
|
||||
// Tags condition (The module has at least one of the restricted tags).
|
||||
$tags_condition = '';
|
||||
|
@ -987,7 +996,13 @@ function tags_get_acl_tags_event_condition(
|
|||
}
|
||||
|
||||
$in_group = implode(',', $without_tags);
|
||||
$condition .= sprintf('('.$id_grupo_table_pretag.'id_grupo IN (%s) OR '.$alt_id_grupo_table_pretag.'id_group IN (%s))', $in_group, $in_group);
|
||||
$condition .= sprintf('('.$id_grupo_table_pretag.'id_grupo IN (%s)', $in_group);
|
||||
|
||||
if ($search_secondary_group === true) {
|
||||
$condition .= sprintf(' OR '.$alt_id_grupo_table_pretag.'id_group IN (%s)', $in_group);
|
||||
}
|
||||
|
||||
$condition .= ')';
|
||||
}
|
||||
|
||||
$condition = !empty($condition) ? "($condition)" : '';
|
||||
|
|
|
@ -473,9 +473,9 @@ function treeview_printAlertsTable($id_module, $server_data=[], $no_head=false)
|
|||
|
||||
if ($user_access_node && check_acl($config['id_user'], $id_group, 'LW')) {
|
||||
// Actions table
|
||||
echo '<div class="w100p right mw300px right_align">';
|
||||
echo '<div class="w100p right_align">';
|
||||
echo '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name='.$module_name.'&id_agente='.$agent_id.$url_hash.'" target="_blank">';
|
||||
html_print_submit_button(__('Go to alerts edition'), 'upd_button', false, 'class="sub search"');
|
||||
html_print_submit_button(__('Go to alerts edition'), 'upd_button', false, 'class="sub search" style="margin-right: 20px"');
|
||||
echo '</a>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
|
|
@ -94,3 +94,55 @@ function showMassiveOperationMessage(message) {
|
|||
});
|
||||
}
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function form_controls_massive_operations_agents(metaconsole) {
|
||||
// Listeners.
|
||||
var recursion;
|
||||
$("#checkbox-recursion").click(function() {
|
||||
recursion = this.checked ? 1 : 0;
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
||||
var disabled;
|
||||
$("#disabled").change(function() {
|
||||
disabled = this.value;
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
||||
var nodes;
|
||||
$("#nodes").change(function() {
|
||||
nodes = $("#nodes").val();
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
||||
$("#status_agents").change(function() {
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
||||
// Build data.
|
||||
var data = {
|
||||
status_agents: function() {
|
||||
return $("#status_agents").val();
|
||||
},
|
||||
agentSelect: "select#id_agents",
|
||||
privilege: "AW",
|
||||
recursion: function() {
|
||||
return recursion;
|
||||
},
|
||||
disabled: function() {
|
||||
return disabled;
|
||||
}
|
||||
};
|
||||
|
||||
if (metaconsole == 1) {
|
||||
data.serialized = true;
|
||||
data.serialized_separator = "|";
|
||||
data.nodes = function() {
|
||||
return nodes;
|
||||
};
|
||||
}
|
||||
|
||||
// Change agents.
|
||||
$("#id_group").pandoraSelectGroupAgent(data);
|
||||
}
|
||||
|
|
|
@ -737,6 +737,11 @@ function post_process_select_init(name) {
|
|||
$("#" + name + "_default").show();
|
||||
}
|
||||
|
||||
function post_process_select_init_inv(name) {
|
||||
$("#" + name + "_manual").show();
|
||||
$("#" + name + "_default").hide();
|
||||
}
|
||||
|
||||
function post_process_select_init_unit(name, selected) {
|
||||
// Manual mode is hidden by default
|
||||
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -64,39 +64,55 @@ final class Config
|
|||
|| $config['history_db_connection'] === false
|
||||
) {
|
||||
ob_start();
|
||||
$config['history_db_connection'] = db_connect(
|
||||
$config['history_db_host'],
|
||||
$config['history_db_name'],
|
||||
|
||||
$link = mysqli_init();
|
||||
$link->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2);
|
||||
$rc = mysqli_real_connect(
|
||||
$link,
|
||||
$$config['history_db_host'],
|
||||
$config['history_db_user'],
|
||||
io_output_password($config['history_db_pass']),
|
||||
$config['history_db_port'],
|
||||
false
|
||||
$config['history_db_name'],
|
||||
$config['history_db_port']
|
||||
);
|
||||
|
||||
if ($rc === false) {
|
||||
$config['history_db_connection'] = false;
|
||||
} else {
|
||||
$config['history_db_connection'] = db_connect(
|
||||
$config['history_db_host'],
|
||||
$config['history_db_name'],
|
||||
$config['history_db_user'],
|
||||
io_output_password($config['history_db_pass']),
|
||||
$config['history_db_port'],
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
ob_get_clean();
|
||||
}
|
||||
|
||||
if ($config['history_db_connection'] !== false) {
|
||||
$data = \db_get_all_rows_sql(
|
||||
'SELECT * FROM `tconfig`',
|
||||
false,
|
||||
false,
|
||||
$config['history_db_connection']
|
||||
if ($config['history_db_connection'] !== false) {
|
||||
$data = \db_get_all_rows_sql(
|
||||
'SELECT * FROM `tconfig`',
|
||||
false,
|
||||
false,
|
||||
$config['history_db_connection']
|
||||
);
|
||||
}
|
||||
|
||||
if (is_array($data) !== true) {
|
||||
return [];
|
||||
}
|
||||
|
||||
self::$settings = array_reduce(
|
||||
$data,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['token']] = $item['value'];
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
if (is_array($data) !== true) {
|
||||
return [];
|
||||
}
|
||||
|
||||
self::$settings = array_reduce(
|
||||
$data,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['token']] = $item['value'];
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -156,7 +156,10 @@ final class DBMaintainer
|
|||
return true;
|
||||
}
|
||||
|
||||
$dbc = new \mysqli(
|
||||
$link = mysqli_init();
|
||||
$link->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2);
|
||||
$rc = mysqli_real_connect(
|
||||
$link,
|
||||
$this->host,
|
||||
$this->user,
|
||||
$this->pass,
|
||||
|
@ -164,25 +167,39 @@ final class DBMaintainer
|
|||
$this->port
|
||||
);
|
||||
|
||||
if ((bool) $dbc->connect_error === true) {
|
||||
if ($rc === false) {
|
||||
$this->dbh = null;
|
||||
$this->connected = false;
|
||||
$this->lastError = $dbc->connect_errno.': '.$dbc->connect_error;
|
||||
$this->lastError = __('Connection problems');
|
||||
} else {
|
||||
$this->dbh = $dbc;
|
||||
if (empty($this->charset) === false) {
|
||||
$dbc->set_charset($this->charset);
|
||||
}
|
||||
$dbc = new \mysqli(
|
||||
$this->host,
|
||||
$this->user,
|
||||
$this->pass,
|
||||
null,
|
||||
$this->port
|
||||
);
|
||||
|
||||
if ($this->dbh->select_db($this->name) === false) {
|
||||
$this->lastError = $this->dbh->errno.': '.$this->dbh->error;
|
||||
$this->ready = false;
|
||||
if ((bool) $dbc->connect_error === true) {
|
||||
$this->dbh = null;
|
||||
$this->connected = false;
|
||||
$this->lastError = $dbc->connect_errno.': '.$dbc->connect_error;
|
||||
} else {
|
||||
$this->lastError = null;
|
||||
$this->ready = true;
|
||||
}
|
||||
$this->dbh = $dbc;
|
||||
if (empty($this->charset) === false) {
|
||||
$dbc->set_charset($this->charset);
|
||||
}
|
||||
|
||||
$this->connected = true;
|
||||
if ($this->dbh->select_db($this->name) === false) {
|
||||
$this->lastError = $this->dbh->errno.': '.$this->dbh->error;
|
||||
$this->ready = false;
|
||||
} else {
|
||||
$this->lastError = null;
|
||||
$this->ready = true;
|
||||
}
|
||||
|
||||
$this->connected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue