Merge remote-tracking branch 'origin/develop' into ent-5735-9752-problema-no-inicializados-modulos-de-tipo-log
This commit is contained in:
commit
9d3a209fc8
31
README.md
31
README.md
|
@ -8,31 +8,34 @@ Pandora FMS is a monitoring software for IT infrastructure management which incl
|
|||
|
||||
For community support you can visit our forums at http://forums.pandorafms.org. Visit our community page at http://pandorafms.org and if you need commercial information or/and professional support visit http://pandorafms.com.
|
||||
|
||||
|
||||
### How to install Pandora FMS
|
||||
|
||||
Installing Pandora FMS is a very easy task. Please visit our wiki and follow all the steps described for a quick and proper installation. http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Installing
|
||||
|
||||
### What is Pandora FMS?
|
||||
Pandora FMS is a monitoring application to watch systems and applications that allows to know the status of any element of the business systems. Pandora FMS watches your hardware, software, your multilayer system and, of course, your OS. Pandora FMS can detect if a network interface is down or the movement of any NASDAQ new technology market value. If you wish, Pandora FMS can send a SMS message when your system or your application fails or when Google stock value drops below 330 US$. Pandora FMS will fit your systems and requirements, because it has been designed to be open, modular, multiplattform and easy to customize.
|
||||
|
||||
Pandora FMS is a monitoring application to watch systems and applications that allows to know the status of any element of the business systems. Pandora FMS watches your hardware, software, your multilayer system and, of course, your OS. Pandora FMS can detect if a network interface is down or the movement of any NASDAQ new technology market value. If you wish, Pandora FMS can send a SMS message when your system or your application fails or when Google stock value drops below 330 US\$. Pandora FMS will fit your systems and requirements, because it has been designed to be open, modular, multiplattform and easy to customize.
|
||||
|
||||
### Other things Pandora FMS can do
|
||||
Pandora FMS is a monitoring tool that not only measures if a parameter is right or wrong. Pandora FMS can quantify the state (right or wrong), or store a value (numeric or alphanumeric) for months if necessary. Pandora FMS can measure performances, compare values among different systems and set alarms over thresholds. Pandora FMS works against a Database so it can generate reports, statistics, SLA and meausre anything: OS, applications and hardware systems, such as firewalls, proxies, Databases, web servers, VPN, routers, switches, processes, services, remote accesses to servers, etc. Everything integrated in an open and distributed architecture. Pandora FMS can be deployed over any OS, with specific agents for each platform. There are agents for Windows (2000, XP, 2003), GNU/Linux, Solaris, HP-UX, BSD, AIX, IPSO and OpenWRT. Pandora FMS not only gathers information through its agents, but it can also monitor any hardware system with TCP/IP connectivity, such as load balancing systems, routers, switches or printers, through SNMP and TCP/ICMP checks.
|
||||
|
||||
Pandora FMS is a monitoring tool that not only measures if a parameter is right or wrong. Pandora FMS can quantify the state (right or wrong), or store a value (numeric or alphanumeric) for months if necessary. Pandora FMS can measure performances, compare values among different systems and set alarms over thresholds. Pandora FMS works against a Database so it can generate reports, statistics, SLA and meausre anything: OS, applications and hardware systems, such as firewalls, proxies, Databases, web servers, VPN, routers, switches, processes, services, [remote accesses to servers](https://pandorafms.com/server-monitoring/), etc. Everything integrated in an open and distributed architecture. Pandora FMS can be deployed over any OS, with specific agents for each platform. There are agents for Windows (2000, XP, 2003), GNU/Linux, Solaris, HP-UX, BSD, AIX, IPSO and OpenWRT. Pandora FMS not only gathers information through its agents, but it can also monitor any hardware system with TCP/IP connectivity, such as load balancing systems, routers, switches or printers, through SNMP and TCP/ICMP checks.
|
||||
|
||||
### Main features
|
||||
* Network monitoring
|
||||
* WMI monitoring
|
||||
* Agent monitoring (for all OS)
|
||||
* Graphical reporting, based on it's own SQL backend
|
||||
* SLA, and ITIL KPI metrics on reporting
|
||||
* Status & Performance monitoring
|
||||
* GIS tracking and viewing
|
||||
* Inventory management (Local and remote)
|
||||
* User defined visual console screens and Dashboards WYSIWYG
|
||||
* Very high capacity (Thousands of devices)
|
||||
* Multiuser, several levels of ACL management.
|
||||
|
||||
- Network monitoring
|
||||
- WMI monitoring
|
||||
- Agent monitoring (for all OS)
|
||||
- Graphical reporting, based on it's own SQL backend
|
||||
- SLA, and ITIL KPI metrics on reporting
|
||||
- Status & Performance monitoring
|
||||
- GIS tracking and viewing
|
||||
- Inventory management (Local and remote)
|
||||
- User defined visual console screens and Dashboards WYSIWYG
|
||||
- Very high capacity (Thousands of devices)
|
||||
- Multiuser, several levels of ACL management.
|
||||
|
||||
### Screenshots
|
||||
|
||||

|
||||
<br />
|
||||
<br />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747, AIX version
|
||||
# Version 7.0NG.748, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747, FreeBSD Version
|
||||
# Version 7.0NG.748, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747, HP-UX Version
|
||||
# Version 7.0NG.748, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747, GNU/Linux
|
||||
# Version 7.0NG.748, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747, GNU/Linux
|
||||
# Version 7.0NG.748, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747, Solaris Version
|
||||
# Version 7.0NG.748, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.747
|
||||
# Version 7.0NG.748
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.747, AIX version
|
||||
# Version 7.0NG.748, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.747
|
||||
# Version 7.0NG.748
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.747, HPUX Version
|
||||
# Version 7.0NG.748, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747
|
||||
# Version 7.0NG.748
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747
|
||||
# Version 7.0NG.748
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747
|
||||
# Version 7.0NG.748
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.747, Solaris version
|
||||
# Version 7.0NG.748, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747, AIX version
|
||||
# Version 7.0NG.748, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.747-200715
|
||||
Version: 7.0NG.748-200907
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.747-200715"
|
||||
pandora_version="7.0NG.748-200907"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747, GNU/Linux
|
||||
# Version 7.0NG.748, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747, FreeBSD Version
|
||||
# Version 7.0NG.748, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747, HP-UX Version
|
||||
# Version 7.0NG.748, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747, GNU/Linux
|
||||
# Version 7.0NG.748, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747, GNU/Linux
|
||||
# Version 7.0NG.748, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747, NetBSD Version
|
||||
# Version 7.0NG.748, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.747, Solaris Version
|
||||
# Version 7.0NG.748, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -54,8 +54,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.747';
|
||||
use constant AGENT_BUILD => '200715';
|
||||
use constant AGENT_VERSION => '7.0NG.748';
|
||||
use constant AGENT_BUILD => '200907';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -1678,7 +1678,7 @@ sub execute_command_timeout {
|
|||
};
|
||||
|
||||
my $result = ($?>>8);
|
||||
print $result;
|
||||
return $result;
|
||||
|
||||
# Exit child.
|
||||
# Child finishes.
|
||||
|
@ -1753,7 +1753,7 @@ sub execute_command_block {
|
|||
);
|
||||
|
||||
# Do not retry if success.
|
||||
last if looks_like_number($err_level) && $err_level == 0;
|
||||
$retries = 0 if looks_like_number($err_level) && $err_level == 0;
|
||||
|
||||
} while ((--$retries) > 0);
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.747
|
||||
%define release 200715
|
||||
%define version 7.0NG.748
|
||||
%define release 200907
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -21,10 +21,10 @@ BuildArch: noarch
|
|||
Requires(pre): shadow-utils
|
||||
Requires(post): chkconfig /bin/ln
|
||||
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
|
||||
Requires: fileutils textutils unzip
|
||||
Requires: coreutils unzip
|
||||
Requires: util-linux procps grep
|
||||
Requires: /sbin/ip /bin/awk
|
||||
Requires: perl perl(Sys::Syslog) perl(IO::Compress::Zip) perl(YAML::Tiny)
|
||||
Requires: perl perl(Sys::Syslog) perl(IO::Compress::Zip)
|
||||
# Required by plugins
|
||||
#Requires: sh-utils sed passwd net-tools rpm
|
||||
AutoReq: 0
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.747
|
||||
%define release 200715
|
||||
%define version 7.0NG.748
|
||||
%define release 200907
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -20,7 +20,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
|||
BuildArch: noarch
|
||||
#PreReq: %fillup_prereq %insserv_prereq /usr/bin/sed /usr/bin/grep /usr/sbin/useradd
|
||||
Requires(pre,preun):/usr/bin/sed /usr/bin/grep /usr/sbin/useradd
|
||||
Requires: coreutils unzip perl perl(Sys::Syslog) perl(IO::Compress::Zip) perl(YAML::Tiny)
|
||||
Requires: coreutils unzip perl perl(Sys::Syslog) perl(IO::Compress::Zip)
|
||||
AutoReq: 0
|
||||
Provides: %{name}-%{version}
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.747"
|
||||
PI_BUILD="200715"
|
||||
PI_VERSION="7.0NG.748"
|
||||
PI_BUILD="200907"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -56,6 +56,8 @@ my $Reg_exp = '';
|
|||
# Flag to show or not summary module
|
||||
my $summary_flag = 0;
|
||||
|
||||
my $nodatalist_flag = 0;
|
||||
|
||||
# Number of coincidences found
|
||||
my $coincidences = 0;
|
||||
|
||||
|
@ -120,7 +122,15 @@ sub error_msg ($) {
|
|||
# Print a help message.
|
||||
###############################################################################
|
||||
sub print_help () {
|
||||
print "Usage: $0 <log_file> <module_name> <pattern> <up_lines_extra> <bot_lines_extra> [--summary]\n";
|
||||
print "Usage: $0 <log_file> <module_name> <pattern> <up_lines_extra> <bot_lines_extra> [--summary] [--nodatalist]\n\n";
|
||||
print "Options:\n";
|
||||
print "\t<log_file>\t\tPath to the log file to be monitored\n";
|
||||
print "\t<module_name>\t\tName of the module that will be created\n";
|
||||
print "\t<pattern>\t\tRegex string to be matched in log file\n";
|
||||
print "\t<up_lines_extra>\tShows NUM lines before matching lines to provide context\n";
|
||||
print "\t<bot_lines_extra>\tShows NUM lines after matching lines to provide context\n";
|
||||
print "\t--summary\t\tCreates a module with the total number of matches\n";
|
||||
print "\t--nodatalist\t\tInserts all coincidences in a single data output instead of a data per line\n";
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
@ -317,6 +327,7 @@ sub print_log ($) {
|
|||
if ($#kdata < 0) {
|
||||
print_summary() if ($summary_flag == 1);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
# Log module
|
||||
|
@ -341,6 +352,18 @@ sub print_log ($) {
|
|||
$output = "<module>\n";
|
||||
$output .= "<name><![CDATA[" . $Module_name . "]]></name>\n";
|
||||
$output .= "<type><![CDATA[async_string]]></type>\n";
|
||||
if ($nodatalist_flag == 1){
|
||||
$output .= "<data><![CDATA[";
|
||||
foreach my $line (@kdata) {
|
||||
foreach my $content (@{$data->{$line}}) {
|
||||
my $processed_line = $content;
|
||||
$processed_line =~ "\n";
|
||||
$output .= $processed_line;
|
||||
}
|
||||
}
|
||||
$output .= "]]></data>\n";
|
||||
}
|
||||
else {
|
||||
$output .= "<datalist>\n";
|
||||
foreach my $line (@kdata) {
|
||||
$output .= "<data><value><![CDATA[";
|
||||
|
@ -352,10 +375,12 @@ sub print_log ($) {
|
|||
$output .= "]]></value></data>\n";
|
||||
}
|
||||
$output .= "</datalist>\n";
|
||||
}
|
||||
$output .= "</module>\n";
|
||||
|
||||
print stdout $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
@ -376,12 +401,18 @@ $Reg_exp = trim($ARGV[2]);
|
|||
my $up_lines = trim($ARGV[3]);
|
||||
my $bot_lines = trim($ARGV[4]);
|
||||
my $sum_flag = trim($ARGV[5]);
|
||||
my $nodatalist = trim($ARGV[6]);
|
||||
|
||||
if ( ( defined($up_lines) && ($up_lines eq "--summary"))
|
||||
|| ( defined($bot_lines) && ($bot_lines eq "--summary"))
|
||||
|| ( defined($sum_flag) && ($sum_flag eq "--summary")) ) {
|
||||
$summary_flag = 1;
|
||||
if ( grep { /--summary/ } @ARGV )
|
||||
{
|
||||
$summary_flag = 1;
|
||||
}
|
||||
|
||||
if ( grep { /--nodatalist/ } @ARGV )
|
||||
{
|
||||
$nodatalist_flag = 1;
|
||||
}
|
||||
|
||||
# Create index file storage directory
|
||||
if ( ! -d $Idx_dir) {
|
||||
mkdir($Idx_dir) || error_msg("Error creating directory $Idx_dir: "
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.747
|
||||
# Version 7.0NG.748
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
|
Binary file not shown.
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.747}
|
||||
{Pandora FMS Windows Agent v7.0NG.748}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{200715}
|
||||
{200907}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.747(Build 200715)")
|
||||
#define PANDORA_VERSION ("7.0NG.748(Build 200907)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.747(Build 200715))"
|
||||
VALUE "ProductVersion", "(7.0NG.748(Build 200907))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -4,5 +4,4 @@ Options -Indexes
|
|||
<Files ~ "\.log$">
|
||||
Order Allow,Deny
|
||||
Deny from All
|
||||
</Files>
|
||||
|
||||
</Files>
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.747-200715
|
||||
Version: 7.0NG.748-200907
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.747-200715"
|
||||
pandora_version="7.0NG.748-200907"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -41,7 +41,9 @@ if (__PAN_XHPROF__ === 1) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((! file_exists('include/config.php')) || (! is_readable('include/config.php'))) {
|
||||
if ((! file_exists('include/config.php'))
|
||||
|| (! is_readable('include/config.php'))
|
||||
) {
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -52,7 +54,9 @@ require_once 'include/functions.php';
|
|||
require_once 'include/functions_db.php';
|
||||
require_once 'include/auth/mysql.php';
|
||||
|
||||
if (isset($config['console_log_enabled']) && $config['console_log_enabled'] == 1) {
|
||||
if (isset($config['console_log_enabled']) === true
|
||||
&& $config['console_log_enabled'] == 1
|
||||
) {
|
||||
ini_set('log_errors', 1);
|
||||
ini_set('error_log', $config['homedir'].'/log/console.log');
|
||||
} else {
|
||||
|
@ -60,14 +64,15 @@ if (isset($config['console_log_enabled']) && $config['console_log_enabled'] == 1
|
|||
ini_set('error_log', 0);
|
||||
}
|
||||
|
||||
|
||||
// Hash login process
|
||||
if (isset($_GET['loginhash'])) {
|
||||
// Hash login process.
|
||||
if (isset($_GET['loginhash']) === true) {
|
||||
$loginhash_data = get_parameter('loginhash_data', '');
|
||||
$loginhash_user = str_rot13(get_parameter('loginhash_user', ''));
|
||||
|
||||
if ($config['loginhash_pwd'] != ''
|
||||
&& $loginhash_data == md5($loginhash_user.io_output_password($config['loginhash_pwd']))
|
||||
&& $loginhash_data == md5(
|
||||
$loginhash_user.io_output_password($config['loginhash_pwd'])
|
||||
)
|
||||
) {
|
||||
db_logon($loginhash_user, $_SERVER['REMOTE_ADDR']);
|
||||
$_SESSION['id_usuario'] = $loginhash_user;
|
||||
|
@ -76,14 +81,38 @@ if (isset($_GET['loginhash'])) {
|
|||
include_once 'general/login_page.php';
|
||||
db_pandora_audit('Logon Failed (loginhash', '', 'system');
|
||||
while (@ob_end_flush()) {
|
||||
// Dumping...
|
||||
continue;
|
||||
}
|
||||
|
||||
exit('</html>');
|
||||
}
|
||||
}
|
||||
|
||||
$auth_class = io_safe_output(
|
||||
get_parameter('auth_class', 'PandoraFMS\Dashboard\Manager')
|
||||
);
|
||||
$public_hash = get_parameter('auth_hash', false);
|
||||
$public_login = false;
|
||||
// Check user.
|
||||
check_login();
|
||||
if (class_exists($auth_class) === false || $public_hash === false) {
|
||||
check_login();
|
||||
} else {
|
||||
if ($auth_class::validatePublicHash($public_hash) === false) {
|
||||
db_pandora_audit(
|
||||
'Invalid public hash',
|
||||
'Trying to access public dashboard'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
// OK. Simulated user log in. If you want to use your own auth_class
|
||||
// remember to set $config['force_instant_logout'] to true to avoid
|
||||
// persistent user login.
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
// Enterprise support.
|
||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||
|
@ -98,7 +127,10 @@ $page .= '.php';
|
|||
$config['id_user'] = $_SESSION['id_usuario'];
|
||||
$isFunctionSkins = enterprise_include_once('include/functions_skins.php');
|
||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||
$config['relative_path'] = enterprise_hook('skins_set_image_skin_path', [$config['id_user']]);
|
||||
$config['relative_path'] = enterprise_hook(
|
||||
'skins_set_image_skin_path',
|
||||
[$config['id_user']]
|
||||
);
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
|
@ -115,3 +147,29 @@ if (file_exists($page)) {
|
|||
if (__PAN_XHPROF__ === 1) {
|
||||
pandora_xhprof_display_result('ajax', 'console');
|
||||
}
|
||||
|
||||
|
||||
if ($config['force_instant_logout'] === true) {
|
||||
// Force user logout.
|
||||
if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
$iduser = $_SESSION['id_usuario'];
|
||||
$_SESSION = [];
|
||||
session_destroy();
|
||||
header_remove('Set-Cookie');
|
||||
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
||||
|
||||
if ($config['auth'] == 'saml') {
|
||||
include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';
|
||||
$as = new SimpleSAML_Auth_Simple('PandoraFMS');
|
||||
$as->logout();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while (@ob_end_flush()) {
|
||||
// Dumping...
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,4 @@
|
|||
<FilesMatch "\.(txt|php)$">
|
||||
Deny from all
|
||||
Allow from localhost
|
||||
</FilesMatch>
|
||||
php_flag engine off
|
||||
|
||||
</FilesMatch>
|
|
@ -1,7 +1,10 @@
|
|||
START TRANSACTION;
|
||||
|
||||
UPDATE `talert_commands` SET name='Monitoring Event' WHERE name='Pandora FMS Event';
|
||||
|
||||
ALTER TABLE `tservice_element` ADD COLUMN `rules` text;
|
||||
ALTER TABLE `tservice` ADD COLUMN `unknown_as_critical` tinyint(1) NOT NULL default 0 AFTER `warning`;
|
||||
ALTER TABLE `tserver` MODIFY COLUMN `version` varchar(25) NOT NULL DEFAULT '';
|
||||
|
||||
UPDATE `tservice` SET `auto_calculate`=0;
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `treport_content` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content_template` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
|
||||
ALTER TABLE `talert_templates` ADD COLUMN `previous_name` text;
|
||||
ALTER TABLE `talert_actions` ADD COLUMN `previous_name` text;
|
||||
ALTER TABLE `talert_commands` ADD COLUMN `previous_name` text;
|
||||
ALTER TABLE `ttag` ADD COLUMN `previous_name` text NULL;
|
||||
ALTER TABLE `tconfig_os` ADD COLUMN `previous_name` text NULL;
|
||||
|
||||
COMMIT;
|
|
@ -849,6 +849,7 @@ ALTER TABLE `treport_content_template` MODIFY COLUMN `historical_db` tinyint(1)
|
|||
MODIFY COLUMN `visual_format` tinyint(1) unsigned NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content_template` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnews`
|
||||
|
@ -1271,6 +1272,7 @@ ALTER TABLE talert_snmp_action ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT "";
|
|||
-- ----------------------------------------------------------------------
|
||||
ALTER TABLE tserver ADD COLUMN `server_keepalive` int(11) DEFAULT 0;
|
||||
ALTER TABLE `tserver` MODIFY COLUMN `server_keepalive` int(11) NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `tserver` MODIFY COLUMN `version` varchar(25) NOT NULL DEFAULT '';
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tagente_estado`
|
||||
|
@ -1311,6 +1313,8 @@ ALTER TABLE talert_actions ADD COLUMN `field12_recovery` TEXT NOT NULL DEFAULT "
|
|||
ALTER TABLE talert_actions ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE `talert_actions` ADD COLUMN `previous_name` text;
|
||||
|
||||
ALTER TABLE `talert_actions` MODIFY COLUMN `field11` text NOT NULL,
|
||||
MODIFY COLUMN `field12` text NOT NULL,
|
||||
MODIFY COLUMN `field13` text NOT NULL,
|
||||
|
@ -1324,6 +1328,7 @@ UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria IMS 
|
|||
UPDATE `talert_commands` SET `description` = 'This alert send an email using internal Pandora FMS Server SMTP capabilities (defined in each server, using:
_field1_ as destination email address, and
_field2_ as subject for message. 
_field3_ as text of message. 
_field4_ as content type (text/plain or html/text).', `fields_descriptions` = '[\"Destination address\",\"Subject\",\"Text\",\"Content Type\",\"\",\"\",\"\",\"\",\"\",\"\"]', `fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id=1;
|
||||
ALTER TABLE `talert_commands` ADD COLUMN `id_group` mediumint(8) unsigned NULL default 0;
|
||||
ALTER TABLE `talert_commands` ADD COLUMN `fields_hidden` text;
|
||||
ALTER TABLE `talert_commands` ADD COLUMN `previous_name` text;
|
||||
|
||||
UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1;
|
||||
|
||||
|
@ -1336,19 +1341,24 @@ ALTER TABLE `talert_commands` MODIFY COLUMN `id_group` mediumint(8) unsigned NUL
|
|||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `tmap` MODIFY COLUMN `id_user` varchar(250) NOT NULL DEFAULT '';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `ttag`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `ttag` ADD COLUMN `previous_name` text NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconfig`
|
||||
-- ---------------------------------------------------------------------
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 40);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 41);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '748');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '749');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
|
||||
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
|
||||
|
@ -1380,7 +1390,9 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_content', '');
|
|||
-- Table `tconfig_os`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`) VALUES (100, 'Cluster', 'Cluster agent', 'so_cluster.png');
|
||||
ALTER TABLE `tconfig_os` ADD COLUMN `previous_name` text NULL;
|
||||
|
||||
INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`) VALUES (100, 'Cluster', 'Cluster agent', 'so_cluster.png', '');
|
||||
|
||||
UPDATE `tagente` SET `id_os` = 100 WHERE `id_os` = 21 and (select `id_os` from `tconfig_os` WHERE `id_os` = 21 and `name` = 'Cluster');
|
||||
|
||||
|
@ -1662,6 +1674,7 @@ ALTER TABLE `treport_content` MODIFY COLUMN `historical_db` tinyint(1) unsigned
|
|||
MODIFY COLUMN `failover_type` tinyint(1) NULL DEFAULT '1';
|
||||
ALTER TABLE `treport_content` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmodule_relationship`
|
||||
|
@ -2460,6 +2473,8 @@ INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES
|
|||
-- Alter table `talert_templates`
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE `talert_templates` ADD COLUMN `previous_name` text;
|
||||
|
||||
ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal');
|
||||
|
||||
ALTER TABLE `talert_templates` MODIFY COLUMN `field11` text NOT NULL,
|
||||
|
|
|
@ -165,7 +165,12 @@ if (check_login()) {
|
|||
break;
|
||||
|
||||
case 'monitorcheckmodal':
|
||||
echo __('This system has too many modules per agent. OpenSource version could manage thousands of modules, but is not recommended to have more than 40 modules per agent. This configuration has B/A modules per agent. Checkout the Enterprise Version for a professional supported system.');
|
||||
// Get agent/module average.
|
||||
$agentCount = db_get_value_sql('SELECT count(*) FROM tagente');
|
||||
$modulesCount = db_get_value_sql('SELECT count(*) FROM tagente_modulo');
|
||||
$average = ($modulesCount / $agentCount);
|
||||
|
||||
echo __('This system has too many modules per agent. OpenSource version could manage thousands of modules, but is not recommended to have more than 100 modules per agent. This configuration has %d modules per agent. Checkout the Enterprise Version for a professional supported system.', $average);
|
||||
break;
|
||||
|
||||
case 'remotemodulesmodal':
|
||||
|
|
|
@ -24,7 +24,16 @@ require_once $config['homedir'].'/include/functions_modules.php';
|
|||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_servers.php';
|
||||
|
||||
$search_string = io_safe_output(urldecode(trim(get_parameter('search_string', ''))));
|
||||
$search_string = io_safe_output(
|
||||
urldecode(
|
||||
trim(
|
||||
get_parameter(
|
||||
'search_string',
|
||||
''
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
global $policy_page;
|
||||
|
||||
|
@ -32,17 +41,27 @@ if (!isset($policy_page)) {
|
|||
$policy_page = false;
|
||||
}
|
||||
|
||||
// Search string filter form
|
||||
|
||||
echo '<form id="create_module_type" method="post" action="'.$url.'">';
|
||||
|
||||
echo '<table width="100%" cellpadding="2" cellspacing="2" class="databox filters" >';
|
||||
echo "<tr><td class='datos' style='width:20%; font-weight: bold;'>";
|
||||
echo __('Search').' '.html_print_input_text(
|
||||
'search_string',
|
||||
$search_string,
|
||||
'',
|
||||
15,
|
||||
255,
|
||||
true
|
||||
);
|
||||
html_print_input_hidden('search', 1);
|
||||
// Search string filter form.
|
||||
if (($policy_page) || (isset($agent))) {
|
||||
echo '<form id="" method="post" action="">';
|
||||
} else {
|
||||
echo '<form id="create_module_type" method="post" action="'.$url.'">';
|
||||
}
|
||||
|
||||
echo '<table width="100%" cellpadding="2" cellspacing="2" class="databox filters" >';
|
||||
echo "<tr><td class='datos' style='width:20%; font-weight: bold;'>";
|
||||
echo __('Search').' '.html_print_input_text('search_string', $search_string, '', 15, 255, true);
|
||||
html_print_input_hidden('search', 1);
|
||||
echo '</td>';
|
||||
echo "<td class='datos' style='width:10%'>";
|
||||
html_print_submit_button(__('Filter'), 'filter', false, 'class="sub search"');
|
||||
|
@ -50,38 +69,38 @@ echo '</td>';
|
|||
echo "<td class='datos' style='width:10%'></td>";
|
||||
echo '</form>';
|
||||
// Check if there is at least one server of each type available to assign that
|
||||
// kind of modules. If not, do not show server type in combo
|
||||
// kind of modules. If not, do not show server type in combo.
|
||||
$network_available = db_get_sql(
|
||||
'SELECT count(*)
|
||||
FROM tserver
|
||||
WHERE server_type = 1'
|
||||
);
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||
$wmi_available = db_get_sql(
|
||||
'SELECT count(*)
|
||||
FROM tserver
|
||||
WHERE server_type = 6'
|
||||
);
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||
$plugin_available = db_get_sql(
|
||||
'SELECT count(*)
|
||||
FROM tserver
|
||||
WHERE server_type = 4'
|
||||
);
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||
$prediction_available = db_get_sql(
|
||||
'SELECT count(*)
|
||||
FROM tserver
|
||||
WHERE server_type = 5'
|
||||
);
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
||||
// Development mode to use all servers
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||
// Development mode to use all servers.
|
||||
if ($develop_bypass || is_metaconsole()) {
|
||||
$network_available = 1;
|
||||
$wmi_available = 1;
|
||||
$plugin_available = 1;
|
||||
// FIXME when prediction predictions server modules can be configured
|
||||
// on metaconsole
|
||||
// FIXME when prediction predictions server modules can be configured.
|
||||
// on metaconsole.
|
||||
$prediction_available = is_metaconsole() ? 0 : 1;
|
||||
}
|
||||
|
||||
|
@ -140,7 +159,7 @@ if (($policy_page) || (isset($agent))) {
|
|||
}
|
||||
|
||||
if ($show_creation) {
|
||||
// Create module/type combo
|
||||
// Create module/type combo.
|
||||
echo '<form id="create_module_type" method="post" action="'.$url.'">';
|
||||
if (!$policy_page) {
|
||||
echo '<td class="datos" style="font-weight: bold; width:20%;">';
|
||||
|
@ -151,13 +170,33 @@ if (($policy_page) || (isset($agent))) {
|
|||
$checked = false;
|
||||
}
|
||||
|
||||
html_print_checkbox('status_hierachy_mode', '', $checked, false, false, 'onChange=change_mod_filter();');
|
||||
html_print_checkbox(
|
||||
'status_hierachy_mode',
|
||||
'',
|
||||
$checked,
|
||||
false,
|
||||
false,
|
||||
'onChange=change_mod_filter();'
|
||||
);
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
echo '<td class="datos" style="font-weight: bold; width:20%;">';
|
||||
echo __('<p>Type</p>');
|
||||
html_print_select($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;');
|
||||
html_print_select(
|
||||
$modules,
|
||||
'moduletype',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
'max-width:300px;'
|
||||
);
|
||||
html_print_input_hidden('edit_module', 1);
|
||||
echo '</td>';
|
||||
echo '<td class="datos" style="width:10%;">';
|
||||
|
@ -212,7 +251,13 @@ if ($multiple_delete) {
|
|||
}
|
||||
|
||||
enterprise_include_once('include/functions_config_agents.php');
|
||||
enterprise_hook('config_agents_delete_module_in_conf', [modules_get_agentmodule_agent($id_agent_module_del), modules_get_agentmodule_name($id_agent_module_del)]);
|
||||
enterprise_hook(
|
||||
'config_agents_delete_module_in_conf',
|
||||
[
|
||||
modules_get_agentmodule_agent($id_agent_module_del),
|
||||
modules_get_agentmodule_name($id_agent_module_del),
|
||||
]
|
||||
);
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
@ -220,7 +265,12 @@ if ($multiple_delete) {
|
|||
// error. NOTICE that we don't delete all data here, just marking for deletion
|
||||
// and delete some simple data.
|
||||
$status = '';
|
||||
$agent_id_of_module = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', (int) $id_agent_module_del);
|
||||
$agent_id_of_module = db_get_value(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
'id_agente_modulo',
|
||||
(int) $id_agent_module_del
|
||||
);
|
||||
|
||||
if (db_process_sql(
|
||||
"UPDATE tagente_modulo
|
||||
|
@ -235,7 +285,7 @@ if ($multiple_delete) {
|
|||
) {
|
||||
$error++;
|
||||
} else {
|
||||
// Set flag to update module status count
|
||||
// Set flag to update module status count.
|
||||
if ($agent_id_of_module !== false) {
|
||||
db_process_sql(
|
||||
'UPDATE tagente
|
||||
|
@ -286,32 +336,48 @@ if ($multiple_delete) {
|
|||
break;
|
||||
}
|
||||
|
||||
// Trick to detect if we are deleting a synthetic module (avg or arithmetic)
|
||||
// If result is empty then module doesn't have this type of submodules
|
||||
$ops_json = enterprise_hook('modules_get_synthetic_operations', [$id_agent_module_del]);
|
||||
// Trick to detect if we are deleting a synthetic module (avg or arithmetic).
|
||||
// If result is empty then module doesn't have this type of submodules.
|
||||
$ops_json = enterprise_hook(
|
||||
'modules_get_synthetic_operations',
|
||||
[$id_agent_module_del]
|
||||
);
|
||||
$result_ops_synthetic = json_decode($ops_json);
|
||||
if (!empty($result_ops_synthetic)) {
|
||||
$result = enterprise_hook('modules_delete_synthetic_operations', [$id_agent_module_del]);
|
||||
$result = enterprise_hook(
|
||||
'modules_delete_synthetic_operations',
|
||||
[$id_agent_module_del]
|
||||
);
|
||||
if ($result === false) {
|
||||
$error++;
|
||||
}
|
||||
} //end if
|
||||
else {
|
||||
$result_components = enterprise_hook('modules_get_synthetic_components', [$id_agent_module_del]);
|
||||
} else {
|
||||
$result_components = enterprise_hook(
|
||||
'modules_get_synthetic_components',
|
||||
[$id_agent_module_del]
|
||||
);
|
||||
$count_components = 1;
|
||||
if (!empty($result_components)) {
|
||||
// Get number of components pending to delete to know when it's needed to update orders
|
||||
// Get number of components pending to delete to know when it's needed to update orders.
|
||||
$num_components = count($result_components);
|
||||
$last_target_module = 0;
|
||||
foreach ($result_components as $id_target_module) {
|
||||
// Detects change of component or last component to update orders
|
||||
if (($count_components == $num_components) or ($last_target_module != $id_target_module)) {
|
||||
// Detects change of component or last component to update orders.
|
||||
if (($count_components == $num_components) || ($last_target_module != $id_target_module)
|
||||
) {
|
||||
$update_orders = true;
|
||||
} else {
|
||||
$update_orders = false;
|
||||
}
|
||||
|
||||
$result = enterprise_hook('modules_delete_synthetic_operations', [$id_target_module, $id_agent_module_del, $update_orders]);
|
||||
$result = enterprise_hook(
|
||||
'modules_delete_synthetic_operations',
|
||||
[
|
||||
$id_target_module,
|
||||
$id_agent_module_del,
|
||||
$update_orders,
|
||||
]
|
||||
);
|
||||
if ($result === false) {
|
||||
$error++;
|
||||
}
|
||||
|
@ -323,7 +389,7 @@ if ($multiple_delete) {
|
|||
}
|
||||
|
||||
|
||||
// Check for errors
|
||||
// Check for errors.
|
||||
if ($error != 0) {
|
||||
} else {
|
||||
$count_correct_delete_modules++;
|
||||
|
@ -509,7 +575,7 @@ switch ($sortField) {
|
|||
}
|
||||
|
||||
|
||||
// Build the order sql
|
||||
// Build the order sql.
|
||||
if (!empty($order)) {
|
||||
$order_sql = ' ORDER BY ';
|
||||
}
|
||||
|
@ -525,7 +591,7 @@ foreach ($order as $ord) {
|
|||
$order_sql .= $ord['field'].' '.$ord['order'];
|
||||
}
|
||||
|
||||
// Get limit and offset parameters
|
||||
// Get limit and offset parameters.
|
||||
$limit = (int) $config['block_size'];
|
||||
$offset = (int) get_parameter('offset');
|
||||
|
||||
|
@ -559,9 +625,15 @@ $where = sprintf('delete_pending = 0 AND id_agente = %s', $id_agente);
|
|||
|
||||
$search_string_entities = io_safe_input($search_string);
|
||||
|
||||
$basic_where = sprintf("(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND", $search_string, $search_string_entities, $search_string, $search_string_entities);
|
||||
$basic_where = sprintf(
|
||||
"(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND",
|
||||
$search_string,
|
||||
$search_string_entities,
|
||||
$search_string,
|
||||
$search_string_entities
|
||||
);
|
||||
|
||||
// Tags acl
|
||||
// Tags acl.
|
||||
$agent_tags = tags_get_user_applied_agent_tags($id_agente);
|
||||
if ($agent_tags !== true) {
|
||||
$where_tags = ' AND ttag_module.id_tag IN ('.implode(',', $agent_tags).')';
|
||||
|
@ -619,7 +691,7 @@ if ($modules === false) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Prepare pagination
|
||||
// Prepare pagination.
|
||||
$url = '?'.'sec=gagente&'.'tab=module&'.'sec2=godmode/agentes/configurar_agente&'.'id_agente='.$id_agente.'&'.'sort_field='.$sortField.'&'.'&sort='.$sort.'&'.'search_string='.urlencode($search_string);
|
||||
|
||||
if ($paginate_module) {
|
||||
|
@ -635,17 +707,48 @@ $table = new stdClass();
|
|||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
$table->head = [];
|
||||
$table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->head[0] = __('Name').ui_get_sorting_arrows($url_name.'up', $url_name.'down', $selectNameUp, $selectNameDown);
|
||||
$table->head['checkbox'] = html_print_checkbox(
|
||||
'all_delete',
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false
|
||||
);
|
||||
$table->head[0] = __('Name').ui_get_sorting_arrows(
|
||||
$url_name.'up',
|
||||
$url_name.'down',
|
||||
$selectNameUp,
|
||||
$selectNameDown
|
||||
);
|
||||
|
||||
// The access to the policy is granted only with AW permission
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl($config['id_user'], $agent['id_grupo'], 'AW')) {
|
||||
// The access to the policy is granted only with AW permission.
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl(
|
||||
$config['id_user'],
|
||||
$agent['id_grupo'],
|
||||
'AW'
|
||||
)
|
||||
) {
|
||||
$table->head[1] = "<span title='".__('Policy')."'>".__('P.').'</span>';
|
||||
}
|
||||
|
||||
$table->head[2] = "<span title='".__('Server')."'>".__('S.').'</span>'.ui_get_sorting_arrows($url_server.'up', $url_server.'down', $selectServerUp, $selectServerDown);
|
||||
$table->head[3] = __('Type').ui_get_sorting_arrows($url_type.'up', $url_type.'down', $selectTypeUp, $selectTypeDown);
|
||||
$table->head[4] = __('Interval').ui_get_sorting_arrows($url_interval.'up', $url_interval.'down', $selectIntervalUp, $selectIntervalDown);
|
||||
$table->head[2] = "<span title='".__('Server')."'>".__('S.').'</span>'.ui_get_sorting_arrows(
|
||||
$url_server.'up',
|
||||
$url_server.'down',
|
||||
$selectServerUp,
|
||||
$selectServerDown
|
||||
);
|
||||
$table->head[3] = __('Type').ui_get_sorting_arrows(
|
||||
$url_type.'up',
|
||||
$url_type.'down',
|
||||
$selectTypeUp,
|
||||
$selectTypeDown
|
||||
);
|
||||
$table->head[4] = __('Interval').ui_get_sorting_arrows(
|
||||
$url_interval.'up',
|
||||
$url_interval.'down',
|
||||
$selectIntervalUp,
|
||||
$selectIntervalDown
|
||||
);
|
||||
$table->head[5] = __('Description');
|
||||
$table->head[6] = __('Status');
|
||||
$table->head[7] = __('Warn');
|
||||
|
@ -690,7 +793,16 @@ if ($checked) {
|
|||
}
|
||||
|
||||
foreach ($modules as $module) {
|
||||
if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') && ! check_acl_one_of_groups($config['id_user'], $all_groups, 'AD')) {
|
||||
if (! check_acl_one_of_groups(
|
||||
$config['id_user'],
|
||||
$all_groups,
|
||||
'AW'
|
||||
) && ! check_acl_one_of_groups(
|
||||
$config['id_user'],
|
||||
$all_groups,
|
||||
'AD'
|
||||
)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -712,7 +824,9 @@ foreach ($modules as $module) {
|
|||
if (!$checked) {
|
||||
if ($module['id_module_group'] != $last_modulegroup) {
|
||||
$last_modulegroup = $module['id_module_group'];
|
||||
$data[0] = '<strong>'.modules_get_modulegroup_name($last_modulegroup).'</strong>';
|
||||
$data[0] = '<strong>'.modules_get_modulegroup_name(
|
||||
$last_modulegroup
|
||||
).'</strong>';
|
||||
$i = array_push($table->data, $data);
|
||||
$table->rowstyle[($i - 1)] = 'text-align: center';
|
||||
$table->rowclass[($i - 1)] = 'datos3';
|
||||
|
@ -727,14 +841,23 @@ foreach ($modules as $module) {
|
|||
}
|
||||
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
$data['checkbox'] = html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
|
||||
$data['checkbox'] = html_print_checkbox(
|
||||
'id_delete[]',
|
||||
$module['id_agente_modulo'],
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$data[0] = '';
|
||||
|
||||
if (isset($module['deep']) && ($module['deep'] != 0)) {
|
||||
$data[0] .= str_repeat(' ', $module['deep']);
|
||||
$data[0] .= html_print_image('images/icono_escuadra.png', true, ['style' => 'padding-bottom: inherit;']).' ';
|
||||
$data[0] .= html_print_image(
|
||||
'images/icono_escuadra.png',
|
||||
true,
|
||||
['style' => 'padding-bottom: inherit;']
|
||||
).' ';
|
||||
}
|
||||
|
||||
if ($module['quiet']) {
|
||||
|
@ -754,17 +877,38 @@ foreach ($modules as $module) {
|
|||
}
|
||||
|
||||
if ($module['disabled']) {
|
||||
$data[0] .= '<em class="disabled_module">'.ui_print_truncate_text($module['nombre'], 'module_medium', false, true, true, '[…]', 'font-size: 7.2pt').'</em>';
|
||||
$data[0] .= '<em class="disabled_module">'.ui_print_truncate_text(
|
||||
$module['nombre'],
|
||||
'module_medium',
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
'[…]',
|
||||
'font-size: 7.2pt'
|
||||
).'</em>';
|
||||
} else {
|
||||
$data[0] .= ui_print_truncate_text($module['nombre'], 'module_medium', false, true, true, '[…]', 'font-size: 7.2pt');
|
||||
$data[0] .= ui_print_truncate_text(
|
||||
$module['nombre'],
|
||||
'module_medium',
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
'[…]',
|
||||
'font-size: 7.2pt'
|
||||
);
|
||||
}
|
||||
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
$data[0] .= '</a>';
|
||||
}
|
||||
|
||||
// The access to the policy is granted only with AW permission
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl($config['id_user'], $agent['id_grupo'], 'AW')) {
|
||||
// The access to the policy is granted only with AW permission.
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl(
|
||||
$config['id_user'],
|
||||
$agent['id_grupo'],
|
||||
'AW'
|
||||
)
|
||||
) {
|
||||
$policyInfo = policies_info_module_policy($module['id_agente_modulo']);
|
||||
if ($policyInfo === false) {
|
||||
$data[1] = '';
|
||||
|
@ -798,17 +942,27 @@ foreach ($modules as $module) {
|
|||
}
|
||||
}
|
||||
|
||||
// Module type (by server type )
|
||||
// Module type (by server type ).
|
||||
$data[2] = '';
|
||||
if ($module['id_modulo'] > 0) {
|
||||
$data[2] = servers_show_type($module['id_modulo']);
|
||||
}
|
||||
|
||||
$module_status = db_get_row('tagente_estado', 'id_agente_modulo', $module['id_agente_modulo']);
|
||||
$module_status = db_get_row(
|
||||
'tagente_estado',
|
||||
'id_agente_modulo',
|
||||
$module['id_agente_modulo']
|
||||
);
|
||||
|
||||
modules_get_status($module['id_agente_modulo'], $module_status['estado'], $module_status['datos'], $status, $title);
|
||||
modules_get_status(
|
||||
$module['id_agente_modulo'],
|
||||
$module_status['estado'],
|
||||
$module_status['datos'],
|
||||
$status,
|
||||
$title
|
||||
);
|
||||
|
||||
// This module is initialized ? (has real data)
|
||||
// This module is initialized ? (has real data).
|
||||
if ($status == STATUS_MODULE_NO_DATA) {
|
||||
$data[2] .= html_print_image(
|
||||
'images/error.png',
|
||||
|
@ -817,13 +971,13 @@ foreach ($modules as $module) {
|
|||
);
|
||||
}
|
||||
|
||||
// Module type (by data type)
|
||||
// Module type (by data type).
|
||||
$data[3] = '';
|
||||
if ($type) {
|
||||
$data[3] = ui_print_moduletype_icon($type, true);
|
||||
}
|
||||
|
||||
// Module interval
|
||||
// Module interval.
|
||||
if ($module['module_interval']) {
|
||||
$data[4] = human_time_description_raw($module['module_interval']);
|
||||
} else {
|
||||
|
@ -831,12 +985,23 @@ foreach ($modules as $module) {
|
|||
}
|
||||
|
||||
if ($module['id_modulo'] == MODULE_DATA && $module['id_policy_module'] != 0) {
|
||||
$data[4] .= ui_print_help_tip(__('The policy modules of data type will only update their intervals when policy is applied.'), true);
|
||||
$data[4] .= ui_print_help_tip(
|
||||
__('The policy modules of data type will only update their intervals when policy is applied.'),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$data[5] = ui_print_truncate_text($module['descripcion'], 'description', false);
|
||||
$data[5] = ui_print_truncate_text(
|
||||
$module['descripcion'],
|
||||
'description',
|
||||
false
|
||||
);
|
||||
|
||||
$data[6] = ui_print_status_image($status, htmlspecialchars($title), true);
|
||||
$data[6] = ui_print_status_image(
|
||||
$status,
|
||||
htmlspecialchars($title),
|
||||
true
|
||||
);
|
||||
|
||||
// MAX / MIN values.
|
||||
if ($module['id_tipo_modulo'] != 25) {
|
||||
|
@ -884,7 +1049,7 @@ foreach ($modules as $module) {
|
|||
);
|
||||
$data[8] .= '</a> ';
|
||||
|
||||
// Make a data normalization
|
||||
// Make a data normalization.
|
||||
if (isset($numericModules[$type])) {
|
||||
if ($numericModules[$type] === true) {
|
||||
$data[8] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&fix_module='.$module['id_agente_modulo'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
|
@ -904,7 +1069,7 @@ foreach ($modules as $module) {
|
|||
$data[8] .= ' ';
|
||||
}
|
||||
|
||||
// create network component action
|
||||
// Create network component action.
|
||||
if ((is_user_admin($config['id_user']))
|
||||
&& ($module['id_modulo'] == MODULE_NETWORK)
|
||||
) {
|
||||
|
@ -927,7 +1092,7 @@ foreach ($modules as $module) {
|
|||
}
|
||||
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
// Delete module
|
||||
// Delete module.
|
||||
$data[9] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
|
||||
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
$data[9] .= html_print_image(
|
||||
|
@ -959,7 +1124,12 @@ html_print_table($table);
|
|||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_input_hidden('multiple_delete', 1);
|
||||
html_print_submit_button(__('Delete'), 'multiple_delete', false, 'class="sub delete"');
|
||||
html_print_submit_button(
|
||||
__('Delete'),
|
||||
'multiple_delete',
|
||||
false,
|
||||
'class="sub delete"'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
|
|
@ -1290,7 +1290,7 @@ ui_require_jquery_file('json');
|
|||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
var disabledBecauseInPolicy = '<?php echo $disabledBecauseInPolicy; ?>';
|
||||
var disabledBecauseInPolicy = <?php echo '\''.(empty($disabledBecauseInPolicy) === true ? '0' : '1').'\''; ?>;
|
||||
$("#right").click (function () {
|
||||
jQuery.each($("select[name='id_tag_available[]'] option:selected"), function (key, value) {
|
||||
tag_name = $(value).html();
|
||||
|
@ -1551,7 +1551,10 @@ $(document).ready (function () {
|
|||
|
||||
//readonly and add class input
|
||||
function disabled_status (disabledBecauseInPolicy) {
|
||||
if($('#dynamic_interval_select').val() != 0 && $('#dynamic_interval').val() != 0){
|
||||
var dynamic_interval_select_value = $('#dynamic_interval_select').val();
|
||||
var dynamic_interval_value = $('#dynamic_interval_select').val();
|
||||
if(typeof dynamic_interval_select_value != "undefined" && typeof dynamic_interval_value != "undefined"
|
||||
&& dynamic_interval_select_value != 0 && dynamic_interval_value != 0){
|
||||
$('#text-min_warning').prop('readonly', true);
|
||||
$('#text-min_warning').addClass('readonly');
|
||||
$('#text-max_warning').prop('readonly', true);
|
||||
|
|
|
@ -464,6 +464,8 @@ $data[1] = html_print_select(
|
|||
$disabledBecauseInPolicy
|
||||
);
|
||||
|
||||
$data[1] .= '<br> <br><a class="info_cell" href="'.ui_get_full_url('index.php?sec=gagente&sec2=godmode/groups/group_list&tab=credbox').'">'.__('Manage credentials').'</a>';
|
||||
|
||||
$array_os = [
|
||||
'inherited' => __('Inherited'),
|
||||
'linux' => __('SSH'),
|
||||
|
|
|
@ -1,17 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Alert actions
|
||||
*
|
||||
* @category Alerts
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Load global vars
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_alerts.php';
|
||||
|
@ -63,9 +78,9 @@ if ($copy_action) {
|
|||
$al_action = alerts_get_alert_action($id);
|
||||
|
||||
if ($al_action !== false) {
|
||||
// If user tries to copy an action with group=ALL
|
||||
// If user tries to copy an action with group=ALL.
|
||||
if ($al_action['id_group'] == 0) {
|
||||
// then must have "PM" access privileges
|
||||
// Then must have "PM" access privileges.
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
|
@ -74,17 +89,20 @@ if ($copy_action) {
|
|||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
} //end if
|
||||
else {
|
||||
} else {
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
||||
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM'));
|
||||
$own_groups = array_keys(
|
||||
users_get_groups($config['id_user'], 'LM')
|
||||
);
|
||||
} else {
|
||||
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM', false));
|
||||
$own_groups = array_keys(
|
||||
users_get_groups($config['id_user'], 'LM', false)
|
||||
);
|
||||
}
|
||||
|
||||
$is_in_group = in_array($al_action['id_group'], $own_groups);
|
||||
// Then action group have to be in his own groups
|
||||
// Then action group have to be in his own groups.
|
||||
if (!$is_in_group) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
|
@ -99,9 +117,15 @@ if ($copy_action) {
|
|||
$result = alerts_clone_alert_action($id);
|
||||
|
||||
if ($result) {
|
||||
db_pandora_audit('Command management', 'Duplicate alert action '.$id.' clone to '.$result);
|
||||
db_pandora_audit(
|
||||
'Command management',
|
||||
'Duplicate alert action '.$id.' clone to '.$result
|
||||
);
|
||||
} else {
|
||||
db_pandora_audit('Command management', 'Fail try to duplicate alert action '.$id);
|
||||
db_pandora_audit(
|
||||
'Command management',
|
||||
'Fail try to duplicate alert action '.$id
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
|
@ -121,9 +145,9 @@ if ($delete_action) {
|
|||
$al_action = alerts_get_alert_action($id);
|
||||
|
||||
if ($al_action !== false) {
|
||||
// If user tries to delete an action with group=ALL
|
||||
// If user tries to delete an action with group=ALL.
|
||||
if ($al_action['id_group'] == 0) {
|
||||
// then must have "PM" access privileges
|
||||
// Then must have "PM" access privileges.
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
|
@ -133,17 +157,21 @@ if ($delete_action) {
|
|||
exit;
|
||||
}
|
||||
|
||||
// If user tries to delete an action of others groups
|
||||
// If user tries to delete an action of others groups.
|
||||
} else {
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
||||
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM'));
|
||||
$own_groups = array_keys(
|
||||
users_get_groups($config['id_user'], 'LM')
|
||||
);
|
||||
} else {
|
||||
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM', false));
|
||||
$own_groups = array_keys(
|
||||
users_get_groups($config['id_user'], 'LM', false)
|
||||
);
|
||||
}
|
||||
|
||||
$is_in_group = in_array($al_action['id_group'], $own_groups);
|
||||
// Then action group have to be in his own groups
|
||||
// Then action group have to be in his own groups.
|
||||
if (!$is_in_group) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
|
@ -159,9 +187,15 @@ if ($delete_action) {
|
|||
$result = alerts_delete_alert_action($id);
|
||||
|
||||
if ($result) {
|
||||
db_pandora_audit('Command management', 'Delete alert action #'.$id);
|
||||
db_pandora_audit(
|
||||
'Command management',
|
||||
'Delete alert action #'.$id
|
||||
);
|
||||
} else {
|
||||
db_pandora_audit('Command management', 'Fail try to delete alert action #'.$id);
|
||||
db_pandora_audit(
|
||||
'Command management',
|
||||
'Fail try to delete alert action #'.$id
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
|
@ -179,6 +213,8 @@ if (is_central_policies_on_node() === true) {
|
|||
|
||||
$search_string = (string) get_parameter('search_string', '');
|
||||
$group = (int) get_parameter('group', 0);
|
||||
$group_search = (int) get_parameter('group_search', 0);
|
||||
$id_command_search = (int) get_parameter('id_command_search', 0);
|
||||
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions';
|
||||
|
||||
// Filter table.
|
||||
|
@ -188,6 +224,7 @@ $table_filter->class = 'databox filters';
|
|||
$table_filter->style = [];
|
||||
$table_filter->style[0] = 'font-weight: bold';
|
||||
$table_filter->style[2] = 'font-weight: bold';
|
||||
$table_filter->style[4] = 'font-weight: bold';
|
||||
$table_filter->data = [];
|
||||
|
||||
$table_filter->data[0][0] = __('Search');
|
||||
|
@ -200,16 +237,54 @@ $table_filter->data[0][1] = html_print_input_text(
|
|||
true
|
||||
);
|
||||
$table_filter->data[0][2] = __('Group');
|
||||
$table_filter->data[0][3] = html_print_select_groups($config['id_user'], 'LM', true, 'group', $group, '', '', 0, true);
|
||||
$table_filter->data[0][4] = '<div class="action-buttons">';
|
||||
$table_filter->data[0][4] .= html_print_submit_button(
|
||||
$table_filter->data[0][3] = html_print_select_groups(
|
||||
$config['id_user'],
|
||||
'LM',
|
||||
true,
|
||||
'group_search',
|
||||
$group_search,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
);
|
||||
$table_filter->data[0][4] = __('Command');
|
||||
$commands_sql = db_get_all_rows_filter(
|
||||
'talert_commands',
|
||||
['id_group' => array_keys(users_get_groups(false, 'LW'))],
|
||||
[
|
||||
'id',
|
||||
'name',
|
||||
],
|
||||
'AND',
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
$commands = db_get_all_rows_sql($commands_sql);
|
||||
$table_filter->data[0][5] = html_print_select(
|
||||
index_array($commands, 'id', 'name'),
|
||||
'id_command_search',
|
||||
$id_command_search,
|
||||
'',
|
||||
__('None'),
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:150px'
|
||||
);
|
||||
$table_filter->data[0][6] = '<div class="action-buttons">';
|
||||
$table_filter->data[0][6] .= html_print_submit_button(
|
||||
__('Search'),
|
||||
'',
|
||||
false,
|
||||
'class="sub search"',
|
||||
true
|
||||
);
|
||||
$table_filter->data[0][4] .= '</div>';
|
||||
$table_filter->data[0][5] .= '</div>';
|
||||
|
||||
|
||||
$show_table_filter = '<form method="post" action="'.$url.'">';
|
||||
|
@ -228,41 +303,49 @@ $table->class = 'info_table';
|
|||
$table->data = [];
|
||||
$table->head = [];
|
||||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Group');
|
||||
$table->head[1] = __('Command');
|
||||
$table->head[2] = __('Group');
|
||||
if (is_central_policies_on_node() === false) {
|
||||
$table->head[2] = __('Copy');
|
||||
$table->head[3] = __('Delete');
|
||||
$table->head[3] = __('Copy');
|
||||
$table->head[4] = __('Delete');
|
||||
}
|
||||
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->size = [];
|
||||
$table->size[1] = '200px';
|
||||
$table->size[2] = '40px';
|
||||
$table->size[3] = '40px';
|
||||
$table->size[4] = '40px';
|
||||
$table->align = [];
|
||||
$table->align[1] = 'left';
|
||||
$table->align[2] = 'left';
|
||||
$table->align[3] = 'left';
|
||||
$table->align[4] = 'left';
|
||||
|
||||
$filter = [];
|
||||
if (!is_user_admin($config['id_user']) && $group === 0) {
|
||||
$filter['talert_actions.id_group'] = array_keys(users_get_groups(false, 'LM'));
|
||||
$filter['talert_actions.id_group'] = array_keys(
|
||||
users_get_groups(false, 'LM')
|
||||
);
|
||||
}
|
||||
|
||||
if ($group !== 0) {
|
||||
$filter['talert_actions.id_group'] = $group;
|
||||
if ($group_search !== 0) {
|
||||
$filter['talert_actions.id_group'] = $group_search;
|
||||
}
|
||||
|
||||
if ($search_string !== '') {
|
||||
$filter['talert_actions.name'] = '%'.$search_string.'%';
|
||||
}
|
||||
|
||||
if ($id_command_search !== 0) {
|
||||
$filter['talert_commands.id'] = $id_command_search;
|
||||
}
|
||||
|
||||
$actions = db_get_all_rows_filter(
|
||||
'talert_actions INNER JOIN talert_commands ON talert_actions.id_alert_command = talert_commands.id',
|
||||
$filter,
|
||||
'talert_actions.* , talert_commands.id_group AS command_group'
|
||||
'talert_actions.* , talert_commands.id_group AS command_group, talert_commands.name AS command_name'
|
||||
);
|
||||
|
||||
if ($actions === false) {
|
||||
$actions = [];
|
||||
}
|
||||
|
@ -288,9 +371,10 @@ foreach ($actions as $action) {
|
|||
$data = [];
|
||||
|
||||
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.$action['name'].'</a>';
|
||||
$data[1] = ui_print_group_icon($action['id_group'], true).' ';
|
||||
$data[1] = $action['command_name'];
|
||||
$data[2] = ui_print_group_icon($action['id_group'], true).' ';
|
||||
if (!alerts_validate_command_to_action($action['id_group'], $action['command_group'])) {
|
||||
$data[1] .= html_print_image(
|
||||
$data[2] .= html_print_image(
|
||||
'images/error.png',
|
||||
true,
|
||||
// FIXME: Translation.
|
||||
|
@ -304,16 +388,16 @@ foreach ($actions as $action) {
|
|||
&& check_acl($config['id_user'], $action['id_group'], 'LM')
|
||||
) {
|
||||
$table->cellclass[] = [
|
||||
2 => 'action_buttons',
|
||||
3 => 'action_buttons',
|
||||
4 => 'action_buttons',
|
||||
];
|
||||
|
||||
$id_action = $action['id'];
|
||||
$text_confirm = __('Are you sure?');
|
||||
|
||||
$data[2] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions"
|
||||
$data[3] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions"
|
||||
onClick="copy_action('.$id_action.',\''.$text_confirm.'\');">'.html_print_image('images/copy.png', true).'</a>';
|
||||
$data[3] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions"
|
||||
$data[4] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions"
|
||||
onClick="delete_action('.$id_action.',\''.$text_confirm.'\');">'.html_print_image('images/cross.png', true).'</a>';
|
||||
}
|
||||
|
||||
|
@ -346,7 +430,7 @@ function copy_action(id_action, text_confirm) {
|
|||
if (!confirm(text_confirm)) {
|
||||
return false;
|
||||
} else {
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page" : "godmode/alerts/alert_actions",
|
||||
"copy_action" : 1,
|
||||
|
|
|
@ -291,8 +291,8 @@ if (is_ajax()) {
|
|||
'field'.$i.'_value',
|
||||
'',
|
||||
'',
|
||||
__('None'),
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
|
|
|
@ -203,7 +203,7 @@ if ($searchFlag) {
|
|||
}
|
||||
|
||||
if ($actionID != -1 && $actionID != '') {
|
||||
$where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.')';
|
||||
$where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.'))';
|
||||
}
|
||||
|
||||
if ($enabledisable != -1 && $enabledisable != '') {
|
||||
|
|
|
@ -362,6 +362,7 @@ $templates = alerts_get_alert_templates(
|
|||
'description',
|
||||
'type',
|
||||
'id_group',
|
||||
'previous_name',
|
||||
]
|
||||
);
|
||||
if ($templates === false) {
|
||||
|
|
|
@ -60,7 +60,7 @@ if ($al_action !== false) {
|
|||
__('Alerts').' » '.__('Configure alert action'),
|
||||
'images/gm_alerts.png',
|
||||
false,
|
||||
'',
|
||||
'alert_config',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ if ($al_action !== false) {
|
|||
__('Alerts').' » '.__('Configure alert action'),
|
||||
'images/gm_alerts.png',
|
||||
false,
|
||||
'',
|
||||
'alert_config',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
@ -283,12 +283,12 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
|||
// Store the value in a hidden to keep it on first execution
|
||||
$table->data['field'.$i][1] .= html_print_input_hidden(
|
||||
'field'.$i.'_value',
|
||||
!empty($action['field'.$i]) ? $action['field'.$i] : '',
|
||||
(!empty($action['field'.$i]) || $action['field'.$i] == 0) ? $action['field'.$i] : '',
|
||||
true
|
||||
);
|
||||
$table->data['field'.$i][2] .= html_print_input_hidden(
|
||||
'field'.$i.'_recovery_value',
|
||||
!empty($action['field'.$i.'_recovery']) ? $action['field'.$i.'_recovery'] : '',
|
||||
(!empty($action['field'.$i.'_recovery']) || $action['field'.$i] == 0) ? $action['field'.$i.'_recovery'] : '',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
|
|
@ -83,6 +83,10 @@ if ($update_command) {
|
|||
$values['command'] = $command;
|
||||
$values['description'] = $description;
|
||||
$values['id_group'] = $id_group;
|
||||
// Only for Metaconsole. Save the previous name for synchronizing.
|
||||
if (is_metaconsole()) {
|
||||
$values['previous_name'] = db_get_value('name', 'talert_commands', 'id', $id);
|
||||
}
|
||||
|
||||
// Check it the new name is used in the other command.
|
||||
$id_check = db_get_value('id', 'talert_commands', 'name', $name);
|
||||
|
|
|
@ -34,6 +34,9 @@ if (! check_acl($config['id_user'], 0, 'LM')) {
|
|||
$duplicate_template = (bool) get_parameter('duplicate_template');
|
||||
$id = (int) get_parameter('id');
|
||||
$pure = get_parameter('pure', 0);
|
||||
$step = (int) get_parameter('step', 1);
|
||||
// We set here the number of steps.
|
||||
define('LAST_STEP', 3);
|
||||
|
||||
// If user tries to duplicate/edit a template with group=ALL then must have "PM" access privileges
|
||||
if ($duplicate_template) {
|
||||
|
@ -56,7 +59,6 @@ if ($a_template !== false) {
|
|||
if (defined('METACONSOLE')) {
|
||||
alerts_meta_print_header();
|
||||
} else {
|
||||
$step = (int) get_parameter('step', 1);
|
||||
if ($step == 1) {
|
||||
$help_header = '';
|
||||
} else if ($step == 2) {
|
||||
|
@ -113,7 +115,6 @@ if ($a_template !== false) {
|
|||
if (defined('METACONSOLE')) {
|
||||
alerts_meta_print_header();
|
||||
} else {
|
||||
$step = (int) get_parameter('step', 1);
|
||||
if ($step == 1) {
|
||||
$help_header = '';
|
||||
} else if ($step == 2) {
|
||||
|
@ -252,24 +253,20 @@ function update_template($step)
|
|||
$wizard_level = (string) get_parameter('wizard_level');
|
||||
$priority = (int) get_parameter('priority');
|
||||
$id_group = get_parameter('id_group');
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
$name_check = db_get_value('name', 'talert_templates', 'name', $name);
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$name_check = db_get_value('name', 'talert_templates', 'to_char(name)', $name);
|
||||
break;
|
||||
// Only for Metaconsole. Save the previous name for synchronizing.
|
||||
if (is_metaconsole()) {
|
||||
$previous_name = db_get_value('name', 'talert_templates', 'id', $id);
|
||||
} else {
|
||||
$previous_name = '';
|
||||
}
|
||||
|
||||
$values = [
|
||||
'name' => $name,
|
||||
'description' => $description,
|
||||
'id_group' => $id_group,
|
||||
'priority' => $priority,
|
||||
'wizard_level' => $wizard_level,
|
||||
'name' => $name,
|
||||
'description' => $description,
|
||||
'id_group' => $id_group,
|
||||
'priority' => $priority,
|
||||
'wizard_level' => $wizard_level,
|
||||
'previous_name' => $previous_name,
|
||||
];
|
||||
|
||||
$result = alerts_update_alert_template($id, $values);
|
||||
|
|
|
@ -35,12 +35,15 @@ global $config;
|
|||
|
||||
check_login();
|
||||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
require_once $config['homedir'].'/include/functions_groups.php';
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
enterprise_include_once('meta/include/functions_agents_meta.php');
|
||||
|
||||
if (is_metaconsole()) {
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
enterprise_include_once('meta/include/functions_agents_meta.php');
|
||||
enterprise_hook('open_meta_frame');
|
||||
}
|
||||
|
||||
if (is_ajax()) {
|
||||
if (! check_acl($config['id_user'], 0, 'AR')) {
|
||||
|
@ -714,7 +717,12 @@ if ($tab == 'tree') {
|
|||
|
||||
foreach ($groups as $key => $group) {
|
||||
$url = 'index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$group['id_grupo'];
|
||||
$url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'];
|
||||
if (is_metaconsole()) {
|
||||
$url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'].'&tab=groups';
|
||||
} else {
|
||||
$url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'];
|
||||
}
|
||||
|
||||
$table->data[$key][0] = $group['id_grupo'];
|
||||
$table->data[$key][1] = '<a href="'.$url.'">'.$group['nombre'].'</a>';
|
||||
if ($group['icon'] != '') {
|
||||
|
|
|
@ -124,6 +124,9 @@ if (check_acl($config['id_user'], 0, 'PM')) {
|
|||
if (check_acl($config['id_user'], 0, 'UM')) {
|
||||
$sub['godmode/users/user_list']['text'] = __('Users management');
|
||||
$sub['godmode/users/user_list']['id'] = 'Users management';
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$sub['godmode/users/profile_list']['text'] = __('Profile management');
|
||||
$sub['godmode/users/profile_list']['id'] = 'Profile management';
|
||||
}
|
||||
|
|
|
@ -330,7 +330,7 @@ if ($create_component) {
|
|||
|
||||
if ($name && !$name_check) {
|
||||
$id = network_components_create_network_component(
|
||||
$name,
|
||||
strip_tags(io_safe_input($name), '<br>'),
|
||||
$type,
|
||||
$id_group,
|
||||
[
|
||||
|
@ -431,7 +431,7 @@ if ($update_component) {
|
|||
$id,
|
||||
[
|
||||
'type' => $type,
|
||||
'name' => $name,
|
||||
'name' => strip_tags(io_safe_input($name, '<br>')),
|
||||
'id_group' => $id_group,
|
||||
'description' => $description,
|
||||
'module_interval' => $module_interval,
|
||||
|
|
|
@ -111,7 +111,7 @@ if (isset($id)) {
|
|||
$component = network_components_get_network_component((int) $id);
|
||||
if ($component !== false) {
|
||||
$id_component_type = $component['id_modulo'];
|
||||
$name = $component['name'];
|
||||
$name = io_safe_output($component['name']);
|
||||
$type = $component['type'];
|
||||
$description = $component['description'];
|
||||
$max = $component['max'];
|
||||
|
|
|
@ -180,7 +180,7 @@ $data[1] = html_print_extended_select_for_post_process(
|
|||
'post_process',
|
||||
$post_process,
|
||||
'',
|
||||
__('Empty'),
|
||||
'',
|
||||
'0',
|
||||
false,
|
||||
true,
|
||||
|
|
|
@ -164,9 +164,9 @@ echo '</div></td></tr>';
|
|||
|
||||
echo "<tr><td class='datos2'><b>".__('Percentil').'</b></td>';
|
||||
echo "<td class='datos2'>".html_print_checkbox('percentil', 1, $percentil, true).'</td>';
|
||||
echo "<td class='datos2'><div id='thresholdDiv' name='thresholdDiv'><b>".__('Equalize maximum thresholds').'</b>';
|
||||
html_print_checkbox('threshold', CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, $check, false, false, '', false);
|
||||
echo '</div></td></tr>';
|
||||
echo "<td class='datos2 thresholdDiv'><b>".__('Equalize maximum thresholds').'</b></td>';
|
||||
echo "<td class='datos2 thresholdDiv'>".html_print_checkbox('threshold', CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, $check, true, false, '', false);
|
||||
echo '</td></tr>';
|
||||
echo "<tr><td class='datos2'><b>".__('Add summatory series').'</b></td>';
|
||||
echo "<td class='datos2'>".html_print_checkbox('summatory_series', 1, $summatory_series, true)."</td>
|
||||
<td class='datos2'><b>".__('Add average series').'</b></td>';
|
||||
|
@ -175,6 +175,7 @@ echo "<tr><td class='datos2'><b>".__('Modules and series').'</b></td>';
|
|||
|
||||
echo "<td class='datos2'>".html_print_checkbox('modules_series', 1, $modules_series, true).'</td>';
|
||||
echo "<td class='datos2'><b>".__('Show full scale graph (TIP)').'</td>';
|
||||
echo "<td class='datos2'>".html_print_checkbox('fullscale', 1, $fullscale, true).'</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
|
||||
|
@ -190,9 +191,9 @@ echo '</form>';
|
|||
echo '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
if ($("#stacked").val() == '.CUSTOM_GRAPH_BULLET_CHART.') {
|
||||
$("#thresholdDiv").show();
|
||||
$(".thresholdDiv").show();
|
||||
}else{
|
||||
$("#thresholdDiv").hide();
|
||||
$(".thresholdDiv").hide();
|
||||
}
|
||||
|
||||
if(!$("#checkbox-summatory_series").is(":checked") && !$("#checkbox-average_series").is(":checked")){
|
||||
|
@ -207,16 +208,16 @@ echo '<script type="text/javascript">
|
|||
$("[name=threshold]").prop("checked", false);
|
||||
$(".stacked").hide();
|
||||
$("input[name=\'width\']").hide();
|
||||
$("#thresholdDiv").hide();
|
||||
$(".thresholdDiv").hide();
|
||||
} else if ($(this).val() == '.CUSTOM_GRAPH_BULLET_CHART.') {
|
||||
$("#thresholdDiv").show();
|
||||
$(".thresholdDiv").show();
|
||||
$(".stacked").show();
|
||||
$("input[name=\'width\']").show();
|
||||
} else {
|
||||
$("[name=threshold]").prop("checked", false);
|
||||
$(".stacked").show();
|
||||
$("input[name=\'width\']").show();
|
||||
$("#thresholdDiv").hide();
|
||||
$(".thresholdDiv").hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -71,12 +71,6 @@ if ($is_enterprise !== ENTERPRISE_NOT_HOOK && $vconsoles_manage) {
|
|||
'active' => false,
|
||||
'text' => '<a href="'.$url_visual_console_template_wizard.'">'.html_print_image('images/wand.png', true, ['title' => __('Visual Console Template Wizard')]).'</a>',
|
||||
];
|
||||
if ($is_metaconsole) {
|
||||
$buttons['visual_console_manager'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_visual_console_manager.'">'.html_print_image('images/builder.png', true, ['title' => __('Visual Console Manager')]).'</a>',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (!$is_metaconsole) {
|
||||
|
|
|
@ -107,6 +107,7 @@ $saturday = true;
|
|||
$sunday = true;
|
||||
$time_from = '00:00:00';
|
||||
$time_to = '00:00:00';
|
||||
$compare_work_time = false;
|
||||
$show_graph = 0;
|
||||
$sla_sorted_by = 0;
|
||||
$id_agents = '';
|
||||
|
@ -315,6 +316,7 @@ switch ($action) {
|
|||
$sunday = $item['sunday'];
|
||||
$time_from = $item['time_from'];
|
||||
$time_to = $item['time_to'];
|
||||
$compare_work_time = $item['compare_work_time'];
|
||||
$show_graph = $item['show_graph'];
|
||||
$priority_mode = isset($style['priority_mode']) ? $style['priority_mode'] : REPORT_PRIORITY_MODE_OK;
|
||||
// 'top_n' filed will be reused for SLA sort option.
|
||||
|
@ -622,6 +624,7 @@ switch ($action) {
|
|||
$sunday = $item['sunday'];
|
||||
$time_from = $item['time_from'];
|
||||
$time_to = $item['time_to'];
|
||||
$compare_work_time = $item['compare_work_time'];
|
||||
$total_time = $item['total_time'];
|
||||
$time_failed = $item['time_failed'];
|
||||
$time_in_ok_status = $item['time_in_ok_status'];
|
||||
|
@ -1213,6 +1216,22 @@ $class = 'databox filters';
|
|||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row_working_time_compare">
|
||||
<td>
|
||||
<?php
|
||||
echo __('Show 24x7 item');
|
||||
?>
|
||||
</td>
|
||||
<td colspan="6">
|
||||
<?php
|
||||
html_print_checkbox(
|
||||
'compare_work_time',
|
||||
1,
|
||||
$compare_work_time
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -4830,9 +4849,9 @@ function chooseType() {
|
|||
$("#row_failover_mode").hide();
|
||||
$("#row_failover_type").hide();
|
||||
$("#row_working_time").hide();
|
||||
$("#row_working_time_compare").hide();
|
||||
$("#row_only_display_wrong").hide();
|
||||
$("#row_combo_module").hide();
|
||||
$("#row_only_display_wrong").hide();
|
||||
$("#row_group_by_agent").hide();
|
||||
$("#general_list").hide();
|
||||
$("#row_order_uptodown").hide();
|
||||
|
@ -4988,6 +5007,7 @@ function chooseType() {
|
|||
$("#row_period").show();
|
||||
$("#sla_list").show();
|
||||
$("#row_working_time").show();
|
||||
$("#row_working_time_compare").show();
|
||||
$("#row_only_display_wrong").show();
|
||||
$("#row_show_graph").show();
|
||||
$("#row_sort").show();
|
||||
|
@ -5000,6 +5020,7 @@ function chooseType() {
|
|||
$("#row_period").show();
|
||||
$("#sla_list").show();
|
||||
$("#row_working_time").show();
|
||||
$("#row_working_time_compare").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
$("#row_priority_mode").show();
|
||||
$("#row_failover_mode").show();
|
||||
|
@ -5278,6 +5299,7 @@ function chooseType() {
|
|||
$("#row_show_address_agent").show();
|
||||
$("#row_show_resume").show();
|
||||
$("#row_working_time").show();
|
||||
$("#row_working_time_compare").show();
|
||||
$('#row_hide_notinit_agents').show();
|
||||
$('#row_select_fields').show();
|
||||
if($("#checkbox-checkbox_show_resume").is(":checked")){
|
||||
|
|
|
@ -170,6 +170,7 @@ if ($schedule_report != '') {
|
|||
$parameters[4] = get_parameter('report_type', '');
|
||||
$parameters['first_execution'] = strtotime($date.' '.$time);
|
||||
|
||||
|
||||
$values = [
|
||||
'id_usuario' => $config['id_user'],
|
||||
'id_user_task' => $id_user_task,
|
||||
|
@ -180,9 +181,11 @@ if ($schedule_report != '') {
|
|||
|
||||
$result = db_process_sql_insert('tuser_task_scheduled', $values);
|
||||
|
||||
$report_type = $parameters[4];
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Your report has been planned, and the system will email you a PDF with the report as soon as its finished'),
|
||||
__('Your report has been planned, and the system will email you a '.$report_type.' file with the report as soon as its finished'),
|
||||
__('An error has ocurred')
|
||||
);
|
||||
echo '<br>';
|
||||
|
@ -1379,7 +1382,10 @@ switch ($action) {
|
|||
$values['description'] = get_parameter('description');
|
||||
$values['type'] = get_parameter('type', null);
|
||||
$values['recursion'] = get_parameter('recursion', null);
|
||||
$values['show_extended_events'] = get_parameter('include_extended_events', null);
|
||||
$values['show_extended_events'] = get_parameter(
|
||||
'include_extended_events',
|
||||
null
|
||||
);
|
||||
|
||||
$label = get_parameter('label', '');
|
||||
|
||||
|
@ -1707,6 +1713,10 @@ switch ($action) {
|
|||
$values['friday'] = get_parameter('friday', 0);
|
||||
$values['saturday'] = get_parameter('saturday', 0);
|
||||
$values['sunday'] = get_parameter('sunday', 0);
|
||||
$values['compare_work_time'] = get_parameter(
|
||||
'compare_work_time',
|
||||
0
|
||||
);
|
||||
$values['total_time'] = get_parameter('total_time', 0);
|
||||
$values['time_failed'] = get_parameter(
|
||||
'time_failed',
|
||||
|
@ -2336,7 +2346,6 @@ switch ($action) {
|
|||
'checkbox_only_display_wrong',
|
||||
0
|
||||
);
|
||||
|
||||
$values['monday'] = get_parameter('monday', 0);
|
||||
$values['tuesday'] = get_parameter('tuesday', 0);
|
||||
$values['wednesday'] = get_parameter('wednesday', 0);
|
||||
|
@ -2344,6 +2353,10 @@ switch ($action) {
|
|||
$values['friday'] = get_parameter('friday', 0);
|
||||
$values['saturday'] = get_parameter('saturday', 0);
|
||||
$values['sunday'] = get_parameter('sunday', 0);
|
||||
$values['compare_work_time'] = get_parameter(
|
||||
'compare_work_time',
|
||||
0
|
||||
);
|
||||
$values['total_time'] = get_parameter('total_time', 0);
|
||||
$values['time_failed'] = get_parameter(
|
||||
'time_failed',
|
||||
|
|
|
@ -64,13 +64,6 @@ if ($is_enterprise !== ENTERPRISE_NOT_HOOK && $vconsoles_manage) {
|
|||
'active' => false,
|
||||
'text' => '<a href="'.$url_visual_console_template_wizard.'">'.html_print_image('images/wand.png', true, ['title' => __('Visual Console Template Wizard')]).'</a>',
|
||||
];
|
||||
|
||||
if ($is_metaconsole) {
|
||||
$buttons['visual_console_manager'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_visual_console_manager.'">'.html_print_image('images/builder.png', true, ['title' => __('Visual Console Manager')]).'</a>',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (!$is_metaconsole) {
|
||||
|
|
|
@ -98,6 +98,10 @@ switch ($action) {
|
|||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['description'] = $description;
|
||||
// Only for Metaconsole. Save the previous name for synchronizing.
|
||||
if (is_metaconsole()) {
|
||||
$values['previous_name'] = db_get_value('name', 'tconfig_os', 'id_os', $idOS);
|
||||
}
|
||||
|
||||
if (($icon !== 0) && ($icon != '')) {
|
||||
$values['icon_name'] = $icon;
|
||||
|
|
|
@ -870,8 +870,8 @@ $row++;
|
|||
$table_chars->data[$row][0] = __('Show only average');
|
||||
|
||||
$options_soft_graphs = [];
|
||||
$options_soft_graphs[0] = __('Standard mode');
|
||||
$options_soft_graphs[1] = __('Classic mode');
|
||||
$options_soft_graphs[0] = __('Show only average by default');
|
||||
$options_soft_graphs[1] = __('Show MAX/AVG/MIN by default');
|
||||
|
||||
$table_chars->data[$row][1] = html_print_select($options_soft_graphs, 'type_mode_graph', $config['type_mode_graph'], '', '', 0, true, false, false);
|
||||
$row++;
|
||||
|
@ -1342,6 +1342,15 @@ $row++;
|
|||
|
||||
$row++;
|
||||
|
||||
$decimal_separator = [
|
||||
'.' => '.',
|
||||
',' => ',',
|
||||
];
|
||||
$table_other->data[$row][0] = __('CSV decimal separator').ui_print_help_tip(__('Only for csv reports'), true);
|
||||
$table_other->data[$row][1] = html_print_select($decimal_separator, 'csv_decimal_separator', $config['csv_decimal_separator'], '', '', '', true, false, false);
|
||||
|
||||
$row++;
|
||||
|
||||
$table_other->data[$row][0] = __('Data multiplier to use in graphs/data');
|
||||
$options_data_multiplier = [];
|
||||
$options_data_multiplier[0] = __('Use 1024 when module unit are bytes');
|
||||
|
|
|
@ -79,6 +79,10 @@ if ($update_tag && $id_tag != 0) {
|
|||
$values['url'] = $url_tag;
|
||||
$values['email'] = $email_tag;
|
||||
$values['phone'] = $phone_tag;
|
||||
// Only for Metaconsole. Save the previous name for synchronizing.
|
||||
if (is_metaconsole()) {
|
||||
$values['previous_name'] = db_get_value('name', 'ttag', 'id_tag', $id_tag);
|
||||
}
|
||||
|
||||
$result = false;
|
||||
if ($values['name'] != '') {
|
||||
|
|
|
@ -35,6 +35,10 @@ if ($delete != 0 && is_metaconsole()) {
|
|||
open_meta_frame();
|
||||
}
|
||||
|
||||
if ($tag_name != '' && is_metaconsole()) {
|
||||
open_meta_frame();
|
||||
}
|
||||
|
||||
// Metaconsole nodes
|
||||
$servers = false;
|
||||
if (is_metaconsole()) {
|
||||
|
@ -182,7 +186,7 @@ $row[] = $filter_button;
|
|||
|
||||
$table->data[] = $row;
|
||||
|
||||
$filter_form = '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/tag/tag&delete_tag=0">';
|
||||
$filter_form = '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/tag/tag&tag_name="'.$tag_name.'>';
|
||||
$filter_form .= html_print_table($table, true);
|
||||
$filter_form .= '</form>';
|
||||
// End of filter form
|
||||
|
|
|
@ -112,14 +112,88 @@ if (! check_acl($config['id_user'], 0, 'UM')) {
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Disabled at the moment.
|
||||
if (!check_referer()) {
|
||||
require ("general/noaccess.php");
|
||||
if (is_ajax()) {
|
||||
$delete_profile = (bool) get_parameter('delete_profile');
|
||||
if ($delete_profile) {
|
||||
$id2 = (string) get_parameter('id_user');
|
||||
$id_up = (int) get_parameter('id_user_profile');
|
||||
|
||||
return;
|
||||
$perfilUser = db_get_row('tusuario_perfil', 'id_up', $id_up);
|
||||
$id_perfil = $perfilUser['id_perfil'];
|
||||
$perfil = db_get_row('tperfil', 'id_perfil', $id_perfil);
|
||||
|
||||
db_pandora_audit(
|
||||
'User management',
|
||||
'Deleted profile for user '.io_safe_input($id2),
|
||||
false,
|
||||
false,
|
||||
'The profile with id '.$id_perfil.' in the group '.$perfilUser['id_grupo']
|
||||
);
|
||||
|
||||
$return = profile_delete_user_profile($id2, $id_up);
|
||||
ui_print_result_message(
|
||||
$return,
|
||||
__('Successfully deleted'),
|
||||
__('Could not be deleted')
|
||||
);
|
||||
|
||||
|
||||
$has_profile = db_get_row('tusuario_perfil', 'id_usuario', $id2);
|
||||
if ($has_profile == false) {
|
||||
$result = delete_user($id2);
|
||||
|
||||
if ($result) {
|
||||
db_pandora_audit(
|
||||
'User management',
|
||||
__('Deleted user %s', io_safe_input($id_user))
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Successfully deleted'),
|
||||
__('There was a problem deleting the user')
|
||||
);
|
||||
|
||||
// Delete the user in all the consoles
|
||||
if (defined('METACONSOLE')) {
|
||||
$servers = metaconsole_get_servers();
|
||||
foreach ($servers as $server) {
|
||||
// Connect to the remote console
|
||||
metaconsole_connect($server);
|
||||
|
||||
// Delete the user
|
||||
$result = delete_user($id_user);
|
||||
if ($result) {
|
||||
db_pandora_audit(
|
||||
'User management',
|
||||
__('Deleted user %s from metaconsole', io_safe_input($id_user))
|
||||
);
|
||||
}
|
||||
|
||||
// Restore the db connection
|
||||
metaconsole_restore_db();
|
||||
|
||||
// Log to the metaconsole too
|
||||
if ($result) {
|
||||
db_pandora_audit(
|
||||
'User management',
|
||||
__('Deleted user %s from %s', io_safe_input($id_user), io_safe_input($server['server_name']))
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Successfully deleted from %s', io_safe_input($server['server_name'])),
|
||||
__('There was a problem deleting the user from %s', io_safe_input($server['server_name']))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
$tab = get_parameter('tab', 'user');
|
||||
|
||||
|
@ -168,9 +242,9 @@ if ($config['user_can_update_info']) {
|
|||
$new_user = (bool) get_parameter('new_user');
|
||||
$create_user = (bool) get_parameter('create_user');
|
||||
$add_profile = (bool) get_parameter('add_profile');
|
||||
$delete_profile = (bool) get_parameter('delete_profile');
|
||||
$update_user = (bool) get_parameter('update_user');
|
||||
$status = get_parameter('status', -1);
|
||||
$json_profile = get_parameter('json_profile', '');
|
||||
|
||||
// Reset status var if current action is not update_user
|
||||
if ($new_user || $create_user || $add_profile
|
||||
|
@ -372,6 +446,41 @@ if ($create_user) {
|
|||
|
||||
$user_info = get_user_info($id);
|
||||
$new_user = false;
|
||||
|
||||
if (!empty($json_profile)) {
|
||||
$json_profile = json_decode(io_safe_output($json_profile), true);
|
||||
foreach ($json_profile as $key => $profile) {
|
||||
if (!empty($profile)) {
|
||||
$group2 = $profile['group'];
|
||||
$profile2 = $profile['profile'];
|
||||
$tags = $profile['tags'];
|
||||
foreach ($tags as $k => $tag) {
|
||||
if (empty($tag)) {
|
||||
unset($tags[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
$tags = implode(',', $tags);
|
||||
$no_hierarchy = $profile['hierarchy'];
|
||||
|
||||
db_pandora_audit(
|
||||
'User management',
|
||||
'Added profile for user '.io_safe_input($id2),
|
||||
false,
|
||||
false,
|
||||
'Profile: '.$profile2.' Group: '.$group2.' Tags: '.$tags
|
||||
);
|
||||
|
||||
$result_profile = profile_create_user_profile($id, $profile2, $group2, false, $tags, $no_hierarchy);
|
||||
|
||||
ui_print_result_message(
|
||||
$result_profile,
|
||||
__('Profile added successfully'),
|
||||
__('Profile cannot be added')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$user_info = $values;
|
||||
$new_user = true;
|
||||
|
@ -598,7 +707,7 @@ if ($status != -1) {
|
|||
);
|
||||
}
|
||||
|
||||
if ($add_profile) {
|
||||
if ($add_profile && empty($json_profile)) {
|
||||
$id2 = (string) get_parameter('id');
|
||||
$group2 = (int) get_parameter('assign_group');
|
||||
$profile2 = (int) get_parameter('assign_profile');
|
||||
|
@ -628,34 +737,38 @@ if ($add_profile) {
|
|||
);
|
||||
}
|
||||
|
||||
if ($delete_profile) {
|
||||
$id2 = (string) get_parameter('id_user');
|
||||
$id_up = (int) get_parameter('id_user_profile');
|
||||
|
||||
$perfilUser = db_get_row('tusuario_perfil', 'id_up', $id_up);
|
||||
$id_perfil = $perfilUser['id_perfil'];
|
||||
$perfil = db_get_row('tperfil', 'id_perfil', $id_perfil);
|
||||
|
||||
db_pandora_audit(
|
||||
'User management',
|
||||
'Deleted profile for user '.io_safe_input($id2),
|
||||
false,
|
||||
false,
|
||||
'The profile with id '.$id_perfil.' in the group '.$perfilUser['id_grupo']
|
||||
);
|
||||
|
||||
$return = profile_delete_user_profile($id2, $id_up);
|
||||
ui_print_result_message(
|
||||
$return,
|
||||
__('Successfully deleted'),
|
||||
__('Could not be deleted')
|
||||
);
|
||||
}
|
||||
|
||||
if ($values) {
|
||||
$user_info = $values;
|
||||
}
|
||||
|
||||
if (!users_is_admin() && $config['id_user'] != $id && !$new_user) {
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
if (isset($group_um[0])) {
|
||||
$group_um_string = implode(',', array_keys(users_get_groups($config['id_user'], 'um', true)));
|
||||
} else {
|
||||
$group_um_string = implode(',', array_keys($group_um));
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario_perfil.* FROM tusuario_perfil
|
||||
INNER JOIN tperfil ON tperfil.id_perfil = tusuario_perfil.id_perfil
|
||||
WHERE id_usuario like '%s' AND id_grupo IN (%s) AND user_management = 0",
|
||||
$id,
|
||||
$group_um_string
|
||||
);
|
||||
|
||||
$result = db_get_all_rows_sql($sql);
|
||||
if ($result == false || $user_info['is_admin']) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access User Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if ($id) {
|
||||
echo '<div class="user_form_title">'.__('Update User').'</div>';
|
||||
|
@ -762,19 +875,22 @@ if ($config['user_can_update_password']) {
|
|||
$own_info = get_user_info($config['id_user']);
|
||||
$global_profile = '<div class="label_select_simple user_global_profile" ><span class="input_label" style="margin:0;">'.__('Global Profile').'</span>';
|
||||
$global_profile .= '<div class="switch_radio_button">';
|
||||
$global_profile .= html_print_radio_button_extended(
|
||||
'is_admin',
|
||||
1,
|
||||
[
|
||||
'label' => __('Administrator'),
|
||||
'help_tip' => __('This user has permissions to manage all. An admin user should not requiere additional group permissions, except for using Enterprise ACL.'),
|
||||
],
|
||||
$user_info['is_admin'],
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
if (users_is_admin()) {
|
||||
$global_profile .= html_print_radio_button_extended(
|
||||
'is_admin',
|
||||
1,
|
||||
[
|
||||
'label' => __('Administrator'),
|
||||
'help_tip' => __('This user has permissions to manage all. An admin user should not requiere additional group permissions, except for using Enterprise ACL.'),
|
||||
],
|
||||
$user_info['is_admin'],
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$global_profile .= html_print_radio_button_extended(
|
||||
'is_admin',
|
||||
0,
|
||||
|
@ -1027,7 +1143,7 @@ if ($meta) {
|
|||
$metaconsole_access_node .= html_print_checkbox('metaconsole_access_node', 1, $user_info['metaconsole_access_node'], true).'</div>';
|
||||
}
|
||||
|
||||
echo '<form method="post" autocomplete="off">';
|
||||
echo '<form id="user_profile_form" method="post" autocomplete="off">';
|
||||
|
||||
|
||||
if (!$id) {
|
||||
|
@ -1067,14 +1183,19 @@ if (!is_metaconsole()) {
|
|||
echo $search_custom_fields_view.$metaconsole_agents_manager.$metaconsole_assigned_server.$metaconsole_access_node;
|
||||
}
|
||||
|
||||
echo '</div>
|
||||
</div>
|
||||
echo '</div>
|
||||
</div>
|
||||
|
||||
<div class="user_edit_third_row white_box">
|
||||
<div class="edit_user_comments">'.$comments.'</div>
|
||||
</div>
|
||||
<div class="user_edit_third_row white_box">'.$ehorus.'</div>
|
||||
</div>';
|
||||
if (!empty($ehorus)) {
|
||||
echo '<div class="user_edit_third_row white_box">'.$ehorus.'</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
profile_print_profile_table($id);
|
||||
|
||||
echo '<div style="width: 100%" class="action-buttons">';
|
||||
if ($config['admin_can_add_user']) {
|
||||
|
@ -1088,16 +1209,15 @@ if ($config['admin_can_add_user']) {
|
|||
}
|
||||
}
|
||||
|
||||
html_print_input_hidden('json_profile', '');
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
echo '<br />';
|
||||
|
||||
// Don't show anything else if we're creating an user
|
||||
if (!empty($id) && !$new_user) {
|
||||
profile_print_profile_table($id);
|
||||
}
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
$delete_image = html_print_input_image('del', 'images/cross.png', 1, '', true, ['onclick' => 'delete_profile(event, this)']);
|
||||
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
?>
|
||||
|
@ -1132,13 +1252,14 @@ if (!is_metaconsole()) {
|
|||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
var json_profile = $('#hidden-json_profile');
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
$('input:radio[name="is_admin"]').change(function() {
|
||||
if($('#radiobtn0002').prop('checked')) {
|
||||
$('#metaconsole_agents_manager_div').show();
|
||||
$('#metaconsole_access_node_div').show();
|
||||
if($('#checkbox-metaconsole_agents_manager').prop('checked')) {
|
||||
if($('#checkbox-metaconsole_agents_manager').prop('checked')) {
|
||||
$('#metaconsole_assigned_server_div').show();
|
||||
}
|
||||
}
|
||||
|
@ -1167,8 +1288,105 @@ $(document).ready (function () {
|
|||
});
|
||||
$('#checkbox-ehorus_user_level_enabled').trigger('change');
|
||||
|
||||
var img_delete = '<?php echo $delete_image; ?>';
|
||||
var id_user = '<?php echo $id; ?>';
|
||||
var data = [];
|
||||
|
||||
$('input:image[name="add"]').click(function (e) {
|
||||
e.preventDefault();
|
||||
var profile = $('#assign_profile').val();
|
||||
var profile_text = $('#assign_profile option:selected').text();
|
||||
var group = $('#assign_group').val();
|
||||
var group_text = $('#assign_group option:selected').text();
|
||||
var tags = $('#assign_tags').val();
|
||||
var tags_text = $('#assign_tags option:selected').toArray().map(item => item.text).join();
|
||||
if ( $('#checkbox-no_hierarchy').is(':checked')) {
|
||||
var hierarchy = 1;
|
||||
var hierarchy_text = '<?php echo __('yes'); ?>';
|
||||
} else {
|
||||
var hierarchy = 0;
|
||||
var hierarchy_text = '<?php echo __('no'); ?>';
|
||||
}
|
||||
|
||||
if (profile === '0' || group === '-1') {
|
||||
alert('<?php echo __('please select profile and group'); ?>');
|
||||
return;
|
||||
}
|
||||
|
||||
if (id_user === '') {
|
||||
let new_json = `{"profile":${profile},"group":${group},"tags":[${tags}],"hierarchy":${hierarchy}}`;
|
||||
data.push(new_json);
|
||||
json_profile.val('['+data+']');
|
||||
$('#table_profiles tr:last').before(
|
||||
`<tr>
|
||||
<td>${profile_text}</td>
|
||||
<td>${group_text}</td>
|
||||
<td>${tags_text}</td>
|
||||
<td>${hierarchy_text}</td>
|
||||
<td>${img_delete}</td>
|
||||
</tr>`
|
||||
);
|
||||
} else {
|
||||
this.form.submit();
|
||||
}
|
||||
});
|
||||
|
||||
$('input:image[name="del"]').click(function (e) {
|
||||
e.preventDefault();
|
||||
var rows = $("#table_profiles tr").length;
|
||||
if (rows <= 3) {
|
||||
if (!confirm('<?php echo __('Deleting last profile'); ?>' + '. ' + '<?php echo __('Are you sure?'); ?>')) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var id_user_profile = $(this).siblings();
|
||||
id_user_profile = id_user_profile[1].value;
|
||||
var row = $(this).closest('tr');
|
||||
|
||||
var params = [];
|
||||
params.push("delete_profile=1");
|
||||
params.push("id_user=" + id_user);
|
||||
params.push("id_user_profile=" + id_user_profile);
|
||||
params.push("page=godmode/users/configure_user");
|
||||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
success: function (data) {
|
||||
row.remove();
|
||||
var rows = $("#table_profiles tr").length;
|
||||
if (rows <= 2) {
|
||||
window.location.replace("<?php echo ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure=0', false, false, false); ?>");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#submit-crtbutton').click(function (e) {
|
||||
e.preventDefault();
|
||||
var rows = $("#table_profiles tr").length;
|
||||
if (rows <= 2) {
|
||||
alert('<?php echo __('please add a profile'); ?>');
|
||||
} else {
|
||||
this.form.submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function delete_profile(event, btn) {
|
||||
event.preventDefault();
|
||||
var row = btn.parentNode.parentNode;
|
||||
var position = row.rowIndex;
|
||||
row.parentNode.removeChild(row);
|
||||
|
||||
var json = json_profile.val();
|
||||
var test = JSON.parse(json);
|
||||
delete test[position-1];
|
||||
json_profile.val(JSON.stringify(test));
|
||||
|
||||
}
|
||||
|
||||
function show_data_section () {
|
||||
section = $("#section").val();
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ require_once $config['homedir'].'/include/functions_profile.php';
|
|||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
require_once $config['homedir'].'/include/functions_groups.php';
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'UM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access User Management'
|
||||
|
|
|
@ -129,16 +129,25 @@ if (defined('METACONSOLE')) {
|
|||
user_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
} else {
|
||||
$buttons = [
|
||||
'user' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure='.$pure.'">'.html_print_image('images/gm_users.png', true, ['title' => __('User management')]).'</a>',
|
||||
],
|
||||
'profile' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gusuarios&sec2=godmode/users/profile_list&tab=profile&pure='.$pure.'">'.html_print_image('images/profiles.png', true, ['title' => __('Profile management')]).'</a>',
|
||||
],
|
||||
];
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$buttons = [
|
||||
'user' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure='.$pure.'">'.html_print_image('images/gm_users.png', true, ['title' => __('User management')]).'</a>',
|
||||
],
|
||||
'profile' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gusuarios&sec2=godmode/users/profile_list&tab=profile&pure='.$pure.'">'.html_print_image('images/profiles.png', true, ['title' => __('Profile management')]).'</a>',
|
||||
],
|
||||
];
|
||||
} else {
|
||||
$buttons = [
|
||||
'user' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure='.$pure.'">'.html_print_image('images/gm_users.png', true, ['title' => __('User management')]).'</a>',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
$buttons[$tab]['active'] = true;
|
||||
|
||||
|
@ -356,10 +365,23 @@ if (!defined('METACONSOLE')) {
|
|||
$table->valign[6] = 'top';
|
||||
}
|
||||
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
if (isset($group_um[0])) {
|
||||
$group_um_string = implode(',', array_keys(users_get_groups($config['id_user'], 'um', true)));
|
||||
} else {
|
||||
$group_um_string = implode(',', array_keys($group_um));
|
||||
}
|
||||
|
||||
|
||||
$info1 = [];
|
||||
|
||||
$info1 = get_users($order);
|
||||
// Is admin or has group permissions all.
|
||||
if (users_is_admin() || isset($group_um[0])) {
|
||||
$info1 = get_users($order);
|
||||
} else {
|
||||
foreach ($group_um as $group => $value) {
|
||||
$info1 = array_merge($info1, users_get_users_by_group($group, $value));
|
||||
}
|
||||
}
|
||||
|
||||
// Filter the users
|
||||
if ($search) {
|
||||
|
@ -400,33 +422,7 @@ if ($search) {
|
|||
}
|
||||
}
|
||||
|
||||
// ~
|
||||
// ~ $filter_group
|
||||
// ~ $filter_search
|
||||
// ~
|
||||
$info = [];
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
$own_groups = users_get_groups($config['id_user'], 'AR', $own_info['is_admin']);
|
||||
|
||||
if ($own_info['is_admin']) {
|
||||
$info = $info1;
|
||||
}
|
||||
// If user is not admin then don't display admin users and user of others groups.
|
||||
else {
|
||||
foreach ($info1 as $key => $usr) {
|
||||
$u = get_user_info($key);
|
||||
$g = users_get_groups($key, false, $u['is_admin']);
|
||||
$result = array_intersect($g, $own_groups);
|
||||
|
||||
// Show users without profile too.
|
||||
if (!empty($result) || (db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $usr['id_user']) === false)) {
|
||||
$info[$key] = $usr;
|
||||
}
|
||||
|
||||
unset($u);
|
||||
unset($g);
|
||||
}
|
||||
}
|
||||
$info = $info1;
|
||||
|
||||
// Prepare pagination
|
||||
ui_pagination(count($info));
|
||||
|
@ -438,9 +434,41 @@ $rowPair = true;
|
|||
$iterator = 0;
|
||||
$cont = 0;
|
||||
foreach ($info as $user_id => $user_info) {
|
||||
if (!users_is_admin() && $user_info['is_admin']) {
|
||||
// If user is not admin then don't display admin users.
|
||||
continue;
|
||||
}
|
||||
|
||||
// User profiles.
|
||||
if (users_is_admin() || $user_id == $config['id_user'] || isset($group_um[0])) {
|
||||
$user_profiles = db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $user_id);
|
||||
} else {
|
||||
$user_profiles_aux = users_get_user_profile($user_id);
|
||||
$user_profiles = [];
|
||||
foreach ($group_um as $key => $value) {
|
||||
if (isset($user_profiles_aux[$key])) {
|
||||
$user_profiles[$key] = $user_profiles_aux[$key];
|
||||
if ($user_profiles_aux[$key]['user_management'] == 1) {
|
||||
$user_info['edit'] = 0;
|
||||
} else {
|
||||
$user_info['edit'] = 1;
|
||||
}
|
||||
|
||||
unset($user_profiles_aux[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($user_profiles_aux)) {
|
||||
$user_info['not_delete'] = 1;
|
||||
}
|
||||
|
||||
if ($user_profiles == false) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$cont++;
|
||||
|
||||
//
|
||||
// Manual pagination due the complicated process of the ACL data
|
||||
if ($cont <= $offset) {
|
||||
continue;
|
||||
|
@ -464,12 +492,14 @@ foreach ($info as $user_id => $user_info) {
|
|||
|
||||
$iterator++;
|
||||
|
||||
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'&id='.$user_id.'">'.$user_id.'</a>';
|
||||
if (users_is_admin() || $config['id_user'] == $user_info['id_user'] || (!$user_info['is_admin'] && (!isset($user_info['edit']) || isset($group_um[0]) || (isset($user_info['edit']) && $user_info['edit'])))) {
|
||||
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'&id='.$user_id.'">'.$user_id.'</a>';
|
||||
} else {
|
||||
$data[0] = $user_id;
|
||||
}
|
||||
|
||||
$data[1] = '<ul style="margin-top: 0 !important; margin-left: auto !important; padding-left: 10px !important; list-style-type: none !important;">';
|
||||
$data[1] .= '<li>'.$user_info['fullname'].'</li>';
|
||||
/*
|
||||
$data[1] .= '<li><b>' . __('First name') . ':</b> ' . $user_info["firstname"] . '</li>';
|
||||
$data[1] .= '<li><b>' . __('Last name') . ':</b> ' . $user_info["lastname"] . '</li>';*/
|
||||
$data[1] .= '<li>'.$user_info['phone'].'</li>';
|
||||
$data[1] .= '<li>'.$user_info['email'].'</li>';
|
||||
$data[1] .= '</ul>';
|
||||
|
@ -485,45 +515,43 @@ foreach ($info as $user_id => $user_info) {
|
|||
]
|
||||
).' ';
|
||||
} else {
|
||||
/*
|
||||
$data[3] = html_print_image ("images/user_green.png", true,
|
||||
array ("alt" => __('User'),
|
||||
"title" => __('Standard User'))) . ' ';
|
||||
*/
|
||||
$data[3] = '';
|
||||
}
|
||||
|
||||
$data[4] = '';
|
||||
$result = db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $user_id);
|
||||
if ($result !== false) {
|
||||
if (defined('METACONSOLE')) {
|
||||
$data[4] .= "<div width='100%'>";
|
||||
foreach ($result as $row) {
|
||||
if ($user_profiles !== false) {
|
||||
$total_profile = 0;
|
||||
|
||||
$data[4] .= '<div style="text-align: end;">';
|
||||
foreach ($user_profiles as $row) {
|
||||
if ($total_profile <= 5) {
|
||||
$data[4] .= "<div style='float:left;'>";
|
||||
$data[4] .= profile_get_name($row['id_perfil']);
|
||||
$data[4] .= ' / </div>';
|
||||
$data[4] .= "<div style='float:left; padding-left:5px;'>";
|
||||
$data[4] .= groups_get_name($row['id_grupo'], true);
|
||||
$data[4] .= '</div>';
|
||||
|
||||
if ($total_profile == 0 && count($user_profiles) >= 5) {
|
||||
$data[4] .= '<span onclick="showGroups()" style="padding-left: 15px;">
|
||||
'.html_print_image('images/input_zoom_gray.png', true, ['title' => __('Show')]).'</span>';
|
||||
}
|
||||
|
||||
$data[4] .= '<br />';
|
||||
$data[4] .= '<br />';
|
||||
$data[4] .= '</div>';
|
||||
} else {
|
||||
$data[4] .= "<div id='groups_list' style='display:none;'>";
|
||||
$data[4] .= '<div >';
|
||||
$data[4] .= profile_get_name($row['id_perfil']);
|
||||
$data[4] .= ' / '.groups_get_name($row['id_grupo'], true).'</div>';
|
||||
$data[4] .= '<br/>';
|
||||
}
|
||||
|
||||
$total_profile++;
|
||||
}
|
||||
|
||||
$data[4] .= '</div>';
|
||||
} else {
|
||||
$data[4] .= "<table width='100%'>";
|
||||
foreach ($result as $row) {
|
||||
$data[4] .= '<tr>';
|
||||
$data[4] .= '<td>';
|
||||
$data[4] .= profile_get_name($row['id_perfil']);
|
||||
$data[4] .= ' / ';
|
||||
$data[4] .= groups_get_name($row['id_grupo'], true);
|
||||
$data[4] .= '</td>';
|
||||
$data[4] .= '</tr>';
|
||||
}
|
||||
|
||||
$data[4] .= '</table>';
|
||||
}
|
||||
} else {
|
||||
$data[4] .= __('The user doesn\'t have any assigned profile/group');
|
||||
}
|
||||
|
@ -531,21 +559,26 @@ foreach ($info as $user_id => $user_info) {
|
|||
$data[5] = ui_print_string_substr($user_info['comments'], 24, true);
|
||||
|
||||
$table->cellclass[][6] = 'action_buttons';
|
||||
if ($user_info['disabled'] == 0) {
|
||||
$data[6] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/user_list&disable_user=1&pure='.$pure.'&id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb.png', true, ['title' => __('Disable')]).'</a>';
|
||||
} else {
|
||||
$data[6] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/user_list&disable_user=0&pure='.$pure.'&id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb_off.png', true, ['title' => __('Enable')]).'</a>';
|
||||
}
|
||||
|
||||
$data[6] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'&id='.$user_id.'">'.html_print_image('images/config.png', true, ['title' => __('Edit')]).'</a>';
|
||||
if ($config['admin_can_delete_user'] && $user_info['id_user'] != $config['id_user']) {
|
||||
$data[6] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/users/user_list&user_del=1&pure='.$pure.'&delete_user='.$user_info['id_user']."'>".html_print_image('images/cross.png', true, ['title' => __('Delete'), 'onclick' => "if (! confirm ('".__('Deleting User').' '.$user_info['id_user'].'. '.__('Are you sure?')."')) return false"]).'</a>';
|
||||
if (defined('METACONSOLE')) {
|
||||
$data[6] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/users/user_list&user_del=1&pure='.$pure.'&delete_user='.$user_info['id_user']."&delete_all=1'>".html_print_image('images/cross_double.png', true, ['title' => __('Delete from all consoles'), 'onclick' => "if (! confirm ('".__('Deleting User %s from all consoles', $user_info['id_user']).'. '.__('Are you sure?')."')) return false"]).'</a>';
|
||||
$data[6] = '';
|
||||
if (users_is_admin() || $config['id_user'] == $user_info['id_user'] || isset($group_um[0]) || (!$user_info['is_admin'] && (!isset($user_info['edit']) || (isset($user_info['edit']) && $user_info['edit'])))) {
|
||||
if (!isset($user_info['not_delete'])) {
|
||||
if ($user_info['disabled'] == 0) {
|
||||
$data[6] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/user_list&disable_user=1&pure='.$pure.'&id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb.png', true, ['title' => __('Disable')]).'</a>';
|
||||
} else {
|
||||
$data[6] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/user_list&disable_user=0&pure='.$pure.'&id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb_off.png', true, ['title' => __('Enable')]).'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$data[6] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'&id='.$user_id.'">'.html_print_image('images/config.png', true, ['title' => __('Edit')]).'</a>';
|
||||
if ($config['admin_can_delete_user'] && $user_info['id_user'] != $config['id_user'] && !isset($user_info['not_delete'])) {
|
||||
$data[6] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/users/user_list&user_del=1&pure='.$pure.'&delete_user='.$user_info['id_user']."'>".html_print_image('images/cross.png', true, ['title' => __('Delete'), 'onclick' => "if (! confirm ('".__('Deleting User').' '.$user_info['id_user'].'. '.__('Are you sure?')."')) return false"]).'</a>';
|
||||
if (defined('METACONSOLE')) {
|
||||
$data[6] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/users/user_list&user_del=1&pure='.$pure.'&delete_user='.$user_info['id_user']."&delete_all=1'>".html_print_image('images/cross_double.png', true, ['title' => __('Delete from all consoles'), 'onclick' => "if (! confirm ('".__('Deleting User %s from all consoles', $user_info['id_user']).'. '.__('Are you sure?')."')) return false"]).'</a>';
|
||||
}
|
||||
} else {
|
||||
$data[6] .= '';
|
||||
// Delete button not in this mode
|
||||
}
|
||||
} else {
|
||||
$data[6] .= '';
|
||||
// Delete button not in this mode
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
|
@ -568,3 +601,17 @@ if ($config['admin_can_add_user'] !== false) {
|
|||
echo '</div>';
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
function showGroups(){
|
||||
var groups_list = document.getElementById("groups_list");
|
||||
|
||||
if(groups_list.style.display == "none"){
|
||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
||||
element.style.display = "block");
|
||||
}else{
|
||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
||||
element.style.display = "none");
|
||||
};
|
||||
}
|
||||
</script>';
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#pandora disable phpexec
|
||||
<Files *.php>
|
||||
<FilesMatch "\.(php)$">
|
||||
Deny from all
|
||||
</Files>
|
||||
php_flag engine off
|
||||
</FilesMatch>
|
|
@ -937,11 +937,16 @@ if ($perform_event_response) {
|
|||
return;
|
||||
}
|
||||
|
||||
$target = get_parameter('target', '');
|
||||
$response_id = get_parameter('response_id');
|
||||
$event_id = (int) get_parameter('event_id');
|
||||
$server_id = (int) get_parameter('server_id', 0);
|
||||
|
||||
$command = events_get_response_target($event_id, $response_id, $server_id);
|
||||
if (empty($target)) {
|
||||
$command = events_get_response_target($event_id, $response_id, $server_id);
|
||||
} else {
|
||||
$command = $target;
|
||||
}
|
||||
|
||||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
||||
|
||||
|
@ -1088,7 +1093,8 @@ if ($dialogue_event_response) {
|
|||
}
|
||||
} else {
|
||||
echo "<div style='text-align:left'>";
|
||||
echo $prompt.sprintf(__('Executing command: %s', $command));
|
||||
|
||||
echo $prompt."Executing command: $command";
|
||||
echo '</div><br>';
|
||||
|
||||
echo "<div id='response_loading_command' style='display:none'>".html_print_image('images/spinner.gif', true).'</div>';
|
||||
|
|
|
@ -25,7 +25,7 @@ if (is_ajax()) {
|
|||
$method = (string) get_parameter('method', '');
|
||||
$action = (string) get_parameter('action', '');
|
||||
$target_ip = (string) get_parameter('target_ip', '');
|
||||
$community = (string) get_parameter('community', '');
|
||||
$community = (string) io_safe_output((get_parameter('community', '')));
|
||||
$snmp_version = (string) get_parameter('snmp_browser_version', '');
|
||||
$snmp3_auth_user = io_safe_output(get_parameter('snmp3_browser_auth_user'));
|
||||
$snmp3_security_level = get_parameter('snmp3_browser_security_level');
|
||||
|
|
|
@ -3001,6 +3001,8 @@ class AgentWizard extends HTML
|
|||
$module['name']
|
||||
);
|
||||
|
||||
$newModule['name_oid'] = str_replace('"', '', $tmpSecond[3]);
|
||||
|
||||
// Add this new module to the module list.
|
||||
$moduleBlocks[] = $newModule;
|
||||
}
|
||||
|
@ -4749,6 +4751,7 @@ class AgentWizard extends HTML
|
|||
*/
|
||||
function switchBlockControl(e) {
|
||||
var switchId = e.target.id.split("_");
|
||||
var switchName = e.target.name.split("_");
|
||||
var type = switchId[1];
|
||||
var blockNumber = switchId[2];
|
||||
var moduleNumber = switchId[3];
|
||||
|
@ -4756,14 +4759,15 @@ class AgentWizard extends HTML
|
|||
var imageInfoModules = $("#image-info-modules-" + blockNumber);
|
||||
var totalCount = 0;
|
||||
var markedCount = 0;
|
||||
|
||||
var hidden_input = document.getElementById("hidden-module-active-"+switchName[2]+"_0-0");
|
||||
var id_input = hidden_input.id.split("_");
|
||||
if (type == 'block') {
|
||||
selectedBlock
|
||||
.parent()
|
||||
.removeClass("alpha50");
|
||||
if (selectedBlock.prop("checked")) {
|
||||
// Set to active the values of fields.
|
||||
$("[id*=hidden-module-active-"+blockNumber+"]")
|
||||
$("[id*='"+id_input[0]+"']")
|
||||
.each(function(){
|
||||
$(this).val('1');
|
||||
});
|
||||
|
@ -4775,8 +4779,8 @@ class AgentWizard extends HTML
|
|||
imageInfoModules.removeClass('hidden');
|
||||
} else {
|
||||
// Set to inactive the values of fields.
|
||||
$("[id*=hidden-module-active-"+blockNumber+"]")
|
||||
.each(function(){
|
||||
$("[id*='"+id_input[0]+"']")
|
||||
.each(function(){
|
||||
$(this).val('0');
|
||||
});
|
||||
// Set unchecked.
|
||||
|
@ -4788,13 +4792,13 @@ class AgentWizard extends HTML
|
|||
}
|
||||
} else if (type == 'module') {
|
||||
// Getting the element.
|
||||
var thisModuleHidden = $("#hidden-module-active-"+blockNumber+"_"+moduleNumber);
|
||||
var thisModuleHidden = document.getElementById("hidden-module-active-"+switchName[2]+"_"+moduleNumber);
|
||||
var thisModule = $("#checkbox-sel_module_"+blockNumber+"_"+moduleNumber);
|
||||
// Setting the individual field
|
||||
if (thisModule.prop('checked')) {
|
||||
thisModuleHidden.val('1');
|
||||
thisModuleHidden.value = '1';
|
||||
} else {
|
||||
thisModuleHidden.val('0');
|
||||
thisModuleHidden.value = '0';
|
||||
}
|
||||
|
||||
// Get the list of selected modules.
|
||||
|
|
|
@ -1221,6 +1221,9 @@ class ConsoleSupervisor
|
|||
// At this point there's no servers with issues.
|
||||
$this->cleanNotifications('NOTIF.SERVER.STATUS%');
|
||||
return;
|
||||
} else {
|
||||
// Clean notifications. Only show notif for down servers.
|
||||
$this->cleanNotifications('NOTIF.SERVER.STATUS%');
|
||||
}
|
||||
|
||||
foreach ($servers as $server) {
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC200715';
|
||||
$pandora_version = 'v7.0NG.747';
|
||||
$build_version = 'PC200907';
|
||||
$pandora_version = 'v7.0NG.748';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -3209,7 +3209,7 @@ function get_refresh_time_array()
|
|||
}
|
||||
|
||||
|
||||
function date2strftime_format($date_format)
|
||||
function date2strftime_format($date_format, $timestamp=null)
|
||||
{
|
||||
$replaces_list = [
|
||||
'D' => '%a',
|
||||
|
@ -3232,11 +3232,14 @@ function date2strftime_format($date_format)
|
|||
'A' => '%p',
|
||||
'i' => '%M',
|
||||
's' => '%S',
|
||||
'u' => '%s',
|
||||
'O' => '%z',
|
||||
'T' => '%Z',
|
||||
'%' => '%%',
|
||||
'G' => '%k',
|
||||
'z' => '%j',
|
||||
'U' => '%s',
|
||||
'c' => '%FT%T%z',
|
||||
'r' => '%d %b %Y %H:%M:%S %z',
|
||||
];
|
||||
|
||||
$return = '';
|
||||
|
@ -3249,7 +3252,30 @@ function date2strftime_format($date_format)
|
|||
if (isset($replaces_list[$c])) {
|
||||
$return .= $replaces_list[$c];
|
||||
} else {
|
||||
$return .= $c;
|
||||
// Check extra formats.
|
||||
switch ($date_format) {
|
||||
default: $return .= date($date_format, $timestamp);
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
if (stristr(PHP_OS, 'win')) {
|
||||
$return .= '%#m';
|
||||
} else {
|
||||
$return .= '%-m';
|
||||
}
|
||||
|
||||
case 'u':
|
||||
if (preg_match('/^[0-9]*\\.([0-9]+)$/', $timestamp, $reg)) {
|
||||
$decimal = substr(str_pad($reg[1], 6, '0'), 0, 6);
|
||||
} else {
|
||||
$decimal = '000000';
|
||||
}
|
||||
|
||||
$return .= $decimal;
|
||||
break;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3335,6 +3361,10 @@ function get_number_of_mr($package, $ent, $offline)
|
|||
$sqlfiles_num = preg_replace($pattern, $replacement, $sqlfiles);
|
||||
|
||||
foreach ($sqlfiles_num as $num) {
|
||||
if ($num <= $config['MR']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$mr_size[] = $num;
|
||||
}
|
||||
}
|
||||
|
@ -3623,6 +3653,14 @@ function color_graph_array()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Label graph Sparse.
|
||||
*
|
||||
* @param array $data Data chart.
|
||||
* @param array $show_elements_graph Data visual styles chart.
|
||||
*
|
||||
* @return array Array label.
|
||||
*/
|
||||
function series_type_graph_array($data, $show_elements_graph)
|
||||
{
|
||||
global $config;
|
||||
|
@ -3645,7 +3683,13 @@ function series_type_graph_array($data, $show_elements_graph)
|
|||
$color_series = color_graph_array();
|
||||
|
||||
if ($show_elements_graph['id_widget_dashboard']) {
|
||||
$opcion = unserialize(db_get_value_filter('options', 'twidget_dashboard', ['id' => $show_elements_graph['id_widget_dashboard']]));
|
||||
$opcion = unserialize(
|
||||
db_get_value_filter(
|
||||
'options',
|
||||
'twidget_dashboard',
|
||||
['id' => $show_elements_graph['id_widget_dashboard']]
|
||||
)
|
||||
);
|
||||
if ($show_elements_graph['graph_combined']) {
|
||||
foreach ($show_elements_graph['modules_id'] as $key => $value) {
|
||||
$color_series[$key] = [
|
||||
|
@ -3674,13 +3718,15 @@ function series_type_graph_array($data, $show_elements_graph)
|
|||
|
||||
if (strpos($key, 'summatory') !== false) {
|
||||
$data_return['series_type'][$key] = $type_graph;
|
||||
$data_return['legend'][$key] = __('Summatory series').' '.$str;
|
||||
$data_return['color'][$key] = $color_series['summatory'];
|
||||
$data_return['legend'][$key] = __('Summatory series').' '.$str;
|
||||
$data_return['color'][$key] = $color_series['summatory'];
|
||||
} else if (strpos($key, 'average') !== false) {
|
||||
$data_return['series_type'][$key] = $type_graph;
|
||||
$data_return['legend'][$key] = __('Average series').' '.$str;
|
||||
$data_return['color'][$key] = $color_series['average'];
|
||||
} else if (strpos($key, 'sum') !== false || strpos($key, 'baseline') !== false) {
|
||||
$data_return['legend'][$key] = __('Average series').' '.$str;
|
||||
$data_return['color'][$key] = $color_series['average'];
|
||||
} else if (strpos($key, 'sum') !== false
|
||||
|| strpos($key, 'baseline') !== false
|
||||
) {
|
||||
switch ($value['id_module_type']) {
|
||||
case 21:
|
||||
case 2:
|
||||
|
@ -3702,24 +3748,44 @@ function series_type_graph_array($data, $show_elements_graph)
|
|||
&& (count($show_elements_graph['labels']) > 0)
|
||||
) {
|
||||
if ($show_elements_graph['unit']) {
|
||||
$name_legend = $show_elements_graph['labels'][$value['agent_module_id']].' / '.__('Unit ').' '.$show_elements_graph['unit'].': ';
|
||||
$data_return['legend'][$key] = $show_elements_graph['labels'][$value['agent_module_id']].' / '.__('Unit ').' '.$show_elements_graph['unit'].': ';
|
||||
$name_legend = $show_elements_graph['labels'][$value['agent_module_id']];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= __('Unit ').' ';
|
||||
$name_legend .= $show_elements_graph['unit'].': ';
|
||||
} else {
|
||||
$name_legend = $show_elements_graph['labels'][$value['agent_module_id']].': ';
|
||||
$data_return['legend'][$key] = $show_elements_graph['labels'][$value['agent_module_id']].': ';
|
||||
}
|
||||
} else {
|
||||
if (strpos($key, 'baseline') !== false) {
|
||||
if ($value['unit']) {
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].' / '.__('Unit ').' '.$value['unit'].'Baseline ';
|
||||
$name_legend = $value['agent_alias'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= $value['module_name'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= __('Unit ').' ';
|
||||
$name_legend .= $value['unit'].'Baseline ';
|
||||
} else {
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].'Baseline ';
|
||||
$name_legend = $value['agent_alias'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= $value['module_name'].'Baseline ';
|
||||
}
|
||||
} else {
|
||||
$name_legend = '';
|
||||
if ((int) $config['type_mode_graph'] === 1) {
|
||||
$name_legend .= 'Avg: ';
|
||||
}
|
||||
|
||||
if ($value['unit']) {
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].' / '.__('Unit ').' '.$value['unit'].': ';
|
||||
$name_legend .= $value['agent_alias'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= $value['module_name'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= __('Unit ').' ';
|
||||
$name_legend .= $value['unit'].': ';
|
||||
} else {
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].': ';
|
||||
$name_legend .= $value['agent_alias'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= $value['module_name'].': ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3727,10 +3793,11 @@ function series_type_graph_array($data, $show_elements_graph)
|
|||
if (isset($value['weight']) === true
|
||||
&& empty($value['weight']) === false
|
||||
) {
|
||||
$name_legend .= ' ('.__('Weight').' * '.$value['weight'].') ';
|
||||
$data_return['legend'][$key] .= ' ('.__('Weight').' * '.$value['weight'].') ';
|
||||
$name_legend .= ' ('.__('Weight');
|
||||
$name_legend .= ' * '.$value['weight'].') ';
|
||||
}
|
||||
|
||||
$data_return['legend'][$key] = $name_legend;
|
||||
if ((int) $value['min'] === PHP_INT_MAX) {
|
||||
$value['min'] = 0;
|
||||
}
|
||||
|
@ -3756,36 +3823,63 @@ function series_type_graph_array($data, $show_elements_graph)
|
|||
)
|
||||
).' '.$str;
|
||||
|
||||
if ($show_elements_graph['compare'] == 'overlapped' && $key == 'sum2') {
|
||||
if ($show_elements_graph['compare'] == 'overlapped'
|
||||
&& $key == 'sum2'
|
||||
) {
|
||||
$data_return['color'][$key] = $color_series['overlapped'];
|
||||
} else {
|
||||
$data_return['color'][$key] = $color_series[$i];
|
||||
$i++;
|
||||
}
|
||||
} else if (!$show_elements_graph['fullscale'] && strpos($key, 'min') !== false
|
||||
|| !$show_elements_graph['fullscale'] && strpos($key, 'max') !== false
|
||||
} else if (!$show_elements_graph['fullscale']
|
||||
&& strpos($key, 'min') !== false
|
||||
|| !$show_elements_graph['fullscale']
|
||||
&& strpos($key, 'max') !== false
|
||||
) {
|
||||
$data_return['series_type'][$key] = $type_graph;
|
||||
|
||||
$name_legend = '';
|
||||
if ((int) $config['type_mode_graph'] === 1) {
|
||||
if (strpos($key, 'min') !== false) {
|
||||
$name_legend .= 'Min: ';
|
||||
}
|
||||
|
||||
if (strpos($key, 'max') !== false) {
|
||||
$name_legend .= 'Max: ';
|
||||
}
|
||||
}
|
||||
|
||||
if ($show_elements_graph['unit']) {
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].' / '.__('Unit ').' '.$show_elements_graph['unit'].': ';
|
||||
$name_legend .= $value['agent_alias'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= $value['module_name'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= __('Unit ').' ';
|
||||
$name_legend .= $show_elements_graph['unit'].': ';
|
||||
} else {
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].': ';
|
||||
$name_legend .= $value['agent_alias'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= $value['module_name'].': ';
|
||||
}
|
||||
|
||||
$data_return['legend'][$key] = $name_legend;
|
||||
if ($show_elements_graph['type_mode_graph']) {
|
||||
$data_return['legend'][$key] .= __('Min:').remove_right_zeros(
|
||||
$data_return['legend'][$key] .= __('Min:');
|
||||
$data_return['legend'][$key] .= remove_right_zeros(
|
||||
number_format(
|
||||
$value['min'],
|
||||
$config['graph_precision']
|
||||
)
|
||||
).' '.__('Max:').remove_right_zeros(
|
||||
);
|
||||
$data_return['legend'][$key] .= ' '.__('Max:');
|
||||
$data_return['legend'][$key] .= remove_right_zeros(
|
||||
number_format(
|
||||
$value['max'],
|
||||
$config['graph_precision']
|
||||
)
|
||||
).' '._('Avg:').remove_right_zeros(
|
||||
);
|
||||
$data_return['legend'][$key] .= ' '._('Avg:');
|
||||
$data_return['legend'][$key] .= remove_right_zeros(
|
||||
number_format(
|
||||
$value['avg'],
|
||||
$config['graph_precision']
|
||||
|
@ -3793,7 +3887,9 @@ function series_type_graph_array($data, $show_elements_graph)
|
|||
).' '.$str;
|
||||
}
|
||||
|
||||
if ($show_elements_graph['compare'] == 'overlapped' && $key == 'sum2') {
|
||||
if ($show_elements_graph['compare'] == 'overlapped'
|
||||
&& $key == 'sum2'
|
||||
) {
|
||||
$data_return['color'][$key] = $color_series['overlapped'];
|
||||
} else {
|
||||
$data_return['color'][$key] = $color_series[$i];
|
||||
|
|
|
@ -2985,6 +2985,11 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false)
|
|||
$accepted_module_types[] = $generic_proc;
|
||||
}
|
||||
|
||||
$remote_snmp = (int) db_get_value('id_tipo', 'ttipo_modulo', 'nombre', 'remote_snmp');
|
||||
if ($remote_snmp) {
|
||||
$accepted_module_types[] = $remote_snmp;
|
||||
}
|
||||
|
||||
if (empty($accepted_module_types)) {
|
||||
$accepted_module_types[] = 0;
|
||||
// No modules will be returned
|
||||
|
|
|
@ -2780,6 +2780,11 @@ function alerts_ui_update_or_create_actions($update=true)
|
|||
if ($update) {
|
||||
$values['name'] = $name;
|
||||
$values['id_alert_command'] = $id_alert_command;
|
||||
// Only for Metaconsole, save the previous name for synchronization.
|
||||
if (is_metaconsole()) {
|
||||
$values['previous_name'] = db_get_value('name', 'talert_actions', 'id', $id);
|
||||
}
|
||||
|
||||
$result = (!$name) ? '' : alerts_update_alert_action($id, $values);
|
||||
} else {
|
||||
$name_check = db_get_value('name', 'talert_actions', 'name', $name);
|
||||
|
|
|
@ -1861,13 +1861,13 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3)
|
|||
foreach ($servers as $server) {
|
||||
if (metaconsole_connect($server) == NOERR) {
|
||||
if ($other['data'][0] === '1') {
|
||||
$idAgent[0] = agents_get_agent_id_by_alias($id);
|
||||
$idAgent = agents_get_agent_id_by_alias($id);
|
||||
} else {
|
||||
$idAgent[0] = agents_get_agent_id($id, true);
|
||||
}
|
||||
|
||||
if ($idAgent[0]) {
|
||||
$result = agents_delete_agent($idAgent, true);
|
||||
if (!empty($idAgent)) {
|
||||
$result = agents_delete_agent($idAgent[0], true);
|
||||
}
|
||||
|
||||
metaconsole_restore_db();
|
||||
|
@ -12286,12 +12286,29 @@ function api_set_create_event($id, $trash1, $other, $returnType)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!empty($other['data'][17]) && is_metaconsole()) {
|
||||
$id_server = db_get_row_filter('tmetaconsole_setup', ['id' => $other['data'][17]]);
|
||||
if ($id_server === false) {
|
||||
returnError('error_create_event', __('Server id does not exist in database.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$values['server_id'] = $other['data'][17];
|
||||
} else {
|
||||
$values['server_id'] = 0;
|
||||
}
|
||||
|
||||
$error_msg = '';
|
||||
if ($other['data'][2] != '') {
|
||||
$id_agent = $other['data'][2];
|
||||
if (is_metaconsole()) {
|
||||
// On metaconsole, connect with the node to check the permissions
|
||||
$agent_cache = db_get_row('tmetaconsole_agent', 'id_tagente', $id_agent);
|
||||
if (empty($values['server_id'])) {
|
||||
$agent_cache = db_get_row('tmetaconsole_agent', 'id_tagente', $id_agent);
|
||||
} else {
|
||||
$agent_cache = db_get_row_filter('tmetaconsole_agent', ['id_tagente' => $id_agent, 'id_tmetaconsole_setup' => $values['server_id']]);
|
||||
}
|
||||
|
||||
if ($agent_cache === false) {
|
||||
returnError('id_not_found', 'string');
|
||||
return;
|
||||
|
@ -12420,12 +12437,6 @@ function api_set_create_event($id, $trash1, $other, $returnType)
|
|||
$values['custom_data'] = '';
|
||||
}
|
||||
|
||||
if ($other['data'][17] != '') {
|
||||
$values['server_id'] = $other['data'][17];
|
||||
} else {
|
||||
$values['server_id'] = 0;
|
||||
}
|
||||
|
||||
if ($other['data'][18] != '') {
|
||||
$values['id_extra'] = $other['data'][18];
|
||||
$sql_validation = 'SELECT id_evento FROM tevento where estado IN (0,2) and id_extra ="'.$other['data'][18].'";';
|
||||
|
@ -16151,3 +16162,38 @@ function api_get_event_mcid($server_id, $console_event_id, $trash2, $returnType)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to set events in progress status.
|
||||
*
|
||||
* @param [int] $event_id Id event (Node or Meta).
|
||||
* @param [string] $trash2 don't use.
|
||||
* @param [string] $returnType
|
||||
*
|
||||
* Example
|
||||
* http://127.0.0.1/pandora_console/include/api.php?op=set&op2=event_in_progress&return_type=json&id=0&apipass=1234&user=admin&pass=pandora
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function api_set_event_in_progress($event_id, $trash2, $returnType)
|
||||
{
|
||||
global $config;
|
||||
if (is_metaconsole()) {
|
||||
$table = 'tmetaconsole_event';
|
||||
} else {
|
||||
$table = 'tevento';
|
||||
}
|
||||
|
||||
$event = db_process_sql_update(
|
||||
$table,
|
||||
['estado' => 2],
|
||||
['id_evento' => $event_id]
|
||||
);
|
||||
|
||||
if ($event !== false) {
|
||||
returnData('string', ['data' => $event]);
|
||||
} else {
|
||||
returnError('id_not_found', 'string');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1340,6 +1340,10 @@ function config_update_config()
|
|||
$error_update[] = __('CSV divider');
|
||||
}
|
||||
|
||||
if (!config_update_value('csv_decimal_separator', (string) get_parameter('csv_decimal_separator', '.'))) {
|
||||
$error_update[] = __('CSV decimal separator');
|
||||
}
|
||||
|
||||
if (!config_update_value('use_data_multiplier', get_parameter('use_data_multiplier', '1'))) {
|
||||
$error_update[] = __('Use data multiplier');
|
||||
}
|
||||
|
@ -2875,6 +2879,10 @@ function config_process_config()
|
|||
config_update_value('csv_divider', ';');
|
||||
}
|
||||
|
||||
if (!isset($config['csv_decimal_separator'])) {
|
||||
config_update_value('csv_decimal_separator', '.');
|
||||
}
|
||||
|
||||
if (!isset($config['use_data_multiplier'])) {
|
||||
config_update_value('use_data_multiplier', '1');
|
||||
}
|
||||
|
|
|
@ -3424,7 +3424,7 @@ function events_page_responses($event, $childrens_ids=[])
|
|||
'owner_button',
|
||||
false,
|
||||
'event_change_owner();',
|
||||
'class="sub next"',
|
||||
'class="sub next w70p"',
|
||||
true
|
||||
);
|
||||
|
||||
|
@ -3504,7 +3504,7 @@ function events_page_responses($event, $childrens_ids=[])
|
|||
'status_button',
|
||||
false,
|
||||
'event_change_status(\''.$event['similar_ids'].'\');',
|
||||
'class="sub next"',
|
||||
'class="sub next w70p"',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
@ -3520,7 +3520,7 @@ function events_page_responses($event, $childrens_ids=[])
|
|||
'comment_button',
|
||||
false,
|
||||
'$(\'#link_comments\').trigger(\'click\');',
|
||||
'class="sub next"',
|
||||
'class="sub next w70p"',
|
||||
true
|
||||
);
|
||||
|
||||
|
@ -3544,7 +3544,7 @@ function events_page_responses($event, $childrens_ids=[])
|
|||
'delete_button',
|
||||
false,
|
||||
'if(!confirm(\''.__('Are you sure?').'\')) { return false; } this.form.submit();',
|
||||
'class="sub cancel"',
|
||||
'class="sub cancel w70p"',
|
||||
true
|
||||
);
|
||||
$data[2] .= html_print_input_hidden('delete', 1, true);
|
||||
|
@ -3599,7 +3599,7 @@ function events_page_responses($event, $childrens_ids=[])
|
|||
'custom_response_button',
|
||||
false,
|
||||
'execute_response('.$event['id_evento'].','.$server_id.')',
|
||||
"class='sub next'",
|
||||
"class='sub next w70p'",
|
||||
true
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1507,7 +1507,9 @@ function graphic_combined_module(
|
|||
}
|
||||
}
|
||||
|
||||
$agent_module_id = $agent_module_id['module'];
|
||||
if (is_array($agent_module_id)) {
|
||||
$agent_module_id = $agent_module_id['module'];
|
||||
}
|
||||
|
||||
$module_data = db_get_row_sql(
|
||||
'SELECT * FROM tagente_modulo
|
||||
|
|
|
@ -737,7 +737,11 @@ function html_print_select_multiple_filtered(
|
|||
array $sections=[]
|
||||
) {
|
||||
ui_require_css_file('multiselect_filtered');
|
||||
ui_require_javascript_file('multiselect_filtered');
|
||||
if (is_ajax() === true) {
|
||||
ui_require_javascript_file('multiselect_filtered', 'include/javascript/', true);
|
||||
} else {
|
||||
ui_require_javascript_file('multiselect_filtered');
|
||||
}
|
||||
|
||||
if (empty($name) === true) {
|
||||
$rid = uniqid();
|
||||
|
@ -3039,7 +3043,11 @@ function html_print_table(&$table, $return=false)
|
|||
$style[$key] = '';
|
||||
}
|
||||
|
||||
$output .= '<td id="'.$tableid.'-'.$keyrow.'-'.$key.'" style="'.$cellstyle[$keyrow][$key].$style[$key].$valign[$key].$align[$key].$size[$key].$wrap[$key].'" '.$colspan[$keyrow][$key].' '.$rowspan[$keyrow][$key].' class="'.$class.' '.$cellclass[$keyrow][$key].'">'.$item.'</td>'."\n";
|
||||
if ($class === 'datos5' && $key === 1) {
|
||||
$output .= '<td id="'.$tableid.'-'.$keyrow.'-'.$key.'" style="'.$cellstyle[$keyrow][$key].$style[$key].$valign[$key].$align[$key].$size[$key].$wrap[$key].$colspan[$keyrow][$key].' '.$rowspan[$keyrow][$key].' class="'.$class.' '.$cellclass[$keyrow][$key].'">'.$item.'</td>'."\n";
|
||||
} else {
|
||||
$output .= '<td id="'.$tableid.'-'.$keyrow.'-'.$key.'" style="'.$cellstyle[$keyrow][$key].$style[$key].$valign[$key].$align[$key].$size[$key].$wrap[$key].'" '.$colspan[$keyrow][$key].' '.$rowspan[$keyrow][$key].' class="'.$class.' '.$cellclass[$keyrow][$key].'">'.$item.'</td>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$output .= '</tr>'."\n";
|
||||
|
@ -3871,21 +3879,16 @@ function html_print_timezone_select($name, $selected='')
|
|||
* Enclose a text into a result_div
|
||||
*
|
||||
* @param string Text to enclose
|
||||
* @param boolean Return formatted text without html tags.
|
||||
*
|
||||
* @return string Text inside the result_div
|
||||
*/
|
||||
function html_print_result_div($text, $text_only)
|
||||
function html_print_result_div($text)
|
||||
{
|
||||
$text = preg_replace('/</', '<', $text);
|
||||
$text = preg_replace('/>/', '>', $text);
|
||||
$text = preg_replace('/\n/i', '<br>', $text);
|
||||
$text = preg_replace('/\s/i', ' ', $text);
|
||||
|
||||
if ($text_only) {
|
||||
return $text;
|
||||
}
|
||||
|
||||
$enclose = "<div id='result_div' style='width: 100%; height: 100%; overflow: auto; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>";
|
||||
$enclose .= $text;
|
||||
$enclose .= '</div>';
|
||||
|
|
|
@ -728,7 +728,7 @@ function notifications_print_source_select_box(
|
|||
"
|
||||
<div class='global-config-notification-single-selector'>
|
||||
<div>
|
||||
<h4>%s</h4>
|
||||
<h5>%s</h5>
|
||||
%s
|
||||
</div>
|
||||
<div class='global-notifications-icons'>
|
||||
|
|
|
@ -188,6 +188,7 @@ function profile_print_profile_table($id)
|
|||
$title = __('Profiles/Groups assigned to this user');
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'table_profiles';
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
if (defined('METACONSOLE')) {
|
||||
|
@ -216,10 +217,30 @@ function profile_print_profile_table($id)
|
|||
$table->head['actions'] = __('Action');
|
||||
$table->align['actions'] = 'center';
|
||||
|
||||
$result = db_get_all_rows_filter(
|
||||
'tusuario_perfil',
|
||||
['id_usuario' => $id]
|
||||
);
|
||||
if (users_is_admin()) {
|
||||
$result = db_get_all_rows_filter(
|
||||
'tusuario_perfil',
|
||||
['id_usuario' => $id]
|
||||
);
|
||||
} else {
|
||||
// Only profiles that can be viewed by the user.
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
if (isset($group_um[0])) {
|
||||
$group_um_string = implode(',', array_keys(users_get_groups($config['id_user'], 'um', true)));
|
||||
} else {
|
||||
$group_um_string = implode(',', array_keys($group_um));
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario_perfil.* FROM tusuario_perfil
|
||||
INNER JOIN tperfil ON tperfil.id_perfil = tusuario_perfil.id_perfil
|
||||
WHERE id_usuario like '%s' AND id_grupo IN (%s) AND user_management = 0",
|
||||
$id,
|
||||
$group_um_string
|
||||
);
|
||||
|
||||
$result = db_get_all_rows_sql($sql);
|
||||
}
|
||||
|
||||
if ($result === false) {
|
||||
$result = [];
|
||||
|
@ -285,6 +306,7 @@ function profile_print_profile_table($id)
|
|||
[
|
||||
'pandora_management' => '<> 1',
|
||||
'db_management' => '<> 1',
|
||||
'user_management' => '<> 1',
|
||||
]
|
||||
),
|
||||
'assign_profile',
|
||||
|
|
|
@ -863,6 +863,17 @@ function reporting_make_reporting_data(
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Report SLA.
|
||||
*
|
||||
* @param array $report Data report.
|
||||
* @param array $content Content for report.
|
||||
* @param null|string $type Type report.
|
||||
* @param null|integer $force_width_chart Size.
|
||||
* @param null|integer $force_height_chart Size.
|
||||
*
|
||||
* @return array Return array for draw report SLA.
|
||||
*/
|
||||
function reporting_SLA(
|
||||
$report,
|
||||
$content,
|
||||
|
@ -926,7 +937,7 @@ function reporting_SLA(
|
|||
include_once $config['homedir'].'/include/functions_planned_downtimes.php';
|
||||
$metaconsole_on = is_metaconsole();
|
||||
|
||||
// checking if needed to show graph or table.
|
||||
// Checking if needed to show graph or table.
|
||||
if ($content['show_graph'] == 0 || $content['show_graph'] == 1) {
|
||||
$show_table = 1;
|
||||
} else {
|
||||
|
@ -947,6 +958,18 @@ function reporting_SLA(
|
|||
$sla_showed = [];
|
||||
$sla_showed_values = [];
|
||||
|
||||
if ((bool) $content['compare_work_time'] === true) {
|
||||
$slas_compare = [];
|
||||
foreach ($slas as $sla) {
|
||||
$sla['compare'] = 1;
|
||||
$slas_compare[] = $sla;
|
||||
$sla['compare'] = 0;
|
||||
$slas_compare[] = $sla;
|
||||
}
|
||||
|
||||
$slas = $slas_compare;
|
||||
}
|
||||
|
||||
foreach ($slas as $sla) {
|
||||
$server_name = $sla['server_name'];
|
||||
// Metaconsole connection.
|
||||
|
@ -1000,26 +1023,51 @@ function reporting_SLA(
|
|||
|
||||
// Call functions sla.
|
||||
$sla_array = [];
|
||||
$sla_array = reporting_advanced_sla(
|
||||
$sla['id_agent_module'],
|
||||
($report['datetime'] - $content['period']),
|
||||
$report['datetime'],
|
||||
$sla['sla_min'],
|
||||
$sla['sla_max'],
|
||||
$inverse_interval,
|
||||
[
|
||||
'1' => $content['sunday'],
|
||||
'2' => $content['monday'],
|
||||
'3' => $content['tuesday'],
|
||||
'4' => $content['wednesday'],
|
||||
'5' => $content['thursday'],
|
||||
'6' => $content['friday'],
|
||||
'7' => $content['saturday'],
|
||||
],
|
||||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
$slice
|
||||
);
|
||||
if (isset($sla['compare']) === false
|
||||
|| empty($sla['compare']) === true
|
||||
) {
|
||||
$sla_array = reporting_advanced_sla(
|
||||
$sla['id_agent_module'],
|
||||
($report['datetime'] - $content['period']),
|
||||
$report['datetime'],
|
||||
$sla['sla_min'],
|
||||
$sla['sla_max'],
|
||||
$inverse_interval,
|
||||
[
|
||||
'1' => $content['sunday'],
|
||||
'2' => $content['monday'],
|
||||
'3' => $content['tuesday'],
|
||||
'4' => $content['wednesday'],
|
||||
'5' => $content['thursday'],
|
||||
'6' => $content['friday'],
|
||||
'7' => $content['saturday'],
|
||||
],
|
||||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
$slice
|
||||
);
|
||||
} else {
|
||||
$sla_array = reporting_advanced_sla(
|
||||
$sla['id_agent_module'],
|
||||
($report['datetime'] - $content['period']),
|
||||
$report['datetime'],
|
||||
$sla['sla_min'],
|
||||
$sla['sla_max'],
|
||||
$inverse_interval,
|
||||
[
|
||||
'1' => 1,
|
||||
'2' => 1,
|
||||
'3' => 1,
|
||||
'4' => 1,
|
||||
'5' => 1,
|
||||
'6' => 1,
|
||||
'7' => 1,
|
||||
],
|
||||
'00:00:00',
|
||||
'00:00:00',
|
||||
$slice
|
||||
);
|
||||
}
|
||||
|
||||
if ($metaconsole_on) {
|
||||
// Restore db connection.
|
||||
|
@ -1093,6 +1141,14 @@ function reporting_SLA(
|
|||
$data['sla_limit'] = $sla['sla_limit'];
|
||||
$data['dinamic_text'] = $dinamic_text;
|
||||
|
||||
if (isset($sla['compare']) === false
|
||||
|| empty($sla['compare']) === true
|
||||
) {
|
||||
$data['compare'] = false;
|
||||
} else {
|
||||
$data['compare'] = true;
|
||||
}
|
||||
|
||||
if (isset($sla_array[0])) {
|
||||
$data['time_total'] = 0;
|
||||
$data['time_ok'] = 0;
|
||||
|
@ -1246,6 +1302,15 @@ function reporting_SLA(
|
|||
$sla['id_agent_module']
|
||||
)
|
||||
);
|
||||
|
||||
if (isset($sla['compare']) === false
|
||||
|| empty($sla['compare']) === true
|
||||
) {
|
||||
$dataslice['compare'] = false;
|
||||
} else {
|
||||
$dataslice['compare'] = true;
|
||||
}
|
||||
|
||||
$dataslice['sla_value'] = $data['sla_value'];
|
||||
$dataslice['order'] = $data['sla_value'];
|
||||
|
||||
|
@ -1259,7 +1324,7 @@ function reporting_SLA(
|
|||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
100,
|
||||
70,
|
||||
((bool) $dataslice['compare'] === true) ? 50 : 80,
|
||||
$urlImage,
|
||||
$ttl,
|
||||
$array_result,
|
||||
|
@ -6372,9 +6437,14 @@ function reporting_advanced_sla(
|
|||
|
||||
|
||||
/**
|
||||
* reporting_availability
|
||||
* Report Availability.
|
||||
*
|
||||
* Generates a structure the report.
|
||||
* @param array $report Data report.
|
||||
* @param array $content Content for report.
|
||||
* @param null|string $date Date.
|
||||
* @param null|integer $time Time.
|
||||
*
|
||||
* @return array Return array for draw report Availability.
|
||||
*/
|
||||
function reporting_availability($report, $content, $date=false, $time=false)
|
||||
{
|
||||
|
@ -6417,7 +6487,12 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||
$count = 0;
|
||||
|
||||
if ($content['failover_mode']) {
|
||||
$availability_graph_data = reporting_availability_graph($report, $content, false, true);
|
||||
$availability_graph_data = reporting_availability_graph(
|
||||
$report,
|
||||
$content,
|
||||
false,
|
||||
true
|
||||
);
|
||||
$data = $availability_graph_data['data'];
|
||||
|
||||
foreach ($data as $key => $item_data) {
|
||||
|
@ -6428,7 +6503,7 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||
$data[$key]['availability_item'] = $item_data['module'];
|
||||
$text = $item_data['agent'].' ('.$item_data['module'].')';
|
||||
$avg = ((($avg * $count) + $percent_ok) / ($count + 1));
|
||||
if (is_null($min)) {
|
||||
if (isset($min) === false) {
|
||||
$min = $percent_ok;
|
||||
$min_text = $text;
|
||||
} else {
|
||||
|
@ -6438,7 +6513,7 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||
}
|
||||
}
|
||||
|
||||
if (is_null($max)) {
|
||||
if (isset($max) === false) {
|
||||
$max = $percent_ok;
|
||||
$max_text = $text;
|
||||
} else {
|
||||
|
@ -6461,9 +6536,10 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'
|
||||
SELECT id_agent_module, id_agent_module_failover,
|
||||
server_name, operation
|
||||
'SELECT id_agent_module,
|
||||
id_agent_module_failover,
|
||||
server_name,
|
||||
operation
|
||||
FROM treport_content_item
|
||||
WHERE id_report_content = %d',
|
||||
$content['id_rc']
|
||||
|
@ -6481,8 +6557,16 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||
$aux_id_agents = $agents;
|
||||
$i = 0;
|
||||
foreach ($items as $item) {
|
||||
$utimestamp = db_get_value('utimestamp', 'tagente_datos', 'id_agente_modulo', $item['id_agent_module'], true);
|
||||
if (($utimestamp === false) || (intval($utimestamp) > intval($datetime_to))) {
|
||||
$utimestamp = db_get_value(
|
||||
'utimestamp',
|
||||
'tagente_datos',
|
||||
'id_agente_modulo',
|
||||
$item['id_agent_module'],
|
||||
true
|
||||
);
|
||||
if (($utimestamp === false)
|
||||
|| (intval($utimestamp) > intval($datetime_to))
|
||||
) {
|
||||
unset($items[$i]);
|
||||
}
|
||||
|
||||
|
@ -6490,14 +6574,29 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($items)) {
|
||||
if (empty($items) === false
|
||||
&& (bool) $content['compare_work_time'] === true
|
||||
) {
|
||||
$items_compare = [];
|
||||
foreach ($items as $item) {
|
||||
// aaMetaconsole connection
|
||||
$item['compare'] = 1;
|
||||
$items_compare[] = $item;
|
||||
$item['compare'] = 0;
|
||||
$items_compare[] = $item;
|
||||
}
|
||||
|
||||
$items = $items_compare;
|
||||
}
|
||||
|
||||
if (empty($items) === false) {
|
||||
foreach ($items as $item) {
|
||||
// Metaconsole connection.
|
||||
$server_name = $item['server_name'];
|
||||
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
|
||||
if (($config['metaconsole'] == 1)
|
||||
&& $server_name != '' && is_metaconsole()
|
||||
) {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (metaconsole_load_external_db($connection) != NOERR) {
|
||||
// ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -6505,8 +6604,10 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||
if (modules_is_disable_agent($item['id_agent_module'])
|
||||
|| modules_is_not_init($item['id_agent_module'])
|
||||
) {
|
||||
// Restore dbconnection
|
||||
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
|
||||
// Restore dbconnection.
|
||||
if (($config['metaconsole'] == 1)
|
||||
&& $server_name != '' && is_metaconsole()
|
||||
) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
@ -6517,62 +6618,83 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||
|
||||
$text = '';
|
||||
|
||||
$row['data'] = reporting_advanced_sla(
|
||||
$item['id_agent_module'],
|
||||
($report['datetime'] - $content['period']),
|
||||
$report['datetime'],
|
||||
null,
|
||||
// min_value -> dynamic
|
||||
null,
|
||||
// max_value -> dynamic
|
||||
null,
|
||||
// inverse_interval -> dynamic
|
||||
[
|
||||
'1' => $content['sunday'],
|
||||
'2' => $content['monday'],
|
||||
'3' => $content['tuesday'],
|
||||
'4' => $content['wednesday'],
|
||||
'5' => $content['thursday'],
|
||||
'6' => $content['friday'],
|
||||
'7' => $content['saturday'],
|
||||
],
|
||||
$content['time_from'],
|
||||
$content['time_to']
|
||||
);
|
||||
if (isset($item['compare']) === true
|
||||
&& empty($item['compare']) === true
|
||||
) {
|
||||
// Intervals is dinamic.
|
||||
$row['data'] = reporting_advanced_sla(
|
||||
$item['id_agent_module'],
|
||||
($report['datetime'] - $content['period']),
|
||||
$report['datetime'],
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
[
|
||||
'1' => $content['sunday'],
|
||||
'2' => $content['monday'],
|
||||
'3' => $content['tuesday'],
|
||||
'4' => $content['wednesday'],
|
||||
'5' => $content['thursday'],
|
||||
'6' => $content['friday'],
|
||||
'7' => $content['saturday'],
|
||||
],
|
||||
$content['time_from'],
|
||||
$content['time_to']
|
||||
);
|
||||
} else {
|
||||
// Intervals is dinamic.
|
||||
$row['data'] = reporting_advanced_sla(
|
||||
$item['id_agent_module'],
|
||||
($report['datetime'] - $content['period']),
|
||||
$report['datetime']
|
||||
);
|
||||
}
|
||||
|
||||
// HACK it is saved in show_graph field.
|
||||
// Show interfaces instead the modules
|
||||
// Show interfaces instead the modules.
|
||||
if ($content['show_graph']) {
|
||||
$text = $row['data']['availability_item'] = agents_get_address(
|
||||
$row['data']['availability_item'] = agents_get_address(
|
||||
modules_get_agentmodule_agent($item['id_agent_module'])
|
||||
);
|
||||
|
||||
if (empty($text)) {
|
||||
$text = $row['data']['availability_item'] = __('No Address');
|
||||
$row['data']['availability_item'] = __('No Address');
|
||||
}
|
||||
} else {
|
||||
$text = $row['data']['availability_item'] = modules_get_agentmodule_name(
|
||||
$row['data']['availability_item'] = modules_get_agentmodule_name(
|
||||
$item['id_agent_module']
|
||||
);
|
||||
}
|
||||
|
||||
$text = $row['data']['availability_item'];
|
||||
|
||||
$row['data']['agent'] = modules_get_agentmodule_agent_alias(
|
||||
$item['id_agent_module']
|
||||
);
|
||||
|
||||
if (isset($item['compare']) === true
|
||||
&& empty($item['compare']) === true
|
||||
) {
|
||||
$row['data']['compare'] = false;
|
||||
} else {
|
||||
$row['data']['compare'] = true;
|
||||
}
|
||||
|
||||
$text = $row['data']['agent'].' ('.$text.')';
|
||||
|
||||
// Restore dbconnection
|
||||
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
|
||||
// Restore dbconnection.
|
||||
if (($config['metaconsole'] == 1)
|
||||
&& $server_name != '' && is_metaconsole()
|
||||
) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
// find order
|
||||
// Find order.
|
||||
$row['data']['order'] = $row['data']['SLA'];
|
||||
|
||||
$percent_ok = $row['data']['SLA'];
|
||||
$avg = ((($avg * $count) + $percent_ok) / ($count + 1));
|
||||
if (is_null($min)) {
|
||||
if (isset($min) === false) {
|
||||
$min = $percent_ok;
|
||||
$min_text = $text;
|
||||
} else {
|
||||
|
@ -6582,7 +6704,7 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||
}
|
||||
}
|
||||
|
||||
if (is_null($max)) {
|
||||
if (isset($max) === false) {
|
||||
$max = $percent_ok;
|
||||
$max_text = $text;
|
||||
} else {
|
||||
|
@ -6650,6 +6772,10 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||
|
||||
$data = $temp;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not possible.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6680,17 +6806,22 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reporting_availability_graph.
|
||||
*
|
||||
* @param array $report Info report.
|
||||
* @param array $content Content data.
|
||||
* @param boolean $pdf Output type PDF.
|
||||
*
|
||||
* @return array Generates a structure the report.
|
||||
*/
|
||||
function reporting_availability_graph($report, $content, $pdf=false, $failover=false)
|
||||
{
|
||||
/**
|
||||
* Reporting_availability_graph.
|
||||
*
|
||||
* @param array $report Info report.
|
||||
* @param array $content Content data.
|
||||
* @param null|boolean $pdf Output type PDF.
|
||||
* @param null|boolean $failover Failover mode.
|
||||
*
|
||||
* @return array Generates a structure the report.
|
||||
*/
|
||||
function reporting_availability_graph(
|
||||
$report,
|
||||
$content,
|
||||
$pdf=false,
|
||||
$failover=false
|
||||
) {
|
||||
global $config;
|
||||
$return = [];
|
||||
$return['type'] = 'availability_graph';
|
||||
|
@ -6756,6 +6887,20 @@ function reporting_availability_graph($report, $content, $pdf=false, $failover=f
|
|||
|
||||
$priority_mode = $content['style']['priority_mode'];
|
||||
|
||||
if (empty($slas) === false && empty($content['failover_mode']) === true
|
||||
&& (bool) $content['compare_work_time'] === true
|
||||
) {
|
||||
$sla_compare = [];
|
||||
foreach ($slas as $sla) {
|
||||
$sla['compare'] = 1;
|
||||
$sla_compare[] = $sla;
|
||||
$sla['compare'] = 0;
|
||||
$sla_compare[] = $sla;
|
||||
}
|
||||
|
||||
$slas = $sla_compare;
|
||||
}
|
||||
|
||||
foreach ($slas as $sla) {
|
||||
$server_name = $sla['server_name'];
|
||||
|
||||
|
@ -6799,15 +6944,27 @@ function reporting_availability_graph($report, $content, $pdf=false, $failover=f
|
|||
$slice = ($content['period'] / $module_interval);
|
||||
$data_combined = [];
|
||||
|
||||
foreach ($sla_failover as $k_sla => $v_sla) {
|
||||
$sla_array = data_db_uncompress_module(
|
||||
$v_sla,
|
||||
$content,
|
||||
$report['datetime'],
|
||||
$slice
|
||||
);
|
||||
if ((bool) $content['compare_work_time'] === true) {
|
||||
$sla_compare = [];
|
||||
foreach ($sla_failover as $k_sla => $sla) {
|
||||
$sla['compare'] = 1;
|
||||
$sla_compare[$k_sla.'_compare'] = $sla;
|
||||
$sla['compare'] = 0;
|
||||
$sla_compare[$k_sla] = $sla;
|
||||
}
|
||||
|
||||
$sla_failover = $sla_compare;
|
||||
}
|
||||
|
||||
foreach ($sla_failover as $k_sla => $v_sla) {
|
||||
if ($content['failover_type'] == REPORT_FAILOVER_TYPE_NORMAL) {
|
||||
$sla_array = data_compare_24x7(
|
||||
$v_sla,
|
||||
$content,
|
||||
$report['datetime'],
|
||||
$slice
|
||||
);
|
||||
|
||||
$return = prepare_data_for_paint(
|
||||
$v_sla,
|
||||
$sla_array,
|
||||
|
@ -6819,53 +6976,37 @@ function reporting_availability_graph($report, $content, $pdf=false, $failover=f
|
|||
);
|
||||
}
|
||||
|
||||
$data_combined[] = $sla_array;
|
||||
if (isset($v_sla['compare']) === true
|
||||
&& empty($v_sla['compare']) === false
|
||||
) {
|
||||
$data_combined_compare[] = $sla_array;
|
||||
} else {
|
||||
$data_combined[] = $sla_array;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($data_combined_compare) === true
|
||||
&& is_array($data_combined_compare) === true
|
||||
&& count($data_combined_compare) > 0
|
||||
) {
|
||||
$return = prepare_data_for_paint(
|
||||
$sla,
|
||||
data_combined_failover($data_combined_compare),
|
||||
$content,
|
||||
$report['datetime'],
|
||||
$return,
|
||||
'result_compare',
|
||||
$pdf
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($data_combined) === true
|
||||
&& is_array($data_combined) === true
|
||||
&& count($data_combined) > 0
|
||||
) {
|
||||
$count_failover = count($data_combined);
|
||||
|
||||
$data_a = $data_combined[0];
|
||||
for ($i = 1; $count_failover > $i; $i++) {
|
||||
$data_a = array_map(
|
||||
function ($primary, $failover) {
|
||||
$return_map = [];
|
||||
if ($primary['date_from'] === $failover['date_from']
|
||||
&& $primary['date_to'] === $failover['date_to']
|
||||
) {
|
||||
if ($primary['time_ok'] < $failover['time_ok']) {
|
||||
$primary['time_total'] = $failover['time_total'];
|
||||
$primary['time_ok'] = $failover['time_ok'];
|
||||
$primary['time_error'] = $failover['time_error'];
|
||||
$primary['time_unknown'] = $failover['time_unknown'];
|
||||
$primary['time_not_init'] = $failover['time_not_init'];
|
||||
$primary['time_downtime'] = $failover['time_downtime'];
|
||||
$primary['time_out'] = $failover['time_out'];
|
||||
$primary['checks_total'] = $failover['checks_total'];
|
||||
$primary['checks_ok'] = $failover['checks_ok'];
|
||||
$primary['checks_error'] = $failover['checks_error'];
|
||||
$primary['checks_unknown'] = $failover['checks_unknown'];
|
||||
$primary['checks_not_init'] = $failover['checks_not_init'];
|
||||
$primary['SLA'] = $failover['SLA'];
|
||||
$primary['sla_fixed'] = $failover['sla_fixed'];
|
||||
}
|
||||
|
||||
$return_map = $primary;
|
||||
}
|
||||
|
||||
return $return_map;
|
||||
},
|
||||
$data_a,
|
||||
$data_combined[($i)]
|
||||
);
|
||||
}
|
||||
|
||||
$return = prepare_data_for_paint(
|
||||
$sla,
|
||||
$data_a,
|
||||
data_combined_failover($data_combined),
|
||||
$content,
|
||||
$report['datetime'],
|
||||
$return,
|
||||
|
@ -6874,10 +7015,11 @@ function reporting_availability_graph($report, $content, $pdf=false, $failover=f
|
|||
);
|
||||
}
|
||||
} else {
|
||||
$sla_array = data_db_uncompress_module(
|
||||
$sla_array = data_compare_24x7(
|
||||
$sla,
|
||||
$content,
|
||||
$report['datetime']
|
||||
$report['datetime'],
|
||||
0
|
||||
);
|
||||
|
||||
$return = prepare_data_for_paint(
|
||||
|
@ -6991,6 +7133,97 @@ function reporting_availability_graph($report, $content, $pdf=false, $failover=f
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Combined data modules failover.
|
||||
*
|
||||
* @param array $data Data.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function data_combined_failover(array $data)
|
||||
{
|
||||
$count_failover = count($data);
|
||||
|
||||
$result = $data[0];
|
||||
for ($i = 1; $count_failover > $i; $i++) {
|
||||
$result = array_map(
|
||||
function ($primary, $failover) {
|
||||
$return_map = [];
|
||||
if ($primary['date_from'] === $failover['date_from']
|
||||
&& $primary['date_to'] === $failover['date_to']
|
||||
) {
|
||||
if ($primary['time_ok'] < $failover['time_ok']) {
|
||||
$primary['time_total'] = $failover['time_total'];
|
||||
$primary['time_ok'] = $failover['time_ok'];
|
||||
$primary['time_error'] = $failover['time_error'];
|
||||
$primary['time_unknown'] = $failover['time_unknown'];
|
||||
$primary['time_not_init'] = $failover['time_not_init'];
|
||||
$primary['time_downtime'] = $failover['time_downtime'];
|
||||
$primary['time_out'] = $failover['time_out'];
|
||||
$primary['checks_total'] = $failover['checks_total'];
|
||||
$primary['checks_ok'] = $failover['checks_ok'];
|
||||
$primary['checks_error'] = $failover['checks_error'];
|
||||
$primary['checks_unknown'] = $failover['checks_unknown'];
|
||||
$primary['checks_not_init'] = $failover['checks_not_init'];
|
||||
$primary['SLA'] = $failover['SLA'];
|
||||
$primary['sla_fixed'] = $failover['sla_fixed'];
|
||||
}
|
||||
|
||||
$return_map = $primary;
|
||||
}
|
||||
|
||||
return $return_map;
|
||||
},
|
||||
$result,
|
||||
$data[($i)]
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepare data compare option.
|
||||
*
|
||||
* @param array $value Value data.
|
||||
* @param array $content Content report.
|
||||
* @param string $datetime Time.
|
||||
* @param integer|null $slice Number slices.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function data_compare_24x7(
|
||||
array $value,
|
||||
array $content,
|
||||
string $datetime,
|
||||
?int $slice=0
|
||||
) {
|
||||
if (isset($value['compare']) === true
|
||||
&& empty($value['compare']) === false
|
||||
) {
|
||||
$content['sunday'] = 1;
|
||||
$content['monday'] = 1;
|
||||
$content['tuesday'] = 1;
|
||||
$content['wednesday'] = 1;
|
||||
$content['thursday'] = 1;
|
||||
$content['friday'] = 1;
|
||||
$content['saturday'] = 1;
|
||||
$content['time_from'] = '00:00';
|
||||
$content['time_to'] = '23:59';
|
||||
}
|
||||
|
||||
$sla_array = data_db_uncompress_module(
|
||||
$value,
|
||||
$content,
|
||||
$datetime,
|
||||
$slice
|
||||
);
|
||||
|
||||
return $sla_array;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return data db uncompress for module.
|
||||
*
|
||||
|
@ -7220,6 +7453,15 @@ function prepare_data_for_paint(
|
|||
$data['sla_value'] = $sla_array['SLA'];
|
||||
}
|
||||
|
||||
$data['compare'] = 0;
|
||||
if (isset($sla['compare']) === true) {
|
||||
if ((bool) $sla['compare'] === true) {
|
||||
$data['compare'] = 1;
|
||||
} else {
|
||||
$data['compare'] = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Checks whether or not it meets the SLA.
|
||||
if ($data['sla_value'] >= $sla['sla_limit']) {
|
||||
$data['sla_status'] = 1;
|
||||
|
@ -7281,8 +7523,16 @@ function prepare_data_for_paint(
|
|||
$dataslice['sla_value'] = $data['sla_value'];
|
||||
|
||||
$height = 80;
|
||||
if ($failover !== '' && $failover !== 'result') {
|
||||
if (($failover !== ''
|
||||
&& $failover !== 'result')
|
||||
|| (bool) $sla['compare'] === true
|
||||
) {
|
||||
$height = 50;
|
||||
if ($failover !== '' && (bool) $sla['compare'] === true
|
||||
|| $failover === 'result_compare'
|
||||
) {
|
||||
$height = 40;
|
||||
}
|
||||
}
|
||||
|
||||
$dataslice['chart'] = graph_sla_slicebar(
|
||||
|
@ -11739,7 +11989,6 @@ function reporting_get_stats_servers()
|
|||
$table_srv->style[1] = $table_srv->style[3] = 'text-align: left; padding: 5px;';
|
||||
|
||||
$tdata = [];
|
||||
'<span class="big_data">'.format_numeric($server_performance['total_local_modules']).'</span>';
|
||||
$tdata[0] = html_print_image('images/module.png', true, ['title' => __('Total running modules')]);
|
||||
$tdata[1] = '<span class="big_data">'.format_numeric($server_performance['total_modules']).'</span>';
|
||||
$tdata[2] = '<span class="med_data">'.format_numeric($server_performance['total_modules_rate'], 2).'</span>';
|
||||
|
@ -11846,12 +12095,6 @@ function reporting_get_stats_servers()
|
|||
);
|
||||
$tdata[1] = '<span class="big_data" id="total_events">'.html_print_image('images/spinner.gif', true).'</span>';
|
||||
|
||||
/*
|
||||
Hello there! :)
|
||||
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
|
||||
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
|
||||
*/
|
||||
|
||||
if ($system_events > 50000 && !enterprise_installed()) {
|
||||
$tdata[2] = "<div id='monitoreventsmodal' class='publienterprise' title='Community version' style='text-align:left'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
|
||||
} else {
|
||||
|
@ -11865,7 +12108,7 @@ function reporting_get_stats_servers()
|
|||
$output = '<fieldset class="databox tactical_set">
|
||||
<legend>'.__('Server performance').'</legend>'.html_print_table($table_srv, true).'</fieldset>';
|
||||
|
||||
$public_hash = get_parameter('hash', false);
|
||||
$public_hash = get_parameter('auth_hash', false);
|
||||
if ($public_hash === false) {
|
||||
$output .= '<script type="text/javascript">';
|
||||
$output .= '$(document).ready(function () {';
|
||||
|
|
|
@ -450,35 +450,35 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
|
|||
|
||||
$interval_description = $config['interval_description'];
|
||||
|
||||
if ($mini) {
|
||||
if ($mini === true) {
|
||||
$font_size = '1.5em';
|
||||
} else {
|
||||
$font_size = $config['font_size_item_report'].'em';
|
||||
}
|
||||
|
||||
$metaconsole_on = is_metaconsole();
|
||||
if ($metaconsole_on) {
|
||||
if ($metaconsole_on === true) {
|
||||
$src = '../../';
|
||||
} else {
|
||||
$src = $config['homeurl'];
|
||||
}
|
||||
|
||||
if (!empty($item['failed'])) {
|
||||
if (empty($item['failed']) === false) {
|
||||
$table->colspan['sla']['cell'] = 3;
|
||||
$table->data['sla']['cell'] = $item['failed'];
|
||||
} else {
|
||||
if (!empty($item['planned_downtimes'])) {
|
||||
if (empty($item['planned_downtimes']) === false) {
|
||||
$downtimes_table = reporting_html_planned_downtimes_table(
|
||||
$item['planned_downtimes']
|
||||
);
|
||||
|
||||
if (!empty($downtimes_table)) {
|
||||
if (empty($downtimes_table) === false) {
|
||||
$table->colspan['planned_downtime']['cell'] = 3;
|
||||
$table->data['planned_downtime']['cell'] = $downtimes_table;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($item['data'])) {
|
||||
if (isset($item['data']) === true) {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
|
||||
|
@ -571,11 +571,15 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
|
|||
$table3->headstyle[5] = 'text-align: right';
|
||||
|
||||
foreach ($item['data'] as $sla) {
|
||||
if (isset($sla)) {
|
||||
if (isset($sla) === true) {
|
||||
// First_table.
|
||||
$row = [];
|
||||
$row[] = $sla['agent'];
|
||||
$row[] = $sla['module'];
|
||||
if ((bool) $sla['compare'] === false) {
|
||||
$row[] = $sla['module'];
|
||||
} else {
|
||||
$row[] = $sla['module'].' ('.__('24 x 7').')';
|
||||
}
|
||||
|
||||
if (is_numeric($sla['dinamic_text'])) {
|
||||
$row[] = sla_truncate(
|
||||
|
@ -608,7 +612,14 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
|
|||
|
||||
// Second table for time globals.
|
||||
$row2 = [];
|
||||
$row2[] = $sla['agent'].' -- ['.$sla['module'].']';
|
||||
if ((bool) $sla['compare'] === false) {
|
||||
$row2[] = $sla['agent'].' -- ['.$sla['module'].']';
|
||||
} else {
|
||||
$name_agent_module = $sla['agent'];
|
||||
$name_agent_module .= ' -- ['.$sla['module'];
|
||||
$name_agent_module .= ' ('.__('24 x 7').')]';
|
||||
$row2[] = $name_agent_module;
|
||||
}
|
||||
|
||||
if ($sla['time_total'] != 0) {
|
||||
$row2[] = human_time_description_raw(
|
||||
|
@ -672,7 +683,15 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
|
|||
|
||||
// Third table for checks globals.
|
||||
$row3 = [];
|
||||
$row3[] = $sla['agent'].' -- ['.$sla['module'].']';
|
||||
if ((bool) $sla['compare'] === false) {
|
||||
$row3[] = $sla['agent'].' -- ['.$sla['module'].']';
|
||||
} else {
|
||||
$name_agent_module = $sla['agent'];
|
||||
$name_agent_module .= ' -- ['.$sla['module'];
|
||||
$name_agent_module .= ' ('.__('24 x 7').')]';
|
||||
$row3[] = $name_agent_module;
|
||||
}
|
||||
|
||||
$row3[] = $sla['checks_total'];
|
||||
$row3[] = '<span style="color: '.COL_CRITICAL.';">'.$sla['checks_error'].'</span>';
|
||||
$row3[] = '<span style="color: '.COL_NORMAL.';">'.$sla['checks_ok'].'</span>';
|
||||
|
@ -726,7 +745,9 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
|
|||
}
|
||||
} else {
|
||||
$table->colspan['error']['cell'] = 3;
|
||||
$table->data['error']['cell'] = __('There are no Agent/Modules defined');
|
||||
$table->data['error']['cell'] = __(
|
||||
'There are no Agent/Modules defined'
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($item['charts']) === false) {
|
||||
|
@ -741,8 +762,15 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
|
|||
$table1->data = [];
|
||||
|
||||
foreach ($item['charts'] as $chart) {
|
||||
$name_agent_module = $chart['agent'];
|
||||
$name_agent_module .= '<br />';
|
||||
$name_agent_module .= $chart['module'];
|
||||
if ((bool) $chart['compare'] === true) {
|
||||
$name_agent_module .= ' ('.__('24 x 7').')';
|
||||
}
|
||||
|
||||
$table1->data[] = [
|
||||
$chart['agent'].'<br />'.$chart['module'],
|
||||
$name_agent_module,
|
||||
$chart['chart'],
|
||||
];
|
||||
}
|
||||
|
@ -2884,7 +2912,7 @@ function reporting_html_agent_configuration(
|
|||
$row['description'] = $module['description'];
|
||||
$row['interval'] = $module['interval'];
|
||||
$row['unit'] = $module['unit'];
|
||||
$row['status'] = $module['status_icon'];
|
||||
$row['status'] = ($pdf === 0) ? $module['status_icon'] : explode(':', $module['status'])[0];
|
||||
$row['tags'] = implode(',', $module['tags']);
|
||||
|
||||
$table1->data[] = $row;
|
||||
|
@ -3216,13 +3244,13 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
$font_size = $config['font_size_item_report'].'em';
|
||||
$interval_description = $config['interval_description'];
|
||||
|
||||
if (!empty($item['data'])) {
|
||||
if (empty($item['data']) === false) {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
$table1->data = [];
|
||||
|
||||
$table1->head = [];
|
||||
if (isset($item['data'][0]['failover'])) {
|
||||
if (isset($item['data'][0]['failover']) === true) {
|
||||
$table1->head[-1] = __('Failover');
|
||||
}
|
||||
|
||||
|
@ -3274,7 +3302,7 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
$table1->head[8] = __('% Ok');
|
||||
|
||||
$table1->headstyle = [];
|
||||
if (isset($item['data'][0]['failover'])) {
|
||||
if (isset($item['data'][0]['failover']) === true) {
|
||||
$table1->headstyle[-1] = 'text-align: left';
|
||||
}
|
||||
|
||||
|
@ -3288,7 +3316,7 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
$table1->headstyle[7] = 'text-align: right';
|
||||
$table1->headstyle[8] = 'text-align: right';
|
||||
|
||||
if (isset($item['data'][0]['failover'])) {
|
||||
if (isset($item['data'][0]['failover']) === true) {
|
||||
$table1->style[-1] = 'text-align: left';
|
||||
}
|
||||
|
||||
|
@ -3301,13 +3329,14 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
$table1->style[6] = 'text-align: center';
|
||||
$table1->style[7] = 'text-align: right';
|
||||
$table1->style[8] = 'text-align: right';
|
||||
$table1->style[9] = 'text-align: right';
|
||||
|
||||
$table2 = new stdClass();
|
||||
$table2->width = '99%';
|
||||
$table2->data = [];
|
||||
|
||||
$table2->head = [];
|
||||
if (isset($item['data'][0]['failover'])) {
|
||||
if (isset($item['data'][0]['failover']) === true) {
|
||||
$table2->head[-1] = __('Failover');
|
||||
}
|
||||
|
||||
|
@ -3345,44 +3374,73 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
}
|
||||
|
||||
$table2->headstyle = [];
|
||||
if (isset($item['data'][0]['failover'])) {
|
||||
if (isset($item['data'][0]['failover']) === true) {
|
||||
$table2->headstyle[-1] = 'text-align: left';
|
||||
}
|
||||
|
||||
$table2->headstyle[0] = 'text-align: left';
|
||||
$table2->headstyle[1] = 'text-align: left';
|
||||
$table2->headstyle[2] = 'text-align: right';
|
||||
$table2->headstyle[2] = 'text-align: left';
|
||||
if (isset($item['data'][0]['failover']) === true) {
|
||||
$table2->headstyle[2] = 'text-align: right';
|
||||
}
|
||||
|
||||
$table2->headstyle[3] = 'text-align: right';
|
||||
$table2->headstyle[4] = 'text-align: right';
|
||||
$table2->headstyle[5] = 'text-align: right';
|
||||
|
||||
if (isset($item['data'][0]['failover'])) {
|
||||
if (isset($item['data'][0]['failover']) === true) {
|
||||
$table2->style[-1] = 'text-align: left';
|
||||
}
|
||||
|
||||
$table2->style[0] = 'text-align: left';
|
||||
$table2->style[1] = 'text-align: left';
|
||||
$table2->style[2] = 'text-align: right';
|
||||
$table2->style[2] = 'text-align: left';
|
||||
$table2->style[3] = 'text-align: right';
|
||||
$table2->style[4] = 'text-align: right';
|
||||
$table2->style[5] = 'text-align: right';
|
||||
$table2->style[6] = 'text-align: right';
|
||||
|
||||
foreach ($item['data'] as $row) {
|
||||
$table_row = [];
|
||||
if (isset($row['failover'])) {
|
||||
if (strpos($row['failover'], 'failover') !== false) {
|
||||
$table_row[] = __('Failover');
|
||||
} else {
|
||||
$table_row[] = ucfirst($row['failover']);
|
||||
if (isset($row['failover']) === true) {
|
||||
switch ($row['failover']) {
|
||||
case 'primary_compare':
|
||||
$table_row[] = __('Primary').' (24x7)';
|
||||
break;
|
||||
|
||||
case 'failover_compare':
|
||||
$table_row[] = __('Failover').' (24x7)';
|
||||
break;
|
||||
|
||||
case 'result_compare':
|
||||
$table_row[] = __('Result').' (24x7)';
|
||||
break;
|
||||
|
||||
default:
|
||||
if (strpos($row['failover'], 'failover') !== false) {
|
||||
$table_row[] = __('Failover');
|
||||
} else {
|
||||
$table_row[] = ucfirst($row['failover']);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($row['failover']) && $row['failover'] === 'result') {
|
||||
if (isset($row['failover']) === true
|
||||
&& ($row['failover'] === 'result'
|
||||
|| $row['failover'] === 'result_compare')
|
||||
) {
|
||||
$table_row[] = '--';
|
||||
$table_row[] = '--';
|
||||
} else {
|
||||
$table_row[] = $row['agent'];
|
||||
$table_row[] = $row['availability_item'];
|
||||
$item = $row['availability_item'];
|
||||
if ((bool) $row['compare'] === true) {
|
||||
$item .= ' ('.__('24 x 7').')';
|
||||
}
|
||||
|
||||
$table_row[] = $item;
|
||||
}
|
||||
|
||||
if ($row['time_total'] != 0 && $item['fields']['total_time']) {
|
||||
|
@ -3391,7 +3449,9 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
true,
|
||||
$interval_description
|
||||
);
|
||||
} else if ($row['time_total'] == 0 && $item['fields']['total_time']) {
|
||||
} else if ($row['time_total'] == 0
|
||||
&& $item['fields']['total_time']
|
||||
) {
|
||||
$table_row[] = '--';
|
||||
} else {
|
||||
$table_row[] = '';
|
||||
|
@ -3403,7 +3463,9 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
true,
|
||||
$interval_description
|
||||
);
|
||||
} else if ($row['time_error'] == 0 && $item['fields']['time_failed']) {
|
||||
} else if ($row['time_error'] == 0
|
||||
&& $item['fields']['time_failed']
|
||||
) {
|
||||
$table_row[] = '--';
|
||||
} else {
|
||||
$table_row[] = '';
|
||||
|
@ -3415,43 +3477,57 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
true,
|
||||
$interval_description
|
||||
);
|
||||
} else if ($row['time_ok'] == 0 && $item['fields']['time_in_ok_status']) {
|
||||
} else if ($row['time_ok'] == 0
|
||||
&& $item['fields']['time_in_ok_status']
|
||||
) {
|
||||
$table_row[] = '--';
|
||||
} else {
|
||||
$table_row[] = '';
|
||||
};
|
||||
|
||||
if ($row['time_unknown'] != 0 && $item['fields']['time_in_unknown_status']) {
|
||||
if ($row['time_unknown'] != 0
|
||||
&& $item['fields']['time_in_unknown_status']
|
||||
) {
|
||||
$table_row[] = human_time_description_raw(
|
||||
$row['time_unknown'],
|
||||
true,
|
||||
$interval_description
|
||||
);
|
||||
} else if ($row['time_unknown'] == 0 && $item['fields']['time_in_unknown_status']) {
|
||||
} else if ($row['time_unknown'] == 0
|
||||
&& $item['fields']['time_in_unknown_status']
|
||||
) {
|
||||
$table_row[] = '--';
|
||||
} else {
|
||||
$table_row[] = '';
|
||||
};
|
||||
|
||||
if ($row['time_not_init'] != 0 && $item['fields']['time_of_not_initialized_module']) {
|
||||
if ($row['time_not_init'] != 0
|
||||
&& $item['fields']['time_of_not_initialized_module']
|
||||
) {
|
||||
$table_row[] = human_time_description_raw(
|
||||
$row['time_not_init'],
|
||||
true,
|
||||
$interval_description
|
||||
);
|
||||
} else if ($row['time_not_init'] == 0 && $item['fields']['time_of_not_initialized_module']) {
|
||||
} else if ($row['time_not_init'] == 0
|
||||
&& $item['fields']['time_of_not_initialized_module']
|
||||
) {
|
||||
$table_row[] = '--';
|
||||
} else {
|
||||
$table_row[] = '';
|
||||
};
|
||||
|
||||
if ($row['time_downtime'] != 0 && $item['fields']['time_of_downtime']) {
|
||||
if ($row['time_downtime'] != 0
|
||||
&& $item['fields']['time_of_downtime']
|
||||
) {
|
||||
$table_row[] = human_time_description_raw(
|
||||
$row['time_downtime'],
|
||||
true,
|
||||
$interval_description
|
||||
);
|
||||
} else if ($row['time_downtime'] == 0 && $item['fields']['time_of_downtime']) {
|
||||
} else if ($row['time_downtime'] == 0
|
||||
&& $item['fields']['time_of_downtime']
|
||||
) {
|
||||
$table_row[] = '--';
|
||||
} else {
|
||||
$table_row[] = '';
|
||||
|
@ -3460,39 +3536,78 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
$table_row[] = '<span style="font-size: '.$font_size.'; font-weight:bold;">'.sla_truncate($row['SLA'], $config['graph_precision']).'%</span>';
|
||||
|
||||
$table_row2 = [];
|
||||
if (isset($row['failover'])) {
|
||||
$table_row2[] = ucfirst($row['failover']);
|
||||
if (isset($row['failover']) === true) {
|
||||
switch ($row['failover']) {
|
||||
case 'primary_compare':
|
||||
$table_row2[] = __('Primary').' (24x7)';
|
||||
break;
|
||||
|
||||
case 'failover_compare':
|
||||
$table_row2[] = __('Failover').' (24x7)';
|
||||
break;
|
||||
|
||||
case 'result_compare':
|
||||
$table_row2[] = __('Result').' (24x7)';
|
||||
break;
|
||||
|
||||
default:
|
||||
if (strpos($row['failover'], 'failover') !== false) {
|
||||
$table_row2[] = __('Failover');
|
||||
} else {
|
||||
$table_row2[] = ucfirst($row['failover']);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($row['failover']) === true
|
||||
&& ($row['failover'] === 'result'
|
||||
|| $row['failover'] === 'result_compare')
|
||||
) {
|
||||
$table_row2[] = '--';
|
||||
$table_row2[] = '--';
|
||||
} else {
|
||||
$table_row2[] = $row['agent'];
|
||||
$item = $row['availability_item'];
|
||||
if ((bool) $row['compare'] === true) {
|
||||
$item .= ' ('.__('24 x 7').')';
|
||||
}
|
||||
|
||||
$table_row2[] = $item;
|
||||
}
|
||||
|
||||
$table_row2[] = $row['agent'];
|
||||
$table_row2[] = $row['availability_item'];
|
||||
if ($item['fields']['total_checks']) {
|
||||
$table_row2[] = $row['checks_total'];
|
||||
} else {
|
||||
$table_row2[] = '';
|
||||
};
|
||||
}
|
||||
|
||||
if ($item['fields']['checks_failed']) {
|
||||
$table_row2[] = $row['checks_error'];
|
||||
} else {
|
||||
$table_row2[] = '';
|
||||
};
|
||||
}
|
||||
|
||||
if ($item['fields']['checks_in_ok_status']) {
|
||||
$table_row2[] = $row['checks_ok'];
|
||||
} else {
|
||||
$table_row2[] = '';
|
||||
};
|
||||
}
|
||||
|
||||
if ($item['fields']['unknown_checks']) {
|
||||
$table_row2[] = $row['checks_unknown'];
|
||||
} else {
|
||||
$table_row2[] = '';
|
||||
};
|
||||
}
|
||||
|
||||
$table1->data[] = $table_row;
|
||||
$table2->data[] = $table_row2;
|
||||
}
|
||||
} else {
|
||||
$table->colspan['error']['cell'] = 3;
|
||||
$table->data['error']['cell'] = __('There are no Agent/Modules defined');
|
||||
$table->data['error']['cell'] = __(
|
||||
'There are no Agent/Modules defined'
|
||||
);
|
||||
}
|
||||
|
||||
if ($pdf === 0) {
|
||||
|
@ -3521,10 +3636,12 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
}
|
||||
}
|
||||
|
||||
if ($item['resume']['resume'] && !empty($item['data'])) {
|
||||
if ($item['resume']['resume'] && empty($item['data']) === false) {
|
||||
$table1->width = '99%';
|
||||
$table1->data = [];
|
||||
if (empty($same_agent_in_resume) || (strpos($item['resume']['min_text'], $same_agent_in_resume) === false)) {
|
||||
if (empty($same_agent_in_resume) === true
|
||||
|| (strpos($item['resume']['min_text'], $same_agent_in_resume) === false)
|
||||
) {
|
||||
$table1->head = [];
|
||||
$table1->head['max_text'] = __('Agent max value');
|
||||
$table1->head['max'] = __('Max Value');
|
||||
|
@ -3668,23 +3785,33 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
|
|||
|
||||
// Check failover availability report.
|
||||
if (empty($item['data'][$k_chart]['failover']) === true) {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '100%';
|
||||
$table1->autosize = 1;
|
||||
$table1->styleTable = 'overflow: wrap; table-layout: fixed;';
|
||||
$table1->data = [];
|
||||
$table1->size = [];
|
||||
$table1->size[0] = '10%';
|
||||
$table1->size[1] = '80%';
|
||||
$table1->size[2] = '10%';
|
||||
if ($item['data'][$k_chart]['compare'] === 0
|
||||
|| $item['data'][$k_chart]['compare'] === 1
|
||||
) {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '100%';
|
||||
$table1->autosize = 1;
|
||||
$table1->styleTable = 'overflow: wrap; table-layout: fixed;';
|
||||
$table1->data = [];
|
||||
$table1->size = [];
|
||||
$table1->size[0] = '10%';
|
||||
$table1->size[1] = '80%';
|
||||
$table1->size[2] = '10%';
|
||||
}
|
||||
|
||||
$table1->style[0] = 'overflow-wrap: break-word';
|
||||
|
||||
// Align percentage and checks resume.
|
||||
$table1->align[2] = 'center';
|
||||
$table1->data[0][0] = $chart['agent'].'<br />'.$chart['module'];
|
||||
$table1->data[0][1] = $chart['chart'];
|
||||
$table1->data[0][2] = "<span style = 'font-weight: bold; font-size: ".$font_size.'; color: '.$color."'>".$sla_value.'</span><br/>';
|
||||
$table1->data[$k_chart][0] = $chart['agent'];
|
||||
$table1->data[$k_chart][0] .= '<br />';
|
||||
$table1->data[$k_chart][0] .= $chart['module'];
|
||||
if ($item['data'][$k_chart]['compare'] === 1) {
|
||||
$table1->data[$k_chart][0] .= ' (24 x 7)';
|
||||
}
|
||||
|
||||
$table1->data[$k_chart][1] = $chart['chart'];
|
||||
$table1->data[$k_chart][2] = "<span style = 'font-weight: bold; font-size: ".$font_size.'; color: '.$color."'>".$sla_value.'</span><br/>';
|
||||
|
||||
// Pdf sizes to avoid excesive overflow.
|
||||
if ($pdf !== 0) {
|
||||
|
@ -3693,15 +3820,20 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
|
|||
$table1->size[2] = '15%';
|
||||
}
|
||||
|
||||
$table1->data[0][2] .= "<span style = 'font-size: ".$font_mini.";'>".$checks_resume.'</span>';
|
||||
$table1->data[$k_chart][2] .= "<span style = 'font-size: ".$font_mini.";'>".$checks_resume.'</span>';
|
||||
|
||||
$tables_chart .= html_print_table(
|
||||
$table1,
|
||||
true
|
||||
);
|
||||
if ($item['data'][$k_chart]['compare'] !== 1) {
|
||||
$tables_chart .= html_print_table(
|
||||
$table1,
|
||||
true
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if ($item['data'][$k_chart]['failover'] === 'primary'
|
||||
|| $item['failover_type'] == REPORT_FAILOVER_TYPE_SIMPLE
|
||||
if (($item['data'][$k_chart]['failover'] === 'primary'
|
||||
|| $item['data'][$k_chart]['failover'] === 'primary_compare'
|
||||
|| $item['failover_type'] == REPORT_FAILOVER_TYPE_SIMPLE)
|
||||
&& ($item['data'][$k_chart]['compare'] === 0
|
||||
|| $item['data'][$k_chart]['compare'] === 1)
|
||||
) {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
|
@ -3719,18 +3851,38 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
|
|||
$checks_resume_text .= '</span>';
|
||||
$sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.' !important; color: '.$color."'>".$sla_value.'</span>';
|
||||
switch ($item['data'][$k_chart]['failover']) {
|
||||
case 'primary_compare':
|
||||
$title = '<b>'.__('Primary').' (24x7)</b>';
|
||||
$title .= '<br />'.$chart['agent'];
|
||||
$title .= '<br />'.$chart['module'];
|
||||
break;
|
||||
|
||||
case 'primary':
|
||||
$title = '<b>'.__('Primary').'</b>';
|
||||
$title .= '<br />'.$chart['agent'];
|
||||
$title .= '<br />'.$chart['module'];
|
||||
break;
|
||||
|
||||
case 'failover_compare':
|
||||
$title = '<b>'.__('Failover').' (24x7)</b>';
|
||||
$title .= '<br />'.$chart['agent'];
|
||||
$title .= '<br />'.$chart['module'];
|
||||
break;
|
||||
|
||||
case (preg_match('/failover.*/', $item['data'][$k_chart]['failover']) ? true : false):
|
||||
$title = '<b>'.__('Failover').'</b>';
|
||||
$title .= '<br />'.$chart['agent'];
|
||||
$title .= '<br />'.$chart['module'];
|
||||
break;
|
||||
|
||||
case 'result_compare':
|
||||
$title = '<b>'.__('Result').' (24x7)</b>';
|
||||
$sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.' !important; color: '.$color."'>".$sla_value.'</span>';
|
||||
$checks_resume_text = '<span style = "font-size: '.$font_mini.';">';
|
||||
$checks_resume_text .= $checks_resume;
|
||||
$checks_resume_text .= '</span>';
|
||||
break;
|
||||
|
||||
case 'result':
|
||||
default:
|
||||
$title = '<b>'.__('Result').'</b>';
|
||||
|
@ -3746,7 +3898,9 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
|
|||
$table1->data[$item['data'][$k_chart]['failover']][2] = $sla_value_text;
|
||||
$table1->data[$item['data'][$k_chart]['failover']][3] = $checks_resume_text;
|
||||
|
||||
if ($item['data'][$k_chart]['failover'] === 'result') {
|
||||
if ($item['data'][$k_chart]['compare'] !== 1
|
||||
&& $item['data'][$k_chart]['failover'] === 'result'
|
||||
) {
|
||||
$tables_chart .= html_print_table(
|
||||
$table1,
|
||||
true
|
||||
|
|
|
@ -273,7 +273,7 @@ function snmp_browser_get_tree(
|
|||
break;
|
||||
|
||||
case '2':
|
||||
$snmp_version = SNMP::VERSION_2c;
|
||||
$snmp_version = SNMP::VERSION_2C;
|
||||
break;
|
||||
|
||||
case '2c':
|
||||
|
@ -286,7 +286,7 @@ function snmp_browser_get_tree(
|
|||
break;
|
||||
|
||||
default:
|
||||
$snmp_version = SNMP::VERSION_2c;
|
||||
$snmp_version = SNMP::VERSION_2C;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -421,6 +421,10 @@ function snmp_browser_get_oid(
|
|||
return;
|
||||
}
|
||||
|
||||
if ($version == '2') {
|
||||
$version = '2c';
|
||||
}
|
||||
|
||||
$output = get_snmpwalk(
|
||||
$target_ip,
|
||||
$version,
|
||||
|
|
|
@ -19,7 +19,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
|
|||
$server_name = '';
|
||||
$server_id = '';
|
||||
$url_hash = '';
|
||||
$console_url = '';
|
||||
$console_url = ui_get_full_url('/');
|
||||
} else {
|
||||
$server_name = $server_data['server_name'];
|
||||
$server_id = $server_data['id'];
|
||||
|
@ -500,7 +500,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
|
|||
$server_name = '';
|
||||
$server_id = '';
|
||||
$url_hash = '';
|
||||
$console_url = '';
|
||||
$console_url = ui_get_full_url('/');
|
||||
} else {
|
||||
$server_name = $server_data['server_name'];
|
||||
$server_id = $server_data['id'];
|
||||
|
@ -567,7 +567,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
|
|||
$table->head = [];
|
||||
$table->data = [];
|
||||
|
||||
// Agent name
|
||||
// Agent name.
|
||||
if ($agent['disabled']) {
|
||||
$cellName = '<em>';
|
||||
} else {
|
||||
|
@ -576,10 +576,10 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
|
|||
|
||||
if (is_metaconsole()) {
|
||||
$pwd = $server_data['auth_token'];
|
||||
// Create HASH login info
|
||||
// Create HASH login info.
|
||||
$user = $config['id_user'];
|
||||
|
||||
// Extract auth token from serialized field
|
||||
// Extract auth token from serialized field.
|
||||
$pwd_deserialiced = json_decode($pwd, true);
|
||||
$hashdata = $user.$pwd_deserialiced['auth_token'];
|
||||
|
||||
|
@ -588,7 +588,11 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
|
|||
|
||||
$cellName .= '<a href="'.$url.'">'.'<b><span style="font-weight:bold;text-transform:uppercase;" title="'.$agent['nombre'].'">'.$agent['alias'].'</span></b></a>';
|
||||
} else {
|
||||
$cellName .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'">'.'<b><span style="font-weight:bold;text-transform:uppercase;" title="'.$agent['nombre'].'">'.$agent['alias'].'</span></b></a>';
|
||||
$url = ui_get_full_url(
|
||||
'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente']
|
||||
);
|
||||
$cellName .= '<a href="'.$url.'">';
|
||||
$cellName .= '<b><span style="font-weight:bold;text-transform:uppercase;" title="'.$agent['nombre'].'">'.$agent['alias'].'</span></b></a>';
|
||||
}
|
||||
|
||||
if ($agent['disabled']) {
|
||||
|
@ -600,7 +604,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
|
|||
$row['data'] = $cellName;
|
||||
$table->data['name'] = $row;
|
||||
|
||||
// Addresses
|
||||
// Addresses.
|
||||
$ips = [];
|
||||
$addresses = agents_get_addresses($id_agente);
|
||||
$address = agents_get_address($id_agente);
|
||||
|
@ -611,8 +615,11 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($addresses)) {
|
||||
$address .= ui_print_help_tip(__('Other IP addresses').': <br>'.implode('<br>', $addresses), true);
|
||||
if (empty($addresses) === false) {
|
||||
$address .= ui_print_help_tip(
|
||||
__('Other IP addresses').': <br>'.implode('<br>', $addresses),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$row = [];
|
||||
|
@ -620,25 +627,27 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
|
|||
$row['data'] = $address;
|
||||
$table->data['address'] = $row;
|
||||
|
||||
// Agent Interval
|
||||
// Agent Interval.
|
||||
$row = [];
|
||||
$row['title'] = __('Interval');
|
||||
$row['data'] = human_time_description_raw($agent['intervalo']);
|
||||
$table->data['interval'] = $row;
|
||||
|
||||
// Comments
|
||||
// Comments.
|
||||
$row = [];
|
||||
$row['title'] = __('Description');
|
||||
$row['data'] = $agent['comentarios'];
|
||||
$table->data['description'] = $row;
|
||||
|
||||
// Last contact
|
||||
// Last contact.
|
||||
$last_contact = ui_print_timestamp($agent['ultimo_contacto'], true);
|
||||
|
||||
if ($agent['ultimo_contacto_remoto'] == '01-01-1970 00:00:00') {
|
||||
$last_remote_contact = __('Never');
|
||||
} else {
|
||||
$last_remote_contact = date_w_fixed_tz($agent['ultimo_contacto_remoto']);
|
||||
$last_remote_contact = date_w_fixed_tz(
|
||||
$agent['ultimo_contacto_remoto']
|
||||
);
|
||||
}
|
||||
|
||||
$row = [];
|
||||
|
@ -646,7 +655,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
|
|||
$row['data'] = "$last_contact / $last_remote_contact";
|
||||
$table->data['contact'] = $row;
|
||||
|
||||
// Next contact (agent)
|
||||
// Next contact (agent).
|
||||
$progress = agents_get_next_contact($id_agente);
|
||||
|
||||
$row = [];
|
||||
|
@ -660,7 +669,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
|
|||
);
|
||||
$table->data['next_contact'] = $row;
|
||||
|
||||
// End of table
|
||||
// End of table.
|
||||
$agent_table = html_print_table($table, true);
|
||||
|
||||
if ($user_access_node && check_acl($config['id_user'], $agent['id_grupo'], 'AW')) {
|
||||
|
|
|
@ -541,8 +541,9 @@ function ui_print_timestamp($unixtime, $return=false, $option=[])
|
|||
pandora_setlocale();
|
||||
|
||||
$title = human_time_comparation($unixtime);
|
||||
$strf_format = date2strftime_format($config['date_format'], $unixtime);
|
||||
$data = strftime(
|
||||
date2strftime_format($config['date_format']),
|
||||
$strf_format,
|
||||
$unixtime
|
||||
);
|
||||
} else if ($prominent == 'compact') {
|
||||
|
@ -1708,9 +1709,8 @@ function ui_process_page_head($string, $bitfield)
|
|||
<meta name="author" content="'.get_copyright_notice().'" />
|
||||
<meta name="copyright" content="(c) '.get_copyright_notice().'" />
|
||||
<meta name="robots" content="index, follow" />';
|
||||
$output .= '<link rel="icon" href="'.ui_get_favicon().'" type="image/ico" />';
|
||||
$output .= '
|
||||
<link rel="shortcut icon" href="'.ui_get_favicon().'" type="image/x-icon" />
|
||||
$output .= '<link rel="icon" href="'.ui_get_full_url('/').ui_get_favicon().'" type="image/ico" />';
|
||||
$output .= '<link rel="shortcut icon" href="'.ui_get_full_url('/').ui_get_favicon().'" type="image/x-icon" />
|
||||
<link rel="alternate" href="operation/events/events_rss.php" title="Pandora RSS Feed" type="application/rss+xml" />';
|
||||
|
||||
if ($config['language'] != 'en') {
|
||||
|
|
|
@ -54,6 +54,25 @@ function update_manager_verify_registration()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a trial license is in use.
|
||||
*
|
||||
* @return boolean true if a trial license is in use, false otherwise.
|
||||
*/
|
||||
function update_manager_verify_trial()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($config['license_licensed_to'])
|
||||
&& strstr($config['license_licensed_to'], 'info@pandorafms.com') !== false
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parses responses from configuration wizard.
|
||||
*
|
||||
|
@ -440,6 +459,11 @@ function registration_wiz_modal(
|
|||
global $config;
|
||||
$output = '';
|
||||
|
||||
// Do not show the wizard for trial licenses.
|
||||
if (update_manager_verify_trial()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$product_name = get_product_name();
|
||||
|
||||
$output .= '<div id="registration_wizard" title="';
|
||||
|
@ -1819,9 +1843,15 @@ function update_manager_recurse_copy($src, $dst, $black_list)
|
|||
while (false !== ( $file = readdir($dir))) {
|
||||
if (( $file != '.' ) && ( $file != '..' ) && (!in_array($file, $black_list))) {
|
||||
if (is_dir($src.'/'.$file)) {
|
||||
$dir_dst = $dst;
|
||||
|
||||
if ($file != 'pandora_console') {
|
||||
$dir_dst .= '/'.$file;
|
||||
}
|
||||
|
||||
if (!update_manager_recurse_copy(
|
||||
$src.'/'.$file,
|
||||
$dst.'/'.$file,
|
||||
$dir_dst,
|
||||
$black_list
|
||||
)
|
||||
) {
|
||||
|
|
|
@ -668,3 +668,109 @@ function get_name_admin():string
|
|||
|
||||
return $mail;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene una matriz con los grupos como clave y si tiene o no permiso UM sobre ese grupo(valor)
|
||||
*
|
||||
* @param string User id
|
||||
* @return array Return .
|
||||
*/
|
||||
function users_get_groups_UM($id_user)
|
||||
{
|
||||
$sql = sprintf(
|
||||
"SELECT id_grupo, user_management FROM tusuario_perfil
|
||||
LEFT JOIN tperfil ON tperfil.id_perfil = tusuario_perfil.id_perfil
|
||||
WHERE id_usuario like '%s' AND user_management = 1 ORDER BY id_grupo",
|
||||
$id_user
|
||||
);
|
||||
|
||||
$groups = db_get_all_rows_sql($sql);
|
||||
$return = [];
|
||||
foreach ($groups as $key => $group) {
|
||||
if (!isset($return[$group['id_grupo']]) || (isset($return[$group['id_grupo']]) && $group['user_management'] != 0)) {
|
||||
$return[$group['id_grupo']] = $group['user_management'];
|
||||
if ($group['id_grupo'] == '0') {
|
||||
$return['group_all'] = $group['id_grupo'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene una matriz con los grupos como clave y si tiene o no permiso UM sobre ese grupo(valor)
|
||||
*
|
||||
* @param string User id
|
||||
* @return array Return .
|
||||
*/
|
||||
function users_get_users_by_group($id_group, $um=false)
|
||||
{
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.* FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo = '%s'",
|
||||
$id_group
|
||||
);
|
||||
|
||||
$users = db_get_all_rows_sql($sql);
|
||||
$return = [];
|
||||
foreach ($users as $key => $user) {
|
||||
$return[$user['id_user']] = $user;
|
||||
$return[$user['id_user']]['edit'] = $um;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
function users_has_profile_without_UM($id_user, $id_groups)
|
||||
{
|
||||
$sql = sprintf(
|
||||
"SELECT id_usuario, tperfil.user_management FROM tusuario_perfil
|
||||
INNER JOIN tperfil ON tperfil.id_perfil = tusuario_perfil.id_perfil AND tperfil.user_management = 0
|
||||
WHERE tusuario_perfil.id_usuario like '%s' AND tusuario_perfil.id_grupo IN (%s)
|
||||
ORDER BY tperfil.user_management DESC",
|
||||
$id_user,
|
||||
$id_groups
|
||||
);
|
||||
|
||||
$without_um = db_get_all_rows_sql($sql);
|
||||
|
||||
if (isset($without_um[0])) {
|
||||
$sql = sprintf(
|
||||
"SELECT id_grupo, tperfil.* FROM tusuario_perfil
|
||||
INNER JOIN tperfil ON tperfil.id_perfil = tusuario_perfil.id_perfil
|
||||
WHERE tusuario_perfil.id_usuario like '%s'
|
||||
ORDER BY tperfil.user_management DESC",
|
||||
$id_user
|
||||
);
|
||||
|
||||
$um = db_get_all_rows_sql($sql);
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function users_get_user_profile($id_user)
|
||||
{
|
||||
$sql = sprintf(
|
||||
"SELECT * FROM tusuario_perfil
|
||||
INNER JOIN tperfil ON tperfil.id_perfil = tusuario_perfil.id_perfil
|
||||
WHERE tusuario_perfil.id_usuario like '%s'",
|
||||
$id_user
|
||||
);
|
||||
|
||||
$aux = db_get_all_rows_sql($sql);
|
||||
$user_profiles = [];
|
||||
foreach ($aux as $key => $value) {
|
||||
$user_profiles[$value['id_grupo']] = $value;
|
||||
}
|
||||
|
||||
return $user_profiles;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ if ($file === '' || $hash === '' || $hash !== md5($file_raw.$config['dbpass']) |
|
|||
if ($parse_sec2_query[0] === 'sec2') {
|
||||
switch ($parse_sec2_query[1]) {
|
||||
case $main_file_manager:
|
||||
case 'operation/snmpconsole/snmp_mib_uploader':
|
||||
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/'.$file;
|
||||
break;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
global $config;
|
||||
|
||||
|
||||
function include_javascript_dependencies_flot_graph($return=false)
|
||||
function include_javascript_dependencies_flot_graph($return=false, $mobile=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
@ -28,8 +28,16 @@ function include_javascript_dependencies_flot_graph($return=false)
|
|||
$metaconsole_hack = '../../';
|
||||
}
|
||||
|
||||
$output = '';
|
||||
|
||||
if ($mobile === true) {
|
||||
$output .= '
|
||||
<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/mobile/include/javascript/jquery.js').'"></script>
|
||||
<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/mobile/include/javascript/jquery.mobile-1.3.1.js').'"></script>';
|
||||
}
|
||||
|
||||
// NOTE: jquery.flot.threshold is not te original file. Is patched to allow multiple thresholds and filled area
|
||||
$output = '
|
||||
$output .= '
|
||||
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/include/graphs/flot/excanvas.js').'"></script><![endif]-->
|
||||
<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/include/graphs/flot/jquery.flot.js').'"></script>
|
||||
<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/include/graphs/flot/jquery.flot.min.js').'"></script>
|
||||
|
|
|
@ -1952,7 +1952,15 @@ function isReachable(url) {
|
|||
* Gets server origin url
|
||||
*/
|
||||
function getServerUrl() {
|
||||
return $("#php_to_js_value_absolute_homeurl").val() || window.location.origin;
|
||||
var server_url;
|
||||
|
||||
try {
|
||||
server_url = get_php_value("homeurl");
|
||||
} catch (SyntaxError) {
|
||||
console.warn("Pandora homeurl cannot be found.");
|
||||
server_url = window.location.origin + "/pandora_console";
|
||||
}
|
||||
return server_url;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -86,11 +86,14 @@ function initialiceLayout(data) {
|
|||
data: {
|
||||
page: data.page,
|
||||
method: "getCellsLayout",
|
||||
dashboardId: data.dashboardId
|
||||
dashboardId: data.dashboardId,
|
||||
auth_class: data.auth.class,
|
||||
auth_hash: data.auth.hash,
|
||||
id_user: data.auth.user
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
loadLayout(data);
|
||||
success: function(d) {
|
||||
loadLayout(d);
|
||||
},
|
||||
error: function(error) {
|
||||
console.error(error);
|
||||
|
@ -136,7 +139,8 @@ function initialiceLayout(data) {
|
|||
position.maxWidth,
|
||||
position.minHeight,
|
||||
position.maxHeight,
|
||||
widgetId
|
||||
widgetId,
|
||||
false
|
||||
);
|
||||
});
|
||||
// Commit.
|
||||
|
@ -167,7 +171,10 @@ function initialiceLayout(data) {
|
|||
dashboardId: data.dashboardId,
|
||||
cellId: id,
|
||||
widgetId: widgetId,
|
||||
gridWidth: gridWidth
|
||||
gridWidth: gridWidth,
|
||||
auth_class: data.auth.class,
|
||||
auth_hash: data.auth.hash,
|
||||
id_user: data.auth.user
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(cellData) {
|
||||
|
@ -205,7 +212,10 @@ function initialiceLayout(data) {
|
|||
widgetId: widgetId,
|
||||
newWidth: newWidth,
|
||||
newHeight: newHeight,
|
||||
gridWidth: gridWidth
|
||||
gridWidth: gridWidth,
|
||||
auth_class: data.auth.class,
|
||||
auth_hash: data.auth.hash,
|
||||
id_user: data.auth.user
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(widgetData) {
|
||||
|
@ -291,7 +301,10 @@ function initialiceLayout(data) {
|
|||
page: data.page,
|
||||
method: "saveLayout",
|
||||
dashboardId: data.dashboardId,
|
||||
items: items
|
||||
items: items,
|
||||
auth_class: data.auth.class,
|
||||
auth_hash: data.auth.hash,
|
||||
id_user: data.auth.user
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
|
@ -313,11 +326,14 @@ function initialiceLayout(data) {
|
|||
page: data.page,
|
||||
dashboardId: data.dashboardId,
|
||||
method: "deleteCell",
|
||||
cellId: cellId
|
||||
cellId: cellId,
|
||||
auth_class: data.auth.class,
|
||||
auth_hash: data.auth.hash,
|
||||
id_user: data.auth.user
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
// For defect x and y = 0
|
||||
// By default x and y = 0
|
||||
// width and height = 4
|
||||
// position auto = true.
|
||||
if (data.result !== 0) {
|
||||
|
@ -338,11 +354,14 @@ function initialiceLayout(data) {
|
|||
data: {
|
||||
page: data.page,
|
||||
method: "insertCellLayout",
|
||||
dashboardId: data.dashboardId
|
||||
dashboardId: data.dashboardId,
|
||||
auth_class: data.auth.class,
|
||||
auth_hash: data.auth.hash,
|
||||
id_user: data.auth.user
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
// For defect x and y = 0
|
||||
// By default x and y = 0
|
||||
// width and height = 4
|
||||
// position auto = true.
|
||||
if (data.cellId !== 0) {
|
||||
|
@ -373,7 +392,7 @@ function initialiceLayout(data) {
|
|||
dashboardId: data.dashboardId,
|
||||
widgetId: widgetId
|
||||
},
|
||||
width: 450,
|
||||
width: widgetId == 14 ? 750 : 450,
|
||||
maxHeight: 600,
|
||||
minHeight: 400
|
||||
},
|
||||
|
@ -536,7 +555,10 @@ function initialiceLayout(data) {
|
|||
method: "drawAddWidget",
|
||||
cellId: cellId,
|
||||
offset: offset,
|
||||
search: search
|
||||
search: search,
|
||||
auth_class: data.auth.class,
|
||||
auth_hash: data.auth.hash,
|
||||
id_user: data.auth.user
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
|
@ -606,7 +628,10 @@ function initialiceLayout(data) {
|
|||
cellId: cellId,
|
||||
widgetId: widgetId,
|
||||
gridWidth: gridWidth,
|
||||
redraw: true
|
||||
redraw: true,
|
||||
auth_class: data.auth.class,
|
||||
auth_hash: data.auth.hash,
|
||||
id_user: data.auth.user
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(cellData) {
|
||||
|
@ -633,7 +658,10 @@ function initialiceLayout(data) {
|
|||
newWidth: newWidth,
|
||||
newHeight: newHeight,
|
||||
gridWidth: gridWidth,
|
||||
widgetId: widgetId
|
||||
widgetId: widgetId,
|
||||
auth_class: data.auth.class,
|
||||
auth_hash: data.auth.hash,
|
||||
id_user: data.auth.user
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(dataWidget) {
|
||||
|
@ -755,8 +783,9 @@ function dashboardLoadNetworkMap(settings) {
|
|||
x_offset: settings.x_offset,
|
||||
y_offset: settings.y_offset,
|
||||
zoom_dash: settings.zoom_dash,
|
||||
id_user: settings.id_user,
|
||||
hash: settings.hash
|
||||
auth_class: settings.auth_class,
|
||||
auth_hash: settings.auth_hash,
|
||||
id_user: settings.id_user
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
|
@ -784,6 +813,8 @@ function dashboardLoadWuxStats(settings) {
|
|||
id_agent: settings.id_agent,
|
||||
transaction: settings.transaction,
|
||||
view_all_stats: settings.view_all_stats,
|
||||
auth_class: settings.auth_class,
|
||||
auth_hash: settings.auth_hash,
|
||||
id_user: settings.id_user
|
||||
},
|
||||
dataType: "html",
|
||||
|
@ -821,9 +852,10 @@ function processTreeSearch(settings) {
|
|||
data: {
|
||||
getChildren: 1,
|
||||
page: settings.page,
|
||||
id_user: settings.user,
|
||||
hash: settings.hash,
|
||||
type: settings.type,
|
||||
auth_class: settings.auth_class,
|
||||
auth_hash: settings.auth_hash,
|
||||
id_user: settings.id_user,
|
||||
filter: filters
|
||||
},
|
||||
success: function(data) {
|
||||
|
@ -858,8 +890,11 @@ function processTreeSearch(settings) {
|
|||
emptyMessage: settings.translate.emptyMessage,
|
||||
foundMessage: settings.translate.foundMessage,
|
||||
tree: data.tree,
|
||||
baseURL: settings.baseURL,
|
||||
auth_hash: settings.auth_hash,
|
||||
auth_class: settings.auth_class,
|
||||
id_user: settings.id_user,
|
||||
ajaxURL: settings.ajaxUrl,
|
||||
baseURL: settings.baseUrl,
|
||||
filter: filters,
|
||||
counterTitles: {
|
||||
total: {
|
||||
|
|
|
@ -135,7 +135,7 @@ function show_response_dialog(response_id, response) {
|
|||
params.push("dialogue_event_response=1");
|
||||
params.push("massive=0");
|
||||
params.push("event_id=" + response["event_id"]);
|
||||
params.push("target=" + response["target"]);
|
||||
params.push("target=" + encodeURIComponent(response["target"]));
|
||||
params.push("response_id=" + response_id);
|
||||
params.push("server_id=" + response["server_id"]);
|
||||
|
||||
|
@ -363,8 +363,17 @@ function get_response_target(
|
|||
if (response_params.length > 1 || response_params[0] != "") {
|
||||
for (var i = 0; i < response_params.length; i++) {
|
||||
if (!response_command) {
|
||||
var response_param = "_" + response_params[i] + "_";
|
||||
|
||||
if (
|
||||
response_params[i].startsWith("_") &&
|
||||
response_params[i].endsWith("_")
|
||||
) {
|
||||
response_param = response_params[i];
|
||||
}
|
||||
|
||||
target = target.replace(
|
||||
"_" + response_params[i] + "_",
|
||||
response_param,
|
||||
$("#" + response_params[i]).val()
|
||||
);
|
||||
} else {
|
||||
|
@ -388,7 +397,7 @@ function perform_response(response, response_id) {
|
|||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("perform_event_response=1");
|
||||
params.push("target=" + response["target"]);
|
||||
params.push("target=" + encodeURIComponent(response["target"]));
|
||||
params.push("response_id=" + response_id);
|
||||
params.push("event_id=" + response["event_id"]);
|
||||
params.push("server_id=" + response["server_id"]);
|
||||
|
|
|
@ -450,7 +450,10 @@ var TreeController = {
|
|||
var postData = {
|
||||
page: controller.ajaxPage,
|
||||
getDetail: 1,
|
||||
type: type
|
||||
type: type,
|
||||
auth_class: controller.auth_class,
|
||||
id_user: controller.id_user,
|
||||
auth_hash: controller.auth_hash
|
||||
};
|
||||
|
||||
if (typeof id !== "undefined") postData.id = id;
|
||||
|
@ -970,11 +973,6 @@ var TreeController = {
|
|||
});
|
||||
}
|
||||
}
|
||||
// Get hash and user.
|
||||
var public_hash = $("#hidden-publi_dash_tree_view_hash").val();
|
||||
if (typeof public_hash === "undefined") public_hash = 0;
|
||||
var public_user = $("#hidden-publi_dash_tree_view_id_user").val();
|
||||
if (typeof public_user === "undefined") public_user = 0;
|
||||
|
||||
if (
|
||||
typeof element.searchChildren != "undefined" &&
|
||||
|
@ -1014,8 +1012,9 @@ var TreeController = {
|
|||
rootType: element.rootType,
|
||||
metaID: element.metaID,
|
||||
filter: controller.filter,
|
||||
hash: public_hash,
|
||||
id_user: public_user
|
||||
auth_class: controller.auth_class,
|
||||
id_user: controller.id_user,
|
||||
auth_hash: controller.auth_hash
|
||||
},
|
||||
complete: function(xhr, textStatus) {
|
||||
$node.removeClass("leaf-loading");
|
||||
|
@ -1150,6 +1149,16 @@ var TreeController = {
|
|||
this.filter = data.filter;
|
||||
}
|
||||
|
||||
if (typeof data.auth_class !== "undefined") {
|
||||
this.auth_class = data.auth_class;
|
||||
}
|
||||
if (typeof data.id_user !== "undefined") {
|
||||
this.id_user = data.id_user;
|
||||
}
|
||||
if (typeof data.auth_hash !== "undefined") {
|
||||
this.auth_hash = data.auth_hash;
|
||||
}
|
||||
|
||||
this.load();
|
||||
},
|
||||
remove: function() {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue