Merge branch 'develop' into ent-11326-security-hardening-console

This commit is contained in:
Daniel Cebrian 2023-07-26 10:55:49 +02:00
commit 001ffc1799
150 changed files with 5931 additions and 1635 deletions

View File

@ -11,7 +11,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='2023050901' S_VERSION='2023062901'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables # define default variables
@ -285,8 +285,7 @@ console_dependencies=" \
mod_ssl \ mod_ssl \
libzstd \ libzstd \
openldap-clients \ openldap-clients \
chromium \ chromium"
http://firefly.pandorafms.com/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies" execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
# Server dependencies # Server dependencies
@ -313,7 +312,6 @@ server_dependencies=" \
bind-utils \ bind-utils \
whois \ whois \
cpanminus \ cpanminus \
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \ http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \
https://firefly.pandorafms.com/centos7/pandorawmic-1.0.0-1.x86_64.rpm" https://firefly.pandorafms.com/centos7/pandorawmic-1.0.0-1.x86_64.rpm"
execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies" execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
@ -341,7 +339,6 @@ execute_cmd "yum install -y $oracle_dependencies || yum reinstall -y $oracle_dep
#ipam dependencies #ipam dependencies
ipam_dependencies=" \ ipam_dependencies=" \
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
perl(NetAddr::IP) \ perl(NetAddr::IP) \
perl(Sys::Syslog) \ perl(Sys::Syslog) \
perl(DBI) \ perl(DBI) \
@ -719,6 +716,9 @@ echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cro
systemctl enable pandora_agent_daemon &>> $LOGFILE systemctl enable pandora_agent_daemon &>> $LOGFILE
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent" execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
# Enable postrix
systemctl enable postfix --now &>> "$LOGFILE"
#SSH banner #SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me) [ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)

View File

@ -14,7 +14,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='2023050901' S_VERSION='2023062901'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables # define default variables
@ -344,8 +344,7 @@ console_dependencies=" \
http://firefly.pandorafms.com/centos8/chromium-110.0.5481.177-1.el7.x86_64.rpm \ http://firefly.pandorafms.com/centos8/chromium-110.0.5481.177-1.el7.x86_64.rpm \
http://firefly.pandorafms.com/centos8/chromium-common-110.0.5481.177-1.el7.x86_64.rpm \ http://firefly.pandorafms.com/centos8/chromium-common-110.0.5481.177-1.el7.x86_64.rpm \
http://firefly.pandorafms.com/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \ http://firefly.pandorafms.com/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \ http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm"
http://firefly.pandorafms.com/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
execute_cmd "dnf install -y $console_dependencies" "Installing Pandora FMS Console dependencies" execute_cmd "dnf install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
# Server dependencies # Server dependencies
@ -371,7 +370,7 @@ server_dependencies=" \
java \ java \
bind-utils \ bind-utils \
whois \ whois \
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \ libnsl \
http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \ http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \
https://firefly.pandorafms.com/centos8/pandorawmic-1.0.0-1.x86_64.rpm" https://firefly.pandorafms.com/centos8/pandorawmic-1.0.0-1.x86_64.rpm"
execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies" execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
@ -399,7 +398,6 @@ execute_cmd "dnf install -y $oracle_dependencies" "Installing Oracle Instant cli
#ipam dependencies #ipam dependencies
ipam_dependencies=" \ ipam_dependencies=" \
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
perl(NetAddr::IP) \ perl(NetAddr::IP) \
perl(Sys::Syslog) \ perl(Sys::Syslog) \
perl(DBI) \ perl(DBI) \
@ -622,8 +620,9 @@ sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini
sed -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini sed -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini
sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
#adding 900s to httpd timeout #adding 900s to httpd timeout and 300 to ProxyTimeout
echo 'TimeOut 900' > /etc/httpd/conf.d/timeout.conf echo 'TimeOut 900' > /etc/httpd/conf.d/timeout.conf
echo 'ProxyTimeout 300' >> /etc/httpd/conf.d/timeout.conf
cat > /var/www/html/index.html << EOF_INDEX cat > /var/www/html/index.html << EOF_INDEX
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/"> <meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">
@ -787,6 +786,9 @@ echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cro
systemctl enable pandora_agent_daemon &>> "$LOGFILE" systemctl enable pandora_agent_daemon &>> "$LOGFILE"
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent" execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
# Enable postfix
systemctl enable postfix --now &>> "$LOGFILE"
#SSH banner #SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me) [ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)

View File

