Merge branch 'develop' into ent-11751-15966-metaconsola-no-se-exportan-los-eventos-a-csv

This commit is contained in:
miguel angel rasteu 2023-07-31 11:28:59 +02:00
commit 63923e3599
147 changed files with 9630 additions and 1633 deletions

View File

@ -19,10 +19,10 @@ LOGFILE="/tmp/deploy-ext-db-$(date +%F).log"
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPASS" ] || DBPASS='Pandor4!'
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTUSER" ] || DBROOTUSER=root
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
[ "$DBROOTPASS" ] || DBROOTPASS='Pandor4!'
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
@ -79,6 +79,53 @@ check_root_permissions () {
fi
}
# Function to check if a password meets the MySQL secure password requirements
is_mysql_secure_password() {
local password=$1
# Check password length (at least 8 characters)
if [[ ${#password} -lt 8 ]]; then
echo "Password length should be at least 8 characters."
return 1
fi
# Check if password contains at least one uppercase letter
if [[ $password == ${password,,} ]]; then
echo "Password should contain at least one uppercase letter."
return 1
fi
# Check if password contains at least one lowercase letter
if [[ $password == ${password^^} ]]; then
echo "Password should contain at least one lowercase letter."
return 1
fi
# Check if password contains at least one digit
if ! [[ $password =~ [0-9] ]]; then
echo "Password should contain at least one digit."
return 1
fi
# Check if password contains at least one special character
if ! [[ $password =~ [[:punct:]] ]]; then
echo "Password should contain at least one special character."
return 1
fi
# Check if password is not a common pattern (e.g., "password", "123456")
local common_patterns=("password" "123456" "qwerty")
for pattern in "${common_patterns[@]}"; do
if [[ $password == *"$pattern"* ]]; then
echo "Password should not contain common patterns."
return 1
fi
done
# If all checks pass, the password is MySQL secure compliant
return 0
}
## Main
echo "Starting PandoraFMS External DB deployment EL8 ver. $S_VERSION"
@ -128,6 +175,10 @@ execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed'
execute_cmd "dnf --version" 'Checking needed tools: dnf'
#Check mysql pass
execute_cmd "is_mysql_secure_password $DBROOTPASS" "Checking DBROOTPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
execute_cmd "is_mysql_secure_password $DBPASS" "Checking DBPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
# Creating working directory
rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE"
mkdir "$HOME"/pandora_deploy_tmp &>> "$LOGFILE"
@ -207,16 +258,12 @@ if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev)
if [ "$MYVER" -eq '80' ] ; then
echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = 'Pandor4!';
UNINSTALL COMPONENT 'file://component_validate_password';
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = '$DBROOTPASS';
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"
fi
if [ "$MYVER" -ne '80' ] ; then
echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('Pandor4!');
UNINSTALL PLUGIN validate_password;
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('$DBROOTPASS');
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"fi
fi

View File

@ -26,9 +26,9 @@ rm -f $LOGFILE &> /dev/null # remove last log before start
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPASS" ] || DBPASS='Pandor4!'
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
[ "$DBROOTPASS" ] || DBROOTPASS='Pandor4!'
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
@ -86,6 +86,53 @@ check_root_permissions () {
fi
}
# Function to check if a password meets the MySQL secure password requirements
is_mysql_secure_password() {
local password=$1
# Check password length (at least 8 characters)
if [[ ${#password} -lt 8 ]]; then
echo "Password length should be at least 8 characters."
return 1
fi
# Check if password contains at least one uppercase letter
if [[ $password == ${password,,} ]]; then
echo "Password should contain at least one uppercase letter."
return 1
fi
# Check if password contains at least one lowercase letter
if [[ $password == ${password^^} ]]; then
echo "Password should contain at least one lowercase letter."
return 1
fi
# Check if password contains at least one digit
if ! [[ $password =~ [0-9] ]]; then
echo "Password should contain at least one digit."
return 1
fi
# Check if password contains at least one special character
if ! [[ $password =~ [[:punct:]] ]]; then
echo "Password should contain at least one special character."
return 1
fi
# Check if password is not a common pattern (e.g., "password", "123456")
local common_patterns=("password" "123456" "qwerty")
for pattern in "${common_patterns[@]}"; do
if [[ $password == *"$pattern"* ]]; then
echo "Password should not contain common patterns."
return 1
fi
done
# If all checks pass, the password is MySQL secure compliant
return 0
}
## Main
echo "Starting PandoraFMS External DB deployment Ubuntu 22.04 ver. $S_VERSION"
@ -137,6 +184,10 @@ execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed'
execute_cmd "apt --version" 'Checking needed tools: apt'
#Check mysql pass
execute_cmd "is_mysql_secure_password $DBROOTPASS" "Checking DBROOTPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
execute_cmd "is_mysql_secure_password $DBPASS" "Checking DBPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
# Creating working directory
rm -rf "$WORKDIR" &>> "$LOGFILE"
mkdir -p "$WORKDIR" &>> "$LOGFILE"
@ -170,6 +221,7 @@ if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
""" | mysql -uroot &>> "$LOGFILE"
export MYSQL_PWD=$DBROOTPASS
echo "INSTALL COMPONENT 'file://component_validate_password';" | mysql -uroot -P$DBPORT -h$DBHOST &>> "$LOGFILE"
echo -en "${cyan}Creating Pandora FMS database...${reset}"
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support."

View File

@ -24,10 +24,10 @@ LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPASS" ] || DBPASS='Pandor4!'
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTUSER" ] || DBROOTUSER=root
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
[ "$DBROOTPASS" ] || DBROOTPASS='Pandor4!'
[ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
@ -125,6 +125,52 @@ installing_docker () {
echo "End installig docker" &>> "$LOGFILE"
}
# Function to check if a password meets the MySQL secure password requirements
is_mysql_secure_password() {
local password=$1
# Check password length (at least 8 characters)
if [[ ${#password} -lt 8 ]]; then
echo "Password length should be at least 8 characters."
return 1
fi
# Check if password contains at least one uppercase letter
if [[ $password == ${password,,} ]]; then
echo "Password should contain at least one uppercase letter."
return 1
fi
# Check if password contains at least one lowercase letter
if [[ $password == ${password^^} ]]; then
echo "Password should contain at least one lowercase letter."
return 1
fi
# Check if password contains at least one digit
if ! [[ $password =~ [0-9] ]]; then
echo "Password should contain at least one digit."
return 1
fi
# Check if password contains at least one special character
if ! [[ $password =~ [[:punct:]] ]]; then
echo "Password should contain at least one special character."
return 1
fi
# Check if password is not a common pattern (e.g., "password", "123456")
local common_patterns=("password" "123456" "qwerty")
for pattern in "${common_patterns[@]}"; do
if [[ $password == *"$pattern"* ]]; then
echo "Password should not contain common patterns."
return 1
fi
done
# If all checks pass, the password is MySQL secure compliant
return 0
}
## Main
echo "Starting PandoraFMS Community deployment EL8 ver. $S_VERSION"
@ -189,6 +235,10 @@ execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed'
execute_cmd "dnf --version" 'Checking needed tools: dnf'
#Check mysql pass
execute_cmd "is_mysql_secure_password $DBROOTPASS" "Checking DBROOTPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
execute_cmd "is_mysql_secure_password $DBPASS" "Checking DBPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
# Creating working directory
rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE"
mkdir "$HOME"/pandora_deploy_tmp &>> "$LOGFILE"
@ -437,7 +487,6 @@ if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
if [ "$MYVER" -eq '80' ] ; then
echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = 'Pandor4!';
UNINSTALL COMPONENT 'file://component_validate_password';
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = '$DBROOTPASS';
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"
fi
@ -445,7 +494,6 @@ if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
if [ "$MYVER" -ne '80' ] ; then
echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('Pandor4!');
UNINSTALL PLUGIN validate_password;
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('$DBROOTPASS');
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"fi
fi

View File

@ -27,9 +27,9 @@ rm -f $LOGFILE &> /dev/null # remove last log before start
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPASS" ] || DBPASS='Pandor4!'
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
[ "$DBROOTPASS" ] || DBROOTPASS='Pandor4!'
[ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
@ -113,6 +113,53 @@ check_root_permissions () {
fi
}
# Function to check if a password meets the MySQL secure password requirements
is_mysql_secure_password() {
local password=$1
# Check password length (at least 8 characters)
if [[ ${#password} -lt 8 ]]; then
echo "Password length should be at least 8 characters."
return 1
fi
# Check if password contains at least one uppercase letter
if [[ $password == ${password,,} ]]; then
echo "Password should contain at least one uppercase letter."
return 1
fi
# Check if password contains at least one lowercase letter
if [[ $password == ${password^^} ]]; then
echo "Password should contain at least one lowercase letter."
return 1
fi
# Check if password contains at least one digit
if ! [[ $password =~ [0-9] ]]; then
echo "Password should contain at least one digit."
return 1
fi
# Check if password contains at least one special character
if ! [[ $password =~ [[:punct:]] ]]; then
echo "Password should contain at least one special character."
return 1
fi
# Check if password is not a common pattern (e.g., "password", "123456")
local common_patterns=("password" "123456" "qwerty")
for pattern in "${common_patterns[@]}"; do
if [[ $password == *"$pattern"* ]]; then
echo "Password should not contain common patterns."
return 1
fi
done
# If all checks pass, the password is MySQL secure compliant
return 0
}
installing_docker () {
#Installing docker for debug
echo "Start installig docker" &>> "$LOGFILE"
@ -194,6 +241,10 @@ execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed'
execute_cmd "apt --version" 'Checking needed tools: apt'
#Check mysql pass
execute_cmd "is_mysql_secure_password $DBROOTPASS" "Checking DBROOTPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
execute_cmd "is_mysql_secure_password $DBPASS" "Checking DBPASS password match policy" 'This password do not match minimum MySQL policy requirements, more info in: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html'
# Creating working directory
rm -rf "$WORKDIR" &>> "$LOGFILE"
mkdir -p "$WORKDIR" &>> "$LOGFILE"
@ -286,6 +337,7 @@ server_dependencies=" \
libgeo-ip-perl \
arping \
snmp-mibs-downloader \
snmptrapd \
libnsl2 \
openjdk-8-jdk "
execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
@ -402,6 +454,7 @@ if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
""" | mysql -uroot &>> "$LOGFILE"
export MYSQL_PWD=$DBROOTPASS
echo "INSTALL COMPONENT 'file://component_validate_password';" | mysql -uroot -P$DBPORT -h$DBHOST &>> "$LOGFILE"
echo -en "${cyan}Creating Pandora FMS database...${reset}"
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support."
@ -785,6 +838,10 @@ sed --follow-symlinks -i -e "s/^openssl_conf = openssl_init/#openssl_conf = open
# Enable postfix
systemctl enable postfix --now &>> "$LOGFILE"
# Disable snmptrapd
systemctl disable --now snmptrapd &>> "$LOGFILE"
systemctl disable --now snmptrapd.socket &>> "$LOGFILE"
#SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)

View File

@ -4,7 +4,7 @@ Architecture: all
Priority: optional
Section: admin
Installed-Size: 260
Maintainer: ÁRTICA ST <info@artica.es>
Maintainer: Pandora FMS <info@pandorafms.com>
Homepage: https://pandorafms.org/
Depends: coreutils, perl, unzip
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. Its possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.

View File

@ -4,7 +4,7 @@ Architecture: all
Priority: optional
Section: admin
Installed-Size: 260
Maintainer: ÁRTICA ST <info@artica.es>
Maintainer: Pandora FMS <info@pandorafms.com>
Homepage: http://pandorafms.org/
Depends: coreutils, perl
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. Its possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.

View File

@ -1,10 +1,10 @@
package: pandorafms-agent-unix
Version: 7.0NG.772-230720
Version: 7.0NG.772-230731
Architecture: all
Priority: optional
Section: admin
Installed-Size: 260
Maintainer: ÁRTICA ST <info@artica.es>
Maintainer: Pandora FMS <info@pandorafms.com>
Homepage: http://pandorafms.org/
Depends: coreutils, perl, unzip
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. Its possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.

View File

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

View File

@ -6,7 +6,7 @@
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
<key>CFBundleVersion</key> <string>7.0NG.772</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.772 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.772 Pandora FMS on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.772</string>
<key>NSPrincipalClass</key><string>NSApplication</string>

View File

@ -1031,7 +1031,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.772';
use constant AGENT_BUILD => '230720';
use constant AGENT_BUILD => '230731';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.772
%define release 230720
%define release 230731
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -0,0 +1,168 @@
#
#Pandora FMS Linux Agent
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.772
%define release 230725
Summary: Pandora FMS Linux agent, binary version
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: ArticaST <http://www.artica.es>
Source0: %{source_name}-%{version}.tar.gz
URL: http://pandorafms.org
Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: noarch
Requires(pre): shadow-utils
Requires(post): chkconfig /bin/ln
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: coreutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl(Sys::Syslog) perl(IO::Compress::Zip)
# Required by plugins
#Requires: sh-utils sed passwd net-tools rpm
AutoReq: 0
Provides: %{name}-%{version}
%description
Pandora FMS agent for unix. Pandora FMS is an OpenSource full-featured monitoring software.
%prep
rm -rf $RPM_BUILD_ROOT
%setup -q -n unix
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
install -m 0644 pandora_agent_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_agent
if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then
rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec
fi
%clean
rm -Rf $RPM_BUILD_ROOT
%pre
getent passwd pandora >/dev/null || \
/usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora
exit 0
chown pandora:root /var/log/pandora
%post
if [ ! -d /etc/pandora ] ; then
mkdir -p /etc/pandora
fi
if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
fi
if [ ! -f /etc/pandora/pandora_agent.conf ] ; then
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
else
[[ ! -f /etc/pandora/pandora_agent.conf.rpmnew ]] && ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
fi
if [ ! -e /etc/pandora/plugins ]; then
ln -s /usr/share/pandora_agent/plugins /etc/pandora
fi
if [ ! -e /etc/pandora/collections ]; then
mkdir -p /usr/share/pandora_agent/collections
ln -s /usr/share/pandora_agent/collections /etc/pandora
fi
if [ ! -e /etc/pandora/commands ]; then
mkdir -p /usr/share/pandora_agent/commands
ln -s /usr/share/pandora_agent/commands /etc/pandora
fi
mkdir -p /var/spool/pandora/data_out
if [ ! -d /var/log/pandora ]; then
mkdir -p /var/log/pandora
fi
if [ `command -v systemctl` ];
then
echo "Copying new version of pandora_agent_daemon service"
cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/
chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service
# Enable the services on SystemD
systemctl enable pandora_agent_daemon.service
else
/sbin/chkconfig --add pandora_agent_daemon
/sbin/chkconfig pandora_agent_daemon on
fi
if [ "$1" -gt 1 ]
then
echo "If Pandora Agent daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
%preun
# Upgrading
if [ "$1" = "1" ]; then
exit 0
fi
/sbin/chkconfig --del pandora_agent_daemon
/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
# Remove symbolic links
pushd /etc/pandora
for f in pandora_agent.conf plugins collections
do
[ -L $f ] && rm -f $f
done
exit 0
%files
%defattr(750,root,root)
/usr/bin/pandora_agent
%defattr(755,pandora,root)
%{prefix}/pandora_agent
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/etc/rc.d/init.d/pandora_agent_daemon
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.772
%define release 230720
%define release 230731
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.772"
PI_BUILD="230720"
PI_BUILD="230731"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{230720}
{230731}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.772 Build 230720")
#define PANDORA_VERSION ("7.0NG.772 Build 230731")
string pandora_path;
string pandora_dir;

View File

@ -6,12 +6,12 @@ BEGIN
BEGIN
BLOCK "080904E4"
BEGIN
VALUE "CompanyName", "Artica ST"
VALUE "CompanyName", "Pandora FMS"
VALUE "FileDescription", "Pandora FMS Agent for Windows Platform"
VALUE "LegalCopyright", "Artica ST"
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.772(Build 230720))"
VALUE "ProductVersion", "(7.0NG.772(Build 230731))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,10 +1,10 @@
package: pandorafms-console
Version: 7.0NG.772-230720
Version: 7.0NG.772-230731
Architecture: all
Priority: optional
Section: admin
Installed-Size: 42112
Maintainer: Artica ST <deptec@artica.es>
Maintainer: Pandora FMS <info@pandorafms.com>
Homepage: https://pandorafms.com/
Depends: php, php-snmp, php-gd, php-mysqlnd, php-db, php-xmlrpc, php-curl, graphviz, dbconfig-common, php-ldap, mysql-client | virtual-mysql-client, php-xmlrpc, php-zip, php-mbstring
Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process.

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.772-230720"
pandora_version="7.0NG.772-230731"
package_pear=0
package_pandora=1
@ -163,7 +163,7 @@ if [ $package_pear -eq 1 ]
then
echo "Make the package \"php-xml-rpc\"."
cd temp_package
dh-make-pear --maintainer "ÁRTICA ST <info@artica.es>" XML_RPC
dh-make-pear --maintainer "Pandora FMS <info@pandorafms.com>" XML_RPC
cd php-xml-rpc-*
dpkg-buildpackage -rfakeroot
cd ..

View File

@ -609,7 +609,7 @@
}
],
"description": "PHP library for ChartJS",
"homepage": "https://artica.es/",
"homepage": "https://pandorafms.com/",
"keywords": [
"chartjs",
"graph",

View File

@ -1,5 +1,49 @@
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `tdiscovery_apps` (
`id_app` int(10) auto_increment,
`short_name` varchar(250) NOT NULL DEFAULT '',
`name` varchar(250) NOT NULL DEFAULT '',
`section` varchar(250) NOT NULL DEFAULT 'custom',
`description` varchar(250) NOT NULL DEFAULT '',
`version` varchar(250) NOT NULL DEFAULT '',
PRIMARY KEY (`id_app`),
UNIQUE (`short_name`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tdiscovery_apps_scripts` (
`id_app` int(10),
`macro` varchar(250) NOT NULL DEFAULT '',
`value` text NOT NULL DEFAULT '',
PRIMARY KEY (`id_app`, `macro`),
FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tdiscovery_apps_executions` (
`id` int(10) unsigned NOT NULL auto_increment,
`id_app` int(10),
`execution` text NOT NULL DEFAULT '',
PRIMARY KEY (`id`, `id_app`),
FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tdiscovery_apps_tasks_macros` (
`id_task` int(10) unsigned NOT NULL,
`macro` varchar(250) NOT NULL DEFAULT '',
`type` varchar(250) NOT NULL DEFAULT 'custom',
`value` text NOT NULL DEFAULT '',
`temp_conf` tinyint unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id_task`, `macro`),
FOREIGN KEY (`id_task`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `trecon_task`
ADD COLUMN `id_app` int(10),
ADD COLUMN `setup_complete` tinyint unsigned NOT NULL DEFAULT 0,
ADD COLUMN `executions_timeout` int unsigned NOT NULL DEFAULT 60,
ADD FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE;
CREATE TABLE IF NOT EXISTS `tnetwork_explorer_filter` (
`id` INT NOT NULL,
`filter_name` VARCHAR(45) NULL,
@ -26,6 +70,7 @@ ALTER TABLE `tlayout_template`
ADD COLUMN `grid_color` VARCHAR(45) NOT NULL DEFAULT '#cccccc' AFTER `maintenance_mode`,
ADD COLUMN `grid_size` VARCHAR(45) NOT NULL DEFAULT '10' AFTER `grid_color`;
DELETE FROM tconfig WHERE token = 'refr';
INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`) VALUES (37,2,'CPU','CPU','','Brand;Clock;Model','',0,2);
@ -38,4 +83,32 @@ INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `descri
ALTER TABLE `treport_content` ADD COLUMN `period_range` INT NULL DEFAULT 0 AFTER `period`;
CREATE TABLE IF NOT EXISTS `tevent_comment` (
`id` serial PRIMARY KEY,
`id_event` BIGINT UNSIGNED NOT NULL,
`utimestamp` BIGINT NOT NULL DEFAULT 0,
`comment` TEXT,
`id_user` VARCHAR(255) DEFAULT NULL,
`action` TEXT,
FOREIGN KEY (`id_event`) REFERENCES `tevento`(`id_evento`)
ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`id_user`) REFERENCES tusuario(`id_user`)
ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
INSERT INTO `tevent_comment` (`id_event`, `utimestamp`, `comment`, `id_user`, `action`)
SELECT * FROM (
SELECT tevento.id_evento AS `id_event`,
JSON_UNQUOTE(JSON_EXTRACT(tevento.user_comment, CONCAT('$[',n.num,'].utimestamp'))) AS `utimestamp`,
JSON_UNQUOTE(JSON_EXTRACT(tevento.user_comment, CONCAT('$[',n.num,'].comment'))) AS `comment`,
JSON_UNQUOTE(JSON_EXTRACT(tevento.user_comment, CONCAT('$[',n.num,'].id_user'))) AS `id_user`,
JSON_UNQUOTE(JSON_EXTRACT(tevento.user_comment, CONCAT('$[',n.num,'].action'))) AS `action`
FROM tevento
INNER JOIN (SELECT 0 num UNION ALL SELECT 1 UNION ALL SELECT 2) n
ON n.num < JSON_LENGTH(tevento.user_comment)
WHERE tevento.user_comment != ""
) t order by utimestamp DESC;
ALTER TABLE tevento DROP COLUMN user_comment;
COMMIT;

View File

@ -233,11 +233,8 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$header_autorefresh = '';
$header_autorefresh_counter = '';
if ($config['legacy_vc']
|| ($_GET['sec2'] !== 'operation/visual_console/render_view')
|| (($_GET['sec2'] !== 'operation/visual_console/render_view')
&& $config['legacy_vc'])
) {
if (($_GET['sec2'] !== 'operation/visual_console/render_view')) {
if ($autorefresh_list !== null
&& array_search($_GET['sec2'], $autorefresh_list) !== false
) {

View File

@ -212,7 +212,7 @@ $groups = users_get_groups($config['id_user'], 'AR', false);
// Get modules.
$modules = db_get_all_rows_sql(
'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
WHERE id_agente = '.$id_parent
WHERE id_agente = '.$id_agente
);
$modules_values = [];
$modules_values[0] = __('Any');
@ -300,7 +300,7 @@ if (enterprise_installed() === true) {
// Parent agents.
$paramsParentAgent = [];
$paramsParentAgent['return'] = true;
$paramsParentAgent['show_helptip'] = false;
$paramsParentAgent['show_helptip'] = true;
$paramsParentAgent['input_name'] = 'id_parent';
$paramsParentAgent['print_hidden_input_idagent'] = true;
$paramsParentAgent['hidden_input_idagent_name'] = 'id_agent_parent';
@ -646,7 +646,7 @@ if (enterprise_installed() === true) {
// Parent agent.
$tableAdvancedAgent->data['parent_agent'][] = html_print_label_input_block(
__('Parent'),
__('Agent parent'),
ui_print_agent_autocomplete_input($paramsParentAgent)
);
@ -1205,15 +1205,30 @@ ui_require_jquery_file('bgiframe');
$("#cascade_protection_module").attr("disabled", 'disabled');
}
$("#checkbox-cascade_protection").change(function () {
var checked = $("#checkbox-cascade_protection").is(":checked");
if (checked) {
$("#text-id_parent").change(function(){
const parent = $("#text-id_parent").val();
if (parent != '') {
$("#checkbox-cascade_protection").prop('checked', true);
$("#cascade_protection_module").removeAttr("disabled");
}
else {
$("#cascade_protection_module").val(0);
$("#cascade_protection_module").attr("disabled", 'disabled');
$("#text-id_parent").removeAttr("required");
$("#cascade_protection_module").empty();
$("#checkbox-cascade_protection").prop('checked', false);
}
});
$("#checkbox-cascade_protection").change(function () {
var checked = $("#checkbox-cascade_protection").is(":checked"); if (checked) {
$("#cascade_protection_module").removeAttr("disabled");
$("#text-id_parent").attr("required", "required");
}
else {
$("#cascade_protection_module").val(0);
$("#cascade_protection_module").attr("disabled", 'disabled');
$("#text-id_parent").removeAttr("required");
}
});

View File

@ -89,7 +89,7 @@ if (is_ajax() === true) {
[
'id' => 'agent_modules_affected_planned_downtime',
'class' => 'info_table',
'style' => 'width: 99%',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'godmode/agentes/planned_downtime.list',

View File

@ -184,7 +184,7 @@ if (empty($result) === false) {
]
).'</a>&nbsp;&nbsp;';
$data[1] .= '<a href="index.php?sec=advanced&sec2=godmode/category/category&delete_category='.$category['id'].'&pure='.(int) $config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image(
'images/delet.svg',
'images/delete.svg',
true,
[
'title' => __('Delete'),

View File

@ -187,7 +187,7 @@ try {
[
'id' => 'list_agents_tactical',
'class' => 'info_table',
'style' => 'width: 99%',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columnNames,
'return' => true,

View File

@ -189,6 +189,14 @@ echo get_table_inputs_masive_agents($params);
if (is_metaconsole() === true || is_management_allowed() === true) {
attachActionButton('delete', 'delete', '100%', false, $SelectAction);
} else {
html_print_action_buttons(
'',
[
'right_content' => $SelectAction,
'class' => 'pdd_t_15px_important pdd_b_15px_important',
]
);
}
echo '</form>';

View File

@ -30,6 +30,7 @@
// Begin.
require_once 'include/config.php';
require_once 'include/functions_menu.php';
require_once $config['homedir'].'/godmode/wizards/ManageExtensions.class.php';
check_login();
@ -78,15 +79,97 @@ if ((bool) check_acl($config['id_user'], 0, 'AR') === true
}
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
enterprise_hook('applications_menu');
enterprise_hook('cloud_menu');
}
// Applications.
$sub2 = [];
if (enterprise_installed() === true) {
$sub2['godmode/servers/discovery&wiz=app&mode=MicrosoftSQLServer']['text'] = __('Microsoft SQL Server');
$sub2['godmode/servers/discovery&wiz=app&mode=mysql']['text'] = __('Mysql');
$sub2['godmode/servers/discovery&wiz=app&mode=oracle']['text'] = __('Oracle');
$sub2['godmode/servers/discovery&wiz=app&mode=vmware']['text'] = __('VMware');
$sub2['godmode/servers/discovery&wiz=app&mode=SAP']['text'] = __('SAP');
$sub2['godmode/servers/discovery&wiz=app&mode=DB2']['text'] = __('DB2');
}
if ((bool) check_acl($config['id_user'], 0, 'RW') === true
|| (bool) check_acl($config['id_user'], 0, 'RM') === true
|| (bool) check_acl($config['id_user'], 0, 'PM') === true
) {
enterprise_hook('console_task_menu');
$extensions = ManageExtensions::getExtensionBySection('app');
if ($extensions !== false) {
foreach ($extensions as $key => $extension) {
$url = sprintf(
'godmode/servers/discovery&wiz=app&mode=%s',
$extension['short_name']
);
$sub2[$url]['text'] = __($extension['name']);
}
}
if ($extensions !== false || enterprise_installed() === true) {
$sub['godmode/servers/discovery&wiz=app']['text'] = __('Applications');
$sub['godmode/servers/discovery&wiz=app']['id'] = 'app';
$sub['godmode/servers/discovery&wiz=app']['type'] = 'direct';
$sub['godmode/servers/discovery&wiz=app']['subtype'] = 'nolink';
$sub['godmode/servers/discovery&wiz=app']['sub2'] = $sub2;
}
// Cloud.
$sub2 = [];
if (enterprise_installed() === true) {
$sub2['godmode/servers/discovery&wiz=cloud&mode=amazonws']['text'] = __('Amazon Web Services');
$sub2['godmode/servers/discovery&wiz=cloud&mode=azure']['text'] = __('Microsoft Azure');
$sub2['godmode/servers/discovery&wiz=cloud&mode=gcp']['text'] = __('Google Compute Platform');
}
$extensions = ManageExtensions::getExtensionBySection('cloud');
if ($extensions !== false) {
foreach ($extensions as $key => $extension) {
$url = sprintf(
'godmode/servers/discovery&wiz=cloud&mode=%s',
$extension['short_name']
);
$sub2[$url]['text'] = __($extension['name']);
}
}
if ($extensions !== false || enterprise_installed() === true) {
$sub['godmode/servers/discovery&wiz=cloud']['text'] = __('Cloud');
$sub['godmode/servers/discovery&wiz=cloud']['id'] = 'cloud';
$sub['godmode/servers/discovery&wiz=cloud']['type'] = 'direct';
$sub['godmode/servers/discovery&wiz=cloud']['subtype'] = 'nolink';
$sub['godmode/servers/discovery&wiz=cloud']['sub2'] = $sub2;
}
// Custom.
$sub2 = [];
$extensions = ManageExtensions::getExtensionBySection('custom');
if ($extensions !== false) {
foreach ($extensions as $key => $extension) {
$url = sprintf(
'godmode/servers/discovery&wiz=custom&mode=%s',
$extension['short_name']
);
$sub2[$url]['text'] = __($extension['name']);
}
$sub['godmode/servers/discovery&wiz=custom']['text'] = __('Custom');
$sub['godmode/servers/discovery&wiz=custom']['id'] = 'customExt';
$sub['godmode/servers/discovery&wiz=custom']['type'] = 'direct';
$sub['godmode/servers/discovery&wiz=custom']['subtype'] = 'nolink';
$sub['godmode/servers/discovery&wiz=custom']['sub2'] = $sub2;
}
if (check_acl($config['id_user'], 0, 'RW')
|| check_acl($config['id_user'], 0, 'RM')
|| check_acl($config['id_user'], 0, 'PM')
) {
$sub['godmode/servers/discovery&wiz=magextensions']['text'] = __('Manage disco packages');
$sub['godmode/servers/discovery&wiz=magextensions']['id'] = 'mextensions';
}
if ((bool) check_acl($config['id_user'], 0, 'RW') === true
|| (bool) check_acl($config['id_user'], 0, 'RM') === true
|| (bool) check_acl($config['id_user'], 0, 'PM') === true
) {
enterprise_hook('console_task_menu');
}
}
}
@ -502,9 +585,13 @@ if ($access_console_node === true) {
$sub2[$extmenu['sec2']]['refr'] = 0;
} else {
if (is_array($extmenu) === true && array_key_exists('fatherId', $extmenu) === true) {
if (strlen($extmenu['fatherId']) > 0) {
if (empty($extmenu['fatherId']) === false
&& strlen($extmenu['fatherId']) > 0
) {
if (array_key_exists('subfatherId', $extmenu) === true) {
if (strlen($extmenu['subfatherId']) > 0) {
if (empty($extmenu['subfatherId']) === false
&& 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'] = str_replace(' ', '_', $extmenu['name']);
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['refr'] = 0;

View File

@ -488,14 +488,38 @@ if (!empty($graphs)) {
true
);
$ActionButtons[] = '</form>';
$offset = (int) get_parameter('offset', 0);
$block_size = (int) $config['block_size'];
$tablePagination = ui_pagination(
count($graphs),
false,
$offset,
$block_size,
true,
'offset',
false
);
}
// FALTA METER EL PRINT TABLE.
html_print_table($table);
html_print_action_buttons(
implode('', $ActionButtons),
['type' => 'form_action']
);
if (is_metaconsole() === true) {
html_print_action_buttons(
implode('', $ActionButtons),
['type' => 'form_action']
);
} else {
html_print_action_buttons(
implode('', $ActionButtons),
[
'type' => 'form_action',
'right_content' => $tablePagination,
]
);
}
}
echo '</div>';

View File

@ -6720,6 +6720,8 @@ function chooseType() {
$("#row_agent").show();
$("#row_module").show();
$("#row_historical_db_check").hide();
period_set_value($("#hidden-period").attr('class'), 3600);
$("#row_period").find('select').val('3600').trigger('change');
break;
case 'SLA_monthly':

View File

@ -116,10 +116,13 @@ if (!$report_r && !$report_w && !$report_m) {
}
require_once $config['homedir'].'/include/functions_reports.php';
require_once $config['homedir'].'/godmode/wizards/DiscoveryTaskList.class.php';
// Load enterprise extensions.
enterprise_include('operation/reporting/custom_reporting.php');
enterprise_include_once('include/functions_metaconsole.php');
enterprise_include_once('include/functions_tasklist.php');
enterprise_include_once('include/functions_cron.php');
@ -782,7 +785,7 @@ switch ($action) {
'<span class="subsection_header_title">'.__('Filters').'</span>',
'filter_form',
'',
false,
true,
false,
'',
'white-box-content',
@ -1251,7 +1254,12 @@ switch ($action) {
array_push($table->data, $data);
}
html_print_table($table);
$reports_table = '<div class="white_box">';
$reports_table .= '<span class="white_table_graph_header">'.__('Reports').'</span>';
$reports_table .= html_print_table($table, true);
$reports_table .= '<br></div>';
echo $reports_table;
$tablePagination = ui_pagination(
$total_reports,
$url,
@ -1259,7 +1267,7 @@ switch ($action) {
$pagination,
true,
'offset',
false,
false
);
} else {
ui_print_info_message(
@ -1270,6 +1278,21 @@ switch ($action) {
);
}
$discovery_tasklist = new DiscoveryTaskList();
$report_task_data = $discovery_tasklist->showListConsoleTask(true);
if (is_array($report_task_data) === true || strpos($report_task_data, 'class="nf"') === false) {
$task_table = '<div class="mrgn_top_15px white_box">';
$task_table .= '<span class="white_table_graph_header">'.__('Report tasks');
$task_table .= ui_print_help_tip(__('To schedule a report, do it from the editing view of each report.'), true);
$task_table .= '</span><div>';
$task_table .= $report_task_data;
$task_table .= '</div></div>';
echo $task_table;
} else {
ui_print_info_message($report_task_data.__('To schedule a report, do it from the editing view of each report.'));
}
if (check_acl($config['id_user'], 0, 'RW')
|| check_acl($config['id_user'], 0, 'RM')
) {

View File

@ -837,12 +837,6 @@ $buttons['wizard'] = [
'active' => false,
'text' => '<a href="'.$url_base.$action.'&tab=wizard&id_visual_console='.$idVisualConsole.'">'.html_print_image('images/wizard@svg.svg', true, ['title' => __('Wizard'), 'class' => 'invert_filter']).'</a>',
];
if ($config['legacy_vc']) {
$buttons['editor'] = [
'active' => false,
'text' => '<a href="'.$url_base.$action.'&tab=editor&id_visual_console='.$idVisualConsole.'">'.html_print_image('images/builder@svg.svg', true, ['title' => __('Builder'), 'class' => 'invert_filter']).'</a>',
];
}
$buttons['view'] = [
'active' => false,

View File

@ -53,6 +53,12 @@ function get_wiz_class($str)
case 'deploymentCenter':
return 'DeploymentCenter';
case 'magextensions':
return 'ManageExtensions';
case 'custom':
return 'Custom';
default:
// Main, show header.
ui_print_standard_header(
@ -161,7 +167,7 @@ if ($classname_selected === null) {
$wiz_data = [];
foreach ($classes as $classpath) {
if (is_reporting_console_node() === true) {
if ($classpath !== '/var/www/html/pandora_console/godmode/wizards/DiscoveryTaskList.class.php') {
if ($classpath !== $config['homedir'].'/godmode/wizards/DiscoveryTaskList.class.php') {
continue;
}
}
@ -169,6 +175,12 @@ if ($classname_selected === null) {
$classname = basename($classpath, '.class.php');
$obj = new $classname();
if (method_exists($obj, 'isEmpty') === true) {
if ($obj->isEmpty() === true) {
continue;
}
}
$button = $obj->load();
if ($button === false) {

View File

@ -560,7 +560,14 @@ if (empty($create) === false || empty($view) === false) {
// $data[0] = html_print_div(['id' => 'command_preview', 'class' => 'mono'], true);
$data[0] = html_print_label_input_block(
__('Command preview'),
html_print_div(['id' => 'command_preview', 'class' => 'mono'], true)
html_print_div(
[
'id' => 'command_preview',
'class' => 'mono',
'style' => 'max-width: 1050px;overflow-wrap: break-word;',
],
true
)
);
$table->data['plugin_preview_inputs'] = $data;
$table->colspan['plugin_preview_inputs'][0] = 2;

View File

@ -101,6 +101,13 @@ foreach ($servers as $server) {
}
}
$ext = '';
// Check for any data-type server present in servers list. If none, enable server access for first server.
if (array_search('data', array_column($servers, 'type')) === false) {
$ext = '_server';
}
foreach ($servers as $server) {
$data = [];
@ -185,14 +192,12 @@ foreach ($servers as $server) {
$data[7] = ui_print_timestamp($server['keepalive'], true);
$ext = '_server';
if ($server['type'] != 'data') {
$ext = '';
if ($server['type'] === 'data') {
$ext = '_server';
}
$safe_server_name = servers_get_name($server['id_server']);
if (($server['type'] == 'data' || $server['type'] == 'enterprise satellite')) {
if (($ext === '_server' || $server['type'] == 'enterprise satellite')) {
if (servers_check_remote_config($safe_server_name.$ext) && enterprise_installed()) {
$names_servers[$safe_server_name] = true;
} else {
@ -253,9 +258,19 @@ foreach ($servers as $server) {
);
$data[8] .= '</a>';
if (($names_servers[$safe_server_name] === true) && ($server['type'] === 'data' || $server['type'] === 'enterprise satellite')) {
if (($names_servers[$safe_server_name] === true) && ($ext === '_server' || $server['type'] === 'enterprise satellite')) {
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'&tab=agent_editor').'">';
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'&tab=standard_editor">';
$data[8] .= html_print_image(
'images/agents@svg.svg',
true,
[
'title' => __('Manage server conf'),
'class' => 'main_menu_icon invert_filter',
]
);
$data[8] .= '</a>';
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'">';
$data[8] .= html_print_image(
'images/remote-configuration@svg.svg',
true,
@ -288,6 +303,8 @@ foreach ($servers as $server) {
unset($data[8]);
}
$ext = '';
array_push($table->data, $data);
}

View File

@ -545,23 +545,8 @@ $table->data[6][0] = html_print_label_input_block(
)
);
$table->data[6][1] = html_print_label_input_block(
__('Max. days before delete old network matrix data'),
html_print_input(
[
'type' => 'number',
'size' => 5,
'max' => $performance_variables_control['delete_old_network_matrix']->max,
'name' => 'delete_old_network_matrix',
'value' => $config['delete_old_network_matrix'],
'return' => true,
'min' => $performance_variables_control['delete_old_network_matrix']->min,
]
)
);
if (enterprise_installed()) {
$table->data[7][0] = html_print_label_input_block(
$table->data[6][1] = html_print_label_input_block(
__('Max. days before delete inventory data'),
html_print_input_text(
'inventory_purge',
@ -574,6 +559,18 @@ if (enterprise_installed()) {
);
}
$table->data[7][1] = html_print_label_input_block(
__('Max. days before disabled agents are deleted'),
html_print_input_text(
'delete_disabled_agents',
$config['delete_disabled_agents'],
'',
false,
0,
true
)
);
$table_other = new stdClass();
$table_other->width = '100%';
$table_other->class = 'filter-table-adv';

View File

@ -747,6 +747,26 @@ $table->data[$i][] = html_print_label_input_block(
)
);
$table->data[$i++][] = html_print_label_input_block(
__('Max. hours old events comments'),
html_print_input_number(
[
'name' => 'max_hours_old_event_comment',
'min' => 0,
'value' => $config['max_hours_old_event_comment'],
]
)
);
$table->data[$i][] = html_print_label_input_block(
__('Show experimental features'),
html_print_checkbox_switch(
'show_experimental_features',
1,
$config['show_experimental_features'],
true
)
);
echo '<form class="max_floating_element_size" id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';
echo '<fieldset class="margin-bottom-10">';

View File

@ -1344,17 +1344,6 @@ $table_vc->style[0] = 'font-weight: bold';
$table_vc->size[0] = '50%';
$table_vc->data = [];
// Remove when the new view reaches rock solid stability.
$table_vc->data[$row][] = html_print_label_input_block(
__('Legacy Visual Console View'),
html_print_checkbox_switch(
'legacy_vc',
1,
(bool) $config['legacy_vc'],
true
)
);
$table_vc->data[$row][] = html_print_label_input_block(
__('Default cache expiration'),
html_print_extended_select_for_time(
@ -1372,7 +1361,6 @@ $table_vc->data[$row][] = html_print_label_input_block(
$intervals
)
);
$row++;
$table_vc->data[$row][] = html_print_label_input_block(
__('Default interval for refresh on Visual Console'),
@ -1388,6 +1376,7 @@ $table_vc->data[$row][] = html_print_label_input_block(
false
)
);
$row++;
$table_vc->data[$row][] = html_print_label_input_block(
__('Type of view of visual consoles'),
@ -1401,12 +1390,12 @@ $table_vc->data[$row][] = html_print_label_input_block(
true
)
);
$row++;
$table_vc->data[$row][] = html_print_label_input_block(
__('Number of favorite visual consoles to show in the menu'),
"<input ' value=".$config['vc_menu_items']." size='5' name='vc_menu_items' min='0' max='25'>"
);
$row++;
$table_vc->data[$row][] = html_print_label_input_block(
__('Default line thickness for the Visual Console'),
@ -1419,7 +1408,6 @@ $table_vc->data[$row][] = html_print_label_input_block(
true
)
);
$row++;
$table_vc->data[$row][] = html_print_label_input_block(
__('Lock screen orientation when viewing on mobile devices'),
@ -1430,6 +1418,7 @@ $table_vc->data[$row][] = html_print_label_input_block(
true
)
);
$row++;
$table_vc->data[$row][] = html_print_label_input_block(
__('Display item frame on alert triggered'),

View File

@ -50,7 +50,7 @@ try {
[
'id' => $tableId,
'class' => 'info_table',
'style' => 'width: 99%',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'include/ajax/update_manager',

View File

@ -0,0 +1,221 @@
<?php
/**
* Applications wizard manager.
*
* @category Wizard
* @package Pandora FMS
* @subpackage Applications
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2007-2021 Artica Soluciones Tecnologicas, http://www.artica.es
* This code is NOT free software. This code is NOT licenced under GPL2 licence
* You cannnot redistribute it without written permission of copyright holder.
* ============================================================================
*/
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/class/ExtensionsDiscovery.class.php';
/**
* Implements Wizard to provide generic Applications wizard.
*/
class Applications extends Wizard
{
/**
* Sub-wizard to be launch (vmware,oracle...).
*
* @var string
*/
public $mode;
/**
* Constructor.
*
* @param integer $page Start page, by default 0.
* @param string $msg Default message to show to users.
* @param string $icon Target icon to be used.
* @param string $label Target label to be displayed.
*
* @return mixed
*/
public function __construct(
int $page=0,
string $msg='Default message. Not set.',
string $icon='images/wizard/applications.png',
string $label='Applications'
) {
$this->setBreadcrum([]);
$this->access = 'AW';
$this->task = [];
$this->msg = $msg;
$this->icon = $icon;
$this->class = $class_style;
$this->label = $label;
$this->page = $page;
$this->url = ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=app'
);
return $this;
}
/**
* Run wizard manager.
*
* @return mixed Returns null if wizard is ongoing. Result if done.
*/
public function run()
{
global $config;
// Load styles.
parent::run();
// Load current wiz. sub-styles.
ui_require_css_file(
'application',
ENTERPRISE_DIR.'/include/styles/wizards/'
);
$mode = get_parameter('mode', null);
// Load application wizards.
$enterprise_classes = glob(
$config['homedir'].'/'.ENTERPRISE_DIR.'/include/class/*.app.php'
);
$extensions = new ExtensionsDiscovery('app', $mode);
foreach ($enterprise_classes as $classpath) {
enterprise_include_once(
'include/class/'.basename($classpath)
);
}
switch ($mode) {
case 'DB2':
$classname_selected = 'DB2';
break;
case 'SAP':
$classname_selected = 'SAP';
break;
case 'vmware':
$classname_selected = 'VMware';
break;
case 'mysql':
$classname_selected = 'MySQL';
break;
case 'oracle':
$classname_selected = 'Oracle';
break;
case 'MicrosoftSQLServer':
$classname_selected = 'MicrosoftSQLServer';
break;
default:
$classname_selected = null;
break;
}
// Else: class not found pseudo exception.
if ($classname_selected !== null) {
$wiz = new $classname_selected($this->page);
$result = $wiz->run();
if (is_array($result) === true) {
return $result;
}
}
if ($classname_selected === null) {
if ($mode !== null) {
// Load extension if exist.
$extensions->run();
return;
}
// Load classes and print selector.
$wiz_data = [];
foreach ($enterprise_classes as $classpath) {
$classname = basename($classpath, '.app.php');
$obj = new $classname();
$wiz_data[] = $obj->load();
}
$wiz_data = array_merge($wiz_data, $extensions->loadExtensions());
$this->prepareBreadcrum(
[
[
'link' => ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery'
),
'label' => __('Discovery'),
],
[
'link' => ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=app'
),
'label' => __('Applications'),
'selected' => true,
],
]
);
// Header.
ui_print_page_header(
__('Applications'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
$this->printHeader(true)
);
Wizard::printBigButtonsList($wiz_data);
echo '<div class="app_mssg"><i>*'.__('All company names used here are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.').'</i></div>';
}
return $result;
}
/**
* Check if section have extensions.
*
* @return boolean Return true if section is empty.
*/
public function isEmpty()
{
$extensions = new ExtensionsDiscovery('app');
$listExtensions = $extensions->getExtensionsApps();
if ($listExtensions > 0 || enterprise_installed() === true) {
return false;
} else {
return true;
}
}
}

View File

@ -0,0 +1,661 @@
<?php
/**
* Cloud wizard manager.
*
* @category Wizard
* @package Pandora FMS
* @subpackage Cloud
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2007-2021 Artica Soluciones Tecnologicas, http://www.artica.es
* This code is NOT free software. This code is NOT licenced under GPL2 licence
* You cannnot redistribute it without written permission of copyright holder.
* ============================================================================
*/
global $config;
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/class/CredentialStore.class.php';
/**
* Implements Wizard to provide generic Cloud wizard.
*/
class Cloud extends Wizard
{
/**
* Sub-wizard to be launch (vmware,oracle...).
*
* @var string
*/
public $mode;
/**
* Discovery task data.
*
* @var array.
*/
public $task;
/**
* General maxPages.
*
* @var integer
*/
public $maxPages;
/**
* Product string.
*
* @var string
*/
protected $product = '';
/**
* Credentials store identifier.
*
* @var string
*/
protected $keyIdentifier = null;
/**
* Credentials store product identifier.
*
* @var string
*/
protected $keyStoreType = null;
/**
* Constructor.
*
* @param integer $page Start page, by default 0.
* @param string $msg Default message to show to users.
* @param string $icon Target icon to be used.
* @param string $label Target label to be displayed.
*
* @return mixed
*/
public function __construct(
int $page=0,
string $msg='Default message. Not set.',
string $icon='images/wizard/cloud.png',
string $label='Cloud'
) {
$this->setBreadcrum([]);
$this->access = 'AW';
$this->task = [];
$this->msg = $msg;
$this->icon = $icon;
$this->label = $label;
$this->page = $page;
$this->url = ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=cloud'
);
return $this;
}
/**
* Run wizard manager.
*
* @return mixed Returns null if wizard is ongoing. Result if done.
*/
public function run()
{
global $config;
// Load styles.
parent::run();
// Load current wiz. sub-styles.
ui_require_css_file(
'cloud',
ENTERPRISE_DIR.'/include/styles/wizards/'
);
$mode = get_parameter('mode', null);
// Load cloud wizards.
$enterprise_classes = glob(
$config['homedir'].'/'.ENTERPRISE_DIR.'/include/class/*.cloud.php'
);
$extensions = new ExtensionsDiscovery('cloud', $mode);
foreach ($enterprise_classes as $classpath) {
enterprise_include_once(
'include/class/'.basename($classpath)
);
}
switch ($mode) {
case 'amazonws':
$classname_selected = 'Aws';
break;
case 'azure':
$classname_selected = 'Azure';
break;
case 'gcp':
$classname_selected = 'Google';
break;
default:
$classname_selected = null;
break;
}
// Else: class not found pseudo exception.
if ($classname_selected !== null) {
$wiz = new $classname_selected($this->page);
$result = $wiz->run();
if (is_array($result) === true) {
return $result;
}
}
if ($classname_selected === null) {
if ($mode !== null) {
// Load extension if exist.
$extensions->run();
return;
}
// Load classes and print selector.
$wiz_data = [];
foreach ($enterprise_classes as $classpath) {
$classname = basename($classpath, '.cloud.php');
$obj = new $classname();
$wiz_data[] = $obj->load();
}
$wiz_data = array_merge($wiz_data, $extensions->loadExtensions());
$this->prepareBreadcrum(
[
[
'link' => ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery'
),
'label' => __('Discovery'),
],
[
'link' => $this->url,
'label' => __('Cloud'),
'selected' => true,
],
],
true
);
// Header.
ui_print_page_header(
__('Cloud'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
$this->printHeader(true)
);
Wizard::printBigButtonsList($wiz_data);
echo '<div class="app_mssg"><i>*'.__('All company names used here are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.').'</i></div>';
}
return $result;
}
/**
* Run credentials wizard.
*
* @return boolean True if credentials wizard is displayed and false if not.
*/
public function runCredentials()
{
global $config;
if ($this->status === false) {
$empty_account = true;
}
// Checks credentials. If check not passed. Show the form to fill it.
if ($this->checkCredentials()) {
return true;
}
// Add breadcrum and print header.
$this->prepareBreadcrum(
[
[
'link' => $this->url.'&credentials=1',
'label' => __('%s credentials', $this->product),
'selected' => true,
],
],
true
);
// Header.
ui_print_page_header(
__('%s credentials', $this->product),
'',
false,
$this->product.'_credentials_tab',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
$this->printHeader(true)
);
if ($this->product === 'Aws') {
ui_print_warning_message(
__(
'If a task with the selected credentials is already running, it will be edited. To create a new one, another account from the credential store must be selected.'
)
);
}
if ($this->status === true) {
ui_print_success_message($this->msg);
} else if ($this->status === false) {
ui_print_error_message($this->msg);
}
if ($empty_account === true) {
ui_print_error_message($this->msg);
}
$link_to_cs = '';
if (check_acl($config['id_user'], 0, 'UM')) {
$link_to_cs = '<a class="ext_link" href="'.ui_get_full_url(
'index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox'
).'" >';
$link_to_cs .= __('Manage accounts').'</a>';
}
$this->getCredentials();
$this->printFormAsList(
[
'form' => [
'action' => $this->url,
'method' => 'POST',
'id' => 'form-credentials',
],
'inputs' => [
[
'label' => __('Cloud tool full path'),
'arguments' => [
'name' => 'cloud_util_path',
'value' => isset($config['cloud_util_path']) ? io_safe_output($config['cloud_util_path']) : '/usr/bin/pandora-cm-api',
'type' => 'text',
],
],
[
'label' => __('Account'),
'extra' => $link_to_cs,
'arguments' => [
'name' => 'account_identifier',
'type' => 'select',
'fields' => CredentialStore::getKeys($this->keyStoreType),
'selected' => $this->keyIdentifier,
'return' => true,
],
],
[
'arguments' => [
'name' => 'parse_credentials',
'value' => 1,
'type' => 'hidden',
'return' => true,
],
],
],
]
);
$buttons_form = $this->printInput(
[
'name' => 'submit',
'label' => __('Validate'),
'type' => 'submit',
'attributes' => [
'icon' => 'wand',
'form' => 'form-credentials',
],
'return' => true,
'width' => 'initial',
]
);
$buttons_form .= $this->printGoBackButton(
ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=cloud'
),
true
);
html_print_action_buttons($buttons_form);
return false;
}
/**
* Check credentials.
*
* @return boolean True if credentials are OK.
*/
public function checkCredentials()
{
global $config;
$pandora = io_safe_output($config['cloud_util_path']);
if (isset($pandora) === false) {
config_update_value('cloud_util_path', '/usr/bin/pandora-cm-api');
}
if ((bool) get_parameter('disconnect_account', false) === true) {
$this->status = null;
return false;
}
if ($this->keyIdentifier === null) {
// Ask user for available credentials.
$this->msg = __('Select a set of credentials from the list');
$this->status = null;
return false;
}
$credentials = $this->getCredentials($this->keyIdentifier);
if (empty($credentials['username']) === true
|| empty($credentials['password']) === true
|| isset($pandora) === false
|| is_executable($pandora) === false
) {
if (is_executable($pandora) === false) {
$this->msg = (__('Path %s is not executable.', $pandora));
$this->status = false;
} else {
$this->msg = __('Invalid username or password');
$this->status = false;
}
return false;
}
try {
$value = $this->executeCMCommand('--get availability');
} catch (Exception $e) {
$this->msg = $e->getMessage();
$this->status = false;
return false;
}
if ($value == '1') {
return true;
}
$this->status = false;
// Error message directly from pandora-cm-api.
$this->msg = str_replace('"', '', $value);
return false;
}
/**
* Handle the click on disconnect account link.
*
* @return void But it prints some info to user.
*/
protected function parseDisconnectAccount()
{
// Check if disconection account link is pressed.
if ((bool) get_parameter('disconnect_account') === false) {
return;
}
$ret = $this->setCredentials(null);
if ($ret) {
$this->msg = __('Account disconnected');
} else {
$this->msg = __('Failed disconnecting account');
}
$this->status = $ret;
$this->page = 0;
}
/**
* Build an array with Product credentials.
*
* @return array with credentials (pass and id).
*/
public function getCredentials()
{
return CredentialStore::getKey($this->keyIdentifier);
}
/**
* Set Product credentials.
*
* @param string|null $identifier Credential store identifier.
*
* @return boolean True if success.
*/
public function setCredentials($identifier)
{
if ($identifier === null) {
unset($this->keyIdentifier);
return true;
}
if (isset($identifier) === false) {
return false;
}
$all = CredentialStore::getKeys($this->type);
if (in_array($identifier, $all) === true) {
$this->keyIdentifier = $identifier;
return true;
}
return false;
}
/**
* Parse credentials form.
*
* @return void But it prints a message.
*/
protected function parseCredentials()
{
global $config;
if (!$this->keyIdentifier) {
$this->setCredentials(get_parameter('ki', null));
}
// Check if credentials form is submitted.
if ((bool) get_parameter('parse_credentials') === false) {
return;
}
$this->page = 0;
$ret = $this->setCredentials(
get_parameter('account_identifier')
);
$path = get_parameter('cloud_util_path');
$ret_path = config_update_value('cloud_util_path', $path);
if ($ret_path) {
$config['cloud_util_path'] = $path;
}
if ($ret && $ret_path) {
$this->msg = __('Credentials successfully updated');
} else {
$this->msg = __('Failed updating credentials process');
}
$this->status = ($ret && $ret_path);
}
/**
* This method must be implemented.
*
* Execute a pandora-cm-api request.
*
* @param string $command Command to execute.
*
* @return void But must return string STDOUT of executed command.
* @throws Exception If not implemented.
*/
protected function executeCMCommand($command)
{
throw new Exception('executeCMCommand must be implemented.');
}
/**
* Get a recon token value
*
* @param string $token The recon key to retrieve.
*
* @return string String with the value.
*/
protected function getConfigReconElement($token)
{
if ($this->reconConfig === false
|| isset($this->reconConfig[0][$token]) === false
) {
if (is_array($this->task) === true
&& isset($this->task[$token]) === true
) {
return $this->task[$token];
} else {
return '';
}
} else {
return $this->reconConfig[0][$token];
}
}
/**
* Print global inputs
*
* @param boolean $last True if is last element.
*
* @return array Array with all global inputs.
*/
protected function getGlobalInputs(bool $last=false)
{
$task_id = $this->task['id_rt'];
if (!$task_id) {
$task_id = $this->getConfigReconElement('id_rt');
}
return [
[
'arguments' => [
'name' => 'page',
'value' => ($this->page + 1),
'type' => 'hidden',
'return' => true,
],
],
[
'arguments' => [
'name' => 'submit',
'label' => ($last) ? __('Finish') : __('Next'),
'type' => 'submit',
'attributes' => 'class="sub '.(($last) ? 'wand' : 'next').'"',
'return' => true,
],
],
[
'arguments' => [
'name' => 'task',
'value' => $task_id,
'type' => 'hidden',
'return' => true,
],
],
[
'arguments' => [
'name' => 'parse_form',
'value' => 1,
'type' => 'hidden',
'return' => true,
],
],
];
}
/**
* Print required css in some points.
*
* @return string With js code.
*/
protected function cloudJS()
{
return '
function toggleCloudSubmenu(curr_elem, id_csm){
if (document.getElementsByName(curr_elem)[0].checked){
$("#li-"+id_csm).show();
} else {
$("#li-"+id_csm).hide();
}
};
';
}
/**
* Check if section have extensions.
*
* @return boolean Return true if section is empty.
*/
public function isEmpty()
{
$extensions = new ExtensionsDiscovery('cloud');
$listExtensions = $extensions->getExtensionsApps();
if ($listExtensions > 0 || enterprise_installed() === true) {
return false;
} else {
return true;
}
}
}

View File

@ -0,0 +1,160 @@
<?php
/**
* Custom wizard manager.
*
* @category Wizard
* @package Pandora FMS
* @subpackage Custom
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2007-2021 Artica Soluciones Tecnologicas, http://www.artica.es
* This code is NOT free software. This code is NOT licenced under GPL2 licence
* You cannnot redistribute it without written permission of copyright holder.
* ============================================================================
*/
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/class/ExtensionsDiscovery.class.php';
/**
* Implements Wizard to provide generic Custom wizard.
*/
class Custom extends Wizard
{
/**
* Sub-wizard to be launch (vmware,oracle...).
*
* @var string
*/
public $mode;
/**
* Constructor.
*
* @param integer $page Start page, by default 0.
* @param string $msg Default message to show to users.
* @param string $icon Target icon to be used.
* @param string $label Target label to be displayed.
*
* @return mixed
*/
public function __construct(
int $page=0,
string $msg='Default message. Not set.',
string $icon='/images/wizard/Custom_apps@svg.svg',
string $label='Custom'
) {
$this->setBreadcrum([]);
$this->access = 'AW';
$this->task = [];
$this->msg = $msg;
$this->icon = $icon;
$this->class = $class_style;
$this->label = $label;
$this->page = $page;
$this->url = ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=custom'
);
return $this;
}
/**
* Run wizard manager.
*
* @return mixed Returns null if wizard is ongoing. Result if done.
*/
public function run()
{
global $config;
// Load styles.
parent::run();
// Load current wiz. sub-styles.
ui_require_css_file(
'custom',
ENTERPRISE_DIR.'/include/styles/wizards/'
);
$mode = get_parameter('mode', null);
$extensions = new ExtensionsDiscovery('custom', $mode);
if ($mode !== null) {
// Load extension if exist.
$extensions->run();
return;
}
// Load classes and print selector.
$wiz_data = $extensions->loadExtensions();
$this->prepareBreadcrum(
[
[
'link' => ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery'
),
'label' => __('Discovery'),
],
[
'link' => ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=custom'
),
'label' => __('Custom'),
'selected' => true,
],
]
);
// Header.
ui_print_page_header(
__('Custom'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
$this->printHeader(true)
);
Wizard::printBigButtonsList($wiz_data);
echo '<div class="app_mssg"><i>*'.__('All company names used here are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.').'</i></div>';
return $result;
}
/**
* Check if section have extensions.
*
* @return boolean Return true if section is empty.
*/
public function isEmpty()
{
$extensions = new ExtensionsDiscovery('custom');
$listExtensions = $extensions->getExtensionsApps();
if ($listExtensions > 0) {
return false;
} else {
return true;
}
}
}

View File

@ -129,6 +129,11 @@ class DiscoveryTaskList extends HTML
}
$delete_console_task = (bool) get_parameter('delete_console_task');
$report_task = (bool) get_parameter('report_task', 0);
if ($report_task === true) {
$this->url = ui_get_full_url('index.php?sec=reporting&sec2=godmode/reporting/reporting_builder');
}
if ($delete_console_task === true) {
return $this->deleteConsoleTask();
}
@ -163,7 +168,10 @@ class DiscoveryTaskList extends HTML
}
if (is_reporting_console_node() === false) {
$ret2 = $this->showList();
$ret2 = $this->showList(__('Host & devices tasks'), [0, 1]);
$ret2 .= $this->showList(__('Applications tasks'), [3, 4, 5, 10, 11, 12], 'app');
$ret2 .= $this->showList(__('Cloud tasks'), [6, 7, 8, 13, 14], 'cloud');
$ret2 .= $this->showList(__('Custom tasks'), [-1], 'custom');
}
if ($ret === false && $ret2 === false) {
@ -287,6 +295,10 @@ class DiscoveryTaskList extends HTML
}
$id_console_task = (int) get_parameter('id_console_task');
$report_task = (bool) get_parameter('report_task', 0);
if ($report_task === true) {
$this->url = ui_get_full_url('index.php?sec=reporting&sec2=godmode/reporting/reporting_builder');
}
if ($id_console_task != null) {
// --------------------------------
@ -352,6 +364,10 @@ class DiscoveryTaskList extends HTML
}
$id_console_task = (int) get_parameter('id_console_task');
$report_task = (bool) get_parameter('report_task', 0);
if ($report_task === true) {
$this->url = ui_get_full_url('index.php?sec=reporting&sec2=godmode/reporting/reporting_builder');
}
if ($id_console_task > 0) {
$result = db_process_sql_update(
@ -505,9 +521,13 @@ class DiscoveryTaskList extends HTML
/**
* Show complete list of running tasks.
*
* @param string $titleTable Title of section.
* @param array $filter Ids array from apps for filter.
* @param boolean $extension_section Extension to add in table.
*
* @return boolean Success or not.
*/
public function showList()
public function showList($titleTable, $filter, $extension_section=false)
{
global $config;
@ -531,7 +551,16 @@ class DiscoveryTaskList extends HTML
include_once $config['homedir'].'/include/functions_network_profiles.php';
if (users_is_admin()) {
$recon_tasks = db_get_all_rows_sql('SELECT * FROM trecon_task');
$recon_tasks = db_get_all_rows_sql(
sprintf(
'SELECT tasks.*, apps.section AS section, apps.short_name AS short_name
FROM trecon_task tasks
LEFT JOIN tdiscovery_apps apps ON tasks.id_app = apps.id_app
WHERE type IN (%s) OR section = "%s"',
implode(',', $filter),
$extension_section
)
);
} else {
$user_groups = implode(
',',
@ -539,9 +568,14 @@ class DiscoveryTaskList extends HTML
);
$recon_tasks = db_get_all_rows_sql(
sprintf(
'SELECT * FROM trecon_task
WHERE id_group IN (%s)',
$user_groups
'SELECT tasks.*, apps.section AS section, apps.short_name AS short_name
FROM trecon_task
LEFT JOIN tdiscovery_apps apps ON tasks.id_app = apps.id_app
WHERE id_group IN (%s) AND
(type IN (%s) OR section = "%s")',
$user_groups,
implode(',', $filter),
$extension_section
)
);
}
@ -658,7 +692,9 @@ class DiscoveryTaskList extends HTML
$recon_script_name = false;
}
if ($task['disabled'] == 0 && $server_name !== '') {
if (($task['disabled'] == 0 && $server_name !== '' && (int) $task['type'] !== DISCOVERY_EXTENSION)
|| ((int) $task['type'] === DISCOVERY_EXTENSION && (int) $task['setup_complete'] === 1)
) {
if (check_acl($config['id_user'], 0, 'AW')) {
$data[0] = '<span class="link" onclick="force_task(\'';
$data[0] .= ui_get_full_url(
@ -682,7 +718,9 @@ class DiscoveryTaskList extends HTML
);
$data[0] .= '</span>';
}
} else if ($task['disabled'] == 2) {
} else if ($task['disabled'] == 2
|| ((int) $task['type'] === DISCOVERY_EXTENSION && (int) $task['setup_complete'] === 0)
) {
$data[0] = ui_print_help_tip(
__('This task has not been completely defined, please edit it'),
true
@ -843,6 +881,19 @@ class DiscoveryTaskList extends HTML
$data[6] .= __('Discovery.App.Microsoft SQL Server');
break;
case DISCOVERY_EXTENSION:
// Discovery NetScan.
$data[6] = html_print_image(
'images/cluster@os.svg',
true,
[
'title' => $task['short_name'],
'class' => 'main_menu_icon invert_filter',
]
).'&nbsp;&nbsp;';
$data[6] .= $task['short_name'];
break;
case DISCOVERY_HOSTDEVICES:
default:
if ($task['id_recon_script'] == 0) {
@ -941,7 +992,7 @@ class DiscoveryTaskList extends HTML
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS
&& $task['type'] != DISCOVERY_CLOUD_AWS_S3
) {
if (check_acl($config['id_user'], 0, 'MR')) {
if (check_acl($config['id_user'], 0, 'MR') && (int) $task['type'] !== 15) {
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image(
'images/web@groups.svg',
@ -999,13 +1050,24 @@ class DiscoveryTaskList extends HTML
).'</a>';
}
} else {
$url_edit = sprintf(
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
$this->getTargetWiz($task, $recon_script_data),
$task['id_rt']
);
if ((int) $task['type'] === DISCOVERY_EXTENSION) {
$url_edit = sprintf(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=%s&mode=%s&id_task=%s',
$task['section'],
$task['short_name'],
$task['id_rt'],
);
}
// Check if is a H&D, Cloud or Application or IPAM.
$data[9] .= '<a href="'.ui_get_full_url(
sprintf(
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
$this->getTargetWiz($task, $recon_script_data),
$task['id_rt']
)
$url_edit
).'">'.html_print_image(
'images/edit.svg',
true,
@ -1069,7 +1131,7 @@ class DiscoveryTaskList extends HTML
$return = true;
}
ui_toggle($content, __('Server Tasks'), '', '', false);
ui_toggle($content, $titleTable, '', '', false);
// Div neccesary for modal map task.
echo '<div id="map_task" class="invisible"></div>';
@ -1096,9 +1158,9 @@ class DiscoveryTaskList extends HTML
*
* @return boolean Success or not.
*/
public function showListConsoleTask()
public function showListConsoleTask($report_task=false)
{
return enterprise_hook('tasklist_showListConsoleTask', [$this]);
return enterprise_hook('tasklist_showListConsoleTask', [$this, $report_task]);
}
@ -1227,7 +1289,7 @@ class DiscoveryTaskList extends HTML
($task['status'] < 0) ? 100 : $task['status'],
150,
150,
'#3A3A3A',
'#14524f',
'%',
'',
'#ececec',
@ -1297,7 +1359,7 @@ class DiscoveryTaskList extends HTML
$task['stats']['c_network_percent'],
150,
150,
'#3A3A3A',
'#14524f',
'%',
'',
'#ececec',
@ -1340,14 +1402,14 @@ class DiscoveryTaskList extends HTML
$output = '';
if (is_array($task['stats']) === false) {
$task['stats'] = json_decode($task['summary'], true);
if (is_array($task['stats']) === false && (int) $task['type'] !== DISCOVERY_EXTENSION) {
$task['stats'] = json_decode(io_safe_output($task['summary']), true);
if (json_last_error() !== JSON_ERROR_NONE) {
return $task['summary'];
}
}
if (is_array($task['stats'])) {
if (is_array($task['stats']) || (int) $task['type'] === DISCOVERY_EXTENSION) {
$i = 0;
$table = new StdClasS();
$table->class = 'databox data';
@ -1405,6 +1467,65 @@ class DiscoveryTaskList extends HTML
$table->data[$i][1] = '<span id="alive">';
$table->data[$i][1] .= ($total - $agents);
$table->data[$i++][1] .= '</span>';
} else if ((int) $task['type'] === DISCOVERY_EXTENSION) {
// Content.
$countSummary = 1;
if (is_array($task['stats']) === true && count(array_filter(array_keys($task['stats']), 'is_numeric')) === count($task['stats'])) {
foreach ($task['stats'] as $key => $summary) {
$table->data[$i][0] = '<b>'.__('Summary').' '.$countSummary.'</b>';
$table->data[$i][1] = '';
$countSummary++;
$i++;
if (is_array($summary) === true) {
if (empty($summary['summary']) === true && empty($summary['info']) === true) {
$table->data[$i][0] = json_encode($summary, JSON_PRETTY_PRINT);
$table->data[$i][1] = '';
$i++;
continue;
}
$unknownJson = $summary;
foreach ($summary as $k2 => $v) {
if (is_array($v) === true) {
if ($k2 === 'summary') {
foreach ($v as $k3 => $v2) {
$table->data[$i][0] = $k3;
$table->data[$i][1] = $v2;
$i++;
}
unset($unknownJson[$k2]);
}
} else {
if ($k2 === 'info') {
$table->data[$i][0] = $v;
$table->data[$i][1] = '';
$i++;
unset($unknownJson[$k2]);
}
}
}
if (empty($unknownJson) === false) {
$table->data[$i][0] = json_encode($unknownJson, JSON_PRETTY_PRINT);
$table->data[$i][1] = '';
$i++;
}
} else {
$table->data[$i][0] = $summary;
$table->data[$i][1] = '';
$i++;
}
}
} else {
$table->data[$i][0] = '<b>'.__('Summary').'</b>';
$table->data[$i][1] = '';
$i++;
$table->data[$i][0] = $task['summary'];
$table->data[$i][1] = '';
$i++;
}
} else {
// Content.
if (is_array($task['stats']['summary']) === true) {
@ -1466,7 +1587,7 @@ class DiscoveryTaskList extends HTML
}
$task = db_get_row('trecon_task', 'id_rt', $id_task);
$task['stats'] = json_decode($task['summary'], true);
$task['stats'] = json_decode(io_safe_output($task['summary']), true);
$summary = $this->progressTaskSummary($task);
$output = '';
@ -1859,7 +1980,11 @@ class DiscoveryTaskList extends HTML
if ($task['status'] <= 0
&& empty($task['summary']) === false
) {
$status = __('Done');
if ($task['status'] == -2) {
$status = __('Failed');
} else {
$status = __('Done');
}
} else if ($task['utimestamp'] == 0
&& empty($task['summary'])
) {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Reportes programados@svg</title>
<g id="Reportes-programados" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M8.00059781,0 C8.54059781,0 9.00059781,0.363636364 9.00059781,0.909090909 L9.00059781,4.07934284 C9.00059781,5.35207011 9.69059781,6 10.9505978,6 L14.1005978,6 C14.6405978,6 15.0005978,6.45454545 15.0005978,7 L15.0005978,16.3636364 C15.0005978,18.3636364 13.3805978,20 11.4005978,20 L5.24310254,20.0009635 C7.48899044,18.7052484 9.00059781,16.2791516 9.00059781,13.5 C9.00059781,9.35786438 5.64273343,6 1.50059781,6 C0.986687841,6 0.484850221,6.05168787 -2.12052598e-14,6.15014855 L0.000597808993,3.63636364 C0.000597808993,1.63636364 1.62059781,0 3.60059781,0 Z M10.0001439,1 L14.0005978,5 L11.0001439,5 C10.4478591,5 10.0001439,4.55228475 10.0001439,4 L10.0001439,1 Z" id="Shape" fill="#3F3F3F" transform="translate(7.500299, 10.000482) scale(-1, 1) translate(-7.500299, -10.000482) "></path>
<path d="M13.5,7 C17.0898509,7 20,9.91014913 20,13.5 C20,17.0898509 17.0898509,20 13.5,20 C9.91014913,20 7,17.0898509 7,13.5 C7,9.91014913 9.91014913,7 13.5,7 Z M14.0002191,9 C13.4873832,9 13.0647119,9.38604019 13.0069468,9.88337887 L13.0002191,10 L13.0002191,13.382 L11.4068856,14.2067645 C10.9481913,14.4361116 10.742785,14.9704208 10.9135349,15.4410874 L10.959672,15.5484052 C11.1890192,16.0070996 11.7233284,16.2125059 12.193995,16.0417559 L12.3013128,15.9956188 L14.4474327,14.8944272 C14.748574,14.7438565 14.9511225,14.4535358 14.9924154,14.1248553 L15.0002191,14 L15.0002191,10 C15.0002191,9.44771525 14.5525038,9 14.0002191,9 Z" id="Oval-2" fill="#3F3F3F"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="462px" height="462px" viewBox="0 0 462 462" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 61.2 (89653) - https://sketch.com -->
<title>Configurar app@svg</title>
<desc>Created with Sketch.</desc>
<defs>
<path d="M170.651341,0 L170.651,0.004 L172.111579,0.00817671226 C263.146802,0.548182735 340,27.8694245 340,92.0575424 L340,247.942458 C340,312.77894 261.586371,340 169.348659,340 L170.651,339.996 L170.651341,340 L170,339.998 L169.348659,340 L169.348659,340 L169.348,339.996 L167.888421,339.991823 C128.247423,339.756679 91.2955334,334.44344 62.2073113,323.219366 L161.855602,223.57095 C187.013424,231.95857 215.800358,226.422038 235.828233,206.394148 C254.435585,187.786783 260.775236,161.559784 254.857225,137.762234 C253.732853,133.229606 248.060798,131.693633 244.757955,134.996478 L207.432822,172.321638 L173.360336,166.644559 L167.683262,132.572049 L205.008395,95.2468889 C208.331316,91.9239659 206.73009,86.2619459 202.167348,85.1275341 C178.384873,79.2346161 152.19805,85.5843105 133.610776,104.166578 C113.713408,124.06396 108.237114,152.90613 116.519318,178.053931 L10.1129522,284.45776 C3.58111026,273.936239 0,261.798287 0,247.942458 L0,92.0575424 C0,27.2210597 78.4136287,0 170.651341,0 L169.348,0.004 L169.348659,0 L170,0.002 L170.651341,0 L170.651341,0 Z" id="path-1"></path>
</defs>
<g id="Configurar-app" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Rectangle" transform="translate(61.000000, 61.000000)">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="Mask" stroke="#555555" stroke-width="14" stroke-linejoin="round" xlink:href="#path-1"></use>
</g>
<g id="Group" transform="translate(107.000000, 136.000000)" stroke="#555555" stroke-width="7">
<circle id="Oval" cx="14.5" cy="14.5" r="14.5"></circle>
<circle id="Oval-Copy" cx="14.5" cy="61.5" r="14.5"></circle>
<circle id="Oval-Copy-2" cx="142.5" cy="208.5" r="14.5"></circle>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="462px" height="462px" viewBox="0 0 462 462" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 61.2 (89653) - https://sketch.com -->
<title>Custom apps@svg</title>
<desc>Created with Sketch.</desc>
<g id="Custom-apps" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group" transform="translate(61.000000, 61.000000)" stroke="#555555">
<path d="M0,315.724835 L0,274.275165 C0,257.178072 20.6773253,250 45,250 L45,250 C69.3226747,250 90,257.178072 90,274.275165 L90,315.724835 C90,332.821928 69.3226747,340 45,340 L45,340 C20.6773253,340 0,332.821928 0,315.724835 Z" id="Mask" stroke-width="14" stroke-linejoin="round"></path>
<path d="M0,190.724835 L0,149.275165 C0,132.178072 20.6773253,125 45,125 L45,125 C69.3226747,125 90,132.178072 90,149.275165 L90,190.724835 C90,207.821928 69.3226747,215 45,215 L45,215 C20.6773253,215 0,207.821928 0,190.724835 Z" id="Mask-Copy" stroke-width="14" stroke-linejoin="round"></path>
<path d="M0,65.7248353 L0,24.2751647 C0,7.17807242 20.6773253,0 45,0 L45,0 C69.3226747,0 90,7.17807242 90,24.2751647 L90,65.7248353 C90,82.8219276 69.3226747,90 45,90 L45,90 C20.6773253,90 0,82.8219276 0,65.7248353 Z" id="Mask-Copy-2" stroke-width="14" stroke-linejoin="round"></path>
<path d="M125,315.724835 L125,274.275165 C125,257.178072 145.677325,250 170,250 L170,250 C194.322675,250 215,257.178072 215,274.275165 L215,315.724835 C215,332.821928 194.322675,340 170,340 L170,340 C145.677325,340 125,332.821928 125,315.724835 Z" id="Mask" stroke-width="14" stroke-linejoin="round"></path>
<path d="M125,190.724835 L125,149.275165 C125,132.178072 145.677325,125 170,125 L170,125 C194.322675,125 215,132.178072 215,149.275165 L215,190.724835 C215,207.821928 194.322675,215 170,215 L170,215 C145.677325,215 125,207.821928 125,190.724835 Z" id="Mask-Copy" stroke-width="14" stroke-linejoin="round"></path>
<path d="M125,65.7248353 L125,24.2751647 C125,7.17807242 145.677325,0 170,0 L170,0 C194.322675,0 215,7.17807242 215,24.2751647 L215,65.7248353 C215,82.8219276 194.322675,90 170,90 L170,90 C145.677325,90 125,82.8219276 125,65.7248353 Z" id="Mask-Copy-2" stroke-width="14" stroke-linejoin="round"></path>
<path d="M250,190.724835 L250,149.275165 C250,132.178072 270.677325,125 295,125 L295,125 C319.322675,125 340,132.178072 340,149.275165 L340,190.724835 C340,207.821928 319.322675,215 295,215 L295,215 C270.677325,215 250,207.821928 250,190.724835 Z" id="Mask-Copy" stroke-width="14" stroke-linejoin="round"></path>
<path d="M250,65.7248353 L250,24.2751647 C250,7.17807242 270.677325,0 295,0 L295,0 C319.322675,0 340,7.17807242 340,24.2751647 L340,65.7248353 C340,82.8219276 319.322675,90 295,90 L295,90 C270.677325,90 250,82.8219276 250,65.7248353 Z" id="Mask-Copy-2" stroke-width="14" stroke-linejoin="round"></path>
<circle id="Oval" stroke-width="7" cx="45" cy="45" r="15"></circle>
<polygon id="Polygon" stroke-width="7" points="295 155 309.265848 165.364745 303.816779 182.135255 286.183221 182.135255 280.734152 165.364745"></polygon>
<rect id="Rectangle" stroke-width="7" x="155" y="280" width="30" height="30"></rect>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="462px" height="462px" viewBox="0 0 462 462" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 61.2 (89653) - https://sketch.com -->
<title>App genérico@svg</title>
<desc>Created with Sketch.</desc>
<defs>
<path d="M340,247.942458 C340,312.77894 261.586371,340 169.348659,340 L170.651,339.996 L170.651341,340 L170,339.998 L169.348659,340 L169.348659,340 L169.348,339.996 L167.888421,339.991823 C76.8531975,339.451817 0,312.130576 0,247.942458 L0,92.0575424 C0,27.2210597 78.4136287,0 170.651341,0 L169.348,0.004 L169.348659,0 L170,0.002 L170.651341,0 L170.651341,0 L170.651,0.004 L172.111579,0.00817671226 C263.146802,0.548182735 340,27.8694245 340,92.0575424 Z" id="path-1"></path>
</defs>
<g id="App-genérico" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Rectangle" transform="translate(61.000000, 61.000000)">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="Mask" stroke="#555555" stroke-width="14" stroke-linejoin="round" xlink:href="#path-1"></use>
<path d="M243.089632,66.6385397 C255.811455,68.1348967 268.474117,71.8213332 276.910371,78.4128805 C279.780827,80.6195335 283.214489,83.0345401 285.04609,85.6744737 C286.108609,87.2039779 287.599447,90.7246786 286.747539,92.8105813 C285.689754,95.3439706 281.820673,95.5831036 278.614186,95.5168093 C267.669538,95.2682057 257.661988,94.0985848 247.077034,95.3534412 C232.071625,97.1623285 219.643237,101.345972 208.921031,105.81847 C186.274482,115.196745 166.808389,130.69067 151.450385,146.338491 C135.966961,162.071549 121.652544,181.903015 110.248812,202.274305 C97.5530192,224.954058 87.9619574,248.876829 80.0344822,274 C62.0000677,250.340039 50.8566406,221.118459 50,189.124358 L50,189.079372 L50,189.079372 C67.1635754,162.156784 86.968065,137.803101 110.459422,117.133486 C126.655136,102.842329 145.730771,90.113824 166.841519,80.8823431 C170.384035,79.3102211 173.820063,77.3284952 177.646549,76.1044183 C181.43044,74.8637679 185.379979,73.6325881 189.417075,72.3019668 C204.850804,67.2470266 226.07514,64.7278433 243.089632,66.6385397 Z M249.443746,111.548575 C251.871655,112.938928 254.490313,115.160583 256.507696,116.816952 C263.206733,122.210025 268.91885,129.801891 273.814061,136.838864 C280.819956,146.997376 286.722822,158.745753 288.862533,171.957223 C294.066675,204.579596 280.685187,228.427576 263.552985,242.99199 C254.774364,250.4841 243.209143,256.901753 230.756521,260.222805 C216.819372,263.942882 201.165478,264.946679 186.253848,262.930771 C158.17014,259.167051 132.95804,241.350168 116,224.649308 C117.944815,220.058442 118.525357,218.38129 120.519932,213.865241 C123.851827,217.348397 129.769207,221.999533 132.402378,223.828397 C150.61895,236.584729 174.427383,247.587012 205.998488,245.822573 C221.986194,244.978802 236.82733,239.450643 247.36209,231.008769 C257.579625,222.849539 266.134322,211.117788 265.976747,194.763997 C265.812951,177.460443 257.372288,163.326228 248.149968,153.85354 C244.990162,150.594836 241.573259,147.109602 238.121109,144.540878 C232.659869,140.477889 226.584914,137.325176 220.476785,134.344958 C214.262915,131.264983 207.879029,128.18293 200.468828,126.561891 C212.714113,118.797529 245.558263,109.318607 249.443746,111.548575 Z" id="Path-3" stroke="#555555" stroke-width="7" stroke-linecap="round" stroke-linejoin="round" mask="url(#mask-2)"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -84,7 +84,7 @@ if ($save_log_filter) {
if ($recover_aduit_log_select) {
echo json_encode(audit_get_audit_filter_select());
echo json_encode(audit_get_audit_filter_select_fix_order());
}
if ($update_log_filter) {
@ -190,7 +190,7 @@ function show_filter() {
draggable: true,
modal: false,
closeOnEscape: true,
width: 380
width: "auto"
});
}
@ -207,12 +207,13 @@ function load_filter_values() {
},
success: function(data) {
var options = "";
console.log(data);
$.each(data,function(i,value){
if (i == 'text'){
$("#text-filter_text").val(value);
}
if (i == 'period'){
$("#text-filter_period").val(value);
$("#filter_period").val(value).change();
}
if (i == 'ip'){
$("#text-filter_ip").val(value);
@ -395,7 +396,7 @@ function save_new_filter() {
"save_log_filter" : 1,
"id_name" : $("#text-id_name").val(),
"text" : $("#text-filter_text").val(),
"period" : $("#text-filter_period").val(),
"period" : $("#filter_period :selected").val(),
"ip" : $('#text-filter_ip').val(),
"type" : $('#filter_type :selected').val(),
"user" : $('#filter_user :selected').val(),
@ -431,7 +432,7 @@ function save_update_filter() {
"update_log_filter" : 1,
"id" : $("#overwrite_filter :selected").val(),
"text" : $("#text-filter_text").val(),
"period" : $("#text-filter_period").val(),
"period" : $("#filter_period :selected").val(),
"ip" : $('#text-filter_ip').val(),
"type" : $('#filter_type :selected').val(),
"user" : $('#filter_user :selected').val(),

View File

@ -90,86 +90,38 @@ $get_comments = (bool) get_parameter('get_comments', false);
$get_events_fired = (bool) get_parameter('get_events_fired');
$get_id_source_event = get_parameter('get_id_source_event');
$node_id = (int) get_parameter('node_id', 0);
$settings_modal = get_parameter('settings', 0);
$parameters_modal = get_parameter('parameters', 0);
if ($get_comments === true) {
$event = get_parameter('event', false);
$event_rep = (int) get_parameter_post('event')['event_rep'];
$group_rep = (int) get_parameter_post('event')['group_rep'];
global $config;
$event = json_decode(io_safe_output(base64_decode(get_parameter('event', ''))), true);
$filter = json_decode(io_safe_output(base64_decode(get_parameter('filter', ''))), true);
$default_hour = (int) $filter['event_view_hr'];
if (isset($config['max_hours_old_event_comment']) === true
&& empty($config['max_hours_old_event_comment']) === false
) {
$default_hour = (int) $config['max_hours_old_event_comment'];
}
$custom_event_view_hr = (int) get_parameter('custom_event_view_hr', 0);
if (empty($custom_event_view_hr) === false) {
if ($custom_event_view_hr === -2) {
$filter['event_view_hr_cs'] = ($default_hour * 3600);
} else {
$filter['event_view_hr_cs'] = $custom_event_view_hr;
}
} else {
$filter['event_view_hr_cs'] = ($default_hour * 3600);
}
if ($event === false) {
return __('Failed to retrieve comments');
}
$eventsGrouped = [];
// Consider if the event is grouped.
$whereGrouped = '1=1';
if ($group_rep === EVENT_GROUP_REP_EVENTS && $event_rep > 1) {
// Default grouped message filtering (evento and estado).
$whereGrouped = sprintf(
'`evento` = "%s"',
$event['evento']
);
// 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 if ($group_rep === EVENT_GROUP_REP_EXTRAIDS) {
$whereGrouped = sprintf(
'`id_extra` = "%s"',
io_safe_output($event['id_extra'])
);
} else {
$whereGrouped = sprintf('`id_evento` = %d', $event['id_evento']);
}
try {
if (is_metaconsole() === true
&& $event['server_id'] > 0
) {
$node = new Node($event['server_id']);
$node->connect();
}
$sql = sprintf(
'SELECT `user_comment`
FROM tevento
WHERE %s',
$whereGrouped
);
// Get grouped comments.
$eventsGrouped = db_get_all_rows_sql($sql);
} catch (\Exception $e) {
// Unexistent agent.
if (is_metaconsole() === true
&& $event['server_id'] > 0
) {
$node->disconnect();
}
$eventsGrouped = [];
} finally {
if (is_metaconsole() === true
&& $event['server_id'] > 0
) {
$node->disconnect();
}
}
// End of get_comments.
echo events_page_comments($event, true, $eventsGrouped);
$eventsGrouped = event_get_comment($event, $filter);
echo events_page_comments($event, $eventsGrouped, $filter);
return;
}
@ -562,8 +514,13 @@ if ($load_filter_modal) {
false
);
$action = 'index.php?sec=eventos&sec2=operation/events/events&pure=';
if ($settings_modal !== 0 && $parameters_modal !== 0) {
$action .= '&settings='.$settings_modal.'&parameters='.$parameters_modal;
}
echo '<div id="load-filter-select" class="load-filter-modal">';
echo '<form method="post" id="form_load_filter" action="index.php?sec=eventos&sec2=operation/events/events&pure=">';
echo '<form method="post" id="form_load_filter" action="'.$action.'">';
$table = new StdClass;
$table->id = 'load_filter_form';
@ -1003,7 +960,7 @@ function save_new_filter() {
}
else {
id_filter_save = data;
$("#info_box").filter(function(i, item) {
if ($(item).data('type_info_box') == "success_create_filter") {
return true;
@ -2003,23 +1960,7 @@ if ($get_extended_event) {
$js .= '});';
$js .= '
$("#link_comments").click(function (){
$.post ({
url : "ajax.php",
data : {
page: "include/ajax/events",
get_comments: 1,
event: '.json_encode($event).',
event_rep: '.$event_rep.'
},
dataType : "html",
success: function (data) {
$("#extended_event_comments_page").empty();
$("#extended_event_comments_page").html(data);
}
});
});';
$js .= '$("#link_comments").click(get_table_events_tabs(\''.base64_encode(json_encode($event)).'\',\''.base64_encode(json_encode($filter)).'\'));';
if (events_has_extended_info($event['id_evento']) === true) {
$js .= '
@ -2525,7 +2466,7 @@ if ($drawConsoleSound === true) {
'label' => __('Start'),
'type' => 'button',
'name' => 'start-search',
'attributes' => [ 'class' => 'play' ],
'attributes' => [ 'class' => 'play secondary' ],
'return' => true,
],
'div',
@ -2651,23 +2592,24 @@ if ($get_events_fired) {
$return[] = array_merge(
$event,
[
'fired' => $event['id_evento'],
'message' => ui_print_string_substr(
'fired' => $event['id_evento'],
'message' => ui_print_string_substr(
strip_tags(io_safe_output($event['evento'])),
75,
true,
'9'
),
'priority' => ui_print_event_priority($event['criticity'], true, true),
'type' => events_print_type_img(
'priority' => ui_print_event_priority($event['criticity'], true, true),
'type' => events_print_type_img(
$event['event_type'],
true
),
'timestamp' => ui_print_timestamp(
'timestamp' => ui_print_timestamp(
$event['timestamp'],
true,
['style' => 'font-size: 9pt; letter-spacing: 0.3pt;']
),
'event_timestamp' => $event['timestamp'],
]
);
}

View File

@ -0,0 +1,60 @@
<?php
/**
* Manager extensions ajax
*
* @category Ajax library.
* @package Pandora FMS
* @subpackage Modules.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config;
require_once $config['homedir'].'/godmode/wizards/ManageExtensions.class.php';
if (is_ajax() === false) {
exit;
}
// Control call flow.
try {
// User access and validation is being processed on class constructor.
$actions = new ManageExtensions();
} catch (Exception $e) {
exit;
}
// Ajax controller.
$method = get_parameter('method', '');
if (method_exists($actions, $method) === true) {
if ($actions->ajaxMethod($method) === true) {
$actions->{$method}();
} else {
$actions->errorAjax('Unavailable method.');
}
} else {
$actions->errorAjax('Method not found. ['.$method.']');
}
// Stop any execution.
exit;

View File

@ -178,7 +178,7 @@ class AuditLog extends HTML
[
'id' => $this->tableId,
'class' => 'info_table',
'style' => 'width: 99%',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,
@ -469,7 +469,7 @@ class AuditLog extends HTML
success: function(data) {
var options = "";
$.each(data,function(key,value){
options += "<option value='"+key+"'>"+value+"</option>";
options += "<option value='"+value+"'>"+key+"</option>";
});
$('#overwrite_filter').html(options);
$('#overwrite_filter').select2();
@ -509,8 +509,12 @@ class AuditLog extends HTML
/* Filter management */
$('#button-load-filter').click(function (){
if($('#load-filter-select').length) {
$('#load-filter-select').dialog({width: "20%",
maxWidth: "25%",
$('#load-filter-select').dialog({
resizable: true,
draggable: true,
modal: false,
closeOnEscape: true,
width: "auto",
title: "<?php echo __('Load filter'); ?>"
});
$.ajax({
@ -523,8 +527,9 @@ class AuditLog extends HTML
},
success: function(data) {
var options = "";
console.log(data)
$.each(data,function(key,value){
options += "<option value='"+key+"'>"+value+"</option>";
options += "<option value='"+value+"'>"+key+"</option>";
});
$('#filter_id').html(options);
$('#filter_id').select2();

View File

@ -1040,7 +1040,7 @@ class CalendarManager
'id' => 'templates_alerts_special_days',
'return' => true,
'class' => 'info_table',
'style' => 'width: 99%',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'godmode/alerts/alert_special_days',

View File

@ -612,7 +612,7 @@ class ConfigPEN extends HTML
'id' => $tableId,
'return' => true,
'class' => 'info_table',
'style' => 'width: 99%',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,

View File

@ -595,7 +595,6 @@ class ConsoleSupervisor
'days_delete_unknown' => 'Max. days before unknown modules are deleted',
'days_delete_not_initialized' => 'Max. days before delete not initialized modules',
'days_autodisable_deletion' => 'Max. days before autodisabled agents are deleted',
'delete_old_network_matrix' => 'Max. days before delete old network matrix data',
'report_limit' => 'Item limit for real-time reports',
'event_view_hr' => 'Default hours for event view',
'big_operation_step_datos_purge' => 'Big Operation Step to purge old data',

View File

@ -827,7 +827,7 @@ class CredentialStore extends Wizard
[
'id' => $this->tableId,
'class' => 'info_table',
'style' => 'width: 99%',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,

View File

@ -1579,7 +1579,7 @@ class Diagnostics extends Wizard
[
'id' => $tableId,
'class' => 'info_table caption_table',
'style' => 'width: 99%',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columnNames,
'ajax_data' => [
@ -1591,6 +1591,7 @@ class Diagnostics extends Wizard
'no_sortable_columns' => [-1],
'caption' => $title,
'print' => true,
'mini_csv' => true,
]
);
} else {

View File

@ -320,7 +320,7 @@ class EventSound extends HTML
[
'id' => $this->tableId,
'class' => 'info_table',
'style' => 'width: 99%',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,

File diff suppressed because it is too large Load Diff

View File

@ -162,7 +162,7 @@ class SatelliteAgent extends HTML
[
'id' => $this->tableId,
'class' => 'info_table',
'style' => 'width: 99%',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,

View File

@ -142,7 +142,7 @@ class SatelliteCollection extends HTML
[
'id' => $this->tableId,
'class' => 'info_table',
'style' => 'width: 99%',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,

View File

@ -326,7 +326,7 @@ class SnmpConsole extends HTML
[
'id' => $tableId,
'class' => 'info_table',
'style' => 'width: 99%',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,
@ -519,6 +519,8 @@ class SnmpConsole extends HTML
$legend .= '</div>';
$legend .= '</div></div></td>';
echo '<br>';
ui_toggle($legend, __('Legend'));
// Load own javascript file.
@ -1331,17 +1333,8 @@ class SnmpConsole extends HTML
* Show more information
*/
function toggleVisibleExtendedInfo(id, position) {
// Show all "Show more"
$('[id^=img_]').each(function() {
$(this).show();
});
// Hide all "Hide details"
$('[id^=img_hide_]').each(function() {
$(this).hide();
});
var status = $('#eye_'+id).attr('data-show');
if(status == "show"){
$('tr[id^=show_]').remove()
$.ajax({
method: 'get',
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
@ -1360,14 +1353,14 @@ class SnmpConsole extends HTML
datatype: "json",
success: function(data) {
let trap = JSON.parse(data);
var tr = $('#snmp_console tr').eq(position+1);
var tr = $('#snmp_console tr:not([id^="show_"])').eq(position+1);
// Count.
if ($('#filter_group_by').val() == 1) {
let labelCount = '<td align="left" valign="top"><b><?php echo __('Count:'); ?></b></br><b><?php echo __('First trap:'); ?></b></br><b><?php echo __('Last trap:'); ?></td>';
let variableCount = `<td align="left" valign="top" style="line-height: 16pt">${trap['count']}</br>${trap['first']}</br>${trap['last']}</td>`;
tr.after(`<tr id="show_" role="row">${labelCount}${variableCount}</tr>`);
tr.after(`<tr id="show_${id}" role="row">${labelCount}${variableCount}</tr>`);
}
// Type.
@ -1405,27 +1398,27 @@ class SnmpConsole extends HTML
let labelType = '<td align="left" valign="top"><b><?php echo __('Type:'); ?></td>';
let variableType = `<td align="left" colspan="8">${desc_trap_type}</td>`;
tr.after(`<tr id="show_" role="row">${labelType}${variableType}</tr>`);
tr.after(`<tr id="show_${id}" role="row">${labelType}${variableType}</tr>`);
// Description.
if (trap['description']) {
let labelDesc = '<td align="left" valign="top"><b><?php echo __('Description:'); ?></td>';
let variableDesc = `<td align="left" colspan="8">${trap['description']}</td>`;
tr.after(`<tr id="show_" role="row">${labelDesc}${variableDesc}</tr>`);
tr.after(`<tr id="show_${id}" role="row">${labelDesc}${variableDesc}</tr>`);
}
// Enterprise String.
let labelOid = '<td align="left" valign="top"><b><?php echo __('Enterprise String:'); ?></td>';
let variableOId = `<td align="left" colspan="8">${trap['oid']}</td>`;
tr.after(`<tr id="show_" role="row">${labelOid}${variableOId}</tr>`);
tr.after(`<tr id="show_${id}" role="row">${labelOid}${variableOId}</tr>`);
// Variable bindings.
let labelBindings = '';
let variableBindings = '';
if ($('#filter_group_by').val() == 1) {
labelBindings = '<td align="left" valign="top" width="15%"><b><?php echo __('Variable bindings:'); ?></b></td>';
labelBindings = '<td align="left" valign="top" ><b><?php echo __('Variable bindings:'); ?></b></td>';
let new_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view';
new_url += '&filter_severity='+$('#filter_severity').val();
@ -1439,7 +1432,7 @@ class SnmpConsole extends HTML
variableBindings = `<td align="left" colspan="8">${string}</td>`;
} else {
labelBindings = '<td align="left" valign="top" width="15%"><b><?php echo __('Variable bindings:'); ?></b></td>';
labelBindings = '<td align="left" valign="top" ><b><?php echo __('Variable bindings:'); ?></b></td>';
const binding_vars = trap['oid_custom'].split("\t");
let string = '';
binding_vars.forEach(function(oid) {
@ -1448,7 +1441,7 @@ class SnmpConsole extends HTML
variableBindings = `<td align="left" colspan="8" class="break-word w200px">${string}</td>`;
}
tr.after(`<tr id="show_" role="row">${labelBindings}${variableBindings}</tr>`);
tr.after(`<tr id="show_${id}" role="row">${labelBindings}${variableBindings}</tr>`);
},
error: function(e) {
console.error(e);
@ -1458,7 +1451,7 @@ class SnmpConsole extends HTML
$('#img_'+id).hide();
$('#img_hide_'+id).show();
} else{
$('tr[id^=show_]').remove();
$(`tr#show_${id}`).remove();
$('#eye_'+id).attr('data-show', 'show');
$('#img_'+id).show();
$('#img_hide_'+id).hide();

View File

@ -475,7 +475,7 @@ class TipsWindow
[
'id' => 'list_tips_windows',
'class' => 'info_table',
'style' => 'width: 99%',
'style' => 'width: 100%',
'dom_elements' => 'lpfti',
'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar',
'columns' => $columns,

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC230720';
$build_version = 'PC230731';
$pandora_version = 'v7.0NG.772';
// Do not overwrite default timezone set if defined.

View File

@ -648,6 +648,7 @@ define('DISCOVERY_APP_DB2', 11);
define('DISCOVERY_APP_MICROSOFT_SQL_SERVER', 12);
define('DISCOVERY_CLOUD_GCP_COMPUTE_ENGINE', 13);
define('DISCOVERY_CLOUD_AWS_S3', 14);
define('DISCOVERY_EXTENSION', 15);
// Force task build tmp results.
define('DISCOVERY_REVIEW', 0);

View File

@ -907,7 +907,7 @@ function set_cookie($name, $value)
{
if (is_null($value)) {
unset($_COOKIE[$value]);
setcookie($name, null, -1, '/');
setcookie($name, '', -1, '/');
} else {
setcookie($name, $value);
}

View File

@ -13102,9 +13102,14 @@ function api_set_create_event($id, $trash1, $other, $returnType)
$values['custom_data'] = '';
}
$ack_utimestamp = 0;
if ($other['data'][18] != '') {
$values['id_extra'] = $other['data'][18];
$sql_validation = 'SELECT id_evento,estado FROM tevento where estado IN (0,2) and id_extra ="'.$other['data'][18].'";';
$sql_validation = 'SELECT id_evento,estado,ack_utimestamp,id_usuario
FROM tevento
WHERE estado IN (0,2) AND id_extra ="'.$other['data'][18].'";';
$validation = db_get_all_rows_sql($sql_validation);
if ($validation) {
@ -13114,8 +13119,10 @@ function api_set_create_event($id, $trash1, $other, $returnType)
&& (int) $values['status'] === 0
) {
$values['status'] = 2;
$ack_utimestamp = $val['ack_utimestamp'];
$values['id_usuario'] = $val['id_usuario'];
}
api_set_validate_event_by_id($val['id_evento']);
}
}
@ -13143,7 +13150,8 @@ function api_set_create_event($id, $trash1, $other, $returnType)
$values['tags'],
$custom_data,
$values['server_id'],
$values['id_extra']
$values['id_extra'],
$ack_utimestamp
);
if ($other['data'][12] != '') {
@ -15755,6 +15763,8 @@ function api_get_cluster_items($cluster_id)
*/
function api_set_create_event_filter($name, $thrash1, $other, $thrash3)
{
global $config;
if ($name == '') {
returnError(
'The event filter could not be created. Event filter name cannot be left blank.'

View File

@ -378,6 +378,10 @@ function config_update_config()
$error_update[] = __('keep_in_process_status_extra_id');
}
if (config_update_value('show_experimental_features', get_parameter('show_experimental_features'), true) === false) {
$error_update[] = __('show_experimental_features');
}
if (config_update_value('console_log_enabled', get_parameter('console_log_enabled'), true) === false) {
$error_update[] = __('Console log enabled');
}
@ -398,6 +402,10 @@ function config_update_config()
$error_update[] = __('Check conexion interval');
}
if (config_update_value('max_hours_old_event_comment', get_parameter('max_hours_old_event_comment'), true) === false) {
$error_update[] = __('Max hours old event comments');
}
if (config_update_value('unique_ip', get_parameter('unique_ip'), true) === false) {
$error_update[] = __('Unique IP');
}
@ -970,12 +978,12 @@ function config_update_config()
}
}
if (config_update_value('delete_old_messages', get_parameter('delete_old_messages'), true) === false) {
$error_update[] = __('Max. days before delete old messages');
if (config_update_value('delete_disabled_agents', get_parameter('delete_disabled_agents'), true) === false) {
$error_update[] = __('Max. days before disabled agents are deleted');
}
if (config_update_value('delete_old_network_matrix', get_parameter('delete_old_network_matrix'), true) === false) {
$error_update[] = __('Max. days before delete old network matrix data');
if (config_update_value('delete_old_messages', get_parameter('delete_old_messages'), true) === false) {
$error_update[] = __('Max. days before delete old messages');
}
if (config_update_value('max_graph_container', get_parameter('max_graph_container'), true) === false) {
@ -2231,12 +2239,12 @@ function config_process_config()
}
}
if (!isset($config['delete_old_messages'])) {
config_update_value('delete_old_messages', 21);
if (!isset($config['delete_disabled_agents'])) {
config_update_value('delete_disabled_agents', 0);
}
if (!isset($config['delete_old_network_matrix'])) {
config_update_value('delete_old_network_matrix', 10);
if (!isset($config['delete_old_messages'])) {
config_update_value('delete_old_messages', 21);
}
if (!isset($config['max_graph_container'])) {
@ -2401,6 +2409,10 @@ function config_process_config()
config_update_value('keep_in_process_status_extra_id', 0);
}
if (!isset($config['show_experimental_features'])) {
config_update_value('show_experimental_features', 0);
}
if (!isset($config['console_log_enabled'])) {
config_update_value('console_log_enabled', 0);
}
@ -2421,6 +2433,10 @@ function config_process_config()
config_update_value('check_conexion_interval', 180);
}
if (!isset($config['max_hours_old_event_comment'])) {
config_update_value('max_hours_old_event_comment', 8);
}
if (!isset($config['elasticsearch_ip'])) {
config_update_value('elasticsearch_ip', '');
}
@ -2502,10 +2518,6 @@ function config_process_config()
'max' => 90,
'min' => 0,
],
'delete_old_network_matrix' => [
'max' => 30,
'min' => 1,
],
'report_limit' => [
'max' => 500,
'min' => 1,
@ -3471,10 +3483,6 @@ function config_process_config()
config_update_value('dbtype', 'mysql');
}
if (!isset($config['legacy_vc'])) {
config_update_value('legacy_vc', 0);
}
if (!isset($config['vc_default_cache_expiration'])) {
config_update_value('vc_default_cache_expiration', 60);
}

View File

@ -613,6 +613,74 @@ function events_update_status($id_evento, $status, $filter=null)
}
/**
* Get filter time.
*
* @param array $filter Filters.
*
* @return array conditions.
*/
function get_filter_date(array $filter)
{
if (isset($filter['date_from']) === true
&& empty($filter['date_from']) === false
&& $filter['date_from'] !== '0000-00-00'
) {
$date_from = $filter['date_from'];
}
if (isset($filter['time_from']) === true) {
$time_from = (empty($filter['time_from']) === true) ? '00:00:00' : $filter['time_from'];
}
if (isset($date_from) === true) {
if (isset($time_from) === false) {
$time_from = '00:00:00';
}
$from = $date_from.' '.$time_from;
$sql_filters[] = sprintf(
' AND te.utimestamp >= %d',
strtotime($from)
);
}
if (isset($filter['date_to']) === true
&& empty($filter['date_to']) === false
&& $filter['date_to'] !== '0000-00-00'
) {
$date_to = $filter['date_to'];
}
if (isset($filter['time_to']) === true) {
$time_to = (empty($filter['time_to']) === true) ? '23:59:59' : $filter['time_to'];
}
if (isset($date_to) === true) {
if (isset($time_to) === false) {
$time_to = '23:59:59';
}
$to = $date_to.' '.$time_to;
$sql_filters[] = sprintf(
' AND te.utimestamp <= %d',
strtotime($to)
);
}
if (isset($from) === false) {
if (isset($filter['event_view_hr']) === true && ($filter['event_view_hr'] > 0)) {
$sql_filters[] = sprintf(
' AND te.utimestamp > UNIX_TIMESTAMP(now() - INTERVAL %d HOUR) ',
$filter['event_view_hr']
);
}
}
return $sql_filters;
}
/**
* Retrieve all events filtered.
*
@ -700,60 +768,7 @@ function events_get_all(
);
}
if (isset($filter['date_from']) === true
&& empty($filter['date_from']) === false
&& $filter['date_from'] !== '0000-00-00'
) {
$date_from = $filter['date_from'];
}
if (isset($filter['time_from']) === true) {
$time_from = (empty($filter['time_from']) === true) ? '00:00:00' : $filter['time_from'];
}
if (isset($date_from) === true) {
if (isset($time_from) === false) {
$time_from = '00:00:00';
}
$from = $date_from.' '.$time_from;
$sql_filters[] = sprintf(
' AND te.utimestamp >= %d',
strtotime($from)
);
}
if (isset($filter['date_to']) === true
&& empty($filter['date_to']) === false
&& $filter['date_to'] !== '0000-00-00'
) {
$date_to = $filter['date_to'];
}
if (isset($filter['time_to']) === true) {
$time_to = (empty($filter['time_to']) === true) ? '23:59:59' : $filter['time_to'];
}
if (isset($date_to) === true) {
if (isset($time_to) === false) {
$time_to = '23:59:59';
}
$to = $date_to.' '.$time_to;
$sql_filters[] = sprintf(
' AND te.utimestamp <= %d',
strtotime($to)
);
}
if (isset($from) === false) {
if (isset($filter['event_view_hr']) === true && ($filter['event_view_hr'] > 0)) {
$sql_filters[] = sprintf(
' AND utimestamp > UNIX_TIMESTAMP(now() - INTERVAL %d HOUR) ',
$filter['event_view_hr']
);
}
}
$sql_filters = get_filter_date($filter);
if (isset($filter['id_agent']) === true && $filter['id_agent'] > 0) {
$sql_filters[] = sprintf(
@ -1069,7 +1084,6 @@ function events_get_all(
$array_search = [
'te.id_evento',
'lower(te.evento)',
'lower(te.user_comment)',
'lower(te.id_extra)',
'lower(te.source)',
'lower('.$custom_data_search.')',
@ -1106,7 +1120,6 @@ function events_get_all(
' AND (lower(ta.alias) not like lower("%%%s%%")
AND te.id_evento not like "%%%s%%"
AND lower(te.evento) not like lower("%%%s%%")
AND lower(te.user_comment) not like lower("%%%s%%")
AND lower(te.id_extra) not like lower("%%%s%%")
AND lower(te.source) not like lower("%%%s%%") )',
array_fill(0, 6, $filter['search_exclude'])
@ -1122,16 +1135,13 @@ function events_get_all(
}
// User comment.
$event_comment_join = '';
if (empty($filter['user_comment']) === false) {
// For filter field.
$event_comment_join = 'INNER JOIN tevent_comment ON te.id_evento = tevent_comment.id_event';
$sql_filters[] = sprintf(
' AND lower(te.user_comment) like lower("%%%s%%") ',
io_safe_input($filter['user_comment'])
);
// For show comments on event details.
$sql_filters[] = sprintf(
' OR lower(te.user_comment) like lower("%%%s%%") ',
' AND (lower(tevent_comment.comment) like lower("%%%s%%")
OR lower(tevent_comment.comment) like lower("%%%s%%"))',
io_safe_input($filter['user_comment']),
$filter['user_comment']
);
}
@ -1455,7 +1465,7 @@ function events_get_all(
' LIMIT %d',
$config['max_number_of_events_per_node']
);
} else if (isset($limit, $offset) === true && $limit > 0) {
} else if (isset($limit, $offset) === true && empty($limit) === false && $limit > 0) {
$pagination = sprintf(' LIMIT %d OFFSET %d', $limit, $offset);
}
@ -1552,36 +1562,20 @@ function events_get_all(
$group_selects = '';
if ($group_by != '') {
if ($count === false) {
$idx = array_search('te.user_comment', $fields);
if ($idx !== false) {
unset($fields[$idx]);
}
db_process_sql('SET group_concat_max_len = 9999999');
$group_selects = sprintf(
',COUNT(id_evento) AS event_rep,
%s
MAX(utimestamp) as timestamp_last,
MIN(utimestamp) as timestamp_first,
MAX(id_evento) as max_id_evento',
($idx !== false) ? 'GROUP_CONCAT(DISTINCT user_comment SEPARATOR "<br>") AS comments,' : ''
MAX(te.utimestamp) as timestamp_last,
MIN(te.utimestamp) as timestamp_first,
MAX(id_evento) as max_id_evento'
);
$group_selects_trans = sprintf(
',tmax_event.event_rep,
%s
tmax_event.timestamp_last,
tmax_event.timestamp_first,
tmax_event.max_id_evento',
($idx !== false) ? 'tmax_event.comments,' : ''
tmax_event.max_id_evento'
);
}
} else {
$idx = array_search('te.user_comment', $fields);
if ($idx !== false) {
$fields[$idx] = 'te.user_comment AS comments';
}
}
if (((int) $filter['group_rep'] === EVENT_GROUP_REP_EVENTS
@ -1596,11 +1590,12 @@ function events_get_all(
FROM %s
%s
%s
%s
%s JOIN %s ta
ON ta.%s = te.id_agente
ON ta.%s = te.id_agente
%s
%s JOIN tgrupo tg
ON %s
ON %s
WHERE 1=1
%s
%s
@ -1611,6 +1606,7 @@ function events_get_all(
ON te.id_evento = tmax_event.max_id_evento
%s
%s
%s
%s JOIN %s ta
ON ta.%s = te.id_agente
%s
@ -1625,6 +1621,7 @@ function events_get_all(
$tevento,
$event_lj,
$agentmodule_join,
$event_comment_join,
$tagente_join,
$tagente_table,
$tagente_field,
@ -1638,6 +1635,7 @@ function events_get_all(
$having,
$event_lj,
$agentmodule_join,
$event_comment_join,
$tagente_join,
$tagente_table,
$tagente_field,
@ -1654,6 +1652,7 @@ function events_get_all(
FROM %s
%s
%s
%s
%s JOIN %s ta
ON ta.%s = te.id_agente
%s
@ -1671,6 +1670,7 @@ function events_get_all(
$tevento,
$event_lj,
$agentmodule_join,
$event_comment_join,
$tagente_join,
$tagente_table,
$tagente_field,
@ -2240,91 +2240,18 @@ function events_comment(
$first_event = reset($id_event);
}
$sql = sprintf(
'SELECT user_comment
FROM tevento
WHERE id_evento = %d',
$first_event
// Update comment.
$ret = db_process_sql_insert(
'tevent_comment',
[
'id_event' => $first_event,
'comment' => $comment,
'action' => $action,
'utimestamp' => time(),
'id_user' => $config['id_user'],
],
);
$event_comments = db_get_all_rows_sql($sql);
$event_comments_array = [];
if ($event_comments[0]['user_comment'] == '') {
$comments_format = 'new';
} else {
// If comments are not stored in json, the format is old.
$event_comments[0]['user_comment'] = str_replace(
[
"\n",
'&#x0a;',
],
'<br>',
$event_comments[0]['user_comment']
);
$event_comments_array = json_decode($event_comments[0]['user_comment']);
if (empty($event_comments_array) === true) {
$comments_format = 'old';
} else {
$comments_format = 'new';
}
}
switch ($comments_format) {
case 'new':
$comment_for_json['comment'] = io_safe_input($comment);
$comment_for_json['action'] = $action;
$comment_for_json['id_user'] = $config['id_user'];
$comment_for_json['utimestamp'] = time();
$comment_for_json['event_id'] = $first_event;
$event_comments_array[] = $comment_for_json;
$event_comments = io_json_mb_encode($event_comments_array);
// Update comment.
$ret = db_process_sql_update(
'tevento',
['user_comment' => $event_comments],
['id_evento' => implode(',', $id_event)]
);
break;
case 'old':
// Give old ugly format to comment.
// Change this method for aux table or json.
$comment = str_replace(["\r\n", "\r", "\n"], '<br>', $comment);
if ($comment !== '') {
$commentbox = '<div class="comment_box">'.io_safe_input($comment).'</div>';
} else {
$commentbox = '';
}
// Don't translate 'by' word because if multiple users with
// different languages make comments in the same console
// will be a mess.
$comment = '<b>-- '.$action.' by '.$config['id_user'].' ['.date($config['date_format']).'] --</b><br>'.$commentbox.'<br>';
// Update comment.
$sql_validation = sprintf(
'UPDATE %s
SET user_comment = concat("%s", user_comment)
WHERE id_evento in (%s)',
'tevento',
$comment,
implode(',', $id_event)
);
$ret = db_process_sql($sql_validation);
break;
default:
// Ignore.
break;
}
if (($ret === false) || ($ret === 0)) {
return false;
}
@ -2409,7 +2336,8 @@ function events_create_event(
$tags='',
$custom_data='',
$server_id=0,
$id_extra=''
$id_extra='',
$ack_utimestamp=0
) {
if ($source === false) {
$source = get_product_name();
@ -2430,7 +2358,6 @@ function events_create_event(
'id_agentmodule' => $id_agent_module,
'id_alert_am' => $id_aam,
'criticity' => $priority,
'user_comment' => '',
'tags' => $tags,
'source' => $source,
'id_extra' => $id_extra,
@ -2438,7 +2365,7 @@ function events_create_event(
'warning_instructions' => $warning_instructions,
'unknown_instructions' => $unknown_instructions,
'owner_user' => '',
'ack_utimestamp' => 0,
'ack_utimestamp' => $ack_utimestamp,
'custom_data' => $custom_data,
'data' => '',
'module_status' => 0,
@ -5061,8 +4988,12 @@ function events_page_general($event)
}
$data[1] = $user_ack.'&nbsp;(&nbsp;';
// hd($config['date_format'], true);
// hd($event['ack_utimestamp_raw'], true);
// TODO: mirar en el manage y en la api que este ack de venir vacio lo herede del anterior que hubiera.
if ($event['ack_utimestamp_raw'] !== false
&& $event['ack_utimestamp_raw'] !== 'false'
&& empty($event['ack_utimestamp_raw']) === false
) {
$data[1] .= date(
$config['date_format'],
@ -5218,7 +5149,7 @@ function events_page_general_acknowledged($event_id)
*
* @return string HTML.
*/
function events_page_comments($event, $ajax=false, $groupedComments=[])
function events_page_comments($event, $groupedComments=[], $filter=null)
{
// Comments.
global $config;
@ -5229,12 +5160,7 @@ function events_page_comments($event, $ajax=false, $groupedComments=[])
$table_comments->head = [];
$table_comments->class = 'table_modal_alternate';
if (isset($event['user_comment']) === false) {
$event['user_comment'] = '';
}
$comments = (empty($groupedComments) === true) ? $event['user_comment'] : $groupedComments;
$comments = $groupedComments;
if (empty($comments) === true) {
$table_comments->style[0] = 'text-align:left;';
$table_comments->colspan[0][0] = 2;
@ -5243,49 +5169,7 @@ function events_page_comments($event, $ajax=false, $groupedComments=[])
$table_comments->data[] = $data;
} else {
if (is_array($comments) === true) {
$comments_array = [];
foreach ($comments as $comm) {
if (empty($comm) === true) {
continue;
}
// If exists user_comments, come from grouped events and must be handled like this.
if (isset($comm['user_comment']) === true) {
$comm = $comm['user_comment'];
}
$comm = str_replace(["\n", '&#x0a;'], '<br>', $comm);
$comments_array[] = io_safe_output(json_decode($comm, true));
}
// Plain comments. Can be improved.
$sortedCommentsArray = [];
foreach ($comments_array as $comm) {
if (isset($comm) === true
&& empty($comm) === false
) {
foreach ($comm as $subComm) {
$sortedCommentsArray[] = $subComm;
}
}
}
// Sorting the comments by utimestamp (newer is first).
usort(
$sortedCommentsArray,
function ($a, $b) {
if ($a['utimestamp'] == $b['utimestamp']) {
return 0;
}
return ($a['utimestamp'] > $b['utimestamp']) ? -1 : 1;
}
);
// Clean the unsorted comments and return it to the original array.
$comments_array = [];
$comments_array[] = $sortedCommentsArray;
$comments_array = $comments;
} else {
$comments = str_replace(["\n", '&#x0a;'], '<br>', $comments);
// If comments are not stored in json, the format is old.
@ -5293,76 +5177,70 @@ function events_page_comments($event, $ajax=false, $groupedComments=[])
}
foreach ($comments_array as $comm) {
$comments_format = (empty($comm) === true && is_array($comments) === false) ? 'old' : 'new';
$eventIdExplanation = (empty($groupedComments) === false) ? sprintf(' (#%d)', $comm['id_event']) : '';
$data[0] = sprintf(
'<b>%s %s %s%s</b>',
$comm['action'],
__('by'),
get_user_fullname(io_safe_input($comm['id_user'])).' ('.io_safe_input($comm['id_user']).')',
$eventIdExplanation
);
switch ($comments_format) {
case 'new':
foreach ($comm as $c) {
$eventIdExplanation = (empty($groupedComments) === false) ? sprintf(' (#%d)', $c['event_id']) : '';
$data[0] .= sprintf(
'<br><br><i>%s</i>',
date($config['date_format'], $comm['utimestamp'])
);
$data[0] = sprintf(
'<b>%s %s %s%s</b>',
$c['action'],
__('by'),
get_user_fullname(io_safe_input($c['id_user'])).' ('.io_safe_input($c['id_user']).')',
$eventIdExplanation
);
$data[1] = '<p class="break_word">'.stripslashes(str_replace(['\n', '\r'], '<br/>', $comm['comment'])).'</p>';
$data[0] .= sprintf(
'<br><br><i>%s</i>',
date($config['date_format'], $c['utimestamp'])
);
$data[1] = '<p class="break_word">'.stripslashes(str_replace(['\n', '\r'], '<br/>', $c['comment'])).'</p>';
$table_comments->data[] = $data;
}
break;
case 'old':
$comm = explode('<br>', $comments);
// Split comments and put in table.
$col = 0;
$data = [];
foreach ($comm as $c) {
switch ($col) {
case 0:
$row_text = preg_replace('/\s*--\s*/', '', $c);
$row_text = preg_replace('/\<\/b\>/', '</i>', $row_text);
$row_text = preg_replace('/\[/', '</b><br><br><i>[', $row_text);
$row_text = preg_replace('/[\[|\]]/', '', $row_text);
break;
case 1:
$row_text = preg_replace("/[\r\n|\r|\n]/", '<br>', io_safe_output(strip_tags($c)));
break;
default:
// Ignore.
break;
}
$data[$col] = $row_text;
$col++;
if ($col == 2) {
$col = 0;
$table_comments->data[] = $data;
$data = [];
}
}
break;
default:
// Ignore.
break;
}
$table_comments->data[] = $data;
}
}
$comments_filter = '<div class="flex align-center">';
$comments_filter .= html_print_label_input_block(
null,
html_print_extended_select_for_time(
'comments_events_max_hours_old',
$filter['event_view_hr_cs'],
'',
__('Default'),
-2,
false,
true,
false,
true,
'',
false,
[
SECONDS_1HOUR => __('1 hour'),
SECONDS_6HOURS => __('6 hours'),
SECONDS_12HOURS => __('12 hours'),
SECONDS_1DAY => __('24 hours'),
SECONDS_2DAY => __('48 hours'),
],
'',
false,
0,
[ SECONDS_1HOUR => __('hours') ],
)
);
$eventb64 = base64_encode(json_encode($event));
$filterb64 = base64_encode(json_encode($filter));
$comments_filter .= html_print_submit_button(
__('Filter'),
'filter_comments_button',
false,
[
'class' => 'mini mrgn_lft_15px',
'icon' => 'search',
'onclick' => 'get_table_events_tabs("'.$eventb64.'","'.$filterb64.'")',
],
true
);
$comments_filter .= '</div>';
if (((tags_checks_event_acl(
$config['id_user'],
$event['id_grupo'],
@ -5388,7 +5266,10 @@ function events_page_comments($event, $ajax=false, $groupedComments=[])
true
);
$comments_form .= '<br><div class="right mrgn_top_10px">';
$comments_form .= '<br>';
$comments_form .= '<div class="mrgn_top_10px container-filter-buttons">';
$comments_form .= $comments_filter;
$comments_form .= '<div>';
$comments_form .= html_print_button(
__('Add comment'),
'comment_button',
@ -5400,14 +5281,15 @@ function events_page_comments($event, $ajax=false, $groupedComments=[])
],
true
);
$comments_form .= '</div><br></div>';
$comments_form .= '</div>';
$comments_form .= '</div>';
$comments_form .= '<br></div>';
} else {
$comments_form = $comments_filter;
}
if ($ajax === true) {
return $comments_form.html_print_table($table_comments, true);
}
return '<div id="extended_event_comments_page" class="extended_event_pages">'.$comments_form.html_print_table($table_comments, true).'</div>';
return $comments_form.html_print_table($table_comments, true);
}
@ -5542,7 +5424,7 @@ function events_get_sql_order($sort_field='timestamp', $sort='DESC', $group_rep=
break;
case 'comment':
$sort_field_translated = 'user_comment';
$sort_field_translated = 'tevent_comment.comment';
break;
case 'extra_id':
@ -6114,3 +5996,179 @@ function get_count_event_criticity(
return db_get_all_rows_sql($sql_meta);
}
/**
* Comments for this events.
*
* @param array $event Info event.
* @param integer $mode Mode group by.
* @param integer $event_rep Events.
*
* @return array Comments.
*/
function event_get_comment($event, $filter=null)
{
$whereGrouped = [];
if (empty($filter) === false) {
if (isset($filter['event_view_hr_cs']) === true && ($filter['event_view_hr_cs'] > 0)) {
$whereGrouped[] = sprintf(
' AND tevent_comment.utimestamp > UNIX_TIMESTAMP(now() - INTERVAL %d SECOND) ',
$filter['event_view_hr_cs']
);
} else if (isset($filter['event_view_hr']) === true && ($filter['event_view_hr'] > 0)) {
$whereGrouped[] = sprintf(
' AND tevent_comment.utimestamp > UNIX_TIMESTAMP(now() - INTERVAL %d SECOND) ',
((int) $filter['event_view_hr'] * 3600)
);
}
}
$mode = (int) $filter['group_rep'];
$eventsGrouped = [];
// Consider if the event is grouped.
if ($mode === EVENT_GROUP_REP_EVENTS) {
// Default grouped message filtering (evento and estado).
$whereGrouped[] = sprintf(
'AND `tevento`.`evento` = "%s"',
io_safe_input(io_safe_output($event['evento']))
);
// If id_agente is reported, filter the messages by them as well.
if ((int) $event['id_agente'] > 0) {
$whereGrouped[] = sprintf(
' AND `tevento`.`id_agente` = %d',
(int) $event['id_agente']
);
}
if ((int) $event['id_agentmodule'] > 0) {
$whereGrouped[] = sprintf(
' AND `tevento`.`id_agentmodule` = %d',
(int) $event['id_agentmodule']
);
}
} else if ($mode === EVENT_GROUP_REP_EXTRAIDS) {
$whereGrouped[] = sprintf(
'AND `tevento`.`id_extra` = "%s"',
io_safe_input(io_safe_output($event['id_extra']))
);
} else {
$whereGrouped[] = sprintf('AND `tevento`.`id_evento` = %d', $event['id_evento']);
}
try {
if (is_metaconsole() === true
&& $event['server_id'] > 0
) {
$node = new Node($event['server_id']);
$node->connect();
}
$sql = sprintf(
'SELECT tevent_comment.*
FROM tevento
INNER JOIN tevent_comment
ON tevento.id_evento = tevent_comment.id_event
WHERE 1=1 %s
ORDER BY tevent_comment.utimestamp DESC',
implode(' ', $whereGrouped)
);
// Get grouped comments.
$eventsGrouped = db_get_all_rows_sql($sql);
} catch (\Exception $e) {
// Unexistent agent.
if (is_metaconsole() === true
&& $event['server_id'] > 0
) {
$node->disconnect();
}
$eventsGrouped = [];
} finally {
if (is_metaconsole() === true
&& $event['server_id'] > 0
) {
$node->disconnect();
}
}
return $eventsGrouped;
}
/**
* Last comment for this event.
*
* @param array $event Info event.
*
* @return string Comment.
*/
function event_get_last_comment($event, $filter)
{
$comments = event_get_comment($event, $filter);
if (empty($comments) === false) {
return $comments[0];
}
return '';
}
/**
* Get counter events same extraid.
*
* @param array $event Event data.
* @param array $filters Filters.
*
* @return integer Counter.
*/
function event_get_counter_extraId(array $event, ?array $filters)
{
$counters = 0;
$where = get_filter_date($filters);
$where[] = sprintf(
'AND `te`.`id_extra` = "%s"',
$event['id_extra']
);
try {
if (is_metaconsole() === true
&& $event['server_id'] > 0
) {
$node = new Node($event['server_id']);
$node->connect();
}
$sql = sprintf(
'SELECT count(*)
FROM tevento te
WHERE 1=1 %s',
implode(' ', $where)
);
// Get grouped comments.
$counters = db_get_value_sql($sql);
} catch (\Exception $e) {
// Unexistent agent.
if (is_metaconsole() === true
&& $event['server_id'] > 0
) {
$node->disconnect();
}
$counters = 0;
} finally {
if (is_metaconsole() === true
&& $event['server_id'] > 0
) {
$node->disconnect();
}
}
return $counters;
}

View File

@ -2162,7 +2162,8 @@ function html_print_extended_select_for_time(
$custom_fields=false,
$style_icon='',
$no_change=false,
$allow_zero=0
$allow_zero=0,
$units=null
) {
global $config;
$admin = is_user_admin($config['id_user']);
@ -2188,15 +2189,17 @@ function html_print_extended_select_for_time(
$selected = 300;
}
$units = [
1 => __('seconds'),
SECONDS_1MINUTE => __('minutes'),
SECONDS_1HOUR => __('hours'),
SECONDS_1DAY => __('days'),
SECONDS_1WEEK => __('weeks'),
SECONDS_1MONTH => __('months'),
SECONDS_1YEAR => __('years'),
];
if (empty($units) === true) {
$units = [
1 => __('seconds'),
SECONDS_1MINUTE => __('minutes'),
SECONDS_1HOUR => __('hours'),
SECONDS_1DAY => __('days'),
SECONDS_1WEEK => __('weeks'),
SECONDS_1MONTH => __('months'),
SECONDS_1YEAR => __('years'),
];
}
if ($unique_name === true) {
$uniq_name = uniqid($name);
@ -3618,6 +3621,7 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
$classes = '';
$fixedId = '';
$iconStyle = '';
$minimize_arrow = false;
// $spanStyle = 'margin-top: 4px;';
$spanStyle = '';
if (empty($name) === true) {
@ -3655,6 +3659,8 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
$buttonType = ($attr_array['type'] ?? 'button');
$buttonAttributes = $value;
break;
} else if ($attribute === 'minimize-arrow') {
$minimize_arrow = true;
} else {
$attributes .= $attribute.'="'.$value.'" ';
}
@ -3679,15 +3685,30 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
$iconDiv = '';
}
if ($minimize_arrow === true) {
$minimezeDiv = html_print_div(
[
'id' => 'minimize_arrow_event_sound',
'style' => 'background-color:transparent; right: 1em; margin-left:0.5em; position:relative; display:none;',
'class' => 'arrow_menu_down w30p',
],
true
);
} else {
$minimezeDiv = '';
}
// Defined id. Is usable for span and button.
// TODO. Check if will be proper use button or submit when where appropiate.
$mainId = ((empty($fixedId) === false) ? $fixedId : 'button-'.$name);
if ($imageButton === false) {
$content = '<span id="span-'.$mainId.'" style="'.$spanStyle.'" class="font_11">'.$label.'</span>';
$content = $minimezeDiv;
$content .= '<span id="span-'.$mainId.'" style="'.$spanStyle.'" class="font_11">'.$label.'</span>';
$content .= $iconDiv;
} else {
$content = $iconDiv;
$content = $minimezeDiv;
$content .= $iconDiv;
}
// In case of not selected button type, in this case, will be normal button.
@ -5504,7 +5525,10 @@ function html_print_input($data, $wrapper='div', $input_only=false)
($data['attributes'] ?? null),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['password']) === true) ? $data['password'] : false),
((isset($data['function']) === true) ? $data['function'] : '')
((isset($data['function']) === true) ? $data['function'] : ''),
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : 'off'),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['hide_div_eye']) === true) ? $data['hide_div_eye'] : false),
);
break;

View File

@ -353,7 +353,7 @@ function menu_print_menu(&$menu)
$secExtensionBool = false;
if ($secExtensionBool) {
if (strlen($sub['icon']) > 0) {
if (empty($sub['icon']) === false && strlen($sub['icon']) > 0) {
$icon_enterprise = false;
if (isset($sub['enterprise'])) {
$icon_enterprise = (bool) $sub['enterprise'];
@ -380,7 +380,7 @@ function menu_print_menu(&$menu)
$secExtension = $sub['sec'];
}
if (strlen($secExtension) > 0) {
if (empty($secExtension) === false && strlen($secExtension) > 0) {
$secUrl = $secExtension;
$extensionInMenu = 'extension_in_menu='.$mainsec.'&amp;';
} else {

View File

@ -88,8 +88,16 @@ function ui_bbcode_to_html($text, $allowed_tags=['[url]'])
*
* @return string Truncated text.
*/
function ui_print_truncate_text($text, $numChars=GENERIC_SIZE_TEXT, $showTextInAToopTip=true, $return=true, $showTextInTitle=true, $suffix='&hellip;', $style=false)
{
function ui_print_truncate_text(
$text,
$numChars=GENERIC_SIZE_TEXT,
$showTextInAToopTip=true,
$return=true,
$showTextInTitle=true,
$suffix='&hellip;',
$style=false,
$forced_title=false
) {
global $config;
if (is_string($numChars)) {
@ -190,6 +198,10 @@ function ui_print_truncate_text($text, $numChars=GENERIC_SIZE_TEXT, $showTextInA
}
}
if ($forced_title === true) {
$truncateText = '<span class="forced_title" style="'.$style.'" data-title="'.$text.'" data-use_title_for_force_title="1>'.$truncateText.'</span>';
}
if ($return == true) {
return $truncateText;
} else {
@ -3742,28 +3754,71 @@ function ui_progress_extend(
* Generate needed code to print a datatables jquery plugin.
*
* @param array $parameters All desired data using following format:
* [
* 'print' => true (by default printed)
* 'id' => datatable id.
* 'class' => datatable class.
* 'style' => datatable style.
* 'order' => [
* 'field' => column name
* 'direction' => asc or desc
* ],
* 'default_pagination' => integer, default pagination is set to block_size
* 'ajax_url' => 'include/ajax.php' ajax_url.
* 'ajax_data' => [ operation => 1 ] extra info to be sent.
* 'ajax_postprocess' => a javscript function to postprocess data received
* by ajax call. It is applied foreach row and must
* use following format:
* * [code]
* * function (item) {
* * // Process received item, for instance, name:
* * tmp = '<span class=label>' + item.name + '</span>';
* * item.name = tmp;
* * }
* * [/code]
*
* ```php
* $parameters = [
* // JS Parameters
* 'serverside' => true,
* 'paging' => true,
* 'default_pagination' => $config['block_size'],
* 'searching' => false,
* 'dom_elements' => "plfrtiB",
* 'pagination_options' => [default_pagination, 5, 10, 20, 100, 200, 500, 1000, "All"],
* 'ordering' => true,
* 'order' => [[0, "asc"]], //['field' => 'column_name', 'direction' => 'asc/desc']
* 'zeroRecords' => "No matching records found",
* 'emptyTable' => "No data available in table",
* 'no_sortable_columns' => [], //Allows the column name (db) from "columns" parameter
* 'csv_field_separator' => ",",
* 'csv_header' => true,
* 'mini_csv' => false,
* 'mini_pagination' => false,
* 'mini_search' => false,
* 'drawCallback' => undefined, //'console.log(123),'
* 'data_element' => undefined, //Rows processed
* 'ajax_postprocess' => undefined, //'process_datatables_item(item)'
* 'ajax_data' => undefined, //Extra data to be sent ['field1' => 1, 'field2 => 0]
* 'ajax_url' => undefined,
* 'caption' => undefined,
*
* // PHP Parameters
* 'id' => undefined, //Used for table and form id,
* 'columns' =>,
* 'column_names' =>,
* 'filter_main_class' =>,
* 'toggle_collapsed' =>true,
* 'search_button_class' => 'sub filter',
* 'csv' =>=1,
* 'form' =>
* ..[
* ....'id' => $form_id,
* ....'class' => 'flex-row',
* ....'style' => 'width: 100%,',
* ....'js' => '',
* ....'html' => $filter,
* ....'inputs' => [],
* ....'extra_buttons' => $buttons,
* ..],
* 'no_toggle' => false,
* 'form_html' => undefined,
* 'toggle_collapsed' => true,
* 'class' => "", //Datatable class.
* 'style' => "" ,//Datatable style.
* 'return' => false,
* 'print' => true,
* ]
*
* ```
*
* ```php
* ajax_postprocess => a javscript function to postprocess data received
* by ajax call. It is applied foreach row and must
* use following format:
* function (item) {
* // Process received item, for instance, name:
* tmp = '<span class=label>' + item.name + '</span>';
* item.name = tmp;
* }
* 'columns_names' => [
* 'column1' :: Used as th text. Direct text entry. It could be array:
* OR
@ -3780,7 +3835,6 @@ function ui_progress_extend(
* 'column2',
* ...
* ],
* 'no_sortable_columns' => [ indexes ] 1,2... -1 etc. Avoid sorting.
* 'form' => [
* 'html' => 'html code' a directly defined inputs in HTML.
* 'extra_buttons' => [
@ -3812,12 +3866,7 @@ function ui_progress_extend(
* ]
* ],
* 'extra_html' => HTML content to be placed after 'filter' section.
* 'drawCallback' => function to be called after draw. Sample in:
* https://datatables.net/examples/advanced_init/row_grouping.html
* ]
* 'zeroRecords' => Message when zero records obtained from filter.(Leave blank for default).
* 'emptyTable' => Message when table data empty.(Leave blank for default).
* End.
* ```
*
* @return string HTML code with datatable.
* @throws Exception On error.
@ -3834,6 +3883,9 @@ function ui_print_datatable(array $parameters)
$form_id = uniqid('datatable_filter_');
}
$parameters['table_id'] = $table_id;
$parameters['form_id'] = $form_id;
if (!isset($parameters['columns']) || !is_array($parameters['columns'])) {
throw new Exception('[ui_print_datatable]: You must define columns for datatable');
}
@ -3853,10 +3905,6 @@ function ui_print_datatable(array $parameters)
$parameters['default_pagination'] = $config['block_size'];
}
if (!isset($parameters['paging'])) {
$parameters['paging'] = true;
}
if (!isset($parameters['filter_main_class'])) {
$parameters['filter_main_class'] = '';
}
@ -3865,13 +3913,9 @@ function ui_print_datatable(array $parameters)
$parameters['toggle_collapsed'] = true;
}
$no_sortable_columns = json_encode([]);
if (isset($parameters['no_sortable_columns'])) {
$no_sortable_columns = json_encode($parameters['no_sortable_columns']);
}
if (!is_array($parameters['order'])) {
$order = '0, "asc"';
$order = 0;
$direction = 'asc';
} else {
if (!isset($parameters['order']['direction'])) {
$direction = 'asc';
@ -3890,47 +3934,35 @@ function ui_print_datatable(array $parameters)
}
}
$order .= ', "'.$parameters['order']['direction'].'"';
$direction = $parameters['order']['direction'];
}
if (!isset($parameters['ajax_data'])) {
$parameters['ajax_data'] = '';
$parameters['order']['order'] = $order;
$parameters['order']['direction'] = $direction;
foreach ($parameters['no_sortable_columns'] as $key => $find) {
$found = array_search(
$parameters['no_sortable_columns'][$key],
$parameters['columns']
);
if ($found !== false) {
unset($parameters['no_sortable_columns'][$key]);
array_push($parameters['no_sortable_columns'], $found);
}
if (is_int($parameters['no_sortable_columns'][$key]) === false) {
unset($parameters['no_sortable_columns'][$key]);
}
}
$search_button_class = 'sub filter';
$parameters['csvTextInfo'] = __('Export current page to CSV');
$parameters['csvFileTitle'] = sprintf(__('export_%s_current_page_%s'), $table_id, date('Y-m-d'));
if (isset($parameters['search_button_class'])) {
$search_button_class = $parameters['search_button_class'];
}
if (isset($parameters['pagination_options'])) {
$pagination_options = $parameters['pagination_options'];
} else {
$pagination_options = [
[
// There is a limit of (2^32)^2 (18446744073709551615) rows in a MyISAM table, show for show all use max nrows.
// -1 Retun error or only 1 row.
$parameters['default_pagination'],
5,
10,
25,
100,
200,
500,
1000,
18446744073709551615,
],
[
$parameters['default_pagination'],
5,
10,
25,
100,
200,
500,
1000,
'All',
],
];
$search_button_class = 'sub filter';
}
if (isset($parameters['datacolumns']) === false
@ -3943,16 +3975,12 @@ function ui_print_datatable(array $parameters)
$parameters['csv'] = 1;
}
$dom_elements = '"plfrtiB"';
if (isset($parameters['dom_elements'])) {
$dom_elements = '"'.$parameters['dom_elements'].'"';
}
$filter = '';
// Datatable filter.
if (isset($parameters['form']) && is_array($parameters['form'])) {
if (isset($parameters['form']['id'])) {
$form_id = $parameters['form']['id'];
$parameters['form_id'] = $form_id;
}
if (isset($parameters['form']['class'])) {
@ -4070,10 +4098,13 @@ function ui_print_datatable(array $parameters)
)
);
$processing .= '</div>';
$parameters['processing'] = $processing;
$zeroRecords = isset($parameters['zeroRecords']) === true ? $parameters['zeroRecords'] : __('No matching records found');
$emptyTable = isset($parameters['emptyTable']) === true ? $parameters['emptyTable'] : __('No data available in table');
$parameters['zeroRecords'] = $zeroRecords;
$parameters['emptyTable'] = $emptyTable;
// Extra html.
$extra = '';
if (isset($parameters['extra_html']) && !empty($parameters['extra_html'])) {
@ -4082,8 +4113,8 @@ function ui_print_datatable(array $parameters)
// Base table.
$table = '<table id="'.$table_id.'" ';
$table .= 'class="'.$parameters['class'].' invisible"';
$table .= 'style="'.$parameters['style'].'">';
$table .= 'class="'.$parameters['class'].'"';
$table .= 'style="box-sizing: border-box;'.$parameters['style'].'">';
$table .= '<thead><tr class="datatables_thead_tr">';
if (isset($parameters['column_names'])
@ -4110,336 +4141,60 @@ function ui_print_datatable(array $parameters)
}
$table .= '</tr></thead>';
if (isset($parameters['data_element']) === true) {
$table .= '<tbody>';
foreach ($parameters['data_element'] as $row) {
$table .= '<tr>';
foreach ($row as $td_data) {
$table .= '<td>'.$td_data.'</td>';
}
$table .= '</tr>';
}
$table .= '</tbody>';
$js = '<script>
$.fn.dataTable.ext.classes.sPageButton = "pandora_pagination mini-pandora-pagination"
var table = $("#'.$table_id.'").DataTable({
"dom": "'.$parameters['dom_elements'].'"
});
$("div.spinner-fixed").hide();
$("table#'.$table_id.'").removeClass("invisible");
$("#'.$table_id.'_filter > label > input").addClass("mini-search-input");
if (table.page.info().pages == 1) {
$("#'.$table_id.'_paginate").hide();
}
</script>';
}
$table .= '</table>';
$pagination_class = 'pandora_pagination';
if (!empty($parameters['pagination_class'])) {
$pagination_class = $parameters['pagination_class'];
$parameters['ajax_url_full'] = ui_get_full_url('ajax.php', false, false, false);
$parameters['spinnerLoading'] = html_print_image(
'images/spinner.gif',
true,
[
'id' => $form_id.'_loading',
'class' => 'loading-search-datatables-button',
]
);
$language = substr(get_user_language(), 0, 2);
if (is_metaconsole() === false) {
$parameters['language'] = 'include/javascript/i18n/dataTables.'.$language.'.json';
} else {
$parameters['language'] = '../../include/javascript/i18n/dataTables.'.$language.'.json';
}
$columns = '';
for ($i = 1; $i <= (count($parameters['columns']) - 3); $i++) {
if ($i != (count($parameters['columns']) - 3)) {
$columns .= $i.',';
} else {
$columns .= $i;
}
$parameters['phpDate'] = date('Y-m-d');
$parameters['dataElements'] = json_encode($parameters['data_element']);
// * START JAVASCRIPT.
if (is_metaconsole() === false) {
$file_path = ui_get_full_url('include/javascript/datatablesFunction.js');
} else {
$file_path = ui_get_full_url('../../include/javascript/datatablesFunction.js');
}
$export_columns = '';
if (isset($parameters['csv_exclude_latest']) === true
&& $parameters['csv_exclude_latest'] === true
) {
$export_columns = ',columns: \'th:not(:last-child)\'';
}
$file_content = file_get_contents($file_path);
$json_data = json_encode($parameters);
$json_config = json_encode($config);
if (isset($parameters['data_element']) === false || isset($parameters['print_pagination_search_csv'])) {
if (isset($parameters['ajax_url'])) {
$type_data = 'ajax: {
url: "'.ui_get_full_url('ajax.php', false, false, false).'",
type: "POST",
dataSrc: function (json) {
if($("#'.$form_id.'_search_bt") != undefined) {
$("#'.$form_id.'_loading").remove();
}
$js = '<script>';
$js .= 'var dt = '.$json_data.';';
$js .= 'var config = '.$json_config.';';
$js .= '</script>';
if (json.error) {
console.error(json.error);
$("#error-'.$table_id.'").html(json.error);
$("#error-'.$table_id.'").dialog({
title: "Filter failed",
width: 630,
resizable: true,
draggable: true,
modal: false,
closeOnEscape: true,
buttons: {
"Ok" : function () {
$(this).dialog("close");
}
}
}).parent().addClass("ui-state-error");
} else {';
if (isset($parameters['ajax_return_operation']) === true
&& empty($parameters['ajax_return_operation']) === false
&& isset($parameters['ajax_return_operation_function']) === true
&& empty($parameters['ajax_return_operation_function']) === false
) {
$type_data .= '
if (json.'.$parameters['ajax_return_operation'].' !== undefined) {
'.$parameters['ajax_return_operation_function'].'(json.'.$parameters['ajax_return_operation'].');
}
';
}
if (isset($parameters['ajax_postprocess'])) {
$type_data .= '
if (json.data) {
json.data.forEach(function(item) {
'.$parameters['ajax_postprocess'].'
});
} else {
json.data = {};
}';
}
$type_data .= '
return json.data;
}
},
data: function (data) {
if($("#button-'.$form_id.'_search_bt") != undefined) {
var loading = \''.html_print_image(
'images/spinner.gif',
true,
[
'id' => $form_id.'_loading',
'class' => 'loading-search-datatables-button',
]
).'\';
$("#button-'.$form_id.'_search_bt").parent().append(loading);
}
inputs = $("#'.$form_id.' :input");
values = {};
inputs.each(function() {
values[this.name] = $(this).val();
})
$.extend(data, {
filter: values,'."\n";
if (is_array($parameters['ajax_data'])) {
foreach ($parameters['ajax_data'] as $k => $v) {
$type_data .= $k.':'.json_encode($v).",\n";
}
}
$type_data .= 'page: "'.$parameters['ajax_url'].'"
});
return data;
}
},';
} else {
$type_data = 'data: '.json_encode($parameters['data_element']).',';
}
$serverside = 'true';
if (isset($parameters['data_element'])) {
$serverside = 'false';
}
// Javascript controller.
$js = '<script type="text/javascript">
$(document).ready(function(){
$.fn.dataTable.ext.errMode = "none";
$.fn.dataTable.ext.classes.sPageButton = "'.$pagination_class.'";
var settings_datatable = {
drawCallback: function(settings) {';
if (!isset($parameters['data_element'])) {
$js .= 'if (dt_'.$table_id.'.page.info().pages > 1) {
$("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").show()
} else {
$("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").hide()
}';
}
$js .= 'if ($("#'.$table_id.' tr td").length == 1) {
$(".datatable-msg-info-'.$table_id.'").show();
$(".datatable-msg-info-'.$table_id.'").removeClass(\'invisible_important\');
$("table#'.$table_id.'").hide();
$("div.dataTables_paginate").hide();
$("div.dataTables_info").hide();
$("div.dataTables_length").hide();
$("div.dt-buttons").hide();
if (dt_'.$table_id.'.page.info().pages > 1) {
$(".dataTables_paginate.paging_simple_numbers").show()
}
} else {
$(".datatable-msg-info-'.$table_id.'").hide();
$("table#'.$table_id.'").show();
$("div.dataTables_paginate").show();
$("div.dataTables_info").hide();
$("div.dataTables_length").show();
$("div.dt-buttons").show();
if (dt_'.$table_id.'.page.info().pages == 1) {
$(".dataTables_paginate.paging_simple_numbers").hide()
}
}';
if (isset($parameters['drawCallback'])) {
$js .= $parameters['drawCallback'];
}
$searching = 'false';
if (isset($parameters['searching']) && $parameters['searching'] === true) {
$searching = 'true';
}
$ordering = 'true';
if (isset($parameters['ordering']) && $parameters['ordering'] === false) {
$ordering = 'false';
}
$js .= '},';
$languaje = substr(get_user_language(), 0, 2);
$js .= '
processing: true,
serverSide: '.$serverside.',
paging: '.$parameters['paging'].',
pageLength: '.$parameters['default_pagination'].',
searching: '.$searching.',
responsive: true,
dom: '.$dom_elements.',
language: {
url: "/pandora_console/include/javascript/i18n/dataTables.'.$languaje.'.json",
processing:"'.$processing.'",
zeroRecords:"'.$zeroRecords.'",
emptyTable:"'.$emptyTable.'",
},
buttons: '.$parameters['csv'].'== 1 ? [
{
extend: "csv",
text : "'.__('Export current page to CSV').'",
titleAttr: "'.__('Export current page to CSV').'",
title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'",
fieldSeparator: "'.$config['csv_divider'].'",
action: function ( e, dt, node, config ) {
blockResubmit(node);
// Call the default csvHtml5 action method to create the CSV file
$.fn.dataTable.ext.buttons.csvHtml5.action.call(this, e, dt, node, config);
},
exportOptions : {
modifier : {
// DataTables core
order : "current",
page : "All",
search : "applied"
}'.$export_columns.'
},
}
] : [],
lengthMenu: '.json_encode($pagination_options).',
columnDefs: [
{ className: "no-class", targets: "_all" },
{ bSortable: false, targets: '.$no_sortable_columns.' }
],
ordering: '.$ordering.',
initComplete: function(settings, json) {
// Move elements to table_action_buttons bar.
$(".action_buttons_right_content").html("<div class=\"pagination-child-div\"></div>");
$(".action_buttons_right_content").html("<div class=\"pagination-child-div\"></div>");
$(".action_buttons_right_content").html("<div class=\"pagination-child-div\"></div>");
$(".action_buttons_right_content").html("<div class=\"pagination-child-div\"></div>");
let original_styles = $("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").attr("style");
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").attr("style", original_styles + " margin-right: 10px;"));
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dataTables_length"));
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dt-buttons"));
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dataTables_filter"));
$("div.spinner-fixed").hide();
},
columns: [';
foreach ($parameters['datacolumns'] as $data) {
if (is_array($data)) {
$js .= '{data : "'.$data['text'].'",className: "'.$data['class'].'"},';
} else {
$js .= '{data : "'.$data.'",className: "no-class"},';
}
}
$js .= '
],
order: [[ '.$order.' ]],';
$js .= $type_data;
$js .= '
};
dt_'.$table_id.' = $("#'.$table_id.'").DataTable(settings_datatable);
$("#button-'.$form_id.'_search_bt").click(function (){
dt_'.$table_id.'.draw().page(0)
});
';
if (isset($parameters['caption']) === true
&& empty($parameters['caption']) === false
) {
$js .= '$("#'.$table_id.'").append("<caption>'.$parameters['caption'].'</caption>");';
$js .= '$(".datatables_thead_tr").css("height", 0);';
}
if (isset($parameters['csv']) === true) {
$js."'$('#".$table_id."').on( 'buttons-processing', function ( e, indicator ) {
if ( indicator ) {
console.log('a');
}
else {
console.log('b');
}";
}
$js .= '$("table#'.$table_id.'").removeClass("invisible");
});';
$js .= '
$(function() {
$(document).on("preInit.dt", function (ev, settings) {
$("div.dataTables_length").hide();
$("div.dt-buttons").hide();
});
});
';
$js .= '</script>';
}
// Order.
$js .= '<script>';
$js .= 'function '.$table_id.'(dt, config) { ';
$js .= $file_content;
$js .= '}';
$js .= $table_id.'(dt, config)';
$js .= '</script>';
// * END JAVASCRIPT.
$info_msg_arr = [];
$info_msg_arr['message'] = $emptyTable;
$info_msg_arr['div_class'] = 'info_box_container invisible_important datatable-msg-info-'.$table_id;
$spinner = '<div class="spinner-fixed"><span></span><span></span><span></span><span></span></div>';
$spinner = '<div id="'.$table_id.'-spinner" class="spinner-fixed"><span></span><span></span><span></span><span></span></div>';
$info_msg = '<div>'.ui_print_info_message($info_msg_arr).'</div>';
$err_msg = '<div id="error-'.$table_id.'"></div>';
$output = $info_msg.$err_msg.$filter.$extra.$spinner.$table.$js;
if (is_ajax() === false) {
@ -4463,7 +4218,7 @@ function ui_print_datatable(array $parameters)
false,
false
);
$output .= '?v='.$config['current_package'].'"/>';
$output .= '"/>';
// Load tables.css.
$output .= '<link rel="stylesheet" href="';
$output .= ui_get_full_url(
@ -5045,7 +4800,10 @@ function ui_get_url_refresh($params=false, $relative=true, $add_post=true)
$url .= $key.'['.$k.']='.$v.'&';
}
} else {
$url .= $key.'='.io_safe_input(rawurlencode($value)).'&';
$aux = (empty($value) === false)
? io_safe_input(rawurlencode($value))
: '';
$url .= $key.'='.$aux.'&';
}
}
@ -7329,68 +7087,55 @@ function ui_print_breadcrums($tab_name)
*
* @return string HTML string with the last comment of the events.
*/
function ui_print_comments($comments)
function ui_print_comments($comments, $truncate_limit=255)
{
global $config;
$comments = explode('<br>', $comments);
$comments = str_replace(["\n", '&#x0a;'], '<br>', $comments);
if (is_array($comments)) {
foreach ($comments as $comm) {
if (empty($comm)) {
continue;
}
$comments_array[] = io_safe_output(json_decode($comm, true));
}
}
$order_utimestamp = array_reduce(
$comments_array,
function ($carry, $item) {
foreach ($item as $k => $v) {
$carry[$v['utimestamp']] = $v;
}
return $carry;
}
);
$key_max_utimestamp = max(array_keys($order_utimestamp));
$last_comment = $order_utimestamp[$key_max_utimestamp];
if (empty($last_comment) === true) {
if (empty($comment) === true) {
return '';
}
// Only show the last comment. If commment its too long,the comment will short with ...
// If $config['prominent_time'] is timestamp the date show Month, day, hour and minutes.
// Else show comments hours ago
if ($last_comment['action'] != 'Added comment') {
$last_comment['comment'] = $last_comment['action'];
if ($comment['action'] != 'Added comment') {
$comment['comment'] = $comment['action'];
}
$short_comment = substr($last_comment['comment'], 0, 20);
$short_comment = substr($comment['comment'], 0, 20);
if ($config['prominent_time'] == 'timestamp') {
$comentario = '<i>'.date($config['date_format'], $last_comment['utimestamp']).'&nbsp;('.$last_comment['id_user'].'):&nbsp;'.$last_comment['comment'].'';
$comentario = '<i>'.date($config['date_format'], $comment['utimestamp']).'&nbsp;('.$comment['id_user'].'):&nbsp;'.$comment['comment'].'';
if (strlen($comentario) > '200px') {
$comentario = '<i>'.date($config['date_format'], $last_comment['utimestamp']).'&nbsp;('.$last_comment['id_user'].'):&nbsp;'.$short_comment.'...';
if (strlen($comentario) > '200px' && $truncate_limit >= 255) {
$comentario = '<i>'.date($config['date_format'], $comment['utimestamp']).'&nbsp;('.$comment['id_user'].'):&nbsp;'.$short_comment.'...';
}
} else {
$rest_time = (time() - $last_comment['utimestamp']);
$rest_time = (time() - $comment['utimestamp']);
$time_last = (($rest_time / 60) / 60);
$comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], ($config['thousand_separator'] ?? ',')).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$last_comment['comment'].'';
$comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], ($config['thousand_separator'] ?? ',')).'&nbsp; Hours &nbsp;('.$comment['id_user'].'):&nbsp;'.$comment['comment'].'';
if (strlen($comentario) > '200px') {
$comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], ($config['thousand_separator'] ?? ',')).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$short_comment.'...';
if (strlen($comentario) > '200px' && $truncate_limit >= 255) {
$comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], ($config['thousand_separator'] ?? ',')).'&nbsp; Hours &nbsp;('.$comment['id_user'].'):&nbsp;'.$short_comment.'...';
}
}
return io_safe_output($comentario);
$comentario = io_safe_output($comentario);
if (strlen($comentario) >= $truncate_limit) {
$comentario = ui_print_truncate_text(
$comentario,
$truncate_limit,
false,
true,
false,
'&hellip;',
true,
true,
);
}
return $comentario;
}
@ -8232,6 +7977,133 @@ function ui_print_fav_menu($id_element, $url, $label, $section)
}
function ui_print_tree(
$tree,
$id=0,
$depth=0,
$last=0,
$last_array=[],
$sufix=false,
$descriptive_ids=false,
$previous_id=''
) {
static $url = false;
$output = '';
// Get the base URL for images.
if ($url === false) {
$url = ui_get_full_url('operation/tree', false, false, false);
}
// Leaf.
if (empty($tree['__LEAVES__'])) {
return '';
}
$count = 0;
$total = (count(array_keys($tree['__LEAVES__'])) - 1);
$last_array[$depth] = $last;
$class = 'item_'.$depth;
if ($depth > 0) {
$output .= '<ul id="ul_'.$id.'" class="mrgn_0px pdd_0px invisible">';
} else {
$output .= '<ul id="ul_'.$id.'" class="mrgn_0px pdd_0px">';
}
foreach ($tree['__LEAVES__'] as $level => $sub_level) {
// Id used to expand leafs.
$sub_id = time().rand(0, getrandmax());
// Display the branch.
$output .= '<li id="li_'.$sub_id.'" class="'.$class.' mrgn_0px pdd_0px">';
// Indent sub branches.
for ($i = 1; $i <= $depth; $i++) {
if ($last_array[$i] == 1) {
$output .= '<img src="'.$url.'/no_branch.png" class="vertical_middle">';
} else {
$output .= '<img src="'.$url.'/branch.png" class="vertical_middle">';
}
}
// Branch.
if (! empty($sub_level['sublevel']['__LEAVES__'])) {
$output .= "<a id='anchor_$sub_id' onfocus='javascript: this.blur();' href='javascript: toggleTreeNode(\"$sub_id\", \"$id\");'>";
if ($depth == 0 && $count == 0) {
if ($count == $total) {
$output .= '<img src="'.$url.'/one_closed.png" class="vertical_middle">';
} else {
$output .= '<img src="'.$url.'/first_closed.png" class="vertical_middle">';
}
} else if ($count == $total) {
$output .= '<img src="'.$url.'/last_closed.png" class="vertical_middle">';
} else {
$output .= '<img src="'.$url.'/closed.png" class="vertical_middle">';
}
$output .= '</a>';
}
// Leave.
else {
if ($depth == 0 && $count == 0) {
if ($count == $total) {
$output .= '<img src="'.$url.'/no_branch.png" class="vertical_middle">';
} else {
$output .= '<img src="'.$url.'/first_leaf.png" class="vertical_middle">';
}
} else if ($count == $total) {
$output .= '<img src="'.$url.'/last_leaf.png" class="vertical_middle">';
} else {
$output .= '<img src="'.$url.'/leaf.png" class="vertical_middle">';
}
}
$checkbox_name_sufix = ($sufix === true) ? '_'.$level : '';
if ($descriptive_ids === true) {
$checkbox_name = 'create_'.$sub_id.$previous_id.$checkbox_name_sufix;
} else {
$checkbox_name = 'create_'.$sub_id.$checkbox_name_sufix;
}
$previous_id = $checkbox_name_sufix;
if ($sub_level['selectable'] === true) {
$output .= html_print_checkbox(
$sub_level['name'],
$sub_level['value'],
$sub_level['checked'],
true,
false,
'',
true
);
}
$output .= '&nbsp;<span>'.$sub_level['label'].'</span>';
$output .= '</li>';
// Recursively print sub levels.
$output .= ui_print_tree(
$sub_level['sublevel'],
$sub_id,
($depth + 1),
(($count == $total) ? 1 : 0),
$last_array,
$sufix,
$descriptive_ids,
$previous_id
);
$count++;
}
$output .= '</ul>';
return $output;
}
function ui_update_name_fav_element($id_element, $section, $label)
{
$label = io_safe_output($label);

View File

@ -1274,52 +1274,50 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background)
);
$form_items_advance['element_group_row']['html'] .= '</td>';
if (!$config['legacy_vc']) {
$intervals = [
10 => '10 '.__('seconds'),
30 => '30 '.__('seconds'),
60 => '1 '.__('minutes'),
300 => '5 '.__('minutes'),
900 => '15 '.__('minutes'),
1800 => '30 '.__('minutes'),
3600 => '1 '.__('hour'),
];
$intervals = [
10 => '10 '.__('seconds'),
30 => '30 '.__('seconds'),
60 => '1 '.__('minutes'),
300 => '5 '.__('minutes'),
900 => '15 '.__('minutes'),
1800 => '30 '.__('minutes'),
3600 => '1 '.__('hour'),
];
$form_items_advance['cache_expiration_row'] = [];
$form_items_advance['cache_expiration_row']['items'] = [
'static_graph',
'percentile_bar',
'percentile_item',
'module_graph',
'simple_value',
'datos',
'auto_sla_graph',
'group_item',
'bars_graph',
'donut_graph',
'color_cloud',
'service',
];
$form_items_advance['cache_expiration_row']['html'] = '<td align="left">';
$form_items_advance['cache_expiration_row']['html'] .= __('Cache expiration');
$form_items_advance['cache_expiration_row']['html'] .= '</td>';
$form_items_advance['cache_expiration_row']['html'] .= '<td align="left">';
$form_items_advance['cache_expiration_row']['html'] .= html_print_extended_select_for_time(
'cache_expiration',
$config['vc_default_cache_expiration'],
'',
__('No cache'),
0,
false,
true,
false,
true,
'',
false,
$intervals
);
$form_items_advance['cache_expiration_row']['html'] .= '</td>';
}
$form_items_advance['cache_expiration_row'] = [];
$form_items_advance['cache_expiration_row']['items'] = [
'static_graph',
'percentile_bar',
'percentile_item',
'module_graph',
'simple_value',
'datos',
'auto_sla_graph',
'group_item',
'bars_graph',
'donut_graph',
'color_cloud',
'service',
];
$form_items_advance['cache_expiration_row']['html'] = '<td align="left">';
$form_items_advance['cache_expiration_row']['html'] .= __('Cache expiration');
$form_items_advance['cache_expiration_row']['html'] .= '</td>';
$form_items_advance['cache_expiration_row']['html'] .= '<td align="left">';
$form_items_advance['cache_expiration_row']['html'] .= html_print_extended_select_for_time(
'cache_expiration',
$config['vc_default_cache_expiration'],
'',
__('No cache'),
0,
false,
true,
false,
true,
'',
false,
$intervals
);
$form_items_advance['cache_expiration_row']['html'] .= '</td>';
// Insert and modify before the buttons to create or update.
if (enterprise_installed()) {
@ -1454,12 +1452,9 @@ function visual_map_editor_print_toolbox()
visual_map_print_button_editor('box_item', __('Box'), 'left', false, 'box_item', true);
visual_map_print_button_editor('line_item', __('Line'), 'left', false, 'line_item', true);
visual_map_print_button_editor('color_cloud', __('Color cloud'), 'left', false, 'color_cloud_min', true);
if (isset($config['legacy_vc']) === false
|| (bool) $config['legacy_vc'] === false
) {
// Applies only on modern VC.
visual_map_print_button_editor('network_link', __('Network link'), 'left', false, 'network_link_min', true);
}
// Applies only on modern VC.
visual_map_print_button_editor('network_link', __('Network link'), 'left', false, 'network_link_min', true);
if (defined('METACONSOLE')) {
echo '<a href="javascript:" class="tip"><img src="'.$config['homeurl_static'].'/images/tip.png" data-title="The data displayed in editor mode is not real" data-use_title_for_force_title="1"

View File

@ -259,7 +259,7 @@ function flot_area_graph(
$return .= html_print_input_hidden(
'line_width_graph',
$config['custom_graph_width'],
(empty($params['line_width']) === true) ? $config['custom_graph_width'] : $params['line_width'],
true
);
$return .= "<div id='timestamp_$graph_id'

View File

@ -0,0 +1,378 @@
var dt = dt;
var config = config;
var datacolumns = [];
var datacolumnsTemp = [];
dt.datacolumns.forEach(column => {
if (column === null) return;
if (typeof column !== "string") {
datacolumnsTemp = { data: column.text, className: column.class };
datacolumns.push(datacolumnsTemp);
} else {
datacolumnsTemp = { data: column, className: "no-class" };
datacolumns.push(datacolumnsTemp);
}
});
var paginationClass = "pandora_pagination";
if (typeof dt.pagination_class !== "undefined") {
paginationClass = dt.pagination_class;
}
var processing = "";
if (typeof dt.processing === "undefined") {
processing = dt.processing;
}
var ajaxReturn = "";
var ajaxReturnFunction = "";
if (
typeof dt.ajax_return_operation !== "undefined" &&
dt.ajax_return_operation !== "" &&
typeof dt.ajax_return_operation_function !== "undefined" &&
dt.ajax_return_operation_function !== ""
) {
ajaxReturn = dt.ajax_return_operation;
ajaxReturnFunction = dt.ajax_return_operation_function;
}
var serverSide = true;
if (typeof dt.data_element !== "undefined") {
serverSide = false;
}
var paging = true;
if (typeof dt.paging !== "undefined") {
paging = dt.paging;
}
var pageLength = parseInt(dt.default_pagination);
var searching = false;
if (typeof dt.searching !== "undefined" && dt.searching === true) {
searching = dt.searching;
}
var dom = "plfrtiB";
if (typeof dt.dom_elements !== "undefined") {
dom = dt.dom_elements;
}
var lengthMenu = [
[pageLength, 5, 10, 20, 100, 200, 500, 1000, -1],
[pageLength, 5, 10, 20, 100, 200, 500, 1000, "All"]
];
if (typeof dt.pagination_options !== "undefined") {
lengthMenu = dt.pagination_options;
}
var ordering = true;
if (typeof dt.ordering !== "undefined" && dt.ordering === false) {
ordering = dt.ordering;
}
var order = [[0, "asc"]];
if (typeof dt.order !== "undefined") {
order = [[dt.order.order, dt.order.direction]];
}
var zeroRecords = "";
if (typeof dt.zeroRecords !== "undefined") {
zeroRecords = `${dt.zeroRecords}`;
}
var emptyTable = "";
if (typeof dt.emptyTable !== "undefined") {
emptyTable = `${dt.emptyTable}`;
}
var no_sortable_columns = [];
if (typeof dt.no_sortable_columns !== "undefined") {
no_sortable_columns = Object.values(dt.no_sortable_columns);
}
var columnDefs = [];
if (typeof dt.columnDefs === "undefined") {
columnDefs = [
{ className: "no-class", targets: "_all" },
{ bSortable: false, targets: no_sortable_columns }
];
} else {
columnDefs = dt.columnDefs;
}
var csvClassName = "csv-button";
if (dt.mini_csv === true) {
csvClassName = "mini-csv-button";
}
var csvFieldSeparator = ";";
if (typeof dt.csv_field_separator !== "undefined") {
csvFieldSeparator = dt.csv_field_separator;
}
var csvHeader = true;
if (dt.csv_header === false) {
csvHeader = false;
}
var csvExcludeLast = "";
if (dt.csv_exclude_latest === true) {
csvExcludeLast = "th:not(:last-child)";
}
var ajaxData = "";
if (typeof dt.ajax_data !== "undefined") {
ajaxData = dt.ajax_data;
}
$(document).ready(function() {
function checkPages() {
if (dt_table.page.info().pages > 1) {
$(
"div.pagination-child-div > .dataTables_paginate.paging_simple_numbers"
).show();
$(`#${dt.id}_paginate`).show();
} else {
$(
"div.pagination-child-div > .dataTables_paginate.paging_simple_numbers"
).hide();
$(`#${dt.id}_paginate`).hide();
}
}
function moveElementsToActionButtons() {
$(".action_buttons_right_content").html(
'<div class="pagination-child-div"></div>'
);
$(".pagination-child-div").append(
$(`#${dt.id}_wrapper > .dataTables_paginate.paging_simple_numbers`).attr(
"style",
"margin-right: 10px;"
)
);
$(".pagination-child-div").append(
$(`#${dt.id}_wrapper > .dataTables_length`)
);
$(".pagination-child-div").append($(`#${dt.id}_wrapper > .dt-buttons`));
$(".pagination-child-div").append(
$(`#${dt.id}_wrapper > .dataTables_filter`)
);
}
$.fn.dataTable.ext.errMode = "none";
$.fn.dataTable.ext.classes.sPageButton = paginationClass;
if (dt.mini_pagination === true) {
$.fn.dataTable.ext.classes.sPageButton = `${paginationClass} mini-pandora-pagination`;
}
var settings_datatable = {
processing: true,
responsive: true,
serverSide,
paging,
pageLength,
searching,
dom,
lengthMenu,
ordering,
order,
columns: eval(datacolumns),
columnDefs,
language: {
url: dt.language,
processing,
zeroRecords,
emptyTable
},
buttons:
dt.csv == 1
? [
{
extend: "csv",
className: csvClassName,
text: dt.csvTextInfo,
titleAttr: dt.csvTextInfo,
title: dt.csvFileTitle,
fieldSeparator: csvFieldSeparator,
header: csvHeader,
action: function(e, dt, node, config) {
blockResubmit(node);
// Call the default csvHtml5 action method to create the CSV file
$.fn.dataTable.ext.buttons.csvHtml5.action.call(
this,
e,
dt,
node,
config
);
},
exportOptions: {
modifier: {
// DataTables core
order: "current",
page: "All",
search: "applied"
},
columns: csvExcludeLast
}
}
]
: [],
initComplete: function(settings, json) {
moveElementsToActionButtons();
checkPages();
$(`div#${dt.id}-spinner`).hide();
},
drawCallback: function(settings) {
if ($(`#${dt.id} tr td`).length == 1) {
$(`.datatable-msg-info-${dt.id}`)
.removeClass("invisible_important")
.show();
$(`table#${dt.id}`).hide();
$("div.pagination-child-div").hide();
$("div.dataTables_info").hide();
$(`#${dt.id}_wrapper`).hide();
$(`.action_buttons_right_content .pagination-child-div`).hide();
} else {
$(`.datatable-msg-info-${dt.id}`).hide();
$(`table#${dt.id}`).show();
$("div.pagination-child-div").show();
$("div.dataTables_info").show();
$(`#${dt.id}_wrapper`).show();
if (typeof dt.drawCallback !== "undefined") {
eval(dt.drawCallback);
}
}
$(`div#${dt.id}-spinner`).hide();
checkPages();
}
};
var ajaxOrData = {};
if (typeof dt.data_element == "undefined") {
ajaxOrData = {
ajax: {
url: dt.ajax_url_full,
type: "POST",
dataSrc: function(json) {
if ($(`#${dt.form_id}_search_bt`) != undefined) {
$(`#${dt.form_id}_loading`).remove();
}
if (json.error) {
console.error(json.error);
$(`#error-${dt.id}`).html(json.error);
$(`#error-${dt.id}`)
.dialog({
title: "Filter failed",
width: 630,
resizable: true,
draggable: true,
modal: false,
closeOnEscape: true,
buttons: {
Ok: function() {
$(this).dialog("close");
}
}
})
.parent()
.addClass("ui-state-error");
} else {
if (json.ajaxReturn !== "undefined") {
eval(`${ajaxReturnFunction}(${json.ajaxReturn})`);
}
if (typeof dt.ajax_postprocess !== "undefined") {
if (json.data) {
json.data.forEach(function(item) {
eval(dt.ajax_postprocess);
});
} else {
json.data = {};
}
}
return json.data;
}
},
data: function(data) {
$(`div#${dt.id}-spinner`).show();
if ($(`#button-${dt.form_id}_search_bt`) != undefined) {
var loading = `<img src="images/spinner.gif" id="${dt.form_id}_loading" class="loading-search-datatables-button" />`;
$(`#button-${dt.form_id}_search_bt`)
.parent()
.append(loading);
}
var inputs = $(`#${dt.form_id} :input`);
var values = {};
inputs.each(function() {
values[this.name] = $(this).val();
});
$.extend(data, ajaxData);
$.extend(data, {
filter: values,
page: dt.ajax_url
});
return data;
}
}
};
} else {
ajaxOrData = { data: dt.data_element };
}
$.extend(settings_datatable, ajaxOrData);
var dt_table = $(`#${dt.table_id}`).DataTable(settings_datatable);
$(`#button-${dt.form_id}_search_bt`).click(function() {
dt_table.draw().page(0);
});
if (typeof dt.caption !== "undefined" && dt.caption !== "") {
$(`#${dt.table_id}`).append(`<caption>${dt.caption}</caption>`);
$(".datatables_thead_tr").css("height", 0);
}
$(function() {
$(document).on("init.dt", function(ev, settings) {
if (dt.mini_search === true) {
$(`#${dt.id}_filter > label > input`).addClass("mini-search-input");
}
$("div.dataTables_length").show();
$("div.dataTables_filter").show();
$("div.dt-buttons").show();
if (dt_table.page.info().pages === 0) {
$(`.action_buttons_right_content .pagination-child-div`).hide();
}
if (dt_table.page.info().pages === 1) {
$(`div.pagination-child-div > #${dt.table_id}_paginate`).hide();
} else {
$(`div.pagination-child-div > #${dt.table_id}_paginate`).show();
}
});
});
});
$(function() {
$(document).on("preInit.dt", function(ev, settings) {
$(`#${dt.id}_wrapper div.dataTables_length`).hide();
$(`#${dt.id}_wrapper div.dataTables_filter`).hide();
$(`#${dt.id}_wrapper div.dt-buttons`).hide();
});
});

View File

@ -0,0 +1,25 @@
/* global $, interval */
$(document).ready(() => {
if (interval === "0") {
setTimeout(() => {
$("#mode_interval")
.parent()
.find("[id^='interval']")
.hide();
}, 100);
}
});
function changeModeInterval(e) {
if ($(e).val() === "manual") {
$(e)
.parent()
.find("[id^='interval']")
.hide();
} else {
var interval = $(e)
.parent()
.find("div[id^='interval']")[0];
$(interval).show();
}
}

View File

@ -6,7 +6,6 @@
"infoThousands": ",",
"lengthMenu": "Show _MENU_ entries",
"loadingRecords": "Loading...",
"processing": "Processing...",
"search": "Search:",
"zeroRecords": "No matching records found",
"thousands": ",",

View File

@ -0,0 +1,72 @@
/* globals $, page, url, textsToTranslate, confirmDialog*/
$(document).ready(function() {
function loading(status) {
if (status) {
$(".spinner-fixed").show();
$("#button-upload_button").attr("disabled", "true");
} else {
$(".spinner-fixed").hide();
$("#button-upload_button").removeAttr("disabled");
}
}
$("#uploadExtension").submit(function(e) {
e.preventDefault();
var formData = new FormData(this);
formData.append("page", page);
formData.append("method", "validateIniName");
loading(true);
$.ajax({
method: "POST",
url: url,
data: formData,
processData: false,
contentType: false,
success: function(data) {
loading(false);
data = JSON.parse(data);
if (data.success) {
if (data.warning) {
confirmDialog({
title: textsToTranslate["Warning"],
message: data.message,
strOKButton: textsToTranslate["Confirm"],
strCancelButton: textsToTranslate["Cancel"],
onAccept: function() {
loading(true);
$("#uploadExtension")[0].submit();
},
onDeny: function() {
return false;
}
});
} else {
$("#uploadExtension")[0].submit();
}
} else {
confirmDialog({
title: textsToTranslate["Error"],
message: data.message,
ok: textsToTranslate["Ok"],
hideCancelButton: true,
onAccept: function() {
return false;
}
});
}
},
error: function() {
loading(false);
confirmDialog({
title: textsToTranslate["Error"],
message: textsToTranslate["Failed to upload extension"],
ok: textsToTranslate["Ok"],
hideCancelButton: true,
onAccept: function() {
return false;
}
});
}
});
});
});

View File

@ -55,7 +55,7 @@ function show_event_dialog(event, dialog_page) {
title: event.evento,
resizable: true,
draggable: true,
modal: true,
modal: false,
minWidth: 875,
minHeight: 600,
close: function() {
@ -484,7 +484,7 @@ function event_comment(current_event) {
success: function() {
$("#button-comment_button").removeAttr("disabled");
$("#response_loading").hide();
$("#link_comments").click();
$("#button-filter_comments_button").click();
}
});
@ -943,6 +943,185 @@ function process_buffers(buffers) {
}
}
function openSoundEventsDialogModal(settings, dialog_parameters, reload) {
let mode = $("#hidden-mode_alert").val();
if (reload != false) {
if (mode == 0) {
let filter_id = $("#filter_id option:selected").val();
let interval = $("#interval option:selected").val();
let time_sound = $("#time_sound option:selected").val();
let sound_id = $("#sound_id option:selected").val();
let parameters = {
filter_id: filter_id,
interval: interval,
time_sound: time_sound,
sound_id: sound_id,
mode: mode
};
parameters = JSON.stringify(parameters);
parameters = btoa(parameters);
let url =
window.location + "&settings=" + settings + "&parameters=" + parameters;
$(location).attr("href", url);
} else {
let url = window.location + "&settings=" + settings;
$(location).attr("href", url);
}
} else {
openSoundEventsDialog(settings, dialog_parameters, reload);
}
}
function openSoundEventsDialog(settings, dialog_parameters, reload) {
let encode_settings = settings;
if (reload == undefined) {
reload = true;
}
if (dialog_parameters != undefined) {
dialog_parameters = JSON.parse(atob(dialog_parameters));
}
settings = JSON.parse(atob(settings));
// Check modal exists and is open.
if (
$("#modal-sound").hasClass("ui-dialog-content") &&
$("#modal-sound").dialog("isOpen")
) {
$(".ui-dialog-titlebar-minimize").trigger("click");
return;
}
//Modify button
$("#minimize_arrow_event_sound").removeClass("arrow_menu_up");
$("#minimize_arrow_event_sound").addClass("arrow_menu_down");
$("#minimize_arrow_event_sound").show();
// Initialize modal.
$("#modal-sound")
.empty()
.dialog({
title: settings.title,
resizable: false,
modal: false,
width: 600,
height: 600,
open: function() {
$.ajax({
method: "post",
url: settings.url,
data: {
page: settings.page,
drawConsoleSound: 1
},
dataType: "html",
success: function(data) {
$("#modal-sound").append(data);
$("#tabs-sound-modal").tabs({
disabled: [1]
});
// Test sound.
$("#button-melody_sound").click(function() {
var sound = false;
if ($("#id_sound_event").length == 0) {
sound = true;
}
test_sound_button(sound, settings.urlSound);
});
// Play Stop.
$("#button-start-search").click(function() {
if (reload == true) {
openSoundEventsDialogModal(encode_settings, 0, reload);
}
var mode = $("#hidden-mode_alert").val();
var action = false;
if (mode == 0) {
action = true;
}
if ($("#button-start-search").hasClass("play")) {
$("#modal-sound").css({
height: "500px"
});
$("#modal-sound")
.parent()
.css({
height: "550px"
});
} else {
$("#modal-sound").css({
height: "450px"
});
$("#modal-sound")
.parent()
.css({
height: "500px"
});
}
action_events_sound(action, settings);
});
if (reload == false && dialog_parameters != undefined) {
if ($("#button-start-search").hasClass("play")) {
$("#filter_id").val(dialog_parameters["filter_id"]);
$("#interval").val(dialog_parameters["interval"]);
$("#time_sound").val(dialog_parameters["time_sound"]);
$("#sound_id").val(dialog_parameters["sound_id"]);
$("#filter_id").trigger("change");
$("#interval").trigger("change");
$("#time_sound").trigger("change");
$("#sound_id").trigger("change");
$("#button-start-search").trigger("click");
}
}
// Silence Alert.
$("#button-no-alerts").click(function() {
if ($("#button-no-alerts").hasClass("silence-alerts") === true) {
// Remove audio.
remove_audio();
// Clean events.
$("#tabs-sound-modal .elements-discovered-alerts ul").empty();
$("#tabs-sound-modal .empty-discovered-alerts").removeClass(
"invisible_important"
);
// Clean progress.
$("#progressbar_time").empty();
// Change img button.
$("#button-no-alerts")
.removeClass("silence-alerts")
.addClass("alerts");
// Change value button.
$("#button-no-alerts").val(settings.noAlert);
$("#button-no-alerts > span").text(settings.noAlert);
// Background button.
$(".container-button-alert").removeClass("fired");
// New progress.
listen_event_sound(settings);
}
});
},
error: function(error) {
console.error(error);
}
});
},
close: function() {
$("#minimize_arrow_event_sound").hide();
remove_audio();
$(this).dialog("destroy");
}
})
.show();
}
function openSoundEventModal(settings) {
if ($("#hidden-metaconsole_activated").val() === "1") {
var win = open(
@ -966,6 +1145,7 @@ function openSoundEventModal(settings) {
}
settings = JSON.parse(atob(settings));
// Check modal exists and is open.
if (
$("#modal-sound").hasClass("ui-dialog-content") &&
@ -1045,10 +1225,12 @@ function add_audio(urlSound) {
sound +
"' autoplay='true' hidden='true' loop='false'>"
);
$("#button-sound_events_button").addClass("animation-blink");
}
function remove_audio() {
$(".actions-sound-modal audio").remove();
$("#button-sound_events_button").removeClass("animation-blink");
}
function listen_event_sound(settings) {
@ -1064,6 +1246,37 @@ function listen_event_sound(settings) {
}
function check_event_sound(settings) {
// Update elements time.
$(".elements-discovered-alerts ul li").each(function() {
let element_time = $(this)
.children(".li-hidden")
.val();
let obj_time = new Date(element_time);
let current_dt = new Date();
let timestamp = current_dt.getTime() - obj_time.getTime();
timestamp = timestamp / 1000;
if (timestamp <= 60) {
timestamp = Math.round(timestamp) + " seconds";
} else if (timestamp <= 3600) {
let minute = Math.floor((timestamp / 60) % 60);
minute = minute < 10 ? "0" + minute : minute;
let second = Math.floor(timestamp % 60);
second = second < 10 ? "0" + second : second;
timestamp = minute + " minutes " + second + " seconds";
} else {
let hour = Math.floor(timestamp / 3600);
hour = hour < 10 ? "0" + hour : hour;
let minute = Math.floor((timestamp / 60) % 60);
minute = minute < 10 ? "0" + minute : minute;
let second = Math.round(timestamp % 60);
second = second < 10 ? "0" + second : second;
timestamp = hour + " hours " + minute + " minutes " + second + " seconds";
}
$(this)
.children(".li-time")
.children("span")
.html(timestamp);
});
jQuery.post(
settings.url,
{
@ -1117,7 +1330,13 @@ function check_event_sound(settings) {
"beforeend",
'<div class="li-time">' + element.timestamp + "</div>"
);
$("#tabs-sound-modal .elements-discovered-alerts ul").append(li);
li.insertAdjacentHTML(
"beforeend",
'<input type="hidden" value="' +
element.event_timestamp +
'" class="li-hidden"/>'
);
$("#tabs-sound-modal .elements-discovered-alerts ul").prepend(li);
});
// -100 delay sound.
@ -1229,3 +1448,285 @@ function removeElement(name_select, id_modal) {
.append(option);
});
}
function get_table_events_tabs(event, filter) {
var custom_event_view_hr = $("#hidden-comments_events_max_hours_old").val();
$.post({
url: "ajax.php",
data: {
page: "include/ajax/events",
get_comments: 1,
event: event,
filter: filter,
custom_event_view_hr: custom_event_view_hr
},
dataType: "html",
success: function(data) {
$("#extended_event_comments_page").empty();
$("#extended_event_comments_page").html(data);
}
});
}
// Define the minimize button functionality;
function hidden_dialog(dialog) {
setTimeout(function() {
$("#modal-sound").css("visibility", "hidden");
dialog.css("z-index", "-1");
}, 200);
}
function show_dialog(dialog) {
setTimeout(function() {
$("#modal-sound").css("visibility", "visible");
dialog.css("z-index", "1115");
}, 50);
}
/*
#############################################################################
##
## + Compacts the Modal Sound Dialog to a tiny toolbar
## + Dynamically adds a button which can reduce/reapply the dialog size
## + If alarm gets raised & minimized, the dialog window maximizes and the toolbar flashes red for 10 seconds.
## - Works fine until a link/action gets clicked. The Toolbar shifts to the bottom of the Modal-Sound Dialog.
##
#############################################################################
*/
$(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
const requestBody = ajaxOptions.data;
try {
if (requestBody && requestBody.includes("drawConsoleSound=1")) {
console.log(
"AJAX request sent with drawConsoleSound=1:",
ajaxOptions.url
);
// Find the dialog element by the aria-describedby attribute
var dialog = $('[aria-describedby="modal-sound"]');
// Select the close button within the dialog
var closeButton = dialog.find(".ui-dialog-titlebar-close");
// Add the minimize button before the close button
var minimizeButton = $("<button>", {
class:
"ui-corner-all ui-widget ui-button-icon-only ui-window-minimize ui-dialog-titlebar-minimize",
type: "button",
title: "Minimize",
style: "float: right;margin-right: 1.5em;"
}).insertBefore(closeButton);
// Add the minimize icon to the minimize button
$("<span>", {
class: "ui-button-icon ui-icon ui-icon-minusthick",
style: "background-color: #fff;"
}).appendTo(minimizeButton);
$("<span>", {
class: "ui-button-icon-space"
})
.html(" ")
.appendTo(minimizeButton);
// Add the disengage button before the minimize button
var disengageButton = $("<button>", {
class:
"ui-corner-all ui-widget ui-button-icon-only ui-dialog-titlebar-disengage",
type: "button",
title: "Disengage",
style: "float: right;margin-right: 0.5em; position:relative;"
}).insertBefore(minimizeButton);
// Add the disengage icon to the disengage button
$("<span>", {
class: "ui-button-icon ui-icon ui-icon-circle-triangle-n",
style: "background-color: #fff;"
}).appendTo(disengageButton);
$("<span>", {
class: "ui-button-icon-space"
})
.html(" ")
.appendTo(disengageButton);
minimizeButton.click(function(e) {
console.log("here");
if ($("#minimize_arrow_event_sound").hasClass("arrow_menu_up")) {
console.log("arrow_menu_up");
$("#minimize_arrow_event_sound").removeClass("arrow_menu_up");
$("#minimize_arrow_event_sound").addClass("arrow_menu_down");
} else if (
$("#minimize_arrow_event_sound").hasClass("arrow_menu_down")
) {
console.log("arrow_menu_down");
$("#minimize_arrow_event_sound").removeClass("arrow_menu_down");
$("#minimize_arrow_event_sound").addClass("arrow_menu_up");
}
if (!dialog.data("isMinimized")) {
$(".ui-widget-overlay").hide();
console.log("Minimize Window");
dialog.data("originalPos", dialog.position());
dialog.data("originalSize", {
width: dialog.width(),
height: dialog.height()
});
dialog.data("isMinimized", true);
dialog.animate(
{
height: "40px",
top: 0,
top: $(window).height() - 100
},
200,
"linear",
hidden_dialog(dialog)
);
dialog.css({ height: "" });
dialog.animate(
{
height: dialog.data("originalSize").height + "px",
top: dialog.data("originalPos").top + "px"
},
5
);
//dialog.find(".ui-dialog-content").hide();
} else {
console.log("Restore Window");
$(".ui-widget-overlay").show();
//dialog.find(".ui-dialog-content").show();
dialog.data("isMinimized", false);
dialog.animate(
{
height: "40px",
top: 0,
top: $(window).height() - 100
},
5
);
dialog.animate(
{
height: dialog.data("originalSize").height + "px",
top: dialog.data("originalPos").top + "px"
},
200,
"linear",
show_dialog(dialog)
);
}
});
disengageButton.click(function() {
$(".ui-dialog-titlebar-close").trigger("click");
$("#button-sound_events_button_hidden").trigger("click");
});
// Listener to check if the dialog content contains <li> elements
var dialogContent = dialog.find(".ui-dialog-content");
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
var addedNodes = mutation.addedNodes;
for (var i = 0; i < addedNodes.length; i++) {
if (addedNodes[i].nodeName.toLowerCase() === "li") {
console.log("The dialog content contains an <li> tag.");
break;
}
}
});
});
// Configure and start observing the dialog content for changes
var config = { childList: true, subtree: true };
observer.observe(dialogContent[0], config);
}
} catch (e) {
console.log(e);
}
});
/*
#############################################################################
##
## + Compacts the Modal Sound Dialog popup and removes the widget-overlay
##
##
#############################################################################
*/
$(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
const requestBody = ajaxOptions.data;
try {
if (requestBody && requestBody.includes("drawConsoleSound=1")) {
console.log(
"AJAX request sent with drawConsoleSound=1:",
ajaxOptions.url
);
// Find the dialog element by the aria-describedby attribute
var dialog = $('[aria-describedby="modal-sound"]');
dialog.css({
// "backgroundColor":"black",
// "color":"white"
});
// Set CSS properties for #modal-sound
$("#modal-sound").css({
height: "450px",
margin: "0px"
});
// Set CSS properties for #tabs-sound-modal
$("#tabs-sound-modal").css({
"margin-top": "0px",
padding: "0px",
"font-weight": "bolder"
});
// Set CSS properties for #actions-sound-modal
$("#actions-sound-modal").css({
"margin-bottom": "0px"
});
// Hide the overlay with specific class and z-index
$('.ui-widget-overlay.ui-front[style="z-index: 10000;"]').css(
"display",
"none"
);
// Handle the 'change' event for #modal-sound, simply to compact the size of the img "No alerts discovered"
// An image should always have a size assigned!!!
$("#modal-sound").on("change", function() {
// Find the image within the specific div
var image = $(this).find(
'img.invert_filter.forced_title[data-title="No alerts discovered"][alt="No alerts discovered"]'
);
// Set the desired width and height
var width = 48;
var height = 48;
// Resize the image
image.width(width);
image.height(height);
});
}
} catch (e) {
console.log(e);
}
});
function loadModal() {
const urlSearch = window.location.search;
const urlParams = new URLSearchParams(urlSearch);
if (urlParams.has("settings")) {
let modal_parameters = "";
if (urlParams.has("parameters")) {
modal_parameters = urlParams.get("parameters");
}
let settings = urlParams.get("settings");
openSoundEventsDialogModal(settings, modal_parameters, false);
}
}
window.onload = loadModal;

View File

@ -893,6 +893,17 @@
var utcMillis = typeof dt === "number" ? dt : new Date(dt).getTime();
var t = tz;
var zoneList = _this.zones[t];
if (typeof zoneList === "undefined") {
zoneList = [
[-53.46666666666666, "-", "LMT", -2422051200000],
[-60, "C-Eur", "CE%sT", -776556000000],
[-60, "SovietZone", "CE%sT", -725932800000],
[-60, "Germany", "CE%sT", 347068800000],
[-60, "EU", "CE%sT", null]
];
}
// Follow links to get to an actual zone
while (typeof zoneList === "string") {
t = zoneList;

View File

@ -297,6 +297,14 @@ class BasicChart extends Widget
$values['label'] = $decoder['label'];
}
if (isset($decoder['type_graph']) === true) {
$values['type_graph'] = $decoder['type_graph'];
}
if (isset($decoder['line_width']) === true) {
$values['line_width'] = $decoder['line_width'];
}
return $values;
}
@ -477,6 +485,22 @@ class BasicChart extends Widget
],
];
$types_graph = [
'area' => __('Area'),
'line' => __('Wire'),
];
$inputs['inputs']['row1'][] = [
'label' => __('Type graph'),
'arguments' => [
'type' => 'select',
'fields' => $types_graph,
'name' => 'type_graph',
'selected' => $values['type_graph'],
'return' => true,
],
];
$inputs['inputs']['row2'][] = [
'label' => __('Show Value'),
'arguments' => [
@ -520,6 +544,18 @@ class BasicChart extends Widget
],
];
$inputs['inputs']['row2'][] = [
'label' => __('Graph line size'),
'arguments' => [
'name' => 'line_width',
'type' => 'number',
'value' => (empty($values['line_width']) === true) ? 3 : $values['line_width'],
'return' => true,
'min' => 2,
'max' => 10,
],
];
return $inputs;
}
@ -546,6 +582,8 @@ class BasicChart extends Widget
$values['colorChart'] = \get_parameter('colorChart');
$values['formatData'] = \get_parameter_switch('formatData');
$values['label'] = \get_parameter('label');
$values['type_graph'] = \get_parameter('type_graph');
$values['line_width'] = \get_parameter('line_width');
return $values;
}
@ -606,6 +644,8 @@ class BasicChart extends Widget
'title' => $module_name,
'unit' => $units_name,
'only_image' => false,
'type_graph' => $this->values['type_graph'],
'line_width' => (empty($this->values['line_width']) === true) ? 3 : $this->values['line_width'],
'menu' => false,
'vconsole' => true,
'return_img_base_64' => false,

View File

@ -520,7 +520,7 @@ class DataMatrix extends Widget
[
'id' => $tableId,
'class' => 'info_table',
'style' => 'width: 99%',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'include/ajax/module',

View File

@ -438,7 +438,7 @@ class ModulesByStatus extends Widget
[
'id' => $tableId,
'class' => 'info_table align-left-important',
'style' => 'width: 99%',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'include/ajax/module',

View File

@ -528,7 +528,7 @@ class EventsListWidget extends Widget
$values['eventType'] = \get_parameter('eventType', 0);
$values['maxHours'] = \get_parameter('maxHours', 8);
$values['limit'] = \get_parameter('limit', 20);
$values['limit'] = (int) \get_parameter('limit', 20);
$values['eventStatus'] = \get_parameter('eventStatus', -1);
$values['severity'] = \get_parameter_switch('severity', -1);
$values['groupId'] = \get_parameter_switch('groupId', []);
@ -708,6 +708,10 @@ class EventsListWidget extends Widget
$hash = get_parameter('auth_hash', '');
$id_user = get_parameter('id_user', '');
if ($this->values['limit'] === 'null') {
$this->values['limit'] = $config['block_size'];
}
// Print datatable.
$output .= ui_print_datatable(
[

View File

@ -395,7 +395,9 @@ class SystemGroupStatusWidget extends Widget
$user_groups = users_get_groups(false, 'AR', $return_all_group);
$selected_groups = explode(',', $this->values['groupId'][0]);
$all_group_selected = false;
if (in_array(0, $selected_groups) === true) {
$all_group_selected = true;
$selected_groups = [];
foreach (groups_get_all() as $key => $name_group) {
$selected_groups[] = groups_get_id($name_group);
@ -480,7 +482,12 @@ class SystemGroupStatusWidget extends Widget
}
}
$this->values['groupId'] = $selected_groups;
if ($all_group_selected === true && $this->values['groupRecursion'] === true) {
$this->values['groupId'] = array_keys($result_groups);
} else {
$this->values['groupId'] = $selected_groups;
}
$this->values['status'] = explode(',', $this->values['status'][0]);
$style = 'font-size: 1.5em; font-weight: bolder;text-align: center;';

View File

@ -59,6 +59,7 @@ class StreamReader {
class StringReader {
var $_pos;
var $_str;
var $is_overloaded;
function __construct($str='') {
$this->_str = $str;

View File

@ -8,7 +8,7 @@
text-align: center;
font-size: 1.5em;
font-weight: bolder;
color: #000;
color: var(--text-color);
background: var(--secondary-color);
padding: 8px;
}
@ -47,16 +47,36 @@
font-size: 1.2em;
}
.title-self-monitoring {
border-top: 1px solid var(--border-color);
border-right: 1px solid var(--border-color);
border-left: 1px solid var(--border-color);
border-top-left-radius: 8px;
border-top-right-radius: 8px;
}
.container-self-monitoring {
display: flex;
flex-direction: row;
flex-wrap: wrap;
background-color: var(--secondary-color);
border-right: 1px solid var(--border-color);
border-bottom: 1px solid var(--border-color);
border-left: 1px solid var(--border-color);
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
padding-bottom: 15px;
}
.element-self-monitoring {
flex: 2 1 600px;
}
.element-self-monitoring > img[data-title="No data"] {
margin-top: 5%;
margin-left: 20%;
}
.footer-self-monitoring {
margin: 30px;
font-style: italic;

View File

@ -4,14 +4,13 @@
ul.bigbuttonlist {
min-height: 200px;
display: flex;
flex-wrap: wrap;
}
li.discovery {
display: inline-block;
float: left;
width: 250px;
margin: 15px;
padding-bottom: 50px;
}
li.discovery > a {
@ -37,8 +36,7 @@ div.data_container {
width: 100%;
height: 100%;
text-align: center;
padding-top: 30px;
padding-bottom: 30px;
padding: 6px;
}
div.data_container:hover {

View File

@ -558,3 +558,10 @@ div#sunburst > svg {
width: 750px;
height: 750px;
}
div.container-filter-buttons {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}

View File

@ -365,3 +365,7 @@ form#modal_form_feedback > ul > li > textarea {
form#modal_form_feedback > ul > li:not(:first-child) > label {
margin-top: 20px !important;
}
table.dataTable {
box-sizing: border-box !important;
}

View File

@ -45,16 +45,41 @@
font-size: 11pt;
top: 2px;
}
.ui-dialog .ui-dialog-titlebar-close {
.ui-dialog .ui-dialog-titlebar-minimize {
position: absolute;
right: 1em;
right: 1.5em;
width: 21px;
margin: 0px 0 0 0;
padding: 1px;
height: 20px;
bottom: 30%;
top: 20%;
top: 2em;
background-color: #fff !important;
}
.ui-dialog .ui-dialog-titlebar-minimize:hover {
cursor: pointer;
}
.ui-dialog .ui-dialog-titlebar-disengage {
position: relative;
right: 1.5em;
width: 21px;
margin: 0px 0 0 0;
padding: 1px;
height: 20px;
bottom: 30%;
background-color: #fff !important;
-ms-transform: scale(1.2);
-webkit-transform: scale(1.2);
transform: scale(1.2);
}
.ui-dialog .ui-dialog-titlebar-disengage:hover {
cursor: pointer;
}
.ui-dialog .ui-dialog-content {
position: relative;
border: 0;

View File

@ -351,6 +351,7 @@ span.span1 {
font-family: "lato-bolder";
color: #fff;
margin-right: 30px;
text-shadow: 2px 2px #000;
}
span.span2 {
@ -361,6 +362,7 @@ span.span2 {
font-family: "lato-bolder";
color: #fff;
margin-right: 30px;
text-shadow: 2px 2px #000;
}
div.img_banner_login img {

View File

@ -31,6 +31,8 @@
--primary-color: #14524f;
--secondary-color: #ffffff;
--input-border: #c0ccdc;
--border-color: #eee;
--text-color: #333;
}
/*
@ -2304,7 +2306,7 @@ div#main_pure {
position: static;
}
.ui-draggable {
.ui-draggable-handle {
cursor: move;
}
@ -4210,13 +4212,6 @@ div.simple_value > a > span.text p {
}
.modalokbutton {
transition-property: background-color, color;
transition-duration: 1s;
transition-timing-function: ease-out;
-webkit-transition-property: background-color, color;
-webkit-transition-duration: 1s;
-o-transition-property: background-color, color;
-o-transition-duration: 1s;
cursor: pointer;
text-align: center;
margin-right: 45px;
@ -4227,44 +4222,24 @@ div.simple_value > a > span.text p {
border-radius: 3px;
width: 90px;
height: 30px;
background-color: white;
border: 1px solid #82b92e;
background-color: var(--primary-color);
border: 1px solid var(--primary-color);
border-radius: 6px;
}
.modalokbuttontext {
transition-property: background-color, color;
transition-duration: 1s;
transition-timing-function: ease-out;
-webkit-transition-property: background-color, color;
-webkit-transition-duration: 1s;
-o-transition-property: background-color, color;
-o-transition-duration: 1s;
color: #82b92e;
color: #fff;
font-size: 10pt;
position: relative;
top: 6px;
}
.modalokbutton:hover {
transition-property: background-color, color;
transition-duration: 1s;
transition-timing-function: ease-out;
-webkit-transition-property: background-color, color;
-webkit-transition-duration: 1s;
-o-transition-property: background-color, color;
-o-transition-duration: 1s;
background-color: #82b92e;
background-color: var(--primary-color);
}
.modalokbutton:hover .modalokbuttontext {
transition-property: background-color, color;
transition-duration: 1s;
transition-timing-function: ease-out;
-webkit-transition-property: background-color, color;
-webkit-transition-duration: 1s;
-o-transition-property: background-color, color;
-o-transition-duration: 1s;
color: white;
color: #fff;
}
.modaldeletebutton {
@ -7623,6 +7598,10 @@ div.graph div.legend table {
padding-bottom: 10px !important;
}
.pdd_b_15px_important {
padding-bottom: 15px !important;
}
.pdd_b_20px {
padding-bottom: 20px;
}
@ -7701,6 +7680,10 @@ div.graph div.legend table {
padding-top: 15px;
}
.pdd_t_15px_important {
padding-top: 15px !important;
}
.pdd_t_20px {
padding-top: 20px;
}
@ -9037,8 +9020,7 @@ div.graph div.legend table {
}
.app_mssg {
position: absolute;
bottom: 1em;
margin: 1em;
clear: both;
color: #888;
}
@ -11666,14 +11648,14 @@ p.trademark-copyright {
}
.show-hide-pass {
position: relative;
right: 40px;
position: absolute;
right: 9px;
top: 4px;
border: 0;
outline: none;
margin: 0;
height: 30px;
width: 30px;
width: 40px;
cursor: pointer;
display: inline-block;
}
@ -11949,7 +11931,7 @@ span.help_icon_15px > img {
/* ==== Spinner ==== */
.spinner-fixed {
position: absolute;
left: 40%;
left: 45%;
top: 40%;
z-index: 1;
width: 100px;
@ -11959,6 +11941,7 @@ span.help_icon_15px > img {
animation: animate 1.2s linear infinite;
margin: auto;
margin-bottom: 40px;
text-align: initial;
}
.spinner-fixed span {
position: absolute;
@ -12341,3 +12324,117 @@ tr[id^="network_component-plugin-wmi-fields-dynamicMacroRow-"] input,
tr[id^="network_component-plugin-snmp-fields-dynamicMacroRow-"] input {
width: 100% !important;
}
.animation-blink {
-webkit-animation: glowing 1500ms infinite;
-moz-animation: glowing 1500ms infinite;
-o-animation: glowing 1500ms infinite;
animation: glowing 1500ms infinite;
background: #14524f !important;
border-color: #14524f !important;
}
@-webkit-keyframes glowing {
0% {
background: #14524f !important;
-webkit-box-shadow: 0 0 3px #14524f;
}
50% {
background: #1d7873 !important;
-webkit-box-shadow: 0 0 40px #1d7873;
}
100% {
background: #14524f !important;
-webkit-box-shadow: 0 0 3px #14524f;
}
}
@-moz-keyframes glowing {
0% {
background: #14524f !important;
-moz-box-shadow: 0 0 3px #14524f;
}
50% {
background: #1d7873 !important;
-moz-box-shadow: 0 0 40px #1d7873;
}
100% {
background: #14524f !important;
-moz-box-shadow: 0 0 3px #14524f;
}
}
@-o-keyframes glowing {
0% {
background: #14524f !important;
box-shadow: 0 0 3px #14524f;
}
50% {
background: #1d7873 !important;
box-shadow: 0 0 40px #1d7873;
}
100% {
background: #14524f !important;
box-shadow: 0 0 3px #14524f;
}
}
@keyframes glowing {
0% {
background: #14524f !important;
box-shadow: 0 0 3px #14524f;
}
50% {
background: #1d7873 !important;
box-shadow: 0 0 40px #1d7873;
}
100% {
background: #14524f !important;
box-shadow: 0 0 3px #14524f;
}
}
.actions-sound-modal .buttons-sound-modal button.play,
.actions-sound-modal .buttons-sound-modal input[type="button"].play {
background: url(../../images/play-white.png), transparent !important;
background-repeat: no-repeat !important;
background-position: 82px 14px !important;
color: #ffffff;
padding-left: 20px;
border: 0;
}
.actions-sound-modal .buttons-sound-modal div.play {
background: url(../../images/play-white.png), transparent !important;
background-repeat: no-repeat !important;
background-position: 20px 5px !important;
color: #ffffff !important;
padding-left: 20px !important;
border: 0 !important;
}
.actions-sound-modal .buttons-sound-modal button.stop,
.actions-sound-modal .buttons-sound-modal input[type="button"].stop {
background: url(../../images/stop.png), var(--primary-color);
background-repeat: no-repeat;
background-position: 82px 14px;
color: #ffffff;
padding-left: 20px;
border: 0;
}
.actions-sound-modal .buttons-sound-modal div.stop {
background: url(../../images/stop.png), transparent !important;
background-repeat: no-repeat !important;
background-position: 20px 5px !important;
color: #ffffff !important;
padding-left: 20px !important;
border: 0 !important;
}
.start-end-date-log-viewer {
display: flex;
flex-direction: row !important;
flex-wrap: nowrap;
justify-content: flex-start !important;
}

View File

@ -20,6 +20,13 @@ Description: The default Pandora FMS theme layout
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
:root {
/* --primary-color: #14524f; */
--secondary-color: #222;
--text-color: #fff;
/* --input-border: #c0ccdc; */
--border-color: #484848;
}
/* General styles */
body,

View File

@ -216,10 +216,10 @@ div.container-button-play > button#button-start-search {
.actions-sound-modal .buttons-sound-modal button.play,
.actions-sound-modal .buttons-sound-modal input[type="button"].play {
background: url(../../images/play-white.png), transparent;
background-repeat: no-repeat;
background-position: 82px 14px;
color: #ffffff;
background: url(../../images/play-white.png), transparent !important;
background-repeat: no-repeat !important;
background-position: 82px 14px !important;
color: #ffffff !important;
padding-left: 20px;
border: 0;
}

View File

@ -237,7 +237,8 @@
.table_action_buttons > img,
.table_action_buttons > button,
.table_action_buttons > form,
.table_action_buttons > div {
.table_action_buttons > div,
.table_action_buttons .action_button_hidden {
visibility: hidden;
}
.info_table > tbody > tr:hover {
@ -250,7 +251,8 @@
.info_table > tbody > tr:hover .table_action_buttons > img,
.info_table > tbody > tr:hover .table_action_buttons > button,
.info_table > tbody > tr:hover .table_action_buttons > form,
.info_table > tbody > tr:hover .table_action_buttons > div {
.info_table > tbody > tr:hover .table_action_buttons > div,
.info_table > tbody > tr:hover .table_action_buttons .action_button_hidden {
visibility: visible;
}
@ -381,15 +383,35 @@ a.pandora_pagination.current:hover {
cursor: pointer;
}
.dt-button.buttons-csv.buttons-html5.mini-csv-button {
background-image: url(../../images/file-csv.svg);
background-position: 4px center;
height: 26px;
width: 31px;
margin-left: 10px;
box-shadow: 0px 0px 0px #00000000;
border: 0px;
border-radius: 0px;
}
.dt-button.buttons-csv.buttons-html5:hover {
color: #1d7873 !important;
border: 2px solid #1d7873 !important;
}
.dt-button.buttons-csv.buttons-html5.mini-csv-button:hover {
color: #00000000 !important;
border: 0px !important;
}
.dt-button.buttons-csv.buttons-html5:before {
content: "csv";
}
.dt-button.buttons-csv.buttons-html5.mini-csv-button:before {
content: "";
}
.dt-button.buttons-csv.buttons-html5 span {
font-size: 0;
}

View File

@ -292,7 +292,7 @@ enterprise_include_once('include/auth/saml.php');
if (isset($config['id_user']) === false) {
// Clear error messages.
unset($_COOKIE['errormsg']);
setcookie('errormsg', null, -1);
setcookie('errormsg', '', -1);
if (isset($_GET['login']) === true) {
include_once 'include/functions_db.php';
@ -1610,7 +1610,7 @@ require 'include/php_to_js_values.php';
$(".ui-widget-overlay").css("background", "#000");
$(".ui-widget-overlay").css("opacity", 0.6);
$(".ui-draggable").css("cursor", "inherit");
//$(".ui-draggable").css("cursor", "inherit");
} catch (error) {
console.log(error);

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