mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Merge branch 'develop' into ent-12296-mejorar-aspecto-filtros-de-busqueda-en-la-vista-principal-de-agentes
This commit is contained in:
commit
5279bb3e17
@ -234,6 +234,21 @@ module_description Number of cron task files
|
|||||||
module_unit files
|
module_unit files
|
||||||
module_end
|
module_end
|
||||||
|
|
||||||
|
# This module /var/log/syslog file, under the module name "syslog"
|
||||||
|
# And search for "ssh" string into it, sending only that information.
|
||||||
|
module_begin
|
||||||
|
module_name Syslog
|
||||||
|
module_description Search for ssh string into /var/log/syslog file
|
||||||
|
module_type log
|
||||||
|
module_regexp /var/log/syslog
|
||||||
|
module_pattern ssh
|
||||||
|
module_end
|
||||||
|
|
||||||
|
#Hardening plugin for security compliance analysis. Enable to use it.
|
||||||
|
#module_begin
|
||||||
|
#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
|
||||||
|
#module_absoluteinterval 7d
|
||||||
|
#module_end
|
||||||
|
|
||||||
# Plugin example
|
# Plugin example
|
||||||
|
|
||||||
@ -241,11 +256,6 @@ module_end
|
|||||||
|
|
||||||
module_plugin pandora_df
|
module_plugin pandora_df
|
||||||
|
|
||||||
# This parses /var/log/syslog file, under the module name "syslog"
|
|
||||||
# And search for "ssh" string into it, sending only that information.
|
|
||||||
|
|
||||||
module_plugin grep_log /var/log/syslog Syslog ssh
|
|
||||||
|
|
||||||
# Get disk space free in MB
|
# Get disk space free in MB
|
||||||
#module_begin
|
#module_begin
|
||||||
#module_name disk_root_free
|
#module_name disk_root_free
|
||||||
@ -270,7 +280,6 @@ module_plugin grep_log /var/log/syslog Syslog ssh
|
|||||||
#module_end
|
#module_end
|
||||||
|
|
||||||
# Plugin for inventory on the agent.
|
# Plugin for inventory on the agent.
|
||||||
|
|
||||||
# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users process ip route
|
# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users process ip route
|
||||||
|
|
||||||
# Example of preconditions
|
# Example of preconditions
|
||||||
@ -304,3 +313,12 @@ module_plugin grep_log /var/log/syslog Syslog ssh
|
|||||||
# This plugin runs several security checks in a Linux system
|
# This plugin runs several security checks in a Linux system
|
||||||
|
|
||||||
#module_plugin pandora_security_check
|
#module_plugin pandora_security_check
|
||||||
|
|
||||||
|
# Extraction module example
|
||||||
|
#module_begin
|
||||||
|
#module_name Collector
|
||||||
|
#module_description Logs extraction module
|
||||||
|
#module_type log
|
||||||
|
#module_regexp /var/log/logfile.log
|
||||||
|
#module_pattern .*
|
||||||
|
#module_end
|
@ -147,22 +147,23 @@ module_max_critical 20
|
|||||||
module_end
|
module_end
|
||||||
|
|
||||||
# Log events
|
# Log events
|
||||||
|
|
||||||
|
# Get logs from System source.
|
||||||
module_begin
|
module_begin
|
||||||
module_name System Events (TermService)
|
module_name System Events (TermService)
|
||||||
module_type async_string
|
|
||||||
module_logevent
|
|
||||||
module_description Log Events coming from Terminal Service
|
module_description Log Events coming from Terminal Service
|
||||||
|
module_type log
|
||||||
|
module_logevent
|
||||||
module_source System
|
module_source System
|
||||||
module_application TermService
|
|
||||||
module_end
|
module_end
|
||||||
|
|
||||||
|
# Get logs from Security source.
|
||||||
module_begin
|
module_begin
|
||||||
module_name Security Events (Invalid Login)
|
module_name Security Events
|
||||||
module_type async_string
|
module_description Security log events
|
||||||
module_description Security log events for invalid login attempt
|
module_type log
|
||||||
module_logevent
|
module_logevent
|
||||||
module_source Security
|
module_source Security
|
||||||
module_eventcode 529
|
|
||||||
module_end
|
module_end
|
||||||
|
|
||||||
# Check if Dhcp service is enabled
|
# Check if Dhcp service is enabled
|
||||||
@ -219,6 +220,12 @@ module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs"
|
|||||||
# module_description Free space on drive D: (%)
|
# module_description Free space on drive D: (%)
|
||||||
# module_end
|
# module_end
|
||||||
|
|
||||||
|
# Hardening plugin for security compliance analysis.
|
||||||
|
# module_begin
|
||||||
|
# module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_hardening.exe -t 150"
|
||||||
|
# module_absoluteinterval 7d
|
||||||
|
# module_end
|
||||||
|
|
||||||
# Sample of Windows inventory module (ONLY ENTERPRISE)!
|
# Sample of Windows inventory module (ONLY ENTERPRISE)!
|
||||||
#module_begin
|
#module_begin
|
||||||
#module_name Inventory
|
#module_name Inventory
|
||||||
@ -345,3 +352,12 @@ module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs"
|
|||||||
#module_exec echo 5
|
#module_exec echo 5
|
||||||
#module_description Postcondition test module
|
#module_description Postcondition test module
|
||||||
#module_end
|
#module_end
|
||||||
|
|
||||||
|
# Example of collector module
|
||||||
|
#module_begin
|
||||||
|
#module_name Collector
|
||||||
|
#module_description Logs extraction module
|
||||||
|
#module_type log
|
||||||
|
#module_regexp /var/log/logfile.log
|
||||||
|
#module_pattern .*
|
||||||
|
#module_end
|
@ -2179,16 +2179,7 @@ sub configure ($) {
|
|||||||
|
|
||||||
#Launch tentacle server in proxy mode if configured
|
#Launch tentacle server in proxy mode if configured
|
||||||
if ($Conf{'proxy_mode'}) {
|
if ($Conf{'proxy_mode'}) {
|
||||||
|
return 1 if (launch_tentacle_proxy() != 0);
|
||||||
#Check if user is root
|
|
||||||
if ($> != 0) {
|
|
||||||
if (launch_tentacle_proxy() != 0) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
error ('Proxy mode can not be launched as root');
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add the plugins directory to the PATH
|
# Add the plugins directory to the PATH
|
||||||
|
@ -157,12 +157,32 @@ module_exec last | head -1
|
|||||||
module_description Last Login
|
module_description Last Login
|
||||||
module_end
|
module_end
|
||||||
|
|
||||||
# Plugin example
|
#Hardening plugin for security compliance analysis. Enable to use it.
|
||||||
|
#module_begin
|
||||||
|
#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
|
||||||
|
#module_absoluteinterval 7d
|
||||||
|
#module_end
|
||||||
|
|
||||||
# This parses /var/log/syslog file, under the module name "syslog"
|
# This module parses /var/log/syslog file, under the module name "syslog"
|
||||||
# And search for "ssh" string into it, sending only that information.
|
# And search for "ssh" string into it, sending only that information.
|
||||||
|
module_begin
|
||||||
|
module_name Syslog
|
||||||
|
module_description Search for ssh string into /var/log/syslog file
|
||||||
|
module_type log
|
||||||
|
module_regexp /var/log/syslog
|
||||||
|
module_pattern ssh
|
||||||
|
module_end
|
||||||
|
|
||||||
module_plugin grep_log /var/log/syslog Syslog ssh
|
# Plugin example
|
||||||
|
|
||||||
# Plugin for inventory on the agent.
|
# Plugin for inventory on the agent.
|
||||||
# module_plugin inventory 1 cpu ram video nic hd cdrom software
|
# module_plugin inventory 1 cpu ram video nic hd cdrom software
|
||||||
|
|
||||||
|
# Extraction module example
|
||||||
|
#module_begin
|
||||||
|
#module_name Collector
|
||||||
|
#module_description Logs extraction module
|
||||||
|
#module_type log
|
||||||
|
#module_regexp /var/log/logfile.log
|
||||||
|
#module_pattern .*
|
||||||
|
#module_end
|
@ -372,13 +372,32 @@ module_end
|
|||||||
#module_description XGrid
|
#module_description XGrid
|
||||||
#module_end
|
#module_end
|
||||||
|
|
||||||
|
#Hardening plugin for security compliance analysis. Enable to use it.
|
||||||
|
#module_begin
|
||||||
|
#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
|
||||||
|
#module_absoluteinterval 7d
|
||||||
|
#module_end
|
||||||
|
|
||||||
|
# This module parses /var/log/syslog file, under the module name "syslog"
|
||||||
|
# And search for "ssh" string into it, sending only that information.
|
||||||
|
module_begin
|
||||||
|
module_name Syslog
|
||||||
|
module_description Log collection modules
|
||||||
|
module_type log
|
||||||
|
module_regexp /var/log/syslog
|
||||||
|
module_pattern ssh
|
||||||
|
module_end
|
||||||
|
|
||||||
# Plugin example
|
# Plugin example
|
||||||
|
|
||||||
# This parses /var/log/syslog file, under the module name "syslog"
|
|
||||||
# And search for "ssh" string into it, sending only that information.
|
|
||||||
|
|
||||||
#module_plugin grep_log /var/log/syslog Syslog ssh
|
|
||||||
|
|
||||||
# Plugin for inventory on the agent.
|
# Plugin for inventory on the agent.
|
||||||
|
|
||||||
# module_plugin inventory 1 cpu ram video nic hd cdrom software
|
# module_plugin inventory 1 cpu ram video nic hd cdrom software
|
||||||
|
|
||||||
|
# Extraction module example
|
||||||
|
#module_begin
|
||||||
|
#module_name Collector
|
||||||
|
#module_description Logs extraction module
|
||||||
|
#module_type log
|
||||||
|
#module_regexp /var/log/logfile.log
|
||||||
|
#module_pattern .*
|
||||||
|
#module_end
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.774-231201
|
Version: 7.0NG.774-231213
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.774-231201"
|
pandora_version="7.0NG.774-231213"
|
||||||
|
|
||||||
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
|
||||||
|
@ -271,11 +271,17 @@ module_plugin pandora_netusage
|
|||||||
module_plugin autodiscover --default
|
module_plugin autodiscover --default
|
||||||
|
|
||||||
# Plugin for inventory on the agent.
|
# Plugin for inventory on the agent.
|
||||||
#module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route
|
# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route
|
||||||
|
|
||||||
# Log collection modules. This will collect log files for forensic analysis and store everything
|
# Log collection modules. This will collect log files for forensic analysis and store everything
|
||||||
# This is for LOG monitoring. Different than log monitoring.
|
# This is for LOG monitoring. Different than log monitoring.
|
||||||
#module_plugin grep_log_module /var/log/messages Syslog \.\*
|
module_begin
|
||||||
|
module_name Syslog
|
||||||
|
module_description Log collection modules
|
||||||
|
module_type log
|
||||||
|
module_regexp /var/log/messages
|
||||||
|
module_pattern .*
|
||||||
|
module_end
|
||||||
|
|
||||||
# Another samples of monitoring modules
|
# Another samples of monitoring modules
|
||||||
|
|
||||||
@ -317,9 +323,9 @@ module_plugin autodiscover --default
|
|||||||
#module_absoluteinterval 7d
|
#module_absoluteinterval 7d
|
||||||
#module_end
|
#module_end
|
||||||
|
|
||||||
# Logs extraction
|
# Extraction module example
|
||||||
#module_begin
|
#module_begin
|
||||||
#module_name Syslog
|
#module_name Collector
|
||||||
#module_description Logs extraction module
|
#module_description Logs extraction module
|
||||||
#module_type log
|
#module_type log
|
||||||
#module_regexp /var/log/logfile.log
|
#module_regexp /var/log/logfile.log
|
||||||
|
@ -1039,7 +1039,7 @@ my $Sem = undef;
|
|||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
use constant AGENT_VERSION => '7.0NG.774';
|
use constant AGENT_VERSION => '7.0NG.774';
|
||||||
use constant AGENT_BUILD => '231201';
|
use constant AGENT_BUILD => '231213';
|
||||||
|
|
||||||
# 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;
|
||||||
@ -4436,14 +4436,7 @@ my $PID = $$;
|
|||||||
|
|
||||||
#Launch tentacle server in proxy mode if configured
|
#Launch tentacle server in proxy mode if configured
|
||||||
if ($Conf{'proxy_mode'}) {
|
if ($Conf{'proxy_mode'}) {
|
||||||
|
launch_tentacle_proxy();
|
||||||
#Check if user is root
|
|
||||||
if ($> != 0) {
|
|
||||||
launch_tentacle_proxy();
|
|
||||||
} else {
|
|
||||||
log_message ('error', 'Proxy mode can not be launched as root');
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Advice if YAML::Tiny is allowed in this system
|
# Advice if YAML::Tiny is allowed in this system
|
||||||
|
@ -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.774
|
%define version 7.0NG.774
|
||||||
%define release 231201
|
%define release 231213
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
%define name pandorafms_agent_linux_bin
|
%define name pandorafms_agent_linux_bin
|
||||||
%define source_name pandorafms_agent_linux
|
%define source_name pandorafms_agent_linux
|
||||||
%define version 7.0NG.774
|
%define version 7.0NG.774
|
||||||
%define release 231201
|
%define release 231213
|
||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, binary version
|
Summary: Pandora FMS Linux agent, binary version
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
%define name pandorafms_agent_linux_bin
|
%define name pandorafms_agent_linux_bin
|
||||||
%define source_name pandorafms_agent_linux
|
%define source_name pandorafms_agent_linux
|
||||||
%define version 7.0NG.774
|
%define version 7.0NG.774
|
||||||
%define release 231201
|
%define release 231213
|
||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, binary version
|
Summary: Pandora FMS Linux agent, binary version
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
%define name pandorafms_agent_linux_bin
|
%define name pandorafms_agent_linux_bin
|
||||||
%define source_name pandorafms_agent_linux
|
%define source_name pandorafms_agent_linux
|
||||||
%define version 7.0NG.774
|
%define version 7.0NG.774
|
||||||
%define release 231201
|
%define release 231213
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, binary version
|
Summary: Pandora FMS Linux agent, binary version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -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.774
|
%define version 7.0NG.774
|
||||||
%define release 231201
|
%define release 231213
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.774"
|
PI_VERSION="7.0NG.774"
|
||||||
PI_BUILD="231201"
|
PI_BUILD="231213"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
@ -179,6 +179,22 @@ module_description Total number of TCP connections active
|
|||||||
module_group Networking
|
module_group Networking
|
||||||
module_end
|
module_end
|
||||||
|
|
||||||
|
# Get logs from System source.
|
||||||
|
module_begin
|
||||||
|
module_name Eventlog_System
|
||||||
|
module_type log
|
||||||
|
module_logevent
|
||||||
|
module_source System
|
||||||
|
module_end
|
||||||
|
|
||||||
|
# Get logs from Security source.
|
||||||
|
module_begin
|
||||||
|
module_name Eventlog_Security
|
||||||
|
module_type log
|
||||||
|
module_logevent
|
||||||
|
module_source Security
|
||||||
|
module_end
|
||||||
|
|
||||||
# Example plugin to retrieve drive usage
|
# Example plugin to retrieve drive usage
|
||||||
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs"
|
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs"
|
||||||
|
|
||||||
@ -273,22 +289,6 @@ module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default
|
|||||||
#module_type generic_data_string
|
#module_type generic_data_string
|
||||||
#module_end
|
#module_end
|
||||||
|
|
||||||
# Get logs from System source. Need enterprise version.
|
|
||||||
#module_begin
|
|
||||||
#module_name Eventlog_System
|
|
||||||
#module_type log
|
|
||||||
#module_logevent
|
|
||||||
#module_source System
|
|
||||||
#module_end
|
|
||||||
|
|
||||||
# Get logs from Security source. Need enterprise version.
|
|
||||||
#module_begin
|
|
||||||
#module_name Eventlog_Security
|
|
||||||
#module_type log
|
|
||||||
#module_logevent
|
|
||||||
#module_source Security
|
|
||||||
#module_end
|
|
||||||
|
|
||||||
# Get logs from Application source. Need enterprise version.
|
# Get logs from Application source. Need enterprise version.
|
||||||
#module_begin
|
#module_begin
|
||||||
#module_name Eventlog_Application
|
#module_name Eventlog_Application
|
||||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Version
|
Version
|
||||||
{231201}
|
{231213}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||||||
using namespace Pandora_Strutils;
|
using namespace Pandora_Strutils;
|
||||||
|
|
||||||
#define PATH_SIZE _MAX_PATH+1
|
#define PATH_SIZE _MAX_PATH+1
|
||||||
#define PANDORA_VERSION ("7.0NG.774 Build 231201")
|
#define PANDORA_VERSION ("7.0NG.774 Build 231213")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
@ -11,7 +11,7 @@ BEGIN
|
|||||||
VALUE "LegalCopyright", "Pandora FMS"
|
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.774(Build 231201))"
|
VALUE "ProductVersion", "(7.0NG.774(Build 231213))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.774-231201
|
Version: 7.0NG.774-231213
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.774-231201"
|
pandora_version="7.0NG.774-231213"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -183,7 +183,9 @@ if (isset($config['force_instant_logout']) === true
|
|||||||
$_SESSION = [];
|
$_SESSION = [];
|
||||||
session_destroy();
|
session_destroy();
|
||||||
header_remove('Set-Cookie');
|
header_remove('Set-Cookie');
|
||||||
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
if (isset($_COOKIE[session_name()]) === true) {
|
||||||
|
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
||||||
|
}
|
||||||
|
|
||||||
if ($config['auth'] === 'saml' && empty($public_hash) === true) {
|
if ($config['auth'] === 'saml' && empty($public_hash) === true) {
|
||||||
include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';
|
include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';
|
||||||
|
@ -34,11 +34,11 @@ if ((bool) $config['metaconsole']) {
|
|||||||
include_once $config['homedir'].'/include/functions_modules.php';
|
include_once $config['homedir'].'/include/functions_modules.php';
|
||||||
include_once $config['homedir'].'/include/functions_users.php';
|
include_once $config['homedir'].'/include/functions_users.php';
|
||||||
} else {
|
} else {
|
||||||
include_once '../include/config.php';
|
include_once __DIR__.'/../include/config.php';
|
||||||
include_once '../include/functions_agents.php';
|
include_once __DIR__.'/../include/functions_agents.php';
|
||||||
include_once '../include/functions_reporting.php';
|
include_once __DIR__.'/../include/functions_reporting.php';
|
||||||
include_once '../include/functions_modules.php';
|
include_once __DIR__.'/../include/functions_modules.php';
|
||||||
include_once '../include/functions_users.php';
|
include_once __DIR__.'/../include/functions_users.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ function view_logfile($file_name, $toggle=false)
|
|||||||
} else {
|
} else {
|
||||||
$file_size = filesize($file_name);
|
$file_size = filesize($file_name);
|
||||||
|
|
||||||
if ($memory_limit < $file_size) {
|
if ($memory_limit < $file_size && $memory_limit !== '-1') {
|
||||||
$code .= '<pre><h2>'.$file_name.' ('.__('File is too large than PHP memory allocated in the system.').')</h2>';
|
$code .= '<pre><h2>'.$file_name.' ('.__('File is too large than PHP memory allocated in the system.').')</h2>';
|
||||||
$code .= '<h2>'.__('The preview file is imposible.').'</h2>';
|
$code .= '<h2>'.__('The preview file is imposible.').'</h2>';
|
||||||
} else if ($file_size > ($config['max_log_size'] * 1000)) {
|
} else if ($file_size > ($config['max_log_size'] * 1000)) {
|
||||||
@ -117,6 +117,7 @@ function pandoralogs_extension_main()
|
|||||||
view_logfile($config['homedir'].'/log/console.log', true);
|
view_logfile($config['homedir'].'/log/console.log', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
view_logfile('/var/log/php-fpm/www-error.log', true);
|
||||||
view_logfile($logs_directory.'/pandora_server.log', true);
|
view_logfile($logs_directory.'/pandora_server.log', true);
|
||||||
view_logfile($logs_directory.'/pandora_server.error', true);
|
view_logfile($logs_directory.'/pandora_server.error', true);
|
||||||
|
|
||||||
|
@ -1720,3 +1720,4 @@ include/functions_integriaims.php
|
|||||||
include/ajax/integria_incidents.ajax.php
|
include/ajax/integria_incidents.ajax.php
|
||||||
enterprise/operation/log/log_source.php
|
enterprise/operation/log/log_source.php
|
||||||
enterprise/include/class/LogSource.class.php
|
enterprise/include/class/LogSource.class.php
|
||||||
|
include/chart_generator.php
|
@ -1,4 +1,4 @@
|
|||||||
pandorafms.vmware=9959cc3e5cc6bfcfadd6d05b56d4a11b
|
pandorafms.vmware=248788e0fb2cd4e11623e4a52ee7d05b
|
||||||
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
|
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
|
||||||
pandorafms.mssql=1cc215409741d19080269ffba112810e
|
pandorafms.mssql=1cc215409741d19080269ffba112810e
|
||||||
pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6
|
pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6
|
||||||
|
@ -3,25 +3,31 @@ START TRANSACTION;
|
|||||||
ALTER TABLE `tevento`
|
ALTER TABLE `tevento`
|
||||||
ADD COLUMN `event_custom_id` TEXT NULL AFTER `module_status`;
|
ADD COLUMN `event_custom_id` TEXT NULL AFTER `module_status`;
|
||||||
|
|
||||||
-- Telegram and vonage default alerts
|
SET @exist = (SELECT count(*) FROM information_schema.columns WHERE TABLE_NAME='tmetaconsole_agent' AND COLUMN_NAME='transactional_agent' AND table_schema = DATABASE());
|
||||||
UPDATE talert_actions
|
SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tmetaconsole_agent` DROP COLUMN `transactional_agent`', 'SELECT ""');
|
||||||
SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_'
|
prepare stmt from @sqlstmt;
|
||||||
WHERE id=9;
|
execute stmt;
|
||||||
UPDATE talert_actions
|
|
||||||
SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_'
|
SET @exist = (SELECT count(*) FROM information_schema.columns WHERE TABLE_NAME='tagente' AND COLUMN_NAME='transactional_agent' AND table_schema = DATABASE());
|
||||||
WHERE id=11;
|
SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tagente` DROP COLUMN `transactional_agent`', 'SELECT ""');
|
||||||
|
prepare stmt from @sqlstmt;
|
||||||
|
execute stmt;
|
||||||
|
|
||||||
|
ALTER TABLE `tdashboard`
|
||||||
|
ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`,
|
||||||
|
ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`,
|
||||||
|
ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`;
|
||||||
|
|
||||||
-- Delete table tagent_access
|
-- Delete table tagent_access
|
||||||
DROP TABLE tagent_access;
|
DROP TABLE IF EXISTS tagent_access;
|
||||||
|
|
||||||
ALTER TABLE `tevent_rule` DROP COLUMN `user_comment`;
|
ALTER TABLE `tevent_rule` DROP COLUMN `user_comment`;
|
||||||
ALTER TABLE `tevent_rule` DROP COLUMN `operator_user_comment`;
|
ALTER TABLE `tevent_rule` DROP COLUMN `operator_user_comment`;
|
||||||
|
|
||||||
ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL;
|
ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL;
|
||||||
|
|
||||||
ALTER TABLE `tevent_filter`
|
ALTER TABLE `tevent_filter` ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`;
|
||||||
ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`;
|
|
||||||
-- Update macros for plugin oracle
|
-- Update macros for plugin oracle
|
||||||
|
|
||||||
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle';
|
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle';
|
||||||
|
|
||||||
SET @id_app := (SELECT `id_app` FROM `tdiscovery_apps` WHERE `short_name` = 'pandorafms.oracle');
|
SET @id_app := (SELECT `id_app` FROM `tdiscovery_apps` WHERE `short_name` = 'pandorafms.oracle');
|
||||||
@ -35,11 +41,6 @@ UPDATE `trecon_task` SET `setup_complete` = 1 WHERE `id_app` = @id_app;
|
|||||||
-- Update lts updates
|
-- Update lts updates
|
||||||
UPDATE tconfig SET value='1' WHERE token='lts_updates';
|
UPDATE tconfig SET value='1' WHERE token='lts_updates';
|
||||||
|
|
||||||
ALTER TABLE `tdashboard`
|
|
||||||
ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`,
|
|
||||||
ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`,
|
|
||||||
ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`;
|
|
||||||
|
|
||||||
SELECT @generic_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_data";
|
SELECT @generic_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_data";
|
||||||
SELECT @generic_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_proc";
|
SELECT @generic_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_proc";
|
||||||
SELECT @async_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_data";
|
SELECT @async_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_data";
|
||||||
@ -47,4 +48,10 @@ SELECT @async_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_proc
|
|||||||
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_data WHERE `tagente_modulo`.`id_tipo_modulo` = @async_data;
|
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_data WHERE `tagente_modulo`.`id_tipo_modulo` = @async_data;
|
||||||
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_proc WHERE `tagente_modulo`.`id_tipo_modulo` = @async_proc;
|
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_proc WHERE `tagente_modulo`.`id_tipo_modulo` = @async_proc;
|
||||||
|
|
||||||
|
-- Telegram and vonage default alerts
|
||||||
|
UPDATE talert_actions SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' WHERE id=9;
|
||||||
|
UPDATE talert_actions SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' WHERE id=11;
|
||||||
|
|
||||||
|
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.vmware';
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -35,7 +35,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
$notifications_numbers['last_id']
|
$notifications_numbers['last_id']
|
||||||
).'</div>';
|
).'</div>';
|
||||||
$header_welcome = '';
|
$header_welcome = '';
|
||||||
if (check_acl($config['id_user'], $group, 'AW')) {
|
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||||
$header_welcome .= '<div id="welcome-icon-header">';
|
$header_welcome .= '<div id="welcome-icon-header">';
|
||||||
$header_welcome .= html_print_image(
|
$header_welcome .= html_print_image(
|
||||||
'images/wizard@svg.svg',
|
'images/wizard@svg.svg',
|
||||||
@ -455,19 +455,28 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
);
|
);
|
||||||
$header_logout .= '</a></div>';
|
$header_logout .= '</a></div>';
|
||||||
|
|
||||||
|
if (enterprise_installed()) {
|
||||||
|
$subtitle_header = $config['custom_subtitle_header'];
|
||||||
|
$class_header = '';
|
||||||
|
} else {
|
||||||
|
$subtitle_header = __('the Flexible Monitoring System (OpenSource version)');
|
||||||
|
echo '<div id="dialog_why_enterprise" class="invisible"></div>';
|
||||||
|
$class_header = 'underline-hover modal_module_list';
|
||||||
|
}
|
||||||
|
|
||||||
if (is_reporting_console_node() === true) {
|
if (is_reporting_console_node() === true) {
|
||||||
echo '<div class="header_left">';
|
echo '<div class="header_left '.$class_header.'">';
|
||||||
echo '<span class="header_title">';
|
echo '<span class="header_title">';
|
||||||
echo $config['custom_title_header'];
|
echo $config['custom_title_header'];
|
||||||
echo '</span>';
|
echo '</span>';
|
||||||
echo '<span class="header_subtitle">';
|
echo '<span class="header_subtitle">';
|
||||||
echo $config['custom_subtitle_header'];
|
echo $subtitle_header;
|
||||||
echo '</span>';
|
echo '</span>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div class="header_center"></div>';
|
echo '<div class="header_center"></div>';
|
||||||
echo '<div class="header_right">'.$modal_help, $header_user, $header_logout.'</div>';
|
echo '<div class="header_right">'.$modal_help, $header_user, $header_logout.'</div>';
|
||||||
} 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 '.$class_header.'"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$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, $header_welcome, $servers_list, $modal_help, $header_setup, $header_user, $header_logout.'</div>';
|
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $header_welcome, $servers_list, $modal_help, $header_setup, $header_user, $header_logout.'</div>';
|
||||||
}
|
}
|
||||||
@ -916,6 +925,46 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
|
|
||||||
|
<?php if (enterprise_installed() === false) { ?>
|
||||||
|
$('.header_left').on('click', function(){
|
||||||
|
// Hidden tips modal.
|
||||||
|
$(".window").css("display", "none");
|
||||||
|
jQuery.post(
|
||||||
|
"ajax.php",
|
||||||
|
{
|
||||||
|
page: "include/functions_menu",
|
||||||
|
'why_enterprise': "true"
|
||||||
|
},
|
||||||
|
function(data) {
|
||||||
|
if (data) {
|
||||||
|
$("#dialog_why_enterprise").html(data);
|
||||||
|
// Open dialog
|
||||||
|
$("#dialog_why_enterprise").dialog({
|
||||||
|
resizable: false,
|
||||||
|
draggable: false,
|
||||||
|
modal: true,
|
||||||
|
show: {
|
||||||
|
effect: "fade",
|
||||||
|
duration: 200
|
||||||
|
},
|
||||||
|
hide: {
|
||||||
|
effect: "fade",
|
||||||
|
duration: 200
|
||||||
|
},
|
||||||
|
closeOnEscape: true,
|
||||||
|
width: 700,
|
||||||
|
height: 450,
|
||||||
|
close: function(){
|
||||||
|
$('#dialog_why_enterprise').html('');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"html"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
// Check new notifications on a periodic way
|
// Check new notifications on a periodic way
|
||||||
setInterval(check_new_notifications, 60000);
|
setInterval(check_new_notifications, 60000);
|
||||||
|
|
||||||
|
@ -600,43 +600,176 @@ html_print_div(
|
|||||||
'content' => html_print_table($tableAgent, true).$CodeQRTable,
|
'content' => html_print_table($tableAgent, true).$CodeQRTable,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
/*
|
|
||||||
TODO REVIEW
|
|
||||||
$table_satellite = '';
|
|
||||||
if ($remote_agent === true) {
|
|
||||||
// Satellite server selector.
|
|
||||||
$satellite_servers = db_get_all_rows_filter(
|
|
||||||
'tserver',
|
|
||||||
['server_type' => SERVER_TYPE_ENTERPRISE_SATELLITE],
|
|
||||||
[
|
|
||||||
'id_server',
|
|
||||||
'name',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$satellite_names = [];
|
// Basic Options.
|
||||||
if (empty($satellite_servers) === false) {
|
$tableBasicAgent = new stdClass();
|
||||||
foreach ($satellite_servers as $s_server) {
|
$tableBasicAgent->class = 'filter-table-adv';
|
||||||
$satellite_names[$s_server['id_server']] = $s_server['name'];
|
$tableBasicAgent->data = [];
|
||||||
|
$disabledBasic = false;
|
||||||
|
$tableClassDisabled = '';
|
||||||
|
if ($new_agent === true || $remote_agent === false || $has_remote_conf === false) {
|
||||||
|
$disabledBasic = true;
|
||||||
|
$tableClassDisabled = ' basic-options-disabled';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enterprise_installed()) {
|
||||||
|
// Get all plugins (BASIC OPTIONS).
|
||||||
|
$agent_plugin = new PandoraFMS\Agent($id_agente);
|
||||||
|
$plugins = $agent_plugin->getPlugins();
|
||||||
|
// Check if some plugin was enabled/disabled in conf.
|
||||||
|
foreach ($plugins as $key => $row) {
|
||||||
|
if (preg_match('/pandora_hardening/', $row['raw']) === 1) {
|
||||||
|
if ($row['disabled'] === 1) {
|
||||||
|
$security_hardening = 0;
|
||||||
|
} else {
|
||||||
|
$security_hardening = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_satellite = '<div class="label_select"><p class="input_label">'.__('Satellite').'</p>';
|
if ($id_os === '1' || $id_os === '8') {
|
||||||
$table_satellite .= '<div class="label_select_parent">';
|
if (preg_match('/(module_plugin grep_log_module ).*/', $row['raw']) === 1) {
|
||||||
|
if ($row['disabled'] === 1) {
|
||||||
|
$enable_log_collector = 0;
|
||||||
|
} else {
|
||||||
|
$enable_log_collector = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$table_satellite .= html_print_input(
|
if (preg_match('/(module_plugin inventory).*/', $row['raw']) === 1) {
|
||||||
|
if ($row['disabled'] === 1) {
|
||||||
|
$enable_inventory = 0;
|
||||||
|
} else {
|
||||||
|
$enable_inventory = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (preg_match('/.vbs/', $row['raw']) === 1 && preg_match('/nettraffic.vbs/', $row['raw']) === 0 && preg_match('/software_installed.vbs/', $row['raw']) === 0 && preg_match('/df.vbs/', $row['raw']) === 0 && preg_match('/win_cf.vbs/', $row['raw']) === 0) {
|
||||||
|
if ($row['disabled'] === 1) {
|
||||||
|
$enable_inventory = 0;
|
||||||
|
} else {
|
||||||
|
$enable_inventory = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id_os === '9') {
|
||||||
|
$modules = $agent_plugin->getModules();
|
||||||
|
foreach ($modules as $key => $row) {
|
||||||
|
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) {
|
||||||
|
if ($row['disabled'] === 1) {
|
||||||
|
$enable_log_collector = 0;
|
||||||
|
} else {
|
||||||
|
$enable_log_collector = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($agent_plugin, $plugins);
|
||||||
|
if (($new_agent === true && $config['current_package'] >= 774) || ($agent_version >= 774 && $new_agent === false)) {
|
||||||
|
if ($disabledBasic === true || $has_remote_conf === false) {
|
||||||
|
$message = __('Remote config disabled, please activate to enable agent basic options');
|
||||||
|
$tableBasicAgent->data[] = '<span>'.$message.'</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$tableBasicAgent->data[] = html_print_label_input_block(
|
||||||
|
__('Enable security hardening monitoring'),
|
||||||
|
html_print_input(
|
||||||
[
|
[
|
||||||
'type' => 'select',
|
'type' => 'switch',
|
||||||
'fields' => $satellite_names,
|
'id' => 'security_hardening',
|
||||||
'name' => 'satellite_server',
|
'name' => 'security_hardening',
|
||||||
'selected' => $satellite_server,
|
'value' => $security_hardening,
|
||||||
'nothing' => __('None'),
|
'disabled' => $disabledBasic,
|
||||||
'nothinf_value' => 0,
|
|
||||||
'return' => true,
|
|
||||||
]
|
]
|
||||||
).'<div class="label_select_child_icons"></div></div></div>';
|
).html_print_input_hidden('options_package', '1', true)
|
||||||
|
);
|
||||||
|
|
||||||
|
$tableBasicAgent->data[] = html_print_label_input_block(
|
||||||
|
__('Enable log collection'),
|
||||||
|
html_print_input(
|
||||||
|
[
|
||||||
|
'type' => 'switch',
|
||||||
|
'id' => 'enable_log_collector',
|
||||||
|
'name' => 'enable_log_collector',
|
||||||
|
'value' => $enable_log_collector,
|
||||||
|
'disabled' => $disabledBasic,
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tableBasicAgent->data[] = html_print_label_input_block(
|
||||||
|
__('Enable inventory'),
|
||||||
|
html_print_input(
|
||||||
|
[
|
||||||
|
'type' => 'switch',
|
||||||
|
'id' => 'enable_inventory',
|
||||||
|
'name' => 'enable_inventory',
|
||||||
|
'value' => $enable_inventory,
|
||||||
|
'disabled' => $disabledBasic,
|
||||||
|
]
|
||||||
|
).html_print_input_hidden('enable_basic_options', '1', true)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($config['ehorus_enabled'] === '1') {
|
||||||
|
$pandoraRC_Id = html_print_image(
|
||||||
|
'images/alert_recovered@svg.svg',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'class' => 'invert_filter main_menu_icon',
|
||||||
|
'title' => __('Pandora RC connected with id ').$config['ehorus_custom_field'],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$pandoraRC_Id = html_print_image(
|
||||||
|
'images/alerts.svg',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'class' => 'invert_filter main_menu_icon',
|
||||||
|
'title' => __('This agent do not have a Pandora RC agent installed, install one.'),
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
$tableBasicAgent->data[] = html_print_label_input_block(
|
||||||
|
__('Enable remote control'),
|
||||||
|
$pandoraRC_Id
|
||||||
|
);
|
||||||
|
|
||||||
|
$WarningPackage = '';
|
||||||
|
if (($new_agent === true && $config['current_package'] < 774) || ($agent_version < 774 && $new_agent === false)) {
|
||||||
|
$WarningPackage = html_print_image(
|
||||||
|
'images/alert-yellow@svg.svg',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('Only available for agents 774 or higher'),
|
||||||
|
'alt' => __('Only available for agents 774 or higher'),
|
||||||
|
'class' => 'main_menu_icon mrgn_lft_5px',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$tableBasicAgent->data[] = '<span>'.__('Remote config is enabled only in the Enteprise version').'</span>';
|
||||||
|
$tableBasicAgent->data[] .= html_print_input_hidden(
|
||||||
|
'enable_basic_options',
|
||||||
|
'0',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_toggle(
|
||||||
|
html_print_table($tableBasicAgent, true),
|
||||||
|
'<span class="subsection_header_title">'.__('Basic options').$WarningPackage.'</span>',
|
||||||
|
'',
|
||||||
|
'basic_options',
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
'white_box_content',
|
||||||
|
'no-border white_table_graph'.$tableClassDisabled,
|
||||||
|
'box-flat white_table_graph invisible'
|
||||||
|
);
|
||||||
|
|
||||||
// Advanced options.
|
// Advanced options.
|
||||||
$tableAdvancedAgent = new stdClass();
|
$tableAdvancedAgent = new stdClass();
|
||||||
@ -1256,7 +1389,8 @@ ui_require_jquery_file('bgiframe');
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("#checkbox-cascade_protection").change(function () {
|
$("#checkbox-cascade_protection").change(function () {
|
||||||
var checked = $("#checkbox-cascade_protection").is(":checked"); if (checked) {
|
var checked = $("#checkbox-cascade_protection").is(":checked");
|
||||||
|
if (checked) {
|
||||||
$("#cascade_protection_module").removeAttr("disabled");
|
$("#cascade_protection_module").removeAttr("disabled");
|
||||||
$("#text-id_parent").attr("required", "required");
|
$("#text-id_parent").attr("required", "required");
|
||||||
}
|
}
|
||||||
@ -1311,5 +1445,17 @@ ui_require_jquery_file('bgiframe');
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
check_basic_options();
|
||||||
|
$('#id_os').on('change', function(){
|
||||||
|
check_basic_options();
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function check_basic_options(){
|
||||||
|
if ($('#id_os').val() == 1 || $('#id_os').val() == 8 || $('#id_os').val() == 9) {
|
||||||
|
$('#basic_options').removeClass('invisible');
|
||||||
|
} else {
|
||||||
|
$('#basic_options').addClass('invisible');
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -232,7 +232,7 @@ if ($create_agent) {
|
|||||||
$cps = (int) get_parameter_switch('cps', -1);
|
$cps = (int) get_parameter_switch('cps', -1);
|
||||||
$fixed_ip = (int) get_parameter_switch('fixed_ip', 0);
|
$fixed_ip = (int) get_parameter_switch('fixed_ip', 0);
|
||||||
$vul_scan_enabled = (int) get_parameter_switch('vul_scan_enabled', 2);
|
$vul_scan_enabled = (int) get_parameter_switch('vul_scan_enabled', 2);
|
||||||
|
$agent_version = $config['current_package'];
|
||||||
$secondary_groups = (array) get_parameter('secondary_groups_selected', '');
|
$secondary_groups = (array) get_parameter('secondary_groups_selected', '');
|
||||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||||
|
|
||||||
@ -300,6 +300,7 @@ if ($create_agent) {
|
|||||||
'cps' => $cps,
|
'cps' => $cps,
|
||||||
'fixed_ip' => $fixed_ip,
|
'fixed_ip' => $fixed_ip,
|
||||||
'vul_scan_enabled' => $vul_scan_enabled,
|
'vul_scan_enabled' => $vul_scan_enabled,
|
||||||
|
'agent_version' => $agent_version,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -1015,6 +1016,13 @@ if ($update_agent) {
|
|||||||
$satellite_server = (int) get_parameter('satellite_server', 0);
|
$satellite_server = (int) get_parameter('satellite_server', 0);
|
||||||
$fixed_ip = (int) get_parameter_switch('fixed_ip', 0);
|
$fixed_ip = (int) get_parameter_switch('fixed_ip', 0);
|
||||||
$vul_scan_enabled = (int) get_parameter_switch('vul_scan_enabled', 2);
|
$vul_scan_enabled = (int) get_parameter_switch('vul_scan_enabled', 2);
|
||||||
|
$security_vunerability = (int) get_parameter_switch('security_vunerability', 0);
|
||||||
|
$security_hardening = (int) get_parameter_switch('security_hardening', 0);
|
||||||
|
$security_monitoring = (int) get_parameter_switch('security_monitoring', 0);
|
||||||
|
$enable_log_collector = (int) get_parameter_switch('enable_log_collector', 0);
|
||||||
|
$enable_inventory = (int) get_parameter_switch('enable_inventory', 0);
|
||||||
|
$enable_basic_options = get_parameter('enable_basic_options');
|
||||||
|
$options_package = get_parameter('options_package', '0');
|
||||||
|
|
||||||
if ($fields === false) {
|
if ($fields === false) {
|
||||||
$fields = [];
|
$fields = [];
|
||||||
@ -1243,6 +1251,81 @@ if ($update_agent) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($enable_basic_options === '1') {
|
||||||
|
// Get all plugins (BASIC OPTIONS).
|
||||||
|
$agent = new PandoraFMS\Agent($id_agente);
|
||||||
|
$plugins = $agent->getPlugins();
|
||||||
|
foreach ($plugins as $key => $row) {
|
||||||
|
// Only check plugins when agent package is bigger than 774.
|
||||||
|
if ($options_package === '1') {
|
||||||
|
if (preg_match('/pandora_hardening/', $row['raw']) === 1) {
|
||||||
|
if ($security_hardening === 1) {
|
||||||
|
if ($row['disabled'] === 1) {
|
||||||
|
$agent->enablePlugins($row['raw']);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($row['disabled'] !== 1) {
|
||||||
|
$agent->disablePlugins($row['raw']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('/(module_plugin grep_log_module ).*/', $row['raw']) === 1) {
|
||||||
|
if ($enable_log_collector === 1) {
|
||||||
|
if ($row['disabled'] === 1) {
|
||||||
|
$agent->enablePlugins($row['raw']);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($row['disabled'] !== 1) {
|
||||||
|
$agent->disablePlugins($row['raw']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inventory switch enable when basic options are enabled.
|
||||||
|
if (preg_match('/(module_plugin inventory).*/', $row['raw']) === 1) {
|
||||||
|
if ($enable_inventory === 1) {
|
||||||
|
if ($row['disabled'] === 1) {
|
||||||
|
$agent->enablePlugins($row['raw']);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($row['disabled'] !== 1) {
|
||||||
|
$agent->disablePlugins($row['raw']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inventory switch enable when basic options are enabled.
|
||||||
|
if (preg_match('/.vbs/', $row['raw']) === 1 && preg_match('/nettraffic.vbs/', $row['raw']) === 0 && preg_match('/software_installed.vbs/', $row['raw']) === 0 && preg_match('/df.vbs/', $row['raw']) === 0 && preg_match('/win_cf.vbs/', $row['raw']) === 0) {
|
||||||
|
if ($enable_inventory === 1) {
|
||||||
|
if ($row['disabled'] === 1) {
|
||||||
|
$agent->enablePlugins($row['raw']);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($row['disabled'] !== 1) {
|
||||||
|
$agent->disablePlugins($row['raw']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modules = $agent->getModules();
|
||||||
|
foreach ($modules as $key => $row) {
|
||||||
|
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) {
|
||||||
|
if ($enable_log_collector === 1) {
|
||||||
|
if ($row['disabled'] === 1) {
|
||||||
|
$agent->enableModule($row['module_name'], $row);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($row['disabled'] !== 1) {
|
||||||
|
$agent->disableModule($row['module_name'], $row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read agent data
|
// Read agent data
|
||||||
@ -1300,6 +1383,19 @@ if ($id_agente) {
|
|||||||
$satellite_server = (int) $agent['satellite_server'];
|
$satellite_server = (int) $agent['satellite_server'];
|
||||||
$fixed_ip = (int) $agent['fixed_ip'];
|
$fixed_ip = (int) $agent['fixed_ip'];
|
||||||
$vul_scan_enabled = (int) $agent['vul_scan_enabled'];
|
$vul_scan_enabled = (int) $agent['vul_scan_enabled'];
|
||||||
|
if (strpos($agent['agent_version'], '(')) {
|
||||||
|
$agent_version = (int) explode('.', explode('(', $agent['agent_version'])[0])[2];
|
||||||
|
} else {
|
||||||
|
if (strpos($agent['agent_version'], 'build') || strpos($agent['agent_version'], 'Build')) {
|
||||||
|
$agent_version = (int) explode('.', explode('build', $agent['agent_version'])[0])[2];
|
||||||
|
} else {
|
||||||
|
if (strpos($agent['agent_version'], '.')) {
|
||||||
|
$agent_version = (int) explode('.', $agent['agent_version'])[2];
|
||||||
|
} else {
|
||||||
|
$agent_version = $agent['agent_version'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$update_module = (bool) get_parameter('update_module');
|
$update_module = (bool) get_parameter('update_module');
|
||||||
|
@ -566,10 +566,10 @@ if ($search != '') {
|
|||||||
if ($id != '') {
|
if ($id != '') {
|
||||||
$aux = $id[0]['id_agent'];
|
$aux = $id[0]['id_agent'];
|
||||||
$search_sql = sprintf(
|
$search_sql = sprintf(
|
||||||
' AND ( nombre LIKE "%%%s%%"
|
' AND ( REPLACE(nombre, " ", " ") LIKE "%%%s%%"
|
||||||
OR alias LIKE "%%%s%%"
|
OR REPLACE(alias, " ", " ") LIKE "%%%s%%"
|
||||||
OR comentarios LIKE "%%%s%%"
|
OR REPLACE(comentarios, " ", " ") LIKE "%%%s%%"
|
||||||
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%")
|
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND REPLACE(description, " ", " ") LIKE "%%%s%%")
|
||||||
OR tagente.id_agente = %d',
|
OR tagente.id_agente = %d',
|
||||||
$search,
|
$search,
|
||||||
$search,
|
$search,
|
||||||
@ -591,10 +591,10 @@ if ($search != '') {
|
|||||||
$search_sql .= ')';
|
$search_sql .= ')';
|
||||||
} else {
|
} else {
|
||||||
$search_sql = sprintf(
|
$search_sql = sprintf(
|
||||||
' AND ( nombre
|
' AND ( REPLACE(nombre, " ", " ")
|
||||||
LIKE "%%%s%%" OR alias
|
LIKE "%%%s%%" OR REPLACE(alias, " ", " ")
|
||||||
LIKE "%%%s%%" OR comentarios LIKE "%%%s%%"
|
LIKE "%%%s%%" OR REPLACE(comentarios, " ", " ") LIKE "%%%s%%"
|
||||||
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%"))',
|
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND REPLACE(description, " ", " ") LIKE "%%%s%%"))',
|
||||||
$search,
|
$search,
|
||||||
$search,
|
$search,
|
||||||
$search,
|
$search,
|
||||||
|
@ -575,7 +575,7 @@ $where = sprintf('delete_pending = 0 AND id_agente = %s', $id_agente);
|
|||||||
$search_string_entities = io_safe_input($search_string);
|
$search_string_entities = io_safe_input($search_string);
|
||||||
|
|
||||||
$basic_where = sprintf(
|
$basic_where = sprintf(
|
||||||
"(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND",
|
"(REPLACE(nombre, ' ', ' ') LIKE '%%%s%%' OR REPLACE(nombre, ' ', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, ' ', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, ' ', ' ') LIKE '%%%s%%') AND",
|
||||||
$search_string,
|
$search_string,
|
||||||
$search_string_entities,
|
$search_string_entities,
|
||||||
$search_string,
|
$search_string,
|
||||||
|
@ -171,7 +171,7 @@ foreach ($password_fields as $k => $p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
if ($("#id_plugin").val() === 0) {
|
if ($("#id_plugin").val() !== 0) {
|
||||||
changePluginSelect();
|
changePluginSelect();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -243,10 +243,15 @@ switch ($action) {
|
|||||||
$map_default_altitude = get_parameter('map_default_altitude');
|
$map_default_altitude = get_parameter('map_default_altitude');
|
||||||
$map_group_id = get_parameter('map_group_id');
|
$map_group_id = get_parameter('map_group_id');
|
||||||
$map_levels_zoom = get_parameter('map_levels_zoom', 16);
|
$map_levels_zoom = get_parameter('map_levels_zoom', 16);
|
||||||
|
|
||||||
$map_connection_list_temp = explode(',', get_parameter('map_connection_list'));
|
$map_connection_list_temp = explode(',', get_parameter('map_connection_list'));
|
||||||
|
$map_connection_list_temp_string = implode(',', $map_connection_list_temp);
|
||||||
|
if (strlen($map_connection_list_temp_string) > 0) {
|
||||||
|
$where_map_connection = ' WHERE id_tmap_connection IN('.$map_connection_list_temp_string.')';
|
||||||
|
} else {
|
||||||
|
$where_map_connection = '';
|
||||||
|
}
|
||||||
|
|
||||||
$listConnectionTemp = db_get_all_rows_sql('SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection');
|
$listConnectionTemp = db_get_all_rows_sql('SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection'.$where_map_connection);
|
||||||
|
|
||||||
foreach ($map_connection_list_temp as $index => $value) {
|
foreach ($map_connection_list_temp as $index => $value) {
|
||||||
$cleanValue = trim($value);
|
$cleanValue = trim($value);
|
||||||
@ -256,7 +261,6 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$map_connection_default = get_parameter('map_connection_default');
|
$map_connection_default = get_parameter('map_connection_default');
|
||||||
|
|
||||||
$map_connection_list = [];
|
$map_connection_list = [];
|
||||||
foreach ($listConnectionTemp as $idMapConnection) {
|
foreach ($listConnectionTemp as $idMapConnection) {
|
||||||
$default = 0;
|
$default = 0;
|
||||||
@ -485,7 +489,7 @@ foreach ($listConnectionTemp as $connectionTemp) {
|
|||||||
$table->data[1][0] = __('Add Map connection').$iconError;
|
$table->data[1][0] = __('Add Map connection').$iconError;
|
||||||
$table->data[1][1] = "<table class='no-class' border='0' id='map_connection'>
|
$table->data[1][1] = "<table class='no-class' border='0' id='map_connection'>
|
||||||
<tr>
|
<tr>
|
||||||
<td>".html_print_select($listConnection, 'map_connection_list', '', '', '', '0', true)."
|
<td>".html_print_select($listConnection, 'select-map_connection_list', '', '', '', '0', true)."
|
||||||
</td>
|
</td>
|
||||||
<td >
|
<td >
|
||||||
<a href='javascript: addConnectionMap();'>".html_print_image(
|
<a href='javascript: addConnectionMap();'>".html_print_image(
|
||||||
|
@ -111,7 +111,8 @@ if ($delete) {
|
|||||||
$alerts_agent_modules = [];
|
$alerts_agent_modules = [];
|
||||||
foreach ($agent_alerts['simple'] as $agent_alert) {
|
foreach ($agent_alerts['simple'] as $agent_alert) {
|
||||||
if ((in_array($agent_alert['id_alert_template'], $id_alert_templates)) && (in_array($agent_alert['id_agent_module'], $modules_id))) {
|
if ((in_array($agent_alert['id_alert_template'], $id_alert_templates)) && (in_array($agent_alert['id_agent_module'], $modules_id))) {
|
||||||
$alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module($agent_alert['id_agent_module'], true, false, 'id'));
|
// $alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module($agent_alert['id_agent_module'], true, false, 'id'));
|
||||||
|
$alerts_agent_modules[] = $agent_alert['id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +127,7 @@ if ($delete) {
|
|||||||
$agent_module_actions = [];
|
$agent_module_actions = [];
|
||||||
|
|
||||||
foreach ($alerts_agent_modules as $alert_agent_module) {
|
foreach ($alerts_agent_modules as $alert_agent_module) {
|
||||||
$agent_module_actions = alerts_get_alert_agent_module_actions($alert_agent_module['id'], ['id', 'id_alert_action']);
|
$agent_module_actions = alerts_get_alert_agent_module_actions($alert_agent_module, ['id', 'id_alert_action']);
|
||||||
|
|
||||||
foreach ($agent_module_actions as $agent_module_action) {
|
foreach ($agent_module_actions as $agent_module_action) {
|
||||||
foreach ($actions as $action) {
|
foreach ($actions as $action) {
|
||||||
|
@ -478,8 +478,8 @@ if ($access_console_node === true) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sub2['godmode/setup/setup§ion=ehorus']['text'] = __('Pandora RC');
|
$sub2['godmode/setup/setup§ion=pandorarc']['text'] = __('Pandora RC');
|
||||||
$sub2['godmode/setup/setup§ion=ehorus']['refr'] = 0;
|
$sub2['godmode/setup/setup§ion=pandorarc']['refr'] = 0;
|
||||||
|
|
||||||
$sub2['godmode/setup/setup§ion=ITSM']['text'] = __('ITSM');
|
$sub2['godmode/setup/setup§ion=ITSM']['text'] = __('ITSM');
|
||||||
$sub2['godmode/setup/setup§ion=ITSM']['refr'] = 0;
|
$sub2['godmode/setup/setup§ion=ITSM']['refr'] = 0;
|
||||||
@ -575,12 +575,13 @@ if ($access_console_node === true) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$extmenu = [];
|
||||||
if ($extension['godmode_menu']['name'] !== __('DB Schema check') && $extension['godmode_menu']['name'] !== __('DB interface')) {
|
if ($extension['godmode_menu']['name'] !== __('DB Schema check') && $extension['godmode_menu']['name'] !== __('DB interface')) {
|
||||||
$extmenu = $extension['godmode_menu'];
|
$extmenu = $extension['godmode_menu'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the ACL for this user.
|
// Check the ACL for this user.
|
||||||
if ((bool) check_acl($config['id_user'], 0, $extmenu['acl']) === false) {
|
if ((bool) check_acl($config['id_user'], 0, ($extmenu['acl'] ?? '')) === false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -732,7 +733,7 @@ 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.
|
// Need to be here because the translate string.
|
||||||
if (check_acl($config['id_user'], $group, 'AW')) {
|
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$("#conf_wizard").click(function() {
|
$("#conf_wizard").click(function() {
|
||||||
|
@ -729,7 +729,7 @@ if ($search_id_group) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($search_string != '') {
|
if ($search_string != '') {
|
||||||
$filter[] = '(name LIKE '."'%".$search_string."%'".'OR description LIKE '."'%".$search_string."%'".'OR tcp_send LIKE '."'%".$search_string."%'".'OR tcp_rcv LIKE '."'%".$search_string."%'".')';
|
$filter[] = '(REPLACE(name, " ", " ") LIKE '."'%".$search_string."%'".' OR REPLACE(REPLACE(description, " ", " "), " ", " ")LIKE '."'%".$search_string."%'".' OR REPLACE(tcp_send, " ", " ") LIKE '."'%".$search_string."%'".'OR REPLACE(tcp_rcv, " ", " ") LIKE '."'%".$search_string."%'".')';
|
||||||
}
|
}
|
||||||
|
|
||||||
$total_components = network_components_get_network_components(
|
$total_components = network_components_get_network_components(
|
||||||
|
@ -1642,7 +1642,7 @@ if (is_metaconsole() === true) {
|
|||||||
10,
|
10,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
@ -1676,7 +1676,7 @@ if (is_metaconsole() === true) {
|
|||||||
10,
|
10,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
@ -1730,7 +1730,7 @@ if (is_metaconsole() === true) {
|
|||||||
10,
|
10,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
@ -1755,7 +1755,7 @@ if (is_metaconsole() === true) {
|
|||||||
<td >
|
<td >
|
||||||
<?php
|
<?php
|
||||||
html_print_extended_select_for_time(
|
html_print_extended_select_for_time(
|
||||||
'period',
|
'period3',
|
||||||
(string) $period,
|
(string) $period,
|
||||||
'onselect=loadLogAgents();',
|
'onselect=loadLogAgents();',
|
||||||
'',
|
'',
|
||||||
@ -1793,7 +1793,7 @@ if (is_metaconsole() === true) {
|
|||||||
10,
|
10,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
@ -7030,7 +7030,7 @@ function loadLogAgents() {
|
|||||||
params["get_agent_source"] = 1;
|
params["get_agent_source"] = 1;
|
||||||
params["log_alert"] = 1;
|
params["log_alert"] = 1;
|
||||||
params["page"] = "enterprise/include/ajax/log_viewer.ajax";
|
params["page"] = "enterprise/include/ajax/log_viewer.ajax";
|
||||||
params["date"] = $('#period_select').val();
|
params["date"] = $('#period3_select').val();
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params,
|
data: params,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
@ -1643,7 +1643,7 @@ switch ($action) {
|
|||||||
$es['log_number'] = $log_number;
|
$es['log_number'] = $log_number;
|
||||||
|
|
||||||
$values['external_source'] = json_encode($es);
|
$values['external_source'] = json_encode($es);
|
||||||
$values['period'] = get_parameter('period');
|
$values['period'] = get_parameter('period3');
|
||||||
$good_format = true;
|
$good_format = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1661,7 +1661,7 @@ switch ($action) {
|
|||||||
$es['log_number'] = $log_number;
|
$es['log_number'] = $log_number;
|
||||||
|
|
||||||
$values['external_source'] = json_encode($es);
|
$values['external_source'] = json_encode($es);
|
||||||
$values['period'] = get_parameter('period');
|
$values['period'] = get_parameter('period3');
|
||||||
$values['period_range'] = get_parameter('period_range');
|
$values['period_range'] = get_parameter('period_range');
|
||||||
$values['show_graph'] = get_parameter('combo_graph_options');
|
$values['show_graph'] = get_parameter('combo_graph_options');
|
||||||
$values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent');
|
$values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent');
|
||||||
@ -2755,7 +2755,7 @@ switch ($action) {
|
|||||||
$es['log_number'] = $log_number;
|
$es['log_number'] = $log_number;
|
||||||
|
|
||||||
$values['external_source'] = json_encode($es);
|
$values['external_source'] = json_encode($es);
|
||||||
$values['period'] = get_parameter('period');
|
$values['period'] = get_parameter('period3');
|
||||||
$good_format = true;
|
$good_format = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2773,7 +2773,7 @@ switch ($action) {
|
|||||||
$es['log_number'] = $log_number;
|
$es['log_number'] = $log_number;
|
||||||
|
|
||||||
$values['external_source'] = json_encode($es);
|
$values['external_source'] = json_encode($es);
|
||||||
$values['period'] = get_parameter('period');
|
$values['period'] = get_parameter('period3');
|
||||||
$values['period_range'] = get_parameter('period_range');
|
$values['period_range'] = get_parameter('period_range');
|
||||||
$values['show_graph'] = get_parameter('combo_graph_options');
|
$values['show_graph'] = get_parameter('combo_graph_options');
|
||||||
$values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent');
|
$values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent');
|
||||||
|
@ -539,6 +539,7 @@ foreach ($layoutDatas as $layoutData) {
|
|||||||
$table->data[($i + 1)][5] .= html_print_checkbox('multiple_delete_items', $idLayoutData, false, true);
|
$table->data[($i + 1)][5] .= html_print_checkbox('multiple_delete_items', $idLayoutData, false, true);
|
||||||
$table->data[($i + 1)][5] .= '<a href="'.$url_delete.'"onclick="javascript: if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).'</a>';
|
$table->data[($i + 1)][5] .= '<a href="'.$url_delete.'"onclick="javascript: if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).'</a>';
|
||||||
$table->data[($i + 1)][5] .= html_print_input_hidden('updated_'.$idLayoutData, '0', true);
|
$table->data[($i + 1)][5] .= html_print_input_hidden('updated_'.$idLayoutData, '0', true);
|
||||||
|
$table->data[($i + 1)][5] .= html_print_input_hidden('rowtype_'.$idLayoutData, $layoutData['type'], true);
|
||||||
|
|
||||||
// Second row
|
// Second row
|
||||||
$table->data[($i + 2)]['icon'] = '';
|
$table->data[($i + 2)]['icon'] = '';
|
||||||
@ -789,14 +790,6 @@ if ($x > ini_get('max_input_vars')) {
|
|||||||
|
|
||||||
$pure = get_parameter('pure', 0);
|
$pure = get_parameter('pure', 0);
|
||||||
|
|
||||||
if (is_metaconsole() === false) {
|
|
||||||
echo '<form id="vc_elem_form" method="post" action="index.php?sec=network&sec2=godmode/reporting/visual_console_builder&tab='.$activeTab.'&id_visual_console='.$visualConsole['id'].'">';
|
|
||||||
html_print_input_hidden('action', 'update');
|
|
||||||
} else {
|
|
||||||
echo "<form id='vc_elem_form' method='post' action='index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure=0&tab=list_elements&id_visual_console=".$idVisualConsole."'>";
|
|
||||||
html_print_input_hidden('action2', 'update');
|
|
||||||
}
|
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
// Form for multiple delete.
|
// Form for multiple delete.
|
||||||
@ -806,15 +799,14 @@ if (is_metaconsole() === false) {
|
|||||||
$url_multiple_delete = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&tab='.$activeTab.'&id_visual_console='.$visualConsole['id'];
|
$url_multiple_delete = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&tab='.$activeTab.'&id_visual_console='.$visualConsole['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</form>';
|
|
||||||
|
|
||||||
$buttons = html_print_submit_button(
|
$buttons = html_print_submit_button(
|
||||||
__('Update'),
|
__('Update'),
|
||||||
'go',
|
'go',
|
||||||
false,
|
false,
|
||||||
[
|
[
|
||||||
'icon' => 'next',
|
'icon' => 'next',
|
||||||
'form' => 'vc_elem_form',
|
'form' => 'vc_elem_form',
|
||||||
|
'onclick' => 'submit_update_json()',
|
||||||
],
|
],
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@ -976,4 +968,76 @@ ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/');
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function submit_update_json() {
|
||||||
|
var array_update = [];
|
||||||
|
$('input[id^=hidden-updated_]').each(function(){
|
||||||
|
var id = $(this).attr('id').split('_')[1];
|
||||||
|
|
||||||
|
var label = $('#hidden-label_'+id).val();
|
||||||
|
var image = $('#image_'+id).val();
|
||||||
|
var width = $('#text-width_'+id).val();
|
||||||
|
var height = $('#text-height_'+id).val();
|
||||||
|
var pos_x = $('#text-left_'+id).val();
|
||||||
|
var pos_y = $('#text-top_'+id).val();
|
||||||
|
var parent = $('#parent_'+id).val();
|
||||||
|
var agent = $('#hidden-agent_'+id).val();
|
||||||
|
var module = $('#module_'+id).val();
|
||||||
|
var period = $('#hidden-period_'+id).val();
|
||||||
|
var map_linked = $('#map_linked_'+id).val();
|
||||||
|
var id_server = $('#id_server_id_'+id).val();
|
||||||
|
var rowtype = $('rowtype_'+id).val();
|
||||||
|
var custom_graph = $('#custom_graph_'+id).val();
|
||||||
|
|
||||||
|
array_update.push({
|
||||||
|
'id': id,
|
||||||
|
'label': label,
|
||||||
|
'image': image,
|
||||||
|
'width': width,
|
||||||
|
'height': height,
|
||||||
|
'pos_x': pos_x,
|
||||||
|
'pos_y': pos_y,
|
||||||
|
'parent': parent,
|
||||||
|
'agent': agent,
|
||||||
|
'module': module,
|
||||||
|
'period': period,
|
||||||
|
'map_linked': map_linked,
|
||||||
|
'rowtype': rowtype,
|
||||||
|
'custom_graph': custom_graph,
|
||||||
|
'id_server': id_server,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
var background_width = $('#text-width').val();
|
||||||
|
var background_height = $('#text-height').val();
|
||||||
|
|
||||||
|
if (background_height > 0 && background_width > 0){
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "ajax.php",
|
||||||
|
data: {
|
||||||
|
page: "godmode/reporting/visual_console_builder",
|
||||||
|
action: "update_json",
|
||||||
|
tab: "list_elements",
|
||||||
|
array_update: JSON.stringify(array_update),
|
||||||
|
id_visual_console: "<?php echo (is_metaconsole() === true) ? $idVisualConsole : $visualConsole['id']; ?>",
|
||||||
|
background: $('#background').val(),
|
||||||
|
background_width: $('#text-width').val(),
|
||||||
|
background_height: $('#text-height').val(),
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
complete: function (data) {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
confirmDialog({
|
||||||
|
title: "<?php echo __('Error.'); ?>",
|
||||||
|
message: "<?php echo __('The width and height property is required and should greater than 0'); ?>",
|
||||||
|
strOKButton: "<?php echo __('Close'); ?>",
|
||||||
|
hideCancelButton: true,
|
||||||
|
size: 300,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -78,6 +78,7 @@ $action = get_parameterBetweenListValues(
|
|||||||
'update',
|
'update',
|
||||||
'delete',
|
'delete',
|
||||||
'multiple_delete',
|
'multiple_delete',
|
||||||
|
'update_json',
|
||||||
],
|
],
|
||||||
'new'
|
'new'
|
||||||
);
|
);
|
||||||
@ -526,6 +527,110 @@ switch ($activeTab) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'update_json':
|
||||||
|
// Update background.
|
||||||
|
$background = get_parameter('background');
|
||||||
|
$width = get_parameter('background_width');
|
||||||
|
$height = get_parameter('background_height');
|
||||||
|
|
||||||
|
if ($width == 0 && $height == 0) {
|
||||||
|
$sizeBackground = getimagesize(
|
||||||
|
$config['homedir'].'/images/console/background/'.$background
|
||||||
|
);
|
||||||
|
$width = $sizeBackground[0];
|
||||||
|
$height = $sizeBackground[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
db_process_sql_update(
|
||||||
|
'tlayout',
|
||||||
|
[
|
||||||
|
'background' => $background,
|
||||||
|
'width' => $width,
|
||||||
|
'height' => $height,
|
||||||
|
],
|
||||||
|
['id' => $idVisualConsole]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Return the updated visual console.
|
||||||
|
$visualConsole = db_get_row_filter(
|
||||||
|
'tlayout',
|
||||||
|
['id' => $idVisualConsole]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Update elements in visual map.
|
||||||
|
$idsElements = db_get_all_rows_filter(
|
||||||
|
'tlayout_data',
|
||||||
|
['id_layout' => $idVisualConsole],
|
||||||
|
[
|
||||||
|
'id',
|
||||||
|
'type',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$array_update = json_decode(io_safe_output(get_parameter('array_update')), true);
|
||||||
|
|
||||||
|
if (count($array_update)) {
|
||||||
|
foreach ($array_update as $row) {
|
||||||
|
$id = $row['id'];
|
||||||
|
$values = [];
|
||||||
|
$values['label'] = $row['label'];
|
||||||
|
$values['image'] = $row['image'];
|
||||||
|
$values['width'] = $row['width'];
|
||||||
|
$values['height'] = $row['height'];
|
||||||
|
$values['pos_x'] = $row['pos_x'];
|
||||||
|
$values['pos_y'] = $row['pos_y'];
|
||||||
|
|
||||||
|
switch ($row['rowtype']) {
|
||||||
|
case NETWORK_LINK:
|
||||||
|
case LINE_ITEM:
|
||||||
|
continue 2;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SIMPLE_VALUE_MAX:
|
||||||
|
case SIMPLE_VALUE_MIN:
|
||||||
|
case SIMPLE_VALUE_AVG:
|
||||||
|
$values['period'] = $row['period'];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MODULE_GRAPH:
|
||||||
|
$values['period'] = $row['period'];
|
||||||
|
unset($values['image']);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GROUP_ITEM:
|
||||||
|
$values['id_group'] = $row['group'];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CIRCULAR_PROGRESS_BAR:
|
||||||
|
case CIRCULAR_INTERIOR_PROGRESS_BAR:
|
||||||
|
case PERCENTILE_BUBBLE:
|
||||||
|
case PERCENTILE_BAR:
|
||||||
|
unset($values['height']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined('METACONSOLE')) {
|
||||||
|
$values['id_metaconsole'] = $row['id_server'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$values['id_agent'] = $row['agent'];
|
||||||
|
$values['id_agente_modulo'] = $row['module'];
|
||||||
|
$values['id_custom_graph'] = $row['custom_graph'];
|
||||||
|
$values['parent_item'] = $row['parent'];
|
||||||
|
$values['id_layout_linked'] = $row['map_linked'];
|
||||||
|
|
||||||
|
if (enterprise_installed()) {
|
||||||
|
enterprise_visual_map_update_action_from_list_elements($row['rowtype'], $values, $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
db_process_sql_update('tlayout_data', $values, ['id' => $id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
$id_element = get_parameter('id_element');
|
$id_element = get_parameter('id_element');
|
||||||
$result = db_process_sql_delete('tlayout_data', ['id' => $id_element]);
|
$result = db_process_sql_delete('tlayout_data', ['id' => $id_element]);
|
||||||
|
@ -184,7 +184,7 @@ $buttons['ITSM'] = [
|
|||||||
|
|
||||||
$buttons['ehorus'] = [
|
$buttons['ehorus'] = [
|
||||||
'active' => false,
|
'active' => false,
|
||||||
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=ehorus').'">'.html_print_image(
|
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=pandorarc').'">'.html_print_image(
|
||||||
'images/RC.png',
|
'images/RC.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
@ -297,7 +297,7 @@ switch ($section) {
|
|||||||
$help_header = 'setup_flow_tab';
|
$help_header = 'setup_flow_tab';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'ehorus':
|
case 'pandorarc':
|
||||||
$buttons['ehorus']['active'] = true;
|
$buttons['ehorus']['active'] = true;
|
||||||
$subpage = __('Pandora RC');
|
$subpage = __('Pandora RC');
|
||||||
$help_header = 'setup_ehorus_tab';
|
$help_header = 'setup_ehorus_tab';
|
||||||
@ -442,7 +442,7 @@ switch ($section) {
|
|||||||
include_once $config['homedir'].'/godmode/setup/setup_visuals.php';
|
include_once $config['homedir'].'/godmode/setup/setup_visuals.php';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'ehorus':
|
case 'pandorarc':
|
||||||
include_once $config['homedir'].'/godmode/setup/setup_ehorus.php';
|
include_once $config['homedir'].'/godmode/setup/setup_ehorus.php';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1113,9 +1113,9 @@ $(document).ready (function () {
|
|||||||
id_imodule = $(value).attr('value');
|
id_imodule = $(value).attr('value');
|
||||||
$("select[name='inventory_changes_blacklist[]']")
|
$("select[name='inventory_changes_blacklist[]']")
|
||||||
.append(
|
.append(
|
||||||
$("<option></option>")
|
$("<option selected='selected'></option>")
|
||||||
.val(id_imodule)
|
.val(id_imodule)
|
||||||
.html('<i>' + imodule_name + '</i>')
|
.text(imodule_name)
|
||||||
);
|
);
|
||||||
$("#inventory_changes_blacklist_out")
|
$("#inventory_changes_blacklist_out")
|
||||||
.find("option[value='" + id_imodule + "']").remove();
|
.find("option[value='" + id_imodule + "']").remove();
|
||||||
@ -1141,7 +1141,7 @@ $(document).ready (function () {
|
|||||||
.append(
|
.append(
|
||||||
$("<option></option>")
|
$("<option></option>")
|
||||||
.val(id_imodule)
|
.val(id_imodule)
|
||||||
.html('<i>' + imodule_name + '</i>')
|
.text(imodule_name)
|
||||||
);
|
);
|
||||||
$("#inventory_changes_blacklist")
|
$("#inventory_changes_blacklist")
|
||||||
.find("option[value='" + id_imodule + "']").remove();
|
.find("option[value='" + id_imodule + "']").remove();
|
||||||
@ -1157,12 +1157,15 @@ $(document).ready (function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#inventory_changes_blacklist > option").each(function(key, value) {
|
||||||
|
$(value).prop('selected',true).trigger('change');
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#submit-update_button").click(function () {
|
$("#inventory_changes_blacklist > option").each(function(key, value) {
|
||||||
$('#inventory_changes_blacklist option').map(function(){
|
$(value).prop('selected',true).trigger('change');
|
||||||
$(this).prop('selected', true);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
BIN
pandora_console/images/widgets/service_level.png
Normal file
BIN
pandora_console/images/widgets/service_level.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
@ -652,30 +652,30 @@ if ($get_agent_alerts_datatable === true) {
|
|||||||
if (is_metaconsole() === true) {
|
if (is_metaconsole() === true) {
|
||||||
include_once $config['homedir'].'/enterprise/meta/include/functions_alerts_meta.php';
|
include_once $config['homedir'].'/enterprise/meta/include/functions_alerts_meta.php';
|
||||||
if ($idAgent !== 0) {
|
if ($idAgent !== 0) {
|
||||||
$alerts['alerts_simple'] = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter);
|
$alerts['alerts_simple'] = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter, $action_filter);
|
||||||
|
|
||||||
$countAlertsSimple = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter);
|
$countAlertsSimple = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter, $action_filter);
|
||||||
} else {
|
} else {
|
||||||
$id_groups = array_keys(
|
$id_groups = array_keys(
|
||||||
users_get_groups($config['id_user'], 'AR', false)
|
users_get_groups($config['id_user'], 'AR', false)
|
||||||
);
|
);
|
||||||
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, $search_sg);
|
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter, $action_filter, $search_sg);
|
||||||
|
|
||||||
$countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, $search_sg);
|
$countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter, $action_filter, $search_sg);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($idAgent !== 0) {
|
if ($idAgent !== 0) {
|
||||||
$alerts['alerts_simple'] = agents_get_alerts_simple($idAgent, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter);
|
$alerts['alerts_simple'] = agents_get_alerts_simple($idAgent, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter);
|
||||||
|
|
||||||
$countAlertsSimple = agents_get_alerts_simple($idAgent, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter);
|
$countAlertsSimple = agents_get_alerts_simple($idAgent, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter);
|
||||||
} else {
|
} else {
|
||||||
$id_groups = array_keys(
|
$id_groups = array_keys(
|
||||||
users_get_groups($config['id_user'], $access, false)
|
users_get_groups($config['id_user'], $access, false)
|
||||||
);
|
);
|
||||||
|
|
||||||
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, false, $search_sg);
|
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter, $action_filter, false, $search_sg);
|
||||||
|
|
||||||
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, false, $search_sg);
|
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter, $action_filter, false, $search_sg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -756,6 +756,7 @@ if (check_login()) {
|
|||||||
$access = ($agent_a === true) ? 'AR' : (($agent_w === true) ? 'AW' : 'AR');
|
$access = ($agent_a === true) ? 'AR' : (($agent_w === true) ? 'AW' : 'AR');
|
||||||
$id_agent = (int) get_parameter('id_agente');
|
$id_agent = (int) get_parameter('id_agente');
|
||||||
$id_agente = $id_agent;
|
$id_agente = $id_agent;
|
||||||
|
$id_grupo = agents_get_agent_group($id_agent);
|
||||||
$show_notinit = (bool) get_parameter('show_notinit');
|
$show_notinit = (bool) get_parameter('show_notinit');
|
||||||
$cluster_list = (int) get_parameter('cluster_list');
|
$cluster_list = (int) get_parameter('cluster_list');
|
||||||
$sortField = (string) get_parameter('sort_field');
|
$sortField = (string) get_parameter('sort_field');
|
||||||
|
@ -1,324 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Generate charts with given parameters.
|
|
||||||
*
|
|
||||||
* @category ChartGenerator.
|
|
||||||
* @package Pandora FMS
|
|
||||||
* @subpackage Opensource.
|
|
||||||
* @version 1.0.0
|
|
||||||
* @license See below
|
|
||||||
*
|
|
||||||
* ______ ___ _______ _______ ________
|
|
||||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
|
||||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
|
||||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
|
||||||
*
|
|
||||||
* ============================================================================
|
|
||||||
* Copyright (c) 2005-2023 Pandora FMS
|
|
||||||
* Please see https://pandorafms.com/community/ for full contribution list
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation for version 2.
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
* ============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Begin.
|
|
||||||
require_once __DIR__.'/config.php';
|
|
||||||
require_once __DIR__.'/functions.php';
|
|
||||||
require_once __DIR__.'/functions_db.php';
|
|
||||||
require_once __DIR__.'/auth/mysql.php';
|
|
||||||
require_once $config['homedir'].'/include/lib/User.php';
|
|
||||||
require_once $config['homedir'].'/include/functions_reporting.php';
|
|
||||||
require_once $config['homedir'].'/include/functions_graph.php';
|
|
||||||
require_once $config['homedir'].'/include/functions_custom_graphs.php';
|
|
||||||
require_once $config['homedir'].'/include/functions_modules.php';
|
|
||||||
require_once $config['homedir'].'/include/functions_agents.php';
|
|
||||||
require_once $config['homedir'].'/include/functions_tags.php';
|
|
||||||
|
|
||||||
$data_raw = get_parameter('data');
|
|
||||||
$data_decoded = json_decode(io_safe_output($data_raw), true);
|
|
||||||
if (json_last_error() === JSON_ERROR_NONE) {
|
|
||||||
$data = $data_decoded['data'];
|
|
||||||
$session_id = $data_decoded['session_id'];
|
|
||||||
$type_graph_pdf = $data_decoded['type_graph_pdf'];
|
|
||||||
$id_user = $data_decoded['id_user'];
|
|
||||||
$slicebar = $data_decoded['slicebar'];
|
|
||||||
$slicebar_value = $data_decoded['slicebar_value'];
|
|
||||||
|
|
||||||
$data_combined = [];
|
|
||||||
if (isset($data_decoded['data_combined']) === true) {
|
|
||||||
$data_combined = $data_decoded['data_combined'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$data_module_list = [];
|
|
||||||
if (isset($data_decoded['data_module_list']) === true) {
|
|
||||||
$data_module_list = $data_decoded['data_module_list'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize session.
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
// Care whit this!!! check_login not working if you remove this.
|
|
||||||
$config['id_user'] = $id_user;
|
|
||||||
$_SESSION['id_usuario'] = $id_user;
|
|
||||||
|
|
||||||
// Checks for server api req.
|
|
||||||
$bypassLogin = false;
|
|
||||||
if ($data_decoded['apipass'] !== null
|
|
||||||
&& ($config['server_unique_identifier'] === $_SESSION['id_usuario'])
|
|
||||||
) {
|
|
||||||
$apiPassword = io_output_password(
|
|
||||||
db_get_value_filter(
|
|
||||||
'value',
|
|
||||||
'tconfig',
|
|
||||||
['token' => 'api_password']
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
if ($apiPassword === $data_decoded['apipass']) {
|
|
||||||
$bypassLogin = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config[$slicebar])) {
|
|
||||||
$config[$slicebar] = $slicebar_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to initialize session using existing php session id.
|
|
||||||
$user = new PandoraFMS\User(['phpsessionid' => $session_id]);
|
|
||||||
|
|
||||||
if (check_login(false) === false && $bypassLogin !== true) {
|
|
||||||
// Error handler.
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
||||||
<title>Access denied</title>
|
|
||||||
<link rel="stylesheet" href="styles/pandora.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
|
||||||
<link rel="stylesheet" href="styles/pandora_minimal.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
|
||||||
<link rel="stylesheet" href="styles/js/jquery-ui.min.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
|
||||||
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
|
||||||
<script language="javascript" type='text/javascript' src='javascript/pandora.js?v=<?php echo $config['current_package']; ?>'></script>
|
|
||||||
<script language="javascript" type='text/javascript' src='javascript/pandora_ui.js?v=<?php echo $config['current_package']; ?>'></script>
|
|
||||||
<script language="javascript" type='text/javascript' src='javascript/jquery.current.js?v=<?php echo $config['current_package']; ?>'></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Access is not granted</h1>
|
|
||||||
<div id="container-chart-generator-item" style="display:none; margin:0px;width:100px;height:100px;">
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Access granted.
|
|
||||||
$params = $data;
|
|
||||||
if (isset($params['backgroundColor']) === false) {
|
|
||||||
$params['backgroundColor'] = 'inherit';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Metaconsole connection to the node.
|
|
||||||
$server_id = 0;
|
|
||||||
if (isset($params['server_id']) === true) {
|
|
||||||
$server_id = $params['server_id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_metaconsole() === true && empty($server_id) === false) {
|
|
||||||
$server = metaconsole_get_connection_by_id($server_id);
|
|
||||||
// Error connecting.
|
|
||||||
if (metaconsole_connect($server) !== NOERR) {
|
|
||||||
?>
|
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
ui_print_error_message(
|
|
||||||
__('There was a problem connecting with the node')
|
|
||||||
);
|
|
||||||
?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<?php
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$user_language = get_user_language($config['id_user']);
|
|
||||||
if (file_exists('languages/'.$user_language.'.mo') === true) {
|
|
||||||
$cfr = new CachedFileReader('languages/'.$user_language.'.mo');
|
|
||||||
$l10n = new gettext_reader($cfr);
|
|
||||||
$l10n->load_tables();
|
|
||||||
}
|
|
||||||
|
|
||||||
$hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
|
|
||||||
?>
|
|
||||||
<!DOCTYPE>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
||||||
<title>Pandora FMS Graph</title>
|
|
||||||
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/pandora.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
|
||||||
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/pandora_minimal.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
|
||||||
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/js/jquery-ui.min.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
|
||||||
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/js/jquery-ui_custom.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
|
|
||||||
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/pandora_ui.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
|
|
||||||
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/jquery.current.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
|
|
||||||
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/jquery.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/javascript/jquery-ui.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/javascript/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.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.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.time.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.pie.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.crosshair.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.stack.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.selection.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.resize.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.threshold.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.threshold.multiple.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.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/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>
|
|
||||||
</head>
|
|
||||||
<body style='width:794px; margin: 0px; background-color: <?php echo $params['backgroundColor']; ?>;'>
|
|
||||||
<?php
|
|
||||||
$params['only_image'] = false;
|
|
||||||
$params['menu'] = false;
|
|
||||||
|
|
||||||
$params['disable_black'] = true;
|
|
||||||
$params_combined = $data_combined;
|
|
||||||
$module_list = $data_module_list;
|
|
||||||
|
|
||||||
$viewport = [
|
|
||||||
'width' => 0,
|
|
||||||
'height' => 0,
|
|
||||||
];
|
|
||||||
|
|
||||||
$style = 'width:100%;';
|
|
||||||
if (isset($params['options']['viewport']) === true) {
|
|
||||||
$viewport = $params['options']['viewport'];
|
|
||||||
if (empty($viewport['width']) === false) {
|
|
||||||
$style .= 'width:'.$viewport['width'].'px;';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($viewport['height']) === false) {
|
|
||||||
$style .= 'height:'.$viewport['height'].'px;';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<div id="container-chart-generator-item" style="'.$style.' margin:0px;">';
|
|
||||||
switch ($type_graph_pdf) {
|
|
||||||
case 'combined':
|
|
||||||
$params['pdf'] = true;
|
|
||||||
$result = graphic_combined_module(
|
|
||||||
$module_list,
|
|
||||||
$params,
|
|
||||||
$params_combined
|
|
||||||
);
|
|
||||||
|
|
||||||
echo $result;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'sparse':
|
|
||||||
$params['pdf'] = true;
|
|
||||||
echo grafico_modulo_sparse($params);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'pie_graph':
|
|
||||||
$params['pdf'] = true;
|
|
||||||
$chart = get_build_setup_charts(
|
|
||||||
'PIE',
|
|
||||||
$params['options'],
|
|
||||||
$params['chart_data']
|
|
||||||
);
|
|
||||||
|
|
||||||
echo $chart->render(true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'vbar_graph':
|
|
||||||
$params['pdf'] = true;
|
|
||||||
$chart = get_build_setup_charts(
|
|
||||||
'BAR',
|
|
||||||
$params['options'],
|
|
||||||
$params['chart_data']
|
|
||||||
);
|
|
||||||
|
|
||||||
echo $chart->render(true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'ring_graph':
|
|
||||||
$params['pdf'] = true;
|
|
||||||
$params['options']['width'] = 500;
|
|
||||||
$params['options']['height'] = 500;
|
|
||||||
|
|
||||||
$chart = get_build_setup_charts(
|
|
||||||
'DOUGHNUT',
|
|
||||||
$params['options'],
|
|
||||||
$params['chart_data']
|
|
||||||
);
|
|
||||||
|
|
||||||
echo $chart->render(true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'line_graph':
|
|
||||||
$params['pdf'] = true;
|
|
||||||
$params['options']['width'] = '100%';
|
|
||||||
$params['options']['height'] = 200;
|
|
||||||
$chart = get_build_setup_charts(
|
|
||||||
'LINE',
|
|
||||||
$params['options'],
|
|
||||||
$params['chart_data']
|
|
||||||
);
|
|
||||||
echo $chart->render(true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'slicebar':
|
|
||||||
// TO-DO Cambiar esto para que se pase por POST, NO SE PUEDE PASAR POR GET.
|
|
||||||
$params['graph_data'] = json_decode(io_safe_output($config[$params['tokem_config']]), true);
|
|
||||||
delete_config_token($params['tokem_config']);
|
|
||||||
echo flot_slicesbar_graph(
|
|
||||||
$params['graph_data'],
|
|
||||||
$params['period'],
|
|
||||||
$params['width'],
|
|
||||||
$params['height'],
|
|
||||||
$params['legend'],
|
|
||||||
$params['colors'],
|
|
||||||
$params['fontpath'],
|
|
||||||
$params['round_corner'],
|
|
||||||
$params['homeurl'],
|
|
||||||
$params['watermark'],
|
|
||||||
$params['adapt_key'],
|
|
||||||
$params['stat_winalse'],
|
|
||||||
$params['id_agent'],
|
|
||||||
$params['full_legend_daterray'],
|
|
||||||
$params['not_interactive'],
|
|
||||||
$params['ttl'],
|
|
||||||
$params['sizeForTicks'],
|
|
||||||
$params['show'],
|
|
||||||
$params['date_to'],
|
|
||||||
$params['server_id']
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// Code...
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</div>';
|
|
||||||
?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -118,7 +118,7 @@ class ConfigPEN extends HTML
|
|||||||
if (is_array($filter)) {
|
if (is_array($filter)) {
|
||||||
if (!empty($filter['free_search'])) {
|
if (!empty($filter['free_search'])) {
|
||||||
$sql_filters[] = vsprintf(
|
$sql_filters[] = vsprintf(
|
||||||
' AND (lower(`manufacturer`) like lower("%%%s%%")
|
' AND (lower(REPLACE(manufacturer, " ", " ")) like lower("%%%s%%")
|
||||||
OR pen = "%s") ',
|
OR pen = "%s") ',
|
||||||
array_fill(0, 2, $filter['free_search'])
|
array_fill(0, 2, $filter['free_search'])
|
||||||
);
|
);
|
||||||
|
@ -701,6 +701,10 @@ class Diagnostics extends Wizard
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
// Get version comment DB.
|
||||||
|
$sql_version_comment = 'select @@version_comment as version_comment';
|
||||||
|
$version_comment = db_get_sql($sql_version_comment);
|
||||||
|
|
||||||
$result = [
|
$result = [
|
||||||
'error' => false,
|
'error' => false,
|
||||||
'data' => [
|
'data' => [
|
||||||
@ -716,6 +720,14 @@ class Diagnostics extends Wizard
|
|||||||
'name' => __('DB Schema Build'),
|
'name' => __('DB Schema Build'),
|
||||||
'value' => $config['db_scheme_build'],
|
'value' => $config['db_scheme_build'],
|
||||||
],
|
],
|
||||||
|
'dbVersion' => [
|
||||||
|
'name' => __('Engine version'),
|
||||||
|
'value' => $config['dbconnection']->server_info,
|
||||||
|
],
|
||||||
|
'dbVersionComment' => [
|
||||||
|
'name' => __('Version comment'),
|
||||||
|
'value' => $version_comment,
|
||||||
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -333,6 +333,7 @@ class TreeService extends Tree
|
|||||||
$services[$service['id']]['id'] = $service['id'];
|
$services[$service['id']]['id'] = $service['id'];
|
||||||
$services[$service['id']]['description'] = $service['description'];
|
$services[$service['id']]['description'] = $service['description'];
|
||||||
$services[$service['id']]['serviceDetail'] = 'index.php?sec=network&sec2=enterprise/operation/services/services&tab=service_map&id_service='.(int) $service['id'];
|
$services[$service['id']]['serviceDetail'] = 'index.php?sec=network&sec2=enterprise/operation/services/services&tab=service_map&id_service='.(int) $service['id'];
|
||||||
|
$services[$service['id']]['title'] = services_get_parents_title((int) $service['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $services;
|
return $services;
|
||||||
@ -627,6 +628,7 @@ class TreeService extends Tree
|
|||||||
$tmp['type'] = 'services';
|
$tmp['type'] = 'services';
|
||||||
$tmp['rootType'] = 'services';
|
$tmp['rootType'] = 'services';
|
||||||
$tmp['children'] = [];
|
$tmp['children'] = [];
|
||||||
|
$tmp['servicesChildren'] = services_get_services_children($item->service()->id());
|
||||||
$tmp['serviceDetail'] = ui_get_full_url(
|
$tmp['serviceDetail'] = ui_get_full_url(
|
||||||
'index.php?sec=network&sec2=enterprise/operation/services/services&tab=service_map&id_service='.$item->service()->id()
|
'index.php?sec=network&sec2=enterprise/operation/services/services&tab=service_map&id_service='.$item->service()->id()
|
||||||
);
|
);
|
||||||
@ -731,7 +733,10 @@ class TreeService extends Tree
|
|||||||
if (isset($this->filter['searchService']) === true
|
if (isset($this->filter['searchService']) === true
|
||||||
&& empty($this->filter['searchService']) === false
|
&& empty($this->filter['searchService']) === false
|
||||||
) {
|
) {
|
||||||
return " AND (ts.name LIKE '%".$this->filter['searchService']."%' OR ts.description LIKE '%".$this->filter['searchService']."%')";
|
$whereAncestors = ' AND ts.name LIKE "%'.$this->filter['searchService'].'%"
|
||||||
|
OR ts.description LIKE "%'.$this->filter['searchService'].'%"';
|
||||||
|
|
||||||
|
return $whereAncestors;
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
@ -606,7 +606,7 @@ class WelcomeWindow extends Wizard
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'label' => __("Let's do it!"),
|
'label' => __('Let's do it!'),
|
||||||
'type' => 'button',
|
'type' => 'button',
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
'class' => 'secondary',
|
'class' => 'secondary',
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
* Pandora build version and version
|
* Pandora build version and version
|
||||||
*/
|
*/
|
||||||
$build_version = 'PC231201';
|
$build_version = 'PC231213';
|
||||||
$pandora_version = 'v7.0NG.774';
|
$pandora_version = 'v7.0NG.774';
|
||||||
|
|
||||||
// Do not overwrite default timezone set if defined.
|
// Do not overwrite default timezone set if defined.
|
||||||
|
@ -306,32 +306,48 @@ function format_for_graph(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function human_milliseconds_to_string($seconds)
|
function human_milliseconds_to_string($seconds, $size_text='large')
|
||||||
{
|
{
|
||||||
$ret = '';
|
$ret = '';
|
||||||
|
|
||||||
// get the days
|
// get the days
|
||||||
$days = intval(intval($seconds) / (360000 * 24));
|
$days = intval(intval($seconds) / (360000 * 24));
|
||||||
if ($days > 0) {
|
if ($days > 0) {
|
||||||
$ret .= "$days days ";
|
if ($size_text === 'short') {
|
||||||
|
$ret .= str_replace(' ', '', "$days d").' ';
|
||||||
|
} else {
|
||||||
|
$ret .= "$days days ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the hours
|
// get the hours
|
||||||
$hours = ((intval($seconds) / 360000) % 24);
|
$hours = ((intval($seconds) / 360000) % 24);
|
||||||
if ($hours > 0) {
|
if ($hours > 0) {
|
||||||
$ret .= "$hours hours ";
|
if ($size_text === 'short') {
|
||||||
|
$ret .= str_replace(' ', '', "$hours h").' ';
|
||||||
|
} else {
|
||||||
|
$ret .= "$hours hours ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the minutes
|
// get the minutes
|
||||||
$minutes = ((intval($seconds) / 6000) % 60);
|
$minutes = ((intval($seconds) / 6000) % 60);
|
||||||
if ($minutes > 0) {
|
if ($minutes > 0) {
|
||||||
$ret .= "$minutes minutes ";
|
if ($size_text === 'short') {
|
||||||
|
$ret .= str_replace(' ', '', "$minutes m").' ';
|
||||||
|
} else {
|
||||||
|
$ret .= "$minutes minutes ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the seconds
|
// get the seconds
|
||||||
$seconds = ((intval($seconds) / 100) % 60);
|
$seconds = ((intval($seconds) / 100) % 60);
|
||||||
if ($seconds > 0) {
|
if ($seconds > 0) {
|
||||||
$ret .= "$seconds seconds";
|
if ($size_text === 'short') {
|
||||||
|
$ret .= str_replace(' ', '', "$seconds s").' ';
|
||||||
|
} else {
|
||||||
|
$ret .= "$seconds seconds ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
@ -4374,48 +4390,22 @@ function generator_chart_to_pdf(
|
|||||||
$module_list=false
|
$module_list=false
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
$hack_metaconsole = '';
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole() === true) {
|
||||||
$hack_metaconsole = '../..';
|
$hack_metaconsole = '../..';
|
||||||
} else {
|
|
||||||
$hack_metaconsole = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = ui_get_full_url(false).$hack_metaconsole.'/include/chart_generator.php';
|
|
||||||
|
|
||||||
if (!$params['return_img_base_64']) {
|
if (!$params['return_img_base_64']) {
|
||||||
$img_file = 'img_'.uniqid().'.png';
|
$img_file = 'img_'.uniqid().'.png';
|
||||||
$img_path = $config['homedir'].'/attachment/'.$img_file;
|
$img_path = $config['homedir'].'/attachment/'.$img_file;
|
||||||
$img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file;
|
$img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
$session_id = session_id();
|
if ($type_graph_pdf !== 'combined') {
|
||||||
if ($type_graph_pdf === 'combined') {
|
$params_combined = [];
|
||||||
$data = [
|
$module_list = [];
|
||||||
'data' => $params,
|
|
||||||
'session_id' => $session_id,
|
|
||||||
'type_graph_pdf' => $type_graph_pdf,
|
|
||||||
'data_module_list' => $module_list,
|
|
||||||
'data_combined' => $params_combined,
|
|
||||||
'id_user' => $config['id_user'],
|
|
||||||
'slicebar' => $_SESSION['slicebar'],
|
|
||||||
'slicebar_value' => $config[$_SESSION['slicebar']],
|
|
||||||
'apipass' => get_parameter('apipass', null),
|
|
||||||
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
$data = [
|
|
||||||
'data' => $params,
|
|
||||||
'session_id' => $session_id,
|
|
||||||
'type_graph_pdf' => $type_graph_pdf,
|
|
||||||
'id_user' => $config['id_user'],
|
|
||||||
'slicebar' => $_SESSION['slicebar'],
|
|
||||||
'slicebar_value' => $config[$_SESSION['slicebar']],
|
|
||||||
'apipass' => get_parameter('apipass', null),
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($data['data']['graph_data']);
|
|
||||||
// If not install chromium avoid 500 convert tu images no data to show.
|
// If not install chromium avoid 500 convert tu images no data to show.
|
||||||
$chromium_dir = io_safe_output($config['chromium_path']);
|
$chromium_dir = io_safe_output($config['chromium_path']);
|
||||||
$result_ejecution = exec($chromium_dir.' --version');
|
$result_ejecution = exec($chromium_dir.' --version');
|
||||||
@ -4435,22 +4425,16 @@ function generator_chart_to_pdf(
|
|||||||
|
|
||||||
// Creates a new page.
|
// Creates a new page.
|
||||||
$page = $browser->createPage();
|
$page = $browser->createPage();
|
||||||
$curl = curl_init();
|
|
||||||
|
|
||||||
curl_setopt($curl, CURLOPT_URL, $url);
|
// Generate Html.
|
||||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
$html = chart_generator(
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, ['data' => json_encode($data)]);
|
$type_graph_pdf,
|
||||||
|
$params,
|
||||||
|
$params_combined,
|
||||||
|
$module_list
|
||||||
|
);
|
||||||
|
|
||||||
$response = curl_exec($curl);
|
$page->setHtml($html);
|
||||||
|
|
||||||
curl_close($curl);
|
|
||||||
|
|
||||||
$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();
|
||||||
@ -4497,6 +4481,211 @@ function generator_chart_to_pdf(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Html print chart for chromium
|
||||||
|
*
|
||||||
|
* @param string $type_graph_pdf Chart mode.
|
||||||
|
* @param array $params Params.
|
||||||
|
* @param array $params_combined Params Combined charts.
|
||||||
|
* @param array $module_list Module list Combined charts.
|
||||||
|
*
|
||||||
|
* @return string Output Html.
|
||||||
|
*/
|
||||||
|
function chart_generator(
|
||||||
|
string $type_graph_pdf,
|
||||||
|
array $params,
|
||||||
|
array $params_combined=[],
|
||||||
|
array $module_list=[]
|
||||||
|
) : string {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
include_once $config['homedir'].'/include/graphs/functions_d3.php';
|
||||||
|
|
||||||
|
if (isset($params['backgroundColor']) === false) {
|
||||||
|
$params['backgroundColor'] = 'inherit';
|
||||||
|
}
|
||||||
|
|
||||||
|
$hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
|
||||||
|
|
||||||
|
$output = '<!DOCTYPE>';
|
||||||
|
$output .= '<html>';
|
||||||
|
$output .= '<head>';
|
||||||
|
$output .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
|
||||||
|
$output .= '<title>Pandora FMS Graph</title>';
|
||||||
|
$output .= '<script type="text/javascript">';
|
||||||
|
$output .= 'var phpTimezone = "'.date_default_timezone_get().'";';
|
||||||
|
$output .= 'var configHomeurl = "'.((is_metaconsole() === false) ? $config['homeurl'] : '../../').'";';
|
||||||
|
$output .= '</script>';
|
||||||
|
|
||||||
|
$css_files = [
|
||||||
|
'pandora' => 'include/styles/',
|
||||||
|
'pandora_minimal' => 'include/styles/',
|
||||||
|
'jquery-ui.min' => 'include/styles/js/',
|
||||||
|
'jquery-ui_custom' => 'include/styles/js/',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($css_files as $name => $path) {
|
||||||
|
$output .= ui_require_css_file($name, $path, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$js_files = [
|
||||||
|
'pandora_ui' => 'include/javascript/',
|
||||||
|
'jquery.current' => 'include/javascript/',
|
||||||
|
'jquery.pandora' => 'include/javascript/',
|
||||||
|
'jquery-ui.min' => 'include/javascript/',
|
||||||
|
'date' => 'include/javascript/timezone/src/',
|
||||||
|
'pandora' => 'include/javascript/',
|
||||||
|
'jquery.flot' => 'include/graphs/flot/',
|
||||||
|
'jquery.flot.min' => 'include/graphs/flot/',
|
||||||
|
'jquery.flot.time' => 'include/graphs/flot/',
|
||||||
|
'jquery.flot.pie' => 'include/graphs/flot/',
|
||||||
|
'jquery.flot.crosshair.min' => 'include/graphs/flot/',
|
||||||
|
'jquery.flot.stack.min' => 'include/graphs/flot/',
|
||||||
|
'jquery.flot.selection.min' => 'include/graphs/flot/',
|
||||||
|
'jquery.flot.resize.min' => 'include/graphs/flot/',
|
||||||
|
'jquery.flot.threshold' => 'include/graphs/flot/',
|
||||||
|
'jquery.flot.threshold.multiple' => 'include/graphs/flot/',
|
||||||
|
'jquery.flot.symbol.min' => 'include/graphs/flot/',
|
||||||
|
'jquery.flot.exportdata.pandora' => 'include/graphs/flot/',
|
||||||
|
'jquery.flot.axislabels' => 'include/graphs/flot/',
|
||||||
|
'pandora.flot' => 'include/graphs/flot/',
|
||||||
|
'chart' => 'include/graphs/chartjs/',
|
||||||
|
'chartjs-plugin-datalabels.min' => 'include/graphs/chartjs/',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($js_files as $name => $path) {
|
||||||
|
$output .= ui_require_javascript_file($name, $path, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$output .= include_javascript_d3(true, true);
|
||||||
|
|
||||||
|
$output .= '</head>';
|
||||||
|
$output .= '<body style="width:794px; margin: 0px; background-color:'.$params['backgroundColor'].';">';
|
||||||
|
$params['only_image'] = false;
|
||||||
|
$params['menu'] = false;
|
||||||
|
$params['disable_black'] = true;
|
||||||
|
|
||||||
|
$viewport = [
|
||||||
|
'width' => 0,
|
||||||
|
'height' => 0,
|
||||||
|
];
|
||||||
|
|
||||||
|
$style = 'width:100%;';
|
||||||
|
if (isset($params['options']['viewport']) === true) {
|
||||||
|
$viewport = $params['options']['viewport'];
|
||||||
|
if (empty($viewport['width']) === false) {
|
||||||
|
$style .= 'width:'.$viewport['width'].'px;';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($viewport['height']) === false) {
|
||||||
|
$style .= 'height:'.$viewport['height'].'px;';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$output .= '<div id="container-chart-generator-item" style="'.$style.' margin:0px;">';
|
||||||
|
switch ($type_graph_pdf) {
|
||||||
|
case 'combined':
|
||||||
|
$params['pdf'] = true;
|
||||||
|
$result = graphic_combined_module(
|
||||||
|
$module_list,
|
||||||
|
$params,
|
||||||
|
$params_combined
|
||||||
|
);
|
||||||
|
|
||||||
|
$output .= $result;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'sparse':
|
||||||
|
$params['pdf'] = true;
|
||||||
|
$output .= grafico_modulo_sparse($params);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'pie_graph':
|
||||||
|
$params['pdf'] = true;
|
||||||
|
$chart = get_build_setup_charts(
|
||||||
|
'PIE',
|
||||||
|
$params['options'],
|
||||||
|
$params['chart_data']
|
||||||
|
);
|
||||||
|
|
||||||
|
$output .= $chart->render(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'vbar_graph':
|
||||||
|
$params['pdf'] = true;
|
||||||
|
$chart = get_build_setup_charts(
|
||||||
|
'BAR',
|
||||||
|
$params['options'],
|
||||||
|
$params['chart_data']
|
||||||
|
);
|
||||||
|
|
||||||
|
$output .= $chart->render(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'ring_graph':
|
||||||
|
$params['pdf'] = true;
|
||||||
|
$params['options']['width'] = 500;
|
||||||
|
$params['options']['height'] = 500;
|
||||||
|
|
||||||
|
$chart = get_build_setup_charts(
|
||||||
|
'DOUGHNUT',
|
||||||
|
$params['options'],
|
||||||
|
$params['chart_data']
|
||||||
|
);
|
||||||
|
|
||||||
|
$output .= $chart->render(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'line_graph':
|
||||||
|
$params['pdf'] = true;
|
||||||
|
$params['options']['width'] = '100%';
|
||||||
|
$params['options']['height'] = 200;
|
||||||
|
$chart = get_build_setup_charts(
|
||||||
|
'LINE',
|
||||||
|
$params['options'],
|
||||||
|
$params['chart_data']
|
||||||
|
);
|
||||||
|
$output .= $chart->render(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'slicebar':
|
||||||
|
$output .= flot_slicesbar_graph(
|
||||||
|
$params['graph_data'],
|
||||||
|
$params['period'],
|
||||||
|
$params['width'],
|
||||||
|
$params['height'],
|
||||||
|
$params['legend'],
|
||||||
|
$params['colors'],
|
||||||
|
$params['fontpath'],
|
||||||
|
$params['round_corner'],
|
||||||
|
$params['homeurl'],
|
||||||
|
$params['watermark'],
|
||||||
|
$params['adapt_key'],
|
||||||
|
$params['stat_winalse'],
|
||||||
|
$params['id_agent'],
|
||||||
|
$params['full_legend_daterray'],
|
||||||
|
$params['not_interactive'],
|
||||||
|
$params['ttl'],
|
||||||
|
$params['sizeForTicks'],
|
||||||
|
$params['show'],
|
||||||
|
$params['date_to'],
|
||||||
|
$params['server_id']
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Code...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output .= '</div>';
|
||||||
|
$output .= '</body>';
|
||||||
|
$output .= '</html>';
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the product name.
|
* Get the product name.
|
||||||
*
|
*
|
||||||
|
@ -10301,8 +10301,7 @@ function api_set_module_data($id, $thrash2, $other, $trash1)
|
|||||||
modules_get_type_name($agentModule['id_tipo_modulo']),
|
modules_get_type_name($agentModule['id_tipo_modulo']),
|
||||||
$data
|
$data
|
||||||
);
|
);
|
||||||
|
if (false === @file_put_contents($config['remote_config'].'/'.io_safe_output($agent['nombre']).'.'.$idAgentModule.'.'.$time.'.data', $xml)) {
|
||||||
if (false === @file_put_contents($config['remote_config'].'/'.io_safe_output($agent['nombre']).'.'.$time.'.data', $xml)) {
|
|
||||||
returnError(sprintf('XML file could not be generated in path: %s', $config['remote_config']));
|
returnError(sprintf('XML file could not be generated in path: %s', $config['remote_config']));
|
||||||
} else {
|
} else {
|
||||||
echo __('XML file was generated successfully in path: ').$config['remote_config'];
|
echo __('XML file was generated successfully in path: ').$config['remote_config'];
|
||||||
|
@ -459,17 +459,17 @@ function cron_task_start_gotty(bool $restart_mode=true)
|
|||||||
|
|
||||||
// Check prev process running and kill it (only if port changed in setup params).
|
// Check prev process running and kill it (only if port changed in setup params).
|
||||||
if (empty($config['restart_gotty_next_cron_port']) === false) {
|
if (empty($config['restart_gotty_next_cron_port']) === false) {
|
||||||
config_update_value('restart_gotty_next_cron_port', '');
|
$prevProcessRunning = shell_exec("pgrep -af 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."' | grep -v 'pgrep'");
|
||||||
|
|
||||||
$prevProcessRunning = shell_exec("pgrep -f 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."'");
|
|
||||||
|
|
||||||
if (empty($prevProcessRunning) === false) {
|
if (empty($prevProcessRunning) === false) {
|
||||||
shell_exec("pkill -f 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."'");
|
shell_exec("pkill -f 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config_update_value('restart_gotty_next_cron_port', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if gotty is running on the configured port.
|
// Check if gotty is running on the configured port.
|
||||||
$processRunning = shell_exec("pgrep -f 'pandora_gotty.*-p ".$config['gotty_port']."'");
|
$processRunning = shell_exec("pgrep -af 'pandora_gotty.*-p ".$config['gotty_port']."' | grep -v 'pgrep'");
|
||||||
|
|
||||||
$start_proc = true;
|
$start_proc = true;
|
||||||
|
|
||||||
|
@ -194,11 +194,11 @@ function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=t
|
|||||||
function custom_graphs_search($id_group, $search)
|
function custom_graphs_search($id_group, $search)
|
||||||
{
|
{
|
||||||
if ($id_group != '' && $search != '') {
|
if ($id_group != '' && $search != '') {
|
||||||
$all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.' AND (name LIKE "%'.$search.'%" OR description LIKE "'.$search.'")');
|
$all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.' AND (REPLACE(name, " ", " ") LIKE "%'.$search.'%" OR REPLACE(description, " ", " ") LIKE "'.$search.'")');
|
||||||
} else if ($id_group != '') {
|
} else if ($id_group != '') {
|
||||||
$all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.'');
|
$all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.'');
|
||||||
} else {
|
} else {
|
||||||
$all_graphs = db_get_all_rows_sql('select * from tgraph where name LIKE "%'.$search.'%" OR description LIKE "'.$search.'"');
|
$all_graphs = db_get_all_rows_sql('select * from tgraph where REPLACE(name, " ", " ") LIKE "%'.$search.'%" OR REPLACE(description, " ", " ") LIKE "'.$search.'"');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($all_graphs === false) {
|
if ($all_graphs === false) {
|
||||||
|
@ -127,6 +127,58 @@ function events_translate_event_type($event_type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module status event_type into descriptive text.
|
||||||
|
*
|
||||||
|
* @param integer $event_type Event type.
|
||||||
|
*
|
||||||
|
* @return string Module status.
|
||||||
|
*/
|
||||||
|
function events_status_module_event_type($event_type)
|
||||||
|
{
|
||||||
|
$module_status = '';
|
||||||
|
switch ($event_type) {
|
||||||
|
case 'alert_fired':
|
||||||
|
case 'alert_recovered':
|
||||||
|
case 'alert_ceased':
|
||||||
|
case 'alert_manual_validation':
|
||||||
|
$module_status = AGENT_MODULE_STATUS_CRITICAL_ALERT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'going_down_normal':
|
||||||
|
case 'going_up_normal':
|
||||||
|
$module_status = AGENT_MODULE_STATUS_NORMAL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'going_unknown':
|
||||||
|
case 'unknown':
|
||||||
|
$module_status = AGENT_MODULE_STATUS_UNKNOWN;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'going_up_warning':
|
||||||
|
case 'going_down_warning':
|
||||||
|
$module_status = AGENT_MODULE_STATUS_WARNING;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'going_up_critical':
|
||||||
|
case 'going_down_critical':
|
||||||
|
$module_status = AGENT_MODULE_STATUS_CRITICAL_BAD;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'recon_host_detected':
|
||||||
|
case 'system':
|
||||||
|
case 'error':
|
||||||
|
case 'new_agent':
|
||||||
|
case 'configuration_change':
|
||||||
|
default:
|
||||||
|
$module_status = AGENT_MODULE_STATUS_NOT_INIT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $module_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates a numeric value event_status into descriptive text.
|
* Translates a numeric value event_status into descriptive text.
|
||||||
*
|
*
|
||||||
|
@ -128,19 +128,18 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
|
|||||||
$extension = pathinfo($filename, PATHINFO_EXTENSION);
|
$extension = pathinfo($filename, PATHINFO_EXTENSION);
|
||||||
|
|
||||||
$umask = io_safe_output((string) get_parameter('umask'));
|
$umask = io_safe_output((string) get_parameter('umask'));
|
||||||
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
// $parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
||||||
$parse_sec2_query = explode('=', $parse_all_queries[1]);
|
// $parse_sec2_query = explode('=', $parse_all_queries[1]);
|
||||||
$check_extension = true;
|
// $check_extension = true;
|
||||||
if ($parse_sec2_query[1] === 'operation/snmpconsole/snmp_mib_uploader') {
|
// if ($parse_sec2_query[1] === 'operation/snmpconsole/snmp_mib_uploader') {
|
||||||
if ((strtolower($extension) !== 'mib' && strtolower($extension) !== 'zip')) {
|
// if ((strtolower($extension) !== 'mib' && strtolower($extension) !== 'zip')) {
|
||||||
$check_extension = false;
|
// $check_extension = false;
|
||||||
} else {
|
// } else {
|
||||||
$check_extension = true;
|
// $check_extension = true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// (strtolower($extension) !== 'mib' && strtolower($extension) !== 'zip')
|
// (strtolower($extension) !== 'mib' && strtolower($extension) !== 'zip')
|
||||||
if (strpos($real_directory, $default_real_directory) !== 0 || $check_extension === false) {
|
if (strpos($real_directory, $default_real_directory) !== 0) {
|
||||||
// Perform security check to determine whether received upload
|
// Perform security check to determine whether received upload
|
||||||
// directory is part of the default path for caller uploader and
|
// directory is part of the default path for caller uploader and
|
||||||
// user is not trying to access an external path (avoid
|
// user is not trying to access an external path (avoid
|
||||||
@ -152,12 +151,12 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
|
|||||||
// Copy file to directory and change name.
|
// Copy file to directory and change name.
|
||||||
$nombre_archivo = sprintf('%s/%s', $real_directory, $filename);
|
$nombre_archivo = sprintf('%s/%s', $real_directory, $filename);
|
||||||
try {
|
try {
|
||||||
$mimeContentType = mime_content_type($_FILES['file']['tmp_name']);
|
$ext = strtolower(pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION));
|
||||||
|
if (empty($filterFilesType) === true || in_array($ext, $filterFilesType) === true) {
|
||||||
if (empty($filterFilesType) === true || in_array($mimeContentType, $filterFilesType) === true) {
|
|
||||||
$result = copy($_FILES['file']['tmp_name'], $nombre_archivo);
|
$result = copy($_FILES['file']['tmp_name'], $nombre_archivo);
|
||||||
} else {
|
} else {
|
||||||
$error_message = 'The uploaded file is not allowed. Only gif, png or jpg files can be uploaded.';
|
$types_allowed = implode(', ', $filterFilesType);
|
||||||
|
$error_message = 'The uploaded file is not allowed. Only '.$types_allowed.' files can be uploaded.';
|
||||||
throw new Exception(__($error_message));
|
throw new Exception(__($error_message));
|
||||||
}
|
}
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
@ -199,19 +198,29 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
|
|||||||
$filepath = $_FILES['file']['tmp_name'];
|
$filepath = $_FILES['file']['tmp_name'];
|
||||||
$real_directory = filemanager_safe_directory($destination_directory);
|
$real_directory = filemanager_safe_directory($destination_directory);
|
||||||
$secure = true;
|
$secure = true;
|
||||||
if ($parse_sec2_query[1] === 'operation/snmpconsole/snmp_mib_uploader') {
|
try {
|
||||||
// Security control structure.
|
$ext = strtolower(pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION));
|
||||||
$zip = new \ZipArchive;
|
if (empty($filterFilesType) === true || in_array($ext, $filterFilesType) === true) {
|
||||||
if ($zip->open($filepath) === true) {
|
// Security control structure.
|
||||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
$zip = new \ZipArchive;
|
||||||
$unzip_filename = $zip->getNameIndex($i);
|
if ($zip->open($filepath) === true) {
|
||||||
$extension = pathinfo($unzip_filename, PATHINFO_EXTENSION);
|
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||||
if (strtolower($extension) !== 'mib') {
|
$unzip_filename = $zip->getNameIndex($i);
|
||||||
$secure = false;
|
$extension = pathinfo($unzip_filename, PATHINFO_EXTENSION);
|
||||||
break;
|
if (in_array(strtolower($extension), $filterFilesType) === false) {
|
||||||
|
$error_message = 'The uploaded file is not allowed. Only '.$types_allowed.' files can be uploaded.';
|
||||||
|
$secure = false;
|
||||||
|
throw new Exception(__($error_message));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_FILE_MANAGER,
|
||||||
|
'Error Uploading files: '.$ex->getMessage()
|
||||||
|
);
|
||||||
|
$config['filemanager']['message'] = ui_print_error_message(__('Upload error').': '.$ex->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($real_directory, $default_real_directory) !== 0 || $secure === false) {
|
if (strpos($real_directory, $default_real_directory) !== 0 || $secure === false) {
|
||||||
|
@ -1585,7 +1585,7 @@ function gis_add_conection_maps_in_form($map_connection_list)
|
|||||||
<tr class="row_0">
|
<tr class="row_0">
|
||||||
<td>'.html_print_input_text('map_connection_name_'.$mapConnection['id_conection'], $mapConnectionRowDB['conection_name'], '', 20, 40, true, true).'</td>
|
<td>'.html_print_input_text('map_connection_name_'.$mapConnection['id_conection'], $mapConnectionRowDB['conection_name'], '', 20, 40, true, true).'</td>
|
||||||
<td>'.$radioButton.'</td>
|
<td>'.$radioButton.'</td>
|
||||||
<td><a id="delete_row" href="javascript: deleteConnectionMap(\''.$mapConnection['id_conection'].'\')">'.html_print_image('images/delete.svg', true, ['alt' => '', 'class' => 'invert_filter']).'</a></td>
|
<td><a id="delete_row" href="javascript: deleteConnectionMap(\''.$mapConnection['id_conection'].'\')">'.html_print_image('images/delete.svg', true, ['alt' => '', 'class' => 'invert_filter main_menu_icon']).'</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -77,7 +77,7 @@ function inventory_get_data(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($inventory_search_string != '') {
|
if ($inventory_search_string != '') {
|
||||||
array_push($where, "tagent_module_inventory.data LIKE '%".$inventory_search_string."%'");
|
array_push($where, "REPLACE(tagent_module_inventory.data, ' ', ' ') LIKE '%".$inventory_search_string."%'");
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset = (int) get_parameter('offset');
|
$offset = (int) get_parameter('offset');
|
||||||
@ -746,7 +746,7 @@ function inventory_get_datatable(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($inventory_search_string != '') {
|
if ($inventory_search_string != '') {
|
||||||
array_push($where, "tagent_module_inventory.data LIKE '%".$inventory_search_string."%'");
|
array_push($where, "REPLACE(tagente_datos_inventory.data, ' ', ' ') LIKE '%".$inventory_search_string."%'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($utimestamp > 0) {
|
if ($utimestamp > 0) {
|
||||||
@ -786,7 +786,6 @@ function inventory_get_datatable(
|
|||||||
}
|
}
|
||||||
|
|
||||||
$rows = db_get_all_rows_sql($sql);
|
$rows = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
if ($order_by_agent === false) {
|
if ($order_by_agent === false) {
|
||||||
$modules = [];
|
$modules = [];
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
@ -796,7 +795,13 @@ function inventory_get_datatable(
|
|||||||
|
|
||||||
$data_rows = explode(PHP_EOL, $row['data_inventory']);
|
$data_rows = explode(PHP_EOL, $row['data_inventory']);
|
||||||
foreach ($data_rows as $data_key => $data_value) {
|
foreach ($data_rows as $data_key => $data_value) {
|
||||||
if (empty($data_value) === false) {
|
if (empty($inventory_search_string) !== true) {
|
||||||
|
$search_check = strpos(str_replace(' ', ' ', $data_value), $inventory_search_string);
|
||||||
|
} else {
|
||||||
|
$search_check = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($data_value) === false && $search_check !== false) {
|
||||||
$row['data'] = $data_value;
|
$row['data'] = $data_value;
|
||||||
$modules[$row['name']][$row['name_agent'].'-'.$data_key.'-'.$data_value] = $row;
|
$modules[$row['name']][$row['name_agent'].'-'.$data_key.'-'.$data_value] = $row;
|
||||||
}
|
}
|
||||||
@ -889,7 +894,7 @@ function get_data_basic_info_sql($params, $count=false)
|
|||||||
|
|
||||||
if ($params['search'] > 0) {
|
if ($params['search'] > 0) {
|
||||||
$where .= sprintf(
|
$where .= sprintf(
|
||||||
' AND ( alias LIKE "%%%s%%" )',
|
' AND ( REPLACE(alias, " ", " ") LIKE "%%%s%%" )',
|
||||||
$params['search']
|
$params['search']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ function menu_print_menu(&$menu)
|
|||||||
|
|
||||||
if (isset($sub['type']) && $sub['type'] == 'direct') {
|
if (isset($sub['type']) && $sub['type'] == 'direct') {
|
||||||
// This is an external link.
|
// This is an external link.
|
||||||
$submenu_output .= '<li title="'.$sub['id'].'" id="'.str_replace(' ', '_', $sub['id']).'" class="'.$class.'">';
|
$submenu_output .= '<li title="'.$sub['text'].'" id="'.str_replace(' ', '_', $sub['id']).'" class="'.$class.'">';
|
||||||
|
|
||||||
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>';
|
||||||
@ -875,6 +875,7 @@ function menu_pepare_acl_select_data($pages, $sec)
|
|||||||
if (is_ajax()) {
|
if (is_ajax()) {
|
||||||
$about = (bool) get_parameter('about');
|
$about = (bool) get_parameter('about');
|
||||||
$about_operation = (bool) get_parameter('about_operation');
|
$about_operation = (bool) get_parameter('about_operation');
|
||||||
|
$why_enterprise = (bool) get_parameter('why_enterprise');
|
||||||
if ($about) {
|
if ($about) {
|
||||||
global $config;
|
global $config;
|
||||||
global $pandora_version;
|
global $pandora_version;
|
||||||
@ -1107,10 +1108,10 @@ if (is_ajax()) {
|
|||||||
</tr>
|
</tr>
|
||||||
<tr class="about-last-tr">
|
<tr class="about-last-tr">
|
||||||
<th style="width: 50%;">
|
<th style="width: 50%;">
|
||||||
<p class="about-last-p"><span>'.$db_info->data->dbSize->name.'</span></p>
|
<p class="about-last-p"><span>'.$db_info->data->dbVersion->name.'</span></p>
|
||||||
</th>
|
</th>
|
||||||
<th style="width: 50%;">
|
<th style="width: 50%;">
|
||||||
<p class="about-last-p" style="font-size: 10pt;">'.$db_info->data->dbSize->value.'</p>
|
<p class="about-last-p" style="font-size: 10pt;">'.$db_info->data->dbVersion->value.'</p>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -1370,4 +1371,50 @@ if (is_ajax()) {
|
|||||||
|
|
||||||
echo $dialog;
|
echo $dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($why_enterprise) {
|
||||||
|
global $config;
|
||||||
|
global $pandora_version;
|
||||||
|
$product_name = io_safe_output(get_product_name());
|
||||||
|
|
||||||
|
$lts_name = '';
|
||||||
|
if (empty($config['lts_name']) === false) {
|
||||||
|
$lts_name = ' <i>'.$config['lts_name'].'</i>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$image_about = ui_get_full_url('/images/custom_logo/logo-default-pandorafms-collapsed.svg', false, false, false);
|
||||||
|
$url_why_enterprise = 'https://pandorafms.com/en/why-enterprise/';
|
||||||
|
$lang = users_get_user_by_id($config['id_user'])['language'];
|
||||||
|
if ($lang === 'es') {
|
||||||
|
$url_why_enterprise = 'https://pandorafms.com/es/por-que-pandora-fms-enterprise/';
|
||||||
|
}
|
||||||
|
|
||||||
|
$dialog = '
|
||||||
|
<div id="about-tabs" class="overflow-hidden">
|
||||||
|
<div id="tab-general-view">
|
||||||
|
<table class="table-about">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 40%; border: 0px;">
|
||||||
|
<a href="https://pandorafms.com/" target="_blank">
|
||||||
|
<img src="'.$image_about.'" alt="logo" width="50%">
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
<th style="width: 60%; text-align: left; border: 0px;">
|
||||||
|
<h1>'.$product_name.'</h1>
|
||||||
|
<p><span>'.__('Version').' '.$pandora_version.$lts_name.' - '.(enterprise_installed() ? 'Enterprise' : 'Community').'</span></p>
|
||||||
|
<p>'.__('You are using the free, OpenSource version of Pandora FMS.').'</p>
|
||||||
|
<p>'.__('This version has no official support or warranty, you can purchase the Enterprise version, which offers support, warranty and additional features to the Opensource version.').'</p>
|
||||||
|
<p><span><a href="'.$url_why_enterprise.'">'.__('Click on this link for more information.').'</a></span></p>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p class="trademark-copyright">Trademark and copyright 2004 - '.date('Y').' <a href="https://pandorafms.com/" target="_blank">Pandora FMS</a>. All rights reserved</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
|
||||||
|
echo $dialog;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -251,6 +251,11 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent,
|
|||||||
unset($new_module['id_agente_modulo']);
|
unset($new_module['id_agente_modulo']);
|
||||||
unset($new_module['id_agente']);
|
unset($new_module['id_agente']);
|
||||||
|
|
||||||
|
// Set debug content.
|
||||||
|
if (empty($new_module['debug_content']) === false) {
|
||||||
|
$new_module['debug_content'] = str_replace("'", '"', $new_module['debug_content']);
|
||||||
|
}
|
||||||
|
|
||||||
$id_new_module = modules_create_agent_module(
|
$id_new_module = modules_create_agent_module(
|
||||||
$id_destiny_agent,
|
$id_destiny_agent,
|
||||||
$new_module['nombre'],
|
$new_module['nombre'],
|
||||||
@ -2619,12 +2624,26 @@ function modules_get_agentmodule_data_for_humans($module)
|
|||||||
$salida = human_milliseconds_to_string($module['datos']);
|
$salida = human_milliseconds_to_string($module['datos']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
|
$salida = remove_right_zeros(
|
||||||
|
number_format(
|
||||||
|
$module['datos'],
|
||||||
|
$config['graph_precision'],
|
||||||
|
$config['decimal_separator'],
|
||||||
|
($config['thousand_separator'] ?? null)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
|
$salida = remove_right_zeros(
|
||||||
|
number_format(
|
||||||
|
$module['datos'],
|
||||||
|
$config['graph_precision'],
|
||||||
|
$config['decimal_separator'],
|
||||||
|
($config['thousand_separator'] ?? null)
|
||||||
|
)
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2643,12 +2662,26 @@ function modules_get_agentmodule_data_for_humans($module)
|
|||||||
$salida = human_milliseconds_to_string($module['datos']);
|
$salida = human_milliseconds_to_string($module['datos']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
|
$salida = remove_right_zeros(
|
||||||
|
number_format(
|
||||||
|
$module['datos'],
|
||||||
|
$config['graph_precision'],
|
||||||
|
$config['decimal_separator'],
|
||||||
|
($config['thousand_separator'] ?? null)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
|
$salida = remove_right_zeros(
|
||||||
|
number_format(
|
||||||
|
$module['datos'],
|
||||||
|
$config['graph_precision'],
|
||||||
|
$config['decimal_separator'],
|
||||||
|
($config['thousand_separator'] ?? null)
|
||||||
|
)
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2930,7 +2963,14 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_numeric($data)) {
|
if (is_numeric($data)) {
|
||||||
$title .= ': '.remove_right_zeros(number_format($data, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
|
$title .= ': '.remove_right_zeros(
|
||||||
|
number_format(
|
||||||
|
$data,
|
||||||
|
$config['graph_precision'],
|
||||||
|
$config['decimal_separator'],
|
||||||
|
($config['thousand_separator'] ?? null)
|
||||||
|
)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$text = io_safe_output($data);
|
$text = io_safe_output($data);
|
||||||
|
|
||||||
@ -4765,7 +4805,231 @@ function export_agents_module_csv($filters)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if modules are compatible with MADE server.
|
* Function to return Mean Time Between Failure, Mean Time To Solution (in seconds)
|
||||||
|
* and Availability of a module
|
||||||
|
*
|
||||||
|
* @param string $datetime_from Start time of the interval.
|
||||||
|
*
|
||||||
|
* @param string $datetime_to End time of the interval.
|
||||||
|
*
|
||||||
|
* @param string $id_agentmodule id_agentmodule of the module
|
||||||
|
*
|
||||||
|
* @return array Returns an array with the data
|
||||||
|
*/
|
||||||
|
function service_level_module_data($datetime_from, $datetime_to, $id_agentmodule)
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
|
$data['mtbf'] = false;
|
||||||
|
$data['mtrs'] = false;
|
||||||
|
$data['availability'] = false;
|
||||||
|
$data['critical_events'] = false;
|
||||||
|
$data['warning_events'] = false;
|
||||||
|
$data['last_status_change'] = false;
|
||||||
|
$data['module_name'] = false;
|
||||||
|
|
||||||
|
$availability = 0;
|
||||||
|
$type = '';
|
||||||
|
if ((bool) is_metaconsole() === true) {
|
||||||
|
if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) {
|
||||||
|
$server_id = [];
|
||||||
|
$server_id['id'] = explode('|', $id_agentmodule)[0];
|
||||||
|
$id_agentmodule = explode('|', $id_agentmodule)[1];
|
||||||
|
$server_name = db_get_row_filter('tmetaconsole_setup', $server_id, 'server_name');
|
||||||
|
$connection = metaconsole_get_connection($server_name);
|
||||||
|
if (metaconsole_load_external_db($connection) !== NOERR) {
|
||||||
|
// Restore db connection.
|
||||||
|
metaconsole_restore_db();
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$uncompressed_data = db_uncompress_module_data(
|
||||||
|
$id_agentmodule,
|
||||||
|
$datetime_from,
|
||||||
|
$datetime_to
|
||||||
|
);
|
||||||
|
|
||||||
|
$first_utimestamp = 0;
|
||||||
|
foreach ($uncompressed_data as $data_module) {
|
||||||
|
foreach ($data_module['data'] as $subdata) {
|
||||||
|
if (!empty($subdata['datos'])) {
|
||||||
|
$first_utimestamp = $subdata['utimestamp'];
|
||||||
|
if (isset($subdata['type'])) {
|
||||||
|
$type = $subdata['type'];
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$interval_time = ($datetime_to - $datetime_from);
|
||||||
|
$current_time = time();
|
||||||
|
$sql = 'SELECT utimestamp, event_type FROM tevento
|
||||||
|
WHERE id_agentmodule = '.$id_agentmodule.'
|
||||||
|
AND utimestamp >= '.$datetime_from.'
|
||||||
|
AND utimestamp <= '.$datetime_to.'
|
||||||
|
ORDER BY utimestamp DESC';
|
||||||
|
|
||||||
|
$events_time = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
|
// Count events.
|
||||||
|
$sql = 'SELECT COUNT(*) as critical_events FROM tevento
|
||||||
|
WHERE id_agentmodule= '.$id_agentmodule.'
|
||||||
|
AND utimestamp >= '.$datetime_from.'
|
||||||
|
AND utimestamp <= '.$datetime_to.'
|
||||||
|
AND (event_type = "going_up_critical" OR event_type = "going_down_critical")';
|
||||||
|
|
||||||
|
$critical_events = db_get_sql($sql);
|
||||||
|
|
||||||
|
$sql = 'SELECT COUNT(*) as warning_events FROM tevento
|
||||||
|
WHERE id_agentmodule= '.$id_agentmodule.'
|
||||||
|
AND utimestamp >= '.$datetime_from.'
|
||||||
|
AND utimestamp <= '.$datetime_to.'
|
||||||
|
AND (event_type = "going_up_warning" OR event_type = "going_down_warning")';
|
||||||
|
|
||||||
|
$warning_events = db_get_sql($sql);
|
||||||
|
|
||||||
|
if ($events_time !== false && count($events_time) > 0) {
|
||||||
|
$failed_event = [];
|
||||||
|
$normal_event = [];
|
||||||
|
$events_time = array_reverse($events_time);
|
||||||
|
$mtrs_events = [];
|
||||||
|
foreach ($events_time as $key => $event) {
|
||||||
|
if ($event['event_type'] === 'going_up_critical' || $event['event_type'] === 'going_down_critical') {
|
||||||
|
$failed_event[] = $event['utimestamp'];
|
||||||
|
$mtrs_events[]['failed_event'] = $event['utimestamp'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($event['event_type'] === 'going_up_normal'
|
||||||
|
|| $event['event_type'] === 'going_down_normal'
|
||||||
|
|| $event['event_type'] === 'going_up_warning'
|
||||||
|
|| $event['event_type'] === 'going_down_warning'
|
||||||
|
) {
|
||||||
|
$normal_event[] = $event['utimestamp'];
|
||||||
|
$mtrs_events[]['normal_event'] = $event['utimestamp'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$process_mtrs_events = [];
|
||||||
|
|
||||||
|
if (empty($mtrs_events) === false) {
|
||||||
|
$last_event_key = '';
|
||||||
|
foreach ($mtrs_events as $key => $val) {
|
||||||
|
if (key($val) !== $last_event_key) {
|
||||||
|
$last_event_key = key($val);
|
||||||
|
$process_mtrs_events[] = $val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$mtrs_array = [];
|
||||||
|
if (empty($normal_event) === true) {
|
||||||
|
$mtrs_array[] = ($current_time - $failed_event[0]);
|
||||||
|
} else if (empty($failed_event) === true) {
|
||||||
|
$mtrs_array[] = 0;
|
||||||
|
} else {
|
||||||
|
$last_value = '';
|
||||||
|
foreach ($process_mtrs_events as $key => $val) {
|
||||||
|
$current_value = $val[key($val)];
|
||||||
|
if ($last_value !== '') {
|
||||||
|
$mtrs_array[] = ($current_value - $last_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
$last_value = $current_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$last_mtrs_event = key(end($process_mtrs_events));
|
||||||
|
if ($last_mtrs_event === 'failed_event') {
|
||||||
|
$mtrs_array[] = ($current_time - $last_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$mtbf_array = [];
|
||||||
|
|
||||||
|
if (!empty($failed_event) === true) {
|
||||||
|
if (count($failed_event) > 1) {
|
||||||
|
for ($i = 1; $i <= array_key_last($failed_event); $i++) {
|
||||||
|
$mtbf_array[] = ($failed_event[$i] - ($failed_event[($i - 1)]));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$mtbf_array[] = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$mtbf_array[] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$total_time_failed = array_sum($mtrs_array);
|
||||||
|
$total_time_ok = ($interval_time - $total_time_failed);
|
||||||
|
if (count($events_time) === 1) {
|
||||||
|
if ((int) $first_utimestamp !== 0) {
|
||||||
|
$availability = round((($total_time_ok / $interval_time) * 100), 2);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$availability = round((($total_time_ok / $interval_time) * 100), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($critical_events > 1) {
|
||||||
|
$mtbf = round(array_sum($mtbf_array) / count($mtbf_array));
|
||||||
|
} else {
|
||||||
|
$mtbf = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($mtrs_array) === 1 && (int) $first_utimestamp !== 0) {
|
||||||
|
$mtrs = round($total_time_failed / count($mtrs_array));
|
||||||
|
} else if (count($mtrs_array) > 1 && (int) $first_utimestamp !== 0) {
|
||||||
|
$mtrs = round((array_sum($mtrs_array) / count($mtrs_array)));
|
||||||
|
} else {
|
||||||
|
$mtrs = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['mtbf'] = $mtbf;
|
||||||
|
$data['mtrs'] = $mtrs;
|
||||||
|
$data['availability'] = $availability;
|
||||||
|
} else {
|
||||||
|
$data['mtbf'] = false;
|
||||||
|
$data['mtrs'] = false;
|
||||||
|
$data['availability'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get last status change.
|
||||||
|
$sql = 'SELECT last_status_change FROM tagente_estado
|
||||||
|
WHERE id_agente_modulo = '.$id_agentmodule.' ';
|
||||||
|
|
||||||
|
$last_status_change = db_get_sql($sql);
|
||||||
|
|
||||||
|
// Get module name.
|
||||||
|
/*
|
||||||
|
$sql = 'SELECT nombre FROM tagente_modulo
|
||||||
|
WHERE id_agente_modulo = '.$id_agentmodule;*/
|
||||||
|
|
||||||
|
$sql = 'SELECT tagente_modulo.nombre as nombre, tagente.alias as alias
|
||||||
|
FROM tagente_modulo INNER JOIN tagente
|
||||||
|
ON tagente_modulo.id_agente = tagente.id_agente
|
||||||
|
WHERE id_agente_modulo = '.$id_agentmodule.' ';
|
||||||
|
$sql_query = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
|
$data['critical_events'] = $critical_events;
|
||||||
|
$data['warning_events'] = $warning_events;
|
||||||
|
$data['last_status_change'] = $last_status_change;
|
||||||
|
$data['module_name'] = $sql_query[0]['nombre'];
|
||||||
|
if ((bool) is_metaconsole() === true) {
|
||||||
|
$data['agent_alias'] = $server_name['server_name'].' » '.$sql_query[0]['alias'];
|
||||||
|
} else {
|
||||||
|
$data['agent_alias'] = $sql_query[0]['alias'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((bool) is_metaconsole() === true) {
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Check if modules are compatible with MADE server.
|
||||||
*
|
*
|
||||||
* @param integer $id_tipo_modulo
|
* @param integer $id_tipo_modulo
|
||||||
* @retur boolean True if compatible, false otherwise.
|
* @retur boolean True if compatible, false otherwise.
|
||||||
|
@ -15986,171 +15986,174 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$module_interval = modules_get_interval(
|
if ($metaconsole_on && $server_name != '') {
|
||||||
$content['id_agent_module']
|
// Restore db connection.
|
||||||
);
|
metaconsole_restore_db();
|
||||||
$slice = ($content['period'] / $module_interval);
|
}
|
||||||
|
|
||||||
$result_sla = reporting_advanced_sla(
|
$filter = [
|
||||||
$content['id_agent_module'],
|
'id_agentmodule' => $content['id_agent_module'],
|
||||||
($report['datetime'] - $content['period']),
|
'group_rep' => EVENT_GROUP_REP_ALL,
|
||||||
$report['datetime'],
|
'date_to' => date('Y-m-d', ($report['datetime'] - $content['period'])),
|
||||||
null,
|
'time_to' => date('H:i:s', ($report['datetime'] - $content['period'])),
|
||||||
null,
|
];
|
||||||
|
|
||||||
|
if ($metaconsole_on && $server_name != '') {
|
||||||
|
$filter['id_server'] = $connection['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$previous_event = events_get_all(
|
||||||
|
['te.event_type, te.timestamp, te.utimestamp'],
|
||||||
|
$filter,
|
||||||
0,
|
0,
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
$slice,
|
|
||||||
1,
|
1,
|
||||||
|
'desc',
|
||||||
|
'timestamp',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
// Select Warning and critical values.
|
$status = '';
|
||||||
$agentmodule_info = modules_get_agentmodule($content['id_agent_module']);
|
if ($previous_event !== false) {
|
||||||
$min_value_critical = ($agentmodule_info['min_critical'] == 0) ? null : $agentmodule_info['min_critical'];
|
$previous_event = end($previous_event);
|
||||||
|
$status = $previous_event['event_type'];
|
||||||
|
}
|
||||||
|
|
||||||
// Check if module type is string.
|
$date_start = ($report['datetime'] - $content['period']);
|
||||||
$modules_is_string = modules_is_string($agentmodule_info['id_agente_modulo']);
|
$filter = [
|
||||||
|
'id_agentmodule' => $content['id_agent_module'],
|
||||||
|
'group_rep' => EVENT_GROUP_REP_ALL,
|
||||||
|
'date_from' => date('Y-m-d', $date_start),
|
||||||
|
'date_to' => date('Y-m-d', $report['datetime']),
|
||||||
|
'time_from' => date('H:i:s', $date_start),
|
||||||
|
'time_to' => date('H:i:s', $report['datetime']),
|
||||||
|
];
|
||||||
|
|
||||||
if ($modules_is_string === false) {
|
if ($metaconsole_on && $server_name != '') {
|
||||||
if ($agentmodule_info['max_critical'] == 0) {
|
$filter['id_server'] = $connection['id'];
|
||||||
$max_value_critical = null;
|
}
|
||||||
if ($agentmodule_info['min_critical'] == 0) {
|
|
||||||
if ((bool) $content['dinamic_proc'] === true) {
|
$events = events_get_all(
|
||||||
$max_value_critical = 0.01;
|
['te.event_type, te.timestamp, te.utimestamp'],
|
||||||
}
|
$filter,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
// Metaconsole connection.
|
||||||
|
if ($metaconsole_on && $server_name != '') {
|
||||||
|
$connection = metaconsole_get_connection($server_name);
|
||||||
|
if (!metaconsole_load_external_db($connection)) {
|
||||||
|
ui_print_error_message('Error connecting to '.$server_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$not_init_data = [];
|
||||||
|
$previous_data = [
|
||||||
|
'event_type' => $status,
|
||||||
|
'utimestamp' => $date_start,
|
||||||
|
];
|
||||||
|
if (empty($status) === true) {
|
||||||
|
// Si viene de no iniciado busco el primer dato del modulo y si es de histórico.
|
||||||
|
$first_utimestamp = false;
|
||||||
|
$search_historydb = false;
|
||||||
|
$extract_first_data = modules_get_first_date($content['id_agent_module'], 0);
|
||||||
|
if (empty($extract_first_data) === false) {
|
||||||
|
$first_utimestamp = $extract_first_data['first_utimestamp'];
|
||||||
|
$search_historydb = (isset($extract_first_data['search_historydb']) === true) ? $extract_first_data['search_historydb'] : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si se encuentra algun dato.
|
||||||
|
// Si no hay eventos, la fecha del primer dato no sea mayor al fin del report (seria un bloque completo de no iniciado).
|
||||||
|
// Se comprueba que si existen eventos el dato no sea previo al evento.
|
||||||
|
if ($first_utimestamp !== false
|
||||||
|
&& ((empty($events) === true && $first_utimestamp < $report['datetime']) || (empty($events) === false && $first_utimestamp < $events[0]['utimestamp']))
|
||||||
|
) {
|
||||||
|
// Tenemos en cuenta si el modulo es de tipo string.
|
||||||
|
$module = modules_get_agentmodule($content['id_agent_module']);
|
||||||
|
$module_type = $module['id_tipo_modulo'];
|
||||||
|
$module_type_str = modules_get_type_name($module_type);
|
||||||
|
$table = 'tagente_datos';
|
||||||
|
if (strstr($module_type_str, 'string') !== false) {
|
||||||
|
$table = 'tagente_datos_string';
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = sprintf(
|
||||||
|
'SELECT datos,utimestamp
|
||||||
|
FROM %s
|
||||||
|
WHERE id_agente_modulo = %d
|
||||||
|
AND utimestamp = %d
|
||||||
|
',
|
||||||
|
$table,
|
||||||
|
$content['id_agent_module'],
|
||||||
|
$first_utimestamp
|
||||||
|
);
|
||||||
|
|
||||||
|
$data = db_get_all_rows_sql($query, $search_historydb);
|
||||||
|
if ($data !== false) {
|
||||||
|
$not_init_data = [
|
||||||
|
'event_type' => $status,
|
||||||
|
'utimestamp' => $date_start,
|
||||||
|
];
|
||||||
|
$previous_data = [
|
||||||
|
'event_type' => 'going_up_normal',
|
||||||
|
'utimestamp' => $data[0]['utimestamp'],
|
||||||
|
];
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$max_value_critical = $agentmodule_info['max_critical'];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($agentmodule_info['str_critical'] == '') {
|
|
||||||
$max_value_critical = null;
|
|
||||||
} else {
|
|
||||||
$max_value_critical = $agentmodule_info['str_critical'];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$inverse_critical = $agentmodule_info['critical_inverse'];
|
$array_result = [];
|
||||||
|
$time_total = $content['period'];
|
||||||
$min_value_warning = ($agentmodule_info['min_warning'] == 0) ? null : $agentmodule_info['min_warning'];
|
$check_total = 0;
|
||||||
|
$check_ok = 0;
|
||||||
if ($modules_is_string === false) {
|
$time_ok = 0;
|
||||||
if ($agentmodule_info['max_warning'] == 0) {
|
if (empty($events) === true) {
|
||||||
$max_value_warning = null;
|
$events = [];
|
||||||
} else {
|
|
||||||
$max_value_warning = $agentmodule_info['max_warning'];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($agentmodule_info['str_warning'] == '') {
|
|
||||||
$max_value_warning = null;
|
|
||||||
} else {
|
|
||||||
$max_value_warning = $agentmodule_info['str_warning'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$inverse_warning = $agentmodule_info['warning_inverse'];
|
// Añadimos el dato previo.
|
||||||
|
array_unshift($events, $previous_data);
|
||||||
|
if (empty($not_init_data) === false) {
|
||||||
|
// Añadimos si viene de no iniciado el no iniciado.
|
||||||
|
array_unshift($events, $not_init_data);
|
||||||
|
}
|
||||||
|
|
||||||
$data = [];
|
$current_time = time();
|
||||||
$data['time_total'] = 0;
|
|
||||||
$data['time_ok'] = 0;
|
|
||||||
$data['time_error'] = 0;
|
|
||||||
$data['time_warning'] = 0;
|
|
||||||
$data['time_unknown'] = 0;
|
|
||||||
$data['time_not_init'] = 0;
|
|
||||||
$data['time_downtime'] = 0;
|
|
||||||
$data['checks_total'] = 0;
|
|
||||||
$data['checks_ok'] = 0;
|
|
||||||
$data['checks_error'] = 0;
|
|
||||||
$data['checks_warning'] = 0;
|
|
||||||
$data['checks_unknown'] = 0;
|
|
||||||
$data['checks_not_init'] = 0;
|
|
||||||
|
|
||||||
$array_graph = [];
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($result_sla as $value_sla) {
|
foreach ($events as $event) {
|
||||||
$data['time_total'] += $value_sla['time_total'];
|
$array_result[$i]['data'] = events_status_module_event_type($event['event_type']);
|
||||||
$data['time_ok'] += $value_sla['time_ok'];
|
if (isset($events[($i + 1)]) === true) {
|
||||||
$data['time_error'] += $value_sla['time_error'];
|
$period = ($events[($i + 1)]['utimestamp'] - $event['utimestamp']);
|
||||||
$data['time_warning'] += $value_sla['time_warning'];
|
$array_result[$i]['utimestamp'] = $period;
|
||||||
$data['time_unknown'] += $value_sla['time_unknown'];
|
|
||||||
$data['time_downtime'] += $value_sla['time_downtime'];
|
|
||||||
$data['time_not_init'] += $value_sla['time_not_init'];
|
|
||||||
$data['checks_total'] += $value_sla['checks_total'];
|
|
||||||
$data['checks_ok'] += $value_sla['checks_ok'];
|
|
||||||
$data['checks_error'] += $value_sla['checks_error'];
|
|
||||||
$data['checks_warning'] += $value_sla['checks_warning'];
|
|
||||||
$data['checks_unknown'] += $value_sla['checks_unknown'];
|
|
||||||
$data['checks_not_init'] += $value_sla['checks_not_init'];
|
|
||||||
|
|
||||||
// Generate raw data for graph.
|
|
||||||
if ($value_sla['time_total'] != 0) {
|
|
||||||
if ($value_sla['time_error'] > 0) {
|
|
||||||
// ERR.
|
|
||||||
$array_graph[$i]['data'] = 3;
|
|
||||||
} else if ($value_sla['time_unknown'] > 0) {
|
|
||||||
// UNKNOWN.
|
|
||||||
$array_graph[$i]['data'] = 4;
|
|
||||||
} else if ($value_sla['time_warning'] > 0) {
|
|
||||||
// Warning.
|
|
||||||
$array_graph[$i]['data'] = 2;
|
|
||||||
} else if ($value_sla['time_not_init'] == $value_sla['time_total']) {
|
|
||||||
// NOT INIT.
|
|
||||||
$array_graph[$i]['data'] = 6;
|
|
||||||
} else {
|
|
||||||
$array_graph[$i]['data'] = 1;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$array_graph[$i]['data'] = 7;
|
$period = ($report['datetime'] - $event['utimestamp']);
|
||||||
|
// El ultimo evento solo lo arrastramos hasta la fecha actual.
|
||||||
|
// Si pedimos mas fecha sera desconocido.
|
||||||
|
if ($report['datetime'] > $current_time) {
|
||||||
|
$period = ($current_time - $event['utimestamp']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$array_result[$i]['utimestamp'] = $period;
|
||||||
}
|
}
|
||||||
|
|
||||||
$array_graph[$i]['utimestamp'] = ($value_sla['date_to'] - $value_sla['date_from']);
|
if ($array_result[$i]['data'] === AGENT_MODULE_STATUS_NORMAL) {
|
||||||
|
$check_ok++;
|
||||||
|
$time_ok += $period;
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_total++;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['sla_value'] = reporting_sla_get_compliance_from_array(
|
// Bloque por si se pide mas fecha.
|
||||||
$data
|
if ($report['datetime'] > $current_time) {
|
||||||
);
|
$array_result[$i]['data'] = AGENT_MODULE_STATUS_UNKNOWN;
|
||||||
|
$array_result[$i]['utimestamp'] = ($report['datetime'] - $current_time);
|
||||||
$data['sla_fixed'] = sla_truncate(
|
|
||||||
$data['sla_value'],
|
|
||||||
$config['graph_precision']
|
|
||||||
);
|
|
||||||
|
|
||||||
$data_init = -1;
|
|
||||||
$acum = 0;
|
|
||||||
$sum = 0;
|
|
||||||
$array_result = [];
|
|
||||||
$i = 0;
|
|
||||||
foreach ($array_graph as $value) {
|
|
||||||
if ($data_init == -1) {
|
|
||||||
$data_init = $value['data'];
|
|
||||||
$acum = $value['utimestamp'];
|
|
||||||
} else {
|
|
||||||
if ($data_init == $value['data']) {
|
|
||||||
$acum = ($acum + $value['utimestamp']);
|
|
||||||
} else {
|
|
||||||
$array_result[$i]['data'] = $data_init;
|
|
||||||
$array_result[$i]['utimestamp'] = $acum;
|
|
||||||
$array_result[$i]['real_data'] = $sum;
|
|
||||||
$i++;
|
|
||||||
$data_init = $value['data'];
|
|
||||||
$acum = $value['utimestamp'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($array_result) == 0) {
|
|
||||||
$array_result = $array_graph;
|
|
||||||
} else {
|
|
||||||
$array_result[$i]['data'] = $data_init;
|
|
||||||
$array_result[$i]['utimestamp'] = $acum;
|
|
||||||
$array_result[$i]['real_data'] = $sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
$time_total = $data['time_total'];
|
|
||||||
// Slice graphs calculation.
|
|
||||||
$return['agent'] = modules_get_agentmodule_agent_alias(
|
$return['agent'] = modules_get_agentmodule_agent_alias(
|
||||||
$content['id_agent_module']
|
$content['id_agent_module']
|
||||||
);
|
);
|
||||||
@ -16158,37 +16161,21 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
|
|||||||
$content['id_agent_module']
|
$content['id_agent_module']
|
||||||
);
|
);
|
||||||
|
|
||||||
$return['max_critical'] = $max_value_critical;
|
$return['data_ok'] = $check_ok;
|
||||||
$return['min_critical'] = $min_value_critical;
|
$return['data_total'] = $check_total;
|
||||||
$return['critical_inverse'] = $inverse_critical;
|
if ($check_total > 0) {
|
||||||
$return['max_warning'] = $max_value_warning;
|
$return['percent_ok'] = (($time_ok * 100) / $content['period']);
|
||||||
$return['min_warning'] = $min_value_warning;
|
|
||||||
$return['warning_inverse'] = $inverse_warning;
|
|
||||||
$return['data_not_init'] = $data['checks_not_init'];
|
|
||||||
$return['data_unknown'] = $data['checks_unknown'];
|
|
||||||
$return['data_critical'] = $data['checks_error'];
|
|
||||||
$return['data_warning'] = $data['checks_warning'];
|
|
||||||
$return['data_ok'] = $data['checks_ok'];
|
|
||||||
$return['data_total'] = $data['checks_total'];
|
|
||||||
$return['time_not_init'] = $data['time_not_init'];
|
|
||||||
$return['time_unknown'] = $data['time_unknown'];
|
|
||||||
$return['time_critical'] = $data['time_error'];
|
|
||||||
$return['time_warning'] = $data['time_warning'];
|
|
||||||
$return['time_ok'] = $data['time_ok'];
|
|
||||||
if ($data['checks_total'] > 0) {
|
|
||||||
$return['percent_ok'] = (($data['checks_ok'] * 100) / $data['checks_total']);
|
|
||||||
} else {
|
} else {
|
||||||
$return['percent_ok'] = 0;
|
$return['percent_ok'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$colors = [
|
$colors = [
|
||||||
1 => COL_NORMAL,
|
AGENT_MODULE_STATUS_CRITICAL_ALERT => COL_ALERTFIRED,
|
||||||
2 => COL_WARNING,
|
AGENT_MODULE_STATUS_NORMAL => COL_NORMAL,
|
||||||
3 => COL_CRITICAL,
|
AGENT_MODULE_STATUS_UNKNOWN => COL_UNKNOWN,
|
||||||
4 => COL_UNKNOWN,
|
AGENT_MODULE_STATUS_WARNING => COL_WARNING,
|
||||||
5 => COL_DOWNTIME,
|
AGENT_MODULE_STATUS_CRITICAL_BAD => COL_CRITICAL,
|
||||||
6 => COL_NOTINIT,
|
AGENT_MODULE_STATUS_NOT_INIT => COL_NOTINIT,
|
||||||
7 => COL_IGNORED,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$width_graph = 100;
|
$width_graph = 100;
|
||||||
|
@ -1275,7 +1275,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
|
|||||||
$table3->headstyle[5] = 'text-align: right';
|
$table3->headstyle[5] = 'text-align: right';
|
||||||
|
|
||||||
foreach ($item['data'] as $sla) {
|
foreach ($item['data'] as $sla) {
|
||||||
if (isset($sla) === true) {
|
if (isset($sla) === true && empty($sla['agent']) === false) {
|
||||||
// First_table.
|
// First_table.
|
||||||
$row = [];
|
$row = [];
|
||||||
$row[] = $sla['agent'];
|
$row[] = $sla['agent'];
|
||||||
@ -4952,7 +4952,7 @@ function reporting_html_value(
|
|||||||
$table2->head = [
|
$table2->head = [
|
||||||
__('Agent'),
|
__('Agent'),
|
||||||
__('Module'),
|
__('Module'),
|
||||||
__('Minimun'),
|
__('Minimum'),
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -5023,7 +5023,7 @@ function reporting_html_value(
|
|||||||
case 'min_value':
|
case 'min_value':
|
||||||
$table1->head = [
|
$table1->head = [
|
||||||
__('Lapse'),
|
__('Lapse'),
|
||||||
__('Minimun'),
|
__('Minimum'),
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1011,12 +1011,12 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||||||
|
|
||||||
$types['vuls_attack_complexity'] = [
|
$types['vuls_attack_complexity'] = [
|
||||||
'optgroup' => __('Vulnerabilities'),
|
'optgroup' => __('Vulnerabilities'),
|
||||||
'name' => __('Attack complexity graph donut'),
|
'name' => __('Attack complexity doughnut chart'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$types['vuls_by_packages'] = [
|
$types['vuls_by_packages'] = [
|
||||||
'optgroup' => __('Vulnerabilities'),
|
'optgroup' => __('Vulnerabilities'),
|
||||||
'name' => __('By packages in graph pie'),
|
'name' => __('By packages in pie chart'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$types['vuls_by_agent'] = [
|
$types['vuls_by_agent'] = [
|
||||||
|
@ -1978,15 +1978,21 @@ function ui_print_help_icon(
|
|||||||
*
|
*
|
||||||
* @return boolean True if the file was added. False if the file doesn't exist.
|
* @return boolean True if the file was added. False if the file doesn't exist.
|
||||||
*/
|
*/
|
||||||
function ui_require_css_file($name, $path='include/styles/', $echo_tag=false)
|
function ui_require_css_file($name, $path='include/styles/', $echo_tag=false, $return=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$filename = $path.$name.'.css';
|
$filename = $path.$name.'.css';
|
||||||
|
|
||||||
if ($echo_tag === true) {
|
if ($echo_tag === true) {
|
||||||
echo '<link type="text/css" rel="stylesheet" href="'.ui_get_full_url($filename, false, false, false).'">';
|
$filename .= '?v='.$config['current_package'];
|
||||||
return null;
|
$tag_name = '<link type="text/css" rel="stylesheet" href="'.ui_get_full_url($filename, false, false, false).'">';
|
||||||
|
if ($return === false) {
|
||||||
|
echo $tag_name;
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return $tag_name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! isset($config['css'])) {
|
if (! isset($config['css'])) {
|
||||||
@ -2035,15 +2041,20 @@ function ui_require_css_file($name, $path='include/styles/', $echo_tag=false)
|
|||||||
*
|
*
|
||||||
* @return boolean True if the file was added. False if the file doesn't exist.
|
* @return boolean True if the file was added. False if the file doesn't exist.
|
||||||
*/
|
*/
|
||||||
function ui_require_javascript_file($name, $path='include/javascript/', $echo_tag=false)
|
function ui_require_javascript_file($name, $path='include/javascript/', $echo_tag=false, $return=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$filename = $path.$name.'.js';
|
$filename = $path.$name.'.js';
|
||||||
|
|
||||||
if ($echo_tag) {
|
if ($echo_tag === true) {
|
||||||
echo '<script type="text/javascript" src="'.ui_get_full_url($filename, false, false, false).'"></script>';
|
$filename .= '?v='.$config['current_package'];
|
||||||
return null;
|
$tag_name = '<script type="text/javascript" src="'.ui_get_full_url($filename, false, false, false).'"></script>';
|
||||||
|
if ($return === false) {
|
||||||
|
echo $tag_name;
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return $tag_name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! isset($config['js'])) {
|
if (! isset($config['js'])) {
|
||||||
|
@ -1004,6 +1004,13 @@ function get_build_setup_charts($type, $options, $data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set display grid true or false.
|
||||||
|
if (isset($options['grid']) === true) {
|
||||||
|
$scales = $chart->options()->getScales();
|
||||||
|
$scales->getX()->grid()->setDrawOnChartArea($options['grid']);
|
||||||
|
$scales->getY()->grid()->setDrawOnChartArea($options['grid']);
|
||||||
|
}
|
||||||
|
|
||||||
// Radius is null maximum possible.
|
// Radius is null maximum possible.
|
||||||
if (isset($options['radius']) === true
|
if (isset($options['radius']) === true
|
||||||
&& empty($options['radius']) === false
|
&& empty($options['radius']) === false
|
||||||
|
@ -11,14 +11,14 @@
|
|||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// 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.
|
||||||
function include_javascript_d3($return=false)
|
function include_javascript_d3($return=false, $force=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
static $is_include_javascript = false;
|
static $is_include_javascript = false;
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
if (!$is_include_javascript) {
|
if (!$is_include_javascript || $force === true) {
|
||||||
$is_include_javascript = true;
|
$is_include_javascript = true;
|
||||||
|
|
||||||
$output .= '<script type="text/javascript" src="';
|
$output .= '<script type="text/javascript" src="';
|
||||||
|
@ -756,9 +756,8 @@ function flot_slicesbar_graph(
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if ($ttl == 2) {
|
if ($ttl == 2) {
|
||||||
$tokem_config = uniqid('slicebar');
|
|
||||||
$params = [
|
$params = [
|
||||||
'tokem_config' => $tokem_config,
|
'graph_data' => $graph_data,
|
||||||
'period' => $period,
|
'period' => $period,
|
||||||
'width' => $width,
|
'width' => $width,
|
||||||
'height' => $height,
|
'height' => $height,
|
||||||
@ -781,9 +780,6 @@ function flot_slicesbar_graph(
|
|||||||
'server_id' => $server_id,
|
'server_id' => $server_id,
|
||||||
];
|
];
|
||||||
|
|
||||||
update_check_config_token($tokem_config, json_encode($graph_data));
|
|
||||||
$_SESSION['slicebar'] = $tokem_config;
|
|
||||||
$_SESSION['slicebar_value'] = json_encode($graph_data);
|
|
||||||
$graph = '<img src="data:image/png;base64,';
|
$graph = '<img src="data:image/png;base64,';
|
||||||
$graph .= generator_chart_to_pdf('slicebar', $params);
|
$graph .= generator_chart_to_pdf('slicebar', $params);
|
||||||
$graph .= '" />';
|
$graph .= '" />';
|
||||||
|
@ -808,8 +808,8 @@ function loadVisualConsoleData(
|
|||||||
getVisualConsoleItems: 1,
|
getVisualConsoleItems: 1,
|
||||||
size: size,
|
size: size,
|
||||||
visualConsoleId: vcId,
|
visualConsoleId: vcId,
|
||||||
id_user: typeof id_user == undefined ? id_user : null,
|
id_user: typeof id_user !== undefined ? id_user : null,
|
||||||
auth_hash: typeof hash == undefined ? hash : null,
|
auth_hash: typeof hash !== undefined ? hash : null,
|
||||||
mode: mode,
|
mode: mode,
|
||||||
widthScreen: widthScreen
|
widthScreen: widthScreen
|
||||||
},
|
},
|
||||||
|
@ -1486,6 +1486,11 @@ var TreeController = {
|
|||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Search service criterion
|
||||||
|
const searchFilter = controller.filter.searchService;
|
||||||
|
if (searchFilter && controller.finded !== 1) {
|
||||||
|
rawTree = _filterItems(rawTree, searchFilter);
|
||||||
|
}
|
||||||
_.each(rawTree, function(element) {
|
_.each(rawTree, function(element) {
|
||||||
element.jqObject = _processNode($group, element);
|
element.jqObject = _processNode($group, element);
|
||||||
});
|
});
|
||||||
@ -1551,6 +1556,67 @@ var TreeController = {
|
|||||||
|
|
||||||
// Add again the hover event to the 'force_callback' elements
|
// Add again the hover event to the 'force_callback' elements
|
||||||
forced_title_callback();
|
forced_title_callback();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the tree based on a search criterion
|
||||||
|
*/
|
||||||
|
function _filterItems(rawTree, searched) {
|
||||||
|
const ancestors = [];
|
||||||
|
const father = [];
|
||||||
|
const newTree = [];
|
||||||
|
const tmpTree = [];
|
||||||
|
rawTree.map((raw, index) => {
|
||||||
|
if (raw.type === "services") {
|
||||||
|
if (raw.servicesChildren.length !== 0) {
|
||||||
|
// search at parent level
|
||||||
|
let descr = raw.description.toLowerCase();
|
||||||
|
let sear = searched.toLowerCase();
|
||||||
|
let findedPadre = descr.indexOf(sear);
|
||||||
|
if (findedPadre === -1) {
|
||||||
|
father.push(raw.id);
|
||||||
|
} else if (findedPadre >= 0) {
|
||||||
|
ancestors.push(raw.id);
|
||||||
|
} else {
|
||||||
|
//we mark the father as found
|
||||||
|
controller.finded = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let finded = raw.description.indexOf(searched);
|
||||||
|
if (finded === -1) {
|
||||||
|
delete rawTree[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (ancestors.length >= 1) {
|
||||||
|
ancestors.map(ancestor => {
|
||||||
|
newTree.push(
|
||||||
|
rawTree.filter(item => item.id === parseInt(ancestor))
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
return newTree[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (father.length >= 1) {
|
||||||
|
let filterfather = [...new Set(father)];
|
||||||
|
|
||||||
|
filterfather.map(father => {
|
||||||
|
tmpTree.push(rawTree.filter(raw => raw.id == father));
|
||||||
|
});
|
||||||
|
|
||||||
|
let tree = [...new Set(tmpTree)];
|
||||||
|
tree.map(item => {
|
||||||
|
let tmpItem = item[0];
|
||||||
|
newTree.push(tmpItem);
|
||||||
|
});
|
||||||
|
|
||||||
|
return newTree;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rawTree.filter(item => item);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
load: function() {
|
load: function() {
|
||||||
this.reload();
|
this.reload();
|
||||||
|
@ -466,6 +466,10 @@ class Widget
|
|||||||
$className .= '\HeatmapWidget';
|
$className .= '\HeatmapWidget';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'service_level':
|
||||||
|
$className .= '\ServiceLevelWidget';
|
||||||
|
break;
|
||||||
|
|
||||||
case 'security_hardening':
|
case 'security_hardening':
|
||||||
if (\enterprise_installed() === false) {
|
if (\enterprise_installed() === false) {
|
||||||
$not_installed = true;
|
$not_installed = true;
|
||||||
|
@ -581,6 +581,12 @@ class EventsListWidget extends Widget
|
|||||||
$customFilter = \events_get_event_filter($this->values['customFilter']);
|
$customFilter = \events_get_event_filter($this->values['customFilter']);
|
||||||
if ($customFilter !== false) {
|
if ($customFilter !== false) {
|
||||||
$filter = $customFilter;
|
$filter = $customFilter;
|
||||||
|
if (in_array('0', $this->values['groupId'])) {
|
||||||
|
$filter['id_group_filter'] = 0;
|
||||||
|
} else {
|
||||||
|
$filter['id_group_filter'] = (!empty($this->values['groupId'][0])) ? $this->values['groupId'] : 0;
|
||||||
|
}
|
||||||
|
|
||||||
$filter['tag_with'] = base64_encode(
|
$filter['tag_with'] = base64_encode(
|
||||||
io_safe_output($filter['tag_with'])
|
io_safe_output($filter['tag_with'])
|
||||||
);
|
);
|
||||||
|
672
pandora_console/include/lib/Dashboard/Widgets/service_level.php
Normal file
672
pandora_console/include/lib/Dashboard/Widgets/service_level.php
Normal file
@ -0,0 +1,672 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Widget Service Level Pandora FMS Console
|
||||||
|
*
|
||||||
|
* @category Console Class
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Widget Service Level
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2023 Pandora FMS
|
||||||
|
* Please see https://pandorafms.com/community/ for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PandoraFMS\Dashboard;
|
||||||
|
use PandoraFMS\Agent;
|
||||||
|
use PandoraFMS\Module;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service Level Widgets
|
||||||
|
*/
|
||||||
|
class ServiceLevelWidget 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;
|
||||||
|
|
||||||
|
include_once $config['homedir'].'/include/functions_agents.php';
|
||||||
|
include_once $config['homedir'].'/include/functions_modules.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->decoders($this->getOptionsWidget());
|
||||||
|
|
||||||
|
// Positions.
|
||||||
|
$this->position = $this->getPositionWidget();
|
||||||
|
|
||||||
|
// Page.
|
||||||
|
$this->page = basename(__FILE__);
|
||||||
|
|
||||||
|
// ClassName.
|
||||||
|
$class = new \ReflectionClass($this);
|
||||||
|
$this->className = $class->getShortName();
|
||||||
|
|
||||||
|
// Title.
|
||||||
|
$this->title = __('Service Level Detail');
|
||||||
|
|
||||||
|
// Name.
|
||||||
|
if (empty($this->name) === true) {
|
||||||
|
$this->name = 'service_level';
|
||||||
|
}
|
||||||
|
|
||||||
|
// This forces at least a first configuration.
|
||||||
|
$this->configurationRequired = false;
|
||||||
|
if (isset($this->values['mModules']) === false) {
|
||||||
|
$this->configurationRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->overflow_scrollbars = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decoders hack for retrocompability.
|
||||||
|
*
|
||||||
|
* @param array $decoder Values.
|
||||||
|
*
|
||||||
|
* @return array Returns the values with the correct key.
|
||||||
|
*/
|
||||||
|
public function decoders(array $decoder): array
|
||||||
|
{
|
||||||
|
$values = [];
|
||||||
|
// Retrieve global - common inputs.
|
||||||
|
$values = parent::decoders($decoder);
|
||||||
|
|
||||||
|
if (isset($decoder['interval']) === true) {
|
||||||
|
$values['interval'] = $decoder['interval'];
|
||||||
|
} else {
|
||||||
|
$values['interval'] = '28800';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['show_agents']) === true) {
|
||||||
|
$values['show_agents'] = $decoder['show_agents'];
|
||||||
|
} else {
|
||||||
|
$values['show_agents'] = '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['mTypeShow']) === true) {
|
||||||
|
$values['mTypeShow'] = $decoder['mTypeShow'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['mGroup']) === true) {
|
||||||
|
$values['mGroup'] = $decoder['mGroup'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['mRecursion']) === true) {
|
||||||
|
$values['mRecursion'] = $decoder['mRecursion'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['mModuleGroup']) === true) {
|
||||||
|
$values['mModuleGroup'] = $decoder['mModuleGroup'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['mAgents']) === true) {
|
||||||
|
$values['mAgents'] = $decoder['mAgents'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['mShowCommonModules']) === true) {
|
||||||
|
$values['mShowCommonModules'] = $decoder['mShowCommonModules'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['mModules']) === true) {
|
||||||
|
$values['mModules'] = $decoder['mModules'];
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
// Interval.
|
||||||
|
$fields = [
|
||||||
|
'604800' => __('1 week'),
|
||||||
|
'172800' => __('48 hours'),
|
||||||
|
'86400' => __('24 hours'),
|
||||||
|
'43200' => __('12 hours'),
|
||||||
|
'28800' => __('8 hours'),
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
$inputs[] = [
|
||||||
|
'label' => __('Interval'),
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'select',
|
||||||
|
'fields' => $fields,
|
||||||
|
'name' => 'interval-'.$this->cellId,
|
||||||
|
'selected' => $values['interval'],
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Show agent.
|
||||||
|
$inputs[] = [
|
||||||
|
'label' => __('Show agents'),
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'switch',
|
||||||
|
'name' => 'show_agents-'.$this->cellId,
|
||||||
|
'value' => $values['show_agents'],
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$return_all_group = false;
|
||||||
|
|
||||||
|
if (users_can_manage_group_all('RM') || $this->values['mGroup'] == 0) {
|
||||||
|
$return_all_group = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$mgroup = '';
|
||||||
|
if (isset($this->values['mGroup']) === false) {
|
||||||
|
$sql = sprintf(
|
||||||
|
'SELECT id_group FROM tdashboard WHERE id = %d',
|
||||||
|
$this->dashboardId
|
||||||
|
);
|
||||||
|
|
||||||
|
$group_dahsboard = db_get_value_sql($sql);
|
||||||
|
if ($group_dahsboard > 0) {
|
||||||
|
$mgroup = $group_dahsboard;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
$this->values['mAgents'] = $this->getIdCacheAgent($this->values['mAgents']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$inputs[] = [
|
||||||
|
'class' => 'flex flex-row',
|
||||||
|
'id' => 'select_multiple_modules_filtered',
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'select_multiple_modules_filtered',
|
||||||
|
'uniqId' => $this->cellId,
|
||||||
|
'mGroup' => (isset($this->values['mGroup']) === true) ? $this->values['mGroup'] : $mgroup,
|
||||||
|
'mRecursion' => (isset($this->values['mRecursion']) === true) ? $this->values['mRecursion'] : '',
|
||||||
|
'mModuleGroup' => (isset($this->values['mModuleGroup']) === true) ? $this->values['mModuleGroup'] : '',
|
||||||
|
'mAgents' => (isset($this->values['mAgents']) === true) ? $this->values['mAgents'] : '',
|
||||||
|
'mShowCommonModules' => (isset($this->values['mShowCommonModules']) === true) ? $this->values['mShowCommonModules'] : '',
|
||||||
|
'mModules' => (isset($this->values['mModules']) === true) ? $this->values['mModules'] : '',
|
||||||
|
'mShowSelectedOtherGroups' => true,
|
||||||
|
'mReturnAllGroup' => $return_all_group,
|
||||||
|
'mMetaFields' => ((bool) is_metaconsole()),
|
||||||
|
'commonModulesSwitch' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
return $inputs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Post for widget.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getPost():array
|
||||||
|
{
|
||||||
|
// Retrieve global - common inputs.
|
||||||
|
$values = parent::getPost();
|
||||||
|
|
||||||
|
$values['interval'] = \get_parameter('interval-'.$this->cellId, '28800');
|
||||||
|
|
||||||
|
$values['show_agents'] = \get_parameter('show_agents-'.$this->cellId, '0');
|
||||||
|
|
||||||
|
$values['mTypeShow'] = \get_parameter(
|
||||||
|
'filtered-type-show-'.$this->cellId
|
||||||
|
);
|
||||||
|
|
||||||
|
$values['mGroup'] = \get_parameter(
|
||||||
|
'filtered-module-group-'.$this->cellId
|
||||||
|
);
|
||||||
|
$values['mRecursion'] = \get_parameter_switch(
|
||||||
|
'filtered-module-recursion-'.$this->cellId
|
||||||
|
);
|
||||||
|
$values['mModuleGroup'] = \get_parameter(
|
||||||
|
'filtered-module-module-group-'.$this->cellId
|
||||||
|
);
|
||||||
|
$values['mAgents'] = \get_parameter(
|
||||||
|
'filtered-module-agents-'.$this->cellId
|
||||||
|
);
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
$values['mAgents'] = $this->getRealIdAgentNode($values['mAgents']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$values['mShowCommonModules'] = \get_parameter(
|
||||||
|
'filtered-module-show-common-modules-'.$this->cellId
|
||||||
|
);
|
||||||
|
$values['mModules'] = explode(
|
||||||
|
',',
|
||||||
|
\get_parameter(
|
||||||
|
'filtered-module-modules-'.$this->cellId
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return $values;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw widget.
|
||||||
|
*
|
||||||
|
* @return string;
|
||||||
|
*/
|
||||||
|
public function load()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$output = '';
|
||||||
|
if (check_acl($config['id_user'], 0, 'AR') === 0) {
|
||||||
|
$output .= '<div class="container-center">';
|
||||||
|
$output .= ui_print_error_message(
|
||||||
|
__('You don\'t have access'),
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$output .= '</div>';
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
$interval_range = [];
|
||||||
|
$current_timestamp = time();
|
||||||
|
$interval_range['start'] = ($current_timestamp - $this->values['interval']);
|
||||||
|
$interval_range['end'] = $current_timestamp;
|
||||||
|
|
||||||
|
$reduceAllModules = array_reduce(
|
||||||
|
$this->values['mModules'],
|
||||||
|
function ($carry, $item) {
|
||||||
|
if ($item === null) {
|
||||||
|
return $carry;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
$item = explode('|', $item);
|
||||||
|
$serverId = $item[0];
|
||||||
|
$fullname = $item[1];
|
||||||
|
if ($this->values['mShowCommonModules'] !== 'on') {
|
||||||
|
$item = explode(' » ', $fullname);
|
||||||
|
$name = $item[1];
|
||||||
|
$carry['modules_selected'][$serverId][$name] = null;
|
||||||
|
$carry['modules'][$name] = null;
|
||||||
|
} else {
|
||||||
|
$carry['modules'][$fullname] = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$carry['modules'][$item] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $carry;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$allModules = $reduceAllModules['modules'];
|
||||||
|
$visualData = [];
|
||||||
|
// Extract info agents selected.
|
||||||
|
$target_agents = explode(',', $this->values['mAgents']);
|
||||||
|
foreach ($target_agents as $agent_id) {
|
||||||
|
try {
|
||||||
|
if (is_metaconsole() === true && str_contains($agent_id, '|') === true) {
|
||||||
|
$server_agent = explode('|', $agent_id);
|
||||||
|
} else {
|
||||||
|
$id_agente = $agent_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((bool) is_metaconsole() === true) {
|
||||||
|
if (isset($server_agent) === true) {
|
||||||
|
$id_agente = $server_agent[1];
|
||||||
|
$tserver = $server_agent[0];
|
||||||
|
} else {
|
||||||
|
$tmeta_agent = db_get_row_filter(
|
||||||
|
'tmetaconsole_agent',
|
||||||
|
[ 'id_agente' => $id_agente ]
|
||||||
|
);
|
||||||
|
$id_agente = $tmeta_agent['id_tagente'];
|
||||||
|
$tserver = $tmeta_agent['id_tmetaconsole_setup'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (metaconsole_connect(null, $tserver) !== NOERR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$agent = new Agent((int) $id_agente);
|
||||||
|
$visualData[$agent_id]['agent_status'] = $agent->lastStatus();
|
||||||
|
$visualData[$agent_id]['agent_name'] = $agent->name();
|
||||||
|
$visualData[$agent_id]['agent_alias'] = $agent->alias();
|
||||||
|
$visualData[$agent_id]['modules'] = [];
|
||||||
|
if (empty($allModules) === false) {
|
||||||
|
if (is_metaconsole() === true && $this->values['mShowCommonModules'] !== 'on') {
|
||||||
|
if (isset($reduceAllModules['modules_selected'][$tserver]) === true) {
|
||||||
|
$modules = $agent->searchModules(
|
||||||
|
['nombre' => array_keys($reduceAllModules['modules_selected'][$tserver])]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$modules = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$modules = $agent->searchModules(
|
||||||
|
['nombre' => array_keys($allModules)]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$visualData[$agent_id]['modules'] = $allModules;
|
||||||
|
|
||||||
|
if ((bool) is_metaconsole() === true) {
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($modules as $module) {
|
||||||
|
if ($module === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data_module_array = $module->toArray();
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()] = [];
|
||||||
|
$last_status = $module->getStatus()->toArray();
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['last_status_change'] = $last_status['last_status_change'];
|
||||||
|
|
||||||
|
// Mean Time Between Failure.
|
||||||
|
// Mean Time To Solution.
|
||||||
|
// Availability.
|
||||||
|
if ((bool) is_metaconsole() === true) {
|
||||||
|
$module_id = $tserver.'|'.$data_module_array['id_agente_modulo'];
|
||||||
|
} else {
|
||||||
|
$module_id = $data_module_array['id_agente_modulo'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$module_data = service_level_module_data($interval_range['start'], $interval_range['end'], $module_id);
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['mtrs'] = ($module_data['mtrs'] !== false) ? human_milliseconds_to_string(($module_data['mtrs'] * 100), 'short') : '-';
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['mtbf'] = ($module_data['mtbf'] !== false) ? human_milliseconds_to_string(($module_data['mtbf'] * 100), 'short') : '-';
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['availability'] = ($module_data['availability'] !== false) ? $module_data['availability'] : '100';
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['critical_events'] = ($module_data['critical_events'] !== false) ? $module_data['critical_events'] : '';
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['warning_events'] = ($module_data['warning_events'] !== false) ? $module_data['warning_events'] : '';
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['last_status_change'] = ($module_data['last_status_change'] !== false) ? $module_data['last_status_change'] : '';
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['agent_alias'] = ($module_data['agent_alias'] !== false) ? $module_data['agent_alias'] : '';
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['module_name'] = ($module_data['module_name'] !== false) ? $module_data['module_name'] : '';
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
echo 'Error: ['.$agent_id.']'.$e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$table = new \stdClass();
|
||||||
|
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->class = 'databox filters filter-table-adv';
|
||||||
|
|
||||||
|
$table->head = [];
|
||||||
|
$show_agents = $this->values['show_agents'];
|
||||||
|
if ($show_agents === 'on') {
|
||||||
|
$table->head[0] = __('Agent / Modules');
|
||||||
|
} else {
|
||||||
|
$table->head[0] = __('Modules');
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->head[1] = __('% Av.');
|
||||||
|
$table->head[2] = __('MTBF');
|
||||||
|
$table->head[3] = __('MTRS');
|
||||||
|
$table->head[4] = __('Crit. Events').ui_print_help_tip(__('Counted only critical events generated automatic by the module'), true);
|
||||||
|
$table->head[5] = __('Warn. Events').ui_print_help_tip(__('Counted only warning events generated automatic by the module'), true);
|
||||||
|
$table->head[6] = __('Last change');
|
||||||
|
$table->data = [];
|
||||||
|
$table->cellstyle = [];
|
||||||
|
$row = 0;
|
||||||
|
foreach ($visualData as $agent_id => $data) {
|
||||||
|
foreach ($data['modules'] as $module_name => $module_data) {
|
||||||
|
if (isset($module_data) === true) {
|
||||||
|
if ($show_agents === 'on') {
|
||||||
|
$table->data[$row][0] = $module_data['agent_alias'].' / '.$module_data['module_name'];
|
||||||
|
$table->cellstyle[$row][0] = 'text-align:left';
|
||||||
|
} else {
|
||||||
|
$table->data[$row][0] = $module_data['module_name'];
|
||||||
|
$table->cellstyle[$row][0] = 'text-align:left';
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->data[$row][1] = $module_data['availability'].'%';
|
||||||
|
$table->data[$row][2] = $module_data['mtbf'];
|
||||||
|
$table->data[$row][3] = $module_data['mtrs'];
|
||||||
|
$table->data[$row][4] = $module_data['critical_events'];
|
||||||
|
$table->data[$row][5] = $module_data['warning_events'];
|
||||||
|
$table->data[$row][6] = date(TIME_FORMAT, $module_data['last_status_change']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$row++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$height = (count($table->data) * 32);
|
||||||
|
$style = 'min-width:400px; min-height:'.$height.'px;';
|
||||||
|
$output = '<div class="container-top" style="'.$style.'">';
|
||||||
|
$output .= html_print_table($table, true);
|
||||||
|
$output .= '</div>';
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get description.
|
||||||
|
*
|
||||||
|
* @return string.
|
||||||
|
*/
|
||||||
|
public static function getDescription()
|
||||||
|
{
|
||||||
|
return __('Service Level Detail');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Name.
|
||||||
|
*
|
||||||
|
* @return string.
|
||||||
|
*/
|
||||||
|
public static function getName()
|
||||||
|
{
|
||||||
|
return 'service_level';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get size Modal Configuration.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getSizeModalConfiguration(): array
|
||||||
|
{
|
||||||
|
$size = [
|
||||||
|
'width' => 800,
|
||||||
|
'height' => 270,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return array with the real id agent and server.
|
||||||
|
*
|
||||||
|
* @param string $id_agents_cache String with the agents cache id.
|
||||||
|
*
|
||||||
|
* @return string $agents_servers with the real id agent and server.
|
||||||
|
*/
|
||||||
|
public function getRealIdAgentNode($id_agents_cache)
|
||||||
|
{
|
||||||
|
$agents_servers = [];
|
||||||
|
$target_agents = explode(',', $id_agents_cache);
|
||||||
|
foreach ($target_agents as $agent_id) {
|
||||||
|
$id_agente = $agent_id;
|
||||||
|
$tmeta_agent = db_get_row_filter(
|
||||||
|
'tmetaconsole_agent',
|
||||||
|
['id_agente' => $id_agente]
|
||||||
|
);
|
||||||
|
|
||||||
|
$id_agente = $tmeta_agent['id_tagente'];
|
||||||
|
$tserver = $tmeta_agent['id_tmetaconsole_setup'];
|
||||||
|
$agents_servers[] = $tserver.'|'.$id_agente;
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(',', $agents_servers);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return string with the cache id agent in metaconsole.
|
||||||
|
*
|
||||||
|
* @param string $id_agents String with the agents and server id.
|
||||||
|
*
|
||||||
|
* @return string $cache_id_agents with the cache id agent.
|
||||||
|
*/
|
||||||
|
public function getIdCacheAgent($id_agents)
|
||||||
|
{
|
||||||
|
$target_agents = explode(',', $id_agents);
|
||||||
|
$cache_id_agents = [];
|
||||||
|
foreach ($target_agents as $agent_id) {
|
||||||
|
if (str_contains($agent_id, '|') === false) {
|
||||||
|
$cache_id_agents[] = $agent_id;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$server_agent = explode('|', $agent_id);
|
||||||
|
$tmeta_agent = db_get_row_filter(
|
||||||
|
'tmetaconsole_agent',
|
||||||
|
[
|
||||||
|
'id_tagente' => $server_agent[1],
|
||||||
|
'id_tmetaconsole_setup' => $server_agent[0],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$cache_id_agents[] = $tmeta_agent['id_agente'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(',', $cache_id_agents);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1196,7 +1196,7 @@ class Item extends CachedModel
|
|||||||
'operation/visual_console/view',
|
'operation/visual_console/view',
|
||||||
['id' => $vcId],
|
['id' => $vcId],
|
||||||
// No autologin from the public view.
|
// No autologin from the public view.
|
||||||
!$config['public_view'],
|
!$config['public_access'],
|
||||||
$mobile_navigation,
|
$mobile_navigation,
|
||||||
[
|
[
|
||||||
'page' => 'visualmap',
|
'page' => 'visualmap',
|
||||||
@ -1302,7 +1302,7 @@ class Item extends CachedModel
|
|||||||
'enterprise/operation/services/services',
|
'enterprise/operation/services/services',
|
||||||
['id_service' => $serviceId],
|
['id_service' => $serviceId],
|
||||||
// No autologin from the public view.
|
// No autologin from the public view.
|
||||||
!$config['public_view']
|
!$config['public_access']
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// A regular module.
|
// A regular module.
|
||||||
@ -1312,7 +1312,7 @@ class Item extends CachedModel
|
|||||||
'operation/agentes/status_monitor',
|
'operation/agentes/status_monitor',
|
||||||
['id_module' => $moduleId],
|
['id_module' => $moduleId],
|
||||||
// No autologin from the public view.
|
// No autologin from the public view.
|
||||||
!((isset($config['public_view']) === true) ? $config['public_view'] : false),
|
!((isset($config['public_access']) === true) ? $config['public_access'] : false),
|
||||||
$mobile_navigation,
|
$mobile_navigation,
|
||||||
[
|
[
|
||||||
'id' => $moduleId,
|
'id' => $moduleId,
|
||||||
@ -1377,7 +1377,7 @@ class Item extends CachedModel
|
|||||||
'operation/agentes/ver_agente',
|
'operation/agentes/ver_agente',
|
||||||
['id_agente' => $agentId],
|
['id_agente' => $agentId],
|
||||||
// No autologin from the public view.
|
// No autologin from the public view.
|
||||||
!$config['public_view'],
|
!$config['public_access'],
|
||||||
$mobile_navigation,
|
$mobile_navigation,
|
||||||
[
|
[
|
||||||
'id' => $agentId,
|
'id' => $agentId,
|
||||||
|
@ -120,6 +120,23 @@ final class EventsHistory extends Item
|
|||||||
$moduleId = static::parseIntOr($linkedModule['moduleId'], null);
|
$moduleId = static::parseIntOr($linkedModule['moduleId'], null);
|
||||||
$legendColor = static::extractLegendColor($data);
|
$legendColor = static::extractLegendColor($data);
|
||||||
|
|
||||||
|
$metaconsoleId = $linkedModule['metaconsoleId'];
|
||||||
|
|
||||||
|
// Maybe connect to node.
|
||||||
|
$nodeConnected = false;
|
||||||
|
if (\is_metaconsole() === true && $metaconsoleId !== null) {
|
||||||
|
$nodeConnected = \metaconsole_connect(
|
||||||
|
null,
|
||||||
|
$metaconsoleId
|
||||||
|
) === NOERR;
|
||||||
|
|
||||||
|
if ($nodeConnected === false) {
|
||||||
|
throw new \InvalidArgumentException(
|
||||||
|
'error connecting to the node'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($agentId === null) {
|
if ($agentId === null) {
|
||||||
throw new \InvalidArgumentException('missing agent Id');
|
throw new \InvalidArgumentException('missing agent Id');
|
||||||
}
|
}
|
||||||
@ -166,6 +183,11 @@ final class EventsHistory extends Item
|
|||||||
|
|
||||||
$data['html'] = $html;
|
$data['html'] = $html;
|
||||||
|
|
||||||
|
// Restore connection.
|
||||||
|
if ($nodeConnected === true) {
|
||||||
|
\metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,6 +284,11 @@ li#div-textarea label {
|
|||||||
display: initial;
|
display: initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content-widget .container-top {
|
||||||
|
height: 100%;
|
||||||
|
width: 99%;
|
||||||
|
}
|
||||||
|
|
||||||
.widget-groups-status {
|
.widget-groups-status {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
@ -8764,6 +8764,10 @@ div.graph div.legend table {
|
|||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.underline-hover:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
.w105px {
|
.w105px {
|
||||||
width: 105px;
|
width: 105px;
|
||||||
}
|
}
|
||||||
@ -12882,6 +12886,12 @@ tr.shown td.details-control {
|
|||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.basic-options-disabled tr > td,
|
||||||
|
.basic-options-disabled tr > td > div > label {
|
||||||
|
color: gray;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
#cluetip-inner > #example {
|
#cluetip-inner > #example {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
|
@ -784,6 +784,11 @@ form ul.form_flex {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content-widget .container-top {
|
||||||
|
height: 100%;
|
||||||
|
width: 99%;
|
||||||
|
}
|
||||||
|
|
||||||
.container-layout {
|
.container-layout {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
border: 3px dashed #fff;
|
border: 3px dashed #fff;
|
||||||
|
@ -132,6 +132,11 @@
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#filter-agent-security div {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 1500px) {
|
@media (max-width: 1500px) {
|
||||||
.col-md-3 {
|
.col-md-3 {
|
||||||
width: 40%;
|
width: 40%;
|
||||||
|
@ -743,6 +743,9 @@ p {
|
|||||||
margin-block-end: 1em;
|
margin-block-end: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strong {
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
/* Styles for the solid icons */
|
/* Styles for the solid icons */
|
||||||
|
|
||||||
.fa {
|
.fa {
|
||||||
|
File diff suppressed because one or more lines are too long
@ -131,7 +131,7 @@
|
|||||||
<div style='padding-bottom: 50px'>
|
<div style='padding-bottom: 50px'>
|
||||||
<?php
|
<?php
|
||||||
$version = '7.0NG.774';
|
$version = '7.0NG.774';
|
||||||
$build = '231201';
|
$build = '231213';
|
||||||
$banner = "v$version Build $build";
|
$banner = "v$version Build $build";
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
|
|
||||||
|
@ -121,8 +121,11 @@ if (empty($agent['os_version']) !== true) {
|
|||||||
$os_agent_text = $os_version.' ('.$os_version_name[1].')';
|
$os_agent_text = $os_version.' ('.$os_version_name[1].')';
|
||||||
} else {
|
} else {
|
||||||
$os_name = preg_split('/[0-9]/', $agent['os_version'])[0];
|
$os_name = preg_split('/[0-9]/', $agent['os_version'])[0];
|
||||||
$os_version = explode($os_name, explode('(', $agent['os_version'])[0])[1];
|
$os_agent_text = $agent['os_version'];
|
||||||
$os_agent_text = $os_version;
|
if (empty($os_name) === false) {
|
||||||
|
$os_version = explode($os_name, explode('(', $agent['os_version'])[0])[1];
|
||||||
|
$os_agent_text = $os_version;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1205,57 +1205,6 @@ if (is_ajax() === true) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($get_agents_in_group) {
|
|
||||||
$id = (int) get_parameter('id', 0);
|
|
||||||
$group = (int) get_parameter('group', -1);
|
|
||||||
|
|
||||||
$return = [];
|
|
||||||
$return['correct'] = false;
|
|
||||||
|
|
||||||
if ($group != -1) {
|
|
||||||
$where_id_agente = ' 1=1 ';
|
|
||||||
|
|
||||||
$agents_in_networkmap = db_get_all_rows_filter(
|
|
||||||
'titem',
|
|
||||||
[
|
|
||||||
'id_map' => $id,
|
|
||||||
'deleted' => 0,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
if ($agents_in_networkmap !== false) {
|
|
||||||
$ids = [];
|
|
||||||
foreach ($agents_in_networkmap as $agent) {
|
|
||||||
if ($agent['type'] == 0) {
|
|
||||||
$ids[] = $agent['source_data'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$where_id_agente = ' id_agente NOT IN ('.implode(',', $ids).')';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$sql = 'SELECT id_agente, alias
|
|
||||||
FROM tagente
|
|
||||||
WHERE id_grupo = '.$group.' AND '.$where_id_agente.'
|
|
||||||
ORDER BY alias ASC';
|
|
||||||
|
|
||||||
$agents = db_get_all_rows_sql($sql);
|
|
||||||
|
|
||||||
if ($agents !== false) {
|
|
||||||
$return['agents'] = [];
|
|
||||||
foreach ($agents as $agent) {
|
|
||||||
$return['agents'][$agent['id_agente']] = $agent['alias'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$return['correct'] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode($return);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($get_agent_info) {
|
if ($get_agent_info) {
|
||||||
$id_agent = (int) get_parameter('id_agent');
|
$id_agent = (int) get_parameter('id_agent');
|
||||||
|
|
||||||
|
@ -1890,6 +1890,13 @@ if (enterprise_hook(
|
|||||||
'eventos',
|
'eventos',
|
||||||
'execute_event_responses',
|
'execute_event_responses',
|
||||||
]
|
]
|
||||||
|
) === false && enterprise_hook(
|
||||||
|
'enterprise_acl',
|
||||||
|
[
|
||||||
|
$config['id_user'],
|
||||||
|
'eventos',
|
||||||
|
'operation/events/events',
|
||||||
|
]
|
||||||
) === false
|
) === false
|
||||||
) {
|
) {
|
||||||
$readonly = true;
|
$readonly = true;
|
||||||
|
@ -1289,6 +1289,10 @@ if ($inventory_module !== 'basic') {
|
|||||||
$style = 'width: 100%';
|
$style = 'width: 100%';
|
||||||
$ordering = true;
|
$ordering = true;
|
||||||
$searching = false;
|
$searching = false;
|
||||||
|
$search = [];
|
||||||
|
if (strlen($inventory_search_string) > 0) {
|
||||||
|
$search['value'] = $inventory_search_string;
|
||||||
|
}
|
||||||
|
|
||||||
$columns = [
|
$columns = [
|
||||||
'alias',
|
'alias',
|
||||||
@ -1338,6 +1342,7 @@ if ($inventory_module !== 'basic') {
|
|||||||
'get_data_basic_info' => 1,
|
'get_data_basic_info' => 1,
|
||||||
'id_agent' => $id_agente,
|
'id_agent' => $id_agente,
|
||||||
'id_group' => $inventory_id_group,
|
'id_group' => $inventory_id_group,
|
||||||
|
'search' => $search,
|
||||||
],
|
],
|
||||||
'zeroRecords' => __('Agent info not found'),
|
'zeroRecords' => __('Agent info not found'),
|
||||||
'emptyTable' => __('Agent info not found'),
|
'emptyTable' => __('Agent info not found'),
|
||||||
|
@ -76,15 +76,15 @@ if ($searchAgents) {
|
|||||||
$sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress
|
$sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress
|
||||||
INNER JOIN taddress_agent ON
|
INNER JOIN taddress_agent ON
|
||||||
taddress.id_a = taddress_agent.id_a
|
taddress.id_a = taddress_agent.id_a
|
||||||
WHERE taddress.ip LIKE '$stringSearchSQL'";
|
WHERE LOWER(REPLACE(taddress.ip, ' ', ' ')) LIKE LOWER('$stringSearchSQL')";
|
||||||
|
|
||||||
$id = db_get_all_rows_sql($sql);
|
$id = db_get_all_rows_sql($sql);
|
||||||
if ($id != '') {
|
if ($id != '') {
|
||||||
$aux = $id[0]['id_agent'];
|
$aux = $id[0]['id_agent'];
|
||||||
$search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR
|
$search_sql = " LOWER(REPLACE(t1.nombre, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t2.nombre LIKE '".$stringSearchSQL."' OR
|
LOWER(REPLACE(t2.nombre, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t1.alias LIKE '".$stringSearchSQL."' OR
|
LOWER(REPLACE(t1.alias, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t1.comentarios LIKE '".$stringSearchSQL."' OR
|
LOWER(REPLACE(t1.comentarios, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t1.id_agente =".$aux;
|
t1.id_agente =".$aux;
|
||||||
|
|
||||||
$idCount = count($id);
|
$idCount = count($id);
|
||||||
@ -96,16 +96,16 @@ if ($searchAgents) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR
|
$search_sql = " LOWER(REPLACE(t1.nombre, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t2.nombre LIKE '".$stringSearchSQL."' OR
|
LOWER(REPLACE(t2.nombre, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t1.direccion LIKE '".$stringSearchSQL."' OR
|
LOWER(REPLACE(t1.direccion, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t1.comentarios LIKE '".$stringSearchSQL."' OR
|
LOWER(REPLACE(t1.comentarios, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
|
||||||
t1.alias LIKE '".$stringSearchSQL."'";
|
LOWER(REPLACE(t1.alias, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."')";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($has_secondary === true) {
|
if ($has_secondary === true) {
|
||||||
$search_sql .= " OR (tasg.id_group IS NOT NULL AND
|
$search_sql .= " OR (tasg.id_group IS NOT NULL AND
|
||||||
tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE nombre LIKE '".$stringSearchSQL."'))";
|
tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE LOWER(REPLACE(nombre, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."')))";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
|
@ -139,64 +139,64 @@ if ($searchAlerts) {
|
|||||||
switch ($config['dbtype']) {
|
switch ($config['dbtype']) {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
$whereAlerts = 'AND (
|
$whereAlerts = 'AND (
|
||||||
id_alert_template IN (SELECT id FROM talert_templates WHERE name LIKE "%'.$stringSearchSQL.'%") OR
|
id_alert_template IN (SELECT id FROM talert_templates WHERE REPLACE(name, " ", " ") LIKE "%'.$stringSearchSQL.'%") OR
|
||||||
id_alert_template IN (
|
id_alert_template IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM talert_templates
|
FROM talert_templates
|
||||||
WHERE id_alert_action IN (
|
WHERE id_alert_action IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM talert_actions
|
FROM talert_actions
|
||||||
WHERE name LIKE "%'.$stringSearchSQL.'%")) OR
|
WHERE REPLACE(name, " ", " ") LIKE "%'.$stringSearchSQL.'%")) OR
|
||||||
talert_template_modules.id IN (
|
talert_template_modules.id IN (
|
||||||
SELECT id_alert_template_module
|
SELECT id_alert_template_module
|
||||||
FROM talert_template_module_actions
|
FROM talert_template_module_actions
|
||||||
WHERE id_alert_action IN (
|
WHERE id_alert_action IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM talert_actions
|
FROM talert_actions
|
||||||
WHERE name LIKE "%'.$stringSearchSQL.'%")) OR
|
WHERE REPLACE(name, " ", " ") LIKE "%'.$stringSearchSQL.'%")) OR
|
||||||
id_agent_module IN (
|
id_agent_module IN (
|
||||||
SELECT id_agente_modulo
|
SELECT id_agente_modulo
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
WHERE nombre LIKE "%'.$stringSearchSQL.'%") OR
|
WHERE REPLACE(nombre, " ", " ") LIKE "%'.$stringSearchSQL.'%") OR
|
||||||
id_agent_module IN (
|
id_agent_module IN (
|
||||||
SELECT id_agente_modulo
|
SELECT id_agente_modulo
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
WHERE id_agente IN (
|
WHERE id_agente IN (
|
||||||
SELECT id_agente
|
SELECT id_agente
|
||||||
FROM tagente
|
FROM tagente
|
||||||
WHERE nombre LIKE "%'.$stringSearchSQL.'%" '.$extra_sql.'))
|
WHERE REPLACE(nombre, " ", " ") LIKE "%'.$stringSearchSQL.'%" '.$extra_sql.'))
|
||||||
)';
|
)';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'postgresql':
|
case 'postgresql':
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
$whereAlerts = 'AND (
|
$whereAlerts = 'AND (
|
||||||
id_alert_template IN (SELECT id FROM talert_templates WHERE upper(name) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR
|
id_alert_template IN (SELECT id FROM talert_templates WHERE upper(REPLACE(name, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR
|
||||||
id_alert_template IN (
|
id_alert_template IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM talert_templates
|
FROM talert_templates
|
||||||
WHERE id_alert_action IN (
|
WHERE id_alert_action IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM talert_actions
|
FROM talert_actions
|
||||||
WHERE upper(name) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR
|
WHERE upper(REPLACE(name, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR
|
||||||
talert_template_modules.id IN (
|
talert_template_modules.id IN (
|
||||||
SELECT id_alert_template_module
|
SELECT id_alert_template_module
|
||||||
FROM talert_template_module_actions
|
FROM talert_template_module_actions
|
||||||
WHERE id_alert_action IN (
|
WHERE id_alert_action IN (
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM talert_actions
|
FROM talert_actions
|
||||||
WHERE upper(name) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR
|
WHERE upper(REPLACE(name, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR
|
||||||
id_agent_module IN (
|
id_agent_module IN (
|
||||||
SELECT id_agente_modulo
|
SELECT id_agente_modulo
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
WHERE upper(nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR
|
WHERE upper(REPLACE(nombre, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR
|
||||||
id_agent_module IN (
|
id_agent_module IN (
|
||||||
SELECT id_agente_modulo
|
SELECT id_agente_modulo
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
WHERE id_agente IN (
|
WHERE id_agente IN (
|
||||||
SELECT id_agente
|
SELECT id_agente
|
||||||
FROM tagente
|
FROM tagente
|
||||||
WHERE upper(nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\' '.$extra_sql.'))
|
WHERE upper(REPLACE(nombre, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\' '.$extra_sql.'))
|
||||||
)';
|
)';
|
||||||
$agents = false;
|
$agents = false;
|
||||||
break;
|
break;
|
||||||
|
@ -31,7 +31,7 @@ if ($searchGraphs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$filter = [];
|
$filter = [];
|
||||||
$filter[] = "(upper(name) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(description) LIKE '%$".strtolower($stringSearchSQL)."%')";
|
$filter[] = "(upper(REPLACE(name, ' ', ' ')) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(REPLACE(description, ' ', ' ')) LIKE '%$".strtolower($stringSearchSQL)."%')";
|
||||||
$filter['id_graph'] = $usergraphs_id;
|
$filter['id_graph'] = $usergraphs_id;
|
||||||
|
|
||||||
$columns = [
|
$columns = [
|
||||||
|
@ -62,10 +62,10 @@ $sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress
|
|||||||
$id = db_get_all_rows_sql($sql);
|
$id = db_get_all_rows_sql($sql);
|
||||||
if ($id != '') {
|
if ($id != '') {
|
||||||
$aux = $id[0]['id_agent'];
|
$aux = $id[0]['id_agent'];
|
||||||
$search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR
|
$search_sql = " REPLACE(t1.nombre, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t2.nombre LIKE '".$stringSearchSQL."' OR
|
REPLACE(t2.nombre, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t1.alias LIKE '".$stringSearchSQL."' OR
|
REPLACE(t1.alias, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t1.comentarios LIKE '".$stringSearchSQL."' OR
|
REPLACE(t1.comentarios, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t1.id_agente =".$aux;
|
t1.id_agente =".$aux;
|
||||||
|
|
||||||
$idCount = count($id);
|
$idCount = count($id);
|
||||||
@ -77,16 +77,16 @@ if ($id != '') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR
|
$search_sql = " REPLACE(t1.nombre, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t2.nombre LIKE '".$stringSearchSQL."' OR
|
REPLACE(t2.nombre, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t1.direccion LIKE '".$stringSearchSQL."' OR
|
REPLACE(t1.direccion, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t1.comentarios LIKE '".$stringSearchSQL."' OR
|
REPLACE(t1.comentarios, ' ', ' ') LIKE '".$stringSearchSQL."' OR
|
||||||
t1.alias LIKE '".$stringSearchSQL."'";
|
REPLACE(t1.alias, ' ', ' ') LIKE '".$stringSearchSQL."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($has_secondary === true) {
|
if ($has_secondary === true) {
|
||||||
$search_sql .= " OR (tasg.id_group IS NOT NULL AND
|
$search_sql .= " OR (tasg.id_group IS NOT NULL AND
|
||||||
tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE nombre LIKE '".$stringSearchSQL."'))";
|
tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE REPLACE(nombre, ' ', ' ') LIKE '".$stringSearchSQL."'))";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
|
@ -32,7 +32,7 @@ if ((bool) $searchMaps === true) {
|
|||||||
FROM tlayout tl
|
FROM tlayout tl
|
||||||
LEFT JOIN tlayout_data tld
|
LEFT JOIN tlayout_data tld
|
||||||
ON tl.id = tld.id_layout
|
ON tl.id = tld.id_layout
|
||||||
WHERE tl.name LIKE "%%%s%%"
|
WHERE REPLACE(tl.name, " ", " ") LIKE "%%%s%%"
|
||||||
AND tl.id_group IN (%s)
|
AND tl.id_group IN (%s)
|
||||||
GROUP BY tl.id, tl.name, tl.id_group',
|
GROUP BY tl.id, tl.name, tl.id_group',
|
||||||
$stringSearchSQL,
|
$stringSearchSQL,
|
||||||
|
@ -142,8 +142,8 @@ if ($searchModules) {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
AND
|
AND
|
||||||
(t1.nombre LIKE "%'.$stringSearchSQL.'%" OR
|
(REPLACE(t1.nombre, " ", " ") LIKE "%'.$stringSearchSQL.'%" OR
|
||||||
t3.nombre LIKE "%'.$stringSearchSQL.'%")
|
REPLACE(t3.nombre, " ", " ") LIKE "%'.$stringSearchSQL.'%")
|
||||||
AND t1.disabled = 0';
|
AND t1.disabled = 0';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -172,8 +172,8 @@ if ($searchModules) {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
) AND
|
) AND
|
||||||
(t1.nombre LIKE \'%'.$stringSearchSQL.'%\' OR
|
(REPLACE(t1.nombre, " ", " ") LIKE \'%'.$stringSearchSQL.'%\' OR
|
||||||
t3.nombre LIKE \'%'.$stringSearchSQL.'%\')';
|
REPLACE(t3.nombre, " ", " ") LIKE \'%'.$stringSearchSQL.'%\')';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
@ -201,8 +201,8 @@ if ($searchModules) {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
) AND
|
) AND
|
||||||
(LOWER(t1.nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\' OR
|
(LOWER(REPLACE(t1.nombre, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\' OR
|
||||||
LOWER(t3.nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\')';
|
LOWER(REPLACE(t3.nombre, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\')';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ if ($searchpolicies === true) {
|
|||||||
|
|
||||||
$sql = "SELECT id, name, description, id_group, status
|
$sql = "SELECT id, name, description, id_group, status
|
||||||
FROM tpolicies
|
FROM tpolicies
|
||||||
WHERE name LIKE '$stringSearchSQL'
|
WHERE REPLACE(name, ' ', ' ') LIKE '$stringSearchSQL'
|
||||||
AND id_group IN ($id_user_groups_str)
|
AND id_group IN ($id_user_groups_str)
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
@ -46,13 +46,13 @@ if ($searchReports) {
|
|||||||
case 'postgresql':
|
case 'postgresql':
|
||||||
$sql = "SELECT id_report, name, description
|
$sql = "SELECT id_report, name, description
|
||||||
FROM treport
|
FROM treport
|
||||||
WHERE (name LIKE '%".$stringSearchSQL."%' OR description LIKE '%".$stringSearchSQL."%')".$reports_condition;
|
WHERE (REPLACE(name, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR REPLACE(description, ' ', ' ') LIKE '%".$stringSearchSQL."%')".$reports_condition;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
$sql = "SELECT id_report, name, description
|
$sql = "SELECT id_report, name, description
|
||||||
FROM treport
|
FROM treport
|
||||||
WHERE (upper(name) LIKE '%".strtolower($stringSearchSQL)."%' OR description LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition;
|
WHERE (upper(REPLACE(name, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR REPLACE(description, ' ', ' ') LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,13 +77,13 @@ if ($searchReports) {
|
|||||||
case 'postgresql':
|
case 'postgresql':
|
||||||
$sql_count = "SELECT COUNT(id_report) AS count
|
$sql_count = "SELECT COUNT(id_report) AS count
|
||||||
FROM treport
|
FROM treport
|
||||||
WHERE (name LIKE '%".$stringSearchSQL."%' OR description LIKE '%".$stringSearchSQL."%')".$reports_condition;
|
WHERE (REPLACE(name, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR REPLACE(description, ' ', ' ') LIKE '%".$stringSearchSQL."%')".$reports_condition;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
$sql_count = "SELECT COUNT(id_report) AS count
|
$sql_count = "SELECT COUNT(id_report) AS count
|
||||||
FROM treport
|
FROM treport
|
||||||
WHERE (upper(name) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(description) LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition;
|
WHERE (upper(REPLACE(name, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(REPLACE(description, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,23 +179,23 @@ if ($searchUsers) {
|
|||||||
case 'mysql':
|
case 'mysql':
|
||||||
case 'postgresql':
|
case 'postgresql':
|
||||||
$sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario
|
$sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario
|
||||||
WHERE fullname LIKE '%".$stringSearchSQL."%' OR
|
WHERE REPLACE(fullname, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR
|
||||||
id_user LIKE '%".$stringSearchSQL."%' OR
|
REPLACE(id_user, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR
|
||||||
firstname LIKE '%".$stringSearchSQL."%' OR
|
REPLACE(firstname, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR
|
||||||
lastname LIKE '%".$stringSearchSQL."%' OR
|
REPLACE(lastname, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR
|
||||||
middlename LIKE '%".$stringSearchSQL."%' OR
|
REPLACE(middlename, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR
|
||||||
email LIKE '%".$stringSearchSQL."%'
|
REPLACE(email, ' ', ' ') LIKE '%".$stringSearchSQL."%'
|
||||||
ORDER BY ".$order['field'].' '.$order['order'];
|
ORDER BY ".$order['field'].' '.$order['order'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
$sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario
|
$sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario
|
||||||
WHERE upper(fullname) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
WHERE upper(REPLACE(fullname, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
||||||
upper(id_user) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
upper(REPLACE(id_user, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
||||||
upper(firstname) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
upper(REPLACE(firstname, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
||||||
upper(lastname) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
upper(REPLACE(lastname, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
||||||
upper(middlename) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
upper(REPLACE(middlename, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR
|
||||||
upper(email) LIKE '%".strtolower($stringSearchSQL)."%'
|
upper(REPLACE(email, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%'
|
||||||
ORDER BY ".$order['field'].' '.$order['order'];
|
ORDER BY ".$order['field'].' '.$order['order'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ $create_text_file = (bool) get_parameter('create_text_file');
|
|||||||
$default_real_directory = realpath($config['homedir'].'/'.$fallback_directory);
|
$default_real_directory = realpath($config['homedir'].'/'.$fallback_directory);
|
||||||
|
|
||||||
if ($upload_file_or_zip === true) {
|
if ($upload_file_or_zip === true) {
|
||||||
upload_file($upload_file_or_zip, $default_real_directory, $real_directory);
|
upload_file($upload_file_or_zip, $default_real_directory, $real_directory, ['mib', 'zip']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($create_text_file === true) {
|
if ($create_text_file === true) {
|
||||||
|
@ -33,7 +33,7 @@ require_once $config['homedir'].'/vendor/autoload.php';
|
|||||||
ui_require_css_file('register', 'include/styles/', true);
|
ui_require_css_file('register', 'include/styles/', true);
|
||||||
|
|
||||||
// Connection lost alert.
|
// Connection lost alert.
|
||||||
ui_require_javascript_file('connection_check', 'include/javascript/', true);
|
// ui_require_javascript_file('connection_check', 'include/javascript/', true);
|
||||||
set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
|
set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
|
||||||
$conn_title = __('Connection with console has been lost');
|
$conn_title = __('Connection with console has been lost');
|
||||||
$conn_text = __('Connection to the console has been lost. Please check your internet connection.');
|
$conn_text = __('Connection to the console has been lost. Please check your internet connection.');
|
||||||
@ -47,7 +47,7 @@ global $vc_public_view;
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$vc_public_view = true;
|
$vc_public_view = true;
|
||||||
$config['public_view'] = true;
|
$config['public_access'] = true;
|
||||||
|
|
||||||
// This starts the page head. In the call back function,
|
// This starts the page head. In the call back function,
|
||||||
// things from $page['head'] array will be processed into the head.
|
// things from $page['head'] array will be processed into the head.
|
||||||
@ -62,12 +62,6 @@ require_once 'include/functions_visual_map.php';
|
|||||||
|
|
||||||
$hash = (string) get_parameter('hash');
|
$hash = (string) get_parameter('hash');
|
||||||
|
|
||||||
// For public link issue.
|
|
||||||
$force_instant_logout = true;
|
|
||||||
if (isset($config['id_user']) === true) {
|
|
||||||
$force_instant_logout = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check input hash.
|
// Check input hash.
|
||||||
// DO NOT move it after of get parameter user id.
|
// DO NOT move it after of get parameter user id.
|
||||||
if (User::validatePublicHash($hash) !== true) {
|
if (User::validatePublicHash($hash) !== true) {
|
||||||
@ -256,17 +250,17 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
|
|||||||
if (menuLinks !== null) {
|
if (menuLinks !== null) {
|
||||||
menuLinks.forEach(function (menuLink) {
|
menuLinks.forEach(function (menuLink) {
|
||||||
menuLink.href = menuLink.href.replace(regex, replacement);
|
menuLink.href = menuLink.href.replace(regex, replacement);
|
||||||
menuLink.href = menuLink.href.replace(
|
//menuLink.href = menuLink.href.replace(
|
||||||
regex_hash,
|
// regex_hash,
|
||||||
replacement_hash
|
// replacement_hash
|
||||||
);
|
//);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change the URL (if the browser has support).
|
// Change the URL (if the browser has support).
|
||||||
if ("history" in window) {
|
if ("history" in window) {
|
||||||
var href = window.location.href.replace(regex, replacement);
|
var href = window.location.href.replace(regex, replacement);
|
||||||
href = href.replace(regex_hash, replacement_hash);
|
//href = href.replace(regex_hash, replacement_hash);
|
||||||
window.history.replaceState({}, document.title, href);
|
window.history.replaceState({}, document.title, href);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,20 +315,24 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
<?php if ($force_instant_logout === true) { ?>
|
|
||||||
// No click enabled when user not logged.
|
|
||||||
$( "a" ).on( "click", function( event ) {
|
|
||||||
event.preventDefault();
|
|
||||||
$('#visual-console-container').removeClass('is-updating');
|
|
||||||
$('.div-visual-console-spinner').remove();
|
|
||||||
});
|
|
||||||
<?php } ?>
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
if ($force_instant_logout === true) {
|
// Clean session to avoid direct access.
|
||||||
unset($userAccessMaintenance, $config['id_user'], $hash);
|
if ($config['force_instant_logout'] === true) {
|
||||||
|
// Force user logout.
|
||||||
|
$iduser = $_SESSION['id_usuario'];
|
||||||
|
if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SESSION = [];
|
||||||
session_destroy();
|
session_destroy();
|
||||||
header_remove('Set-Cookie');
|
header_remove('Set-Cookie');
|
||||||
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
if (isset($_COOKIE[session_name()]) === true) {
|
||||||
|
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (ob_get_length() > 0) {
|
||||||
|
ob_end_flush();
|
||||||
}
|
}
|
@ -6,7 +6,7 @@
|
|||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.774
|
%define version 7.0NG.774
|
||||||
%define release 231201
|
%define release 231213
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.774
|
%define version 7.0NG.774
|
||||||
%define release 231201
|
%define release 231213
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user