@ -17,7 +17,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
WORKDIR=/opt/pandora/deploy WORKDIR=/opt/pandora/deploy
S_VERSION='2023050901' S_VERSION='2023062901'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
rm -f $LOGFILE &> /dev/null # remove last log before start rm -f $LOGFILE &> /dev/null # remove last log before start
@ -265,7 +265,6 @@ server_dependencies=" \
openssh-client \ openssh-client \
postfix \ postfix \
unzip \ unzip \
xprobe \
coreutils \ coreutils \
libio-compress-perl \ libio-compress-perl \
libmoosex-role-timer-perl \ libmoosex-role-timer-perl \
@ -287,6 +286,7 @@ server_dependencies=" \
libgeo-ip-perl \ libgeo-ip-perl \
arping \ arping \
snmp-mibs-downloader \ snmp-mibs-downloader \
libnsl2 \
openjdk-8-jdk " openjdk-8-jdk "
execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server dependencies" execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
@ -299,17 +299,7 @@ echo -en "${cyan}Installing wmic and pandorawmic...${reset}"
chmod +x pandorawmic wmic &>> "$LOGFILE" && \ chmod +x pandorawmic wmic &>> "$LOGFILE" && \
cp -a wmic /usr/bin/ &>> "$LOGFILE" && \ cp -a wmic /usr/bin/ &>> "$LOGFILE" && \
cp -a pandorawmic /usr/bin/ &>> "$LOGFILE" cp -a pandorawmic /usr/bin/ &>> "$LOGFILE"
check_cmd_status "Error Installing phanromjs" check_cmd_status "Error Installing pandorawmic/wmic"
# phantomjs
echo -en "${cyan}Installing phantomjs...${reset}"
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
export OPENSSL_CONF=/etc/ssl
curl -LSs -O "https://firefly.pandorafms.com/pandorafms/utils/$PHANTOM_JS.tar.bz2" &>> "$LOGFILE" && \
tar xvjf "$PHANTOM_JS.tar.bz2" &>> "$LOGFILE" && \
mv $PHANTOM_JS/bin/phantomjs /usr/bin &>> "$LOGFILE" && \
/usr/bin/phantomjs --version &>> "$LOGFILE"
check_cmd_status "Error Installing phanromjs"
# create symlink for fping # create symlink for fping
rm -f /usr/sbin/fping &>> "$LOGFILE" rm -f /usr/sbin/fping &>> "$LOGFILE"
@ -370,7 +360,6 @@ source '/root/.profile' &>> "$LOGFILE"
#ipam dependencies #ipam dependencies
ipam_dependencies=" \ ipam_dependencies=" \
xprobe \
libnetaddr-ip-perl \ libnetaddr-ip-perl \
coreutils \ coreutils \
libdbd-mysql-perl \ libdbd-mysql-perl \
@ -619,8 +608,9 @@ sed --follow-symlinks -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.i
sed --follow-symlinks -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini sed --follow-symlinks -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
sed --follow-symlinks -i -e "s/^disable_functions/;disable_functions/" /etc/php.ini sed --follow-symlinks -i -e "s/^disable_functions/;disable_functions/" /etc/php.ini
#adding 900s to httpd timeout #adding 900s to httpd timeout and 300 to ProxyTimeout
#echo 'TimeOut 900' > /etc/httpd/conf.d/timeout.conf echo 'TimeOut 900' > /etc/apache2/conf-enabled/timeout.conf
echo 'ProxyTimeout 300' >> /etc/apache2/conf-enabled/timeout.conf
cat > /var/www/html/index.html << EOF_INDEX cat > /var/www/html/index.html << EOF_INDEX
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/"> <meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">
@ -792,6 +782,9 @@ systemctl enable pandora_agent_daemon &>> "$LOGFILE"
#fix path phantomjs #fix path phantomjs
sed --follow-symlinks -i -e "s/^openssl_conf = openssl_init/#openssl_conf = openssl_init/g" /etc/ssl/openssl.cnf &>> "$LOGFILE" sed --follow-symlinks -i -e "s/^openssl_conf = openssl_init/#openssl_conf = openssl_init/g" /etc/ssl/openssl.cnf &>> "$LOGFILE"
# Enable postfix
systemctl enable postfix --now &>> "$LOGFILE"
#SSH banner #SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me) [ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.772" PI_VERSION="7.0NG.772"
PI_BUILD="230712" PI_BUILD="230725"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0
@ -541,8 +541,17 @@ install () {
then then
echo "Define 'pandora_agent=\"YES\"' in /etc/rc.conf to enable the daemon." echo "Define 'pandora_agent=\"YES\"' in /etc/rc.conf to enable the daemon."
else else
echo "Check your startup configuration to be sure Pandora FMS Agent is ready " # Enable startup service
echo "to start automatically when system restarts": if [ `command -v systemctl` ]
then
systemctl enable pandora_agent_daemon
elif [ `command -v chkconfig` ]
then
chkconfig pandora_agent_daemon on
else
echo "Check your startup configuration to be sure Pandora FMS Agent is ready "
echo "to start automatically when system restarts":
fi
fi fi
# Restore the daemon script # Restore the daemon script

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{230712} {230725}
ViewReadme ViewReadme
{Yes} {Yes}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1692,3 +1692,14 @@ enterprise/godmode/modules/manage_inventory_modules_form.php
enterprise/operation/inventory/inventory.php enterprise/operation/inventory/inventory.php
include/test.js include/test.js
include/web2image.js include/web2image.js
enterprise/meta/monitoring/wizard/wizard.agent.php
enterprise/meta/monitoring/wizard/wizard.create_agent.php
enterprise/meta/monitoring/wizard/wizard.create_module.php
enterprise/meta/monitoring/wizard/wizard.main.php
enterprise/meta/monitoring/wizard/wizard.manage_alert.php
enterprise/meta/monitoring/wizard/wizard.module.local.php
enterprise/meta/monitoring/wizard/wizard.module.network.php
enterprise/meta/monitoring/wizard/wizard.module.web.php
enterprise/meta/monitoring/wizard/wizard.php
enterprise/meta/monitoring/wizard/wizard.update_agent.php
enterprise/meta/monitoring/wizard/wizard.update_module.php

View File

@ -1,5 +1,23 @@
START TRANSACTION; START TRANSACTION;
CREATE TABLE IF NOT EXISTS `tnetwork_explorer_filter` (
`id` INT NOT NULL,
`filter_name` VARCHAR(45) NULL,
`top` VARCHAR(45) NULL,
`action` VARCHAR(45) NULL,
`advanced_filter` TEXT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tnetwork_usage_filter` (
`id` INT NOT NULL auto_increment,
`filter_name` VARCHAR(45) NULL,
`top` VARCHAR(45) NULL,
`action` VARCHAR(45) NULL,
`advanced_filter` TEXT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `tlayout` ALTER TABLE `tlayout`
ADD COLUMN `grid_color` VARCHAR(45) NOT NULL DEFAULT '#cccccc' AFTER `maintenance_mode`, ADD COLUMN `grid_color` VARCHAR(45) NOT NULL DEFAULT '#cccccc' AFTER `maintenance_mode`,
ADD COLUMN `grid_size` VARCHAR(45) NOT NULL DEFAULT '10' AFTER `grid_color`; ADD COLUMN `grid_size` VARCHAR(45) NOT NULL DEFAULT '10' AFTER `grid_color`;

View File

@ -34,6 +34,22 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$notifications_numbers['notifications'], $notifications_numbers['notifications'],
$notifications_numbers['last_id'] $notifications_numbers['last_id']
).'</div>'; ).'</div>';
$header_welcome = '';
if (check_acl($config['id_user'], $group, 'AW')) {
$header_welcome .= '<div id="welcome-icon-header">';
$header_welcome .= html_print_image(
'images/wizard@svg.svg',
true,
[
'class' => 'main_menu_icon invert_filter',
'title' => __('Welcome dialog'),
'id' => 'Welcome-dialog',
'alt' => __('Welcome dialog'),
'style' => 'cursor: pointer;',
]
);
$header_welcome .= '</div>';
}
// ======= Servers List =============================================== // ======= Servers List ===============================================
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) { if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
@ -461,7 +477,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
} else { } else {
echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div> echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div>
<div class="header_center">'.$header_searchbar.'</div> <div class="header_center">'.$header_searchbar.'</div>
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $servers_list, $header_feedback, $header_support, $header_docu, $header_user, $header_logout.'</div>'; <div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $header_welcome, $servers_list, $header_feedback, $header_support, $header_docu, $header_user, $header_logout.'</div>';
} }
?> ?>
</div> <!-- Closes #table_header_inner --> </div> <!-- Closes #table_header_inner -->
@ -904,6 +920,44 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$("#agent_access").css("display",""); $("#agent_access").css("display","");
}); });
$("#welcome-icon-header").click(function () {
if (!$('#welcome_modal_window').length){
$(document.body).append('<div id="welcome_modal_window"></div>');
$(document.body).append( $('<link rel="stylesheet" type="text/css" />').attr('href', 'include/styles/new_installation_welcome_window.css') );
}
// Clean DOM.
load_modal({
target: $('#welcome_modal_window'),
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
modal: {
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
cancel: '<?php echo __('Do not show anymore'); ?>',
ok: '<?php echo __('Close'); ?>'
},
onshow: {
page: 'include/ajax/welcome_window',
method: 'loadWelcomeWindow',
},
oncancel: {
page: 'include/ajax/welcome_window',
title: "<?php echo __('Cancel Configuration Window'); ?>",
method: 'cancelWelcome',
confirm: function (fn) {
confirmDialog({
title: '<?php echo __('Are you sure?'); ?>',
message: '<?php echo __('Are you sure you want to cancel this tutorial?'); ?>',
ok: '<?php echo __('OK'); ?>',
cancel: '<?php echo __('Cancel'); ?>',
onAccept: function() {
// Continue execution.
fn();
}
})
}
}
});
});
<?php if (enterprise_installed()) { ?> <?php if (enterprise_installed()) { ?>
// Feedback. // Feedback.
$("#feedback-header").click(function () { $("#feedback-header").click(function () {

View File

@ -100,21 +100,23 @@ if ($initial && users_is_admin()) {
); );
} }
$welcome = !$initial; if (check_acl($config['id_user'], 0, 'AW')) {
try { $welcome = !$initial;
$welcome_window = new WelcomeWindow($welcome); try {
if ($welcome_window !== null) { $welcome_window = new WelcomeWindow($welcome);
$welcome_window->run(); if ($welcome_window !== null) {
$welcome_window->run();
}
} catch (Exception $e) {
$welcome = false;
} }
} catch (Exception $e) {
$welcome = false;
} }
try { try {
if (isset($_SESSION['showed_tips_window']) === false) { if (isset($_SESSION['showed_tips_window']) === false) {
$tips_window = new TipsWindow(); $tips_window = new TipsWindow();
if ($tips_window !== null) { if ($tips_window !== null) {
$tips_window->run(); $tips_window->run();
} }
} }
} catch (Exception $e) { } catch (Exception $e) {

View File

@ -212,7 +212,7 @@ $groups = users_get_groups($config['id_user'], 'AR', false);
// Get modules. // Get modules.
$modules = db_get_all_rows_sql( $modules = db_get_all_rows_sql(
'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo 'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
WHERE id_agente = '.$id_parent WHERE id_agente = '.$id_agente
); );
$modules_values = []; $modules_values = [];
$modules_values[0] = __('Any'); $modules_values[0] = __('Any');

View File

@ -80,7 +80,7 @@ if (isset($_POST['template_id']) === true) {
$values = [ $values = [
'id_agente' => $id_agente, 'id_agente' => $id_agente,
'id_tipo_modulo' => $row2['type'], 'id_tipo_modulo' => $row2['type'],
'descripcion' => __('Created by template ').$name_template.' . '.$row2['description'], 'descripcion' => $row2['description'],
'max' => $row2['max'], 'max' => $row2['max'],
'min' => $row2['min'], 'min' => $row2['min'],
'module_interval' => $row2['module_interval'], 'module_interval' => $row2['module_interval'],

View File

@ -460,6 +460,18 @@ if ($id_agente) {
$templatetab['active'] = ($tab === 'template'); $templatetab['active'] = ($tab === 'template');
// Policy tab.
$policyTab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=policy&amp;id_agente='.$id_agente,
'image' => 'images/policy@svg.svg',
'title' => __('Manage policy'),
],
true
);
$policyTab['active'] = ($tab === 'policy');
// Inventory. // Inventory.
$inventorytab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'">'.html_print_image( $inventorytab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'">'.html_print_image(
'images/hardware-software-component@svg.svg', 'images/hardware-software-component@svg.svg',
@ -638,6 +650,7 @@ if ($id_agente) {
'template' => $templatetab, 'template' => $templatetab,
'inventory' => $inventorytab, 'inventory' => $inventorytab,
'pluginstab' => $pluginstab, 'pluginstab' => $pluginstab,
'policy' => (enterprise_installed() === true) ? $policyTab : '',
'collection' => $collectiontab, 'collection' => $collectiontab,
'group' => $grouptab, 'group' => $grouptab,
'gis' => $gistab, 'gis' => $gistab,
@ -654,11 +667,11 @@ if ($id_agente) {
'template' => $templatetab, 'template' => $templatetab,
'inventory' => $inventorytab, 'inventory' => $inventorytab,
'pluginstab' => $pluginstab, 'pluginstab' => $pluginstab,
'policy' => (enterprise_installed() === true) ? $policyTab : '',
'collection' => $collectiontab, 'collection' => $collectiontab,
'group' => $grouptab, 'group' => $grouptab,
'gis' => $gistab, 'gis' => $gistab,
'agent_wizard' => $agent_wizard, 'agent_wizard' => $agent_wizard,
]; ];
} }
@ -725,6 +738,11 @@ if ($id_agente) {
$tab_name = __('Inventory'); $tab_name = __('Inventory');
break; break;
case 'policy':
$help_header = 'policy_tab';
$tab_name = __('Policies');
break;
case 'plugins': case 'plugins':
$help_header = 'plugins_tab'; $help_header = 'plugins_tab';
$tab_name = __('Agent plugins'); $tab_name = __('Agent plugins');
@ -2428,6 +2446,10 @@ switch ($tab) {
include 'inventory_manager.php'; include 'inventory_manager.php';
break; break;
case 'policy':
enterprise_include('operation/agentes/policy_manager.php');
break;
default: default:
if (enterprise_hook('switch_agent_tab', [$tab])) { if (enterprise_hook('switch_agent_tab', [$tab])) {
// This will make sure that blank pages will have at least some // This will make sure that blank pages will have at least some

View File

@ -1072,16 +1072,20 @@ if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
function () { function () {
$(".actions", this).css ("visibility", "hidden"); $(".actions", this).css ("visibility", "hidden");
}); });
$("#ag_group").click ( $("#ag_group").click (
function () { function () {
$(this).css ("width", "auto"); $(this).css ("width", "auto");
$(this).css ("min-width", "100px"); $(this).css ("min-width", "100px");
}); });
$("#ag_group").blur (function () { $("#ag_group").blur (function () {
$(this).css ("width", "100px"); $(this).css ("width", "100px");
}); });
var show_deploy_agent = "<?php echo get_parameter('show_deploy_agent', 0); ?>";
if (show_deploy_agent !== '0'){
$('#button-modal_deploy_agent').click();
}
}); });
</script> </script>

View File

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

View File

@ -40,6 +40,8 @@ $table->size = [];
$table->style[0] = 'width: 50%'; $table->style[0] = 'width: 50%';
$table->style[1] = 'width: 50%'; $table->style[1] = 'width: 50%';
$modules = [];
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$params = []; $params = [];
$params['return'] = true; $params['return'] = true;
@ -79,8 +81,6 @@ if (is_metaconsole() === true) {
} }
} }
$modules = [];
$table->data[0][1] = html_print_label_input_block( $table->data[0][1] = html_print_label_input_block(
__('Module'), __('Module'),
html_print_select( html_print_select(

View File

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

View File

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

View File

@ -86,31 +86,39 @@ if ($do_operation) {
$groups = users_get_groups(); $groups = users_get_groups();
$table = new stdClass(); $table = new stdClass();
$table->class = 'databox filters';
$table->width = '100%';
$table->data = [];
$table->style = [];
$table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold';
$table->style[4] = 'font-weight: bold';
$table->style[6] = 'font-weight: bold';
// Source selection
$table->id = 'source_table'; $table->id = 'source_table';
$table->data[0][0] = __('Group'); $table->class = 'databox filters filter-table-adv';
$table->data[0][1] = html_print_select_groups( $table->width = '100%';
false, $table->size[0] = '50%';
'AW', $table->size[1] = '50%';
true, $table->data = [];
'source_id_group',
$source_id_group, // Source selection.
false, $table->data[0][0] = html_print_label_input_block(
'', __('Group'),
'', html_print_select_groups(
true false,
'AW',
true,
'source_id_group',
$source_id_group,
false,
'',
'',
true,
false,
false,
'w100p',
false,
'width:100%'
)
); );
$table->data[0][2] = __('Group recursion');
$table->data[0][3] = html_print_checkbox('source_recursion', 1, $source_recursion, true, false); $table->data[0][1] = html_print_label_input_block(
__('Group recursion'),
html_print_checkbox('source_recursion', 1, $source_recursion, true, false)
);
$status_list = []; $status_list = [];
$status_list[AGENT_STATUS_NORMAL] = __('Normal'); $status_list[AGENT_STATUS_NORMAL] = __('Normal');
$status_list[AGENT_STATUS_WARNING] = __('Warning'); $status_list[AGENT_STATUS_WARNING] = __('Warning');
@ -118,37 +126,52 @@ $status_list[AGENT_STATUS_CRITICAL] = __('Critical');
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown'); $status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); $status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init'); $status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
$table->data[0][4] = __('Status');
$table->data[0][5] = html_print_select( $table->data[1][0] = html_print_label_input_block(
$status_list, __('Status'),
'status_agents_source', html_print_select(
'selected', $status_list,
'', 'status_agents_source',
__('All'), 'selected',
AGENT_STATUS_ALL, '',
true __('All'),
AGENT_STATUS_ALL,
true,
false,
true,
'w100p'
)
); );
$table->data[0][6] = __('Agent');
$table->data[0][6] .= ' <span id="source_agent_loading" class="invisible">';
$table->data[0][6] .= html_print_image('images/spinner.png', true);
$table->data[0][6] .= '</span>';
// $table->data[0][7] = html_print_select (agents_get_group_agents ($source_id_group, false, "none"),
// 'source_id_agent', $source_id_agent, false, __('Select'), 0, true);
$agents = ( $source_id_group ? agents_get_group_agents($source_id_group, false, 'none') : agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false))) ); $agents = ( $source_id_group ? agents_get_group_agents($source_id_group, false, 'none') : agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false))) );
$table->data[0][7] = html_print_select($agents, 'source_id_agent', $source_id_agent, false, __('Select'), 0, true); $table->data[1][1] = html_print_label_input_block(
__('Agent').' <span id="source_agent_loading" class="invisible">'.html_print_image('images/spinner.png', true).'</span>',
echo '<form '.'action="index.php?'.'sec=gmassive&'.'sec2=godmode/massive/massive_operations&'.'option=copy_modules" '.'id="manage_config_form" '.'method="post">'; html_print_select(
$agents,
'source_id_agent',
$source_id_agent,
false,
__('Select'),
0,
true
)
);
echo '<form action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=copy_modules" id="manage_config_form" method="post" class="max_floating_element_size">';
echo '<fieldset id="fieldset_source">'; echo '<fieldset id="fieldset_source">';
echo '<legend>'; echo '<legend><span>'.__('Source').'</span></legend>';
echo '<span>'.__('Source');
echo '</legend>';
html_print_table($table); html_print_table($table);
echo '</fieldset>'; echo '</fieldset>';
// Target selection
unset($table);
// Target selection.
$table = new stdClass();
$table->id = 'target_table'; $table->id = 'target_table';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->width = '100%';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = []; $table->data = [];
$modules = []; $modules = [];
@ -169,66 +192,64 @@ foreach ($agent_alerts as $alert) {
} }
$tags = tags_get_user_tags(); $tags = tags_get_user_tags();
$table->data['tags'][0] = __('Tags'); $table->colspan[0][0] = 2;
$table->data['tags'][1] = html_print_select( $table->data[0][0] = html_print_label_input_block(
$tags, __('Tags'),
'tags[]', html_print_select(
$tags_name, $tags,
false, 'tags[]',
__('Any'), $tags_name,
-1, false,
true, __('Any'),
true, -1,
true true,
true,
true,
'',
false,
'overflow-x: hidden;white-space: nowrap;max-width: 1136px;'
)
); );
$table->data['operations'][0] = __('Operations'); $table->data[1][0] = html_print_label_input_block(
$table->data['operations'][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">'; __('Operations'),
$table->data['operations'][1] .= html_print_checkbox('copy_modules', 1, true, true); '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">'.html_print_checkbox('copy_modules', 1, true, true).html_print_label(__('Copy modules'), 'checkbox-copy_modules', true).'</span><span class="with_alerts'.(empty($alerts) ? ' invisible' : '').'">'.html_print_checkbox('copy_alerts', 1, true, true).html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true).'</span>'
$table->data['operations'][1] .= html_print_label(__('Copy modules'), 'checkbox-copy_modules', true);
$table->data['operations'][1] .= '</span><br />';
$table->data['operations'][1] .= '<span class="with_alerts'.(empty($alerts) ? ' invisible' : '').'">';
$table->data['operations'][1] .= html_print_checkbox('copy_alerts', 1, true, true);
$table->data['operations'][1] .= html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true);
$table->data['operations'][1] .= '</span>';
$table->data['form_modules_filter'][0] = __('Filter Modules');
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
$table->data[1][0] = __('Modules');
$table->data[1][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">';
$table->data[1][1] .= html_print_select(
$modules,
'target_modules[]',
0,
false,
'',
'',
true,
true
); );
$table->data[1][1] .= '</span>';
$table->data[1][1] .= '<span class="without_modules'.(! empty($modules) ? ' invisible' : '').'">';
$table->data[1][1] .= '<em>'.__('No modules for this agent').'</em>';
$table->data[1][1] .= '</span>';
$table->data[2][0] = __('Alerts'); $table->data[1][1] = html_print_label_input_block(
$table->data[2][1] = '<span class="with_alerts'.(empty($alerts) ? ' invisible' : '').'">'; __('Filter Modules'),
$table->data[2][1] .= html_print_select( html_print_input_text('filter_modules', '', '', 20, 255, true)
$alerts, );
'target_alerts[]',
0, $table->colspan[2][0] = 2;
false, $table->data[2][0] = html_print_label_input_block(
'', __('Modules'),
'', '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">'.html_print_select(
true, $modules,
true 'target_modules[]',
0,
false,
'',
'',
true,
true
).'</span><span class="without_modules'.(! empty($modules) ? ' invisible' : '').'"><em>'.__('No modules for this agent').'</em></span>'
);
$table->colspan[3][0] = 2;
$table->data[3][0] = html_print_label_input_block(
__('Alerts'),
'<span class="with_alerts'.(empty($alerts) ? ' invisible' : '').'">'.html_print_select(
$alerts,
'target_alerts[]',
0,
false,
'',
'',
true,
true
).'</span><span class="without_alerts'.(! empty($modules) ? ' invisible' : '').'"><em>'.__('No alerts for this agent').'</em></span>'
); );
$table->data[2][1] .= '</span>';
$table->data[2][1] .= '<span class="without_alerts'.(! empty($modules) ? ' invisible' : '').'">';
$table->data[2][1] .= '<em>'.__('No alerts for this agent').'</em>';
$table->data[2][1] .= '</span>';
echo '<div id="modules_loading" class="loading invisible">'; echo '<div id="modules_loading" class="loading invisible">';
html_print_image('images/spinner.png'); html_print_image('images/spinner.png');
@ -240,35 +261,50 @@ echo '<legend><span>'.__('Targets').'</span></legend>';
html_print_table($table); html_print_table($table);
echo '</fieldset>'; echo '</fieldset>';
unset($table);
// Destiny selection // Destiny selection.
$table = new stdClass();
$table->id = 'destiny_table'; $table->id = 'destiny_table';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->width = '100%';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = []; $table->data = [];
$table->size[0] = '20%';
$table->size[1] = '30%';
$table->size[2] = '20%';
$table->size[3] = '30%';
$table->data[0][0] = __('Group'); $table->data[0][0] = html_print_label_input_block(
$table->data[0][1] = html_print_select_groups( __('Group'),
false, html_print_select_groups(
'AW', false,
true, 'AW',
'destiny_id_group', true,
$destiny_id_group, 'destiny_id_group',
false, $destiny_id_group,
'', false,
'', '',
true '',
true,
false,
false,
'w100p',
false,
'width:100%'
)
); );
$table->data[0][2] = __('Group recursion');
$table->data[0][3] = html_print_checkbox( $table->data[0][1] = html_print_label_input_block(
'destiny_recursion', __('Group recursion'),
1, html_print_checkbox(
$destiny_recursion, 'destiny_recursion',
true, 1,
false $destiny_recursion,
true,
false
)
);
$table->data[1][0] = html_print_label_input_block(
__('Filter Agents'),
html_print_input_text('filter_agents', '', '', 20, 255, true)
); );
$status_list = []; $status_list = [];
@ -278,32 +314,30 @@ $status_list[AGENT_STATUS_CRITICAL] = __('Critical');
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown'); $status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); $status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init'); $status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
$table->data[1][0] = __('Status'); $table->data[1][1] = html_print_label_input_block(
$table->data[1][1] = html_print_select( __('Status'),
$status_list, html_print_select(
'status_agents_destiny', $status_list,
'selected', 'status_agents_destiny',
'', 'selected',
__('All'), '',
AGENT_STATUS_ALL, __('All'),
true AGENT_STATUS_ALL,
true
)
); );
$table->data['form_agents_filter'][0] = __('Filter Agents');
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
$table->data[2][0] = __('Agent');
$table->data[2][0] .= '<span id="destiny_agent_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true);
$table->data[2][0] .= '</span>';
$agents = []; $agents = [];
if ($source_id_agent) { if ($source_id_agent) {
$agents = ( $destiny_id_group ? agents_get_group_agents($destiny_id_group, false, 'none') : agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false))) ); $agents = ( $destiny_id_group ? agents_get_group_agents($destiny_id_group, false, 'none') : agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false))) );
unset($agents[$source_id_agent]); unset($agents[$source_id_agent]);
} }
$table->data[2][1] = html_print_select($agents, 'destiny_id_agent[]', 0, false, '', '', true, true); $table->colspan[2][0] = 2;
$table->data[2][0] = html_print_label_input_block(
__('Agent').'<span id="destiny_agent_loading" class="invisible">'.html_print_image('images/spinner.png', true).'</span>',
html_print_select($agents, 'destiny_id_agent[]', 0, false, '', '', true, true)
);
echo '<fieldset id="fieldset_destiny"'.($source_id_agent ? '' : ' class="invisible"').'>'; echo '<fieldset id="fieldset_destiny"'.($source_id_agent ? '' : ' class="invisible"').'>';
echo '<legend><span>'.__('To agent(s)').'</span></legend>'; echo '<legend><span>'.__('To agent(s)').'</span></legend>';

View File

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

View File

@ -310,45 +310,47 @@ foreach ($module_types as $type) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = []; $table->data = [];
$table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold';
$table->data['selection_mode'][0] = __('Selection mode'); $table->data[0][0] = html_print_label_input_block(
$table->data['selection_mode'][1] = '<span class="massive_span">'.__('Select modules first ').'</span>'.html_print_radio_button_extended('selection_mode', 'modules', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true).'<br>'; __('Selection mode'),
$table->data['selection_mode'][1] .= '<span class="massive_span">'.__('Select agents first ').'</span>'.html_print_radio_button_extended('selection_mode', 'agents', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true); '<div class="flex"><span class="massive_span">'.__('Select modules first ').'</span>'.html_print_radio_button_extended('selection_mode', 'modules', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true).'<br><span class="massive_span">'.__('Select agents first ').'</span>'.html_print_radio_button_extended('selection_mode', 'agents', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true).'</div>'
$table->rowclass['form_modules_1'] = 'select_modules_row';
$table->data['form_modules_1'][0] = __('Module type');
$table->data['form_modules_1'][0] .= '<span id="module_loading" class="invisible">';
$table->data['form_modules_1'][0] .= html_print_image('images/spinner.png', true);
$table->data['form_modules_1'][0] .= '</span>';
$types[0] = __('All');
$table->colspan['form_modules_1'][1] = 2;
$table->data['form_modules_1'][1] = html_print_select(
$types,
'module_type',
'',
false,
__('Select'),
-1,
true,
false,
true,
'',
false,
'width:100%'
); );
$table->data['form_modules_1'][3] = __('Select all modules of this type').' '.html_print_checkbox_extended(
'force_type', $table->rowclass[1] = 'select_modules_row';
'type', $types[0] = __('All');
'', $table->data[1][0] = html_print_label_input_block(
'', __('Module type').'<span id="module_loading" class="invisible">'.html_print_image('images/spinner.png', true).'</span>',
false, html_print_select(
'class="mrgn_right_40px"', $types,
true, 'module_type',
'' '',
false,
__('Select'),
-1,
true,
false,
true,
'',
false,
'width:100%'
)
);
$table->data[1][1] = html_print_label_input_block(
__('Select all modules of this type'),
html_print_checkbox_extended(
'force_type',
'type',
'',
'',
false,
'class="mrgn_right_40px"',
true,
''
)
); );
$modules = []; $modules = [];
@ -368,52 +370,59 @@ foreach ($names as $name) {
$modules[$name['nombre']] = $name['nombre']; $modules[$name['nombre']] = $name['nombre'];
} }
$table->rowclass['form_agents_1'] = 'select_agents_row'; $table->rowclass[2] = 'select_agents_row';
$table->data['form_agents_1'][0] = __('Agent group');
$groups = users_get_groups($config['id_user'], 'AW', false); $groups = users_get_groups($config['id_user'], 'AW', false);
$groups[0] = __('All'); $groups[0] = __('All');
$table->colspan['form_agents_1'][1] = 2; $table->data[2][0] = html_print_label_input_block(
$table->data['form_agents_1'][1] = html_print_select_groups( __('Agent group'),
false, html_print_select_groups(
'AW', false,
true, 'AW',
'groups_select', true,
'', 'groups_select',
false, '',
'', false,
'', '',
true '',
).' '.__('Group recursion').' '.html_print_checkbox('recursion', 1, false, true, false); true
$table->data['form_agents_1'][3] = __('Select all modules of this group').' '.html_print_checkbox_extended( ).' '.__('Group recursion').' '.html_print_checkbox('recursion', 1, false, true, false)
'force_group', );
'group',
'', $table->data[2][1] = html_print_label_input_block(
'', __('Select all modules of this group'),
false, html_print_checkbox_extended(
'', 'force_group',
'class="mrgn_right_40px"', 'group',
true '',
'',
false,
'',
'class="mrgn_right_40px"',
true
)
); );
$tags = tags_get_user_tags(); $tags = tags_get_user_tags();
$table->rowstyle['form_modules_4'] = 'vertical-align: top;'; $table->rowclass[3] = 'select_modules_row select_modules_row_2';
$table->rowclass['form_modules_4'] = 'select_modules_row select_modules_row_2'; $table->colspan[3][0] = 2;
$table->data['form_modules_4'][0] = __('Tags'); $table->data[3][0] = html_print_label_input_block(
$table->data['form_modules_4'][1] = html_print_select( __('Tags'),
$tags, html_print_select(
'tags[]', $tags,
$tags_name, 'tags[]',
false, $tags_name,
__('Any'), false,
-1, __('Any'),
true, -1,
true, true,
true true,
true,
'',
false,
'overflow-x: hidden;white-space: nowrap;max-width: 1136px;'
)
); );
$table->rowclass['form_agents_2'] = 'select_agents_row';
$table->data['form_agents_2'][0] = __('Status');
$table->colspan['form_agents_2'][1] = 2;
$status_list = []; $status_list = [];
$status_list[AGENT_STATUS_NORMAL] = __('Normal'); $status_list[AGENT_STATUS_NORMAL] = __('Normal');
$status_list[AGENT_STATUS_WARNING] = __('Warning'); $status_list[AGENT_STATUS_WARNING] = __('Warning');
@ -421,166 +430,194 @@ $status_list[AGENT_STATUS_CRITICAL] = __('Critical');
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown'); $status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); $status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init'); $status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
$table->data['form_agents_2'][1] = html_print_select( $table->data[4][0] = html_print_label_input_block(
$status_list, __('Module Status'),
'status_agents', html_print_select(
'selected', $status_list,
'', 'status_module',
__('All'), 'selected',
AGENT_STATUS_ALL, '',
true __('All'),
AGENT_MODULE_STATUS_ALL,
true,
false,
true,
'w100p',
false,
'width: 100%'
)
); );
$table->data['form_agents_2'][3] = '';
$table->rowclass['form_modules_3'] = ''; $table->cellclass[4][1] = 'select_agents_row';
$table->data['form_modules_3'][0] = __('Module Status'); $table->data[4][1] = html_print_label_input_block(
$table->colspan['form_modules_3'][1] = 2; __('Status'),
$status_list = []; html_print_select(
$status_list[AGENT_MODULE_STATUS_NORMAL] = __('Normal'); $status_list,
$status_list[AGENT_MODULE_STATUS_WARNING] = __('Warning'); 'status_agents',
$status_list[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical'); 'selected',
$status_list[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown'); '',
$status_list[AGENT_MODULE_STATUS_NOT_NORMAL] = __('Not normal'); __('All'),
$status_list[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init'); AGENT_STATUS_ALL,
$table->data['form_modules_3'][1] = html_print_select( true,
$status_list, false,
'status_module', true,
'selected', 'w100p',
'', false,
__('All'), 'width: 100%'
AGENT_MODULE_STATUS_ALL, )
true
); );
$table->data['form_modules_3'][3] = '';
$table->rowstyle['form_modules_filter'] = 'vertical-align: top;'; $table->rowclass[5] = 'select_modules_row select_modules_row_2';
$table->rowclass['form_modules_filter'] = 'select_modules_row select_modules_row_2'; $table->data[5][0] = html_print_label_input_block(
$table->data['form_modules_filter'][0] = __('Filter Modules'); __('Filter Modules'),
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true); html_print_input_text('filter_modules', '', '', 20, 255, true)
$table->rowstyle['form_modules_2'] = 'vertical-align: top;';
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_2'][0] = __('Modules');
$table->data['form_modules_2'][1] = html_print_select(
$modules,
'module_name[]',
$module_name,
false,
__('Select'),
-1,
true,
true,
true,
'',
false,
'width:100%'
).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'");
$table->data['form_modules_2'][2] = __('When select modules');
$table->data['form_modules_2'][2] .= '<br>';
$table->data['form_modules_2'][2] .= html_print_select(
[
'common' => __('Show common agents'),
'all' => __('Show all agents'),
],
'agents_selection_mode',
'common',
false,
'',
'',
true,
false,
true,
'',
false
); );
$table->data['form_modules_2'][3] = html_print_select(
[], $table->data[5][1] = html_print_label_input_block(
'agents[]', __('When select modules'),
$agents_select, html_print_select(
false, [
__('None'), 'common' => __('Show common agents'),
0, 'all' => __('Show all agents'),
true, ],
true, 'agents_selection_mode',
false, 'common',
'', false,
false, '',
'width:100%' '',
true,
false,
true,
'w100p',
false,
'width:100%'
)
);
$table->rowclass[6] = 'select_modules_row select_modules_row_2';
$table->data[6][0] = html_print_label_input_block(
__('Modules'),
html_print_select(
$modules,
'module_name[]',
$module_name,
false,
__('Select'),
-1,
true,
true,
true,
'',
false,
'width:100%'
).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'")
);
$table->data[6][1] = html_print_label_input_block(
__('Agents'),
html_print_select(
[],
'agents[]',
$agents_select,
false,
__('None'),
0,
true,
true,
false,
'',
false,
'width:100%'
)
); );
$tags = tags_get_user_tags(); $tags = tags_get_user_tags();
$table->rowstyle['form_agents_4'] = 'vertical-align: top;'; $table->rowclass[7] = 'select_agents_row select_agents_row_2';
$table->rowclass['form_agents_4'] = 'select_agents_row select_agents_row_2'; $table->colspan[7][0] = 2;
$table->data['form_agents_4'][0] = __('Tags'); $table->data[7][0] = html_print_label_input_block(
$table->data['form_agents_4'][1] = html_print_select( __('Tags'),
$tags, html_print_select(
'tags[]', $tags,
$tags_name, 'tags[]',
false, $tags_name,
__('Any'), false,
-1, __('Any'),
true, -1,
true, true,
true true,
true,
'',
false,
'overflow-x: hidden;white-space: nowrap;max-width: 1136px;'
)
); );
$table->rowstyle['form_agents_filter'] = 'vertical-align: top;'; $table->rowclass[8] = 'select_agents_row select_agents_row_2';
$table->rowclass['form_agents_filter'] = 'select_agents_row select_agents_row_2'; $table->data[8][0] = html_print_label_input_block(
$table->data['form_agents_filter'][0] = __('Filter Agents'); __('Filter Agents'),
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true); html_print_input_text('filter_agents', '', '', 20, 255, true)
$table->rowstyle['form_agents_3'] = 'vertical-align: top;';
$table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_3'][0] = __('Agents');
$table->data['form_agents_3'][1] = html_print_select(
$agents,
'id_agents[]',
$agents_id,
false,
'',
'',
true,
true,
false,
'',
false,
'width:100%'
).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'");
$table->data['form_agents_3'][2] = __('When select agents');
$table->data['form_agents_3'][2] .= '<br>';
$table->data['form_agents_3'][2] .= html_print_select(
[
'common' => __('Show common modules'),
'all' => __('Show all modules'),
'unknown' => __('Show unknown and not init modules'),
],
'modules_selection_mode',
'common',
false,
'',
'',
true
);
$table->data['form_agents_3'][3] = html_print_select(
[],
'module[]',
$modules_select,
false,
'',
'',
true,
true,
false,
'',
false,
'width:100%'
); );
$table->data[8][1] = html_print_label_input_block(
__('When select agents'),
html_print_select(
[
'common' => __('Show common modules'),
'all' => __('Show all modules'),
'unknown' => __('Show unknown and not init modules'),
],
'modules_selection_mode',
'common',
false,
'',
'',
true,
false,
true,
'w100p',
false,
'width: 100%'
)
);
$table->rowclass[9] = 'select_agents_row select_agents_row_2';
$table->data[9][0] = html_print_label_input_block(
__('Agents'),
html_print_select(
$agents,
'id_agents[]',
$agents_id,
false,
'',
'',
true,
true,
false,
'',
false,
'width:100%;white-space: nowrap;max-width: 1136px;'
).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'")
);
echo '<form method="post" id="form_modules" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_modules" >'; $table->data[9][1] = html_print_label_input_block(
__('Modules'),
html_print_select(
[],
'module[]',
$modules_select,
false,
'',
'',
true,
true,
false,
'w100p',
false,
'width:100%'
)
);
echo '<form method="post" class="max_floating_element_size" id="form_modules" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_modules" >';
html_print_table($table); html_print_table($table);
attachActionButton('delete', 'delete', $table->width, false, $SelectAction); attachActionButton('delete', 'delete', $table->width, false, $SelectAction);
@ -617,7 +654,9 @@ $(document).ready (function () {
$("#module_name").trigger('change'); $("#module_name").trigger('change');
} else { } else {
$("#module_name option").prop('selected', false); $("#module_name option").prop('selected', false);
$("#module_name").trigger('change'); if ($('#agents_selection_mode :selected').val() === 'all'){
$("#module_name").trigger('change');
}
} }
}); });
@ -760,14 +799,6 @@ $(document).ready (function () {
else if (this.id == "checkbox-recursion") { else if (this.id == "checkbox-recursion") {
$("#groups_select").trigger("change"); $("#groups_select").trigger("change");
} }
else {
if (this.checked) {
$(".select_agents_row_2").css('display', 'none');
}
else {
$(".select_agents_row_2").css('display', '');
}
}
} }
); );

View File

@ -174,6 +174,13 @@ if ($access_console_node === true) {
} }
$sub = []; $sub = [];
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$sub['wizard']['text'] = __('Configuration wizard');
$sub['wizard']['id'] = 'conf_wizard';
$sub['wizard']['type'] = 'direct';
$sub['wizard']['subtype'] = 'nolink_no_arrow';
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$sub['templates']['text'] = __('Templates'); $sub['templates']['text'] = __('Templates');
$sub['templates']['id'] = 'Templates'; $sub['templates']['id'] = 'Templates';
@ -620,3 +627,55 @@ if ((bool) $config['pure'] === false) {
} }
echo '<div id="about-div"></div>'; echo '<div id="about-div"></div>';
// Need to be here because the translate string.
if (check_acl($config['id_user'], $group, 'AW')) {
?>
<script type="text/javascript">
$("#conf_wizard").click(function() {
$("#conf_wizard").addClass("selected");
if (!$("#welcome_modal_window").length) {
$(document.body).append('<div id="welcome_modal_window"></div>');
$(document.body).append(
$('<link rel="stylesheet" type="text/css" />').attr(
"href",
"include/styles/new_installation_welcome_window.css"
)
);
}
load_modal({
target: $('#welcome_modal_window'),
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
modal: {
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
cancel: '<?php echo __('Do not show anymore'); ?>',
ok: '<?php echo __('Close'); ?>'
},
onshow: {
page: 'include/ajax/welcome_window',
method: 'loadWelcomeWindow',
},
oncancel: {
page: 'include/ajax/welcome_window',
title: "<?php echo __('Cancel Configuration Window'); ?>",
method: 'cancelWelcome',
confirm: function (fn) {
confirmDialog({
title: '<?php echo __('Are you sure?'); ?>',
message: '<?php echo __('Are you sure you want to cancel this tutorial?'); ?>',
ok: '<?php echo __('OK'); ?>',
cancel: '<?php echo __('Cancel'); ?>',
onAccept: function() {
// Continue execution.
fn();
}
})
}
}
});
});
</script>
<?php
}

View File

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

View File

@ -38,6 +38,9 @@ require_once $config['homedir'].'/include/db/oracle.php';
// Login check. // Login check.
check_login(); check_login();
// Validate enterprise.
$is_enterprise = enterprise_installed();
if (! check_acl($config['id_user'], 0, 'RW') if (! check_acl($config['id_user'], 0, 'RW')
&& ! check_acl($config['id_user'], 0, 'RM') && ! check_acl($config['id_user'], 0, 'RM')
) { ) {
@ -3682,25 +3685,28 @@ $class = 'databox filters';
?> ?>
</td> </td>
</tr> </tr>
<?php
<tr id="row_landscape" class="datos"> if ($is_enterprise) {
<td class="bolder">
<?php
echo __('Show item in landscape format (only PDF)');
?> ?>
</td> <tr id="row_landscape" class="datos">
<td><?php html_print_checkbox_switch('landscape', 1, $landscape); ?></td> <td class="bolder">
</tr> <?php
echo __('Show item in landscape format (only PDF)');
<tr id="row_pagebreak" class="datos"> ?>
<td class="bolder"> </td>
<td><?php html_print_checkbox_switch('landscape', 1, $landscape); ?></td>
</tr>
<tr id="row_pagebreak" class="datos">
<td class="bolder">
<?php
echo __('Page break at the end of the item (only PDF)');
?>
</td>
<td><?php html_print_checkbox_switch('pagebreak', 1, $pagebreak); ?></td>
</tr>
<?php <?php
echo __('Page break at the end of the item (only PDF)'); }
?> ?>
</td>
<td><?php html_print_checkbox_switch('pagebreak', 1, $pagebreak); ?></td>
</tr>
<tr id="row_agents_inventory_display_options" class="datos"> <tr id="row_agents_inventory_display_options" class="datos">
<td class="bolder"> <td class="bolder">
<?php <?php
@ -6714,6 +6720,8 @@ function chooseType() {
$("#row_agent").show(); $("#row_agent").show();
$("#row_module").show(); $("#row_module").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
period_set_value($("#hidden-period").attr('class'), 3600);
$("#row_period").find('select').val('3600').trigger('change');
break; break;
case 'SLA_monthly': case 'SLA_monthly':

View File

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

View File

@ -161,7 +161,7 @@ if ($classname_selected === null) {
$wiz_data = []; $wiz_data = [];
foreach ($classes as $classpath) { foreach ($classes as $classpath) {
if (is_reporting_console_node() === true) { if (is_reporting_console_node() === true) {
if ($classpath !== '/var/www/html/pandora_console/godmode/wizards/DiscoveryTaskList.class.php') { if ($classpath !== $config['homedir'].'/godmode/wizards/DiscoveryTaskList.class.php') {
continue; continue;
} }
} }

View File

@ -212,7 +212,7 @@ if (isset($_GET['server']) === true) {
false, false,
'servers', 'servers',
true, true,
[], $buttons,
[ [
[ [
'link' => '', 'link' => '',

View File

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

View File

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

View File

@ -210,7 +210,7 @@ if (is_ajax() === true) {
// Ldapsearch timeout. // Ldapsearch timeout.
// Default Ldapsearch timeout. // Default Ldapsearch timeout.
set_when_empty($config['ldap_searh_timeout'], 5); set_when_empty($config['ldap_search_timeout'], 5);
$row = []; $row = [];
$row['name'] = __('Ldap search timeout (secs)'); $row['name'] = __('Ldap search timeout (secs)');
$row['control'] = html_print_input_text( $row['control'] = html_print_input_text(
@ -558,7 +558,13 @@ echo '</form>';
if ($('input[type=checkbox][name=secondary_ldap_enabled]:checked').val() == 1) { if ($('input[type=checkbox][name=secondary_ldap_enabled]:checked').val() == 1) {
$("tr[id*='ldap_'][id$='_secondary']").show(); $("tr[id*='ldap_'][id$='_secondary']").show();
} else { } else {
$( "tr[id*='ldap_'][id$='_secondary']" ).hide(); $( "tr[id*='ldap_'][id$='_secondary']" ).hide();
}
if ($('input[type=checkbox][name=secondary_active_directory]:checked').val() == 1) {
$("tr[id*='ad_'][id$='_secondary']").show();
} else {
$( "tr[id*='ad_'][id$='_secondary']" ).hide();
} }
} }
$( document ).ready(function() { $( document ).ready(function() {

View File

@ -681,15 +681,19 @@ $table->data[$i++][] = html_print_label_input_block(
) )
); );
$help_tip = ui_print_help_tip(
__('This log is recommended to be DISABLED by default due to the large amount of debug data it generates.'),
true
);
$table->data[$i][] = html_print_label_input_block( $table->data[$i][] = html_print_label_input_block(
__('Enable console log'), __('Enable console log').$help_tip,
html_print_checkbox_switch( html_print_checkbox_switch(
'console_log_enabled', 'console_log_enabled',
1, 1,
$config['console_log_enabled'], $config['console_log_enabled'],
true true
).ui_print_input_placeholder( ).ui_print_input_placeholder(
__('Log location').': pandora_console/log/console.log', __('Log location').': /var/log/php-fpm/error.log',
true true
) )
); );
@ -743,6 +747,16 @@ $table->data[$i][] = html_print_label_input_block(
) )
); );
$table->data[$i][] = html_print_label_input_block(
__('Show experimental features'),
html_print_checkbox_switch(
'show_experimental_features',
1,
$config['show_experimental_features'],
true
)
);
echo '<form class="max_floating_element_size" id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">'; echo '<form class="max_floating_element_size" id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';
echo '<fieldset class="margin-bottom-10">'; echo '<fieldset class="margin-bottom-10">';

View File

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

View File

@ -129,6 +129,11 @@ class DiscoveryTaskList extends HTML
} }
$delete_console_task = (bool) get_parameter('delete_console_task'); $delete_console_task = (bool) get_parameter('delete_console_task');
$report_task = (bool) get_parameter('report_task', 0);
if ($report_task === true) {
$this->url = ui_get_full_url('index.php?sec=reporting&sec2=godmode/reporting/reporting_builder');
}
if ($delete_console_task === true) { if ($delete_console_task === true) {
return $this->deleteConsoleTask(); return $this->deleteConsoleTask();
} }
@ -287,6 +292,10 @@ class DiscoveryTaskList extends HTML
} }
$id_console_task = (int) get_parameter('id_console_task'); $id_console_task = (int) get_parameter('id_console_task');
$report_task = (bool) get_parameter('report_task', 0);
if ($report_task === true) {
$this->url = ui_get_full_url('index.php?sec=reporting&sec2=godmode/reporting/reporting_builder');
}
if ($id_console_task != null) { if ($id_console_task != null) {
// -------------------------------- // --------------------------------
@ -352,6 +361,10 @@ class DiscoveryTaskList extends HTML
} }
$id_console_task = (int) get_parameter('id_console_task'); $id_console_task = (int) get_parameter('id_console_task');
$report_task = (bool) get_parameter('report_task', 0);
if ($report_task === true) {
$this->url = ui_get_full_url('index.php?sec=reporting&sec2=godmode/reporting/reporting_builder');
}
if ($id_console_task > 0) { if ($id_console_task > 0) {
$result = db_process_sql_update( $result = db_process_sql_update(
@ -1096,9 +1109,9 @@ class DiscoveryTaskList extends HTML
* *
* @return boolean Success or not. * @return boolean Success or not.
*/ */
public function showListConsoleTask() public function showListConsoleTask($report_task=false)
{ {
return enterprise_hook('tasklist_showListConsoleTask', [$this]); return enterprise_hook('tasklist_showListConsoleTask', [$this, $report_task]);
} }
@ -1137,6 +1150,9 @@ class DiscoveryTaskList extends HTML
case DISCOVERY_CLOUD_AWS_S3: case DISCOVERY_CLOUD_AWS_S3:
return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&sub=s3&page=0'; return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&sub=s3&page=0';
case DISCOVERY_CLOUD_GCP_COMPUTE_ENGINE:
return 'wiz=cloud&mode=gcp&ki='.$task['auth_strings'].'&sub=compute&page=0';
default: default:
return 'wiz=cloud'; return 'wiz=cloud';
} }

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>EB094270-FB38-4A58-BE94-D40EA44EA568</title>
<g id="Agentes" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="1.a1-Agentes---Listado" transform="translate(-362.500000, -268.000000)" fill="#C1CCDC">
<g id="Contenido" transform="translate(310.000000, 188.000000)">
<g transform="translate(20.000000, 20.000000)" id="Agentes">
<g id="Content" transform="translate(29.308511, 20.000000)">
<g id="Top" transform="translate(0.191489, 0.000000)">
<g id="Icons/Light/24/example" transform="translate(3.000000, 40.000000)">
<circle id="Oval" cx="6" cy="6" r="6"></circle>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

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

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

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

View File

@ -17,6 +17,8 @@ $save_custom_graph = (bool) get_parameter('save_custom_graph');
$print_custom_graph = (bool) get_parameter('print_custom_graph', false); $print_custom_graph = (bool) get_parameter('print_custom_graph', false);
$print_sparse_graph = (bool) get_parameter('print_sparse_graph'); $print_sparse_graph = (bool) get_parameter('print_sparse_graph');
$get_graphs = (bool) get_parameter('get_graphs_container'); $get_graphs = (bool) get_parameter('get_graphs_container');
$width = get_parameter('width', 0);
$height = get_parameter('height', 0);
if ($save_custom_graph) { if ($save_custom_graph) {
$return = []; $return = [];
@ -25,8 +27,6 @@ if ($save_custom_graph) {
$name = get_parameter('name', ''); $name = get_parameter('name', '');
$description = get_parameter('description', ''); $description = get_parameter('description', '');
$stacked = get_parameter('stacked', CUSTOM_GRAPH_LINE); $stacked = get_parameter('stacked', CUSTOM_GRAPH_LINE);
$width = get_parameter('width', 0);
$height = get_parameter('height', 0);
$events = get_parameter('events', 0); $events = get_parameter('events', 0);
$period = get_parameter('period', 0); $period = get_parameter('period', 0);
$fullscale = get_parameter('fullscale', 0); $fullscale = get_parameter('fullscale', 0);
@ -126,6 +126,8 @@ if ($print_sparse_graph) {
'force_interval' => '', 'force_interval' => '',
'time_interval' => 300, 'time_interval' => 300,
'array_data_create' => 0, 'array_data_create' => 0,
'height' => $height,
'width' => $width,
]; ];
echo grafico_modulo_sparse($params); echo grafico_modulo_sparse($params);

View File

@ -97,6 +97,21 @@ if (check_login()) {
return; return;
} }
$id_plugin = get_parameter('id_plugin', 0);
if ($id_plugin !== 0) {
$id_module_plugin = db_get_value(
'id_plugin',
'tagente_modulo',
'id_agente_modulo',
$get_module_macros
);
if ($id_plugin !== $id_module_plugin) {
$get_plugin_macros = true;
$get_module_macros = 0;
}
}
if ($get_plugin_macros) { if ($get_plugin_macros) {
if (https_is_running()) { if (https_is_running()) {
header('Content-type: application/json'); header('Content-type: application/json');

View File

@ -182,6 +182,7 @@ try {
if ($method == 'snmp_browser_create_modules') { if ($method == 'snmp_browser_create_modules') {
// Get target ids from form. // Get target ids from form.
$use_agent_ip = get_parameter('use_agent_ip', '');
$id_items = get_parameter('id_item2', null); $id_items = get_parameter('id_item2', null);
$id_target = null; $id_target = null;
if (empty($id_items) === false) { if (empty($id_items) === false) {
@ -209,7 +210,8 @@ try {
$module_target, $module_target,
$snmp_conf_values, $snmp_conf_values,
$id_target, $id_target,
$server_to_exec $server_to_exec,
$use_agent_ip
); );
// Return fail modules for error/success message. // Return fail modules for error/success message.

View File

@ -0,0 +1,190 @@
<?php
/**
* Extension to schedule tasks on Pandora FMS Console
*
* @category Wizard
* @package Pandora FMS
* @subpackage Host&Devices
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 PandoraFMS S.L.
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
require_once '../functions.php';
require_once '../functions_welcome_wizard.php';
global $config;
$check_web = get_parameter('check_web', 0);
$check_connectivity = get_parameter('check_connectivity', 0);
$create_net_scan = get_parameter('create_net_scan', 0);
$create_mail_alert = get_parameter('create_mail_alert', 0);
$create_unknown_template_alert = get_parameter('create_unknown_template_alert', 0);
// Begin.
global $config;
if ($check_web) {
include_once '../functions_api.php';
include_once '../functions_servers.php';
$status_webserver = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_WEB], 'status')['status'];
if ($status_webserver === '1') {
$name = array_keys(servers_get_names())[0];
$id_group = get_parameter('id_group', 4);
$array_other['data'] = [
'Web monitoring',
'',
2,
$id_group,
0,
30,
30,
9,
$name,
0,
0,
0,
__('Agent Web monitoring created on welcome'),
];
$id_agent = api_set_new_agent(0, '', $array_other, '', true);
if ($id_agent > 0) {
$module_name = get_parameter('module_name', 'Web_monitoring_module');
$text_to_search = get_parameter('text_to_search', '');
$url_goliat = get_parameter('url_goliat', 'https://pandorafms.com/en/');
$module_latency = create_module_latency_goliat($id_agent, $module_name, $id_group, $url_goliat, $text_to_search);
$module_status = create_module_status_goliat($id_agent, $module_name, $id_group, $url_goliat, $text_to_search);
if ($module_latency > 0 && $module_status > 0) {
ui_print_success_message(__('Your check has been created, <a href='.ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agent).'>click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
}
} else {
ui_print_error_message(__('The Name is not valid for the modules.'));
}
} else {
ui_print_error_message(__('Web server is not enabled.'));
}
}
if ($check_connectivity) {
include_once '../functions_api.php';
include_once '../functions_servers.php';
$status_newtwork = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_NETWORK], 'status')['status'];
$status_pluggin = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_PLUGIN], 'status')['status'];
if ($status_newtwork === '1' && $status_pluggin === '1') {
$name = array_keys(servers_get_names())[0];
$id_group = get_parameter('id_group', 4);
$agent_name = get_parameter('agent_name', __('Agent check connectivity'));
$array_other['data'] = [
$agent_name,
'',
2,
$id_group,
0,
30,
30,
9,
$name,
0,
0,
0,
__('Basic connectivity'),
];
$id_agent = api_set_new_agent(0, '', $array_other, '', true);
if ($id_agent > 0) {
$ip_target = get_parameter('ip_target', '127.0.0.1');
$basic_network = create_module_basic_network($id_agent, $id_group, $ip_target);
$latency_network = create_module_latency_network($id_agent, $id_group, $ip_target);
$packet_lost = create_module_packet_lost($id_agent, $id_group, $ip_target);
if ($basic_network > 0 && $latency_network > 0 && $packet_lost > 0) {
ui_print_success_message(__('Your check has been created, <a href='.ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agent).'>click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
}
} else {
ui_print_error_message(__('The Name is not valid for the modules.'));
}
} else {
ui_print_error_message(__('Web server is not enabled.'));
}
}
if ($create_net_scan) {
$ip_target = get_parameter('ip_target', '192.168.10.0/24');
$id_net_scan = create_net_scan($ip_target);
if ($id_net_scan > 0) {
$id_recon_server = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_DISCOVERY], 'id_server')['id_server'];
ui_print_success_message(__('Basic net created and scan in progress. <a href='.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_recon_server.'&force='.$id_net_scan).'>Click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
} else {
ui_print_error_message(__('Basic net already exists. <a href='.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist').'>Click here to view the data</a>'));
}
}
if ($create_mail_alert) {
include_once '../functions_alerts.php';
$id_action = db_get_row_filter('talert_actions', ['name' => 'Email to '.$config['id_user']], 'id')['id'];
if (!$id_action) {
$al_action = alerts_get_alert_action($id);
$id_action = alerts_clone_alert_action(1, $al_action['id_group'], 'Email to '.$config['id_user']);
}
$id_alert_template = get_parameter('id_condition', 0);
$id_agent_module = get_parameter('id_agent_module', 0);
$exist = db_get_value_sql(
sprintf(
'SELECT COUNT(id)
FROM talert_template_modules
WHERE id_agent_module = %d
AND id_alert_template = %d
AND id_policy_alerts = 0
',
$id_agent_module,
$id_alert_template
)
);
if ($exist > 0) {
ui_print_error_message(__('Alert already exists. <a href='.ui_get_full_url('index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&pure=0').'>Click here to view the data</a>'));
} else {
$id = alerts_create_alert_agent_module($id_agent_module, $id_alert_template);
if ($id !== false) {
$values = [];
$values['fires_min'] = (int) get_parameter('fires_min');
$values['fires_max'] = (int) get_parameter('fires_max');
$values['module_action_threshold'] = (int) 300;
$alert_created = alerts_add_alert_agent_module_action($id, $id_action, $values);
}
}
if ($alert_created === true) {
ui_print_success_message(__('Congratulations, you have already created a simple alert. <a href='.ui_get_full_url('index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&pure=0').'>You can see it.</a> Pandora FMS alerts are very flexible, you can do many more things with them, we recommend you to read the <a href="https://pandorafms.com/manual/start?id=en/documentation/04_using/01_alerts">documentation</a> for more information. You can create advanced alerts from <a href='.ui_get_full_url('index.php?sec=galertas&sec2=godmode/alerts/alert_actions').'>here</a>.'));
}
}
if ($create_unknown_template_alert) {
if (is_array(alerts_get_alert_templates(['name' => io_safe_input('Unknown condition')]))) {
echo 1;
} else {
echo create_template_alert_unknown();
}
}

View File

@ -35,6 +35,13 @@ if (is_ajax() === false) {
} }
$ajaxPage = 'include/ajax/welcome_window'; $ajaxPage = 'include/ajax/welcome_window';
// Ajax controller.
$method = get_parameter('method', '');
if ($method === 'loadWelcomeWindow') {
unset($config['welcome_state']);
}
// Control call flow. // Control call flow.
try { try {
@ -44,9 +51,6 @@ try {
exit; exit;
} }
// Ajax controller.
$method = get_parameter('method', '');
if (method_exists($welcome_actions, $method) === true) { if (method_exists($welcome_actions, $method) === true) {
if ($welcome_actions->ajaxMethod($method) === true) { if ($welcome_actions->ajaxMethod($method) === true) {
$welcome_actions->{$method}(); $welcome_actions->{$method}();

View File

@ -129,6 +129,14 @@ if (empty($apiPassword) === true
// Compat. // Compat.
$config['id_user'] = 'admin'; $config['id_user'] = 'admin';
$correctLogin = true; $correctLogin = true;
// Bypass credentials if server-auth and api-pass are correct.
} else if (($config['server_unique_identifier'] === get_parameter('server_auth'))
&& ($api_password === $apiPassword)
&& ((bool) isInACL($ipOrigin) === true)
) {
$config['id_usuario'] = 'admin';
$config['id_user'] = 'admin';
$correctLogin = true;
} else if ((bool) isInACL($ipOrigin) === true) { } else if ((bool) isInACL($ipOrigin) === true) {
// External access. // External access.
// Token is valid. Bypass the credentials. // Token is valid. Bypass the credentials.

View File

@ -237,8 +237,13 @@ function process_user_login_remote($login, $pass, $api=false)
// Active Directory. // Active Directory.
case 'ad': case 'ad':
if (enterprise_hook('ad_process_user_login', [$login, $pass]) === false) { $sr = enterprise_hook('ad_process_user_login', [$login, $pass]);
$config['auth_error'] = 'User not found in database or incorrect password'; // Try with secondary server.
if ($sr === false && (bool) $config['secondary_active_directory'] === true) {
$sr = enterprise_hook('ad_process_user_login', [$login, $pass, true]);
}
if ($sr === false) {
return false; return false;
} }
break; break;

View File

@ -165,6 +165,9 @@ $hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.symbol.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script> <script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.symbol.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.exportdata.pandora.js'); ?>?v=<?php echo $config['current_package']; ?>"></script> <script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.exportdata.pandora.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.axislabels.js'); ?>?v=<?php echo $config['current_package']; ?>"></script> <script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.axislabels.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script type="text/javascript">
var phpTimezone = "<?php echo date_default_timezone_get(); ?>";
</script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/pandora.flot.js'); ?>?v=<?php echo $config['current_package']; ?>"></script> <script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/pandora.flot.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chart.js'); ?>?v=<?php echo $config['current_package']; ?>"></script> <script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chart.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chartjs-plugin-datalabels.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script> <script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chartjs-plugin-datalabels.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>

View File

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

View File

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

View File

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

View File

@ -1807,7 +1807,8 @@ class ConsoleSupervisor
$this->cleanNotifications('NOTIF.PHP.SERIALIZE_PRECISION'); $this->cleanNotifications('NOTIF.PHP.SERIALIZE_PRECISION');
} }
if (version_compare('8.1', PHP_VERSION) >= 0) { // If PHP_VERSION is lower than 8.0.27 version_compare() returns 1.
if (version_compare('8.0.27', PHP_VERSION) === 1) {
$url = 'https://www.php.net/supported-versions.php'; $url = 'https://www.php.net/supported-versions.php';
$this->notify( $this->notify(
[ [

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -4348,6 +4348,11 @@ function generator_chart_to_pdf(
curl_close($curl); curl_close($curl);
$page->setHtml($response); $page->setHtml($response);
/*
//For debug url with parameters.
$navigation = $page->navigate($url.'?data='.urlencode(json_encode($data)));
$navigation->waitForNavigation(Page::DOM_CONTENT_LOADED);
*/
// Dynamic. // Dynamic.
$dynamic_height = $page->evaluate('document.getElementById("container-chart-generator-item").clientHeight')->getReturnValue(); $dynamic_height = $page->evaluate('document.getElementById("container-chart-generator-item").clientHeight')->getReturnValue();

View File

@ -2770,6 +2770,69 @@ function agents_delete_agent($id_agents, $disableACL=false)
enterprise_include_once('include/functions_agents.php'); enterprise_include_once('include/functions_agents.php');
enterprise_hook('agent_delete_from_cache', [$id_agent]); enterprise_hook('agent_delete_from_cache', [$id_agent]);
// Delete agent from visual console.
db_process_sql_delete(
'tlayout_data',
['id_agent' => $id_agent]
);
// Delete agent from visual dashboards.
db_process_sql(
'UPDATE twidget_dashboard
SET options = NULL
WHERE options LIKE ("%\"agentid\":\"'.$id_agent.'\"%")'
);
// Delete agent from treport.
db_process_sql_delete(
'treport_content',
['id_agent' => $id_agent]
);
// Delete rules from tevent alerts (correlative alerts)
db_process_sql_delete(
'tevent_rule',
[
'agent' => $id_agent,
'operator_agent' => '==',
]
);
db_process_sql_delete(
'tevent_rule',
[
'log_agent' => $id_agent,
'operator_log_agent' => '==',
]
);
// Delete from gis maps history
db_process_sql_delete(
'tgis_data_history',
['tagente_id_agente' => $id_agent]
);
// Delete from policies.
db_process_sql_delete(
'tpolicy_agents',
['id_agent' => $id_agent]
);
// Delete from tnetwork maps
db_process_sql_delete(
'titem',
['source_data' => $id_agent]
);
db_process_sql_delete(
'trel_item',
[
'id_parent_source_data' => $id_agent,
'id_child_source_data' => $id_agent,
],
'OR'
);
// Delete agent from fav menu. // Delete agent from fav menu.
db_process_sql_delete( db_process_sql_delete(
'tfavmenu_user', 'tfavmenu_user',

View File

@ -455,7 +455,7 @@ function alerts_delete_alert_action($id_alert_action)
* *
* @return mixed Id of the cloned action or false in case of fail. * @return mixed Id of the cloned action or false in case of fail.
*/ */
function alerts_clone_alert_action($id_alert_action, $id_group) function alerts_clone_alert_action($id_alert_action, $id_group, $copy_name='')
{ {
$id_alert_action = safe_int($id_alert_action, 1); $id_alert_action = safe_int($id_alert_action, 1);
if (empty($id_alert_action)) { if (empty($id_alert_action)) {
@ -474,7 +474,13 @@ function alerts_clone_alert_action($id_alert_action, $id_group)
unset($action['id']); unset($action['id']);
return alerts_create_alert_action($action['name'].' '.__('copy'), $action['id_alert_command'], $action); if ($copy_name !== '') {
$copy_name = $copy_name;
} else {
$copy_name = $action['name'].' '.__('copy');
}
return alerts_create_alert_action($copy_name, $action['id_alert_command'], $action);
} }

View File

@ -1916,7 +1916,7 @@ function api_set_update_agent_field($id_agent, $use_agent_alias, $params)
* *
* @param $thrash3 Don't use. * @param $thrash3 Don't use.
*/ */
function api_set_new_agent($id_node, $thrash2, $other, $trhash3) function api_set_new_agent($id_node, $thrash2, $other, $trhash3, $return=false)
{ {
global $config; global $config;
@ -2038,13 +2038,17 @@ function api_set_new_agent($id_node, $thrash2, $other, $trhash3)
} }
} }
returnData( if ($return === false) {
'string', returnData(
[ 'string',
'type' => 'string', [
'data' => $id_agente, 'type' => 'string',
] 'data' => $id_agente,
); ]
);
} else {
return $id_agente;
}
} catch (\Exception $e) { } catch (\Exception $e) {
returnError($e->getMessage()); returnError($e->getMessage());
return; return;

View File

@ -378,6 +378,10 @@ function config_update_config()
$error_update[] = __('keep_in_process_status_extra_id'); $error_update[] = __('keep_in_process_status_extra_id');
} }
if (config_update_value('show_experimental_features', get_parameter('show_experimental_features'), true) === false) {
$error_update[] = __('show_experimental_features');
}
if (config_update_value('console_log_enabled', get_parameter('console_log_enabled'), true) === false) { if (config_update_value('console_log_enabled', get_parameter('console_log_enabled'), true) === false) {
$error_update[] = __('Console log enabled'); $error_update[] = __('Console log enabled');
} }
@ -627,6 +631,30 @@ function config_update_config()
$error_update[] = __('Domain'); $error_update[] = __('Domain');
} }
if (config_update_value('secondary_active_directory', get_parameter('secondary_active_directory'), true) === false) {
$error_update[] = __('Secondary active directory');
}
if (config_update_value('ad_server_secondary', get_parameter('ad_server_secondary'), true) === false) {
$error_update[] = __('Secondary active directory server');
}
if (config_update_value('ad_port_secondary', get_parameter('ad_port_secondary'), true) === false) {
$error_update[] = __('Secondary active directory port');
}
if (config_update_value('ad_start_tls_secondary', get_parameter('ad_start_tls_secondary'), true) === false) {
$error_update[] = __('Secondary start TLS');
}
if (config_update_value('ad_search_timeout', get_parameter('ad_search_timeout'), true) === false) {
$error_update[] = __('AD search timeout');
}
if (config_update_value('ad_domain_secondary', get_parameter('ad_domain_secondary'), true) === false) {
$error_update[] = __('Secondary domain');
}
if (config_update_value('ad_adv_perms', get_parameter('ad_adv_perms'), true) === false) { if (config_update_value('ad_adv_perms', get_parameter('ad_adv_perms'), true) === false) {
$error_update[] = __('Advanced Permisions AD'); $error_update[] = __('Advanced Permisions AD');
} }
@ -2377,6 +2405,10 @@ function config_process_config()
config_update_value('keep_in_process_status_extra_id', 0); config_update_value('keep_in_process_status_extra_id', 0);
} }
if (!isset($config['show_experimental_features'])) {
config_update_value('show_experimental_features', 0);
}
if (!isset($config['console_log_enabled'])) { if (!isset($config['console_log_enabled'])) {
config_update_value('console_log_enabled', 0); config_update_value('console_log_enabled', 0);
} }
@ -3100,6 +3132,14 @@ function config_process_config()
config_update_value('ad_port', 389); config_update_value('ad_port', 389);
} }
if (!isset($config['ad_server_secondary'])) {
config_update_value('ad_server_secondary', 'localhost');
}
if (!isset($config['ad_port_secondary'])) {
config_update_value('ad_port_secondary', 389);
}
if (!isset($config['ad_start_tls'])) { if (!isset($config['ad_start_tls'])) {
config_update_value('ad_start_tls', 0); config_update_value('ad_start_tls', 0);
} }

View File

@ -4624,7 +4624,10 @@ function graph_netflow_circular_mesh($data)
include_once $config['homedir'].'/include/graphs/functions_d3.php'; include_once $config['homedir'].'/include/graphs/functions_d3.php';
return d3_relationship_graph($data['elements'], $data['matrix'], 900, true); $width = (empty($data['width']) === false) ? $data['width'] : 900;
$height = (empty($data['height']) === false) ? $data['height'] : 900;
return d3_relationship_graph($data['elements'], $data['matrix'], $width, true, $height);
} }
@ -4983,19 +4986,18 @@ function graph_monitor_wheel($width=550, $height=600, $filter=false)
$filter_module_group = (!empty($filter) && !empty($filter['module_group'])) ? $filter['module_group'] : false; $filter_module_group = (!empty($filter) && !empty($filter['module_group'])) ? $filter['module_group'] : false;
if ($filter['group'] != 0) { if ($filter['group'] != 0) {
$filter_subgroups = ''; if ($filter['dont_show_subgroups'] === false) {
if (!$filter['dont_show_subgroups']) { $groups = groups_get_children($filter['group']);
$filter_subgroups = ' || parent IN ('.$filter['group'].')'; $groups_ax = [];
foreach ($groups as $g) {
$groups_ax[$g['id_grupo']] = $g;
}
$groups = $groups_ax;
} else {
$groups = groups_get_group_by_id($filter['group']);
$groups[$group['id_grupo']] = $group;
} }
$groups = db_get_all_rows_sql('SELECT * FROM tgrupo where id_grupo IN ('.$filter['group'].') '.$filter_subgroups);
$groups_ax = [];
foreach ($groups as $g) {
$groups_ax[$g['id_grupo']] = $g;
}
$groups = $groups_ax;
} else { } else {
$groups = users_get_groups(false, 'AR', false, true, (!empty($filter) && isset($filter['group']) ? $filter['group'] : null)); $groups = users_get_groups(false, 'AR', false, true, (!empty($filter) && isset($filter['group']) ? $filter['group'] : null));
} }

View File

@ -671,6 +671,7 @@ function html_print_select_groups(
step: params.page || 1, step: params.page || 1,
strict: "<?php echo $strict_user; ?>", strict: "<?php echo $strict_user; ?>",
not_condition: $('#not_condition_switch').prop('checked'), not_condition: $('#not_condition_switch').prop('checked'),
returnAllGroup: <?php echo (int) $returnAllGroup; ?>
} }
return query; return query;
@ -5503,7 +5504,10 @@ function html_print_input($data, $wrapper='div', $input_only=false)
($data['attributes'] ?? null), ($data['attributes'] ?? null),
((isset($data['return']) === true) ? $data['return'] : false), ((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['password']) === true) ? $data['password'] : false), ((isset($data['password']) === true) ? $data['password'] : false),
((isset($data['function']) === true) ? $data['function'] : '') ((isset($data['function']) === true) ? $data['function'] : ''),
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : 'off'),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['hide_div_eye']) === true) ? $data['hide_div_eye'] : false),
); );
break; break;
@ -7194,3 +7198,44 @@ function html_print_code_picker(
echo $output; echo $output;
} }
} }
function html_print_wizard_diagnosis(
$title,
$id_button,
$description='',
$status=true,
$return=false,
) {
$button = '';
if ($status === true) {
$status = 'Connected';
$img = '/images/configuration@svg.svg';
} else {
$status = 'Disconnected';
$img = '/images/change-active.svg';
}
$button = html_print_image(
$img,
true,
[
'class' => 'main_menu_icon invert_filter float-right mrgn_right_10px',
'id' => $id_button,
]
);
$output = '<div class="rectangle rectangle_'.$status.'">
<span class="status '.$status.'">'.__($status).$button.'</span>
<div class="title">'.html_print_image('/images/circle_title.svg', true, ['class' => 'invert_filter']).'<span>'.$title.'</span></div>
<div class="description">
<span>'.$description.'</span>
</div>
</div>';
if ($return === true) {
return $output;
} else {
echo $output;
}
}

View File

@ -324,6 +324,8 @@ function menu_print_menu(&$menu)
if (isset($sub['subtype']) && $sub['subtype'] == 'nolink') { if (isset($sub['subtype']) && $sub['subtype'] == 'nolink') {
$submenu_output .= '<div class=" SubNoLink '.$sub_tree_class.'"><span class="w70p span_has_menu_text">'.$sub['text'].'</span><div class="w21p arrow_menu_down"></div></div>'; $submenu_output .= '<div class=" SubNoLink '.$sub_tree_class.'"><span class="w70p span_has_menu_text">'.$sub['text'].'</span><div class="w21p arrow_menu_down"></div></div>';
} else if (isset($sub['subtype']) && $sub['subtype'] == 'nolink_no_arrow') {
$submenu_output .= '<div class=" SubNoLink '.$sub_tree_class.'"><span class="w70p span_has_menu_text">'.$sub['text'].'</span><div class="w21p"></div></div>';
} else if (isset($sub['subtype']) && $sub['subtype'] == 'new_blank') { } else if (isset($sub['subtype']) && $sub['subtype'] == 'new_blank') {
$submenu_output .= '<a href="'.$subsec2.'" target="_blank"><div class="'.$sub_tree_class.'">'.$sub['text'].'</div></a>'; $submenu_output .= '<a href="'.$subsec2.'" target="_blank"><div class="'.$sub_tree_class.'">'.$sub['text'].'</div></a>';
} else { } else {

View File

@ -743,7 +743,8 @@ function modules_create_agent_module(
string $name, string $name,
array $values=[], array $values=[],
bool $disableACL=false, bool $disableACL=false,
$tags=false $tags=false,
$use_agent_ip=false,
) { ) {
global $config; global $config;
@ -785,6 +786,10 @@ function modules_create_agent_module(
return ERR_EXIST; return ERR_EXIST;
} }
if ($use_agent_ip === true) {
$values['ip_target'] = agents_get_address($id_agent);
}
// Encrypt passwords. // Encrypt passwords.
if (isset($values['plugin_pass']) === true) { if (isset($values['plugin_pass']) === true) {
// Avoid two times encryption. // Avoid two times encryption.

View File

@ -1233,7 +1233,9 @@ function netflow_draw_item(
$max_aggregates, $max_aggregates,
$connection_name='', $connection_name='',
$output='HTML', $output='HTML',
$address_resolution=false $address_resolution=false,
$width_content=false,
$height_content=false
) { ) {
$aggregate = $filter['aggregate']; $aggregate = $filter['aggregate'];
$interval = ($end_date - $start_date); $interval = ($end_date - $start_date);
@ -1432,6 +1434,9 @@ function netflow_draw_item(
netflow_aggregate_is_ip($aggregate) netflow_aggregate_is_ip($aggregate)
); );
$data_circular['width'] = $width_content;
$data_circular['height'] = $height_content;
$html = '<div class="center">'; $html = '<div class="center">';
$html .= graph_netflow_circular_mesh($data_circular); $html .= graph_netflow_circular_mesh($data_circular);
$html .= '</div>'; $html .= '</div>';
@ -1734,7 +1739,12 @@ function netflow_get_top_summary(
switch ($top_action) { switch ($top_action) {
case 'listeners': case 'listeners':
if (empty(!$filter)) { if (empty(!$filter)) {
$netflow_filter['ip_src'] = $filter; if (!is_array($filter)) {
$netflow_filter['ip_src'] = $filter;
} else {
$netflow_filter['ip_src'] = $filter['ip'];
$netflow_filter['advanced_filter'] = $filter['advanced_filter'];
}
} }
$sort = 'dstip'; $sort = 'dstip';
@ -1742,7 +1752,12 @@ function netflow_get_top_summary(
case 'talkers': case 'talkers':
if (empty(!$filter)) { if (empty(!$filter)) {
$netflow_filter['ip_dst'] = $filter; if (!is_array($filter)) {
$netflow_filter['ip_dst'] = $filter;
} else {
$netflow_filter['ip_dst'] = $filter['ip'];
$netflow_filter['advanced_filter'] = $filter['advanced_filter'];
}
} }
$sort = 'srcip'; $sort = 'srcip';
@ -2069,7 +2084,7 @@ function netflow_aggregate_is_ip($aggregate)
* *
* @return array With map structure. * @return array With map structure.
*/ */
function netflow_build_map_data($start_date, $end_date, $top, $aggregate) function netflow_build_map_data($start_date, $end_date, $top, $aggregate, $advanced_filter='')
{ {
// Pass an empty filter data structure. // Pass an empty filter data structure.
$data = netflow_get_relationships_raw_data( $data = netflow_get_relationships_raw_data(
@ -2083,7 +2098,7 @@ function netflow_build_map_data($start_date, $end_date, $top, $aggregate)
'ip_src' => '', 'ip_src' => '',
'dst_port' => '', 'dst_port' => '',
'src_port' => '', 'src_port' => '',
'advanced_filter' => '', 'advanced_filter' => $advanced_filter,
'router_ip' => '', 'router_ip' => '',
], ],
$top, $top,

View File

@ -1411,3 +1411,24 @@ function servers_get_master()
return $result; return $result;
} }
/**
* Return true if all servers are up.
*
* @return boolean
*/
function check_all_servers_up()
{
$status = true;
$servers = servers_get_info();
foreach ($servers as $server) {
if ($server['status'] !== '1') {
return false;
}
}
return $status;
}

View File

@ -1291,7 +1291,8 @@ function snmp_browser_create_modules_snmp(
string $module_target, string $module_target,
array $snmp_values, array $snmp_values,
?array $id_target, ?array $id_target,
?string $server_to_exec=null ?string $server_to_exec=null,
?string $use_agent_ip=''
) { ) {
$target_ip = null; $target_ip = null;
$target_port = null; $target_port = null;
@ -1350,6 +1351,12 @@ function snmp_browser_create_modules_snmp(
} }
} }
if (empty($use_agent_ip) === false) {
$use_agent_ip = true;
} else {
$use_agent_ip = false;
}
$fail_modules = []; $fail_modules = [];
foreach ($targets_oids as $key => $target_oid) { foreach ($targets_oids as $key => $target_oid) {
@ -1514,7 +1521,7 @@ function snmp_browser_create_modules_snmp(
'history_data' => 1, 'history_data' => 1,
]; ];
foreach ($id_target as $agent) { foreach ($id_target as $agent) {
$ids[] = modules_create_agent_module($agent, $oid['oid'], $values); $ids[] = modules_create_agent_module($agent, $oid['oid'], $values, false, false, $use_agent_ip);
} }
} else if ($module_target == 'policy') { } else if ($module_target == 'policy') {
// Policies only in enterprise version. // Policies only in enterprise version.
@ -1803,6 +1810,16 @@ function snmp_browser_print_create_module_massive(
true true
); );
$table->data[4][0] = html_print_label_input_block(
__('Use agent IP'),
html_print_checkbox(
'use_agent_ip',
1,
false,
true
)
);
$output .= html_print_table($table, true); $output .= html_print_table($table, true);
// SNMP extradata. // SNMP extradata.

View File

@ -795,8 +795,14 @@ function tags_get_acl_tags(
$acltags = []; $acltags = [];
foreach ($raw_acltags as $group => $taglist) { foreach ($raw_acltags as $group => $taglist) {
if (empty($id_group) === false && array_key_exists($group, $id_group) === false) { if ($return_mode === 'module_condition') {
continue; if (!empty($id_group) && !in_array($group, $id_group)) {
continue;
}
} else {
if (empty($id_group) === false && array_key_exists($group, $id_group) === false) {
continue;
}
} }
if (!empty($taglist)) { if (!empty($taglist)) {

View File

@ -650,16 +650,28 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
// Agent name. // Agent name.
$row = []; $row = [];
$row['title'] = __('Agent name'); $row['title'] = __('Agent name');
$row['data'] = html_print_anchor( if (is_metaconsole() === true) {
[ $row['data'] = html_print_anchor(
'href' => 'javascript:void(0)', [
'title' => __('Click here for view this agent'), 'href' => 'javascript:void(0)',
'class' => 'font_11', 'title' => __('Click here for view this agent'),
'content' => $cellName, 'class' => 'font_11',
'onClick' => "sendHash('".$urlAgent."')", 'content' => $cellName,
], 'onClick' => "sendHash('".$urlAgent."')",
true ],
); true
);
} else {
$row['data'] = html_print_anchor(
[
'href' => $urlAgent,
'title' => __('Click here for view this agent'),
'class' => 'font_11',
'content' => $cellName,
],
true
);
}
$table->data['name'] = $row; $table->data['name'] = $row;

View File

@ -3324,6 +3324,32 @@ function ui_print_module_status(
} }
/**
* Returns html code to print a shape for a module.
*
* @param integer $color Hex color.
* @param boolean $return True or false.
* @param string $class Custom class or use defined.
* @param string $div_content Content.
*
* @return string HTML code for shape.
*/
function ui_print_diagnosis_status(
$color,
$return=false,
$class='status_rounded_rectangles',
$div_content=''
) {
$output = '<div style="background: '.$color.'" class="'.$class.'">'.$div_content.'</div>';
if ($return === false) {
echo $output;
}
return $output;
}
/** /**
* Get the shape of an image by assigning it a CSS class. Prints an image with CSS representing a status. * Get the shape of an image by assigning it a CSS class. Prints an image with CSS representing a status.
* *
@ -3716,28 +3742,71 @@ function ui_progress_extend(
* Generate needed code to print a datatables jquery plugin. * Generate needed code to print a datatables jquery plugin.
* *
* @param array $parameters All desired data using following format: * @param array $parameters All desired data using following format:
* [ *
* 'print' => true (by default printed) * ```php
* 'id' => datatable id. * $parameters = [
* 'class' => datatable class. * // JS Parameters
* 'style' => datatable style. * 'serverside' => true,
* 'order' => [ * 'paging' => true,
* 'field' => column name * 'default_pagination' => $config['block_size'],
* 'direction' => asc or desc * 'searching' => false,
* ], * 'dom_elements' => "plfrtiB",
* 'default_pagination' => integer, default pagination is set to block_size * 'pagination_options' => [default_pagination, 5, 10, 20, 100, 200, 500, 1000, "All"],
* 'ajax_url' => 'include/ajax.php' ajax_url. * 'ordering' => true,
* 'ajax_data' => [ operation => 1 ] extra info to be sent. * 'order' => [[0, "asc"]], //['field' => 'column_name', 'direction' => 'asc/desc']
* 'ajax_postprocess' => a javscript function to postprocess data received * 'zeroRecords' => "No matching records found",
* by ajax call. It is applied foreach row and must * 'emptyTable' => "No data available in table",
* use following format: * 'no_sortable_columns' => [], //Allows the column name (db) from "columns" parameter
* * [code] * 'csv_field_separator' => ",",
* * function (item) { * 'csv_header' => true,
* * // Process received item, for instance, name: * 'mini_csv' => false,
* * tmp = '<span class=label>' + item.name + '</span>'; * 'mini_pagination' => false,
* * item.name = tmp; * 'mini_search' => false,
* * } * 'drawCallback' => undefined, //'console.log(123),'
* * [/code] * 'data_element' => undefined, //Rows processed
* 'ajax_postprocess' => undefined, //'process_datatables_item(item)'
* 'ajax_data' => undefined, //Extra data to be sent ['field1' => 1, 'field2 => 0]
* 'ajax_url' => undefined,
* 'caption' => undefined,
*
* // PHP Parameters
* 'id' => undefined, //Used for table and form id,
* 'columns' =>,
* 'column_names' =>,
* 'filter_main_class' =>,
* 'toggle_collapsed' =>true,
* 'search_button_class' => 'sub filter',
* 'csv' =>=1,
* 'form' =>
* ..[
* ....'id' => $form_id,
* ....'class' => 'flex-row',
* ....'style' => 'width: 100%,',
* ....'js' => '',
* ....'html' => $filter,
* ....'inputs' => [],
* ....'extra_buttons' => $buttons,
* ..],
* 'no_toggle' => false,
* 'form_html' => undefined,
* 'toggle_collapsed' => true,
* 'class' => "", //Datatable class.
* 'style' => "" ,//Datatable style.
* 'return' => false,
* 'print' => true,
* ]
*
* ```
*
* ```php
* ajax_postprocess => a javscript function to postprocess data received
* by ajax call. It is applied foreach row and must
* use following format:
* function (item) {
* // Process received item, for instance, name:
* tmp = '<span class=label>' + item.name + '</span>';
* item.name = tmp;
* }
* 'columns_names' => [ * 'columns_names' => [
* 'column1' :: Used as th text. Direct text entry. It could be array: * 'column1' :: Used as th text. Direct text entry. It could be array:
* OR * OR
@ -3754,7 +3823,6 @@ function ui_progress_extend(
* 'column2', * 'column2',
* ... * ...
* ], * ],
* 'no_sortable_columns' => [ indexes ] 1,2... -1 etc. Avoid sorting.
* 'form' => [ * 'form' => [
* 'html' => 'html code' a directly defined inputs in HTML. * 'html' => 'html code' a directly defined inputs in HTML.
* 'extra_buttons' => [ * 'extra_buttons' => [
@ -3786,12 +3854,7 @@ function ui_progress_extend(
* ] * ]
* ], * ],
* 'extra_html' => HTML content to be placed after 'filter' section. * 'extra_html' => HTML content to be placed after 'filter' section.
* 'drawCallback' => function to be called after draw. Sample in: * ```
* https://datatables.net/examples/advanced_init/row_grouping.html
* ]
* 'zeroRecords' => Message when zero records obtained from filter.(Leave blank for default).
* 'emptyTable' => Message when table data empty.(Leave blank for default).
* End.
* *
* @return string HTML code with datatable. * @return string HTML code with datatable.
* @throws Exception On error. * @throws Exception On error.
@ -3808,6 +3871,9 @@ function ui_print_datatable(array $parameters)
$form_id = uniqid('datatable_filter_'); $form_id = uniqid('datatable_filter_');
} }
$parameters['table_id'] = $table_id;
$parameters['form_id'] = $form_id;
if (!isset($parameters['columns']) || !is_array($parameters['columns'])) { if (!isset($parameters['columns']) || !is_array($parameters['columns'])) {
throw new Exception('[ui_print_datatable]: You must define columns for datatable'); throw new Exception('[ui_print_datatable]: You must define columns for datatable');
} }
@ -3827,10 +3893,6 @@ function ui_print_datatable(array $parameters)
$parameters['default_pagination'] = $config['block_size']; $parameters['default_pagination'] = $config['block_size'];
} }
if (!isset($parameters['paging'])) {
$parameters['paging'] = true;
}
if (!isset($parameters['filter_main_class'])) { if (!isset($parameters['filter_main_class'])) {
$parameters['filter_main_class'] = ''; $parameters['filter_main_class'] = '';
} }
@ -3839,13 +3901,9 @@ function ui_print_datatable(array $parameters)
$parameters['toggle_collapsed'] = true; $parameters['toggle_collapsed'] = true;
} }
$no_sortable_columns = json_encode([]);
if (isset($parameters['no_sortable_columns'])) {
$no_sortable_columns = json_encode($parameters['no_sortable_columns']);
}
if (!is_array($parameters['order'])) { if (!is_array($parameters['order'])) {
$order = '0, "asc"'; $order = 0;
$direction = 'asc';
} else { } else {
if (!isset($parameters['order']['direction'])) { if (!isset($parameters['order']['direction'])) {
$direction = 'asc'; $direction = 'asc';
@ -3864,47 +3922,35 @@ function ui_print_datatable(array $parameters)
} }
} }
$order .= ', "'.$parameters['order']['direction'].'"'; $direction = $parameters['order']['direction'];
} }
if (!isset($parameters['ajax_data'])) { $parameters['order']['order'] = $order;
$parameters['ajax_data'] = ''; $parameters['order']['direction'] = $direction;
foreach ($parameters['no_sortable_columns'] as $key => $find) {
$found = array_search(
$parameters['no_sortable_columns'][$key],
$parameters['columns']
);
if ($found !== false) {
unset($parameters['no_sortable_columns'][$key]);
array_push($parameters['no_sortable_columns'], $found);
}
if (is_int($parameters['no_sortable_columns'][$key]) === false) {
unset($parameters['no_sortable_columns'][$key]);
}
} }
$search_button_class = 'sub filter'; $parameters['csvTextInfo'] = __('Export current page to CSV');
$parameters['csvFileTitle'] = sprintf(__('export_%s_current_page_%s'), $table_id, date('Y-m-d'));
if (isset($parameters['search_button_class'])) { if (isset($parameters['search_button_class'])) {
$search_button_class = $parameters['search_button_class']; $search_button_class = $parameters['search_button_class'];
}
if (isset($parameters['pagination_options'])) {
$pagination_options = $parameters['pagination_options'];
} else { } else {
$pagination_options = [ $search_button_class = 'sub filter';
[
// There is a limit of (2^32)^2 (18446744073709551615) rows in a MyISAM table, show for show all use max nrows.
// -1 Retun error or only 1 row.
$parameters['default_pagination'],
5,
10,
25,
100,
200,
500,
1000,
18446744073709551615,
],
[
$parameters['default_pagination'],
5,
10,
25,
100,
200,
500,
1000,
'All',
],
];
} }
if (isset($parameters['datacolumns']) === false if (isset($parameters['datacolumns']) === false
@ -3917,16 +3963,12 @@ function ui_print_datatable(array $parameters)
$parameters['csv'] = 1; $parameters['csv'] = 1;
} }
$dom_elements = '"plfrtiB"';
if (isset($parameters['dom_elements'])) {
$dom_elements = '"'.$parameters['dom_elements'].'"';
}
$filter = ''; $filter = '';
// Datatable filter. // Datatable filter.
if (isset($parameters['form']) && is_array($parameters['form'])) { if (isset($parameters['form']) && is_array($parameters['form'])) {
if (isset($parameters['form']['id'])) { if (isset($parameters['form']['id'])) {
$form_id = $parameters['form']['id']; $form_id = $parameters['form']['id'];
$parameters['form_id'] = $form_id;
} }
if (isset($parameters['form']['class'])) { if (isset($parameters['form']['class'])) {
@ -4044,10 +4086,13 @@ function ui_print_datatable(array $parameters)
) )
); );
$processing .= '</div>'; $processing .= '</div>';
$parameters['processing'] = $processing;
$zeroRecords = isset($parameters['zeroRecords']) === true ? $parameters['zeroRecords'] : __('No matching records found'); $zeroRecords = isset($parameters['zeroRecords']) === true ? $parameters['zeroRecords'] : __('No matching records found');
$emptyTable = isset($parameters['emptyTable']) === true ? $parameters['emptyTable'] : __('No data available in table'); $emptyTable = isset($parameters['emptyTable']) === true ? $parameters['emptyTable'] : __('No data available in table');
$parameters['zeroRecords'] = $zeroRecords;
$parameters['emptyTable'] = $emptyTable;
// Extra html. // Extra html.
$extra = ''; $extra = '';
if (isset($parameters['extra_html']) && !empty($parameters['extra_html'])) { if (isset($parameters['extra_html']) && !empty($parameters['extra_html'])) {
@ -4056,8 +4101,8 @@ function ui_print_datatable(array $parameters)
// Base table. // Base table.
$table = '<table id="'.$table_id.'" '; $table = '<table id="'.$table_id.'" ';
$table .= 'class="'.$parameters['class'].' invisible"'; $table .= 'class="'.$parameters['class'].'"';
$table .= 'style="'.$parameters['style'].'">'; $table .= 'style="box-sizing: border-box;'.$parameters['style'].'">';
$table .= '<thead><tr class="datatables_thead_tr">'; $table .= '<thead><tr class="datatables_thead_tr">';
if (isset($parameters['column_names']) if (isset($parameters['column_names'])
@ -4084,335 +4129,60 @@ function ui_print_datatable(array $parameters)
} }
$table .= '</tr></thead>'; $table .= '</tr></thead>';
if (isset($parameters['data_element']) === true) {
$table .= '<tbody>';
foreach ($parameters['data_element'] as $row) {
$table .= '<tr>';
foreach ($row as $td_data) {
$table .= '<td>'.$td_data.'</td>';
}
$table .= '</tr>';
}
$table .= '</tbody>';
$js = '<script>
$.fn.dataTable.ext.classes.sPageButton = "pandora_pagination mini-pandora-pagination"
var table = $("#'.$table_id.'").DataTable({
"dom": "'.$parameters['dom_elements'].'"
});
$("div.spinner-fixed").hide();
$("table#'.$table_id.'").removeClass("invisible");
$("#'.$table_id.'_filter > label > input").addClass("mini-search-input");
if (table.page.info().pages == 1) {
$("#'.$table_id.'_paginate").hide();
}
</script>';
}
$table .= '</table>'; $table .= '</table>';
$pagination_class = 'pandora_pagination'; $parameters['ajax_url_full'] = ui_get_full_url('ajax.php', false, false, false);
if (!empty($parameters['pagination_class'])) {
$pagination_class = $parameters['pagination_class']; $parameters['spinnerLoading'] = html_print_image(
'images/spinner.gif',
true,
[
'id' => $form_id.'_loading',
'class' => 'loading-search-datatables-button',
]
);
$language = substr(get_user_language(), 0, 2);
if (is_metaconsole() === false) {
$parameters['language'] = 'include/javascript/i18n/dataTables.'.$language.'.json';
} else {
$parameters['language'] = '../../include/javascript/i18n/dataTables.'.$language.'.json';
} }
$columns = ''; $parameters['phpDate'] = date('Y-m-d');
for ($i = 1; $i <= (count($parameters['columns']) - 3); $i++) { $parameters['dataElements'] = json_encode($parameters['data_element']);
if ($i != (count($parameters['columns']) - 3)) {
$columns .= $i.','; // * START JAVASCRIPT.
} else { if (is_metaconsole() === false) {
$columns .= $i; $file_path = ui_get_full_url('include/javascript/datatablesFunction.js');
} } else {
$file_path = ui_get_full_url('../../include/javascript/datatablesFunction.js');
} }
$export_columns = ''; $file_content = file_get_contents($file_path);
if (isset($parameters['csv_exclude_latest']) === true $json_data = json_encode($parameters);
&& $parameters['csv_exclude_latest'] === true $json_config = json_encode($config);
) {
$export_columns = ',columns: \'th:not(:last-child)\'';
}
if (isset($parameters['data_element']) === false || isset($parameters['print_pagination_search_csv'])) { $js = '<script>';
if (isset($parameters['ajax_url'])) { $js .= 'var dt = '.$json_data.';';
$type_data = 'ajax: { $js .= 'var config = '.$json_config.';';
url: "'.ui_get_full_url('ajax.php', false, false, false).'", $js .= '</script>';
type: "POST",
dataSrc: function (json) {
if($("#'.$form_id.'_search_bt") != undefined) {
$("#'.$form_id.'_loading").remove();
}
if (json.error) { $js .= '<script>';
console.error(json.error); $js .= 'function '.$table_id.'(dt, config) { ';
$("#error-'.$table_id.'").html(json.error); $js .= $file_content;
$("#error-'.$table_id.'").dialog({ $js .= '}';
title: "Filter failed", $js .= $table_id.'(dt, config)';
width: 630, $js .= '</script>';
resizable: true, // * END JAVASCRIPT.
draggable: true,
modal: false,
closeOnEscape: true,
buttons: {
"Ok" : function () {
$(this).dialog("close");
}
}
}).parent().addClass("ui-state-error");
} else {';
if (isset($parameters['ajax_return_operation']) === true
&& empty($parameters['ajax_return_operation']) === false
&& isset($parameters['ajax_return_operation_function']) === true
&& empty($parameters['ajax_return_operation_function']) === false
) {
$type_data .= '
if (json.'.$parameters['ajax_return_operation'].' !== undefined) {
'.$parameters['ajax_return_operation_function'].'(json.'.$parameters['ajax_return_operation'].');
}
';
}
if (isset($parameters['ajax_postprocess'])) {
$type_data .= '
if (json.data) {
json.data.forEach(function(item) {
'.$parameters['ajax_postprocess'].'
});
} else {
json.data = {};
}';
}
$type_data .= '
return json.data;
}
},
data: function (data) {
if($("#button-'.$form_id.'_search_bt") != undefined) {
var loading = \''.html_print_image(
'images/spinner.gif',
true,
[
'id' => $form_id.'_loading',
'class' => 'loading-search-datatables-button',
]
).'\';
$("#button-'.$form_id.'_search_bt").parent().append(loading);
}
inputs = $("#'.$form_id.' :input");
values = {};
inputs.each(function() {
values[this.name] = $(this).val();
})
$.extend(data, {
filter: values,'."\n";
if (is_array($parameters['ajax_data'])) {
foreach ($parameters['ajax_data'] as $k => $v) {
$type_data .= $k.':'.json_encode($v).",\n";
}
}
$type_data .= 'page: "'.$parameters['ajax_url'].'"
});
return data;
}
},';
} else {
$type_data = 'data: '.json_encode($parameters['data_element']).',';
}
$serverside = 'true';
if (isset($parameters['data_element'])) {
$serverside = 'false';
}
// Javascript controller.
$js = '<script type="text/javascript">
$(document).ready(function(){
$.fn.dataTable.ext.errMode = "none";
$.fn.dataTable.ext.classes.sPageButton = "'.$pagination_class.'";
var settings_datatable = {
drawCallback: function(settings) {';
if (!isset($parameters['data_element'])) {
$js .= 'if (dt_'.$table_id.'.page.info().pages > 1) {
$("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").show()
} else {
$("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").hide()
}';
}
$js .= 'if ($("#'.$table_id.' tr td").length == 1) {
$(".datatable-msg-info-'.$table_id.'").show();
$(".datatable-msg-info-'.$table_id.'").removeClass(\'invisible_important\');
$("table#'.$table_id.'").hide();
$("div.dataTables_paginate").hide();
$("div.dataTables_info").hide();
$("div.dataTables_length").hide();
$("div.dt-buttons").hide();
if (dt_'.$table_id.'.page.info().pages > 1) {
$("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").show()
}
} else {
$(".datatable-msg-info-'.$table_id.'").hide();
$("table#'.$table_id.'").show();
$("#'.$table_id.'_wrapper > div.dataTables_paginate").show();
$("#'.$table_id.'_wrapper > div.dataTables_info").hide();
$("#'.$table_id.'_wrapper > div.dataTables_length").show();
$("#'.$table_id.'_wrapper > div.dt-buttons").show();
if (dt_'.$table_id.'.page.info().pages == 1) {
$("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").hide()
}
}';
if (isset($parameters['drawCallback'])) {
$js .= $parameters['drawCallback'];
}
$searching = 'false';
if (isset($parameters['searching']) && $parameters['searching'] === true) {
$searching = 'true';
}
$ordering = 'true';
if (isset($parameters['ordering']) && $parameters['ordering'] === false) {
$ordering = 'false';
}
$js .= '},';
$languaje = substr(get_user_language(), 0, 2);
$js .= '
processing: true,
serverSide: '.$serverside.',
paging: '.$parameters['paging'].',
pageLength: '.$parameters['default_pagination'].',
searching: '.$searching.',
responsive: true,
dom: '.$dom_elements.',
language: {
url: "/pandora_console/include/javascript/i18n/dataTables.'.$languaje.'.json",
processing:"'.$processing.'",
zeroRecords:"'.$zeroRecords.'",
emptyTable:"'.$emptyTable.'",
},
buttons: '.$parameters['csv'].'== 1 ? [
{
extend: "csv",
text : "'.__('Export current page to CSV').'",
titleAttr: "'.__('Export current page to CSV').'",
title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'",
fieldSeparator: "'.$config['csv_divider'].'",
action: function ( e, dt, node, config ) {
blockResubmit(node);
// Call the default csvHtml5 action method to create the CSV file
$.fn.dataTable.ext.buttons.csvHtml5.action.call(this, e, dt, node, config);
},
exportOptions : {
modifier : {
// DataTables core
order : "current",
page : "All",
search : "applied"
}'.$export_columns.'
},
}
] : [],
lengthMenu: '.json_encode($pagination_options).',
columnDefs: [
{ className: "no-class", targets: "_all" },
{ bSortable: false, targets: '.$no_sortable_columns.' }
],
ordering: '.$ordering.',
initComplete: function(settings, json) {
// Move elements to table_action_buttons bar.
$(".action_buttons_right_content").html("<div class=\"pagination-child-div\"></div>");
$(".action_buttons_right_content").html("<div class=\"pagination-child-div\"></div>");
$(".action_buttons_right_content").html("<div class=\"pagination-child-div\"></div>");
$(".action_buttons_right_content").html("<div class=\"pagination-child-div\"></div>");
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").attr("style","margin-right: 10px;"));
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dataTables_length"));
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dt-buttons"));
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dataTables_filter"));
$("div.spinner-fixed").hide();
},
columns: [';
foreach ($parameters['datacolumns'] as $data) {
if (is_array($data)) {
$js .= '{data : "'.$data['text'].'",className: "'.$data['class'].'"},';
} else {
$js .= '{data : "'.$data.'",className: "no-class"},';
}
}
$js .= '
],
order: [[ '.$order.' ]],';
$js .= $type_data;
$js .= '
};
dt_'.$table_id.' = $("#'.$table_id.'").DataTable(settings_datatable);
$("#button-'.$form_id.'_search_bt").click(function (){
dt_'.$table_id.'.draw().page(0)
});
';
if (isset($parameters['caption']) === true
&& empty($parameters['caption']) === false
) {
$js .= '$("#'.$table_id.'").append("<caption>'.$parameters['caption'].'</caption>");';
$js .= '$(".datatables_thead_tr").css("height", 0);';
}
if (isset($parameters['csv']) === true) {
$js."'$('#".$table_id."').on( 'buttons-processing', function ( e, indicator ) {
if ( indicator ) {
console.log('a');
}
else {
console.log('b');
}";
}
$js .= '$("table#'.$table_id.'").removeClass("invisible");
});';
$js .= '
$(function() {
$(document).on("preInit.dt", function (ev, settings) {
$("div.dataTables_length").hide();
$("div.dt-buttons").hide();
});
});
';
$js .= '</script>';
}
// Order.
$info_msg_arr = []; $info_msg_arr = [];
$info_msg_arr['message'] = $emptyTable; $info_msg_arr['message'] = $emptyTable;
$info_msg_arr['div_class'] = 'info_box_container invisible_important datatable-msg-info-'.$table_id; $info_msg_arr['div_class'] = 'info_box_container invisible_important datatable-msg-info-'.$table_id;
$spinner = '<div class="spinner-fixed"><span></span><span></span><span></span><span></span></div>'; $spinner = '<div id="'.$table_id.'-spinner" class="spinner-fixed"><span></span><span></span><span></span><span></span></div>';
$info_msg = '<div>'.ui_print_info_message($info_msg_arr).'</div>'; $info_msg = '<div>'.ui_print_info_message($info_msg_arr).'</div>';
$err_msg = '<div id="error-'.$table_id.'"></div>'; $err_msg = '<div id="error-'.$table_id.'"></div>';
$output = $info_msg.$err_msg.$filter.$extra.$spinner.$table.$js; $output = $info_msg.$err_msg.$filter.$extra.$spinner.$table.$js;
if (is_ajax() === false) { if (is_ajax() === false) {
@ -4436,7 +4206,7 @@ function ui_print_datatable(array $parameters)
false, false,
false false
); );
$output .= '?v='.$config['current_package'].'"/>'; $output .= '"/>';
// Load tables.css. // Load tables.css.
$output .= '<link rel="stylesheet" href="'; $output .= '<link rel="stylesheet" href="';
$output .= ui_get_full_url( $output .= ui_get_full_url(

View File

@ -0,0 +1,568 @@
<?php
/**
* Agents Functions.
*
* @category Agents functions.
* @package Pandora FMS
* @subpackage User interface.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 PandoraFMS Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
/**
* Create_module_latency_goliat and return module id.
*
* @param mixed $id_agent Id agent.
* @param mixed $module_name Module name.
* @param mixed $id_group Id group.
* @param mixed $url_search Url to search.
* @param mixed $string_search Text to search.
*
* @return interger Module id.
*/
function create_module_latency_goliat($id_agent, $module_name, $id_group, $url_search, $string_search='')
{
if ($string_search !== '') {
$str_search = 'check_string '.$string_search.'';
}
include_once 'include/functions_modules.php';
$array_values = [
'id_tipo_modulo' => '30',
'descripcion' => '',
'max' => '0',
'min' => '0',
'snmp_oid' => '',
'snmp_community' => 'public',
'id_module_group' => $id_group,
'module_interval' => '300',
'module_ff_interval' => '0',
'ip_target' => '',
'tcp_port' => '0',
'tcp_rcv' => '',
'tcp_send' => '',
'id_export' => '0',
'plugin_user' => '',
'plugin_pass' => '0',
'plugin_parameter' => 'task_begin
get '.$url_search.'
resource 1
'.$str_search.'
task_end',
'id_plugin' => '0',
'post_process' => '0',
'prediction_module' => '0',
'max_timeout' => '0',
'max_retries' => '0',
'disabled' => '',
'id_modulo' => '7',
'custom_id' => '',
'history_data' => '1',
'dynamic_interval' => '0',
'dynamic_max' => '0',
'dynamic_min' => '0',
'dynamic_two_tailed' => '0',
'parent_module_id' => '0',
'min_warning' => '0',
'max_warning' => '0',
'str_warning' => '',
'min_critical' => '0',
'max_critical' => '0',
'str_critical' => '',
'custom_string_1' => '',
'custom_string_2' => '',
'custom_string_3' => '',
'custom_integer_1' => '0',
'custom_integer_2' => '0',
'min_ff_event' => '0',
'min_ff_event_normal' => '0',
'min_ff_event_warning' => '0',
'min_ff_event_critical' => '0',
'ff_type' => '0',
'each_ff' => '0',
'ff_timeout' => '0',
'unit' => '',
'macros' => '',
'quiet' => '0',
'cps' => '0',
'critical_instructions' => '',
'warning_instructions' => '',
'unknown_instructions' => '',
'critical_inverse' => '0',
'warning_inverse' => '0',
'percentage_critical' => '0',
'percentage_warning' => '0',
'cron_interval' => '* * * * *',
'id_category' => '0',
'disabled_types_event' => '{\"going_unknown\":0}',
'module_macros' => 'W10=',
'warning_time' => '0',
];
return modules_create_agent_module($id_agent, $module_name.'_latency', $array_values);
}
/**
* Create_module_status_goliat and return module id.
*
* @param mixed $id_agent Id agent.
* @param mixed $module_name Module name.
* @param mixed $id_group Id group.
* @param mixed $url_search Url to search.
* @param mixed $string_search Text to search.
*
* @return interger Module id.
*/
function create_module_status_goliat($id_agent, $module_name, $id_group, $url_search, $string_search='')
{
if ($string_search !== '') {
$str_search = 'check_string '.$string_search.' ';
}
include_once 'include/functions_modules.php';
$array_values = [
'id_tipo_modulo' => '31',
'descripcion' => '',
'max' => '0',
'min' => '0',
'snmp_oid' => '',
'snmp_community' => 'public',
'id_module_group' => $id_group,
'module_interval' => '300',
'module_ff_interval' => '0',
'ip_target' => '',
'tcp_port' => '0',
'tcp_rcv' => '',
'tcp_send' => '',
'id_export' => '0',
'plugin_user' => '',
'plugin_pass' => '0',
'plugin_parameter' => 'task_begin
get '.$url_search.'
resource 1
'.$str_search.'
task_end',
'id_plugin' => '0',
'post_process' => '0',
'prediction_module' => '0',
'max_timeout' => '0',
'max_retries' => '0',
'disabled' => '',
'id_modulo' => '7',
'custom_id' => '',
'history_data' => '1',
'dynamic_interval' => '0',
'dynamic_max' => '0',
'dynamic_min' => '0',
'dynamic_two_tailed' => '0',
'parent_module_id' => '0',
'min_warning' => '0',
'max_warning' => '0',
'str_warning' => '',
'min_critical' => '0',
'max_critical' => '0',
'str_critical' => '',
'custom_string_1' => '',
'custom_string_2' => '',
'custom_string_3' => '',
'custom_integer_1' => '0',
'custom_integer_2' => '0',
'min_ff_event' => '0',
'min_ff_event_normal' => '0',
'min_ff_event_warning' => '0',
'min_ff_event_critical' => '0',
'ff_type' => '0',
'each_ff' => '0',
'ff_timeout' => '0',
'unit' => '',
'macros' => '',
'quiet' => '0',
'cps' => '0',
'critical_instructions' => '',
'warning_instructions' => '',
'unknown_instructions' => '',
'critical_inverse' => '0',
'warning_inverse' => '0',
'percentage_critical' => '0',
'percentage_warning' => '0',
'cron_interval' => '* * * * *',
'id_category' => '0',
'disabled_types_event' => '{\"going_unknown\":0}',
'module_macros' => 'W10=',
'warning_time' => '0',
];
return modules_create_agent_module($id_agent, $module_name.'_status', $array_values);
}
/**
* Create module basic network and return module id.
*
* @param mixed $id_agent Id agent.
* @param mixed $id_group Id group.
* @param mixed $ip_target Ip target.
*
* @return interger Module id.
*/
function create_module_basic_network($id_agent, $id_group, $ip_target)
{
include_once 'include/functions_modules.php';
$array_values = [
'id_tipo_modulo' => '6',
'descripcion' => 'Basic network check (ping)',
'max' => '0',
'min' => '0',
'snmp_oid' => '',
'snmp_community' => 'public',
'id_module_group' => $id_group,
'module_interval' => '300',
'module_ff_interval' => '0',
'ip_target' => $ip_target,
'tcp_port' => '0',
'tcp_rcv' => '',
'tcp_send' => '',
'id_export' => '0',
'plugin_user' => '',
'plugin_pass' => '0',
'plugin_parameter' => '',
'id_plugin' => '0',
'post_process' => '0',
'prediction_module' => '0',
'max_timeout' => '0',
'max_retries' => '0',
'disabled' => '',
'id_modulo' => '2',
'custom_id' => '',
'history_data' => '1',
'dynamic_interval' => '0',
'dynamic_max' => '0',
'dynamic_min' => '0',
'dynamic_two_tailed' => '0',
'parent_module_id' => '0',
'min_warning' => '0',
'max_warning' => '0',
'str_warning' => '',
'min_critical' => '0',
'max_critical' => '0',
'str_critical' => '',
'custom_string_1' => '',
'custom_string_2' => '',
'custom_string_3' => '',
'custom_integer_1' => '0',
'custom_integer_2' => '0',
'min_ff_event' => '0',
'min_ff_event_normal' => '0',
'min_ff_event_warning' => '0',
'min_ff_event_critical' => '0',
'ff_type' => '0',
'each_ff' => '0',
'ff_timeout' => '0',
'unit' => '',
'macros' => '',
'quiet' => '0',
'cps' => '0',
'critical_instructions' => '',
'warning_instructions' => '',
'unknown_instructions' => '',
'critical_inverse' => '0',
'warning_inverse' => '0',
'percentage_critical' => '0',
'percentage_warning' => '0',
'cron_interval' => '* * * * *',
'id_category' => '0',
'disabled_types_event' => '{\"going_unknown\":0}',
'module_macros' => 'W10=',
'warning_time' => '0',
];
return modules_create_agent_module($id_agent, 'Basic_Network_Check', $array_values);
}
/**
* Create module latency network and return module id.
*
* @param mixed $id_agent Id agent.
* @param mixed $id_group Id group.
* @param mixed $ip_target Ip target.
*
* @return interger Module id.
*/
function create_module_latency_network($id_agent, $id_group, $ip_target)
{
include_once 'include/functions_modules.php';
$array_values = [
'id_tipo_modulo' => '7',
'descripcion' => 'Basic network connectivity check to measure network latency in miliseconds',
'max' => '0',
'min' => '0',
'snmp_oid' => '',
'snmp_community' => 'public',
'id_module_group' => $id_group,
'module_interval' => '300',
'module_ff_interval' => '0',
'ip_target' => $ip_target,
'tcp_port' => '0',
'tcp_rcv' => '',
'tcp_send' => '',
'id_export' => '0',
'plugin_user' => '',
'plugin_pass' => '0',
'plugin_parameter' => '',
'id_plugin' => '0',
'post_process' => '0',
'prediction_module' => '0',
'max_timeout' => '0',
'max_retries' => '0',
'disabled' => '',
'id_modulo' => '2',
'custom_id' => '',
'history_data' => '1',
'dynamic_interval' => '0',
'dynamic_max' => '0',
'dynamic_min' => '0',
'dynamic_two_tailed' => '1',
'parent_module_id' => '0',
'min_warning' => '0',
'max_warning' => '0',
'str_warning' => '',
'min_critical' => '0',
'max_critical' => '0',
'str_critical' => '',
'custom_string_1' => '',
'custom_string_2' => '',
'custom_string_3' => '',
'custom_integer_1' => '0',
'custom_integer_2' => '0',
'min_ff_event' => '0',
'min_ff_event_normal' => '0',
'min_ff_event_warning' => '0',
'min_ff_event_critical' => '0',
'ff_type' => '0',
'each_ff' => '0',
'ff_timeout' => '0',
'unit' => '',
'macros' => '',
'quiet' => '0',
'cps' => '0',
'critical_instructions' => '',
'warning_instructions' => '',
'unknown_instructions' => '',
'critical_inverse' => '0',
'warning_inverse' => '0',
'percentage_critical' => '0',
'percentage_warning' => '0',
'cron_interval' => '* * * * *',
'id_category' => '0',
'disabled_types_event' => '{\"going_unknown\":0}',
'module_macros' => 'W10=',
'warning_time' => '0',
];
return modules_create_agent_module($id_agent, 'Basic_Network_Latency', $array_values);
}
/**
* Create module packet lost and return module id.
*
* @param mixed $id_agent Id agent.
* @param mixed $id_group Id group.
* @param mixed $ip_target Ip target.
*
* @return interger Module id.
*/
function create_module_packet_lost($id_agent, $id_group, $ip_target)
{
include_once 'include/functions_modules.php';
$array_values = [
'id_tipo_modulo' => '1',
'descripcion' => 'Basic network connectivity check to measure packet loss in %',
'max' => '0',
'min' => '0',
'snmp_oid' => '',
'snmp_community' => 'public',
'id_module_group' => $id_group,
'module_interval' => '300',
'module_ff_interval' => '0',
'ip_target' => '',
'tcp_port' => '0',
'tcp_rcv' => '',
'tcp_send' => '',
'id_export' => '0',
'plugin_user' => '',
'plugin_pass' => '0',
'plugin_parameter' => '',
'id_plugin' => '9',
'post_process' => '0',
'prediction_module' => '0',
'max_timeout' => '0',
'max_retries' => '0',
'disabled' => '',
'id_modulo' => '4',
'custom_id' => '',
'history_data' => '1',
'dynamic_interval' => '0',
'dynamic_max' => '0',
'dynamic_min' => '0',
'dynamic_two_tailed' => '1',
'parent_module_id' => '0',
'min_warning' => '0',
'max_warning' => '0',
'str_warning' => '',
'min_critical' => '0',
'max_critical' => '0',
'str_critical' => '',
'custom_string_1' => '',
'custom_string_2' => '',
'custom_string_3' => '',
'custom_integer_1' => '0',
'custom_integer_2' => '0',
'min_ff_event' => '0',
'min_ff_event_normal' => '0',
'min_ff_event_warning' => '0',
'min_ff_event_critical' => '0',
'ff_type' => '0',
'each_ff' => '0',
'ff_timeout' => '0',
'unit' => '',
'macros' => '{"1":{"macro":"_field1_","desc":"Test time","help":"","value":"8","hide":""},"2":{"macro":"_field2_","desc":"Target IP","help":"","value":"'.$ip_target.'","hide":""}}',
'quiet' => '0',
'cps' => '0',
'critical_instructions' => '',
'warning_instructions' => '',
'unknown_instructions' => '',
'critical_inverse' => '0',
'warning_inverse' => '0',
'percentage_critical' => '0',
'percentage_warning' => '0',
'cron_interval' => '* * * * *',
'id_category' => '0',
'disabled_types_event' => '{\"going_unknown\":0}',
'module_macros' => 'W10=',
'warning_time' => '0',
];
return modules_create_agent_module($id_agent, 'Basic_Network_Packetloss', $array_values);
}
/**
* Create module packet lost and return module id.
*
* @param string $ip_target Ip and red mask.
*
* @return interger Module id.
*/
function create_net_scan($ip_target)
{
global $config;
include_once $config['homedir'].'/godmode/wizards/HostDevices.class.php';
$HostDevices = new HostDevices(1);
$id_recon_server = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_DISCOVERY], 'id_server')['id_server'];
$_POST = [
'page' => '1',
'interval_manual_defined' => '1',
'interval_select' => '-1',
'interval_text' => '0',
'interval' => '0',
'interval_units' => '1',
'taskname' => __('Basic network'),
'id_recon_server' => $id_recon_server,
'network' => $ip_target,
'id_group' => '8',
'comment' => __('Created on welcome'),
];
$task_created = $HostDevices->parseNetScan();
if ($task_created === true) {
$HostDevicesFinal = new HostDevices(2);
$_POST = [
'task' => $HostDevices->task['id_rt'],
'page' => '2',
'recon_ports' => '',
'auto_monitor' => 'on',
'id_network_profile' => ['0' => '2'],
'review_results' => 'on',
'review_limited' => '0',
'snmp_enabled' => 'on',
'snmp_version' => '1',
'snmp_skip_non_enabled_ifs' => 'on',
'community' => '',
'snmp_context' => '',
'snmp_auth_user' => '',
'snmp_security_level' => 'authNoPriv',
'snmp_auth_method' => 'MD5',
'snmp_auth_pass' => '',
'snmp_privacy_method' => 'AES',
'snmp_privacy_pass' => '',
'os_detect' => 'on',
'resolve_names' => 'on',
'parent_detection' => 'on',
'parent_recursion' => 'on',
'vlan_enabled' => 'on',
];
$task_final_created = $HostDevicesFinal->parseNetScan();
if ($task_final_created === true) {
$net_scan_id = $HostDevices->task['id_rt'];
unset($HostDevices, $HostDevicesFinal);
return $net_scan_id;
}
} else {
return 0;
}
}
/**
* Create new template unknown.
*
* @return boolean 1 correct create 0 bad create.
*/
function create_template_alert_unknown()
{
$name = io_safe_input(__('Unknown condition'));
$type = 'critical';
$values = [
'description' => __('This is a generic alert template to fire on UNKNOWN condition'),
'max_value' => 0,
'min_value' => 0,
'id_group' => 0,
'priority' => 4,
'wizard_level' => 'nowizard',
'time_threshold' => '300',
'min_alerts_reset_counter' => 1,
'schedule' => '{"monday":[{"start":"00:00:00","end":"00:00:00"}],"tuesday":[{"start":"00:00:00","end":"00:00:00"}],"wednesday":[{"start":"00:00:00","end":"00:00:00"}],"thursday":[{"start":"00:00:00","end":"00:00:00"}],"friday":[{"start":"00:00:00","end":"00:00:00"}],"saturday":[{"start":"00:00:00","end":"00:00:00"}],"sunday":[{"start":"00:00:00","end":"00:00:00"}]}',
'recovery_notify' => true,
'field2' => '[PANDORA] Alert for UNKNOWN status on _agent_ / _module_',
'field2_recovery' => '[PANDORA] Alert RECOVERED for UNKNOWN status on _agent_ / _module_',
'field3' => '<div style="background-color: #eaf0f6; font-family: Arial, Helvetica, sans-serif; padding: 30px; margin: 0;"><table style="max-width: 560px; background-color: white; border-radius: 10px; padding: 10px 20px 40px;" cellspacing="0" cellpadding="0" align="center"><thead><tr><td style="padding: 0px 0px 5px;"><a href="https://pandorafms.com/en/" target="_blank" rel="noopener"><img src="https://pandorafms.com/wp-content/uploads/2022/03/System-email-Pandora-FMS.png" width="206px"></a></td><td style="padding: 0px 0px 5px;"><p style="text-align: right; color: #223549; font-weight: bold; line-height: 36px; padding: 0px; font-size: 12px;">Automatic alert system</p></td></tr><tr><td style="padding: 0px 0px 5px;" colspan="2"><hr style="border: 1px solid #f5f5f5; width: 100%; margin: 0px;"></td></tr></thead><tbody><tr><td colspan="2"><img style="display: block; margin-left: auto; margin-right: auto; width: 105px; margin-top: 20px; padding: 0px;" src="https://pandorafms.com/wp-content/uploads/2022/03/Warning-news.png" width="105px"></td></tr><tr><td colspan="2"><p style="font-size: 24px; text-align: center; color: #223549; padding: 0px 10%; line-height: 34px; margin: 20px 0px;">We have bad news for you, something is on <span style="text-transform: uppercase; font-weight: 800;">UNKNOWN</span>&nbsp;status!</p><div><!-- [if mso]><v:rect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="#" style="height:33px;v-text-anchor:middle;width:100px;" stroke="f" fillcolor="#D84A38"><w:anchorlock/><center><![endif]--><a style="background-color: #223549; border: none; color: white; padding: 15px 30px; text-align: center; text-decoration: none; display: block; font-size: 16px; margin-left: auto; margin-right: auto; border-radius: 100px; max-width: 50%; margin-top: 0px; font-weight: bold;" href="_homeurl_">Go to Pandora FMS Console</a><!-- [if mso]></center></v:rect><![endif]--></div></td></tr><tr><td colspan="2"><div style="background-color: #f6f6f6; border-radius: 10px; padding: 10px 20px; margin-top: 40px;"><p style="font-size: 18px; line-height: 30px; color: #223549;">Monitoring details</p><p style="font-size: 15px; color: #333333; font-weight: 800; line-height: 15px;">Data: <span style="font-weight: 400!important;">_data_ <em>(warning)</em></span></p><p style="font-size: 15px; color: #333333; font-weight: 800; line-height: 15px;">Agent: <span style="font-weight: 400!important;">_agent_ <em>_address_</em></span></p><p style="font-size: 15px; color: #333333; font-weight: 800; line-height: 15px;">Module: <span style="font-weight: 400!important;">_module_ <em>_moduledescription_</em></span></p><p style="font-size: 15px; color: #333333; font-weight: 800; line-height: 15px;">Timestamp: <span style="font-weight: 400!important;">_timestamp_</span></p></div></td></tr><tr><td style="padding: 20px 0px;" colspan="2"><p style="font-size: 18px; line-height: 30px; color: #223549;">This is a graph of latest 24hr data for this module</p><p style="font-weight: 400!important;">_modulegraph_24h_</p></td></tr></tbody></table><div style="text-align: center; margin-top: 10px;"><p style="font-size: 12px; text-decoration: none; font-weight: 400; color: #777;"><a style="font-size: 12px; text-decoration: none; font-weight: 400; color: #777;" href="https://pandorafms.com/en/contact/">Contact Us</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a style="font-size: 12px; text-decoration: none; font-weight: 400; color: #777;" href="https://pandorafms.com/community/forums/forum/english/">Support</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a style="font-size: 12px; text-decoration: none; font-weight: 400; color: #777;" href="https://pandorafms.com/manual/en/start">Docs</a></p></div></div>',
'field3_recovery' => '<div style="background-color:#EAF0F6; font-family: Arial, Helvetica, sans-serif; padding:30px; margin:0;"><table style="max-width:560px; background-color:white; border-radius:10px; padding:10px 20px 40px;" cellspacing="0" cellpadding="0" align="center"><thead><tr><td style="padding:0px 0px 5px;"><a href="https://pandorafms.com/en/" target="_blank"><img src="https://pandorafms.com/wp-content/uploads/2022/03/System-email-Pandora-FMS.png" width="206px"></a></td><td style="padding:0px 0px 5px;"><p style="text-align:right; color:#223549; font-weight:700; line-height:36px; padding:0px; font-size:12px;">Automatic alert system</p></td></tr><tr><td colspan="2" style="padding:0px 0px 5px;"><hr style="border: 1px solid #f5f5f5; width:100%; margin:0px;"></td></tr></thead><tbody><tr><td colspan="2"><img src="https://pandorafms.com/wp-content/uploads/2022/03/System-email-Good-news.png" style="display: block; margin-left: auto; margin-right: auto; width:105px; margin-top:20px; padding:0px;" width="105px"></td></tr><tr><td colspan="2"><p style="font-size:24px; text-align:center; color:#223549; padding:0px 10%; line-height:34px; margin:20px 0px;">We have good news for you, alert has been <span style="text-transform:uppercase; font-weight:800;">recovered</span></p><div><!--[if mso]><v:rect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="#" style="height:33px;v-text-anchor:middle;width:100px;" stroke="f" fillcolor="#D84A38"><w:anchorlock/><center><![endif]--><a style="background-color: #223549; border: none; color: white; padding: 15px 30px; text-align: center; text-decoration: none; display: block; font-size: 16px; margin-left: auto; margin-right: auto; border-radius:100px; max-width:50%; margin-top:0px; font-weight:700;" href="_homeurl_">Go to Pandora FMS Console</a><!--[if mso]></center></v:rect><![endif]--></div></td></tr><tr><td colspan="2"><div style="background-color:#F6F6F6; border-radius:10px; padding:10px 20px; margin-top:40px;"><p style="font-size:18px; line-height:30px; color:#223549;">Monitoring details</p><p style="font-size:15px; color:#333333; font-weight:800; line-height:15px;">Data: <span style="font-weight:400!important;">_data_ <em>(normal)</em></span></p><p style="font-size:15px; color:#333333; font-weight:800; line-height:15px;">Agent: <span style="font-weight:400!important;">_agent_ <em>_address_</em></span></p><p style="font-size:15px; color:#333333; font-weight:800; line-height:15px;">Module: <span style="font-weight:400!important;">_module_ <em>_moduledescription_</em></span></p><p style="font-size:15px; color:#333333; font-weight:800; line-height:15px;">Timestamp: <span style="font-weight:400!important;">_timestamp_</span></p></div></td></tr><tr><td style="padding:20px 0px;" colspan="2"><p style="font-size:18px; line-height:30px; color:#223549;">This is a graph of latest 24hr data for this module</p><p style="font-weight:400!important;">_modulegraph_24h_</p></td></tr></tbody></table><div style="text-align:center; margin-top:10px;"><p style="font-size:12px; text-decoration: none; font-weight:400; color:#777;"><a href="https://pandorafms.com/en/contact/" style="font-size:12px; text-decoration: none; font-weight:400; color:#777;">Contact Us</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="https://pandorafms.com/community/forums/forum/english/" style="font-size:12px; text-decoration: none; font-weight:400; color:#777;">Support</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="https://pandorafms.com/manual/en/start" style="font-size:12px; text-decoration: none; font-weight:400; color:#777;">Docs</a></p></div></div>',
];
$result = alerts_create_alert_template($name, $type, $values);
return $result;
}

View File

@ -57,7 +57,7 @@ function include_javascript_d3($return=false)
} }
function d3_relationship_graph($elements, $matrix, $width=700, $return=false) function d3_relationship_graph($elements, $matrix, $width=700, $return=false, $height=700)
{ {
global $config; global $config;
@ -72,7 +72,7 @@ function d3_relationship_graph($elements, $matrix, $width=700, $return=false)
$output = '<div id="chord_diagram"></div>'; $output = '<div id="chord_diagram"></div>';
$output .= include_javascript_d3(true); $output .= include_javascript_d3(true);
$output .= "<script language=\"javascript\" type=\"text/javascript\"> $output .= "<script language=\"javascript\" type=\"text/javascript\">
chordDiagram('#chord_diagram', $elements, $matrix, $width); chordDiagram('#chord_diagram', $elements, $matrix, $width, $height);
</script>"; </script>";
if (!$return) { if (!$return) {
@ -150,7 +150,7 @@ function d3_tree_map_graph($data, $width=700, $height=700, $return=false)
} }
function d3_sunburst_graph($data, $width=700, $height=700, $return=false, $tooltip=true) function d3_sunburst_graph($data, $width=700, $height=700, $return=false, $tooltip=true, $id_container=false)
{ {
global $config; global $config;
@ -158,6 +158,8 @@ function d3_sunburst_graph($data, $width=700, $height=700, $return=false, $toolt
$data = json_encode($data); $data = json_encode($data);
} }
$id_container = ($id_container === false) ? '#sunburst' : $id_container;
$output = "<div id=\"sunburst\" style='overflow: hidden;'></div>"; $output = "<div id=\"sunburst\" style='overflow: hidden;'></div>";
$output .= include_javascript_d3(true); $output .= include_javascript_d3(true);
$output .= '<style type="text/css"> $output .= '<style type="text/css">
@ -167,7 +169,7 @@ function d3_sunburst_graph($data, $width=700, $height=700, $return=false, $toolt
} }
</style>'; </style>';
$output .= "<script language=\"javascript\" type=\"text/javascript\"> $output .= "<script language=\"javascript\" type=\"text/javascript\">
sunburst('#sunburst', $data, '$width', '$height', '$tooltip'); sunburst('$id_container', $data, '$width', '$height', '$tooltip');
</script>"; </script>";
if (!$return) { if (!$return) {

View File

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

View File

@ -22,7 +22,7 @@
// matrix = [[0, 0, 2], // a[a => a, a => b, a => c] // matrix = [[0, 0, 2], // a[a => a, a => b, a => c]
// [5, 0, 1], // b[b => a, b => b, b => c] // [5, 0, 1], // b[b => a, b => b, b => c]
// [2, 3, 0]]; // c[c => a, c => b, c => c] // [2, 3, 0]]; // c[c => a, c => b, c => c]
function chordDiagram(recipient, elements, matrix, width) { function chordDiagram(recipient, elements, matrix, width, height) {
d3.chart = d3.chart || {}; d3.chart = d3.chart || {};
d3.chart.chordWheel = function(options) { d3.chart.chordWheel = function(options) {
// Default values // Default values
@ -59,10 +59,13 @@ function chordDiagram(recipient, elements, matrix, width) {
.enter() .enter()
.append("svg:svg") .append("svg:svg")
.attr("width", width) .attr("width", width)
.attr("height", width) .attr("height", height)
.attr("class", "dependencyWheel") .attr("class", "dependencyWheel")
.append("g") .append("g")
.attr("transform", "translate(" + width / 2 + "," + width / 2 + ")"); .attr(
"transform",
"translate(" + width / 2 + "," + height / 2 + ") scale(1.2)"
);
var arc = d3.svg var arc = d3.svg
.arc() .arc()
@ -206,8 +209,8 @@ function chordDiagram(recipient, elements, matrix, width) {
.on("mousemove", move_tooltip); .on("mousemove", move_tooltip);
function move_tooltip(d) { function move_tooltip(d) {
x = d3.event.pageX + 10; x = d3.event.layerX + 10;
y = d3.event.pageY + 10; y = d3.event.layerY + 10;
$("#tooltip").css("left", x + "px"); $("#tooltip").css("left", x + "px");
$("#tooltip").css("top", y + "px"); $("#tooltip").css("top", y + "px");

View File

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

View File

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

View File

@ -416,6 +416,10 @@ class Widget
$className .= '\OsQuickReportWidget'; $className .= '\OsQuickReportWidget';
break; break;
case 'netflow':
$className .= '\Netflow';
break;
case 'GroupedMeterGraphs': case 'GroupedMeterGraphs':
case 'ColorModuleTabs': case 'ColorModuleTabs':
case 'BlockHistogram': case 'BlockHistogram':
@ -424,6 +428,7 @@ class Widget
case 'ModulesByStatus': case 'ModulesByStatus':
case 'AvgSumMaxMinModule': case 'AvgSumMaxMinModule':
case 'BasicChart': case 'BasicChart':
case 'AgentHive':
$className .= '\\'.$name; $className .= '\\'.$name;
break; break;

View File

@ -0,0 +1,519 @@
<?php
/**
* Widget agent hive Pandora FMS Console
*
* @category Console Class
* @package Pandora FMS
* @subpackage Widget
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
namespace PandoraFMS\Dashboard;
use PandoraFMS\Enterprise\Metaconsole\Node;
global $config;
/**
* URL Widgets
*/
class AgentHive 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;
/**
* Cell ID.
*
* @var integer
*/
protected $cellId;
/**
* 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;
// Cell Id.
$this->cellId = $cellId;
// Options.
$this->values = $this->decoders($this->getOptionsWidget());
// Page.
$this->page = basename(__FILE__);
// ClassName.
$class = new \ReflectionClass($this);
$this->className = $class->getShortName();
// Title.
$this->title = __('Agent hive');
// Name.
if (empty($this->name) === true) {
$this->name = 'AgentHive';
}
// This forces at least a first configuration.
$this->configurationRequired = false;
if (empty($this->values['groups']) === true) {
$this->configurationRequired = true;
}
}
/**
* 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['groups'] = $decoder['groups'];
}
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();
// Filters.
$inputs[] = [
'label' => __('Groups'),
'id' => 'li_groups',
'arguments' => [
'type' => 'select_groups',
'name' => 'groups[]',
'returnAllGroup' => false,
'privilege' => 'AR',
'selected' => explode(',', $values['groups'][0]),
'return' => true,
'multiple' => true,
'required' => true,
],
];
return $inputs;
}
/**
* Get Post for widget.
*
* @return array
*/
public function getPost(): array
{
// Retrieve global - common inputs.
$values = parent::getPost();
$values['groups'] = \get_parameter('groups', 0);
return $values;
}
/**
* Draw widget.
*
* @return string;
*/
public function load()
{
global $config;
$groups = $this->values['groups'];
$groups = explode(',', $groups[0]);
$user_groups = array_keys(
users_get_groups(
false,
'AR',
false,
false,
$groups
)
);
foreach ($groups as $key => $group) {
if (in_array($group, $user_groups) === false) {
unset($groups[$key]);
}
}
$table = 'tagente';
if (is_metaconsole()) {
$table = 'tmetaconsole_agent';
}
$sql = sprintf(
'SELECT * FROM %s WHERE id_grupo IN('.implode(',', $groups).')',
$table
);
$all_agents = db_get_all_rows_sql($sql);
$output = '';
$output .= '<div class="container-tabs">';
foreach ($all_agents as $agent) {
$output .= $this->drawSquare($agent);
}
$output .= '</div>';
$output .= '<script type="text/javascript">
$(document).ready (function () {
$(".widget-agent-hive-square").click(function(e) {
if (typeof e.target.id === "string" && /img_.*/i.test(e.target.id) === false) {
var url = $(this).children("input").first().val();
window.open(url);
}
});
$("div [id*=hiveImg_] svg path").css("fill", "#99A3BE");
});
</script>';
return $output;
}
/**
* Draw square agent.
*
* @param array $data Info agent.
*
* @return string Output.
*/
private function drawSquare(array $data): string
{
global $config;
$id = (is_metaconsole() === true)
? $data['id_tagente']
: $data['id_agente'];
$status = agents_get_status_from_counts($data);
switch ($status) {
case 1:
case 4:
case 100:
// Critical (BAD or ALERT).
$color = '#e63c52';
break;
case 0:
case 300:
// Normal (OK).
$color = '#82b92e';
break;
case 2:
case 200:
// Warning.
$color = '#f3b200';
break;
case 5:
// Not init.
$color = '#4a83f3';
break;
default:
// Default is Grey (Other).
$color = '#b2b2b2';
break;
}
$style_contact = 'flex-grow: 9; font-size: 8pt; display: flex;
justify-content: start;align-items: start; color: #9FA5B1; font-weight: 600;';
// Last contact.
$lastContactDate = ui_print_timestamp(
$data['ultimo_contacto'],
true,
['style' => $style_contact]
);
// Url.
$console_url = ui_get_full_url('/');
if (is_metaconsole()) {
$server = metaconsole_get_servers($data['id_tmetaconsole_setup']);
$console_url = $server['server_url'].'/';
}
$url_view = $console_url.'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id;
$url_manage = $console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id;
$output = '<div class="widget-agent-hive-square">';
$output .= '<input type="hidden" name="test" value="'.$url_view.'" />';
$output .= '<div class="widget-agent-hive-square-status"
style="background-color:'.$color.'"></div>';
$output .= '<div class="widget-agent-hive-square-info">';
// Last contact and img.
$output .= '<div class="widget-agent-hive-square-info-header">';
$output .= $lastContactDate;
$output .= '<a href="'.$url_manage.'" target="_blank">'.html_print_image(
'images/configuration@svg.svg',
true,
[
'title' => __('Operation view'),
'class' => 'main_menu_icon invert_filter',
'style' => 'flex-grow: 1',
'id' => 'img_'.$id,
]
).'</a>';
$output .= '</div>';
// OS and alias.
$output .= '<div class="widget-agent-hive-square-info-body">';
$icon = (string) db_get_value(
'icon_name',
'tconfig_os',
'id_os',
(int) $data['id_os']
);
$output .= '<div id="hiveImg_'.$id.'"
style="width:20px;height:20px;margin-right: 5px;">';
$output .= file_get_contents(
ui_get_full_url('images/'.$icon, false, false, false)
);
$output .= '</div>';
$output .= ui_print_truncate_text(
ucfirst(io_safe_output($data['alias'])),
12,
false,
true,
true,
'&hellip;',
'font-size: 11pt;color: #14524f;white-space: nowrap;
font-weight: 600;text-align: left;width: 80%;
overflow: hidden;',
);
$output .= '</div>';
// OS description.
$output .= html_print_div(
[
'content' => (empty($data['os_version']) === true)
? get_os_name((int) $data['id_os'])
: $data['os_version'],
'style' => 'font-size: 6pt; display:
flex;justify-content: start;align-items: start;
color: #9FA5B1; font-weight: 600;margin-bottom: 5px',
],
true
);
// Description.
$output .= html_print_div(
[
'content' => ui_print_truncate_text(
io_safe_output($data['comentarios']),
38,
false,
true,
true,
'&hellip;',
),
'style' => 'text-align: left;min-height: 42px;
font-size: 8pt;max-height: 42px; margin-bottom: 10px',
],
true
);
// IP.
$output .= html_print_div(
[
'content' => $data['direccion'],
'style' => 'font-size: 10pt;color: #14524f;
font-weight: 600; text-align: left',
],
true
);
$output .= '</div>';
$output .= '</div>';
return $output;
}
/**
* Get description.
*
* @return string.
*/
public static function getDescription()
{
return __('Agents hive');
}
/**
* Get Name.
*
* @return string.
*/
public static function getName()
{
return 'AgentHive';
}
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
$size = [
'width' => (is_metaconsole() === true) ? 700 : 600,
'height' => 610,
];
return $size;
}
}

View File

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

View File

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

View File

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

View File

@ -540,12 +540,6 @@ class ModuleIconWidget extends Widget
$output = ''; $output = '';
$id_group = \agents_get_agent_group($this->values['agentId']);
$modulesAgent = \modules_get_agentmodule_agent(
$this->values['moduleId']
);
$data_module = \modules_get_last_value( $data_module = \modules_get_last_value(
$this->values['moduleId'] $this->values['moduleId']
); );
@ -574,33 +568,37 @@ class ModuleIconWidget extends Widget
// General div. // General div.
$output .= '<div class="'.$orientation.'" id="general-'.$uuid.'">'; $output .= '<div class="'.$orientation.'" id="general-'.$uuid.'">';
$sql = 'SELECT min_warning, $status = \modules_get_agentmodule_status($this->values['moduleId']);
max_warning,
min_critical,
max_critical,
str_warning,
str_critical
FROM tagente_modulo
WHERE id_agente_modulo = '.(int) $this->values['moduleId'];
$sql_data = db_get_row_sql($sql);
$last = modules_get_last_value($this->values['moduleId']); switch ($status) {
case 1:
case 4:
// Critical or critical alert (BAD).
$color_icon .= '_bad.png';
break;
$color_icon = '_ok'; case 0:
if (($last >= $sql_data['min_warning']) && ($last < $sql_data['max_warning'])) { // Normal (OK).
$color_icon = '_warning'; $color_icon .= '_ok.png';
break;
case 2:
case 10:
// Warning or warning alert.
$color_icon .= '_warning.png';
break;
case 3:
// Unknown.
default:
$color_icon .= '.png';
// Default is Grey (Other).
break;
} }
if ($last >= $sql_data['max_warning']) { $output .= '<div class="pdd_l_15px pdd_r_15px mrgn_btn_25px" style="flex: 0 1 '.$sizeIcon.'px; height: '.$sizeIcon.'px;">';
$color_icon = '_bad';
}
// Div image.
$style_icon = 'flex: 0 1 '.$sizeIcon.'px;';
$output .= '<div class="pdd_l_15px pdd_r_15px '.$margin_bottom.'" style="flex: 0 1 '.$sizeIcon.'px; height: '.$sizeIcon.'px;">';
$output .= html_print_image( $output .= html_print_image(
'images/console/icons/'.$icon.$color_icon.'.png', 'images/console/icons/'.$icon.$color_icon,
true, true,
['width' => $sizeIcon] ['width' => $sizeIcon]
); );

View File

@ -0,0 +1,465 @@
<?php
/**
* Widget Netflow Pandora FMS Console
*
* @category Console Class
* @package Pandora FMS
* @subpackage Widget Netflow
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
namespace PandoraFMS\Dashboard;
/**
* Netflow.
*/
class Netflow 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;
// Includes.
include_once $config['homedir'].'/include/functions_graph.php';
include_once $config['homedir'].'/include/class/NetworkMap.class.php';
// 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->getOptionsWidget();
// Positions.
$this->position = $this->getPositionWidget();
// Page.
$this->page = basename(__FILE__);
// ClassName.
$class = new \ReflectionClass($this);
$this->className = $class->getShortName();
// Title.
$this->title = __('Netflow');
// Name.
if (empty($this->name) === true) {
$this->name = 'netflow';
}
}
/**
* 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();
// Default values.
if (isset($values['quantity']) === false) {
$values['quantity'] = 5;
}
// Default values.
if (isset($values['period']) === false) {
$values['period'] = SECONDS_1WEEK;
}
// Default values.
if (isset($values['max_values']) === false) {
$values['max_values'] = 10;
}
// Period.
$inputs[] = [
'label' => __('Interval'),
'arguments' => [
'name' => 'period',
'type' => 'interval',
'value' => $values['period'],
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
],
];
$chart_types = netflow_get_chart_types();
$chart_types['usage_map'] = __('Usage map');
$inputs[] = [
'label' => __('Type graph'),
'arguments' => [
'name' => 'chart_type',
'type' => 'select',
'fields' => $chart_types,
'selected' => $values['chart_type'],
],
];
$aggregate_list = [
'srcip' => __('Src Ip Address'),
'dstip' => __('Dst Ip Address'),
'srcport' => __('Src Port'),
'dstport' => __('Dst Port'),
];
$inputs[] = [
'label' => __('Aggregated by'),
'id' => 'aggregated',
'arguments' => [
'name' => 'aggregate',
'type' => 'select',
'fields' => $aggregate_list,
'selected' => $values['aggregate'],
],
];
$inputs[] = [
'label' => __('Data to show'),
'id' => 'data_to_show',
'arguments' => [
'name' => 'action',
'type' => 'select',
'fields' => network_get_report_actions(),
'selected' => $values['action'],
],
];
$max_values = [
'2' => '2',
'5' => '5',
'10' => '10',
'15' => '15',
'20' => '20',
'25' => '25',
'50' => '50',
];
$inputs[] = [
'label' => __('Max values'),
'arguments' => [
'name' => 'max_values',
'type' => 'select',
'fields' => $max_values,
'selected' => $values['max_values'],
],
];
return $inputs;
}
/**
* Get Post for widget.
*
* @return array
*/
public function getPost():array
{
// Retrieve global - common inputs.
$values = parent::getPost();
$values['period'] = \get_parameter('period', 0);
$values['chart_type'] = \get_parameter('chart_type', '');
$values['aggregate'] = \get_parameter('aggregate');
$values['max_values'] = \get_parameter('max_values', 10);
$values['action'] = \get_parameter('action', 'srcip');
return $values;
}
/**
* Draw widget.
*
* @return string
*/
public function load()
{
ui_require_css_file('netflow_widget', 'include/styles/', true);
global $config;
$output = '';
$size = parent::getSize();
$start_date = (time() - $this->values['period']);
$end_date = time();
if ($this->values['chart_type'] === 'usage_map') {
$map_data = netflow_build_map_data(
$start_date,
$end_date,
$this->values['max_values'],
($this->values['action'] === 'talkers') ? 'srcip' : 'dstip'
);
$has_data = !empty($map_data['nodes']);
if ($has_data === true) {
$map_manager = new \NetworkMap($map_data);
$map_manager->printMap();
} else {
ui_print_info_message(__('No data to show'));
}
} else {
$netflowContainerClass = ($this->values['chart_type'] === 'netflow_data' || $this->values['chart_type'] === 'netflow_summary' || $this->values['chart_type'] === 'netflow_top_N') ? '' : 'white_box';
$filter = [
'aggregate' => $this->values['aggregate'],
'netflow_monitoring_interval' => 300,
];
$output .= html_print_input_hidden(
'selected_style_theme',
$config['style'],
true
);
$style = 'width:100%; height: 100%; border: none;';
if ($this->values['chart_type'] !== 'netflow_area') {
$style .= ' width: 95%;';
}
if ($size['width'] > $size['height']) {
$size['width'] = $size['height'];
}
// Draw the netflow chart.
$output .= html_print_div(
[
'class' => $netflowContainerClass,
'style' => $style,
'content' => netflow_draw_item(
$start_date,
$end_date,
12,
$this->values['chart_type'],
$filter,
$this->values['max_values'],
'',
'HTML',
0,
($size['width'] - 50),
($size['height'] - 20),
),
],
true
);
}
return $output;
}
/**
* Return aux javascript code for forms.
*
* @return string
*/
public function getFormJS()
{
return '
$(document).ready(function(){
//Limit 1 week
$("#period_select option").each(function(key, element){
if(element.value > 604800){
$(element).remove();
}
})
$("#period_manual option").each(function(key, element){
if(element.value > 604800){
$(element).remove();
}
});
$("#period_manual input").on("change", function(e){
if($("#hidden-period").val() > 604800) {
$(this).val(1);
$("#hidden-period").val(604800);
$("#period_manual select option").removeAttr("selected");
setTimeout(() => {
$("#period_default select option[value=\'604800\']").attr("selected", "selected");
$("#period_manual select option[value=\'604800\']").attr("selected", "selected");
$("#period_manual select").val(604800);
}, 500);
}
});
if($("#chart_type").val() === "usage_map") {
$("#data_to_show").show();
$("#aggregated").hide();
} else {
$("#data_to_show").hide();
$("#aggregated").show();
}
$("#chart_type").on("change", function(e){
if(this.value === "usage_map") {
$("#data_to_show").show();
$("#aggregated").hide();
} else {
$("#data_to_show").hide();
$("#aggregated").show();
}
});
});
';
}
/**
* Get description.
*
* @return string.
*/
public static function getDescription()
{
return __('Netflow');
}
/**
* Get Name.
*
* @return string.
*/
public static function getName()
{
return 'netflow';
}
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
$size = [
'width' => 400,
'height' => 530,
];
return $size;
}
}

View File

@ -433,7 +433,14 @@ class ServiceMapWidget extends Widget
); );
} else { } else {
include_once $config['homedir'].'/include/graphs/functions_d3.php'; include_once $config['homedir'].'/include/graphs/functions_d3.php';
servicemap_print_sunburst($this->values['serviceId'], $size['width'], $size['height'], false); $id_container = '#container_servicemap_'.$this->values['serviceId'].'_'.$this->cellId.' #sunburst';
servicemap_print_sunburst(
$this->values['serviceId'],
$size['width'],
$size['height'],
false,
$id_container
);
} }
$output .= ob_get_clean(); $output .= ob_get_clean();

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