Merge branch 'ent-11807-security-hardening-console-informes' into ent-11965-security-hardening-console-vistas-estaticas
This commit is contained in:
commit
133c1676c0
|
@ -78,16 +78,16 @@ cd unix && ./pandora_agent_installer --install
|
|||
}
|
||||
|
||||
|
||||
install_autodiscover () {
|
||||
local arch=$1
|
||||
wget http://firefly.pandorafms.com/projects/autodiscover-linux.zip
|
||||
unzip autodiscover-linux.zip
|
||||
chmod +x $arch/autodiscover
|
||||
mv -f $arch/autodiscover /etc/pandora/plugins/autodiscover
|
||||
}
|
||||
# install_autodiscover () {
|
||||
# local arch=$1
|
||||
# wget http://firefly.pandorafms.com/projects/autodiscover-linux.zip
|
||||
# unzip autodiscover-linux.zip
|
||||
# chmod +x $arch/autodiscover
|
||||
# mv -f $arch/autodiscover /etc/pandora/plugins/autodiscover
|
||||
# }
|
||||
|
||||
## Main
|
||||
echo "Starting PandoraFMS Agent deployment ver. $S_VERSION"
|
||||
echo "Starting PandoraFMS Agent binary deployment ver. $S_VERSION"
|
||||
|
||||
execute_cmd "[ $PANDORA_SERVER_IP ]" 'Check Server IP Address' 'Please define env variable PANDORA_SERVER_IP'
|
||||
|
||||
|
@ -104,8 +104,6 @@ OS=$([[ $(grep '^ID_LIKE=' /etc/os-release) ]] && grep ^ID_LIKE= /etc/os-release
|
|||
[[ $OS =~ 'rhel' ]] && OS_RELEASE=$OS
|
||||
[[ $OS =~ 'fedora' ]] && OS_RELEASE=$OS
|
||||
[[ $OS =~ 'debian' ]] && OS_RELEASE=$OS
|
||||
#[[ $OS == 'rhel fedora' ]] && OS_RELEASE=$OS
|
||||
#[[ $OS == 'centos rhel fedora' ]] && OS_RELEASE=$OS
|
||||
|
||||
# initialice logfile
|
||||
execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE"
|
||||
|
@ -126,6 +124,30 @@ check_repo_connection
|
|||
execute_cmd "grep --version" 'Checking needed tools: grep'
|
||||
execute_cmd "sed --version" 'Checking needed tools: sed'
|
||||
|
||||
# Arch check
|
||||
arch=$(uname -m)
|
||||
case $arch in
|
||||
|
||||
x86_64)
|
||||
echo -e "${cyan}Arch: $arch ${reset} "
|
||||
;;
|
||||
|
||||
x86)
|
||||
echo -e "${yellow}Skiping installation arch: $arch not suported by binary agent please consider to install source agent${reset}"
|
||||
exit -1
|
||||
;;
|
||||
|
||||
armv7l)
|
||||
echo -e "${yellow}Skiping installation arch: $arch not suported by binary agent please consider to install source agent${reset}"
|
||||
exit -1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo -e "${yellow}Skiping installation arch: $arch not suported by binary agent please consider to install source agent${reset}"
|
||||
exit -1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Creating working directory
|
||||
rm -rf $HOME/pandora_deploy_tmp/ &>> $LOGFILE
|
||||
mkdir $HOME/pandora_deploy_tmp &>> $LOGFILE
|
||||
|
@ -148,6 +170,10 @@ if [[ $OS_RELEASE =~ 'rhel' ]] || [[ $OS_RELEASE =~ 'fedora' ]]; then
|
|||
# Check rh version
|
||||
if [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '8' ] ; then
|
||||
package_manager_cmd=dnf
|
||||
execute_cmd "$package_manager_cmd install -y libnsl" "Installing dependencies"
|
||||
elif [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '9' ] ; then
|
||||
package_manager_cmd=dnf
|
||||
execute_cmd "$package_manager_cmd install -y libnsl libxcrypt-compat" "Installing dependencies"
|
||||
elif [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '7' ] ; then
|
||||
package_manager_cmd=yum
|
||||
|
||||
|
@ -158,24 +184,23 @@ if [[ $OS_RELEASE =~ 'rhel' ]] || [[ $OS_RELEASE =~ 'fedora' ]]; then
|
|||
echo -e "${cyan}Installing agent dependencies...${reset}" ${green}OK${reset}
|
||||
|
||||
# Insatall pandora agent
|
||||
$package_manager_cmd install -y http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm &>> $LOGFILE
|
||||
echo -en "${cyan}Installing Pandora FMS agent...${reset}"
|
||||
check_cmd_status 'Error installing Pandora FMS agent'
|
||||
[[ $PANDORA_AGENT_SSL ]] && execute_cmd "$package_manager_cmd install -y perl-IO-Socket-SSL" "Installing SSL libraries for encrypted connection"
|
||||
[ "$PANDORA_AGENT_PACKAGE_EL" ] || PANDORA_AGENT_PACKAGE_EL="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm "
|
||||
execute_cmd "$package_manager_cmd install -y ${PANDORA_AGENT_PACKAGE_EL}" 'Installing Pandora FMS agent package'
|
||||
#[[ $PANDORA_AGENT_SSL ]] && execute_cmd "$package_manager_cmd install -y perl-IO-Socket-SSL" "Installing SSL libraries for encrypted connection"
|
||||
|
||||
fi
|
||||
|
||||
if [[ $OS_RELEASE == 'debian' ]]; then
|
||||
[ "$PANDORA_AGENT_PACKAGE_UBUNTU" ] || PANDORA_AGENT_PACKAGE_UBUNTU='https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG_x86_64.tar.gz'
|
||||
execute_cmd "apt update" 'Updating repos'
|
||||
execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Installing agent dependencies'
|
||||
execute_cmd 'wget http://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz' 'Downloading Pandora FMS agent package'
|
||||
execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Installing agent dependencies'
|
||||
execute_cmd "curl --output pandorafms_agent_linux-7.0NG.tar.gz ${PANDORA_AGENT_PACKAGE_UBUNTU}" 'Downloading Pandora FMS agent package'
|
||||
execute_cmd 'install_tarball pandorafms_agent_linux-7.0NG.tar.gz' 'Installing Pandora FMS agent'
|
||||
[[ $PANDORA_AGENT_SSL ]] && execute_cmd 'apt install -y libio-socket-ssl-perl' "Installing SSL libraries for encrypted connection"
|
||||
#[[ $PANDORA_AGENT_SSL ]] && execute_cmd 'apt install -y libio-socket-ssl-perl' "Installing SSL libraries for encrypted connection"
|
||||
cd $HOME/pandora_deploy_tmp
|
||||
fi
|
||||
|
||||
# Configuring Agente
|
||||
|
||||
[[ $PANDORA_SERVER_IP ]] && sed -i "s/^server_ip.*$/server_ip $PANDORA_SERVER_IP/g" $PANDORA_AGENT_CONF
|
||||
[[ $PANDORA_REMOTE_CONFIG ]] && sed -i "s/^remote_config.*$/remote_config $PANDORA_REMOTE_CONFIG/g" $PANDORA_AGENT_CONF
|
||||
[[ $PANDORA_GROUP ]] && sed -i "s/^group.*$/group $PANDORA_GROUP/g" $PANDORA_AGENT_CONF
|
||||
|
@ -187,27 +212,6 @@ fi
|
|||
[[ $PANDORA_AGENT_SSL ]] && sed -i "s/^#server_ssl.*$/server_ssl $PANDORA_AGENT_SSL/g" $PANDORA_AGENT_CONF
|
||||
|
||||
|
||||
#installing autodiscover
|
||||
|
||||
arch=$(uname -m)
|
||||
case $arch in
|
||||
|
||||
x86_64)
|
||||
execute_cmd 'install_autodiscover x86_64' "installing service autodiscover on $arch" 'Error unable to install autodiscovery'
|
||||
;;
|
||||
|
||||
x86)
|
||||
execute_cmd 'install_autodiscover x84' "installing service autodiscover on $arch" 'Error unable to install autodiscovery'
|
||||
;;
|
||||
|
||||
armv7l)
|
||||
echo -e "${cyan}Skiping autodiscover installation arch $arch not suported${reset}"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo -e "${yellow}Skiping autodiscover installation arch $arch not suported${reset}"
|
||||
;;
|
||||
esac
|
||||
|
||||
#Starting pandora agent daemon.
|
||||
execute_cmd '/etc/init.d/pandora_agent_daemon restart' 'Starting Pandora Agent'
|
||||
|
|
|
@ -28,7 +28,7 @@ $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.spe
|
|||
$CODEHOME/pandora_console/pandora_console.redhat.spec \
|
||||
$CODEHOME/pandora_console/pandora_console.rhel7.spec \
|
||||
$CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \
|
||||
$CODEHOME/pandora_agents/unix/pandora_agent.redhat_bin.spec\
|
||||
$CODEHOME/pandora_agents/unix/pandora_agent.redhat_bin.spec \
|
||||
$CODEHOME/pandora_server/pandora_server.redhat.spec \
|
||||
$PANDHOME_ENT/pandora_agents/pandora_agent.spec \
|
||||
$PANDHOME_ENT/pandora_server/pandora_server_enterprise.redhat.spec \
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2, AIX version
|
||||
# Version 7.0NG.773.3, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2, FreeBSD Version
|
||||
# Version 7.0NG.773.3, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2, HP-UX Version
|
||||
# Version 7.0NG.773.3, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2, GNU/Linux
|
||||
# Version 7.0NG.773.3, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
@ -166,7 +166,7 @@ module_description User CPU Usage (%)
|
|||
module_min_warning 70
|
||||
module_max_warning 90
|
||||
module_min_critical 91
|
||||
module_max_critical 100
|
||||
module_max_critical 0
|
||||
module_unit %
|
||||
module_end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2, GNU/Linux
|
||||
# Version 7.0NG.773.3, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2, Solaris Version
|
||||
# Version 7.0NG.773.3, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2023 Pandora FMS
|
||||
# Version 7.0NG.773.2
|
||||
# Version 7.0NG.773.3
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
# Foundation; either version 2 of the Licence or any later version
|
||||
|
@ -119,7 +119,7 @@ module_description CPU Load (%)
|
|||
module_min_warning 80
|
||||
module_max_warning 90
|
||||
module_min_critical 91
|
||||
module_max_critical 100
|
||||
module_max_critical 0
|
||||
module_end
|
||||
|
||||
# Number processes
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.773.2, AIX version
|
||||
# Version 7.0NG.773.3, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.773.2
|
||||
# Version 7.0NG.773.3
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.773.2, HPUX Version
|
||||
# Version 7.0NG.773.3, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2
|
||||
# Version 7.0NG.773.3
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2023 Pandora FMS
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2
|
||||
# Version 7.0NG.773.3
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2023 Pandora FMS
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2
|
||||
# Version 7.0NG.773.3
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.773.2, Solaris version
|
||||
# Version 7.0NG.773.3, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2, AIX version
|
||||
# Version 7.0NG.773.3, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.773.2-230829
|
||||
Version: 7.0NG.773.3-230907
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.773.2-230829"
|
||||
pandora_version="7.0NG.773.3-230907"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -31,7 +31,7 @@ fi
|
|||
if [ "$#" -ge 2 ]; then
|
||||
VERSION="$2"
|
||||
else
|
||||
VERSION="7.0NG.773.2"
|
||||
VERSION="7.0NG.773.3"
|
||||
fi
|
||||
|
||||
# Path for the generated DMG file
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
<choice id="com.pandorafms.pandorafms_src" visible="false">
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src"/>
|
||||
</choice>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.773.2" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.773.3" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
|
||||
</choice>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.773.2" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.773.3" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<!-- <installation-check script="check()" />
|
||||
<script>
|
||||
<![CDATA[
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
|
||||
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
|
||||
|
||||
<key>CFBundleVersion</key> <string>7.0NG.773.2</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.773.2 Pandora FMS on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.773.2</string>
|
||||
<key>CFBundleVersion</key> <string>7.0NG.773.3</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.773.3 Pandora FMS on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.773.3</string>
|
||||
|
||||
<key>NSPrincipalClass</key><string>NSApplication</string>
|
||||
<key>NSMainNibFile</key><string>MainMenu</string>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2, GNU/Linux
|
||||
# Version 7.0NG.773.3, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
@ -187,7 +187,7 @@ module_description User CPU Usage (%)
|
|||
module_min_warning 70
|
||||
module_max_warning 90
|
||||
module_min_critical 91
|
||||
module_max_critical 100
|
||||
module_max_critical 0
|
||||
module_end
|
||||
|
||||
#Get load average
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2, FreeBSD Version
|
||||
# Version 7.0NG.773.3, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2, HP-UX Version
|
||||
# Version 7.0NG.773.3, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2
|
||||
# Version 7.0NG.773.3
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2004-2023 Pandora FMS
|
||||
# https://pandorafms.com
|
||||
|
@ -219,7 +219,7 @@ module_description User CPU Usage (%)
|
|||
module_min_warning 70
|
||||
module_max_warning 90
|
||||
module_min_critical 91
|
||||
module_max_critical 100
|
||||
module_max_critical 0
|
||||
module_unit %
|
||||
module_group System
|
||||
module_end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2, GNU/Linux
|
||||
# Version 7.0NG.773.3, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2, NetBSD Version
|
||||
# Version 7.0NG.773.3, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.2, Solaris Version
|
||||
# Version 7.0NG.773.3, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1030,8 +1030,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.773.2';
|
||||
use constant AGENT_BUILD => '230829';
|
||||
use constant AGENT_VERSION => '7.0NG.773.3';
|
||||
use constant AGENT_BUILD => '230907';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.773.2
|
||||
%define release 230829
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230907
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.773.2
|
||||
%define release 230725
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230907
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.773.2
|
||||
%define release 230829
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230907
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.773.2"
|
||||
PI_BUILD="230829"
|
||||
PI_VERSION="7.0NG.773.3"
|
||||
PI_BUILD="230907"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2023 Pandora FMS
|
||||
# Version 7.0NG.773.2
|
||||
# Version 7.0NG.773.3
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
# Foundation; either version 2 of the Licence or any later version
|
||||
|
@ -165,7 +165,7 @@ module_description User CPU Usage (%)
|
|||
module_min_warning 70
|
||||
module_max_warning 90
|
||||
module_min_critical 91
|
||||
module_max_critical 100
|
||||
module_max_critical 0
|
||||
module_unit %
|
||||
module_group System
|
||||
module_end
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.773.2}
|
||||
{Pandora FMS Windows Agent v7.0NG.773.3}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{230829}
|
||||
{230907}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.773.2 Build 230829")
|
||||
#define PANDORA_VERSION ("7.0NG.773.3 Build 230907")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Pandora FMS"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.773.2(Build 230829))"
|
||||
VALUE "ProductVersion", "(7.0NG.773.3(Build 230907))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.773.2-230829
|
||||
Version: 7.0NG.773.3-230907
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.773.2-230829"
|
||||
pandora_version="7.0NG.773.3-230907"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -204,51 +204,60 @@ function files_repo_add_file($file_input_name='upfile', $description='', $groups
|
|||
|
||||
if ($upload_result === true) {
|
||||
$filename = $_FILES[$file_input_name]['name'];
|
||||
// Replace conflictive characters
|
||||
$filename = str_replace([' ', '=', '?', '&'], '_', $filename);
|
||||
$filename = filter_var($filename, FILTER_SANITIZE_URL);
|
||||
// The filename should not be larger than 200 characters
|
||||
if (mb_strlen($filename, 'UTF-8') > 200) {
|
||||
$filename = mb_substr($filename, 0, 200, 'UTF-8');
|
||||
}
|
||||
|
||||
$hash = '';
|
||||
if ($public) {
|
||||
$hash = md5(time().$config['dbpass']);
|
||||
$hash = mb_substr($hash, 0, 8, 'UTF-8');
|
||||
}
|
||||
// Invalid extensions.
|
||||
$extension = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
$invalid_extensions = '/^(php|php1|php2|php3|php4|php5|php7|php8|phar|phptml|phps)$/i';
|
||||
|
||||
$values = [
|
||||
'name' => $filename,
|
||||
'description' => $description,
|
||||
'hash' => $hash,
|
||||
];
|
||||
$file_id = db_process_sql_insert('tfiles_repo', $values);
|
||||
if (preg_match($invalid_extensions, $extension) === 0) {
|
||||
// Replace conflictive characters
|
||||
$filename = str_replace([' ', '=', '?', '&'], '_', $filename);
|
||||
$filename = filter_var($filename, FILTER_SANITIZE_URL);
|
||||
// The filename should not be larger than 200 characters
|
||||
if (mb_strlen($filename, 'UTF-8') > 200) {
|
||||
$filename = mb_substr($filename, 0, 200, 'UTF-8');
|
||||
}
|
||||
|
||||
if ($file_id) {
|
||||
$file_tmp = $_FILES[$file_input_name]['tmp_name'];
|
||||
$destination = $files_repo_path.'/'.$file_id.'_'.$filename;
|
||||
$hash = '';
|
||||
if ($public) {
|
||||
$hash = md5(time().$config['dbpass']);
|
||||
$hash = mb_substr($hash, 0, 8, 'UTF-8');
|
||||
}
|
||||
|
||||
if (move_uploaded_file($file_tmp, $destination)) {
|
||||
if (is_array($groups) && !empty($groups)) {
|
||||
db_process_sql_delete('tfiles_repo_group', ['id_file' => $file_id]);
|
||||
foreach ($groups as $group) {
|
||||
$values = [
|
||||
'id_file' => $file_id,
|
||||
'id_group' => $group,
|
||||
];
|
||||
db_process_sql_insert('tfiles_repo_group', $values);
|
||||
$values = [
|
||||
'name' => $filename,
|
||||
'description' => $description,
|
||||
'hash' => $hash,
|
||||
];
|
||||
$file_id = db_process_sql_insert('tfiles_repo', $values);
|
||||
|
||||
if ($file_id) {
|
||||
$file_tmp = $_FILES[$file_input_name]['tmp_name'];
|
||||
$destination = $files_repo_path.'/'.$file_id.'_'.$filename;
|
||||
|
||||
if (move_uploaded_file($file_tmp, $destination)) {
|
||||
if (is_array($groups) && !empty($groups)) {
|
||||
db_process_sql_delete('tfiles_repo_group', ['id_file' => $file_id]);
|
||||
foreach ($groups as $group) {
|
||||
$values = [
|
||||
'id_file' => $file_id,
|
||||
'id_group' => $group,
|
||||
];
|
||||
db_process_sql_insert('tfiles_repo_group', $values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result['status'] = true;
|
||||
$result['status'] = true;
|
||||
} else {
|
||||
db_process_sql_delete('tfiles_repo', ['id' => $file_id]);
|
||||
unlink($file_tmp);
|
||||
$result['message'] = __('The file could not be copied');
|
||||
}
|
||||
} else {
|
||||
db_process_sql_delete('tfiles_repo', ['id' => $file_id]);
|
||||
unlink($file_tmp);
|
||||
$result['message'] = __('The file could not be copied');
|
||||
$result['message'] = __('There was an error creating the file');
|
||||
}
|
||||
} else {
|
||||
$result['message'] = __('There was an error creating the file');
|
||||
$result['message'] = __('File has an invalid extension');
|
||||
}
|
||||
} else {
|
||||
$result['message'] = $upload_result;
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `treport_content` ADD COLUMN `cat_security_hardening` INT NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `ttrap` ADD COLUMN `utimestamp` INT UNSIGNED NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE `treport_content` ADD COLUMN `ignore_skipped` INT NOT NULL DEFAULT 0;
|
||||
UPDATE ttrap SET utimestamp=UNIX_TIMESTAMP(timestamp);
|
||||
|
||||
ALTER TABLE `treport_content` ADD COLUMN `status_of_check` TINYTEXT;
|
||||
CREATE TABLE IF NOT EXISTS `tgraph_analytics_filter` (
|
||||
`id` INT NOT NULL auto_increment,
|
||||
`filter_name` VARCHAR(45) NULL,
|
||||
`user_id` VARCHAR(255) NULL,
|
||||
`graph_modules` TEXT NULL,
|
||||
`interval` INT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
UPDATE `twelcome_tip`
|
||||
SET title = 'Scheduled downtimes',
|
||||
|
@ -15,4 +22,30 @@ UPDATE tagente_modulo SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
|
|||
UPDATE tpolicy_modules SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
|
||||
UPDATE tnetwork_component SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
|
||||
|
||||
ALTER TABLE `tsesion_filter_log_viewer`
|
||||
CHANGE COLUMN `date_range` `custom_date` INT NULL DEFAULT NULL ,
|
||||
CHANGE COLUMN `start_date_defined` `date` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
CHANGE COLUMN `start_date_time` `date_text` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
CHANGE COLUMN `start_date_date` `date_units` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
CHANGE COLUMN `start_date_date_range` `date_init` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
CHANGE COLUMN `start_date_time_range` `time_init` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
CHANGE COLUMN `end_date_date_range` `date_end` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
CHANGE COLUMN `end_date_time_range` `time_end` VARCHAR(45) NULL DEFAULT NULL ;
|
||||
|
||||
ALTER TABLE `tsesion_filter`
|
||||
CHANGE COLUMN `period` `date_text` VARCHAR(45) NULL DEFAULT NULL AFTER `user`;
|
||||
|
||||
ALTER TABLE `tsesion_filter`
|
||||
ADD COLUMN `custom_date` INT NULL AFTER `user`,
|
||||
ADD COLUMN `date` VARCHAR(45) NULL AFTER `custom_date`,
|
||||
ADD COLUMN `date_units` VARCHAR(45) NULL AFTER `date_text`,
|
||||
ADD COLUMN `date_init` VARCHAR(45) NULL AFTER `date_units`,
|
||||
ADD COLUMN `time_init` VARCHAR(45) NULL AFTER `date_init`,
|
||||
ADD COLUMN `date_end` VARCHAR(45) NULL AFTER `time_init`,
|
||||
ADD COLUMN `time_end` VARCHAR(45) NULL AFTER `date_end`;
|
||||
|
||||
ALTER TABLE `treport_content` ADD COLUMN `cat_security_hardening` INT NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `ignore_skipped` INT NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `status_of_check` TINYTEXT;
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -241,10 +241,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||
&& array_search($_GET['sec2'], $autorefresh_list) !== false
|
||||
) {
|
||||
$do_refresh = true;
|
||||
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
|
||||
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
|
||||
$do_refresh = false;
|
||||
}
|
||||
|
||||
// Exception for network maps.
|
||||
if ($_GET['sec2'] === 'operation/agentes/pandora_networkmap') {
|
||||
$do_refresh = false;
|
||||
}
|
||||
|
||||
if ($do_refresh) {
|
||||
|
|
|
@ -216,7 +216,9 @@ if ($create_agent) {
|
|||
$server_name = (string) get_parameter_post('server_name');
|
||||
$id_os = (int) get_parameter_post('id_os');
|
||||
$disabled = (int) get_parameter_post('disabled');
|
||||
$custom_id = (string) get_parameter_post('custom_id', '');
|
||||
$custom_id_safe_output = strip_tags(io_safe_output(get_parameter('custom_id', '')));
|
||||
$custom_id = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $custom_id_safe_output)));
|
||||
// $custom_id = (string) get_parameter_post('custom_id', '');
|
||||
$cascade_protection = (int) get_parameter_post('cascade_protection', 0);
|
||||
$cascade_protection_module = (int) get_parameter_post('cascade_protection_module', 0);
|
||||
$safe_mode = (int) get_parameter_post('safe_mode', 0);
|
||||
|
@ -999,7 +1001,9 @@ if ($update_agent) {
|
|||
$disabled = (bool) get_parameter_post('disabled');
|
||||
$server_name = (string) get_parameter_post('server_name', '');
|
||||
$id_parent = (int) get_parameter_post('id_agent_parent');
|
||||
$custom_id = (string) get_parameter_post('custom_id', '');
|
||||
$custom_id_safe_output = strip_tags(io_safe_output(get_parameter('custom_id', '')));
|
||||
$custom_id = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $custom_id_safe_output)));
|
||||
// $custom_id = (string) get_parameter_post('custom_id', '');
|
||||
$cascade_protection = (int) get_parameter_post('cascade_protection', 0);
|
||||
$cascade_protection_module = (int) get_parameter('cascade_protection_module', 0);
|
||||
$safe_mode_module = (int) get_parameter('safe_mode_module', 0);
|
||||
|
@ -1471,13 +1475,13 @@ if ($update_module === true || $create_module === true) {
|
|||
$plugin_pass = io_input_password(
|
||||
(string) get_parameter('snmp3_auth_pass')
|
||||
);
|
||||
$plugin_parameter = (string) get_parameter('snmp3_auth_method');
|
||||
$plugin_parameter = (string) get_parameter('snmp3_auth_method', 'MD5');
|
||||
|
||||
$custom_string_1 = (string) get_parameter('snmp3_privacy_method');
|
||||
$custom_string_1 = (string) get_parameter('snmp3_privacy_method', 'DES');
|
||||
$custom_string_2 = io_input_password(
|
||||
(string) get_parameter('snmp3_privacy_pass')
|
||||
);
|
||||
$custom_string_3 = (string) get_parameter('snmp3_security_level');
|
||||
$custom_string_3 = (string) get_parameter('snmp3_security_level', 'noAuthNoPriv');
|
||||
} else if ($id_module_type >= 34 && $id_module_type <= 37) {
|
||||
$tcp_send = (string) get_parameter('command_text');
|
||||
$custom_string_1 = (string) get_parameter(
|
||||
|
|
|
@ -459,10 +459,10 @@ if ($id_agent_module) {
|
|||
$snmp_version = 1;
|
||||
$snmp3_auth_user = '';
|
||||
$snmp3_auth_pass = '';
|
||||
$snmp3_auth_method = '';
|
||||
$snmp3_privacy_method = '';
|
||||
$snmp3_auth_method = 'MD5';
|
||||
$snmp3_privacy_method = 'DES';
|
||||
$snmp3_privacy_pass = '';
|
||||
$snmp3_security_level = '';
|
||||
$snmp3_security_level = 'noAuthNoPriv';
|
||||
|
||||
// For Remote CMD.
|
||||
$command_text = '';
|
||||
|
|
|
@ -405,7 +405,22 @@ push_table_simple($data, 'field_snmpv3_row1');
|
|||
|
||||
$data = [];
|
||||
$data[0] = __('Privacy method');
|
||||
$data[1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true, false, false, '', $disabledBecauseInPolicy);
|
||||
$data[1] = html_print_select(
|
||||
[
|
||||
'DES' => __('DES'),
|
||||
'AES' => __('AES'),
|
||||
],
|
||||
'snmp3_privacy_method',
|
||||
$snmp3_privacy_method,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
$data[2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||
$data[3] = html_print_input_password(
|
||||
'snmp3_privacy_pass',
|
||||
|
|
|
@ -89,7 +89,7 @@ if (is_ajax() === true) {
|
|||
[
|
||||
'id' => 'agent_modules_affected_planned_downtime',
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 100%',
|
||||
'style' => 'width: 99%',
|
||||
'columns' => $columns,
|
||||
'column_names' => $column_names,
|
||||
'ajax_url' => 'godmode/agentes/planned_downtime.list',
|
||||
|
@ -730,7 +730,7 @@ if ($downtimes === false && $filter_performed === false) {
|
|||
$table->cellstyle = [];
|
||||
|
||||
$table->head = [];
|
||||
$table->head['name'] = __('Name #Ag.');
|
||||
$table->head['name'] = __('Name (Ag.)');
|
||||
$table->head['description'] = __('Description');
|
||||
$table->head['group'] = __('Group');
|
||||
$table->head['type'] = __('Type');
|
||||
|
|
|
@ -97,7 +97,7 @@ if (is_ajax()) {
|
|||
|
||||
if (!empty($field_description)) {
|
||||
// If the value is 5, this because severity in snmp alerts is not permit to show.
|
||||
if (($i > 5) && ($command['id'] == 3)) {
|
||||
if (($i > 5) && ($command['id'] === 3)) {
|
||||
$fdesc = $field_description.' <br><span class="normal xx-small">'.sprintf(
|
||||
__('Field %s'),
|
||||
($i - 1)
|
||||
|
@ -118,7 +118,7 @@ if (is_ajax()) {
|
|||
}
|
||||
} else {
|
||||
// If the macro hasn't description and doesnt appear in command, set with empty description to dont show it.
|
||||
if (($i > 5) && ($command['id'] == 3)) {
|
||||
if (($i > 5) && ($command['id'] === 3)) {
|
||||
if (substr_count($command['command'], '_field'.($i - 1).'_') > 0) {
|
||||
$fdesc = sprintf(__('Field %s'), ($i - 1));
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1,284 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Pandora FMS
|
||||
* Please see https://pandorafms.com/community/ 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access massive alert deletion'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
if (is_ajax() === true) {
|
||||
$load_policies = get_parameter('load_policies', 0);
|
||||
$load_alerts_policies = get_parameter('load_alerts_policies', 0);
|
||||
|
||||
if ($load_policies) {
|
||||
$id_group = get_parameter('id_group', 0);
|
||||
if ($id_group !== '0') {
|
||||
$filter['force_id_group'] = $id_group;
|
||||
$arr_policies = policies_get_policies($filter);
|
||||
} else {
|
||||
$arr_policies = policies_get_policies();
|
||||
}
|
||||
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
echo json_encode($policies, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($load_alerts_policies) {
|
||||
$ids_policies = get_parameter('policies', []);
|
||||
|
||||
$alerts = [];
|
||||
foreach ($ids_policies as $policie) {
|
||||
foreach (policies_get_alerts($policie, ['id_policy_module' => '<>0']) as $row) {
|
||||
$alerts[$row['id']] = io_safe_output(alerts_get_alert_template_name($row['id_alert_template']).' - '.policies_get_module_name($row['id_policy_module']));
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($alerts, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$add = (bool) get_parameter_post('add');
|
||||
|
||||
if ($add) {
|
||||
$array_alerts = (array) get_parameter('id_alerts');
|
||||
$array_actions = (array) get_parameter('action');
|
||||
$fires_min = (int) get_parameter('fires_min', 0);
|
||||
$fires_max = (int) get_parameter('fires_max', 0);
|
||||
|
||||
if (empty($array_alerts) === false) {
|
||||
foreach ($array_alerts as $id_alert) {
|
||||
foreach ($array_actions as $action) {
|
||||
$id_policy_alert = db_get_value('id_policy_alert', 'tpolicy_alerts_actions', 'id', $action);
|
||||
$result = policies_add_action_alert($id_alert, $action, $fires_min, $fires_max);
|
||||
}
|
||||
}
|
||||
|
||||
ui_print_result_message($result, __('Add action successfully'), __('Could not be added'), '');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'add_table';
|
||||
$table->class = 'databox filters filter-table-adv';
|
||||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold; vertical-align:top';
|
||||
$table->style[2] = 'font-weight: bold; vertical-align:top';
|
||||
$table->size = [];
|
||||
$table->size[0] = '50%';
|
||||
$table->size[1] = '50%';
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$table->data[0][0] = html_print_label_input_block(
|
||||
__('Group'),
|
||||
html_print_select_groups(
|
||||
false,
|
||||
'AW',
|
||||
true,
|
||||
'id_group',
|
||||
0,
|
||||
'',
|
||||
'All',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[0][1] = html_print_label_input_block(
|
||||
__('Group recursion'),
|
||||
html_print_checkbox('recursion', 1, $recursion, true, false, '', true)
|
||||
);
|
||||
|
||||
$arr_policies = policies_get_policies();
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
$table->data[1][0] = html_print_label_input_block(
|
||||
__('Policies'),
|
||||
html_print_select(
|
||||
$policies,
|
||||
'id_policies[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[1][1] = html_print_label_input_block(
|
||||
__('Alerts'),
|
||||
html_print_select(
|
||||
[],
|
||||
'id_alerts[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
$actions = alerts_get_alert_actions();
|
||||
$table->data[2][0] = html_print_label_input_block(
|
||||
__('Action'),
|
||||
html_print_select(
|
||||
$actions,
|
||||
'action[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'w100p',
|
||||
false,
|
||||
'width:100%'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[2][1] = html_print_label_input_block(
|
||||
__('Number of matching alerts'),
|
||||
'<div>'.html_print_input_text('fires_min', 0, '', false, 10, true, false, false, '', 'w30p').'<span class="margin-lr-10">'.__('to').'</span>'.html_print_input_text('fires_max', 0, '', false, 10, true, false, false, '', 'w30p').'</div>'
|
||||
);
|
||||
|
||||
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_alerts">';
|
||||
html_print_table($table);
|
||||
|
||||
attachActionButton('add', 'add', $table->width, false, $SelectAction);
|
||||
|
||||
echo '</form>';
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
$('#id_group').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_add_policies_alerts',
|
||||
load_policies: 1,
|
||||
id_group: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_policies').html(options);
|
||||
} else {
|
||||
$('#id_policies').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
$('#id_policies').trigger('change');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#id_policies').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_add_policies_alerts',
|
||||
load_alerts_policies: 1,
|
||||
policies: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_alerts').html(options);
|
||||
} else {
|
||||
$('#id_alerts').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$("form").submit(function(e){
|
||||
var id_policies = $('#id_policies :selected').val();
|
||||
var id_alerts = $('#id_alerts :selected').val();
|
||||
var action = $('#action :selected').val();
|
||||
|
||||
if ($.isEmptyObject(id_policies) || $.isEmptyObject(id_alerts) || $.isEmptyObject(action) || id_policies === '0' || id_alerts === '0'){
|
||||
e.preventDefault();
|
||||
alert('<?php echo __('Policies, Alerts and Action must to be selected'); ?>');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
|
@ -0,0 +1,288 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Pandora FMS
|
||||
* Please see https://pandorafms.com/community/ 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access massive alert deletion'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
if (is_ajax() === true) {
|
||||
$load_policies = get_parameter('load_policies', 0);
|
||||
$load_alerts_policies = get_parameter('load_alerts_policies', 0);
|
||||
|
||||
if ($load_policies) {
|
||||
$id_group = get_parameter('id_group', 0);
|
||||
if ($id_group !== '0') {
|
||||
$filter['force_id_group'] = $id_group;
|
||||
$arr_policies = policies_get_policies($filter);
|
||||
} else {
|
||||
$arr_policies = policies_get_policies();
|
||||
}
|
||||
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
echo json_encode($policies, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($load_alerts_policies) {
|
||||
$ids_policies = get_parameter('policies', []);
|
||||
|
||||
$alerts = [];
|
||||
foreach ($ids_policies as $policie) {
|
||||
$array_alerts = policies_get_alerts(
|
||||
$policie,
|
||||
['id_policy_module' => '0']
|
||||
);
|
||||
foreach ($array_alerts as $row) {
|
||||
$alerts[$row['id']] = io_safe_output(alerts_get_alert_template_name($row['id_alert_template']).' - '.$row['name_extern_module']);
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($alerts, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$add = (bool) get_parameter_post('add');
|
||||
|
||||
if ($add) {
|
||||
$array_alerts = (array) get_parameter('id_alerts');
|
||||
$array_actions = (array) get_parameter('action');
|
||||
$fires_min = (int) get_parameter('fires_min', 0);
|
||||
$fires_max = (int) get_parameter('fires_max', 0);
|
||||
|
||||
if (empty($array_alerts) === false) {
|
||||
foreach ($array_alerts as $id_alert) {
|
||||
foreach ($array_actions as $action) {
|
||||
$id_policy_alert = db_get_value('id_policy_alert', 'tpolicy_alerts_actions', 'id', $action);
|
||||
$result = policies_add_action_alert($id_alert, $action, $fires_min, $fires_max);
|
||||
}
|
||||
}
|
||||
|
||||
ui_print_result_message($result, __('Add action successfully'), __('Could not be added'), '');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'add_table';
|
||||
$table->class = 'databox filters filter-table-adv';
|
||||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold; vertical-align:top';
|
||||
$table->style[2] = 'font-weight: bold; vertical-align:top';
|
||||
$table->size = [];
|
||||
$table->size[0] = '50%';
|
||||
$table->size[1] = '50%';
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$table->data[0][0] = html_print_label_input_block(
|
||||
__('Group'),
|
||||
html_print_select_groups(
|
||||
false,
|
||||
'AW',
|
||||
true,
|
||||
'id_group',
|
||||
0,
|
||||
'',
|
||||
'All',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:180px;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[0][1] = html_print_label_input_block(
|
||||
__('Group recursion'),
|
||||
html_print_checkbox('recursion', 1, $recursion, true, false, '', true)
|
||||
);
|
||||
|
||||
$arr_policies = policies_get_policies();
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
$table->data[1][0] = html_print_label_input_block(
|
||||
__('Policies'),
|
||||
html_print_select(
|
||||
$policies,
|
||||
'id_policies[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[1][1] = html_print_label_input_block(
|
||||
__('Alerts'),
|
||||
html_print_select(
|
||||
[],
|
||||
'id_alerts[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
$actions = alerts_get_alert_actions();
|
||||
$table->data[2][0] = html_print_label_input_block(
|
||||
__('Action'),
|
||||
html_print_select(
|
||||
$actions,
|
||||
'action[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'w100p',
|
||||
false,
|
||||
'width:100%'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[2][1] = html_print_label_input_block(
|
||||
__('Number of matching alerts'),
|
||||
'<div>'.html_print_input_text('fires_min', 0, '', false, 10, true, false, false, '', 'w30p').'<span class="margin-lr-10">'.__('to').'</span>'.html_print_input_text('fires_max', 0, '', false, 10, true, false, false, '', 'w30p').'</div>'
|
||||
);
|
||||
|
||||
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_alerts">';
|
||||
html_print_table($table);
|
||||
|
||||
attachActionButton('add', 'add', $table->width, false, $SelectAction);
|
||||
|
||||
echo '</form>';
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
$('#id_group').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_add_policies_alerts_action_external',
|
||||
load_policies: 1,
|
||||
id_group: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_policies').html(options);
|
||||
} else {
|
||||
$('#id_policies').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
$('#id_policies').trigger('change');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#id_policies').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_add_policies_alerts_action_external',
|
||||
load_alerts_policies: 1,
|
||||
policies: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_alerts').html(options);
|
||||
} else {
|
||||
$('#id_alerts').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$("form").submit(function(e){
|
||||
var id_policies = $('#id_policies :selected').val();
|
||||
var id_alerts = $('#id_alerts :selected').val();
|
||||
var action = $('#action :selected').val();
|
||||
|
||||
if ($.isEmptyObject(id_policies) || $.isEmptyObject(id_alerts) || $.isEmptyObject(action) || id_policies === '0' || id_alerts === '0'){
|
||||
e.preventDefault();
|
||||
alert('<?php echo __('Policies, Alerts and Action must to be selected'); ?>');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
|
@ -0,0 +1,325 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Pandora FMS
|
||||
* Please see https://pandorafms.com/community/ 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access massive alert deletion'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
if (is_ajax() === true) {
|
||||
$load_policies = get_parameter('load_policies', 0);
|
||||
$load_alerts_policies = get_parameter('load_alerts_policies', 0);
|
||||
$load_actions_alerts = get_parameter('load_actions_alerts', 0);
|
||||
|
||||
if ($load_policies) {
|
||||
$id_group = get_parameter('id_group', 0);
|
||||
if ($id_group !== '0') {
|
||||
$filter['force_id_group'] = $id_group;
|
||||
$arr_policies = policies_get_policies($filter);
|
||||
} else {
|
||||
$arr_policies = policies_get_policies();
|
||||
}
|
||||
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
echo json_encode($policies, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($load_alerts_policies) {
|
||||
$ids_policies = get_parameter('policies', []);
|
||||
|
||||
$alerts = [];
|
||||
foreach ($ids_policies as $policie) {
|
||||
foreach (policies_get_alerts($policie, ['id_policy_module' => '<>0']) as $row) {
|
||||
$name = io_safe_output(alerts_get_alert_template_name($row['id_alert_template']).' - '.policies_get_module_name($row['id_policy_module']));
|
||||
$alerts[$row['id'].'__'.policies_get_name($policie).' - '.$name] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($alerts, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($load_actions_alerts) {
|
||||
$array_alerts = get_parameter('id_alerts', []);
|
||||
|
||||
$actions = [];
|
||||
foreach ($array_alerts as $alert) {
|
||||
$alert_policie = explode('__', $alert);
|
||||
$alert_id = $alert_policie[0];
|
||||
$alert_name = $alert_policie[1];
|
||||
$array_actions = db_get_all_rows_filter(
|
||||
'tpolicy_alerts_actions',
|
||||
['id_policy_alert' => $alert]
|
||||
);
|
||||
foreach ($array_actions as $row) {
|
||||
$action = db_get_row_filter(
|
||||
'talert_actions',
|
||||
['id' => $row['id_alert_action']]
|
||||
);
|
||||
$actions[$row['id']] = $alert_name.' - '.$action['name'];
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($actions, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$delete = (bool) get_parameter_post('delete');
|
||||
|
||||
if ($delete) {
|
||||
$array_actions = get_parameter('id_actions');
|
||||
foreach ($array_actions as $id_action) {
|
||||
$result = policies_delete_action_alert($id_action);
|
||||
}
|
||||
|
||||
ui_print_result_message($result, __('Deleted action successfully'), __('Could not be deleted'), '');
|
||||
}
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'add_table';
|
||||
$table->class = 'databox filters filter-table-adv';
|
||||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold; vertical-align:top';
|
||||
$table->style[2] = 'font-weight: bold; vertical-align:top';
|
||||
$table->size = [];
|
||||
$table->size[0] = '50%';
|
||||
$table->size[1] = '50%';
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$table->data[0][0] = html_print_label_input_block(
|
||||
__('Group'),
|
||||
html_print_select_groups(
|
||||
false,
|
||||
'AW',
|
||||
true,
|
||||
'id_group',
|
||||
0,
|
||||
'',
|
||||
'All',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:180px;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[0][1] = html_print_label_input_block(
|
||||
__('Group recursion'),
|
||||
html_print_checkbox('recursion', 1, $recursion, true, false, '', true)
|
||||
);
|
||||
|
||||
$arr_policies = policies_get_policies();
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
$table->data[1][0] = html_print_label_input_block(
|
||||
__('Policies'),
|
||||
html_print_select(
|
||||
$policies,
|
||||
'id_policies[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[1][1] = html_print_label_input_block(
|
||||
__('Alerts'),
|
||||
html_print_select(
|
||||
[],
|
||||
'id_alerts[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->colspan[2][0] = 2;
|
||||
$table->data[2][0] = html_print_label_input_block(
|
||||
__('Actions'),
|
||||
html_print_select(
|
||||
[],
|
||||
'id_actions[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_alerts">';
|
||||
html_print_table($table);
|
||||
|
||||
attachActionButton('delete', 'delete', $table->width, false, $SelectAction);
|
||||
|
||||
echo '</form>';
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
$('#id_group').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_delete_policies_alerts',
|
||||
load_policies: 1,
|
||||
id_group: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_policies').html(options);
|
||||
} else {
|
||||
$('#id_policies').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
$('#id_policies').trigger('change');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#id_policies').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_delete_policies_alerts',
|
||||
load_alerts_policies: 1,
|
||||
policies: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_alerts').html(options);
|
||||
} else {
|
||||
$('#id_alerts').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#id_alerts').change(function(){
|
||||
var data = $(this).val();
|
||||
if (data !== 0){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_delete_policies_alerts',
|
||||
load_actions_alerts: 1,
|
||||
id_alerts: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_actions').html(options);
|
||||
} else {
|
||||
$('#id_actions').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
$("form").submit(function(e){
|
||||
var id_policies = $('#id_policies :selected').val();
|
||||
var id_alerts = $('#id_alerts :selected').val();
|
||||
var id_actions = $('#id_actions :selected').val();
|
||||
|
||||
if ($.isEmptyObject(id_policies) || $.isEmptyObject(id_alerts) || $.isEmptyObject(id_actions) || id_policies === '0' || id_alerts === '0'){
|
||||
e.preventDefault();
|
||||
alert('<?php echo __('Policies, Alerts and Action must to be selected'); ?>');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
|
@ -0,0 +1,325 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Pandora FMS
|
||||
* Please see https://pandorafms.com/community/ 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access massive alert deletion'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
if (is_ajax() === true) {
|
||||
$load_policies = get_parameter('load_policies', 0);
|
||||
$load_alerts_policies = get_parameter('load_alerts_policies', 0);
|
||||
$load_actions_alerts = get_parameter('load_actions_alerts', 0);
|
||||
|
||||
if ($load_policies) {
|
||||
$id_group = get_parameter('id_group', 0);
|
||||
if ($id_group !== '0') {
|
||||
$filter['force_id_group'] = $id_group;
|
||||
$arr_policies = policies_get_policies($filter);
|
||||
} else {
|
||||
$arr_policies = policies_get_policies();
|
||||
}
|
||||
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
echo json_encode($policies, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($load_alerts_policies) {
|
||||
$ids_policies = get_parameter('policies', []);
|
||||
|
||||
$alerts = [];
|
||||
foreach ($ids_policies as $policie) {
|
||||
foreach (policies_get_alerts($policie, ['id_policy_module' => '0']) as $row) {
|
||||
$name = io_safe_output(alerts_get_alert_template_name($row['id_alert_template']).' - '.$row['name_extern_module']);
|
||||
$alerts[$row['id'].'__'.policies_get_name($policie).' - '.$name] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($alerts, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($load_actions_alerts) {
|
||||
$array_alerts = get_parameter('id_alerts', []);
|
||||
|
||||
$actions = [];
|
||||
foreach ($array_alerts as $alert) {
|
||||
$alert_policie = explode('__', $alert);
|
||||
$alert_id = $alert_policie[0];
|
||||
$alert_name = $alert_policie[1];
|
||||
$array_actions = db_get_all_rows_filter(
|
||||
'tpolicy_alerts_actions',
|
||||
['id_policy_alert' => $alert]
|
||||
);
|
||||
foreach ($array_actions as $row) {
|
||||
$action = db_get_row_filter(
|
||||
'talert_actions',
|
||||
['id' => $row['id_alert_action']]
|
||||
);
|
||||
$actions[$row['id']] = $alert_name.' - '.$action['name'];
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($actions, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$delete = (bool) get_parameter_post('delete');
|
||||
|
||||
if ($delete) {
|
||||
$array_actions = get_parameter('id_actions');
|
||||
foreach ($array_actions as $id_action) {
|
||||
$result = policies_delete_action_alert($id_action);
|
||||
}
|
||||
|
||||
ui_print_result_message($result, __('Deleted action successfully'), __('Could not be deleted'), '');
|
||||
}
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'add_table';
|
||||
$table->class = 'databox filters filter-table-adv';
|
||||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold; vertical-align:top';
|
||||
$table->style[2] = 'font-weight: bold; vertical-align:top';
|
||||
$table->size = [];
|
||||
$table->size[0] = '50%';
|
||||
$table->size[1] = '50%';
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$table->data[0][0] = html_print_label_input_block(
|
||||
__('Group'),
|
||||
html_print_select_groups(
|
||||
false,
|
||||
'AW',
|
||||
true,
|
||||
'id_group',
|
||||
0,
|
||||
'',
|
||||
'All',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:180px;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[0][1] = html_print_label_input_block(
|
||||
__('Group recursion'),
|
||||
html_print_checkbox('recursion', 1, $recursion, true, false, '', true)
|
||||
);
|
||||
|
||||
$arr_policies = policies_get_policies();
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
$table->data[1][0] = html_print_label_input_block(
|
||||
__('Policies'),
|
||||
html_print_select(
|
||||
$policies,
|
||||
'id_policies[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[1][1] = html_print_label_input_block(
|
||||
__('Alerts'),
|
||||
html_print_select(
|
||||
[],
|
||||
'id_alerts[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->colspan[2][0] = 2;
|
||||
$table->data[2][0] = html_print_label_input_block(
|
||||
__('Actions'),
|
||||
html_print_select(
|
||||
[],
|
||||
'id_actions[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_alerts">';
|
||||
html_print_table($table);
|
||||
|
||||
attachActionButton('delete', 'delete', $table->width, false, $SelectAction);
|
||||
|
||||
echo '</form>';
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
$('#id_group').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_delete_policies_alerts_action_external',
|
||||
load_policies: 1,
|
||||
id_group: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_policies').html(options);
|
||||
} else {
|
||||
$('#id_policies').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
$('#id_policies').trigger('change');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#id_policies').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_delete_policies_alerts_action_external',
|
||||
load_alerts_policies: 1,
|
||||
policies: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_alerts').html(options);
|
||||
} else {
|
||||
$('#id_alerts').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#id_alerts').change(function(){
|
||||
var data = $(this).val();
|
||||
if (data !== 0){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_delete_policies_alerts_action_external',
|
||||
load_actions_alerts: 1,
|
||||
id_alerts: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_actions').html(options);
|
||||
} else {
|
||||
$('#id_actions').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
$("form").submit(function(e){
|
||||
var id_policies = $('#id_policies :selected').val();
|
||||
var id_alerts = $('#id_alerts :selected').val();
|
||||
var id_actions = $('#id_actions :selected').val();
|
||||
|
||||
if ($.isEmptyObject(id_policies) || $.isEmptyObject(id_alerts) || $.isEmptyObject(id_actions) || id_policies === '0' || id_alerts === '0'){
|
||||
e.preventDefault();
|
||||
alert('<?php echo __('Policies, Alerts and Action must to be selected'); ?>');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
|
@ -371,7 +371,6 @@ $autorefresh_list_out['operation/agentes/status_monitor'] = 'Monitor detail';
|
|||
$autorefresh_list_out['enterprise/operation/services/services'] = 'Services';
|
||||
$autorefresh_list_out['operation/dashboard/dashboard'] = 'Dashboard';
|
||||
|
||||
$autorefresh_list_out['operation/agentes/pandora_networkmap'] = 'Network map';
|
||||
$autorefresh_list_out['operation/visual_console/render_view'] = 'Visual console';
|
||||
$autorefresh_list_out['operation/events/events'] = 'Events';
|
||||
|
||||
|
|
|
@ -64,6 +64,16 @@ $options_alerts = [
|
|||
'standby_alerts' => __('Bulk alert setting standby'),
|
||||
];
|
||||
|
||||
$options_alerts_policies = [
|
||||
'add_policies_alerts' => __('Bulk policies alert action add'),
|
||||
'delete_policies_alerts' => __('Bulk policies alert action delete'),
|
||||
];
|
||||
|
||||
$options_policies_alerts_externals = [
|
||||
'add_policies_alerts_action_external' => __('Bulk policies external alert action add'),
|
||||
'delete_policies_alerts_action_external' => __('Bulk policies external alert action delete'),
|
||||
];
|
||||
|
||||
$options_agents = [
|
||||
'edit_agents' => __('Bulk agent edit'),
|
||||
'delete_agents' => __('Bulk agent delete'),
|
||||
|
@ -119,6 +129,10 @@ if ($satellite_options != ENTERPRISE_NOT_HOOK) {
|
|||
|
||||
if (in_array($option, array_keys($options_alerts)) === true) {
|
||||
$tab = 'massive_alerts';
|
||||
} else if (in_array($option, array_keys($options_alerts_policies)) === true) {
|
||||
$tab = 'massive_policies_alerts';
|
||||
} else if (in_array($option, array_keys($options_policies_alerts_externals)) === true) {
|
||||
$tab = 'massive_policies_alerts_external';
|
||||
} else if (in_array($option, array_keys($options_agents)) === true) {
|
||||
$tab = 'massive_agents';
|
||||
} else if (in_array($option, array_keys($options_users)) === true) {
|
||||
|
@ -173,6 +187,14 @@ switch ($tab) {
|
|||
$options = $options_alerts;
|
||||
break;
|
||||
|
||||
case 'massive_policies_alerts':
|
||||
$options = $options_alerts_policies;
|
||||
break;
|
||||
|
||||
case 'massive_policies_alerts_external':
|
||||
$options = $options_policies_alerts_externals;
|
||||
break;
|
||||
|
||||
case 'massive_agents':
|
||||
$options = $options_agents;
|
||||
break;
|
||||
|
@ -223,6 +245,30 @@ $alertstab = [
|
|||
'active' => $tab == 'massive_alerts',
|
||||
];
|
||||
|
||||
$policiesalertstab = [
|
||||
'text' => '<a href="'.$url.'&tab=massive_policies_alerts">'.html_print_image(
|
||||
'images/policies_mc.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Policies alerts'),
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
]
|
||||
).'</a>',
|
||||
'active' => $tab == 'massive_policies_alerts',
|
||||
];
|
||||
|
||||
$policiesalertsexternaltab = [
|
||||
'text' => '<a href="'.$url.'&tab=massive_policies_alerts_external">'.html_print_image(
|
||||
'images/alerts_extern.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Policies external alerts'),
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
]
|
||||
).'</a>',
|
||||
'active' => $tab == 'massive_policies_alerts_external',
|
||||
];
|
||||
|
||||
$userstab = [
|
||||
'text' => '<a href="'.$url.'&tab=massive_users">'.html_print_image(
|
||||
'images/user.svg',
|
||||
|
@ -298,6 +344,8 @@ if (check_acl($config['id_user'], 0, 'UM')) {
|
|||
}
|
||||
|
||||
$onheader['massive_alerts'] = $alertstab;
|
||||
$onheader['massive_policies_alerts'] = $policiesalertstab;
|
||||
$onheader['massive_policies_alerts_external'] = $policiesalertsexternaltab;
|
||||
$onheader['policies'] = $policiestab;
|
||||
$onheader['snmp'] = $snmptab;
|
||||
$onheader['satellite'] = $satellitetab;
|
||||
|
@ -318,6 +366,8 @@ if (is_metaconsole() === false) {
|
|||
$pluginstab,
|
||||
$userstab,
|
||||
$alertstab,
|
||||
$policiesalertstab,
|
||||
$policiesalertsexternaltab,
|
||||
$policiestab,
|
||||
$snmptab,
|
||||
$satellitetab,
|
||||
|
@ -490,6 +540,22 @@ switch ($option) {
|
|||
include_once $config['homedir'].'/godmode/massive/massive_standby_alerts.php';
|
||||
break;
|
||||
|
||||
case 'add_policies_alerts':
|
||||
include_once $config['homedir'].'/godmode/massive/massive_add_policies_alerts.php';
|
||||
break;
|
||||
|
||||
case 'delete_policies_alerts':
|
||||
include_once $config['homedir'].'/godmode/massive/massive_delete_policies_alerts.php';
|
||||
break;
|
||||
|
||||
case 'add_policies_alerts_action_external':
|
||||
include_once $config['homedir'].'/godmode/massive/massive_add_policies_alerts_action_external.php';
|
||||
break;
|
||||
|
||||
case 'delete_policies_alerts_action_external':
|
||||
include_once $config['homedir'].'/godmode/massive/massive_delete_policies_alerts_action_external.php';
|
||||
break;
|
||||
|
||||
case 'add_profiles':
|
||||
include_once $config['homedir'].'/godmode/massive/massive_add_profiles.php';
|
||||
break;
|
||||
|
|
|
@ -309,6 +309,8 @@ if ($access_console_node === true) {
|
|||
}
|
||||
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_alerts']['text'] = __('Alerts operations');
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_policies_alerts']['text'] = __('Policies alerts');
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_policies_alerts_external']['text'] = __('Policies External alerts');
|
||||
enterprise_hook('massivepolicies_submenu');
|
||||
enterprise_hook('massivesnmp_submenu');
|
||||
enterprise_hook('massivesatellite_submenu');
|
||||
|
|
|
@ -759,6 +759,31 @@ if (enterprise_installed() === true) {
|
|||
);
|
||||
}
|
||||
|
||||
$days_week = [
|
||||
0 => __('Sunday'),
|
||||
1 => __('Monday'),
|
||||
2 => __('Tuesday'),
|
||||
3 => __('Wednesday'),
|
||||
4 => __('Thursday'),
|
||||
5 => __('Friday'),
|
||||
6 => __('Saturday'),
|
||||
];
|
||||
|
||||
$table_styles->data[$row][] = html_print_label_input_block(
|
||||
__('Datepicker first day of week'),
|
||||
html_print_select(
|
||||
$days_week,
|
||||
'datepicker_first_day',
|
||||
$config['datepicker_first_day'],
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
$row++;
|
||||
|
||||
// Title Header.
|
||||
|
|
|
@ -2312,7 +2312,7 @@ $(document).ready (function () {
|
|||
// The row provided has a predefined class. We delete it.
|
||||
$('#table_macros-field' + i)
|
||||
.removeAttr('class');
|
||||
if(old_value && i != 4){
|
||||
if(old_value){
|
||||
$("[name=field" + i + "_value]").val(old_value).trigger('change');
|
||||
}
|
||||
$('#table_macros-field').show();
|
||||
|
|
|
@ -1628,7 +1628,6 @@ $autorefresh_list_out['operation/agentes/status_monitor'] = 'Monitor detail';
|
|||
$autorefresh_list_out['enterprise/operation/services/services'] = 'Services';
|
||||
$autorefresh_list_out['operation/dashboard/dashboard'] = 'Dashboard';
|
||||
|
||||
$autorefresh_list_out['operation/agentes/pandora_networkmap'] = 'Network map';
|
||||
$autorefresh_list_out['operation/visual_console/render_view'] = 'Visual console';
|
||||
$autorefresh_list_out['operation/events/events'] = 'Events';
|
||||
|
||||
|
@ -1643,6 +1642,10 @@ if (isset($autorefresh_list) === false || empty($autorefresh_list) === true || e
|
|||
$aux = [];
|
||||
$count_autorefresh_list = count($autorefresh_list);
|
||||
for ($i = 0; $i < $count_autorefresh_list; $i++) {
|
||||
if ($autorefresh_list[$i] === 'operation/agentes/pandora_networkmap') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$aux[$autorefresh_list[$i]] = $autorefresh_list_out[$autorefresh_list[$i]];
|
||||
unset($autorefresh_list_out[$autorefresh_list[$i]]);
|
||||
$autorefresh_list[$i] = $aux;
|
||||
|
|
|
@ -912,7 +912,7 @@ class DiscoveryTaskList extends HTML
|
|||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
).' ';
|
||||
$data[6] .= __('Discovery.NetScan (legacy)');
|
||||
$data[6] .= __('Discovery.NetScan');
|
||||
} else {
|
||||
// APP or external script recon task.
|
||||
$data[6] = html_print_image(
|
||||
|
@ -920,7 +920,7 @@ class DiscoveryTaskList extends HTML
|
|||
true,
|
||||
['class' => 'main_menu_icon invert_filter']
|
||||
).' ';
|
||||
$data[6] .= $recon_script_name.' (legacy)';
|
||||
$data[6] .= $recon_script_name;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
|
@ -58,7 +58,14 @@ if ($save_log_filter) {
|
|||
$values = [];
|
||||
$values['id_name'] = get_parameter('id_name');
|
||||
$values['text'] = get_parameter('text', '');
|
||||
$values['period'] = get_parameter('period', '');
|
||||
$values['custom_date'] = get_parameter('custom_date');
|
||||
$values['date'] = get_parameter('date');
|
||||
$values['date_text'] = get_parameter('date_text');
|
||||
$values['date_units'] = get_parameter('date_units');
|
||||
$values['date_init'] = get_parameter('date_init');
|
||||
$values['time_init'] = get_parameter('time_init');
|
||||
$values['date_end'] = get_parameter('date_end');
|
||||
$values['time_end'] = get_parameter('time_end');
|
||||
$values['ip'] = get_parameter('ip', '');
|
||||
$values['type'] = get_parameter('type', -1);
|
||||
$values['user'] = get_parameter('user', -1);
|
||||
|
@ -91,7 +98,14 @@ if ($update_log_filter) {
|
|||
$values = [];
|
||||
$id = get_parameter('id');
|
||||
$values['text'] = get_parameter('text', '');
|
||||
$values['period'] = get_parameter('period', '');
|
||||
$values['custom_date'] = get_parameter('custom_date');
|
||||
$values['date'] = get_parameter('date');
|
||||
$values['date_text'] = get_parameter('date_text');
|
||||
$values['date_units'] = get_parameter('date_units');
|
||||
$values['date_init'] = get_parameter('date_init');
|
||||
$values['time_init'] = get_parameter('time_init');
|
||||
$values['date_end'] = get_parameter('date_end');
|
||||
$values['time_end'] = get_parameter('time_end');
|
||||
$values['ip'] = get_parameter('ip', '');
|
||||
$values['type'] = get_parameter('type', -1);
|
||||
$values['user'] = get_parameter('user', -1);
|
||||
|
@ -211,18 +225,42 @@ function load_filter_values() {
|
|||
$.each(data,function(i,value){
|
||||
if (i == 'text'){
|
||||
$("#text-filter_text").val(value);
|
||||
}
|
||||
if (i == 'period'){
|
||||
$("#filter_period").val(value).change();
|
||||
}
|
||||
if (i == 'ip'){
|
||||
} else if (i == 'ip'){
|
||||
$("#text-filter_ip").val(value);
|
||||
}
|
||||
if (i == 'type'){
|
||||
} else if (i == 'type'){
|
||||
$("#filter_type").val(value).change();
|
||||
}
|
||||
if (i == 'user'){
|
||||
} else if (i == 'user'){
|
||||
$("#filter_user").val(value).change();
|
||||
} else if (i == 'custom_date'){
|
||||
$('#hidden-custom_date').val(value).change();
|
||||
if ($('#hidden-custom_date').val()==='0'){
|
||||
$('#date_default').show();
|
||||
$('#date_range').hide();
|
||||
$('#date_extend').hide();
|
||||
$('#date').val('".SECONDS_1DAY."').trigger('change');
|
||||
} else if ($('#hidden-custom_date').val()==='1'){
|
||||
$('#date_range').show();
|
||||
$('#date_default').hide();
|
||||
$('#date_extend').hide();
|
||||
} else {
|
||||
$('#date_range').hide();
|
||||
$('#date_default').hide();
|
||||
$('#date_extend').show();
|
||||
}
|
||||
} else if (i == 'date'){
|
||||
$('#date').val(value).change();
|
||||
} else if (i == 'date_end'){
|
||||
$('#text-date_end').val(value);
|
||||
} else if (i == 'date_init'){
|
||||
$('#text-date_init').val(value);
|
||||
} else if (i == 'date_text'){
|
||||
$('#text-date_text').val(value);
|
||||
} else if (i == 'date_units'){
|
||||
$('#date_units').val(value).change();
|
||||
} else if (i == 'time_end'){
|
||||
$('#text-time_end').val(value);
|
||||
} else if (i == 'time_init'){
|
||||
$('#text-time_init').val(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -408,7 +446,14 @@ function save_new_filter() {
|
|||
"save_log_filter" : 1,
|
||||
"id_name" : $("#text-id_name").val(),
|
||||
"text" : $("#text-filter_text").val(),
|
||||
"period" : $("#filter_period :selected").val(),
|
||||
"custom_date": $('#hidden-custom_date').val(),
|
||||
"date": $('#date option:selected').val(),
|
||||
"date_text": $('#text-date_text').val(),
|
||||
"date_units": $('#date_units option:selected').val(),
|
||||
"date_init": $('#text-date_init').val(),
|
||||
"time_init": $('#text-time_init').val(),
|
||||
"date_end": $('#text-date_end').val(),
|
||||
"time_end": $('#text-time_end').val(),
|
||||
"ip" : $('#text-filter_ip').val(),
|
||||
"type" : $('#filter_type :selected').val(),
|
||||
"user" : $('#filter_user :selected').val(),
|
||||
|
@ -444,7 +489,14 @@ function save_update_filter() {
|
|||
"update_log_filter" : 1,
|
||||
"id" : $("#overwrite_filter :selected").val(),
|
||||
"text" : $("#text-filter_text").val(),
|
||||
"period" : $("#filter_period :selected").val(),
|
||||
"custom_date": $('#hidden-custom_date').val(),
|
||||
"date": $('#date option:selected').val(),
|
||||
"date_text": $('#text-date_text').val(),
|
||||
"date_units": $('#date_units option:selected').val(),
|
||||
"date_init": $('#text-date_init').val(),
|
||||
"time_init": $('#text-time_init').val(),
|
||||
"date_end": $('#text-date_end').val(),
|
||||
"time_end": $('#text-time_end').val(),
|
||||
"ip" : $('#text-filter_ip').val(),
|
||||
"type" : $('#filter_type :selected').val(),
|
||||
"user" : $('#filter_user :selected').val(),
|
||||
|
|
|
@ -1486,27 +1486,53 @@ if (check_login()) {
|
|||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
if ($params['histogram'] === true) {
|
||||
$params['id_agent_module'] = $params['agent_module_id'];
|
||||
$params['dinamic_proc'] = 1;
|
||||
if ($params['enable_projected_period'] === '1') {
|
||||
$params_graphic = [
|
||||
'period' => $params['period'],
|
||||
'date' => strtotime(date('Y-m-d H:i:s')),
|
||||
'only_image' => false,
|
||||
'homeurl' => ui_get_full_url(false, false, false, false).'/',
|
||||
'ttl' => false,
|
||||
'height' => $config['graph_image_height'],
|
||||
'landscape' => $content['landscape'],
|
||||
'return_img_base_64' => true,
|
||||
];
|
||||
|
||||
$params_combined = [
|
||||
'projection' => $params['period_projected'],
|
||||
];
|
||||
|
||||
$return['chart'] = graphic_combined_module(
|
||||
[$params['agent_module_id']],
|
||||
$params_graphic,
|
||||
$params_combined
|
||||
);
|
||||
$output .= '<div class="stat_win_histogram">';
|
||||
if ($params['compare'] === 'separated') {
|
||||
$output .= $return['chart'];
|
||||
$output .= '</div>';
|
||||
} else {
|
||||
if ($params['histogram'] === true) {
|
||||
$params['id_agent_module'] = $params['agent_module_id'];
|
||||
$params['dinamic_proc'] = 1;
|
||||
|
||||
$output .= '<div class="stat_win_histogram">';
|
||||
if ($params['compare'] === 'separated') {
|
||||
$graph = \reporting_module_histogram_graph(
|
||||
['datetime' => ($params['begin_date'] - $params['period'])],
|
||||
$params
|
||||
);
|
||||
$output .= $graph['chart'];
|
||||
}
|
||||
|
||||
$graph = \reporting_module_histogram_graph(
|
||||
['datetime' => ($params['begin_date'] - $params['period'])],
|
||||
['datetime' => $params['begin_date']],
|
||||
$params
|
||||
);
|
||||
$output .= $graph['chart'];
|
||||
$output .= '</div>';
|
||||
} else {
|
||||
$output .= grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
$graph = \reporting_module_histogram_graph(
|
||||
['datetime' => $params['begin_date']],
|
||||
$params
|
||||
);
|
||||
$output .= $graph['chart'];
|
||||
$output .= '</div>';
|
||||
} else {
|
||||
$output .= grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true && empty($server_id) === false) {
|
||||
|
|
|
@ -201,23 +201,8 @@ class AuditLog extends HTML
|
|||
'name' => 'filter_text',
|
||||
],
|
||||
[
|
||||
'label' => __('Max. hours old'),
|
||||
'type' => 'select',
|
||||
'class' => 'w20px',
|
||||
'select2_enable' => true,
|
||||
'sort' => false,
|
||||
'selected' => 168,
|
||||
'fields' => [
|
||||
24 => __('1 day'),
|
||||
168 => __('7 days'),
|
||||
360 => __('15 days'),
|
||||
744 => __('1 month'),
|
||||
2160 => __('3 months'),
|
||||
4320 => __('6 months'),
|
||||
8760 => __('1 Year'),
|
||||
],
|
||||
'id' => 'filter_period',
|
||||
'name' => 'filter_period',
|
||||
'label' => __('Date'),
|
||||
'type' => 'date_range',
|
||||
],
|
||||
[
|
||||
'label' => __('IP'),
|
||||
|
@ -312,10 +297,35 @@ class AuditLog extends HTML
|
|||
$filter .= sprintf(" AND ip_origen LIKE '%%%s%%'", $this->filterIp);
|
||||
}
|
||||
|
||||
if (empty($this->filterPeriod) === false) {
|
||||
$filter .= sprintf(' AND fecha >= DATE_ADD(NOW(), INTERVAL -%d HOUR)', $this->filterPeriod);
|
||||
// Calculate range dates.
|
||||
$custom_date = $filters['custom_date'];
|
||||
if ($custom_date === '1') {
|
||||
$date_from = ($filters['date_init'].' '.$filters['time_init']);
|
||||
$date_to = ($filters['date_end'].' '.$filters['time_end']);
|
||||
} else if ($custom_date === '2') {
|
||||
$period = ($filters['date_text'] * $filters['date_units']);
|
||||
$date_to = date('Y-m-d H:i:s');
|
||||
$date_from = date('Y-m-d H:i:s', (strtotime($date_to) - $period));
|
||||
} else if (in_array($filters['date'], ['this_week', 'this_month', 'past_week', 'past_month'])) {
|
||||
if ($filters['date'] === 'this_week') {
|
||||
$date_from = date('Y-m-d 00:00:00', strtotime('last monday'));
|
||||
$date_to = date('Y-m-d 23:59:59', strtotime($date_from.' +6 days'));
|
||||
} else if ($filters['date'] === 'this_month') {
|
||||
$date_from = date('Y-m-d 23:59:59', strtotime('first day of this month'));
|
||||
$date_to = date('Y-m-d 00:00:00', strtotime('last day of this month'));
|
||||
} else if ($filters['date'] === 'past_month') {
|
||||
$date_from = date('Y-m-d 00:00:00', strtotime('first day of previous month'));
|
||||
$date_to = date('Y-m-d 23:59:59', strtotime('last day of previous month'));
|
||||
} else if ($filters['date'] === 'past_week') {
|
||||
$date_from = date('Y-m-d 00:00:00', strtotime('monday', strtotime('last week')));
|
||||
$date_to = date('Y-m-d 23:59:59', strtotime('sunday', strtotime('last week')));
|
||||
}
|
||||
} else {
|
||||
$date_to = date('Y-m-d H:i:s');
|
||||
$date_from = date('Y-m-d H:i:s', (strtotime($date_to) - $filters['date']));
|
||||
}
|
||||
|
||||
$filter .= sprintf(' AND fecha BETWEEN "%s" AND "%s"', $date_from, $date_to);
|
||||
$count = (int) db_get_value_sql(sprintf('SELECT COUNT(*) as "total" FROM tsesion WHERE %s', $filter));
|
||||
|
||||
if ($length !== '-1') {
|
||||
|
|
|
@ -283,7 +283,8 @@ class ExtensionsDiscovery extends Wizard
|
|||
ui_require_javascript_file('extensions_discovery');
|
||||
$_iniFile = $this->loadIni();
|
||||
if ($_iniFile === false) {
|
||||
include 'general/noaccess.php';
|
||||
// No file .disco.
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('No .disco file found') ]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -549,6 +549,11 @@ class SnmpConsole extends HTML
|
|||
$order = get_datatable_order(true);
|
||||
$filters = get_parameter('filter', []);
|
||||
|
||||
// Build ranges.
|
||||
$now_timestamp = time();
|
||||
$interval_seconds = ($filters['filter_hours_ago'] * 3600);
|
||||
$ago_timestamp = ($now_timestamp - $interval_seconds);
|
||||
|
||||
// Build ranges.
|
||||
$now = new DateTime();
|
||||
$ago = new DateTime();
|
||||
|
@ -688,7 +693,7 @@ class SnmpConsole extends HTML
|
|||
if ($date_from_trap != '') {
|
||||
if ($time_from_trap != '') {
|
||||
$whereSubquery .= '
|
||||
AND (UNIX_TIMESTAMP(timestamp) > UNIX_TIMESTAMP("'.$date_from_trap.' '.$time_from_trap.'"))
|
||||
AND (utimestamp > '.$ago_timestamp.')
|
||||
';
|
||||
} else {
|
||||
$whereSubquery .= '
|
||||
|
@ -700,7 +705,7 @@ class SnmpConsole extends HTML
|
|||
if ($date_to_trap != '') {
|
||||
if ($time_to_trap) {
|
||||
$whereSubquery .= '
|
||||
AND (UNIX_TIMESTAMP(timestamp) < UNIX_TIMESTAMP("'.$date_to_trap.' '.$time_to_trap.'"))
|
||||
AND (utimestamp < '.$now_timestamp.')
|
||||
';
|
||||
} else {
|
||||
$whereSubquery .= '
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC230829';
|
||||
$pandora_version = 'v7.0NG.773.2';
|
||||
$build_version = 'PC230907';
|
||||
$pandora_version = 'v7.0NG.773.3';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -807,6 +807,7 @@ define('AUDIT_LOG_FILE_MANAGER', 'File manager');
|
|||
define('AUDIT_LOG_ALERT_MANAGEMENT', 'Alert management');
|
||||
define('AUDIT_LOG_ALERT_CORRELATION_MANAGEMENT', 'Alert correlation management');
|
||||
define('AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT', 'Visual Console Management');
|
||||
define('AUDIT_LOG_GRAPH_ANALYTICS_PUBLIC', 'Graph Analytics Public');
|
||||
define('AUDIT_LOG_TAG_MANAGEMENT', 'Tag management');
|
||||
define('AUDIT_LOG_SNMP_MANAGEMENT', 'SNMP management');
|
||||
define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management');
|
||||
|
|
|
@ -270,7 +270,8 @@ function format_for_graph(
|
|||
$dec_point='.',
|
||||
$thousands_sep=',',
|
||||
$divider=1000,
|
||||
$sufix=''
|
||||
$sufix='',
|
||||
$two_lines=false
|
||||
) {
|
||||
// Exception to exclude modules whose unit is already formatted as KB (satellite modules)
|
||||
if (!empty($sufix) && $sufix == 'KB') {
|
||||
|
@ -297,6 +298,10 @@ function format_for_graph(
|
|||
}
|
||||
|
||||
// This will actually do the rounding and the decimals.
|
||||
if ($two_lines === true) {
|
||||
return remove_right_zeros(format_numeric($number, $decimals)).'<br>'.$shorts[$pos].$sufix;
|
||||
}
|
||||
|
||||
return remove_right_zeros(format_numeric($number, $decimals)).$shorts[$pos].$sufix;
|
||||
}
|
||||
|
||||
|
@ -4046,25 +4051,49 @@ function series_type_graph_array($data, $show_elements_graph)
|
|||
}
|
||||
} else {
|
||||
$name_legend = '';
|
||||
if (isset($show_elements_graph['fullscale']) === true
|
||||
&& (int) $show_elements_graph['fullscale'] === 1
|
||||
) {
|
||||
$name_legend .= 'Tip: ';
|
||||
} else {
|
||||
$name_legend .= 'Avg: ';
|
||||
}
|
||||
|
||||
if ($value['unit']) {
|
||||
$name_legend .= $value['agent_alias'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= $value['module_name'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= __('Unit ').' ';
|
||||
$name_legend .= $value['unit'].': ';
|
||||
if ($show_elements_graph['graph_analytics'] === true) {
|
||||
$name_legend .= '<div class="graph-analytics-legend-main">';
|
||||
$name_legend .= '<div class="graph-analytics-legend-square" style="background-color: '.$color_series[$i]['color'].';">';
|
||||
$name_legend .= '<span class="square-value">';
|
||||
$name_legend .= format_for_graph(
|
||||
end(end($value['data'])),
|
||||
1,
|
||||
$config['decimal_separator'],
|
||||
$config['thousand_separator'],
|
||||
1000,
|
||||
'',
|
||||
true
|
||||
);
|
||||
$name_legend .= '</span>';
|
||||
$name_legend .= '<span class="square-unit" title="'.$value['unit'].'">'.$value['unit'].'</span>';
|
||||
$name_legend .= '</div>';
|
||||
$name_legend .= '<div class="graph-analytics-legend">';
|
||||
$name_legend .= '<span>'.$value['agent_alias'].'</span>';
|
||||
$name_legend .= '<span title="'.$value['module_name'].'">'.$value['module_name'].'</span>';
|
||||
$name_legend .= '</div>';
|
||||
$name_legend .= '</div>';
|
||||
} else {
|
||||
$name_legend .= $value['agent_alias'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= $value['module_name'].': ';
|
||||
if (isset($show_elements_graph['fullscale']) === true
|
||||
&& (int) $show_elements_graph['fullscale'] === 1
|
||||
) {
|
||||
$name_legend .= 'Tip: ';
|
||||
} else {
|
||||
$name_legend .= 'Avg: ';
|
||||
}
|
||||
|
||||
if ($value['unit']) {
|
||||
$name_legend .= $value['agent_alias'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= $value['module_name'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= __('Unit ').' ';
|
||||
$name_legend .= $value['unit'].': ';
|
||||
} else {
|
||||
$name_legend .= $value['agent_alias'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= $value['module_name'].': ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4085,28 +4114,30 @@ function series_type_graph_array($data, $show_elements_graph)
|
|||
$value['max'] = 0;
|
||||
}
|
||||
|
||||
$data_return['legend'][$key] .= '<span class="legend-font-small">'.__('Min').' </span><span class="bolder">'.remove_right_zeros(
|
||||
number_format(
|
||||
$value['min'],
|
||||
$config['graph_precision'],
|
||||
$config['csv_decimal_separator'],
|
||||
$config['csv_decimal_separator'] == ',' ? '.' : ','
|
||||
)
|
||||
).' '.$value['unit'].'</span> <span class="legend-font-small">'.__('Max').' </span><span class="bolder">'.remove_right_zeros(
|
||||
number_format(
|
||||
$value['max'],
|
||||
$config['graph_precision'],
|
||||
$config['csv_decimal_separator'],
|
||||
$config['csv_decimal_separator'] == ',' ? '.' : ','
|
||||
)
|
||||
).' '.$value['unit'].'</span> <span class="legend-font-small">'._('Avg.').' </span><span class="bolder">'.remove_right_zeros(
|
||||
number_format(
|
||||
$value['avg'],
|
||||
$config['graph_precision'],
|
||||
$config['csv_decimal_separator'],
|
||||
$config['csv_decimal_separator'] == ',' ? '.' : ','
|
||||
)
|
||||
).' '.$value['unit'].'</span> '.$str;
|
||||
if (isset($show_elements_graph['graph_analytics']) === false) {
|
||||
$data_return['legend'][$key] .= '<span class="legend-font-small">'.__('Min').' </span><span class="bolder">'.remove_right_zeros(
|
||||
number_format(
|
||||
$value['min'],
|
||||
$config['graph_precision'],
|
||||
$config['csv_decimal_separator'],
|
||||
$config['csv_decimal_separator'] == ',' ? '.' : ','
|
||||
)
|
||||
).' '.$value['unit'].'</span> <span class="legend-font-small">'.__('Max').' </span><span class="bolder">'.remove_right_zeros(
|
||||
number_format(
|
||||
$value['max'],
|
||||
$config['graph_precision'],
|
||||
$config['csv_decimal_separator'],
|
||||
$config['csv_decimal_separator'] == ',' ? '.' : ','
|
||||
)
|
||||
).' '.$value['unit'].'</span> <span class="legend-font-small">'._('Avg.').' </span><span class="bolder">'.remove_right_zeros(
|
||||
number_format(
|
||||
$value['avg'],
|
||||
$config['graph_precision'],
|
||||
$config['csv_decimal_separator'],
|
||||
$config['csv_decimal_separator'] == ',' ? '.' : ','
|
||||
)
|
||||
).' '.$value['unit'].'</span> '.$str;
|
||||
}
|
||||
|
||||
if ($show_elements_graph['compare'] == 'overlapped'
|
||||
&& $key == 'sum2'
|
||||
|
|
|
@ -1168,6 +1168,10 @@ function config_update_config()
|
|||
$error_update[] = __('Custom title header');
|
||||
}
|
||||
|
||||
if (config_update_value('datepicker_first_day', (string) get_parameter('datepicker_first_day'), true) === false) {
|
||||
$error_update[] = __('Datepicker first day');
|
||||
}
|
||||
|
||||
if (config_update_value('custom_subtitle_header', (string) get_parameter('custom_subtitle_header'), true) === false) {
|
||||
$error_update[] = __('Custom subtitle header');
|
||||
}
|
||||
|
@ -2751,6 +2755,10 @@ function config_process_config()
|
|||
config_update_value('custom_title_header', __('Pandora FMS'));
|
||||
}
|
||||
|
||||
if (!isset($config['datepicker_first_day'])) {
|
||||
config_update_value('datepicker_first_day', '0');
|
||||
}
|
||||
|
||||
if (!isset($config['custom_subtitle_header'])) {
|
||||
config_update_value('custom_subtitle_header', __('the Flexible Monitoring System'));
|
||||
}
|
||||
|
|
|
@ -125,9 +125,22 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
|
|||
if (isset($_FILES['file']) === true && empty($_FILES['file']['name']) === false) {
|
||||
$filename = $_FILES['file']['name'];
|
||||
$real_directory = filemanager_safe_directory($destination_directory);
|
||||
$umask = io_safe_output((string) get_parameter('umask'));
|
||||
$extension = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
|
||||
if (strpos($real_directory, $default_real_directory) !== 0) {
|
||||
$umask = io_safe_output((string) get_parameter('umask'));
|
||||
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
||||
$parse_sec2_query = explode('=', $parse_all_queries[1]);
|
||||
$check_extension = true;
|
||||
if ($parse_sec2_query[1] === 'operation/snmpconsole/snmp_mib_uploader') {
|
||||
if ((strtolower($extension) !== 'mib' && strtolower($extension) !== 'zip')) {
|
||||
$check_extension = false;
|
||||
} else {
|
||||
$check_extension = true;
|
||||
}
|
||||
}
|
||||
|
||||
// (strtolower($extension) !== 'mib' && strtolower($extension) !== 'zip')
|
||||
if (strpos($real_directory, $default_real_directory) !== 0 || $check_extension === false) {
|
||||
// Perform security check to determine whether received upload
|
||||
// directory is part of the default path for caller uploader and
|
||||
// user is not trying to access an external path (avoid
|
||||
|
@ -177,14 +190,31 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
|
|||
|
||||
// Upload zip.
|
||||
if ($upload_zip === true) {
|
||||
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
||||
$parse_sec2_query = explode('=', $parse_all_queries[1]);
|
||||
if (isset($_FILES['file']) === true
|
||||
&& empty($_FILES['file']['name']) === false
|
||||
) {
|
||||
$filename = $_FILES['file']['name'];
|
||||
$filepath = $_FILES['file']['tmp_name'];
|
||||
$real_directory = filemanager_safe_directory($destination_directory);
|
||||
$secure = true;
|
||||
if ($parse_sec2_query[1] === 'operation/snmpconsole/snmp_mib_uploader') {
|
||||
// Security control structure.
|
||||
$zip = new \ZipArchive;
|
||||
if ($zip->open($filepath) === true) {
|
||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||
$unzip_filename = $zip->getNameIndex($i);
|
||||
$extension = pathinfo($unzip_filename, PATHINFO_EXTENSION);
|
||||
if (strtolower($extension) !== 'mib') {
|
||||
$secure = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($real_directory, $default_real_directory) !== 0) {
|
||||
if (strpos($real_directory, $default_real_directory) !== 0 || $secure === false) {
|
||||
// Perform security check to determine whether received upload
|
||||
// directory is part of the default path for caller uploader
|
||||
// and user is not trying to access an external path (avoid
|
||||
|
|
|
@ -5540,3 +5540,23 @@ function graph_events_agent_by_group($id_group, $width=300, $height=200, $noWate
|
|||
$options
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function graph_analytics_filter_select()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$result = [];
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'RW') === 1 || check_acl($config['id_user'], 0, 'RM') === 1) {
|
||||
$filters = db_get_all_rows_sql('SELECT id, filter_name FROM tgraph_analytics_filter WHERE user_id = "'.$config['id_user'].'"');
|
||||
|
||||
if ($filters !== false) {
|
||||
foreach ($filters as $filter) {
|
||||
$result[$filter['id']] = $filter['filter_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -2648,14 +2648,16 @@ function groups_get_heat_map_agents(array $id_group, float $width=0, float $heig
|
|||
*
|
||||
* @return string Html
|
||||
*/
|
||||
function tactical_groups_get_agents_and_monitoring($id_groups)
|
||||
function tactical_groups_get_agents_and_monitoring($id_groups, $data='')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$data = [
|
||||
'total_agents' => groups_agents_total_counters($id_groups, false)['total'],
|
||||
'monitor_total' => groups_get_total_monitors($id_groups, [], [], false, false, false, false),
|
||||
];
|
||||
if ($data === '') {
|
||||
$data = [
|
||||
'total_agents' => groups_agents_total_counters($id_groups, false)['total'],
|
||||
'monitor_total' => groups_get_total_monitors($id_groups, [], [], false, false, false, false),
|
||||
];
|
||||
}
|
||||
|
||||
// Link URLS
|
||||
$urls = [];
|
||||
|
@ -2703,16 +2705,18 @@ function tactical_groups_get_agents_and_monitoring($id_groups)
|
|||
* @param [type] $id_groups
|
||||
* @return string Html.
|
||||
*/
|
||||
function tactical_groups_get_stats_alerts($id_groups)
|
||||
function tactical_groups_get_stats_alerts($id_groups, $data='')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$alerts = groups_monitor_alerts_total_counters($id_groups, false);
|
||||
$data = [
|
||||
'monitor_alerts' => $alerts['total'],
|
||||
'monitor_alerts_fired' => $alerts['fired'],
|
||||
if ($data === '') {
|
||||
$alerts = groups_monitor_alerts_total_counters($id_groups, false);
|
||||
$data = [
|
||||
'monitor_alerts' => $alerts['total'],
|
||||
'monitor_alerts_fired' => $alerts['fired'],
|
||||
|
||||
];
|
||||
];
|
||||
}
|
||||
|
||||
$urls = [];
|
||||
$urls['monitor_alerts'] = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&ag_group='.$id_groups[0];
|
||||
|
@ -2780,17 +2784,19 @@ function tactical_groups_get_stats_alerts($id_groups)
|
|||
* @param boolean $data_agents
|
||||
* @return void
|
||||
*/
|
||||
function groups_get_stats_modules_status($id_groups, $graph_width=250, $graph_height=150, $links=false, $data_agents=false)
|
||||
function groups_get_stats_modules_status($id_groups, $graph_width=250, $graph_height=150, $links=false, $data_agents=false, $data='')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$data = [
|
||||
'monitor_critical' => groups_get_critical_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_warning' => groups_get_warning_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_ok' => groups_get_normal_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_unknown' => groups_get_unknown_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_not_init' => groups_get_not_init_monitors($id_groups, [], [], false, false, false, false),
|
||||
];
|
||||
if ($data === '') {
|
||||
$data = [
|
||||
'monitor_critical' => groups_get_critical_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_warning' => groups_get_warning_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_ok' => groups_get_normal_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_unknown' => groups_get_unknown_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_not_init' => groups_get_not_init_monitors($id_groups, [], [], false, false, false, false),
|
||||
];
|
||||
}
|
||||
|
||||
// Link URLS.
|
||||
if ($links === false) {
|
||||
|
|
|
@ -7228,6 +7228,298 @@ function html_print_code_picker(
|
|||
}
|
||||
|
||||
|
||||
function html_print_select_date_range(
|
||||
$name,
|
||||
$return,
|
||||
$selected=SECONDS_1DAY,
|
||||
$date_init='',
|
||||
$time_init='',
|
||||
$date_end='',
|
||||
$time_end='',
|
||||
$date_text=SECONDS_1DAY,
|
||||
$class='w100p'
|
||||
) {
|
||||
global $config;
|
||||
|
||||
if ($selected === 'custom') {
|
||||
$display_extend = '';
|
||||
$display_range = 'style="display:none"';
|
||||
$display_default = 'style="display:none"';
|
||||
$custom_date = 2;
|
||||
} else if ($selected === 'chose_range') {
|
||||
$display_range = '';
|
||||
$display_default = 'style="display:none"';
|
||||
$display_extend = 'style="display:none"';
|
||||
$custom_date = 1;
|
||||
} else {
|
||||
$display_default = '';
|
||||
$display_range = 'style="display:none"';
|
||||
$display_extend = 'style="display:none"';
|
||||
$custom_date = 0;
|
||||
}
|
||||
|
||||
if ($date_end === '') {
|
||||
$date_end = date('Y/m/d');
|
||||
}
|
||||
|
||||
if ($date_init === '') {
|
||||
$date_init = date('Y/m/d', strtotime($date_end.' -1 days'));
|
||||
}
|
||||
|
||||
if ($time_init === '') {
|
||||
$time_init = date('H:i:s');
|
||||
}
|
||||
|
||||
if ($time_end === '') {
|
||||
$time_end = date('H:i:s');
|
||||
}
|
||||
|
||||
$fields[SECONDS_1DAY] = __('Last 24hr');
|
||||
$fields['this_week'] = __('This week');
|
||||
$fields['this_month'] = __('This month');
|
||||
$fields['past_week'] = __('Past week');
|
||||
$fields['past_month'] = __('Past month');
|
||||
$fields[SECONDS_1WEEK] = __('Last 7 days');
|
||||
$fields[SECONDS_15DAYS] = __('Last 15 days');
|
||||
$fields[SECONDS_1MONTH] = __('Last 30 days');
|
||||
$fields['custom'] = __('Custom');
|
||||
$fields['chose_range'] = __('Chose start/end date period');
|
||||
|
||||
$output = html_print_input_hidden('custom_date', $custom_date, true);
|
||||
$output .= '<div id="'.$name.'_default" class="wauto inline_flex" '.$display_default.'>';
|
||||
$output .= html_print_select(
|
||||
$fields,
|
||||
$name,
|
||||
$selected,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
$class
|
||||
);
|
||||
$output .= '</div>';
|
||||
$output .= '<div id="'.$name.'_range" class="inline_flex" '.$display_range.'>';
|
||||
$table = new stdClass();
|
||||
$table->class = 'table-adv-filter';
|
||||
$table->data[0][0] .= '<div><div><div><span class="font-title-font">'.__('From').':</span></div>';
|
||||
$table->data[0][0] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' ';
|
||||
$table->data[0][0] .= html_print_input_text('time_init', $time_init, '', 10, 7, true).' ';
|
||||
$table->data[0][0] .= '</div>';
|
||||
$table->data[0][0] .= '<div><div><span class="font-title-font">'.__('to').':</span></div>';
|
||||
$table->data[0][0] .= html_print_input_text('date_end', $date_end, '', 12, 10, true).' ';
|
||||
$table->data[0][0] .= '<div id="'.$name.'_manual" class="w100p inline_line">';
|
||||
$table->data[0][0] .= html_print_input_text('time_end', $time_end, '', 10, 7, true).' ';
|
||||
$table->data[0][0] .= ' <a href="javascript:">'.html_print_image(
|
||||
'images/logs@svg.svg',
|
||||
true,
|
||||
[
|
||||
'id' => 'back_default',
|
||||
'class' => ' main_menu_icon invert_filter',
|
||||
'alt' => __('List'),
|
||||
'title' => __('List'),
|
||||
'style' => 'width: 18px;',
|
||||
]
|
||||
).'</a>';
|
||||
$table->data[0][0] .= '</div></div>';
|
||||
$output .= html_print_table($table, true);
|
||||
$output .= '</div>';
|
||||
|
||||
$units = [
|
||||
1 => __('seconds'),
|
||||
SECONDS_1MINUTE => __('minutes'),
|
||||
SECONDS_1HOUR => __('hours'),
|
||||
SECONDS_1DAY => __('days'),
|
||||
SECONDS_1WEEK => __('weeks'),
|
||||
SECONDS_1MONTH => __('months'),
|
||||
SECONDS_1YEAR => __('years'),
|
||||
];
|
||||
$output .= '<div id="'.$name.'_extend" class="w100p inline_flex" '.$display_extend.'>';
|
||||
$output .= html_print_input_text($name.'_text', $date_text, '', false, 255, true);
|
||||
$output .= html_print_select(
|
||||
$units,
|
||||
$name.'_units',
|
||||
'1',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
' margin-left: 5px; width: 140px;',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$output .= ' <a href="javascript:">'.html_print_image(
|
||||
'images/logs@svg.svg',
|
||||
true,
|
||||
[
|
||||
'id' => 'back_default_extend',
|
||||
'class' => $name.'_toggler main_menu_icon invert_filter',
|
||||
'alt' => __('List'),
|
||||
'title' => __('List'),
|
||||
'style' => 'width: 18px;margin-bottom: -5px; padding-top: 10px;',
|
||||
]
|
||||
).'</a>';
|
||||
$output .= '</div>';
|
||||
ui_include_time_picker();
|
||||
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
|
||||
$output .= "<script type='text/javascript'>
|
||||
$(document).ready (function () {
|
||||
$('#".$name."').change(function(){
|
||||
if ($(this).val() === 'chose_range') {
|
||||
$('#".$name."_range').show();
|
||||
$('#".$name."_default').hide();
|
||||
$('#".$name."_extend').hide();
|
||||
$('#hidden-custom_date').val('1');
|
||||
} else if ($(this).val() === 'custom') {
|
||||
$('#".$name."_range').hide();
|
||||
$('#".$name."_default').hide();
|
||||
$('#".$name."_extend').show();
|
||||
$('#hidden-custom_date').val('2');
|
||||
}
|
||||
});
|
||||
|
||||
$('#back_default, #back_default_extend').click(function(){
|
||||
display_default();
|
||||
});
|
||||
|
||||
// To get position must to be showed, hide elements return 0 on offset function.
|
||||
$('#".$name."_range').show();
|
||||
$('#".$name."_default').hide();
|
||||
$('#".$name."_extend').hide();
|
||||
position_top_init = $('#text-date_init').offset().top + $('#text-date_init').outerHeight();
|
||||
position_top_end = $('#text-date_end').offset().top + $('#text-date_end').outerHeight();
|
||||
$('#".$name."_range').hide();
|
||||
$('#".$name."_extend').hide();
|
||||
$('#".$name."_default').show();
|
||||
});
|
||||
|
||||
var position_top_init = 0;
|
||||
var position_top_end = 0;
|
||||
|
||||
function display_default(){
|
||||
$('#".$name."_default').show();
|
||||
$('#".$name."_range').hide();
|
||||
$('#".$name."_extend').hide();
|
||||
$('#".$name."').val('".SECONDS_1DAY."').trigger('change');
|
||||
$('#hidden-custom_date').val('0');
|
||||
}
|
||||
|
||||
$('#text-date').datepicker({
|
||||
dateFormat: '".DATE_FORMAT_JS."',
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
showAnim: 'slideDown'
|
||||
});
|
||||
|
||||
$('[id^=text-time_init]').timepicker({
|
||||
showSecond: true,
|
||||
timeFormat: '".TIME_FORMAT_JS."',
|
||||
timeOnlyTitle: '".__('Choose time')."',
|
||||
timeText: '".__('Time')."',
|
||||
hourText: '".__('Hour')."',
|
||||
minuteText: '".__('Minute')."',
|
||||
secondText: '".__('Second')."',
|
||||
currentText: '".__('Now')."',
|
||||
closeText: '".__('Close')."'
|
||||
});
|
||||
|
||||
$('[id^=text-date_init]').datepicker ({
|
||||
dateFormat: '".DATE_FORMAT_JS."',
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
showAnim: 'slideDown',
|
||||
firstDay: ".$config['datepicker_first_day'].",
|
||||
beforeShowDay: function (date) {
|
||||
show_datepicker = 'date_init';
|
||||
var date_now = date.getTime();
|
||||
var date_ini_split = $('[id^=text-date_init]').val().split('/');
|
||||
var date_ini = new Date(date_ini_split[1]+'/'+date_ini_split[2]+'/'+date_ini_split[0]).getTime();
|
||||
var date_end_split = $('[id^=text-date_end]').val().split('/');
|
||||
var date_end = new Date(date_end_split[1]+'/'+date_end_split[2]+'/'+date_end_split[0]).getTime();
|
||||
if (date_now > date_ini && date_now < date_end) {
|
||||
return [true, 'ui-date-range-in', 'prueba'];
|
||||
} else if (date_now == date_ini || date_now == date_end){
|
||||
return [true, 'ui-datepicker-current-day', ''];
|
||||
}
|
||||
return [true, '', ''];
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=text-date_end]').datepicker ({
|
||||
dateFormat: '".DATE_FORMAT_JS."',
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
showAnim: 'slideDown',
|
||||
firstDay: ".$config['datepicker_first_day'].",
|
||||
beforeShowDay: function (date) {
|
||||
show_datepicker = 'date_end';
|
||||
var date_now = date.getTime();
|
||||
var date_ini_split = $('[id^=text-date_init]').val().split('/');
|
||||
var date_ini = new Date(date_ini_split[1]+'/'+date_ini_split[2]+'/'+date_ini_split[0]).getTime();
|
||||
var date_end_split = $('[id^=text-date_end]').val().split('/');
|
||||
var date_end = new Date(date_end_split[1]+'/'+date_end_split[2]+'/'+date_end_split[0]).getTime();
|
||||
if (date_now > date_ini && date_now < date_end) {
|
||||
return [true, 'ui-date-range-in', 'prueba'];
|
||||
} else if (date_now == date_ini || date_now == date_end){
|
||||
return [true, 'ui-datepicker-current-day', ''];
|
||||
}
|
||||
return [true, '', ''];
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=text-time_end]').timepicker({
|
||||
showSecond: true,
|
||||
timeFormat: '".TIME_FORMAT_JS."',
|
||||
timeOnlyTitle: '".__('Choose time')."',
|
||||
timeText: '".__('Time')."',
|
||||
hourText: '".__('Hour')."',
|
||||
minuteText: '".__('Minute')."',
|
||||
secondText: '".__('Second')."',
|
||||
currentText: '".__('Now')."',
|
||||
closeText: '".__('Close')."'
|
||||
});
|
||||
|
||||
$(window).scroll(function(e){
|
||||
if ($('#date option:selected').val() == 'chose_range'){
|
||||
if ($('#ui-datepicker-div').html() !== '') {
|
||||
if ($(this).scrollTop() > 0){
|
||||
var css_datepicker = $('#ui-datepicker-div').attr('style').replace('absolute','fixed');
|
||||
if (!css_datepicker.includes('px !important')) {
|
||||
if (show_datepicker == 'date_end'){
|
||||
css_datepicker += '; top: '+position_top_end+'px !important';
|
||||
} else {
|
||||
css_datepicker += '; top: '+position_top_init+'px !important';
|
||||
}
|
||||
}
|
||||
$('#ui-datepicker-div').attr('style', css_datepicker);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>";
|
||||
|
||||
if ($return === true) {
|
||||
return $output;
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function html_print_wizard_diagnosis(
|
||||
$title,
|
||||
$id_button,
|
||||
|
@ -7266,4 +7558,5 @@ function html_print_wizard_diagnosis(
|
|||
} else {
|
||||
echo $output;
|
||||
}
|
||||
|
||||
}
|
|
@ -31,6 +31,7 @@ function inventory_get_data(
|
|||
$agents_ids,
|
||||
$inventory_module_name,
|
||||
$utimestamp,
|
||||
$period,
|
||||
$inventory_search_string='',
|
||||
$export_csv=false,
|
||||
$return_mode=false,
|
||||
|
@ -97,7 +98,7 @@ function inventory_get_data(
|
|||
|
||||
// Prepare pagination.
|
||||
$url = sprintf(
|
||||
'?sec=estado&sec2=operation/inventory/inventory&agent_id=%s&agent=%s&id_group=%s&export=%s&module_inventory_general_view=%s&search_string=%s&utimestamp=%s&order_by_agent=%s&submit_filter=%d',
|
||||
'?sec=estado&sec2=operation/inventory/inventory&agent_id=%s&agent=%s&id_group=%s&export=%s&module_inventory_general_view=%s&search_string=%s&utimestamp=%s&period=%s&order_by_agent=%s&submit_filter=%d',
|
||||
$pagination_url_parameters['inventory_id_agent'],
|
||||
$pagination_url_parameters['inventory_agent'],
|
||||
$pagination_url_parameters['inventory_id_group'],
|
||||
|
@ -105,6 +106,7 @@ function inventory_get_data(
|
|||
$inventory_module_name,
|
||||
$inventory_search_string,
|
||||
$utimestamp,
|
||||
$period,
|
||||
$order_by_agent,
|
||||
1
|
||||
);
|
||||
|
@ -328,7 +330,7 @@ function inventory_get_data(
|
|||
$timestamp = db_get_value_sql(
|
||||
"SELECT timestamp
|
||||
FROM tagente_datos_inventory
|
||||
WHERE utimestamp = $utimestamp"
|
||||
WHERE utimestamp BETWEEN '".($utimestamp - $period)."' AND '".$utimestamp."'"
|
||||
);
|
||||
} else {
|
||||
$timestamp = db_get_value_sql(
|
||||
|
@ -892,6 +894,14 @@ function get_data_basic_info_sql($params, $count=false)
|
|||
);
|
||||
}
|
||||
|
||||
if ($params['utimestamp'] > 0 && $count === false) {
|
||||
$where .= sprintf(
|
||||
' AND utimestamp BETWEEN %d AND %d',
|
||||
($params['utimestamp'] - $params['period']),
|
||||
$params['utimestamp']
|
||||
);
|
||||
}
|
||||
|
||||
if ($params['order'] > 0) {
|
||||
$str_split = explode(' ', $params['order']);
|
||||
switch ($str_split[0]) {
|
||||
|
|
|
@ -143,6 +143,10 @@ function menu_print_menu(&$menu)
|
|||
if (empty($new_msg) === false) {
|
||||
$sec2 = 'operation/messages/message_edit&new_msg='.$new_msg;
|
||||
}
|
||||
} else if ($sec2 === 'enterprise/godmode/servers/credential_boxes_satellite'
|
||||
|| $sec2 === 'enterprise/godmode/servers/manage_credential_boxes'
|
||||
) {
|
||||
$sec2 = 'enterprise/godmode/servers/list_satellite';
|
||||
} else {
|
||||
$sec2 = (string) get_parameter('sec2');
|
||||
}
|
||||
|
|
|
@ -621,15 +621,15 @@ function reporting_html_top_n_checks_failed($table, $item)
|
|||
{
|
||||
global $config;
|
||||
$table->rowclass[0] = '';
|
||||
$table->data[1][0] = '<b>'.__('Id').'</b>';
|
||||
$table->data[1][1] = '<b>'.__('Title').'</b>';
|
||||
$table->data[1][2] = '<b>'.__('Total Failed').'</b>';
|
||||
$table->data[1][3] = '<b>'.__('Description').'</b>';
|
||||
|
||||
$row = 2;
|
||||
foreach ($item['data'] as $key => $check) {
|
||||
$table->data[$row][0] = $check['id'];
|
||||
$table->data[$row][1] = $check['title'];
|
||||
$table->data[$row][2] = $check['total'];
|
||||
$table->data[$row][3] = $check['description'];
|
||||
$row++;
|
||||
}
|
||||
}
|
||||
|
@ -2781,7 +2781,237 @@ function reporting_html_group_report($table, $item, $pdf=0)
|
|||
|
||||
$table->colspan['group_report']['cell'] = 3;
|
||||
$table->cellstyle['group_report']['cell'] = 'text-align: center;';
|
||||
$data = "<table class='info_table' width='100%'>
|
||||
$metaconsole_connected = false;
|
||||
if (is_metaconsole() === true) {
|
||||
$connection = metaconsole_get_connection($item['server_name']);
|
||||
if (metaconsole_connect($connection) == NOERR) {
|
||||
$metaconsole_connected = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($item['subtitle'] === 'All') {
|
||||
$group_id = [];
|
||||
$all_group_id = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo');
|
||||
|
||||
foreach ($all_group_id as $group) {
|
||||
$group_id[] = $group['id_grupo'];
|
||||
}
|
||||
|
||||
$description = __('Data view of all groups');
|
||||
$icon = '';
|
||||
|
||||
$group_events = db_get_all_rows_sql(
|
||||
'SELECT COUNT(te.id_evento) as count_events, ta.alias
|
||||
FROM tevento as te
|
||||
INNER JOIN tagente as ta ON te.id_agente = ta.id_agente
|
||||
GROUP BY te.id_agente'
|
||||
);
|
||||
|
||||
$group_os = db_get_all_rows_sql(
|
||||
'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
|
||||
FROM tconfig_os as os
|
||||
INNER JOIN tagente as ta ON ta.id_os = os.id_os GROUP by os.name'
|
||||
);
|
||||
} else {
|
||||
$group_id = db_get_value('id_grupo', 'tgrupo', 'nombre', $item['subtitle']);
|
||||
$description = db_get_value('description', 'tgrupo', 'id_grupo', $group_id);
|
||||
$icon_url = db_get_value('icon', 'tgrupo', 'id_grupo', $group_id);
|
||||
$icon = html_print_image(
|
||||
'images/'.$icon_url,
|
||||
true,
|
||||
[
|
||||
'title' => $item['subtitle'],
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
);
|
||||
|
||||
$childrens = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo WHERE parent = '.$group_id);
|
||||
$total_agents = db_get_all_rows_sql('SELECT COUNT(id_agente) as total FROM tagente where id_grupo = '.$group_id);
|
||||
|
||||
if ($childrens !== false && (int) $total_agents[0]['total'] !== $item['data']['group_stats']['total_agents']) {
|
||||
$array_group_id = [];
|
||||
$array_group_id[] = $group_id;
|
||||
foreach ($childrens as $group) {
|
||||
$array_group_id[] = $group['id_grupo'];
|
||||
}
|
||||
|
||||
$group_id = $array_group_id;
|
||||
$explode_group_id = implode(',', $group_id);
|
||||
} else {
|
||||
$explode_group_id = $group_id;
|
||||
}
|
||||
|
||||
$group_events = db_get_all_rows_sql(
|
||||
'SELECT COUNT(te.id_evento) as count_events, ta.alias
|
||||
FROM tevento as te
|
||||
INNER JOIN tagente as ta ON te.id_agente = ta.id_agente WHERE te.id_grupo IN ('.$explode_group_id.')
|
||||
GROUP BY te.id_agente'
|
||||
);
|
||||
|
||||
$group_os = db_get_all_rows_sql(
|
||||
'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
|
||||
FROM tconfig_os as os
|
||||
INNER JOIN tagente as ta ON ta.id_os = os.id_os
|
||||
WHERE ta.id_grupo IN ('.$explode_group_id.') GROUP by os.name'
|
||||
);
|
||||
}
|
||||
|
||||
if ($metaconsole_connected === true) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$graph_width = 280;
|
||||
$graph_height = 250;
|
||||
|
||||
$out = '<table width="100%" class="info_table">';
|
||||
$out .= '<tbody>';
|
||||
$out .= '<tr>';
|
||||
|
||||
$out .= '<td>';
|
||||
$out .= '<fieldset class="databox tactical_set" id="group_view_'.$item['subtitle'].'">
|
||||
<legend>'.$item['subtitle'].' '.$icon.'</legend>';
|
||||
|
||||
$out .= '<table class="info_table group_view_table">';
|
||||
$out .= '<tr>';
|
||||
$out .= '<td style="word-wrap:break-word; text-align: left;">
|
||||
<fieldset>
|
||||
<legend>'.__('Group Description').'</legend> '.$description.'</fieldset>
|
||||
</td>';
|
||||
$out .= '<td>';
|
||||
|
||||
$data = [
|
||||
'monitor_alerts' => $item['data']['group_stats']['monitor_alerts'],
|
||||
'monitor_alerts_fired' => $item['data']['group_stats']['monitor_alerts_fired'],
|
||||
|
||||
];
|
||||
|
||||
$out .= tactical_groups_get_stats_alerts($group_id, $data);
|
||||
$out .= '</td>';
|
||||
$out .= '</tr>';
|
||||
$out .= '<tr>';
|
||||
$out .= '<td>';
|
||||
|
||||
$data = [
|
||||
'total_agents' => $item['data']['group_stats']['total_agents'],
|
||||
'monitor_total' => $item['data']['group_stats']['monitor_checks'],
|
||||
];
|
||||
|
||||
$out .= tactical_groups_get_agents_and_monitoring($group_id, $data);
|
||||
$out .= '</td>';
|
||||
$out .= '<td>';
|
||||
|
||||
$data = [
|
||||
'monitor_critical' => $item['data']['group_stats']['monitor_critical'],
|
||||
'monitor_warning' => $item['data']['group_stats']['monitor_warning'],
|
||||
'monitor_ok' => $item['data']['group_stats']['monitor_ok'],
|
||||
'monitor_unknown' => $item['data']['group_stats']['monitor_unknown'],
|
||||
'monitor_not_init' => $item['data']['group_stats']['monitor_not_init'],
|
||||
];
|
||||
$out .= groups_get_stats_modules_status($group_id, 250, 150, false, false, $data);
|
||||
$out .= '</td>';
|
||||
$out .= '</tr>';
|
||||
$out .= '<tr>';
|
||||
$out .= '</td>';
|
||||
$out .= '<td><fieldset><legend>'.__('Events per agent').'</legend>';
|
||||
$data = [];
|
||||
$options = [];
|
||||
$labels = [];
|
||||
|
||||
foreach ($group_events as $value) {
|
||||
$data[$value['alias']] = $value['count_events'];
|
||||
$labels[] = io_safe_output($value['alias']);
|
||||
}
|
||||
|
||||
if ($pdf !== 0) {
|
||||
$ttl = 2;
|
||||
} else {
|
||||
$ttl = 0;
|
||||
}
|
||||
|
||||
$options = [
|
||||
'width' => $graph_width,
|
||||
'height' => $graph_height,
|
||||
'legend' => ['display' => false],
|
||||
'labels' => $labels,
|
||||
'ttl' => $ttl,
|
||||
'legend' => [
|
||||
'display' => true,
|
||||
'position' => 'top',
|
||||
'align' => 'center',
|
||||
],
|
||||
];
|
||||
|
||||
$out .= '<div id="events_per_agent_pie" style="height: '.$graph_height.'px">';
|
||||
if ((int) $ttl === 2) {
|
||||
$out .= '<img src="data:image/png;base64,';
|
||||
} else {
|
||||
$out .= '<div id="status_pie" style="margin: auto; width: '.$graph_width.'px;">';
|
||||
}
|
||||
|
||||
$out .= pie_graph($data, $options);
|
||||
if ((int) $ttl === 2) {
|
||||
$out .= '" />';
|
||||
} else {
|
||||
$out .= '</div>';
|
||||
}
|
||||
|
||||
$out .= '</div>';
|
||||
$out .= '</fieldset>';
|
||||
$out .= '</td>';
|
||||
$out .= '<td><fieldset><legend>'.__('Distribution by OS').'</legend>';
|
||||
|
||||
$data = [];
|
||||
$options = [];
|
||||
$labels = [];
|
||||
foreach ($group_os as $value) {
|
||||
$data[$value['name_os']] = $value['count_os'];
|
||||
$labels[] = io_safe_output($value['name_os']);
|
||||
}
|
||||
|
||||
$options = [
|
||||
'width' => $graph_width,
|
||||
'height' => $graph_height,
|
||||
'legend' => ['display' => false],
|
||||
'labels' => $labels,
|
||||
'ttl' => $ttl,
|
||||
'legend' => [
|
||||
'display' => true,
|
||||
'position' => 'top',
|
||||
'align' => 'center',
|
||||
],
|
||||
];
|
||||
|
||||
$out .= '<div id="group_os_pie" style="height: '.$graph_height.'px">';
|
||||
if ((int) $ttl === 2) {
|
||||
$out .= '<img src="data:image/png;base64,';
|
||||
} else {
|
||||
$out .= '<div id="status_pie" style="margin: auto; width: '.$graph_width.'px;">';
|
||||
}
|
||||
|
||||
$out .= pie_graph($data, $options);
|
||||
if ((int) $ttl === 2) {
|
||||
$out .= '" />';
|
||||
} else {
|
||||
$out .= '</div>';
|
||||
}
|
||||
|
||||
$out .= '</div>';
|
||||
$out .= '</fieldset>';
|
||||
$out .= '</td>';
|
||||
$out .= '</tr>';
|
||||
$out .= '</table>';
|
||||
|
||||
$out .= '</fieldset>';
|
||||
$out .= '</td>';
|
||||
$out .= '<td>';
|
||||
$out .= '</td>';
|
||||
$out .= '</td>';
|
||||
$out .= '</tr>';
|
||||
$out .= '</tbody>';
|
||||
$out .= '</table>';
|
||||
|
||||
/*
|
||||
$data = "<table class='info_table' width='100%'>
|
||||
<tbody><tr>
|
||||
<td></td>
|
||||
<td colspan='3' class='cellBold cellCenter'>".__('Total')."</td>
|
||||
|
@ -2824,12 +3054,12 @@ function reporting_html_group_report($table, $item, $pdf=0)
|
|||
<td class='cellBold cellCenter'>".__('Events (not validated)')."</td>
|
||||
<td colspan='6' class='cellBold cellCenter cellWhite cellBorder1 cellBig'>".$item['data']['count_events'].'</td>
|
||||
</tr></tbody>
|
||||
</table>';
|
||||
</table>';*/
|
||||
|
||||
$table->data['group_report']['cell'] = $data;
|
||||
$table->data['group_report']['cell'] = $out;
|
||||
|
||||
if ($pdf !== 0) {
|
||||
return $data;
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3913,6 +3913,15 @@ function ui_print_datatable(array $parameters)
|
|||
$parameters['toggle_collapsed'] = true;
|
||||
}
|
||||
|
||||
$columns_tmp = [];
|
||||
foreach ($parameters['columns'] as $k_column => $v_column) {
|
||||
if (isset($parameters['columns'][$k_column]['text']) === true) {
|
||||
array_push($columns_tmp, $v_column['text']);
|
||||
} else {
|
||||
array_push($columns_tmp, $v_column);
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($parameters['order'])) {
|
||||
$order = 0;
|
||||
$direction = 'asc';
|
||||
|
@ -3926,7 +3935,7 @@ function ui_print_datatable(array $parameters)
|
|||
} else {
|
||||
$order = array_search(
|
||||
$parameters['order']['field'],
|
||||
$parameters['columns']
|
||||
$columns_tmp
|
||||
);
|
||||
|
||||
if ($order === false) {
|
||||
|
@ -3943,7 +3952,7 @@ function ui_print_datatable(array $parameters)
|
|||
foreach ($parameters['no_sortable_columns'] as $key => $find) {
|
||||
$found = array_search(
|
||||
$parameters['no_sortable_columns'][$key],
|
||||
$parameters['columns']
|
||||
$columns_tmp
|
||||
);
|
||||
|
||||
if ($found !== false) {
|
||||
|
@ -4013,7 +4022,11 @@ function ui_print_datatable(array $parameters)
|
|||
$filter .= '<ul class="datatable_filter content filter_table no_border">';
|
||||
|
||||
foreach ($parameters['form']['inputs'] as $input) {
|
||||
$filter .= html_print_input(($input + ['return' => true]), 'li');
|
||||
if ($input['type'] === 'date_range') {
|
||||
$filter .= '<li><label>'.$input['label'].'</label>'.html_print_select_date_range('date', true).'</li>';
|
||||
} else {
|
||||
$filter .= html_print_input(($input + ['return' => true]), 'li');
|
||||
}
|
||||
}
|
||||
|
||||
$filter .= '</ul>';
|
||||
|
@ -4165,11 +4178,7 @@ function ui_print_datatable(array $parameters)
|
|||
$parameters['dataElements'] = json_encode($parameters['data_element']);
|
||||
|
||||
// * START JAVASCRIPT.
|
||||
if (is_metaconsole() === false) {
|
||||
$file_path = 'include/javascript/datatablesFunction.js';
|
||||
} else {
|
||||
$file_path = '../../include/javascript/datatablesFunction.js';
|
||||
}
|
||||
$file_path = $config['homedir'].'/include/javascript/datatablesFunction.js';
|
||||
|
||||
$file_content = file_get_contents($file_path);
|
||||
$json_data = json_encode($parameters);
|
||||
|
@ -4229,18 +4238,17 @@ function ui_print_datatable(array $parameters)
|
|||
false
|
||||
);
|
||||
$output .= '?v='.$config['current_package'].'"/>';
|
||||
if (is_metaconsole() === true) {
|
||||
// Load meta_tables.css.
|
||||
$output .= '<link rel="stylesheet" href="';
|
||||
$output .= ui_get_full_url(
|
||||
ENTERPRISE_DIR.'/include/styles/meta_tables.css',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$output .= '?v='.$config['current_package'].'"/>';
|
||||
}
|
||||
|
||||
// if (is_metaconsole() === true) {
|
||||
// Load meta_tables.css.
|
||||
// $output .= '<link rel="stylesheet" href="';
|
||||
// $output .= ui_get_full_url(
|
||||
// ENTERPRISE_DIR.'/include/styles/meta_tables.css',
|
||||
// false,
|
||||
// false,
|
||||
// false
|
||||
// );
|
||||
// $output .= '?v='.$config['current_package'].'"/>';
|
||||
// }
|
||||
// Load datatables.js.
|
||||
$output .= '<script src="';
|
||||
$output .= ui_get_full_url(
|
||||
|
@ -4516,7 +4524,8 @@ function ui_toggle(
|
|||
$switch_on=null,
|
||||
$switch_name=null,
|
||||
$disableToggle=false,
|
||||
$id_table=false
|
||||
$id_table=false,
|
||||
$position_tgl_div=false
|
||||
) {
|
||||
// Generate unique Id.
|
||||
$uniqid = uniqid('');
|
||||
|
@ -4635,6 +4644,11 @@ function ui_toggle(
|
|||
}
|
||||
|
||||
if ($disableToggle === false) {
|
||||
$position_div = 'relative';
|
||||
if ($position_tgl_div !== false) {
|
||||
$position_div = $position_tgl_div;
|
||||
}
|
||||
|
||||
// JQuery Toggle.
|
||||
$output .= '<script type="text/javascript">'."\n";
|
||||
$output .= ' var hide_tgl_ctrl_'.$uniqid.' = '.(int) $hidden_default.";\n";
|
||||
|
@ -4659,7 +4673,7 @@ function ui_toggle(
|
|||
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
|
||||
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
|
||||
$output .= " $('#tgl_div_".$uniqid."').css('height', 'auto');\n";
|
||||
$output .= " $('#tgl_div_".$uniqid."').css('position', 'relative');\n";
|
||||
$output .= " $('#tgl_div_".$uniqid."').css('position', '".$position_div."');\n";
|
||||
$output .= " $('#image_".$uniqid."').attr('style', 'rotate: ".$rotateA."');\n";
|
||||
$output .= " $('#checkbox-".$switch_name."').prop('checked', true);\n";
|
||||
$output .= $class_table;
|
||||
|
@ -7088,7 +7102,7 @@ function ui_print_breadcrums($tab_name)
|
|||
*
|
||||
* @return string HTML string with the last comment of the events.
|
||||
*/
|
||||
function ui_print_comments($comments, $truncate_limit=255)
|
||||
function ui_print_comments($comment, $truncate_limit=255)
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
|
|
@ -46,6 +46,18 @@ $hash = get_parameter('hash');
|
|||
$file_raw = get_parameter('file');
|
||||
|
||||
$file = base64_decode(urldecode($file_raw));
|
||||
$secure_extension = true;
|
||||
$extension = pathinfo($file, PATHINFO_EXTENSION);
|
||||
if ($extension === 'php' || $extension === 'js') {
|
||||
$secure_extension = false;
|
||||
}
|
||||
|
||||
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
||||
$parse_sec2_query = explode('=', $parse_all_queries[1]);
|
||||
$dirname = dirname($file);
|
||||
|
||||
$path_traversal = strpos($file, '../');
|
||||
|
||||
// Avoid possible inifite loop with referer.
|
||||
if (isset($_SERVER['HTTP_ORIGIN']) === false || (isset($_SERVER['HTTP_ORIGIN']) === true && $_SERVER['HTTP_REFERER'] === $_SERVER['HTTP_ORIGIN'].$_SERVER['REQUEST_URI'])) {
|
||||
$refererPath = ui_get_full_url('index.php');
|
||||
|
@ -53,12 +65,13 @@ if (isset($_SERVER['HTTP_ORIGIN']) === false || (isset($_SERVER['HTTP_ORIGIN'])
|
|||
$refererPath = $_SERVER['HTTP_REFERER'];
|
||||
}
|
||||
|
||||
if (empty($file) === true || empty($hash) === true || $hash !== md5($file_raw.$config['server_unique_identifier']) || isset($_SERVER['HTTP_REFERER']) === false) {
|
||||
if (empty($file) === true || empty($hash) === true || $hash !== md5($file_raw.$config['server_unique_identifier'])
|
||||
|| isset($_SERVER['HTTP_REFERER']) === false || $path_traversal !== false || $secure_extension === false
|
||||
) {
|
||||
$errorMessage = __('Security error. Please contact the administrator.');
|
||||
} else {
|
||||
$downloadable_file = '';
|
||||
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
||||
$parse_sec2_query = explode('=', $parse_all_queries[1]);
|
||||
|
||||
// Metaconsole have a route distinct than node.
|
||||
$main_file_manager = (is_metaconsole() === true) ? 'advanced/metasetup' : 'godmode/setup/file_manager';
|
||||
$main_collections = (is_metaconsole() === true) ? 'advanced/collections' : 'enterprise/godmode/agentes/collections';
|
||||
|
@ -70,7 +83,9 @@ if (empty($file) === true || empty($hash) === true || $hash !== md5($file_raw.$c
|
|||
break;
|
||||
|
||||
case 'extensions/files_repo':
|
||||
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/files_repo/'.$file;
|
||||
$attachment_path = io_safe_output($config['attachment_store']);
|
||||
$downloadable_file = $attachment_path.'/files_repo/'.$file;
|
||||
// $downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/files_repo/'.$file;
|
||||
break;
|
||||
|
||||
case 'godmode/servers/plugin':
|
||||
|
@ -81,6 +96,9 @@ if (empty($file) === true || empty($hash) === true || $hash !== md5($file_raw.$c
|
|||
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/collection/'.$file;
|
||||
break;
|
||||
|
||||
case 'godmode/setup/file_manager':
|
||||
$downloadable_file = ($dirname === 'image') ? $_SERVER['DOCUMENT_ROOT'].'/pandora_console/'.$file : '';
|
||||
|
||||
default:
|
||||
// Wrong action.
|
||||
$downloadable_file = '';
|
||||
|
|
|
@ -943,17 +943,25 @@ function pandoraFlotSlicebar(
|
|||
|
||||
// Format functions
|
||||
function xFormatter(v) {
|
||||
// var ct = new Date();
|
||||
var ct = new timezoneJS.Date();
|
||||
ct.setTimezone(phpTimezone);
|
||||
var ct;
|
||||
if (typeof timezoneJS === "undefined") {
|
||||
ct = new Date();
|
||||
} else {
|
||||
ct = new timezoneJS.Date();
|
||||
ct.setTimezone(phpTimezone);
|
||||
}
|
||||
|
||||
var currentTime = ct.getTime();
|
||||
|
||||
var diffDates = (currentTime - 1000 * datelimit) / 1000;
|
||||
|
||||
// var d = new Date(1000 * (v + datelimit));
|
||||
var d = new timezoneJS.Date(1000 * (v + datelimit));
|
||||
d.setTimezone(phpTimezone);
|
||||
var d;
|
||||
if (typeof timezoneJS === "undefined") {
|
||||
d = new Date(1000 * (v + datelimit));
|
||||
} else {
|
||||
d = new timezoneJS.Date(1000 * (v + datelimit));
|
||||
d.setTimezone(phpTimezone);
|
||||
}
|
||||
|
||||
var monthNames = [
|
||||
"Jan",
|
||||
|
@ -995,6 +1003,9 @@ function pandoraFlotSlicebar(
|
|||
}
|
||||
}
|
||||
|
||||
// Set array for realtime graphs
|
||||
var realtimeGraphs = [];
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function pandoraFlotArea(
|
||||
graph_id,
|
||||
|
@ -1007,6 +1018,21 @@ function pandoraFlotArea(
|
|||
params,
|
||||
events_array
|
||||
) {
|
||||
// Realtime graphs.
|
||||
if (typeof params.realtime !== "undefined") {
|
||||
realtimeGraphs.push({
|
||||
graph_id,
|
||||
values,
|
||||
legend,
|
||||
series_type,
|
||||
color,
|
||||
date_array,
|
||||
data_module_graph,
|
||||
params,
|
||||
events_array
|
||||
});
|
||||
}
|
||||
|
||||
//diferents vars
|
||||
var unit = params.unit ? params.unit : "";
|
||||
var homeurl = params.homeurl;
|
||||
|
@ -2462,15 +2488,23 @@ function pandoraFlotArea(
|
|||
if (Object.keys(update_legend).length == 0) {
|
||||
label_aux = legend[series.label];
|
||||
|
||||
$("#legend_" + graph_id + " .legendLabel")
|
||||
.eq(i)
|
||||
.html(
|
||||
label_aux +
|
||||
" value = " +
|
||||
number_format(y, 0, "", short_data, divisor) +
|
||||
" " +
|
||||
unit
|
||||
);
|
||||
if (params.graph_analytics === true) {
|
||||
var numberParams = {};
|
||||
numberParams.twoLines = true;
|
||||
$("#legend_" + graph_id + " .legendLabel .square-value")
|
||||
.eq(i)
|
||||
.html(number_format(y, 0, "", 1, divisor, numberParams));
|
||||
} else {
|
||||
$("#legend_" + graph_id + " .legendLabel")
|
||||
.eq(i)
|
||||
.html(
|
||||
label_aux +
|
||||
" value = " +
|
||||
number_format(y, 0, "", short_data, divisor) +
|
||||
" " +
|
||||
unit
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$.each(update_legend, function(index, value) {
|
||||
if (typeof value[x - 1] !== "undefined") {
|
||||
|
@ -2844,12 +2878,16 @@ function pandoraFlotArea(
|
|||
// Add bottom margin in the legend
|
||||
// Estimated height of 24 (works fine with this data in all browsers)
|
||||
$("#legend_" + graph_id).css("margin-bottom", "10px");
|
||||
parent_height = parseInt(
|
||||
$("#menu_" + graph_id)
|
||||
.parent()
|
||||
.css("height")
|
||||
.split("px")[0]
|
||||
);
|
||||
|
||||
if (typeof params.realtime === "undefined" || params.realtime === false) {
|
||||
parent_height = parseInt(
|
||||
$("#menu_" + graph_id)
|
||||
.parent()
|
||||
.css("height")
|
||||
.split("px")[0]
|
||||
);
|
||||
}
|
||||
|
||||
adjust_menu(graph_id, plot, parent_height, width, show_legend);
|
||||
}
|
||||
}
|
||||
|
@ -2987,7 +3025,14 @@ function check_adaptions(graph_id) {
|
|||
});
|
||||
}
|
||||
|
||||
function number_format(number, force_integer, unit, short_data, divisor) {
|
||||
function number_format(
|
||||
number,
|
||||
force_integer,
|
||||
unit,
|
||||
short_data,
|
||||
divisor,
|
||||
params
|
||||
) {
|
||||
divisor = typeof divisor !== "undefined" ? divisor : 1000;
|
||||
var decimals = 2;
|
||||
|
||||
|
@ -3029,6 +3074,11 @@ function number_format(number, force_integer, unit, short_data, divisor) {
|
|||
number = 0;
|
||||
}
|
||||
|
||||
if (typeof params !== "undefined") {
|
||||
if (typeof params.twoLines !== "undefined" && params.twoLines === true);
|
||||
return number + "<br>" + shorts[pos] + unit;
|
||||
}
|
||||
|
||||
return number + " " + shorts[pos] + unit;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ function d3_relationship_graph($elements, $matrix, $width=700, $return=false, $h
|
|||
}
|
||||
|
||||
|
||||
function d3_tree_map_graph($data, $width=700, $height=700, $return=false)
|
||||
function d3_tree_map_graph($data, $width=700, $height=700, $return=false, $id_container='tree_map', $child_links=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
@ -91,7 +91,7 @@ function d3_tree_map_graph($data, $width=700, $height=700, $return=false)
|
|||
$data = json_encode($data);
|
||||
}
|
||||
|
||||
$output = "<div id=\"tree_map\" style='overflow: hidden;'></div>";
|
||||
$output = '<div id="'.$id_container."\" style='overflow: hidden;'></div>";
|
||||
$output .= include_javascript_d3(true);
|
||||
$output .= '<style type="text/css">
|
||||
.cell>rect {
|
||||
|
@ -139,8 +139,18 @@ function d3_tree_map_graph($data, $width=700, $height=700, $return=false)
|
|||
}
|
||||
</style>';
|
||||
$output .= "<script language=\"javascript\" type=\"text/javascript\">
|
||||
treeMap('#tree_map', $data, '$width', '$height');
|
||||
treeMap('#$id_container', $data, '$width', '$height', $child_links);
|
||||
</script>";
|
||||
if ($child_links === true) {
|
||||
$output .= html_print_input_image(
|
||||
'resize_parent',
|
||||
'/images/normal_screen.png',
|
||||
1,
|
||||
'background-color: white !important; padding: 4px !important;',
|
||||
true,
|
||||
['class' => 'resize_button invisible']
|
||||
);
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
echo $output;
|
||||
|
|
|
@ -39,7 +39,7 @@ function include_javascript_dependencies_flot_graph($return=false, $mobile=false
|
|||
$output .= '
|
||||
<script type="text/javascript">
|
||||
var phpTimezone = "'.date_default_timezone_get().'";
|
||||
var configHomeurl = "'.$config['homeurl'].'";
|
||||
var configHomeurl = "'.((is_metaconsole() === false) ? $config['homeurl'] : '../../').'";
|
||||
</script>';
|
||||
|
||||
// NOTE: jquery.flot.threshold is not te original file. Is patched to allow multiple thresholds and filled area
|
||||
|
@ -262,8 +262,14 @@ function flot_area_graph(
|
|||
(empty($params['line_width']) === true) ? $config['custom_graph_width'] : $params['line_width'],
|
||||
true
|
||||
);
|
||||
|
||||
$timestamp_top_fixed = '';
|
||||
if (isset($params['timestamp_top_fixed']) === true && empty($params['timestamp_top_fixed']) === false) {
|
||||
$timestamp_top_fixed = $params['timestamp_top_fixed'];
|
||||
}
|
||||
|
||||
$return .= "<div id='timestamp_$graph_id'
|
||||
class='timestamp_graph'
|
||||
class='timestamp_graph ".$timestamp_top_fixed." '
|
||||
style='font-size:".$params['font_size']."pt;
|
||||
display:none; position:absolute;
|
||||
background:#fff; border: solid 1px #aaa;
|
||||
|
@ -275,8 +281,20 @@ function flot_area_graph(
|
|||
$return .= 'noresizevc ';
|
||||
}
|
||||
|
||||
if (strpos($params['width'], '%') === false) {
|
||||
$width = 'width: '.$params['width'].'px;';
|
||||
} else {
|
||||
$width = 'width: '.$params['width'].';';
|
||||
}
|
||||
|
||||
if (strpos($params['graph_width'], '%') === false) {
|
||||
$width = 'width: '.$params['graph_width'].'px;';
|
||||
} else {
|
||||
$width = 'width: '.$params['graph_width'].';';
|
||||
}
|
||||
|
||||
$return .= 'graph'.$params['adapt_key']."'
|
||||
style=' width: ".$params['width'].'px;
|
||||
style='".$width.';
|
||||
height: '.$params['height']."px;'></div>";
|
||||
|
||||
$legend_top = 10;
|
||||
|
|
|
@ -402,18 +402,24 @@ function chordDiagram(recipient, elements, matrix, width, height) {
|
|||
// }
|
||||
// ]
|
||||
// };
|
||||
function treeMap(recipient, data, width, height) {
|
||||
function treeMap(recipient, data, width, height, childLinks = false) {
|
||||
//var isIE = BrowserDetect.browser == 'Explorer';
|
||||
var isIE = true;
|
||||
var chartWidth = width;
|
||||
var chartHeight = height;
|
||||
var consoleStyle = document.getElementById("hidden-selected_style_theme")
|
||||
.value;
|
||||
$("#tooltip").css(
|
||||
const uniqueId = generateUniqueId();
|
||||
if (document.getElementById("hidden-selected_style_theme") !== null) {
|
||||
var consoleStyle = document.getElementById("hidden-selected_style_theme")
|
||||
.value;
|
||||
} else {
|
||||
var consoleStyle = "";
|
||||
}
|
||||
|
||||
$("#tooltip_" + uniqueId).css(
|
||||
"color",
|
||||
consoleStyle === "pandora_black" ? "rgb(240, 240, 240)" : "rgb(0, 0, 0)"
|
||||
);
|
||||
$("#tooltip").css(
|
||||
$("#tooltip_" + uniqueId).css(
|
||||
"background-color",
|
||||
consoleStyle === "pandora_black" ? "rgb(0, 0, 0)" : "rgb(240, 240, 240)"
|
||||
);
|
||||
|
@ -431,6 +437,9 @@ function treeMap(recipient, data, width, height) {
|
|||
var transitionDuration = 500;
|
||||
var root;
|
||||
var node;
|
||||
var resize_button = $(recipient)
|
||||
.parent()
|
||||
.find(".resize_button");
|
||||
|
||||
var treemap = d3.layout
|
||||
.treemap()
|
||||
|
@ -468,6 +477,7 @@ function treeMap(recipient, data, width, height) {
|
|||
.attr("class", "cell parent")
|
||||
.on("click", function(d) {
|
||||
zoom(d);
|
||||
resize_button.show();
|
||||
})
|
||||
.append("svg")
|
||||
.attr("class", "clip")
|
||||
|
@ -476,6 +486,9 @@ function treeMap(recipient, data, width, height) {
|
|||
})
|
||||
.attr("height", headerHeight);
|
||||
parentEnterTransition
|
||||
.filter(function(d) {
|
||||
if (d.name) return d;
|
||||
})
|
||||
.append("rect")
|
||||
.attr("width", function(d) {
|
||||
return Math.max(0.01, d.dx);
|
||||
|
@ -483,6 +496,9 @@ function treeMap(recipient, data, width, height) {
|
|||
.attr("height", headerHeight)
|
||||
.style("fill", headerColor);
|
||||
parentEnterTransition
|
||||
.filter(function(d) {
|
||||
if (d.name) return d;
|
||||
})
|
||||
.append("text")
|
||||
.attr("class", "label")
|
||||
.attr("fill", "white")
|
||||
|
@ -490,6 +506,7 @@ function treeMap(recipient, data, width, height) {
|
|||
.attr("width", function(d) {
|
||||
return Math.max(0.01, d.dx);
|
||||
})
|
||||
.attr("style", "transition: all 0.5s ease-out;")
|
||||
.attr("height", headerHeight)
|
||||
.text(function(d) {
|
||||
return d.name;
|
||||
|
@ -521,6 +538,10 @@ function treeMap(recipient, data, width, height) {
|
|||
// remove transition
|
||||
parentCells.exit().remove();
|
||||
|
||||
$(resize_button).on("click", function() {
|
||||
zoom(root);
|
||||
$(this).hide();
|
||||
});
|
||||
// create children cells
|
||||
var childrenCells = chart
|
||||
.selectAll("g.cell.child")
|
||||
|
@ -534,19 +555,27 @@ function treeMap(recipient, data, width, height) {
|
|||
.append("g")
|
||||
.attr("class", "cell child")
|
||||
.on("click", function(d) {
|
||||
zoom(node === d.parent ? root : d.parent);
|
||||
if (childLinks) {
|
||||
if (node === d.parent) {
|
||||
window.location.href = d.link;
|
||||
} else {
|
||||
resize_button.show();
|
||||
zoom(d.parent);
|
||||
}
|
||||
} else {
|
||||
zoom(node === d.parent ? root : d.parent);
|
||||
}
|
||||
})
|
||||
.on("mouseover", over_user)
|
||||
.on("mouseout", out_user)
|
||||
.on("mousemove", move_tooltip)
|
||||
.append("svg")
|
||||
.attr("class", "clip");
|
||||
|
||||
$(recipient).on("mouseover", over_user);
|
||||
$(recipient).on("mouseout", out_user);
|
||||
$(recipient).on("mousemove", move_tooltip);
|
||||
childEnterTransition
|
||||
.append("rect")
|
||||
.classed("background", true)
|
||||
.style("fill", function(d) {
|
||||
return color(d.name);
|
||||
return d.color ? d.color : color(d.name);
|
||||
});
|
||||
|
||||
childEnterTransition
|
||||
|
@ -608,6 +637,30 @@ function treeMap(recipient, data, width, height) {
|
|||
|
||||
zoom(node);
|
||||
|
||||
function calculateSizeText() {
|
||||
$(recipient + " .parent .clip .label").each((key, node) => {
|
||||
const textElement = node;
|
||||
const containerWidth = parseFloat(
|
||||
$(textElement)
|
||||
.parent()
|
||||
.attr("width")
|
||||
);
|
||||
const originalFontSize = 12;
|
||||
|
||||
textElement.style.fontSize = "16px";
|
||||
const computedTextLength = textElement.getComputedTextLength();
|
||||
const textWidth = computedTextLength + 8;
|
||||
textElement.style.fontSize = originalFontSize + "px";
|
||||
|
||||
const scaleFactor = containerWidth / textWidth;
|
||||
let scaledFontSize = parseFloat(originalFontSize) * scaleFactor;
|
||||
|
||||
scaledFontSize = scaledFontSize > 12 ? 12 : scaledFontSize;
|
||||
|
||||
textElement.style.fontSize = scaledFontSize + "px";
|
||||
});
|
||||
}
|
||||
|
||||
function size(d) {
|
||||
return d.size;
|
||||
}
|
||||
|
@ -728,6 +781,9 @@ function treeMap(recipient, data, width, height) {
|
|||
if (d3.event) {
|
||||
d3.event.stopPropagation();
|
||||
}
|
||||
setTimeout(() => {
|
||||
calculateSizeText();
|
||||
}, transitionDuration);
|
||||
}
|
||||
|
||||
function position() {
|
||||
|
@ -746,11 +802,10 @@ function treeMap(recipient, data, width, height) {
|
|||
}
|
||||
|
||||
function move_tooltip(d) {
|
||||
x = d3.event.pageX + 10;
|
||||
y = d3.event.pageY + 10;
|
||||
|
||||
$("#tooltip").css("left", x + "px");
|
||||
$("#tooltip").css("top", y + "px");
|
||||
x = d.offsetX + 40;
|
||||
y = d.offsetY + 40;
|
||||
$("#tooltip_" + uniqueId).css("left", x + "px");
|
||||
$("#tooltip_" + uniqueId).css("top", y + "px");
|
||||
}
|
||||
|
||||
function over_user(d) {
|
||||
|
@ -772,17 +827,17 @@ function treeMap(recipient, data, width, height) {
|
|||
}
|
||||
|
||||
function create_tooltip(d, x, y) {
|
||||
if ($("#tooltip").length == 0) {
|
||||
if ($("#tooltip_" + uniqueId).length == 0) {
|
||||
$(recipient).append(
|
||||
$("<div></div>")
|
||||
.attr("id", "tooltip")
|
||||
.html(d.tooltip_content)
|
||||
.attr("id", "tooltip_" + uniqueId)
|
||||
.html(d.target.__data__.tooltip_content)
|
||||
);
|
||||
} else {
|
||||
$("#tooltip").html(d.tooltip_content);
|
||||
$("#tooltip_" + uniqueId).html(d.target.__data__.tooltip_content);
|
||||
}
|
||||
|
||||
$("#tooltip").attr(
|
||||
$("#tooltip_" + uniqueId).attr(
|
||||
"style",
|
||||
"background: #fff;" +
|
||||
"color: #111;" +
|
||||
|
@ -805,14 +860,22 @@ function treeMap(recipient, data, width, height) {
|
|||
}
|
||||
|
||||
function show_tooltip(d) {
|
||||
x = d3.event.pageX + 10;
|
||||
y = d3.event.pageY + 10;
|
||||
|
||||
create_tooltip(d, x, y);
|
||||
x = d.offsetX + 10;
|
||||
y = d.offsetY + 10;
|
||||
if (d.target.__data__) {
|
||||
create_tooltip(d, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
function hide_tooltip() {
|
||||
$("#tooltip").hide();
|
||||
$("#tooltip_" + uniqueId).hide();
|
||||
}
|
||||
|
||||
function generateUniqueId() {
|
||||
const timestamp = new Date().getTime();
|
||||
const randomNum = Math.floor(Math.random() * 10000);
|
||||
const uniqueId = `${timestamp}-${randomNum}`;
|
||||
return uniqueId;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,713 @@
|
|||
// Droppable options.
|
||||
var droppableOptions = {
|
||||
accept: ".draggable",
|
||||
hoverClass: "drops-hover",
|
||||
activeClass: "droppable-zone",
|
||||
drop: function(event, ui) {
|
||||
// Add new module.
|
||||
$(this)
|
||||
.data("modules")
|
||||
.push(ui.draggable.data("id-module"));
|
||||
|
||||
// Create elements.
|
||||
createDroppableZones(droppableOptions, getModulesByGraphs());
|
||||
}
|
||||
};
|
||||
|
||||
// Doc ready.
|
||||
$(document).ready(function() {
|
||||
// Hide toggles.
|
||||
$("#agents-toggle").hide();
|
||||
$("#groups-toggle").hide();
|
||||
$("#modules-toggle").hide();
|
||||
$("[data-button=pause-realtime]")
|
||||
.parent()
|
||||
.hide();
|
||||
|
||||
// Set droppable zones.
|
||||
$(".droppable").droppable(droppableOptions);
|
||||
});
|
||||
|
||||
// Interval change.
|
||||
$("#interval").change(function(e) {
|
||||
createDroppableZones(droppableOptions, getModulesByGraphs());
|
||||
});
|
||||
|
||||
// Collapse filters.
|
||||
$("div.filters-div-main > .filters-div-header > img").click(function(e) {
|
||||
if ($(".filters-div-main").hasClass("filters-div-main-collapsed") === true) {
|
||||
$(".filters-div-header > img").attr("src", "images/menu/contraer.svg");
|
||||
$(".filters-div-main").removeClass("filters-div-main-collapsed");
|
||||
$("#droppable-graphs").removeClass("droppable-graphs-collapsed");
|
||||
} else {
|
||||
$(".filters-div-header > img").attr("src", "images/menu/expandir.svg");
|
||||
$(".filters-div-main").addClass("filters-div-main-collapsed");
|
||||
$("#droppable-graphs").addClass("droppable-graphs-collapsed");
|
||||
}
|
||||
});
|
||||
|
||||
// Search left.
|
||||
$("#search-left").keyup(function(e) {
|
||||
if ($(this).val() !== "") {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
search_left: e.target.value
|
||||
},
|
||||
success: function(data) {
|
||||
if (data.agents || data.groups || data.modules) {
|
||||
var agentsToggle = $(
|
||||
"#agents-toggle > div[id^=tgl_div_] > div.white-box-content"
|
||||
);
|
||||
var groupsToggle = $(
|
||||
"#groups-toggle > div[id^=tgl_div_] > div.white-box-content"
|
||||
);
|
||||
var modulesToggle = $(
|
||||
"#modules-toggle > div[id^=tgl_div_] > div.white-box-content"
|
||||
);
|
||||
agentsToggle.empty();
|
||||
groupsToggle.empty();
|
||||
modulesToggle.empty();
|
||||
|
||||
if (data.agents) {
|
||||
$("#agents-toggle").show();
|
||||
data.agents.forEach(agent => {
|
||||
agentsToggle.append(
|
||||
`<div onclick="clickAgent(event.target);" data-id-agent="${agent.id_agente}" title="${agent.alias}">${agent.alias}</div>`
|
||||
);
|
||||
});
|
||||
} else {
|
||||
$("#agents-toggle").hide();
|
||||
}
|
||||
|
||||
if (data.groups) {
|
||||
$("#groups-toggle").show();
|
||||
data.groups.forEach(group => {
|
||||
groupsToggle.append(
|
||||
`<div onclick="clickGroup(event.target);" data-id-group="${group.id_grupo}" title="${group.nombre}">${group.nombre}</div>`
|
||||
);
|
||||
});
|
||||
} else {
|
||||
$("#groups-toggle").hide();
|
||||
}
|
||||
|
||||
if (data.modules) {
|
||||
$("#modules-toggle").show();
|
||||
data.modules.forEach(module => {
|
||||
modulesToggle.append(
|
||||
`<div class="draggable draggable-container" data-id-module="${module.id_agente_modulo}" title="${module.nombre}">
|
||||
<img class="draggable-icon" src="images/draggable.svg">
|
||||
<div class="draggable-module">
|
||||
<span class="draggable-module-name">${module.nombre}</span>
|
||||
<span class="draggable-agent-name">${module.alias}</span>
|
||||
</div>
|
||||
</div>`
|
||||
);
|
||||
});
|
||||
} else {
|
||||
$("#modules-toggle").hide();
|
||||
}
|
||||
|
||||
// Create draggable elements.
|
||||
$(".draggable").draggable({
|
||||
revert: "invalid",
|
||||
stack: ".draggable",
|
||||
helper: "clone"
|
||||
});
|
||||
} else {
|
||||
$("#agents-toggle").hide();
|
||||
$("#groups-toggle").hide();
|
||||
$("#modules-toggle").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("#agents-toggle").hide();
|
||||
$("#groups-toggle").hide();
|
||||
$("#modules-toggle").hide();
|
||||
}
|
||||
});
|
||||
|
||||
function clickAgent(e) {
|
||||
$("#search-agent").val($(e).data("id-agent"));
|
||||
$("#search-group").val("");
|
||||
searchRight($("#search-right").val());
|
||||
}
|
||||
|
||||
function clickGroup(e) {
|
||||
$("#search-group").val($(e).data("id-group"));
|
||||
$("#search-agent").val("");
|
||||
searchRight($("#search-right").val());
|
||||
}
|
||||
|
||||
// Search right.
|
||||
$("#search-right").keyup(function(e) {
|
||||
if ($("#search-right") !== "") {
|
||||
searchRight(e.target.value);
|
||||
}
|
||||
});
|
||||
|
||||
function searchRight(freeSearch) {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
search_right: true,
|
||||
free_search: freeSearch,
|
||||
search_agent: $("#search-agent").val(),
|
||||
search_group: $("#search-group").val()
|
||||
},
|
||||
success: function(data) {
|
||||
var modulesRight = $("#modules-right");
|
||||
|
||||
if (data.modules) {
|
||||
modulesRight.empty();
|
||||
|
||||
data.modules.forEach(module => {
|
||||
modulesRight.append(
|
||||
`<div class="draggable draggable-container" data-id-module="${module.id_agente_modulo}" title="${module.nombre}">
|
||||
<img class="draggable-icon" src="images/draggable.svg">
|
||||
<div class="draggable-module">
|
||||
<span class="draggable-module-name">${module.nombre}</span>
|
||||
<span class="draggable-agent-name">${module.alias}</span>
|
||||
</div>
|
||||
</div>`
|
||||
);
|
||||
});
|
||||
|
||||
// Create draggable elements.
|
||||
$(".draggable").draggable({
|
||||
revert: "invalid",
|
||||
stack: ".draggable",
|
||||
helper: "clone"
|
||||
});
|
||||
} else {
|
||||
modulesRight.empty();
|
||||
console.error("NO DATA FOUND");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createDroppableZones(
|
||||
droppableOptions,
|
||||
modulesByGraphs,
|
||||
homeurl = "",
|
||||
getInterval = 0
|
||||
) {
|
||||
var url = "ajax.php";
|
||||
var interval = $("#interval").val();
|
||||
|
||||
if (homeurl !== "") {
|
||||
url = homeurl + "/ajax.php";
|
||||
}
|
||||
|
||||
if (getInterval !== 0) {
|
||||
interval = getInterval;
|
||||
}
|
||||
|
||||
// Clear graph area.
|
||||
$("#droppable-graphs").empty();
|
||||
|
||||
// Reset realtime data.
|
||||
realtimeGraphs = [];
|
||||
|
||||
// Graph modules.
|
||||
modulesByGraphs
|
||||
.slice()
|
||||
.reverse()
|
||||
.forEach(graph => {
|
||||
// Max modules by graph.
|
||||
var droppableClass = "";
|
||||
if (graph.length < 2) {
|
||||
droppableClass = "droppable";
|
||||
}
|
||||
|
||||
// Create graph div.
|
||||
var graphDiv = $(
|
||||
`<div class="${droppableClass}" data-modules="[${graph}]"></div>`
|
||||
);
|
||||
$("#droppable-graphs").prepend(graphDiv);
|
||||
|
||||
// Print graphs.
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url,
|
||||
dataType: "html",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
get_graphs: graph,
|
||||
interval
|
||||
},
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
graphDiv.append(
|
||||
$(
|
||||
`<div class="draggable ui-draggable ui-draggable-handle">${data}</div>`
|
||||
)
|
||||
);
|
||||
|
||||
// Create remove button.
|
||||
if (
|
||||
graphDiv
|
||||
.children()
|
||||
.children()
|
||||
.hasClass("parent_graph") === true
|
||||
) {
|
||||
graphDiv
|
||||
.children()
|
||||
.children()
|
||||
.children(":first-child")
|
||||
.prepend(
|
||||
$(
|
||||
'<img src="images/delete.svg" class="remove-graph-analytics" onclick="removeGraph(this);">'
|
||||
)
|
||||
);
|
||||
} else {
|
||||
graphDiv
|
||||
.children()
|
||||
.append(
|
||||
$(
|
||||
'<img src="images/delete.svg" class="remove-graph-analytics" onclick="removeGraph(this);">'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Create next droppable zone.
|
||||
graphDiv.after(
|
||||
$(
|
||||
`<div class="droppable droppable-default-zone droppable-new" data-modules="[]"><span class="drop-here">${dropHere}<span></div>`
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
// Create first droppable zones and graphs.
|
||||
$("#droppable-graphs").prepend(
|
||||
$(
|
||||
`<div class="droppable droppable-default-zone droppable-new" data-modules="[]"><span class="drop-here">${dropHere}<span></div>`
|
||||
)
|
||||
);
|
||||
|
||||
// Set droppable zones.
|
||||
$(".droppable").droppable(droppableOptions);
|
||||
}
|
||||
|
||||
function getModulesByGraphs() {
|
||||
var modulesByGraphs = [];
|
||||
$("#droppable-graphs > div").each(function(i, v) {
|
||||
var modulesTmp = $(v).data("modules");
|
||||
if (modulesTmp.length > 0) {
|
||||
modulesByGraphs.push(modulesTmp);
|
||||
}
|
||||
});
|
||||
|
||||
return modulesByGraphs;
|
||||
}
|
||||
|
||||
function realtimeGraph() {
|
||||
realtimeGraphsTmp = realtimeGraphs;
|
||||
realtimeGraphs = [];
|
||||
|
||||
realtimeGraphsTmp.forEach(graph => {
|
||||
$.each(graph.series_type, function(i, v) {
|
||||
// Get new values.
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
get_new_values: graph.values[i].agent_module_id,
|
||||
date_array: graph.date_array,
|
||||
data_module_graph: graph.data_module_graph,
|
||||
params: graph.params,
|
||||
suffix: i.slice(-1)
|
||||
},
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
// Set new values
|
||||
graph.values[i].data = data[i].data;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// New periods.
|
||||
var period = $("#interval").val();
|
||||
var time = Math.floor(Date.now() / 1000);
|
||||
|
||||
graph.params.date = time;
|
||||
|
||||
var date_array = {
|
||||
period,
|
||||
final_date: time,
|
||||
start_date: time - period
|
||||
};
|
||||
|
||||
pandoraFlotArea(
|
||||
graph.graph_id,
|
||||
graph.values,
|
||||
graph.legend,
|
||||
graph.series_type,
|
||||
graph.color,
|
||||
date_array,
|
||||
graph.data_module_graph,
|
||||
graph.params,
|
||||
graph.events_array
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Action buttons.
|
||||
// Start/Pause Realtime.
|
||||
var realtimeGraphInterval;
|
||||
$("[data-button=pause-realtime]")
|
||||
.parent()
|
||||
.hide();
|
||||
|
||||
$("[data-button=start-realtime]").click(function(e) {
|
||||
$("[data-button=start-realtime]")
|
||||
.parent()
|
||||
.hide();
|
||||
$("[data-button=pause-realtime]")
|
||||
.parent()
|
||||
.show();
|
||||
|
||||
realtimeGraphInterval = setInterval(realtimeGraph, 5000);
|
||||
});
|
||||
|
||||
$("[data-button=pause-realtime]").click(function(e) {
|
||||
$("[data-button=pause-realtime]")
|
||||
.parent()
|
||||
.hide();
|
||||
$("[data-button=start-realtime]")
|
||||
.parent()
|
||||
.show();
|
||||
|
||||
clearInterval(realtimeGraphInterval);
|
||||
});
|
||||
|
||||
// New graph.
|
||||
$("[data-button=new]").click(function(e) {
|
||||
confirmDialog({
|
||||
title: titleNew,
|
||||
message: messageNew,
|
||||
onAccept: function() {
|
||||
$("#droppable-graphs").empty();
|
||||
|
||||
// Create graph div.
|
||||
$("#droppable-graphs").prepend(
|
||||
$(
|
||||
`<div class="droppable droppable-default-zone ui-droppable" data-modules="[]"><span class="drop-here">${dropHere}<span></div>`
|
||||
)
|
||||
);
|
||||
$(".droppable").droppable(droppableOptions);
|
||||
|
||||
// Reset realtime button.
|
||||
$("[data-button=pause-realtime]")
|
||||
.parent()
|
||||
.hide();
|
||||
$("[data-button=start-realtime]")
|
||||
.parent()
|
||||
.show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Save graps modal.
|
||||
$("[data-button=save]").click(function(e) {
|
||||
// Filter save mode selector
|
||||
$("#save_filter_row1").show();
|
||||
$("#save_filter_row2").show();
|
||||
$("#update_filter_row1").hide();
|
||||
$("#radiobtn0002").prop("checked", false);
|
||||
$("#radiobtn0001").prop("checked", true);
|
||||
$("#text-id_name").val("");
|
||||
|
||||
$("[name='filter_mode']").click(function() {
|
||||
if ($(this).val() == "new") {
|
||||
$("#save_filter_row1").show();
|
||||
$("#save_filter_row2").show();
|
||||
$("#submit-save_filter").show();
|
||||
$("#update_filter_row1").hide();
|
||||
} else {
|
||||
$("#save_filter_row1").hide();
|
||||
$("#save_filter_row2").hide();
|
||||
$("#update_filter_row1").show();
|
||||
$("#submit-save_filter").hide();
|
||||
}
|
||||
});
|
||||
|
||||
$("#save-filter-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: 350
|
||||
});
|
||||
});
|
||||
|
||||
// Save filter button.
|
||||
function save_new_filter() {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
save_filter: $("#text-id_name").val(),
|
||||
graphs: getModulesByGraphs(),
|
||||
interval: $("#interval").val()
|
||||
},
|
||||
success: function(data) {
|
||||
if (data == "saved") {
|
||||
confirmDialog({
|
||||
title: titleSave,
|
||||
message: messageSave,
|
||||
hideCancelButton: true,
|
||||
onAccept: function() {
|
||||
$(
|
||||
"button.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close"
|
||||
).click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var message = messageSaveEmpty;
|
||||
if (data === "") {
|
||||
message = messageSaveEmptyName;
|
||||
}
|
||||
confirmDialog({
|
||||
title: titleError,
|
||||
message,
|
||||
hideCancelButton: true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Update filter button.
|
||||
function save_update_filter() {
|
||||
confirmDialog({
|
||||
title: titleUpdate,
|
||||
message: messageUpdate,
|
||||
onAccept: function() {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
update_filter: $("#overwrite_filter").val(),
|
||||
graphs: getModulesByGraphs(),
|
||||
interval: $("#interval").val()
|
||||
},
|
||||
success: function(data) {
|
||||
if (data == "updated") {
|
||||
confirmDialog({
|
||||
title: titleUpdateConfirm,
|
||||
message: messageUpdateConfirm,
|
||||
hideCancelButton: true,
|
||||
onAccept: function() {
|
||||
$(
|
||||
"button.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close"
|
||||
).click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
confirmDialog({
|
||||
title: titleUpdateError,
|
||||
message: messageUpdateError,
|
||||
hideCancelButton: true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Load graps modal.
|
||||
$("[data-button=load]").click(function(e) {
|
||||
$("#load-filter-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: "auto"
|
||||
});
|
||||
});
|
||||
|
||||
// Load filter button.
|
||||
function load_filter_values(id = 0, homeurl) {
|
||||
var url = "ajax.php";
|
||||
var filterId = $("#filter_id").val();
|
||||
|
||||
if (id !== 0) {
|
||||
filterId = id;
|
||||
url = homeurl + "/ajax.php";
|
||||
}
|
||||
|
||||
if (id === 0) {
|
||||
confirmDialog({
|
||||
title: titleLoad,
|
||||
message: messageLoad,
|
||||
onAccept: function() {
|
||||
loadFilter(url, filterId, homeurl, id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
loadFilter(url, filterId, homeurl, id);
|
||||
}
|
||||
}
|
||||
|
||||
function loadFilter(url, filterId, homeurl, id) {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url,
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
load_filter: filterId
|
||||
},
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
createDroppableZones(
|
||||
droppableOptions,
|
||||
data.graphs,
|
||||
homeurl,
|
||||
data.interval
|
||||
);
|
||||
if (id === 0) {
|
||||
$("#interval")
|
||||
.val(data.interval)
|
||||
.trigger("change");
|
||||
}
|
||||
|
||||
$(
|
||||
"button.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close"
|
||||
).click();
|
||||
|
||||
// Reset realtime button.
|
||||
if (id === 0) {
|
||||
$("[data-button=pause-realtime]")
|
||||
.parent()
|
||||
.hide();
|
||||
$("[data-button=start-realtime]")
|
||||
.parent()
|
||||
.show();
|
||||
}
|
||||
} else {
|
||||
confirmDialog({
|
||||
title: titleLoadConfirm,
|
||||
message: messageLoadConfirm,
|
||||
hideCancelButton: true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Share button.
|
||||
$("[data-button=share]").click(function(e) {
|
||||
$("#share-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: "auto"
|
||||
});
|
||||
});
|
||||
|
||||
$("#button-share-modal").click(function(e) {
|
||||
const hash = $("#hash_share").val();
|
||||
const idFilter = btoa($("#share-id").val());
|
||||
const idUser = $("#id_user").val();
|
||||
|
||||
const queryParams = "hash=" + hash + "&id=" + idFilter + "&id_user=" + idUser;
|
||||
|
||||
window.open(
|
||||
configHomeurl +
|
||||
"/operation/reporting/graph_analytics_public.php?" +
|
||||
queryParams
|
||||
);
|
||||
});
|
||||
|
||||
// Export button.
|
||||
$("[data-button=export]").click(function(e) {
|
||||
$("#export-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: "auto",
|
||||
title: titleExport
|
||||
});
|
||||
});
|
||||
|
||||
$("#button-export-modal").click(function(e) {
|
||||
const filter = parseInt($("#export-filter-id").val());
|
||||
const group = parseInt($("#export-group-id").val());
|
||||
|
||||
if (filter !== 0) {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
export_filter: filter,
|
||||
group
|
||||
},
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
confirmDialog({
|
||||
title: titleExportConfirm,
|
||||
message: data + " " + messageExportConfirm,
|
||||
hideCancelButton: true,
|
||||
onAccept: function() {
|
||||
$(
|
||||
"button.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close"
|
||||
).click();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Remove graph.
|
||||
function removeGraph(e) {
|
||||
confirmDialog({
|
||||
title: titleRemoveConfirm,
|
||||
message: messageRemoveConfirm,
|
||||
onAccept: function() {
|
||||
if (
|
||||
$(e)
|
||||
.parent()
|
||||
.hasClass("menu_graph") === true
|
||||
) {
|
||||
$(e)
|
||||
.parent()
|
||||
.parent()
|
||||
.parent()
|
||||
.parent()
|
||||
.remove();
|
||||
} else {
|
||||
$(e)
|
||||
.parent()
|
||||
.parent()
|
||||
.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -275,6 +275,10 @@ function initialiceLayout(data) {
|
|||
$("#configure-widget-" + id).click(function() {
|
||||
getSizeModalConfiguration(id, widgetId);
|
||||
});
|
||||
|
||||
$("#copy-widget-" + id).click(function() {
|
||||
duplicateWidget(id, widgetId);
|
||||
});
|
||||
},
|
||||
error: function(error) {
|
||||
console.error(error);
|
||||
|
@ -305,6 +309,31 @@ function initialiceLayout(data) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function duplicateWidget(original_cellId, original_widgetId) {
|
||||
let duplicate_cellId = insertCellLayoutForDuplicate();
|
||||
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: data.url,
|
||||
data: {
|
||||
page: data.page,
|
||||
method: "duplicateWidget",
|
||||
dashboardId: data.dashboardId,
|
||||
widgetId: original_widgetId,
|
||||
cellId: original_cellId,
|
||||
duplicateCellId: duplicate_cellId
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(success) {
|
||||
console.log(success);
|
||||
},
|
||||
error: function(error) {
|
||||
console.log(error);
|
||||
return [];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saveLayout() {
|
||||
var items = $(".grid-stack > .grid-stack-item:visible")
|
||||
.map(function(i, el) {
|
||||
|
@ -400,6 +429,37 @@ function initialiceLayout(data) {
|
|||
});
|
||||
}
|
||||
|
||||
function insertCellLayoutForDuplicate() {
|
||||
let duplicateCellId = 0;
|
||||
$.ajax({
|
||||
async: false,
|
||||
method: "post",
|
||||
url: data.url,
|
||||
data: {
|
||||
page: data.page,
|
||||
method: "insertCellLayout",
|
||||
dashboardId: data.dashboardId,
|
||||
auth_class: data.auth.class,
|
||||
auth_hash: data.auth.hash,
|
||||
id_user: data.auth.user
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
// By default x and y = 0
|
||||
// width and height = 4
|
||||
// position auto = true.
|
||||
if (data.cellId !== 0) {
|
||||
addCell(data.cellId, 0, 0, 4, 4, true, 0, 2000, 0, 2000, 0, true);
|
||||
duplicateCellId = data.cellId;
|
||||
}
|
||||
},
|
||||
error: function(error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
return duplicateCellId;
|
||||
}
|
||||
|
||||
function configurationWidget(cellId, widgetId, size) {
|
||||
load_modal({
|
||||
target: $("#modal-config-widget"),
|
||||
|
@ -728,6 +788,10 @@ function initialiceLayout(data) {
|
|||
getSizeModalConfiguration(cellId, widgetId);
|
||||
});
|
||||
|
||||
$("#copy-widget-" + cellId).click(function() {
|
||||
duplicateWidget(cellId, widgetId);
|
||||
});
|
||||
|
||||
saveLayout();
|
||||
}
|
||||
});
|
||||
|
@ -1549,3 +1613,12 @@ function type_change() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Show/Hide period for projection on agent module graph.
|
||||
function show_projection_period() {
|
||||
if ($("#projection_switch").is(":checked")) {
|
||||
$("#div_projection_period").show();
|
||||
} else {
|
||||
$("#div_projection_period").hide();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,6 +160,13 @@ class Manager implements PublicLogin
|
|||
*/
|
||||
private $publicLink;
|
||||
|
||||
/**
|
||||
* Duplicate Id Cell.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $duplicateCellId;
|
||||
|
||||
/**
|
||||
* Allowed methods to be called using AJAX request.
|
||||
*
|
||||
|
@ -181,6 +188,7 @@ class Manager implements PublicLogin
|
|||
'formSlides',
|
||||
'callWidgetMethod',
|
||||
'getSizeModalConfiguration',
|
||||
'duplicateWidget',
|
||||
];
|
||||
|
||||
|
||||
|
@ -283,6 +291,7 @@ class Manager implements PublicLogin
|
|||
$this->widgetId = (int) $extradata['widgetId'];
|
||||
} else {
|
||||
$this->cellId = (int) \get_parameter('cellId', []);
|
||||
$this->duplicateCellId = (int) \get_parameter('duplicateCellId', []);
|
||||
$this->offset = (int) \get_parameter('offset', 0);
|
||||
|
||||
$this->dashboardId = (int) \get_parameter('dashboardId', 0);
|
||||
|
@ -597,6 +606,42 @@ class Manager implements PublicLogin
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Duplicate widget.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function duplicateWidget():int
|
||||
{
|
||||
$original_widget = [];
|
||||
|
||||
$original_cellId = $this->cellId;
|
||||
foreach ($this->cells as $cells) {
|
||||
if ($cells['id'] == $original_cellId) {
|
||||
$original_widget['id_widget'] = $cells['id_widget'];
|
||||
$original_widget['options'] = $cells['options'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$options = json_decode($original_widget['options'], true);
|
||||
$options['title'] = __('Copy of %s', $options['title']);
|
||||
$options_json = json_encode($options);
|
||||
|
||||
$values = [
|
||||
'options' => $options_json,
|
||||
'id_widget' => $original_widget['id_widget'],
|
||||
];
|
||||
$res = \db_process_sql_update(
|
||||
'twidget_dashboard',
|
||||
$values,
|
||||
['id' => $this->duplicateCellId]
|
||||
);
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy Dashboard and asociate widgets.
|
||||
*
|
||||
|
|
|
@ -300,6 +300,10 @@ class Widget
|
|||
$className .= '\GroupsStatusWidget';
|
||||
break;
|
||||
|
||||
case 'groups_status_map':
|
||||
$className .= '\GroupsStatusMapWidget';
|
||||
break;
|
||||
|
||||
case 'maps_made_by_user':
|
||||
$className .= '\MapsMadeByUser';
|
||||
break;
|
||||
|
@ -412,6 +416,10 @@ class Widget
|
|||
$className .= '\WuxWidget';
|
||||
break;
|
||||
|
||||
case 'inventory':
|
||||
$className .= '\InventoryWidget';
|
||||
break;
|
||||
|
||||
case 'os_quick_report':
|
||||
$className .= '\OsQuickReportWidget';
|
||||
break;
|
||||
|
|
|
@ -530,7 +530,7 @@ class EventCardboard extends Widget
|
|||
);
|
||||
}
|
||||
|
||||
$output .= '<table class="w100p h100p table-border-0"><tbody><tr>';
|
||||
$output .= '<table class="w100p h100p table-border-0 event-cardboard-widget"><tbody><tr>';
|
||||
|
||||
$width_td = (100 / count(explode(',', $severity)));
|
||||
|
||||
|
|
|
@ -394,6 +394,8 @@ class EventsListWidget extends Widget
|
|||
-1 => \__('All event'),
|
||||
1 => \__('Only validated'),
|
||||
0 => \__('Only pending'),
|
||||
2 => \__('Only in process'),
|
||||
3 => \__('Only not validated'),
|
||||
];
|
||||
|
||||
$inputs['inputs']['row1'][] = [
|
||||
|
@ -720,14 +722,15 @@ class EventsListWidget extends Widget
|
|||
'style' => 'width: 99%;',
|
||||
'ajax_url' => 'operation/events/events',
|
||||
'ajax_data' => [
|
||||
'get_events' => 1,
|
||||
'table_id' => $table_id,
|
||||
'filter' => $filter,
|
||||
'length' => $this->values['limit'],
|
||||
'groupRecursion' => (bool) $this->values['groupRecursion'],
|
||||
'auth_hash' => $hash,
|
||||
'auth_class' => 'PandoraFMS\Dashboard\Manager',
|
||||
'id_user' => $id_user,
|
||||
'get_events' => 1,
|
||||
'table_id' => $table_id,
|
||||
'filter' => $filter,
|
||||
'event_list_widget_filter' => $filter,
|
||||
'length' => $this->values['limit'],
|
||||
'groupRecursion' => (bool) $this->values['groupRecursion'],
|
||||
'auth_hash' => $hash,
|
||||
'auth_class' => 'PandoraFMS\Dashboard\Manager',
|
||||
'id_user' => $id_user,
|
||||
],
|
||||
'default_pagination' => $this->values['limit'],
|
||||
'pagination_options' => [
|
||||
|
|
|
@ -0,0 +1,460 @@
|
|||
<?php
|
||||
/**
|
||||
* Widget Group status map Pandora FMS Console
|
||||
*
|
||||
* @category Console Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage Widget Group status
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Pandora FMS
|
||||
* Please see https://pandorafms.com/community/ 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
namespace PandoraFMS\Dashboard;
|
||||
|
||||
/**
|
||||
* Group status map Widgets.
|
||||
*/
|
||||
class GroupsStatusMapWidget extends Widget
|
||||
{
|
||||
|
||||
/**
|
||||
* Name widget.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Title widget.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Page widget;
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $page;
|
||||
|
||||
/**
|
||||
* Class name widget.
|
||||
*
|
||||
* @var [type]
|
||||
*/
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* Values options for each widget.
|
||||
*
|
||||
* @var [type]
|
||||
*/
|
||||
protected $values;
|
||||
|
||||
/**
|
||||
* Configuration required.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $configurationRequired;
|
||||
|
||||
/**
|
||||
* Error load widget.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $loadError;
|
||||
|
||||
/**
|
||||
* Width.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $width;
|
||||
|
||||
/**
|
||||
* Heigth.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $height;
|
||||
|
||||
/**
|
||||
* Grid Width.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $gridWidth;
|
||||
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param integer $cellId Cell ID.
|
||||
* @param integer $dashboardId Dashboard ID.
|
||||
* @param integer $widgetId Widget ID.
|
||||
* @param integer|null $width New width.
|
||||
* @param integer|null $height New height.
|
||||
* @param integer|null $gridWidth Grid width.
|
||||
*/
|
||||
public function __construct(
|
||||
int $cellId,
|
||||
int $dashboardId=0,
|
||||
int $widgetId=0,
|
||||
?int $width=0,
|
||||
?int $height=0,
|
||||
?int $gridWidth=0
|
||||
) {
|
||||
global $config;
|
||||
|
||||
// WARNING: Do not edit. This chunk must be in the constructor.
|
||||
parent::__construct(
|
||||
$cellId,
|
||||
$dashboardId,
|
||||
$widgetId
|
||||
);
|
||||
|
||||
// Width.
|
||||
$this->width = $width;
|
||||
|
||||
// Height.
|
||||
$this->height = $height;
|
||||
|
||||
// Grid Width.
|
||||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
||||
// Page.
|
||||
$this->page = basename(__FILE__);
|
||||
|
||||
// ClassName.
|
||||
$class = new \ReflectionClass($this);
|
||||
$this->className = $class->getShortName();
|
||||
|
||||
// Title.
|
||||
$this->title = __('Group status map');
|
||||
|
||||
// Name.
|
||||
if (empty($this->name) === true) {
|
||||
$this->name = 'groups_status_map';
|
||||
}
|
||||
|
||||
$this->overflow_scrollbars = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['groups']) === true) {
|
||||
$values['groupId'] = $decoder['groups'];
|
||||
}
|
||||
|
||||
if (isset($decoder['groupId']) === true) {
|
||||
$values['groupId'] = $decoder['groupId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['groupRecursion']) === true) {
|
||||
$values['groupRecursion'] = $decoder['groupRecursion'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
* @return array Of inputs.
|
||||
*
|
||||
* @throws Exception On error.
|
||||
*/
|
||||
public function getFormInputs(): array
|
||||
{
|
||||
$values = $this->values;
|
||||
|
||||
// Retrieve global - common inputs.
|
||||
$inputs = parent::getFormInputs();
|
||||
$values['groupId'] = explode(',', $values['groupId']);
|
||||
// Restrict access to group.
|
||||
$inputs[] = [
|
||||
'label' => __('Groups'),
|
||||
'arguments' => [
|
||||
'type' => 'select_groups',
|
||||
'name' => 'groupId',
|
||||
'returnAllGroup' => true,
|
||||
'privilege' => 'AR',
|
||||
'multiple' => true,
|
||||
'selected' => $values['groupId'],
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Group recursion'),
|
||||
'arguments' => [
|
||||
'name' => 'groupRecursion',
|
||||
'id' => 'groupRecursion',
|
||||
'type' => 'switch',
|
||||
'value' => $values['groupRecursion'],
|
||||
],
|
||||
];
|
||||
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Post for widget.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getPost():array
|
||||
{
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::getPost();
|
||||
|
||||
$values['groupId'] = \get_parameter('groupId', 0);
|
||||
$values['groupRecursion'] = \get_parameter_switch('groupRecursion', 0);
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw widget.
|
||||
*
|
||||
* @return string;
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$size = parent::getSize();
|
||||
include_once $config['homedir'].'/include/graphs/functions_d3.php';
|
||||
include_once $config['homedir'].'/include/functions_reporting.php';
|
||||
include_once $config['homedir'].'/include/functions_graph.php';
|
||||
$groups_array = (empty($this->values['groupId']) === false) ? explode(',', $this->values['groupId']) : [];
|
||||
|
||||
if ((bool) $this->values['groupRecursion'] === true && in_array('0', $groups_array) === false) {
|
||||
foreach ($groups_array as $key => $group) {
|
||||
$children = groups_get_children($group, false, 'AR', false);
|
||||
foreach ($children as $key => $child) {
|
||||
$groups_array[] = $child['id_grupo'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$where = '';
|
||||
if (in_array('0', $groups_array) === false && count($groups_array) > 0) {
|
||||
$where = ' WHERE g.id_grupo IN ('.implode(',', $groups_array).') ';
|
||||
}
|
||||
|
||||
$servers = metaconsole_get_servers();
|
||||
$rows = [];
|
||||
if (isset($servers) === true && is_array($servers) === true
|
||||
) {
|
||||
foreach ($servers as $server) {
|
||||
if (metaconsole_connect($server) == NOERR) {
|
||||
$sql = 'SELECT g.id_grupo, g.nombre, estado, count(*) AS total_modules
|
||||
FROM tagente a
|
||||
LEFT JOIN tgrupo g ON g.id_grupo = a.id_grupo
|
||||
LEFT JOIN tagente_modulo m ON a.id_agente = m.id_agente
|
||||
LEFT JOIN tagente_estado es ON es.id_agente_modulo = m.id_agente_modulo
|
||||
'.$where.'
|
||||
GROUP BY a.id_grupo, estado';
|
||||
$result = db_process_sql($sql);
|
||||
if ($result !== false) {
|
||||
foreach ($result as $key => $group) {
|
||||
$not_exist = true;
|
||||
foreach ($rows as $key2 => $row) {
|
||||
if ($group['id_grupo'] === $row['id_grupo']
|
||||
&& $group['estado'] === $row['estado']
|
||||
) {
|
||||
$rows[$key2]['total_modules'] += $group['total_modules'];
|
||||
$not_exist = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($not_exist === true) {
|
||||
$rows[] = $group;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$where = '';
|
||||
if (in_array('0', $groups_array) === false && count($groups_array) > 0) {
|
||||
$where = ' WHERE g.id_grupo IN ('.implode(',', $groups_array).') ';
|
||||
}
|
||||
|
||||
$sql = 'SELECT g.id_grupo, g.nombre, estado, count(*) AS total_modules
|
||||
FROM tagente a
|
||||
LEFT JOIN tgrupo g ON g.id_grupo = a.id_grupo
|
||||
LEFT JOIN tagente_modulo m ON a.id_agente = m.id_agente
|
||||
LEFT JOIN tagente_estado es ON es.id_agente_modulo = m.id_agente_modulo
|
||||
'.$where.'
|
||||
GROUP BY a.id_grupo, estado';
|
||||
|
||||
$rows = db_process_sql($sql);
|
||||
}
|
||||
|
||||
if ($rows === false || (is_array($rows) === true && count($rows) === 0)) {
|
||||
$output = ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No data found.'),
|
||||
]
|
||||
);
|
||||
return $output;
|
||||
}
|
||||
|
||||
$level1 = [
|
||||
'name' => __('Module status map'),
|
||||
'children' => [],
|
||||
];
|
||||
|
||||
$names = [];
|
||||
foreach ($rows as $key => $row) {
|
||||
$color = '';
|
||||
$name_status = '';
|
||||
switch ($row['estado']) {
|
||||
case '1':
|
||||
$color = '#e63c52';
|
||||
$name_status = __('Critical');
|
||||
break;
|
||||
|
||||
case '2':
|
||||
$color = '#FFB900';
|
||||
$name_status = __('Warning');
|
||||
break;
|
||||
|
||||
case '0':
|
||||
$color = '#82b92e';
|
||||
$name_status = __('Normal');
|
||||
break;
|
||||
|
||||
case '3':
|
||||
$color = '#B2B2B2';
|
||||
$name_status = __('Unknown');
|
||||
break;
|
||||
|
||||
case '4':
|
||||
$color = '#4a83f3';
|
||||
$name_status = __('No data');
|
||||
$row['estado'] = 6;
|
||||
break;
|
||||
|
||||
default:
|
||||
$row['estado'] = 6;
|
||||
$color = '#B2B2B2';
|
||||
$name_status = __('Unknown');
|
||||
continue;
|
||||
}
|
||||
|
||||
$level1['children'][$row['id_grupo']][] = [
|
||||
'id' => uniqid(),
|
||||
'name' => $row['estado'],
|
||||
'value' => $row['total_modules'],
|
||||
'color' => $color,
|
||||
'tooltip_content' => $row['total_modules'].__(' Modules(%s)', $name_status),
|
||||
'link' => 'index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group='.$row['id_grupo'].'&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status='.$row['estado'].'&sort_field=&sort=none&pure=',
|
||||
];
|
||||
$names[$row['id_grupo']] = $row['nombre'];
|
||||
}
|
||||
|
||||
$level2 = [
|
||||
'children' => [],
|
||||
];
|
||||
foreach ($level1['children'] as $id_grupo => $group) {
|
||||
$level2['children'][] = [
|
||||
'id' => uniqid(),
|
||||
'name' => io_safe_output($names[$id_grupo]),
|
||||
'children' => $group,
|
||||
];
|
||||
}
|
||||
|
||||
$id_container = 'tree_map_'.uniqid();
|
||||
$output = d3_tree_map_graph($level2, $size['width'], $size['height'], true, $id_container, true);
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get description.
|
||||
*
|
||||
* @return string.
|
||||
*/
|
||||
public static function getDescription()
|
||||
{
|
||||
return __('Group status map');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Name.
|
||||
*
|
||||
* @return string.
|
||||
*/
|
||||
public static function getName()
|
||||
{
|
||||
return 'groups_status_map';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get size Modal Configuration.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSizeModalConfiguration(): array
|
||||
{
|
||||
$size = [
|
||||
'width' => 400,
|
||||
'height' => 330,
|
||||
];
|
||||
|
||||
return $size;
|
||||
}
|
||||
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -269,6 +269,14 @@ class SingleGraphWidget extends Widget
|
|||
$values['showLegend'] = $decoder['showLegend'];
|
||||
}
|
||||
|
||||
if (isset($decoder['projection_switch']) === true) {
|
||||
$values['projection_switch'] = $decoder['projection_switch'];
|
||||
}
|
||||
|
||||
if (isset($decoder['period_projection']) === true) {
|
||||
$values['period_projection'] = $decoder['period_projection'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
@ -357,6 +365,33 @@ class SingleGraphWidget extends Widget
|
|||
],
|
||||
];
|
||||
|
||||
// Projection.
|
||||
$inputs[] = [
|
||||
'label' => __('Projection Graph'),
|
||||
'arguments' => [
|
||||
'name' => 'projection_switch',
|
||||
'id' => 'projection_switch',
|
||||
'type' => 'switch',
|
||||
'value' => $values['projection_switch'],
|
||||
'onclick' => 'show_projection_period()',
|
||||
],
|
||||
];
|
||||
|
||||
// Period Projection.
|
||||
$display_projection = ($values['projection_switch'] === true) ? '' : 'display:none';
|
||||
$inputs[] = [
|
||||
'label' => __('Period Projection'),
|
||||
'id' => 'div_projection_period',
|
||||
'style' => $display_projection,
|
||||
'arguments' => [
|
||||
'name' => 'period_projection',
|
||||
'type' => 'interval',
|
||||
'value' => $values['period_projection'],
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
|
@ -376,6 +411,8 @@ class SingleGraphWidget extends Widget
|
|||
$values['moduleId'] = \get_parameter('moduleId', 0);
|
||||
$values['period'] = \get_parameter('period', 0);
|
||||
$values['showLegend'] = \get_parameter_switch('showLegend');
|
||||
$values['projection_switch'] = (boolean) get_parameter_switch('projection_switch');
|
||||
$values['period_projection'] = \get_parameter('period_projection', 0);
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
@ -405,23 +442,46 @@ class SingleGraphWidget extends Widget
|
|||
$trickHight = 40;
|
||||
}
|
||||
|
||||
$params = [
|
||||
'agent_module_id' => $this->values['moduleId'],
|
||||
'width' => '100%',
|
||||
'height' => ((int) $size['height'] - $trickHight),
|
||||
'period' => $this->values['period'],
|
||||
'title' => $module_name,
|
||||
'unit' => $units_name,
|
||||
'homeurl' => $config['homeurl'],
|
||||
'backgroundColor' => 'transparent',
|
||||
'show_legend' => $this->values['showLegend'],
|
||||
'show_title' => $module_name,
|
||||
'menu' => false,
|
||||
'dashboard' => true,
|
||||
];
|
||||
|
||||
$output = '<div class="container-center widget-mrgn-0px">';
|
||||
$output .= \grafico_modulo_sparse($params);
|
||||
if ($this->values['projection_switch'] === true) {
|
||||
$params_graphic = [
|
||||
'period' => $this->values['period'],
|
||||
'date' => strtotime(date('Y-m-d H:i:s')),
|
||||
'only_image' => false,
|
||||
'homeurl' => ui_get_full_url(false, false, false, false).'/',
|
||||
'height' => ((int) $size['height'] - $trickHight),
|
||||
'landscape' => $content['landscape'],
|
||||
'return_img_base_64' => true,
|
||||
];
|
||||
|
||||
$params_combined = [
|
||||
'projection' => $this->values['period_projection'],
|
||||
];
|
||||
|
||||
$return['chart'] = graphic_combined_module(
|
||||
[$this->values['moduleId']],
|
||||
$params_graphic,
|
||||
$params_combined
|
||||
);
|
||||
$output .= $return['chart'];
|
||||
} else {
|
||||
$params = [
|
||||
'agent_module_id' => $this->values['moduleId'],
|
||||
'width' => '100%',
|
||||
'height' => ((int) $size['height'] - $trickHight),
|
||||
'period' => $this->values['period'],
|
||||
'title' => $module_name,
|
||||
'unit' => $units_name,
|
||||
'homeurl' => $config['homeurl'],
|
||||
'backgroundColor' => 'transparent',
|
||||
'show_legend' => $this->values['showLegend'],
|
||||
'show_title' => $module_name,
|
||||
'menu' => false,
|
||||
'dashboard' => true,
|
||||
];
|
||||
$output .= \grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
return $output;
|
||||
}
|
||||
|
|
|
@ -937,3 +937,13 @@ div.basic-chart-title span {
|
|||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input.resize_button {
|
||||
position: absolute;
|
||||
background-color: white !important;
|
||||
padding: 4px !important;
|
||||
border-radius: 20px;
|
||||
width: 28px;
|
||||
bottom: 3%;
|
||||
right: 6%;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,371 @@
|
|||
div#main {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
div.box-flat.white_table_graph > div[id^="tgl_div_"] {
|
||||
border-bottom-left-radius: 8px;
|
||||
border-bottom-right-radius: 8px;
|
||||
width: 228px;
|
||||
}
|
||||
|
||||
div.box-flat.white_table_graph > div[id^="tgl_div_"] > div.white-box-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
align-items: flex-start;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
div.box-flat.white_table_graph
|
||||
> div[id^="tgl_div_"]
|
||||
> div.white-box-content
|
||||
> [data-id-agent],
|
||||
div.box-flat.white_table_graph
|
||||
> div[id^="tgl_div_"]
|
||||
> div.white-box-content
|
||||
> [data-id-group] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div#menu_tab ul li,
|
||||
div#menu_tab ul li span {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div#menu_tab ul.mn li.nomn.tab_operation img {
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
div#menu_tab ul li:hover,
|
||||
div#menu_tab ul li span:hover {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
div.main-div {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
min-height: calc(100vh - 160px);
|
||||
}
|
||||
|
||||
div.main-div.graph-analytics-public {
|
||||
min-height: calc(100vh - 2px);
|
||||
}
|
||||
|
||||
div.padding-div {
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
div.margin-div {
|
||||
margin: 10px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
div.filters-div-main {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 500px;
|
||||
min-width: 500px;
|
||||
border-right: 1px solid var(--border-dark-color);
|
||||
}
|
||||
|
||||
div.filters-div-main.filters-div-main-collapsed {
|
||||
width: 35px;
|
||||
min-width: 20px;
|
||||
border-right: 0px;
|
||||
}
|
||||
|
||||
div.filters-div-main.filters-div-main-collapsed
|
||||
*:not(.filters-div-header):not(.filters-div-header > img) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.droppable-graphs-collapsed {
|
||||
margin-left: -30px;
|
||||
}
|
||||
|
||||
div.filters-div-main > .filters-div-header {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: space-between;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
div.filters-div-main > .filters-div-header > img {
|
||||
width: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div.filters-div-submain {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
height: calc(100% - 51px);
|
||||
}
|
||||
|
||||
div.filter-div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
width: 230px;
|
||||
min-width: 230px;
|
||||
max-width: 230px;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
border-top: 1px solid var(--border-dark-color);
|
||||
}
|
||||
|
||||
.filters-left-div {
|
||||
border-right: 1px solid var(--border-dark-color);
|
||||
}
|
||||
|
||||
div.filters-right-div {
|
||||
width: 230px;
|
||||
min-width: 230px;
|
||||
max-width: 230px;
|
||||
}
|
||||
|
||||
.search-graph-analytics {
|
||||
background-image: url(../../images/details.svg);
|
||||
background-position: center right 10px;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 17px;
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
div.graphs-div-main {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.handle-graph {
|
||||
cursor: grab;
|
||||
}
|
||||
|
||||
#droppable-graphs {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.interval-div {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* Draggable */
|
||||
.draggable.ui-draggable-dragging {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.draggable {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.draggable-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin-left: -10px;
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.draggable-container:last-child {
|
||||
border-bottom: 0px;
|
||||
}
|
||||
|
||||
.draggable-module {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.draggable-icon {
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
.draggable-module > span {
|
||||
line-height: 10pt;
|
||||
}
|
||||
|
||||
.draggable-module > span.draggable-module-name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.draggable-module > span.draggable-agent-name {
|
||||
color: #8a96a6;
|
||||
}
|
||||
|
||||
/* Droppable */
|
||||
#droppable-graphs * {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.droppable {
|
||||
width: 100%;
|
||||
/* height: 20px; */
|
||||
margin-bottom: 5px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#droppable-graphs .droppable-zone {
|
||||
background-color: #0077ff80;
|
||||
border: 2px dashed #0077ff;
|
||||
border-radius: 6px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#droppable-graphs .droppable-zone > div {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
#droppable-graphs .drops-hover {
|
||||
background-color: #82b92e80;
|
||||
border: 2px dashed #82b92e;
|
||||
}
|
||||
|
||||
#droppable-graphs .droppable.droppable-default-zone:not(.droppable-new) {
|
||||
height: 70px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#droppable-graphs .droppable.droppable-default-zone.droppable-new {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#droppable-graphs
|
||||
.droppable.droppable-default-zone.droppable-new
|
||||
> span.drop-here {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#droppable-graphs .droppable.droppable-default-zone > span.drop-here {
|
||||
font-size: 15pt;
|
||||
font-weight: bold;
|
||||
color: #0077ff;
|
||||
}
|
||||
|
||||
#droppable-graphs
|
||||
.droppable.droppable-default-zone.droppable-new.ui-droppable-active
|
||||
> span.drop-here {
|
||||
display: initial;
|
||||
}
|
||||
|
||||
#droppable-graphs .droppable.droppable-default-zone.ui-droppable-active {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#droppable-graphs
|
||||
.droppable.droppable-default-zone.ui-droppable-active.drops-hover
|
||||
> span.drop-here {
|
||||
color: #82b92e;
|
||||
}
|
||||
|
||||
#droppable-graphs .droppable .draggable.ui-draggable.ui-draggable-handle {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#droppable-graphs .parent_graph {
|
||||
padding-top: 40px;
|
||||
}
|
||||
|
||||
#droppable-graphs .timestamp_graph {
|
||||
top: 15px;
|
||||
}
|
||||
|
||||
#droppable-graphs .menu_graph {
|
||||
left: 85%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
div.timestamp-top-fixed {
|
||||
top: 15px !important;
|
||||
}
|
||||
|
||||
div.graph-analytics-legend-main {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
div.graph-analytics-legend-square {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
max-width: 30px;
|
||||
margin-right: 5px;
|
||||
padding-right: 3px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
div.graph-analytics-legend-square > span {
|
||||
text-align: right;
|
||||
color: #fff;
|
||||
line-height: 9pt;
|
||||
}
|
||||
|
||||
div.graph-analytics-legend-square > span.square-unit {
|
||||
width: 30px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
div.graph-analytics-legend {
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
div.graph-analytics-legend > span {
|
||||
line-height: 12pt;
|
||||
}
|
||||
|
||||
div.graph-analytics-legend > span:first-child {
|
||||
font-weight: normal;
|
||||
font-size: 8pt;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
#droppable-graphs td.legendColorBox {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#droppable-graphs .remove-graph-analytics {
|
||||
width: 20px;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#droppable-graphs > div:hover .remove-graph-analytics {
|
||||
opacity: 1;
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -107,24 +107,51 @@
|
|||
height: 30px;
|
||||
width: 90px;
|
||||
}
|
||||
.ui-widget-header .ui-icon {
|
||||
background-image: url(../images/ui-icons_444444_256x240.png);
|
||||
|
||||
.ui-datepicker-prev {
|
||||
margin-top: 5px;
|
||||
background: url(../../../images/arrow_left_green.png) no-repeat 0 0 !important;
|
||||
}
|
||||
.ui-icon,
|
||||
.ui-widget-content .ui-icon {
|
||||
background-image: url(../images/ui-icons_444444_256x240.png);
|
||||
|
||||
.ui-datepicker-next {
|
||||
margin-top: 5px;
|
||||
background: url(../../../images/arrow_right_green.png) no-repeat 0 0 !important;
|
||||
}
|
||||
|
||||
.ui-widget-content {
|
||||
background: #fff;
|
||||
}
|
||||
.ui-state-default,
|
||||
.ui-widget-content .ui-state-default,
|
||||
.ui-widget-header .ui-state-default {
|
||||
margin-top: 3px;
|
||||
border-bottom: 0;
|
||||
background: transparent;
|
||||
font-weight: normal;
|
||||
color: #555555;
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
border: 2px solid #ccc;
|
||||
}
|
||||
.ui-datepicker td,
|
||||
a.ui-state-default,
|
||||
.ui-datepicker td a {
|
||||
width: 30px !important;
|
||||
height: 30px !important;
|
||||
}
|
||||
a.ui-state-default:hover {
|
||||
background-color: #82b92e;
|
||||
}
|
||||
a.ui-state-default > span {
|
||||
text-align: center;
|
||||
margin-top: 2px;
|
||||
}
|
||||
a.ui-state-default > span:hover {
|
||||
font-weight: bold !important;
|
||||
}
|
||||
.ui-datepicker-current-day > a {
|
||||
background-color: #82b92e !important;
|
||||
font-weight: bold !important;
|
||||
border: 2px solid #000 !important;
|
||||
}
|
||||
.ui-corner-all,
|
||||
.ui-corner-top,
|
||||
|
@ -153,13 +180,44 @@
|
|||
#ui-datepicker-div {
|
||||
border-color: #b1b1b1;
|
||||
background: #ffffff;
|
||||
border-radius: 15px;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
width: 350px !important;
|
||||
border: 2px solid var(--primary-color);
|
||||
}
|
||||
.ui-datepicker .ui-datepicker-header {
|
||||
position: relative;
|
||||
padding: 0.2em 0;
|
||||
border-radius: 15px 15px 0px 0px;
|
||||
}
|
||||
.ui-datepicker-title,
|
||||
.ui-datepicker-month,
|
||||
.ui-datepicker-year {
|
||||
height: 30px;
|
||||
}
|
||||
.ui-datepicker-month,
|
||||
.ui-datepicker-year {
|
||||
width: 100px !important;
|
||||
}
|
||||
.ui-datepicker-month {
|
||||
margin-left: -10px !important;
|
||||
margin-right: 25px !important;
|
||||
}
|
||||
.ui-widget-header {
|
||||
background: #b1b1b1;
|
||||
background: white;
|
||||
color: #ffffff;
|
||||
}
|
||||
.ui-datepicker-calendar th {
|
||||
background-color: #3f3f3f;
|
||||
background-color: #fff;
|
||||
padding-left: 15px;
|
||||
text-align: initial;
|
||||
}
|
||||
.ui-datepicker-calendar th span {
|
||||
color: #000;
|
||||
}
|
||||
.ui-widget-header {
|
||||
height: 20px !important;
|
||||
}
|
||||
.ui-dialog .ui-widget-header {
|
||||
margin: 3px 3px 0px 3px;
|
||||
|
@ -175,7 +233,10 @@
|
|||
margin: 0px 15px 0px 15px;
|
||||
}
|
||||
.ui-timepicker-div .ui-datepicker-title {
|
||||
color: white;
|
||||
color: black;
|
||||
}
|
||||
.ui-timepicker-div dl {
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
.ui-datepicker-buttonpane button {
|
||||
border-color: #b1b1b1;
|
||||
|
@ -200,7 +261,6 @@
|
|||
border: 0px;
|
||||
}
|
||||
|
||||
.ui-state-hover .ui-icon,
|
||||
.ui-state-focus .ui-icon,
|
||||
.ui-button:hover .ui-icon,
|
||||
.ui-button:focus .ui-icon {
|
||||
|
@ -233,35 +293,6 @@ a.ui-button:active,
|
|||
border: none;
|
||||
}
|
||||
|
||||
.ui-state-hover:before,
|
||||
.ui-widget-content .ui-state-hover:before,
|
||||
.ui-widget-header .ui-state-hover:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 25%;
|
||||
bottom: -10%;
|
||||
height: 1px;
|
||||
width: 50%;
|
||||
border-bottom: 4px solid #82b92e;
|
||||
}
|
||||
|
||||
.ui-priority-secondary:hover {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: -5px;
|
||||
width: 100%;
|
||||
border-bottom: 5px solid #82b92e;
|
||||
}
|
||||
|
||||
.ui-priority-primary:hover {
|
||||
content: "";
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
bottom: -5px;
|
||||
width: 100%;
|
||||
border-bottom: 5px solid #82b92e;
|
||||
}
|
||||
|
||||
.ui-state-active,
|
||||
.ui-widget-content .ui-state-active,
|
||||
.ui-widget-header .ui-state-active {
|
||||
|
@ -314,3 +345,21 @@ input[type="submit"].ui-button-dialog {
|
|||
height: 30px;
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
.ui-priority-primary,
|
||||
.ui-priority-secondary {
|
||||
background-color: #fff !important;
|
||||
color: var(--primary-color) !important;
|
||||
border: 2px solid var(--primary-color) !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.ui-timepicker-div > dl dt,
|
||||
.ui-timepicker-div > dl dd {
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.ui-timepicker-div > dl dt,
|
||||
.ui_tpicker_time {
|
||||
margin-left: 10px !important;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
--secondary-color: #ffffff;
|
||||
--input-border: #c0ccdc;
|
||||
--border-color: #eee;
|
||||
--border-dark-color: #e1e1e1;
|
||||
--text-color: #333;
|
||||
}
|
||||
|
||||
|
@ -12362,6 +12363,10 @@ tr[id^="network_component-plugin-snmp-fields-dynamicMacroRow-"] input {
|
|||
width: 100% !important;
|
||||
}
|
||||
|
||||
.group_view_table > tbody > tr > td {
|
||||
width: 350px !important;
|
||||
}
|
||||
|
||||
.notificaion_menu_container {
|
||||
display: flex;
|
||||
padding-top: 10px;
|
||||
|
@ -12557,3 +12562,7 @@ tr[id^="network_component-plugin-snmp-fields-dynamicMacroRow-"] input {
|
|||
flex-wrap: nowrap;
|
||||
justify-content: flex-start !important;
|
||||
}
|
||||
|
||||
.ui-date-range-in > a {
|
||||
background-color: #81b92e3b !important;
|
||||
}
|
||||
|
|
|
@ -727,6 +727,13 @@ div.module-graph .gauge_d3_class {
|
|||
background: #82b92e;
|
||||
}
|
||||
|
||||
#box-rectangle-selection {
|
||||
position: absolute;
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
border: 2px solid #002f33;
|
||||
}
|
||||
|
||||
/* Styles for the solid icons */
|
||||
|
||||
.fa {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue