Merge branch 'develop' into '1058-rework-elements-labels-in-service-map-dev'

# Conflicts:
#   pandora_console/include/styles/pandora.css
This commit is contained in:
artu30 2017-08-31 08:19:00 +02:00
commit 914f09c559
131 changed files with 2843 additions and 885 deletions

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707, AIX version # Version 7.0NG.711, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707, FreeBSD Version # Version 7.0NG.711, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707, HP-UX Version # Version 7.0NG.711, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707, GNU/Linux # Version 7.0NG.711, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707, GNU/Linux # Version 7.0NG.711, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707, Solaris Version # Version 7.0NG.711, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas # (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.707 # Version 7.0NG.711
# This program is Free Software, you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.707, AIX version # Version 7.0NG.711, AIX version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.707 # Version 7.0NG.711
# FreeBSD/IPSO version # FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena # Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.707, HPUX Version # Version 7.0NG.711, HPUX Version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707 # Version 7.0NG.711
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas # (c) 2003-2010 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707 # Version 7.0NG.711
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas # (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707 # Version 7.0NG.711
# Licensed under GPL license v2, # Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.707, Solaris version # Version 7.0NG.711, Solaris version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707, AIX version # Version 7.0NG.711, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.707-170719 Version: 7.0NG.711-170831
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707, GNU/Linux # Version 7.0NG.711, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas # Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707, FreeBSD Version # Version 7.0NG.711, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas # Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707, HP-UX Version # Version 7.0NG.711, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707, GNU/Linux # Version 7.0NG.711, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas # Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707, GNU/Linux # Version 7.0NG.711, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707, NetBSD Version # Version 7.0NG.711, NetBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.707, Solaris Version # Version 7.0NG.711, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -40,8 +40,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.707'; use constant AGENT_VERSION => '7.0NG.711';
use constant AGENT_BUILD => '170719'; use constant AGENT_BUILD => '170831';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -906,14 +906,13 @@ sub fix_directory ($) {
################################################################################ ################################################################################
# Sends a file to the server. # Sends a file to the server.
################################################################################ ################################################################################
#sub send_file ($;$) { #sub send_file ($;$$$) {
sub send_file { sub send_file {
my ($file, $secondary) = @_; my ($file, $secondary, $rc_primary, $flag_always) = @_;
my $output; my $output;
my $pid = fork(); my $pid = fork();
return 1 unless defined $pid; return 1 unless defined $pid;
if ($pid == 0) { if ($pid == 0) {
# execute the transfer program by child process. # execute the transfer program by child process.
eval { eval {
@ -942,14 +941,14 @@ sub send_file {
}; };
if ($@) { if ($@) {
log_message ('error', "Error sending file '$file': File transfer command is not responding."); log_message ('error', "Error sending file '$file' to '" . $Conf{'server_ip'} . ":" . $Conf{'server_port'}. "': File transfer command is not responding.");
exit 1; exit 1;
} }
# Get the errorlevel # Get the errorlevel
my $rc = $? >> 8; my $rc = $? >> 8;
if ($rc != 0) { if ($rc != 0) {
log_message ('error', "Error sending file '$file': $output"); log_message ('error', "Error sending file '$file' to '" . $Conf{'server_ip'} . ":" . $Conf{'server_port'}. "': $output");
} }
exit $rc; exit $rc;
} }
@ -958,39 +957,104 @@ sub send_file {
waitpid ($pid, 0); waitpid ($pid, 0);
my $rc = $? >> 8; my $rc = $? >> 8;
return $rc unless (defined ($secondary)); if( ($Conf{'secondary_mode'} eq 'always') && ( !defined($flag_always) ) ){
# Send the file to the secondary server
return $rc unless ($Conf{'secondary_mode'} eq 'always');
if(defined ($secondary)){
if( ($rc != 0 && ($file =~ /\.data/)) ){
$rc_primary = 1;
}
swap_servers ();
$rc = send_file ($file, undef, $rc_primary);
swap_servers ();
# Send the file to the secondary server return $rc;
return $rc unless ($Conf{'secondary_mode'} eq 'always' || ($Conf{'secondary_mode'} eq 'on_error' && $rc != 0)); }
else{
swap_servers (); my $rc_secondary = 0;
$rc = send_file ($file); if( ($rc != 0) && ($file =~ /\.data/)){
swap_servers (); $rc_secondary = 1;
return $rc; }
if ( $rc_secondary == 1 && defined($rc_primary) ){
return 1;
}
if ( $rc_secondary == 1 ){
if (! -d "$Conf{'temporal'}/secondary"){
mkdir "$Conf{'temporal'}/secondary";
}
eval {
copy("$file", "$Conf{'temporal'}/secondary/");
};
if ($@) {
# We shouldn't reach this point...
die ("Cannot write on $Conf{'temporal'}/secondary/");
}
return 0;
}
if ( defined($rc_primary) ){
if (! -d "$Conf{'temporal'}/primary"){
mkdir "$Conf{'temporal'}/primary";
}
eval {
copy("$file", "$Conf{'temporal'}/primary/");
};
if ($@) {
# We shouldn't reach this point...
die ("Cannot write on $Conf{'temporal'}/primary/");
}
return 0;
}
if ( $rc_secondary == 0 && !defined($rc_primary) ){
return 0;
}
}
}
elsif ( ($Conf{'secondary_mode'} eq 'always') && defined($flag_always) ){
return $rc;
}
else{
return $rc unless (defined ($secondary));
# Send the file to the secondary server
return $rc unless ($Conf{'secondary_mode'} eq 'always' || ($Conf{'secondary_mode'} eq 'on_error' && $rc != 0));
swap_servers ();
$rc = send_file ($file);
swap_servers ();
return $rc;
}
} }
################################################################################ ################################################################################
# Send buffered XML files. # Send buffered XML files.
################################################################################ ################################################################################
sub send_buffered_xml_files () { sub send_buffered_xml_files ($;$) {
my ($temporal_file, $flag_always) = @_;
# Read XML files from the temporal directory # Read XML files from the temporal directory
opendir(TEMPORAL, $Conf{'temporal'}) or return; opendir(TEMPORAL, $temporal_file) or return;
while (my $xml_file = readdir(TEMPORAL)) { if (defined($flag_always) && ($flag_always == 2)){
swap_servers ();
}
while (my $xml_file = readdir(TEMPORAL)) {
# Skip non data files and symlinks # Skip non data files and symlinks
next if ($xml_file !~ m/^$Conf{'agent_name'}\.[0-9]+\.data$/ || -l "$Conf{'temporal'}/$xml_file"); next if ($xml_file !~ m/^$Conf{'agent_name'}\.[0-9]+\.data$/ || -l "$temporal_file/$xml_file");
my $rc = send_file ("$temporal_file/$xml_file", 1, undef, $flag_always);
my $rc = send_file ("$Conf{'temporal'}/$xml_file", 1);
if ($rc == 0) { if ($rc == 0) {
if ($Conf{'debug'} eq '1') { if ($Conf{'debug'} eq '1') {
rename "$Conf{'temporal'}/$xml_file", "$Conf{'temporal'}/$xml_file". "sent"; rename "$temporal_file/$xml_file", "$temporal_file/$xml_file". "sent";
} else { } else {
unlink ("$Conf{'temporal'}/$xml_file"); unlink ("$temporal_file/$xml_file");
} }
} }
} }
if (defined($flag_always) && ($flag_always == 2)){
swap_servers ();
}
} }
################################################################################ ################################################################################
@ -2769,7 +2833,20 @@ while (1) {
# Send buffered XML data files # Send buffered XML data files
if ($Conf{'xml_buffer'} == 1) { if ($Conf{'xml_buffer'} == 1) {
send_buffered_xml_files (); if($Conf{'secondary_mode'} eq 'always'){
$Conf{'__temporal_primary'} = "$Conf{'temporal'}/primary";
$Conf{'__temporal_secondary'} = "$Conf{'temporal'}/secondary";
if (-d "$Conf{'__temporal_primary'}"){
send_buffered_xml_files ($Conf{'__temporal_primary'}, 1);
}
if (-d "$Conf{'__temporal_secondary'}"){
send_buffered_xml_files ($Conf{'__temporal_secondary'}, 2);
}
send_buffered_xml_files ($Conf{'temporal'});
}
else{
send_buffered_xml_files ($Conf{'temporal'});
}
} }
} }

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.707 %define version 7.0NG.711
%define release 170719 %define release 170831
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.707 %define version 7.0NG.711
%define release 170719 %define release 170831
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. # Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.707" PI_VERSION="7.0NG.711"
PI_BUILD="170719" PI_BUILD="170831"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2014 Artica Soluciones Tecnologicas # (c) 2006-2014 Artica Soluciones Tecnologicas
# Version 7.0NG.707 # Version 7.0NG.711
# This program is Free Software, you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes} {Yes}
AppName AppName
{Pandora FMS Windows Agent v7.0NG.707} {Pandora FMS Windows Agent v7.0NG.711}
ApplicationID ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F} {17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{170719} {170831}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.707(Build 170719)") #define PANDORA_VERSION ("7.0NG.711(Build 170831)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.707(Build 170719))" VALUE "ProductVersion", "(7.0NG.711(Build 170831))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.707-170719 Version: 7.0NG.711-170831
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.707-170719" pandora_version="7.0NG.711-170831"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -528,24 +528,24 @@ function mainAgentsModules() {
echo '<a href="javascript:'.$link.'">'; echo '<a href="javascript:'.$link.'">';
switch ($status) { switch ($status) {
case AGENT_MODULE_STATUS_NORMAL: case AGENT_MODULE_STATUS_NORMAL:
ui_print_status_image ('module_ok.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); ui_print_status_image ('module_ok.png', modules_get_last_value($module_id), false);
break; break;
case AGENT_MODULE_STATUS_CRITICAL_BAD: case AGENT_MODULE_STATUS_CRITICAL_BAD:
ui_print_status_image ('module_critical.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); ui_print_status_image ('module_critical.png', modules_get_last_value($module_id), false);
break; break;
case AGENT_MODULE_STATUS_WARNING: case AGENT_MODULE_STATUS_WARNING:
ui_print_status_image ('module_warning.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); ui_print_status_image ('module_warning.png', modules_get_last_value($module_id), false);
break; break;
case AGENT_MODULE_STATUS_UNKNOWN: case AGENT_MODULE_STATUS_UNKNOWN:
ui_print_status_image ('module_unknown.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); ui_print_status_image ('module_unknown.png', modules_get_last_value($module_id), false);
break; break;
case AGENT_MODULE_STATUS_NORMAL_ALERT: case AGENT_MODULE_STATUS_NORMAL_ALERT:
case AGENT_MODULE_STATUS_WARNING_ALERT: case AGENT_MODULE_STATUS_WARNING_ALERT:
case AGENT_MODULE_STATUS_CRITICAL_ALERT: case AGENT_MODULE_STATUS_CRITICAL_ALERT:
ui_print_status_image ('module_alertsfired.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); ui_print_status_image ('module_alertsfired.png', modules_get_last_value($module_id), false);
break; break;
case 4: case 4:
ui_print_status_image ('module_no_data.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); ui_print_status_image ('module_no_data.png', modules_get_last_value($module_id), false);
break; break;
} }
echo '</a>'; echo '</a>';

View File

@ -167,6 +167,7 @@ function mainInsertData() {
$params['use_hidden_input_idagent'] = true; $params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true; $params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent'; $params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent';
$params['hidden_input_idagent_value'] = $id_agente;
$table->data[0][1] = ui_print_agent_autocomplete_input($params); $table->data[0][1] = ui_print_agent_autocomplete_input($params);

View File

@ -0,0 +1,15 @@
START TRANSACTION;
SET @st_oum707 = (SELECT IF(
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tgraph_source' AND table_schema = DATABASE() AND column_name = 'id_server') > 0,
"SELECT 1",
"ALTER TABLE tgraph_source ADD COLUMN id_server int(11) UNSIGNED NOT NULL default 0"
));
PREPARE pr_oum707 FROM @st_oum707;
EXECUTE pr_oum707;
DEALLOCATE PREPARE pr_oum707;
ALTER TABLE tserver_export_data MODIFY `module_name` varchar(600) BINARY NOT NULL default '';
COMMIT;

View File

@ -0,0 +1,5 @@
START TRANSACTION;
ALTER TABLE tagente MODIFY COLUMN `cascade_protection_module` int(10) unsigned NOT NULL default '0';
COMMIT;

View File

@ -1215,7 +1215,7 @@ ALTER TABLE tnetwork_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsign
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tagente ADD `transactional_agent` tinyint(1) NOT NULL default 0; ALTER TABLE tagente ADD `transactional_agent` tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD `remote` tinyint(1) NOT NULL default 0; ALTER TABLE tagente ADD `remote` tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD `cascade_protection_module` int(10) unsigned default '0'; ALTER TABLE tagente ADD COLUMN `cascade_protection_module` int(10) unsigned NOT NULL default '0';
ALTER TABLE tagente ADD COLUMN (alias varchar(600) not null default ''); ALTER TABLE tagente ADD COLUMN (alias varchar(600) not null default '');
ALTER TABLE tagente ADD `alias_as_name` int(2) unsigned default '0'; ALTER TABLE tagente ADD `alias_as_name` int(2) unsigned default '0';
@ -1327,6 +1327,7 @@ IF @vv1>0 THEN
END IF; END IF;
END; END;
// //
delimiter ;
CALL addcol(); CALL addcol();
DROP PROCEDURE addcol; DROP PROCEDURE addcol;
@ -1351,6 +1352,17 @@ CREATE TABLE IF NOT EXISTS `tcontainer` (
INSERT INTO `tcontainer` SET `name` = 'Default graph container'; INSERT INTO `tcontainer` SET `name` = 'Default graph container';
-- ----------------------------------------------------------------------
-- Table `treset_pass_history`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `treset_pass_history` (
`id` int(10) unsigned NOT NULL auto_increment,
`id_user` varchar(60) NOT NULL,
`reset_moment` datetime NOT NULL,
`success` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tcontainer_item` -- Table `tcontainer_item`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1391,4 +1403,26 @@ ALTER TABLE tpolicy_modules MODIFY post_process double(24,15) default 0;
-- Table `tserver_export` -- Table `tserver_export`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tserver_export MODIFY `name` varchar(600) BINARY NOT NULL default ''; ALTER TABLE tserver_export MODIFY `name` varchar(600) BINARY NOT NULL default '';
-- ---------------------------------------------------------------------
-- Table `tgraph_source` column 'id_server'
-- ---------------------------------------------------------------------
ALTER TABLE tgraph_source ADD COLUMN id_server int(11) UNSIGNED NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `tserver_export_data`
-- ---------------------------------------------------------------------
ALTER TABLE tserver_export_data MODIFY `module_name` varchar(600) BINARY NOT NULL default '';
-- ---------------------------------------------------------------------
-- Table `tserver`
-- ---------------------------------------------------------------------
ALTER TABLE tserver ADD COLUMN exec_proxy tinyint(1) UNSIGNED NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `tevent_response`
-- ---------------------------------------------------------------------
ALTER TABLE tevent_response ADD COLUMN server_to_exec int(10) unsigned NOT NULL DEFAULT 0;

View File

@ -193,32 +193,51 @@ config_check();
$select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '" . $config['id_user'] . "'"); $select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '" . $config['id_user'] . "'");
$autorefresh_list = json_decode($select[0]['autorefresh_white_list']); $autorefresh_list = json_decode($select[0]['autorefresh_white_list']);
if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) { if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) {
$autorefresh_img = html_print_image("images/header_refresh.png", true, array("class" => 'bot', "alt" => 'lightning', 'title' => __('Configure autorefresh'))); $do_refresh = true;
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
if ($_GET['refr']) { if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
$autorefresh_txt .= ' (<span id="refrcounter">'.date ("i:s", $config["refr"]).'</span>)'; $do_refresh = false;
}
} }
if ($do_refresh) {
$autorefresh_img = html_print_image("images/header_refresh.png", true, array("class" => 'bot', "alt" => 'lightning', 'title' => __('Configure autorefresh')));
$ignored_params['refr'] = ''; if ($_GET['refr']) {
$values = get_refresh_time_array(); $autorefresh_txt .= ' (<span id="refrcounter">'.date ("i:s", $config["refr"]).'</span>)';
$autorefresh_additional = '<span id="combo_refr" style="display: none;">'; }
$autorefresh_additional .= html_print_select ($values, 'ref', '', '', __('Select'), '0', true, false, false);
$autorefresh_additional .= '</span>'; $ignored_params['refr'] = '';
unset ($values); $values = get_refresh_time_array();
$autorefresh_additional = '<span id="combo_refr" style="display: none;">';
$autorefresh_link_open_img = $autorefresh_additional .= html_print_select ($values, 'ref', '', '', __('Select'), '0', true, false, false);
'<a class="white autorefresh" href="' . ui_get_url_refresh ($ignored_params) . '">'; $autorefresh_additional .= '</span>';
unset ($values);
if ($_GET['refr']) {
$autorefresh_link_open_txt = $autorefresh_link_open_img =
'<a class="white autorefresh autorefresh_txt" href="' . ui_get_url_refresh ($ignored_params) . '">'; '<a class="white autorefresh" href="' . ui_get_url_refresh ($ignored_params) . '">';
if ($_GET['refr']) {
$autorefresh_link_open_txt =
'<a class="white autorefresh autorefresh_txt" href="' . ui_get_url_refresh ($ignored_params) . '">';
}
else {
$autorefresh_link_open_txt = '<a>';
}
$autorefresh_link_close = '</a>';
} }
else { else {
$autorefresh_link_open_txt = '<a>'; $autorefresh_img = html_print_image("images/header_refresh_disabled.png", true, array("class" => 'bot autorefresh_disabled', "alt" => 'lightning', 'title' => __('Disabled autorefresh')));
}
$autorefresh_link_close = '</a>'; $ignored_params['refr'] = false;
$autorefresh_link_open_img = '';
$autorefresh_link_open_txt = '';
$autorefresh_link_close = '';
}
} }
else { else {
$autorefresh_img = html_print_image("images/header_refresh_disabled.png", true, array("class" => 'bot autorefresh_disabled', "alt" => 'lightning', 'title' => __('Disabled autorefresh'))); $autorefresh_img = html_print_image("images/header_refresh_disabled.png", true, array("class" => 'bot autorefresh_disabled', "alt" => 'lightning', 'title' => __('Disabled autorefresh')));
@ -357,17 +376,25 @@ config_check();
$(document).ready (function () { $(document).ready (function () {
<?php <?php
if (($autorefresh_list !== null) && (array_search($_GET['sec2'], $autorefresh_list) !== false) && (!isset($_GET["refr"]))) { if (($autorefresh_list !== null) && (array_search($_GET['sec2'], $autorefresh_list) !== false) && (!isset($_GET["refr"]))) {
$do_refresh = true;
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
$do_refresh = false;
}
}
if ($do_refresh) {
?> ?>
$("a.autorefresh_txt").toggle (); $("a.autorefresh_txt").toggle ();
$("#combo_refr").toggle (); $("#combo_refr").toggle ();
$("#combo_refr").css('padding-right', '9px'); $("#combo_refr").css('padding-right', '9px');
href = $("a.autorefresh").attr ("href"); href = $("a.autorefresh").attr ("href");
$(document).attr ("location", href + "30"); $(document).attr ("location", href + "30");
<?php <?php
}
} }
?> ?>
if (fixed_header) { if (fixed_header) {
$('div#head').addClass('fixed_header'); $('div#head').addClass('fixed_header');
$('div#page') $('div#page')

View File

@ -170,18 +170,22 @@ echo '<div class="login_page">';
} }
else { else {
echo '<div class="login_nick">'; echo '<div class="login_nick">';
echo '<div>'; echo '<div style="width:15%;">';
html_print_image ("/images/usuario_login.png", false); html_print_image ("/images/usuario_login.png", false);
echo '</div>'; echo '</div>';
html_print_input_text_extended ("nick", '', "nick", '', '', '' , false, echo '<div style="width:85%;">';
'', 'autocomplete="off" placeholder="'.__('User').'"'); html_print_input_text_extended ("nick", '', "nick", '', '', '' , false,
'', 'autocomplete="off" placeholder="'.__('User').'"');
echo '</div>';
echo '</div>'; echo '</div>';
echo '<div class="login_pass">'; echo '<div class="login_pass">';
echo '<div>'; echo '<div style="width:15%;">';
html_print_image ("/images/candado_login.png", false); html_print_image ("/images/candado_login.png", false);
echo '</div>'; echo '</div>';
html_print_input_text_extended ("pass", '', "pass", '', '', '' ,false, echo '<div style="width:85%;">';
'', 'autocomplete="off" placeholder="'.__('Password').'"', false, true); html_print_input_text_extended ("pass", '', "pass", '', '', '' ,false,
'', 'autocomplete="off" placeholder="'.__('Password').'"', false, true);
echo '</div>';
echo '</div>'; echo '</div>';
echo '<div class="login_button">'; echo '<div class="login_button">';
html_print_submit_button(__("Login"), "login_button", false, 'class="sub next_login"'); html_print_submit_button(__("Login"), "login_button", false, 'class="sub next_login"');

View File

@ -232,7 +232,7 @@ if(!$new_agent){
if ($id_agente) { if ($id_agente) {
$table->data[2][2] = $table->data[2][2] =
"<a id='qr_code_agent_view' href='javascript: show_dialog_qrcode(null, \"" . "<a id='qr_code_agent_view' href='javascript: show_dialog_qrcode(null, \"" .
ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agente) . "\" );'></a>"; ui_get_full_url('mobile/index.php?page=agent&id=' . $id_agente) . "\" );'></a>";
} }
else { else {
$table->data[2][2] = __("Only it is show when<br />the agent is saved."); $table->data[2][2] = __("Only it is show when<br />the agent is saved.");
@ -580,11 +580,11 @@ ui_require_jquery_file('bgiframe');
}); });
$("#text-id_parent").on("autocompletechange", function () { $("#text-id_parent").on("autocompletechange", function () {
agent_name = $("#text-id_parent").val(); agent_id=$("#hidden-id_parent").val();
var params = {}; var params = {};
params["get_agent_modules_json_by_name"] = 1; params["get_agent_modules_json_by_name"] = 1;
params["agent_name"] = agent_name; params["id_agent"] = agent_id;
params["page"] = "include/ajax/module"; params["page"] = "include/ajax/module";
jQuery.ajax ({ jQuery.ajax ({

View File

@ -34,6 +34,7 @@ $ip_target = (string) get_parameter ('ip_target', $ipAgent);
$use_agent = get_parameter ('use_agent'); $use_agent = get_parameter ('use_agent');
$snmp_community = (string) get_parameter ('snmp_community', 'public'); $snmp_community = (string) get_parameter ('snmp_community', 'public');
$snmp_version = get_parameter('snmp_version', '1'); $snmp_version = get_parameter('snmp_version', '1');
$server_to_exec = get_parameter('server_to_exec', 0);
$snmp3_auth_user = get_parameter('snmp3_auth_user'); $snmp3_auth_user = get_parameter('snmp3_auth_user');
$snmp3_security_level = get_parameter('snmp3_security_level'); $snmp3_security_level = get_parameter('snmp3_security_level');
$snmp3_auth_method = get_parameter('snmp3_auth_method'); $snmp3_auth_method = get_parameter('snmp3_auth_method');
@ -87,7 +88,8 @@ if ($snmpwalk) {
// OID Used is for DISKS // OID Used is for DISKS
$snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.25.2.3.1.3", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.25.2.3.1.3", $tcp_port,
$server_to_exec);
if (empty($snmpis)) { if (empty($snmpis)) {
$fail = true; $fail = true;
@ -120,7 +122,8 @@ if ($snmpwalk) {
// OID Used is for PROCESSES // OID Used is for PROCESSES
$snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.25.4.2.1.2", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.25.4.2.1.2", $tcp_port,
$server_to_exec);
if ($snmpis === false) { if ($snmpis === false) {
$snmpis = array(); $snmpis = array();
@ -158,7 +161,8 @@ if ($snmpwalk) {
// OID Used is for SENSOR TEMPERATURES // OID Used is for SENSOR TEMPERATURES
$snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.4.1.2021.13.16.2.1", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.4.1.2021.13.16.2.1", $tcp_port,
$server_to_exec);
if ($snmpis === false) { if ($snmpis === false) {
$snmpis = array(); $snmpis = array();
@ -196,7 +200,8 @@ if ($snmpwalk) {
// OID Used is for DEVICES // OID Used is for DEVICES
$snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.4.1.2021.13.15.1.1", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.4.1.2021.13.15.1.1", $tcp_port,
$server_to_exec);
if ($snmpis === false) { if ($snmpis === false) {
$snmpis = array(); $snmpis = array();
@ -706,6 +711,19 @@ $table->data[0][3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 20, tr
$table->data[1][0] = '<b>' . __('Use agent ip') . '</b>'; $table->data[1][0] = '<b>' . __('Use agent ip') . '</b>';
$table->data[1][1] = html_print_checkbox ('use_agent', 1, $use_agent, true); $table->data[1][1] = html_print_checkbox ('use_agent', 1, $use_agent, true);
$servers_to_exec = array();
$servers_to_exec[0] = __('Local console');
if (enterprise_installed()) {
enterprise_include_once ('include/functions_satellite.php');
$rows = get_proxy_servers();
foreach ($rows as $row) {
$servers_to_exec[$row['id_server']] = $row['name'];
}
}
$table->data[1][2] = '<b>' . __('Server to execute command') . '</b>';
$table->data[1][3] = html_print_select ($servers_to_exec, 'server_to_exec', $server_to_exec, '', '', '', true);
$snmp_versions['1'] = 'v. 1'; $snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2'; $snmp_versions['2'] = 'v. 2';
$snmp_versions['2c'] = 'v. 2c'; $snmp_versions['2c'] = 'v. 2c';

View File

@ -30,6 +30,7 @@ check_login ();
$ip_target = (string) get_parameter ('ip_target', $ipAgent); $ip_target = (string) get_parameter ('ip_target', $ipAgent);
$use_agent = get_parameter ('use_agent'); $use_agent = get_parameter ('use_agent');
$snmp_community = (string) get_parameter ('snmp_community', 'public'); $snmp_community = (string) get_parameter ('snmp_community', 'public');
$server_to_exec = get_parameter('server_to_exec', 0);
$snmp_version = get_parameter('snmp_version', '1'); $snmp_version = get_parameter('snmp_version', '1');
$snmp3_auth_user = get_parameter('snmp3_auth_user'); $snmp3_auth_user = get_parameter('snmp3_auth_user');
$snmp3_security_level = get_parameter('snmp3_security_level'); $snmp3_security_level = get_parameter('snmp3_security_level');
@ -53,16 +54,19 @@ if ($snmpwalk) {
// OID Used is for SNMP MIB-2 Interfaces // OID Used is for SNMP MIB-2 Interfaces
$snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.2", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.2", $tcp_port,
$server_to_exec);
// ifXTable is also used // ifXTable is also used
$ifxitems = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $ifxitems = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.31.1.1", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.31.1.1", $tcp_port,
$server_to_exec);
// Get the interfaces IPV4/IPV6 // Get the interfaces IPV4/IPV6
$snmp_int_ip = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $snmp_int_ip = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.4.34.1.3", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.4.34.1.3", $tcp_port,
$server_to_exec);
// Build a [<interface id>] => [<interface ip>] array // Build a [<interface id>] => [<interface ip>] array
if (!empty($snmp_int_ip)) { if (!empty($snmp_int_ip)) {
@ -345,6 +349,19 @@ $table->data[0][3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 20, tr
$table->data[1][0] = '<b>' . __('Use agent ip') . '</b>'; $table->data[1][0] = '<b>' . __('Use agent ip') . '</b>';
$table->data[1][1] = html_print_checkbox ('use_agent', 1, $use_agent, true); $table->data[1][1] = html_print_checkbox ('use_agent', 1, $use_agent, true);
$servers_to_exec = array();
$servers_to_exec[0] = __('Local console');
if (enterprise_installed()) {
enterprise_include_once ('include/functions_satellite.php');
$rows = get_proxy_servers();
foreach ($rows as $row) {
$servers_to_exec[$row['id_server']] = $row['name'];
}
}
$table->data[1][2] = '<b>' . __('Server to execute command') . '</b>';
$table->data[1][3] = html_print_select ($servers_to_exec, 'server_to_exec', $server_to_exec, '', '', '', true);
$snmp_versions['1'] = 'v. 1'; $snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2'; $snmp_versions['2'] = 'v. 2';
$snmp_versions['2c'] = 'v. 2c'; $snmp_versions['2c'] = 'v. 2c';

View File

@ -29,6 +29,7 @@ $ip_target = (string) get_parameter ('ip_target', $ipAgent); // Host
$plugin_user = (string) get_parameter ('plugin_user', 'Administrator'); // Username $plugin_user = (string) get_parameter ('plugin_user', 'Administrator'); // Username
$plugin_pass = io_safe_output(get_parameter('plugin_pass', '')); // Password $plugin_pass = io_safe_output(get_parameter('plugin_pass', '')); // Password
$tcp_send = (string) get_parameter ('tcp_send'); // Namespace $tcp_send = (string) get_parameter ('tcp_send'); // Namespace
$server_to_exec = get_parameter('server_to_exec', true);
//See if id_agente is set (either POST or GET, otherwise -1 //See if id_agente is set (either POST or GET, otherwise -1
$id_agent = $idAgent; $id_agent = $idAgent;
@ -53,7 +54,18 @@ if ($wmiexplore) {
$wmi_processes = $wmi_command . ' "select Name from Win32_Process"'; $wmi_processes = $wmi_command . ' "select Name from Win32_Process"';
$processes_name_field = 1; $processes_name_field = 1;
exec($wmi_processes, $output); if (enterprise_installed()) {
if ($server_to_exec != 0) {
$server_data = db_get_row('tserver','id_server', $server_to_exec);
exec("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " '" . $wmi_processes . "'", $output, $rc);
}
else {
exec($wmi_processes, $output);
}
}
else {
exec($wmi_processes, $output);
}
$fail = false; $fail = false;
if (preg_match('/^Failed/', $output[0])) { if (preg_match('/^Failed/', $output[0])) {
@ -79,7 +91,18 @@ if ($wmiexplore) {
$services_name_field = 0; $services_name_field = 0;
$services_check_field = 1; $services_check_field = 1;
exec($wmi_services, $output); if (enterprise_installed()) {
if ($server_to_exec != 0) {
$server_data = db_get_row('tserver','id_server', $server_to_exec);
exec("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " '" . $wmi_services . "'", $output, $rc);
}
else {
exec($wmi_services, $output);
}
}
else {
exec($wmi_services, $output);
}
foreach ($output as $index => $row) { foreach ($output as $index => $row) {
// First and second rows are Class and column names, ignore it // First and second rows are Class and column names, ignore it
@ -98,7 +121,18 @@ if ($wmiexplore) {
$wmi_disks = $wmi_command . ' "Select DeviceID from Win32_LogicalDisk"'; $wmi_disks = $wmi_command . ' "Select DeviceID from Win32_LogicalDisk"';
$disks_name_field = 0; $disks_name_field = 0;
exec($wmi_disks, $output); if (enterprise_installed()) {
if ($server_to_exec != 0) {
$server_data = db_get_row('tserver','id_server', $server_to_exec);
exec("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " '" . $wmi_disks . "'", $output, $rc);
}
else {
exec($wmi_disks, $output);
}
}
else {
exec($wmi_disks, $output);
}
foreach ($output as $index => $row) { foreach ($output as $index => $row) {
// First and second rows are Class and column names, ignore it // First and second rows are Class and column names, ignore it
@ -267,6 +301,19 @@ $table->data[1][3] = html_print_input_password ('plugin_pass', $plugin_pass, '',
$table->data[1][3] .= '<div id="spinner_modules" style="float: left; display: none;">' . html_print_image("images/spinner.gif", true) . '</div>'; $table->data[1][3] .= '<div id="spinner_modules" style="float: left; display: none;">' . html_print_image("images/spinner.gif", true) . '</div>';
html_print_input_hidden('wmiexplore', 1); html_print_input_hidden('wmiexplore', 1);
$servers_to_exec = array();
$servers_to_exec[0] = __('Local console');
if (enterprise_installed()) {
enterprise_include_once ('include/functions_satellite.php');
$rows = get_proxy_servers();
foreach ($rows as $row) {
$servers_to_exec[$row['id_server']] = $row['name'];
}
}
$table->data[2][0] = '<b>' . __('Server to execute command') . '</b>';
$table->data[2][1] = html_print_select ($servers_to_exec, 'server_to_exec', $server_to_exec, '', '', '', true);
html_print_table($table); html_print_table($table);
echo "<div style='text-align:right; width:".$table->width."'>"; echo "<div style='text-align:right; width:".$table->width."'>";

View File

@ -789,7 +789,7 @@ if ($update_agent) { // if modified some agent paramenter
WHERE id_group = ".$group_old); WHERE id_group = ".$group_old);
$result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agente)); $result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agente));
if ($result === false) { if ($result == false) {
ui_print_error_message( ui_print_error_message(
__('There was a problem updating the agent')); __('There was a problem updating the agent'));
} }
@ -1000,10 +1000,11 @@ if ($update_module || $create_module) {
$macros = io_json_mb_encode($macros); $macros = io_json_mb_encode($macros);
$conf_array = explode("\n",$configuration_data); $conf_array = explode("\n", io_safe_output($configuration_data));
foreach ($conf_array as $line) { foreach ($conf_array as $line) {
if (preg_match("/^module_name\s*(.*)/", $line, $match)) { if (preg_match("/^module_name\s*(.*)/", $line, $match)) {
$new_configuration_data .= "module_name $name\n"; $new_configuration_data .= "module_name " . io_safe_output($name) . "\n";
} }
// We delete from conf all the module macros starting with _field // We delete from conf all the module macros starting with _field
else if(!preg_match("/^module_macro_field.*/", $line, $match)) { else if(!preg_match("/^module_macro_field.*/", $line, $match)) {
@ -1011,14 +1012,28 @@ if ($update_module || $create_module) {
} }
} }
$values_macros = array();
$values_macros['macros'] = base64_encode($macros);
$macros_for_data = enterprise_hook(
'config_agents_get_macros_data_conf', array($values_macros));
if ($macros_for_data != '') {
$new_configuration_data = str_replace('module_end', $macros_for_data . "module_end", $new_configuration_data);
}
/*
$macros_for_data = enterprise_hook('config_agents_get_macros_data_conf', array($_POST)); $macros_for_data = enterprise_hook('config_agents_get_macros_data_conf', array($_POST));
if ($macros_for_data !== ENTERPRISE_NOT_HOOK && $macros_for_data != '') { if ($macros_for_data !== ENTERPRISE_NOT_HOOK && $macros_for_data != '') {
// Add macros to configuration file // Add macros to configuration file
$new_configuration_data = str_replace('module_end', $macros_for_data."module_end", $new_configuration_data); $new_configuration_data = str_replace('module_end', $macros_for_data."module_end", $new_configuration_data);
} }
*/
$configuration_data = $new_configuration_data; $configuration_data = str_replace('\\', "&#92;",
io_safe_input($new_configuration_data));;
html_debug($configuration_data, true);
} }
// Services are an enterprise feature, // Services are an enterprise feature,
@ -1228,7 +1243,7 @@ if ($update_module) {
'min_ff_event_critical' => $ff_event_critical, 'min_ff_event_critical' => $ff_event_critical,
'each_ff' => $each_ff, 'each_ff' => $each_ff,
'ff_timeout' => $ff_timeout, 'ff_timeout' => $ff_timeout,
'unit' => $unit, 'unit' => io_safe_output($unit),
'macros' => $macros, 'macros' => $macros,
'quiet' => $quiet_module, 'quiet' => $quiet_module,
'critical_instructions' => $critical_instructions, 'critical_instructions' => $critical_instructions,
@ -1388,7 +1403,7 @@ if ($create_module) {
'min_ff_event_critical' => $ff_event_critical, 'min_ff_event_critical' => $ff_event_critical,
'each_ff' => $each_ff, 'each_ff' => $each_ff,
'ff_timeout' => $ff_timeout, 'ff_timeout' => $ff_timeout,
'unit' => $unit, 'unit' => io_safe_output($unit),
'macros' => $macros, 'macros' => $macros,
'quiet' => $quiet_module, 'quiet' => $quiet_module,
'critical_instructions' => $critical_instructions, 'critical_instructions' => $critical_instructions,
@ -1512,7 +1527,8 @@ if ($delete_module) { // DELETE agent module !
if ($result === false) if ($result === false)
$error++; $error++;
if (alerts_delete_alert_agent_module($id_borrar_modulo) === false) if (alerts_delete_alert_agent_module(false,
array('id_agent_module' => $id_borrar_modulo)) === false)
$error++; $error++;
$result = db_process_delete_temp('ttag_module', 'id_agente_modulo', $result = db_process_delete_temp('ttag_module', 'id_agente_modulo',

View File

@ -180,8 +180,7 @@ echo "</tr></table>";
$order_collation = ""; $order_collation = "";
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$order_collation = ""; $order_collation = "COLLATE utf8_general_ci";
//$order_collation = "COLLATE utf8_general_ci";
break; break;
case "postgresql": case "postgresql":
case "oracle": case "oracle":
@ -275,6 +274,7 @@ switch ($sortField) {
} }
$search_sql = ''; $search_sql = '';
if ($search != "") { if ($search != "") {
$sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress $sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress
INNER JOIN taddress_agent ON INNER JOIN taddress_agent ON
@ -488,6 +488,7 @@ if ($agents !== false) {
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=os&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '</a>' . '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=os&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '</a>' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=os&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . '</a>'; '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=os&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . '</a>';
echo "</th>"; echo "</th>";
echo "<th>".__('Type'). "</th>";
echo "<th>".__('Group'). ' ' . echo "<th>".__('Group'). ' ' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '</a>' . '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '</a>' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . '</a>'; '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . '</a>';
@ -606,6 +607,14 @@ if ($agents !== false) {
echo "<td class='$tdcolor' align='left' valign='middle'>"; echo "<td class='$tdcolor' align='left' valign='middle'>";
ui_print_os_icon ($agent["id_os"], false); ui_print_os_icon ($agent["id_os"], false);
echo "</td>"; echo "</td>";
// Type agent (Networt, Software or Satellite)
echo "<td class='$tdcolor' align='left' valign='middle'>";
echo ui_print_type_agent_icon ($agent["id_os"], $agent['ultimo_contacto_remoto'],
$agent['ultimo_contacto'], $agent['remote'], $agent['agent_version']);
echo "</td>";
// Group icon and name // Group icon and name
echo "<td class='$tdcolor' align='left' valign='middle'>" . ui_print_group_icon ($id_grupo, true)."</td>"; echo "<td class='$tdcolor' align='left' valign='middle'>" . ui_print_group_icon ($id_grupo, true)."</td>";
// Description // Description

View File

@ -149,7 +149,6 @@ $table->data = array();
$fields_available = array(); $fields_available = array();
$fields_available['id_evento'] = __('Event id');
$fields_available['evento'] = __('Event name'); $fields_available['evento'] = __('Event name');
$fields_available['id_agente'] = __('Agent name'); $fields_available['id_agente'] = __('Agent name');
$fields_available['id_usuario'] = __('User'); $fields_available['id_usuario'] = __('User');

View File

@ -53,6 +53,7 @@ else {
$event_response['modal_width'] = 0; $event_response['modal_width'] = 0;
$event_response['modal_height'] = 0; $event_response['modal_height'] = 0;
$event_response['params'] = ''; $event_response['params'] = '';
$event_response['server_to_exec'] = '';
} }
$table = new stdClass(); $table = new stdClass();
@ -117,11 +118,25 @@ $data[3] = html_print_select($types,'type',$event_response['type'],'','','',true
$table->data[3] = $data; $table->data[3] = $data;
$data = array(); $data = array();
$table->colspan[4][1] = 3;
$data[0] = '<span id="command_label" class="labels">'.__('Command').'</span><span id="url_label" style="display:none;" class="labels">'.__('URL').'</span>'.ui_print_help_icon ("response_macros", true); $data[0] = '<span id="command_label" class="labels">'.__('Command').'</span><span id="url_label" style="display:none;" class="labels">'.__('URL').'</span>'.ui_print_help_icon ("response_macros", true);
$data[1] = html_print_input_text('target', $event_response['target'], $data[1] = html_print_input_text('target', $event_response['target'],
'', 100, 255, true); '', 100, 255, true);
$types = array('url' => __('URL'), 'command' => __('Command'));
$servers_to_exec = array();
$servers_to_exec[0] = __('Local console');
if (enterprise_installed()) {
enterprise_include_once ('include/functions_satellite.php');
$rows = get_proxy_servers();
foreach ($rows as $row) {
$servers_to_exec[$row['id_server']] = $row['name'];
}
}
$data[2] = '<div id="server_to_exec_label" style="display:none;" class="labels">' . __('Server to execute command') . '</div>';
$data[3] = '<div id="server_to_exec_value" style="display:none;">' . html_print_select($servers_to_exec, 'server_to_exec', $event_response['server_to_exec'], '', '', '', true) . '</div>';
$table->data[4] = $data; $table->data[4] = $data;
if ($event_response_id == 0) { if ($event_response_id == 0) {
@ -158,9 +173,13 @@ $('#type').change(function() {
$('#new_window option[value="0"]') $('#new_window option[value="0"]')
.prop('selected', true); .prop('selected', true);
$('#new_window').attr('disabled','disabled'); $('#new_window').attr('disabled','disabled');
$('#server_to_exec_label').css('display','');
$('#server_to_exec_value').css('display','');
break; break;
case 'url': case 'url':
$('#new_window').removeAttr('disabled'); $('#new_window').removeAttr('disabled');
$('#server_to_exec_label').css('display','none');
$('#server_to_exec_value').css('display','none');
break; break;
} }
}); });

View File

@ -40,6 +40,17 @@ switch($action) {
$values['modal_height'] = get_parameter('modal_height'); $values['modal_height'] = get_parameter('modal_height');
$values['new_window'] = get_parameter('new_window'); $values['new_window'] = get_parameter('new_window');
$values['params'] = get_parameter('params'); $values['params'] = get_parameter('params');
if (enterprise_installed()) {
if ($values['type'] == 'command') {
$values['server_to_exec'] = get_parameter('server_to_exec');
}
else {
$values['server_to_exec'] = 0;
}
}
else {
$values['server_to_exec'] = 0;
}
if($values['new_window'] == 1) { if($values['new_window'] == 1) {
$values['modal_width'] = 0; $values['modal_width'] = 0;
@ -67,6 +78,17 @@ switch($action) {
$values['modal_height'] = get_parameter('modal_height'); $values['modal_height'] = get_parameter('modal_height');
$values['new_window'] = get_parameter('new_window'); $values['new_window'] = get_parameter('new_window');
$values['params'] = get_parameter('params'); $values['params'] = get_parameter('params');
if (enterprise_installed()) {
if ($values['type'] == 'command') {
$values['server_to_exec'] = get_parameter('server_to_exec');
}
else {
$values['server_to_exec'] = 0;
}
}
else {
$values['server_to_exec'] = 0;
}
if($values['new_window'] == 1) { if($values['new_window'] == 1) {
$values['modal_width'] = 0; $values['modal_width'] = 0;

View File

@ -48,7 +48,7 @@ if (is_ajax ()) {
return; return;
} }
function process_manage_delete ($module_name, $id_agents) { function process_manage_delete ($module_name, $id_agents, $module_status = 'all') {
global $config; global $config;
@ -217,6 +217,20 @@ function process_manage_delete ($module_name, $id_agents) {
} }
} }
if (($module_status == 'unknown') && ($module_name[0] == "0") && (is_array($module_name)) && (count($module_name) == 1)) {
$modules_to_delete = array();
foreach ($modules as $mod_id) {
$mod_status = (int)db_get_value_filter ('estado', 'tagente_estado', array('id_agente_modulo' => $mod_id));
// Unknown, not init and no data modules
if ($mod_status == 3 || $mod_status == 4 || $mod_status == 5) {
$modules_to_delete[$mod_id] = $mod_id;
}
}
$modules = $modules_to_delete;
}
$count_deleted_modules = count($modules); $count_deleted_modules = count($modules);
if ($config['dbtype'] == "oracle") { if ($config['dbtype'] == "oracle") {
$success = db_process_sql(sprintf("DELETE FROM tagente_modulo WHERE id_agente_modulo IN (%s)", implode(",", $modules))); $success = db_process_sql(sprintf("DELETE FROM tagente_modulo WHERE id_agente_modulo IN (%s)", implode(",", $modules)));
@ -251,6 +265,7 @@ $agents_id = get_parameter('id_agents');
$modules_select = get_parameter('module'); $modules_select = get_parameter('module');
$selection_mode = get_parameter('selection_mode', 'modules'); $selection_mode = get_parameter('selection_mode', 'modules');
$recursion = get_parameter('recursion'); $recursion = get_parameter('recursion');
$modules_selection_mode = get_parameter('modules_selection_mode');
if ($delete) { if ($delete) {
switch ($selection_mode) { switch ($selection_mode) {
@ -299,7 +314,7 @@ if ($delete) {
$module_name = array(); $module_name = array();
} }
foreach ($module_name as $mod_name) { foreach ($module_name as $mod_name) {
$result = process_manage_delete ($mod_name['nombre'], $id_agent['id_agente']); $result = process_manage_delete ($mod_name['nombre'], $id_agent['id_agente'], $modules_selection_mode);
$count ++; $count ++;
$success += (int)$result; $success += (int)$result;
} }
@ -319,7 +334,7 @@ if ($delete) {
$module_name = array(); $module_name = array();
} }
else { else {
$result = process_manage_delete (array(0 => 0), $id_agent); $result = process_manage_delete (array(0 => 0), $id_agent, $modules_selection_mode);
} }
$success += (int)$result; $success += (int)$result;
} }
@ -330,7 +345,8 @@ if ($delete) {
} }
if (!$force) { if (!$force) {
$result = process_manage_delete ($modules_, $agents_); $result = false;
$result = process_manage_delete ($modules_, $agents_, $modules_selection_mode);
} }
if ($result) { if ($result) {

View File

@ -147,10 +147,15 @@ if ($update_agents) {
$result = db_process_sql_update ('tagente', $result = db_process_sql_update ('tagente',
$values, $values,
array ('id_agente' => $id_agent)); array ('id_agente' => $id_agent));
if($group_old || $result){ if($group_old || $result){
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups if ($group_old && $group_old != null) {
WHERE id_group = ".$group_old); $tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
WHERE id_group = ".$group_old);
}
else {
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups");
}
if($tpolicy_group_old){ if($tpolicy_group_old){
foreach ($tpolicy_group_old as $key => $value) { foreach ($tpolicy_group_old as $key => $value) {
@ -164,9 +169,13 @@ if ($update_agents) {
} }
} }
} }
if ($values['id_grupo'] && $values['id_grupo'] != null) {
$tpolicy_group_new = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups $tpolicy_group_new = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
WHERE id_group = ".$values['id_grupo']); WHERE id_group = ".$values['id_grupo']);
}
else {
$tpolicy_group_new = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups");
}
if($tpolicy_group_new){ if($tpolicy_group_new){
foreach ($tpolicy_group_new as $key => $value) { foreach ($tpolicy_group_new as $key => $value) {
@ -558,11 +567,11 @@ $(document).ready (function () {
}); });
$("#text-id_parent").on("autocompletechange", function () { $("#text-id_parent").on("autocompletechange", function () {
agent_name = $("#text-id_parent").val(); agent_id = $("#hidden-id_parent").val();
var params = {}; var params = {};
params["get_agent_modules_json_by_name"] = 1; params["get_agent_modules_json_by_name"] = 1;
params["agent_name"] = agent_name; params["id_agent"] = agent_id;
params["page"] = "include/ajax/module"; params["page"] = "include/ajax/module";
jQuery.ajax ({ jQuery.ajax ({

View File

@ -40,6 +40,7 @@ $agents_id = get_parameter('id_agents');
$modules_select = get_parameter('module'); $modules_select = get_parameter('module');
$selection_mode = get_parameter('selection_mode', 'modules'); $selection_mode = get_parameter('selection_mode', 'modules');
$recursion = get_parameter('recursion'); $recursion = get_parameter('recursion');
$modules_selection_mode = get_parameter('modules_selection_mode');
$update = (bool) get_parameter_post ('update'); $update = (bool) get_parameter_post ('update');
@ -105,7 +106,7 @@ if ($update) {
$module_name = array(); $module_name = array();
foreach ($module_name as $mod_name) { foreach ($module_name as $mod_name) {
$result = process_manage_edit($mod_name['nombre'], $id_agent); $result = process_manage_edit($mod_name['nombre'], $id_agent, $modules_selection_mode);
$count++; $count++;
$success += (int)$result; $success += (int)$result;
} }
@ -127,7 +128,7 @@ if ($update) {
$module_name = array(); $module_name = array();
foreach($module_name as $mod_name) { foreach($module_name as $mod_name) {
$result = process_manage_edit($mod_name['nombre'], $id_agent); $result = process_manage_edit($mod_name['nombre'], $id_agent, $modules_selection_mode);
$count++; $count++;
$success += (int)$result; $success += (int)$result;
} }
@ -146,7 +147,7 @@ if ($update) {
foreach ($modules_ as $module_) { foreach ($modules_ as $module_) {
$result = process_manage_edit ($module_, $agent_); $result = process_manage_edit ($module_, $agent_, $modules_selection_mode);
$count++; $count++;
$success += (int)$result; $success += (int)$result;
@ -1112,7 +1113,7 @@ function disabled_status () {
/* ]]> */ /* ]]> */
</script> </script>
<?php <?php
function process_manage_edit ($module_name, $agents_select = null) { function process_manage_edit ($module_name, $agents_select = null, $module_status = 'all') {
if (is_int ($module_name) && $module_name < 0) { if (is_int ($module_name) && $module_name < 0) {
ui_print_error_message(__('No modules selected')); ui_print_error_message(__('No modules selected'));
@ -1230,6 +1231,19 @@ function process_manage_edit ($module_name, $agents_select = null) {
if ($modules === false) if ($modules === false)
return false; return false;
if (($module_status == 'unknown') && ($module_name == "0")) {
$modules_to_delete = array();
foreach ($modules as $mod_id) {
$mod_status = (int)db_get_value_filter ('estado', 'tagente_estado', array('id_agente_modulo' => $mod_id));
// Unknown, not init and no data modules
if ($mod_status == 3 || $mod_status == 4 || $mod_status == 5) {
$modules_to_delete[$mod_id] = $mod_id;
}
}
$modules = $modules_to_delete;
}
foreach ($modules as $module) { foreach ($modules as $module) {
$result = modules_update_agent_module( $result = modules_update_agent_module(

View File

@ -41,8 +41,13 @@ if (is_ajax()){
$id_agent = get_parameter('id_agent'); $id_agent = get_parameter('id_agent');
$id_agent_module = get_parameter('id_agent_module'); $id_agent_module = get_parameter('id_agent_module');
$time_lapse = get_parameter('time_lapse'); $time_lapse = get_parameter('time_lapse');
$only_avg = (int) get_parameter('only_avg'); $only_avg = get_parameter('only_avg');
if($only_avg != 'false'){
$only_avg = 1;
}
else{
$only_avg = 0;
}
$values = array( $values = array(
'id_container' => $id_container2, 'id_container' => $id_container2,
'type' => "simple_graph", 'type' => "simple_graph",
@ -76,7 +81,13 @@ if (is_ajax()){
$agent_alias = get_parameter('agent_alias',''); $agent_alias = get_parameter('agent_alias','');
$module_name = get_parameter('module_name',''); $module_name = get_parameter('module_name','');
$tag = get_parameter('tag',0); $tag = get_parameter('tag',0);
$only_avg = get_parameter('only_avg');
if($only_avg != 'false'){
$only_avg = 1;
}
else{
$only_avg = 0;
}
$values = array( $values = array(
'id_container' => $id_container2, 'id_container' => $id_container2,
'type' => "dynamic_graph", 'type' => "dynamic_graph",
@ -85,8 +96,8 @@ if (is_ajax()){
'id_module_group' => $module_group, 'id_module_group' => $module_group,
'agent' => $agent_alias, 'agent' => $agent_alias,
'module' => $module_name, 'module' => $module_name,
'id_tag' => $tag); 'id_tag' => $tag,
'only_average' => $only_avg);
$id_item = db_process_sql_insert('tcontainer_item', $values); $id_item = db_process_sql_insert('tcontainer_item', $values);
return; return;
} }
@ -433,7 +444,13 @@ if($edit_container){
$tag, '', __('Any'), 0, true, false, false); $tag, '', __('Any'), 0, true, false, false);
$table->data[] = $data; $table->data[] = $data;
$table->rowclass[] = ''; $table->rowclass[] = '';
$data = array();
$data[0] = __('Only average');
$data[1] = html_print_checkbox('only_avg_2', 1, false,true);
$table->data[] = $data;
$table->rowclass[] = '';
$data = array(); $data = array();
$data[0] = ""; $data[0] = "";
$data[1] = "<input style='float:right;' type=submit name='add_dynamic' class='sub add' value='".__('Add item')."'>"; $data[1] = "<input style='float:right;' type=submit name='add_dynamic' class='sub add' value='".__('Add item')."'>";
@ -592,6 +609,7 @@ echo html_print_input_hidden('id_agent', 0);
var group = $("#container_id_group1").val(); var group = $("#container_id_group1").val();
var module_group = $("#combo_modulegroup").val(); var module_group = $("#combo_modulegroup").val();
var tag = $("#tag").val(); var tag = $("#tag").val();
var only_avg = $("#checkbox-only_avg_2").prop("checked");
var id_container = <?php echo $id_container; ?>; var id_container = <?php echo $id_container; ?>;
jQuery.post ("ajax.php", jQuery.post ("ajax.php",
{"page" : "godmode/reporting/create_container", {"page" : "godmode/reporting/create_container",
@ -603,6 +621,7 @@ echo html_print_input_hidden('id_agent', 0);
"module_name" : module_name, "module_name" : module_name,
"tag" : tag, "tag" : tag,
"id_container" : id_container, "id_container" : id_container,
"only_avg" : only_avg,
}, },
function (data, status) { function (data, status) {
var url = location.href.replace('&update_container=1', ""); var url = location.href.replace('&update_container=1', "");

View File

@ -94,7 +94,7 @@ echo "</div>";
}, },
success: function(data) { success: function(data) {
$("#div_"+hash).remove(); $("#div_"+hash).remove();
$("#tgl_div_"+hash).prepend("<div id='div_"+hash+"' style='width: 100%;padding-left: 63px; padding-top: 7px;'>"+data+"</div>"); $("#tgl_div_"+hash).prepend("<div id='div_"+hash+"' class='graph_conteiner_inside' style='width: 99%;padding-left: 63px; padding-top: 7px;'>"+data+"</div>");
if($('div[class *= graph]').length == 0 && $('div[class *= bullet]').length == 0 && $('div[id *= gauge_]').length == 0){ if($('div[class *= graph]').length == 0 && $('div[class *= bullet]').length == 0 && $('div[id *= gauge_]').length == 0){
$("#div_"+hash).remove(); $("#div_"+hash).remove();

View File

@ -539,7 +539,7 @@ switch ($action) {
$table->size[3] = '2%'; $table->size[3] = '2%';
$table->size[4] = '2%'; $table->size[4] = '2%';
$table->size[5] = '2%'; $table->size[5] = '2%';
$table->size[6] = '2%'; $table->size[6] = '4%';
$table->size['csv'] = '5%'; $table->size['csv'] = '5%';
$next = 4; $next = 4;
@ -1124,8 +1124,8 @@ switch ($action) {
$values['treport_custom_sql_id'] = get_parameter('id_custom'); $values['treport_custom_sql_id'] = get_parameter('id_custom');
if ($values['treport_custom_sql_id'] == 0) { if ($values['treport_custom_sql_id'] == 0) {
$values['external_source'] = get_parameter('sql'); $values['external_source'] = get_parameter('sql');
$values['historical_db'] = get_parameter('historical_db_check');
} }
$values['historical_db'] = get_parameter('historical_db_check');
} }
else if ($values['type'] == 'url') { else if ($values['type'] == 'url') {
$values['external_source'] = get_parameter('url'); $values['external_source'] = get_parameter('url');
@ -1214,7 +1214,6 @@ switch ($action) {
break; break;
} }
$resultOperationDB = db_process_sql_update( $resultOperationDB = db_process_sql_update(
'treport_content', 'treport_content',
$values, $values,
@ -1446,8 +1445,8 @@ switch ($action) {
$values['treport_custom_sql_id'] = get_parameter('id_custom'); $values['treport_custom_sql_id'] = get_parameter('id_custom');
if ($values['treport_custom_sql_id'] == 0) { if ($values['treport_custom_sql_id'] == 0) {
$values['external_source'] = get_parameter('sql'); $values['external_source'] = get_parameter('sql');
$values['historical_db'] = get_parameter('historical_db_check');
} }
$values['historical_db'] = get_parameter('historical_db_check');
} }
elseif ($values['type'] == 'url') { elseif ($values['type'] == 'url') {
$values['external_source'] = get_parameter('url'); $values['external_source'] = get_parameter('url');

View File

@ -270,14 +270,14 @@ function update_button_palette_callback() {
break; break;
case 'box_item': case 'box_item':
if($('input[name=width_box]').val() == ''){ if($('input[name=width_box]').val() == ''){
alert('Undefined width'); alert('Undefined width');
return false; return false;
} }
if($('input[name=height_box]').val() == ''){ if($('input[name=height_box]').val() == ''){
alert('Undefined height'); alert('Undefined height');
return false; return false;
} }
$("#" + idItem + " div").css('background-color', values['fill_color']); $("#" + idItem + " div").css('background-color', values['fill_color']);
$("#" + idItem + " div").css('border-color', values['border_color']); $("#" + idItem + " div").css('border-color', values['border_color']);
@ -295,55 +295,53 @@ function update_button_palette_callback() {
case 'group_item': case 'group_item':
case 'static_graph': case 'static_graph':
if($('input[name=width]').val() == ''){ if($('input[name=width]').val() == ''){
alert('Undefined width'); alert('Undefined width');
return false; return false;
}
if($('input[name=height]').val() == ''){
alert('Undefined height');
return false;
}
$("#text_" + idItem).html(values['label']);
if ((values['width'] == 0) || (values['height'] == 0)) {
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', 70);
$("#image_" + idItem).attr('height', 70);
$("#image_" + idItem).css('width', '70px');
$("#image_" + idItem).css('height', '70px');
} }
else{ if($('input[name=height]').val() == ''){
alert('Undefined height');
return false;
}
$("#text_" + idItem).html(values['label']);
if ((values['width'] == 0) || (values['height'] == 0)) {
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', 70);
$("#image_" + idItem).attr('height', 70);
$("#image_" + idItem).css('width', '70px');
$("#image_" + idItem).css('height', '70px');
}
else{
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px');
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
}
}
else {
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight); $("#image_" + idItem).attr('width', values['width']);
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight); $("#image_" + idItem).attr('height', values['height']);
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px'); $("#image_" + idItem).css('width', values['width'] + 'px');
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px'); $("#image_" + idItem).css('height', values['height'] + 'px');
} }
}
else {
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', values['width']);
$("#image_" + idItem).attr('height', values['height']);
$("#image_" + idItem).css('width', values['width'] + 'px');
$("#image_" + idItem).css('height', values['height'] + 'px');
}
break; break;
case 'percentile_bar': case 'percentile_bar':
case 'percentile_item': case 'percentile_item':
if($('input[name=width_percentile]').val() == ''){
if($('input[name=width_percentile]').val() == ''){ alert('Undefined width');
alert('Undefined width'); return false;
return false; }
} if($('input[name=height_percentile]').val() == ''){
if($('input[name=height_percentile]').val() == ''){ alert('Undefined height');
alert('Undefined height'); return false;
return false; }
}
$("#text_" + idItem).html(values['label']); $("#text_" + idItem).html(values['label']);
$("#image_" + idItem).attr("src", "images/spinner.gif"); $("#image_" + idItem).attr("src", "images/spinner.gif");
@ -354,60 +352,69 @@ function update_button_palette_callback() {
setPercentileBar(idItem, values); setPercentileBar(idItem, values);
} }
break; break;
case 'module_graph': case 'module_graph':
if($('#dir_items').html() == 'horizontal'){
if(parseInt($('#text-left').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))
if($('#dir_items').html() == 'horizontal'){ || parseInt($('#text-left').val()) + (parseInt($('input[name=width_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))){
if(parseInt($('#text-left').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))
|| parseInt($('#text-left').val()) + (parseInt($('input[name=width_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))){ alert($('#count_items').html()+' joined graph items are wider than background');
return false;
alert($('#count_items').html()+' joined graph items are wider than background');
return false; }
} }
}
if($('#dir_items').html() == 'vertical'){
if($('#dir_items').html() == 'vertical'){ if(parseInt($('#text-top').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('height'))){
if(parseInt($('#text-top').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('height'))){ alert($('#count_items').html()+' joined graph items are higher than background');
alert($('#count_items').html()+' joined graph items are higher than background'); return false;
return false;
}
} }
}
if($('input[name=width_module_graph]').val() == ''){
alert('Undefined width');
if($('input[name=width_module_graph]').val() == ''){ return false;
alert('Undefined width'); }
return false; if($('input[name=height_module_graph]').val() == ''){
} alert('Undefined height');
if($('input[name=height_module_graph]').val() == ''){ return false;
alert('Undefined height'); }
return false; if($('#custom_graph_row').css('display') != 'none' && $("#custom_graph option:selected").html() == 'None'){
}
if($('#custom_graph_row').css('display') != 'none' && $("#custom_graph option:selected").html() == 'None'){
alert('Undefined graph'); alert('Undefined graph');
return false; return false;
} }
$("#text_" + idItem).html(values['label']); $("#text_" + idItem).html(values['label']);
$("#image_" + idItem).attr("src", "images/spinner.gif"); $("#image_" + idItem).attr("src", "images/spinner.gif");
setModuleGraph(idItem); setModuleGraph(idItem);
break; break;
case 'auto_sla_graph':
if($('input[name=width]').val() == ''){
alert('Undefined width');
return false;
}
if($('input[name=height]').val() == ''){
alert('Undefined height');
return false;
}
$("#text_" + idItem).html(values['label']);
$("#image_" + idItem).attr("src", "images/spinner.gif");
setEventsBar(idItem, values);
break;
case 'simple_value': case 'simple_value':
//checkpoint //checkpoint
if(($('#text-label_ifr').contents().find('#tinymce p').html() == '_VALUE_' || // if(($('#text-label_ifr').contents().find('#tinymce p').html() == '_VALUE_' ||
$('#text-label_ifr').contents().find('#tinymce').html() == '_VALUE_') // $('#text-label_ifr').contents().find('#tinymce').html() == '_VALUE_')
&& $('#data_image_check').html() != 'On'){ // && $('#data_image_check').html() != 'On'){
alert('_VALUE_ exactly value is only enable for data image. Please change label text or select a data image module.'); // alert('_VALUE_ exactly value is only enable for data image. Please change label text or select a data image module.');
return; // return;
} // }
$("#" + idItem).html(values['label']); $("#" + idItem).html(values['label']);
if(values['label'].replace( /<.*?>/g, '' ) == '_VALUE_'){ if( (values['label'].replace( /<.*?>/g, '' ) != '_VALUE_')
&& (values['label'].replace( /<.*?>/g, '' ) != '(_VALUE_)') ){
$("#text_" + idItem).html('<img style="width:'+values['width_data_image']+'px;" src="images/console/signes/data_image.png">'); $("#text_" + idItem).html('<img style="width:'+values['width_data_image']+'px;" src="images/console/signes/data_image.png">');
$("#" + idItem).html('<img style="width:'+values['width_data_image']+'px;" src="images/console/signes/data_image.png">'); $("#" + idItem).html('<img style="width:'+values['width_data_image']+'px;" src="images/console/signes/data_image.png">');
} }
@ -430,42 +437,41 @@ function update_button_palette_callback() {
$("#text_" + idItem).html(values['label']); $("#text_" + idItem).html(values['label']);
break; break;
case 'icon': case 'icon':
if($('input[name=width]').val() == ''){
if($('input[name=width]').val() == ''){ alert('Undefined width');
alert('Undefined width'); return false;
return false; }
} if($('input[name=height]').val() == ''){
if($('input[name=height]').val() == ''){ alert('Undefined height');
alert('Undefined height'); return false;
return false; }
} $("#image_" + idItem).attr('src', "images/spinner.gif");
$("#image_" + idItem).attr('src', "images/spinner.gif"); if ((values['width'] == 0) || (values['height'] == 0)) {
if ((values['width'] == 0) || (values['height'] == 0)) { if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ $("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', 70);
$("#image_" + idItem).attr('height', 70);
$("#image_" + idItem).css('width', '70px');
$("#image_" + idItem).css('height', '70px');
}
else{
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px');
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
}
}
else {
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', 70); $("#image_" + idItem).attr('width', values['width']);
$("#image_" + idItem).attr('height', 70); $("#image_" + idItem).attr('height', values['height']);
$("#image_" + idItem).css('width', '70px'); $("#image_" + idItem).css('width', values['width'] + 'px');
$("#image_" + idItem).css('height', '70px'); $("#image_" + idItem).css('height', values['height'] + 'px');
} }
else{
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px');
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
}
}
else {
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', values['width']);
$("#image_" + idItem).attr('height', values['height']);
$("#image_" + idItem).css('width', values['width'] + 'px');
$("#image_" + idItem).css('height', values['height'] + 'px');
}
var image = values['image'] + ".png"; var image = values['image'] + ".png";
set_image("image", idItem, image); set_image("image", idItem, image);
break; break;
@ -576,16 +582,19 @@ function readFields() {
} }
values['width'] = $("input[name=width]").val(); values['width'] = $("input[name=width]").val();
values['width_data_image'] = $("#data_image_width").val(); values['width_data_image'] = $("#data_image_width").val();
if(values['width_data_image'] != 0){ if(selectedItem == 'simple_value' || creationItem == 'simple_value'){
values['width'] = values['width_data_image']; if(values['width_data_image'] != 0){
values['width'] = values['width_data_image'];
}
} }
values['height'] = $("input[name=height]").val(); values['height'] = $("input[name=height]").val();
values['parent'] = $("select[name=parent]").val(); values['parent'] = $("select[name=parent]").val();
values['map_linked'] = $("select[name=map_linked]").val(); values['map_linked'] = $("select[name=map_linked]").val();
values['width_percentile'] = $("input[name=width_percentile]").val(); values['width_percentile'] = $("input[name=width_percentile]").val();
values['max_percentile'] = $("input[name=max_percentile]").val(); values['max_percentile'] = parseInt($("input[name=max_percentile]").val());
values['width_module_graph'] = $("input[name=width_module_graph]").val(); values['width_module_graph'] = $("input[name=width_module_graph]").val();
values['height_module_graph'] = $("input[name=height_module_graph]").val(); values['height_module_graph'] = $("input[name=height_module_graph]").val();
values['event_max_time_row'] = $("select[name=event_max_time_row]").val();
values['type_percentile'] = $("input[name=type_percentile]:checked").val(); values['type_percentile'] = $("input[name=type_percentile]:checked").val();
values['value_show'] = $("input[name=value_show]:checked").val(); values['value_show'] = $("input[name=value_show]:checked").val();
values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0; values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0;
@ -655,6 +664,16 @@ function create_button_palette_callback() {
validate = false; validate = false;
} }
break; break;
case 'auto_sla_graph':
if ((values['agent'] == '')) {
alert($("#message_alert_no_agent").html());
validate = false;
}
if ((values['module'] == 0)) {
alert($("#message_alert_no_module").html());
validate = false;
}
break;
case 'label': case 'label':
if ((values['label'] == '')) { if ((values['label'] == '')) {
alert($("#message_alert_no_label").html()); alert($("#message_alert_no_label").html());
@ -930,6 +949,7 @@ function toggle_item_palette() {
activeToolboxButton('group_item', true); activeToolboxButton('group_item', true);
activeToolboxButton('box_item', true); activeToolboxButton('box_item', true);
activeToolboxButton('line_item', true); activeToolboxButton('line_item', true);
activeToolboxButton('auto_sla_graph', true);
if (typeof(enterprise_activeToolboxButton) == 'function') { if (typeof(enterprise_activeToolboxButton) == 'function') {
enterprise_activeToolboxButton(true); enterprise_activeToolboxButton(true);
@ -949,6 +969,7 @@ function toggle_item_palette() {
activeToolboxButton('static_graph', false); activeToolboxButton('static_graph', false);
activeToolboxButton('module_graph', false); activeToolboxButton('module_graph', false);
activeToolboxButton('auto_sla_graph', false);
activeToolboxButton('simple_value', false); activeToolboxButton('simple_value', false);
activeToolboxButton('label', false); activeToolboxButton('label', false);
activeToolboxButton('icon', false); activeToolboxButton('icon', false);
@ -1089,6 +1110,8 @@ function loadFieldsFromDB(item) {
fill_parent_select(idItem); fill_parent_select(idItem);
jQuery.each(data, function(key, val) { jQuery.each(data, function(key, val) {
if (key == 'event_max_time_row')
$("select[name=event_max_time_row]").val(val);
if (key == 'background') if (key == 'background')
$("#background_image").val(val); $("#background_image").val(val);
if (key == 'width') $("input[name=width]").val(val); if (key == 'width') $("input[name=width]").val(val);
@ -1423,6 +1446,9 @@ function hiddenFields(item) {
$("#process_value_row").css('display', 'none'); $("#process_value_row").css('display', 'none');
$("#process_value_row." + item).css('display', ''); $("#process_value_row." + item).css('display', '');
$("#event_max_time_row").css('display', 'none');
$("#event_max_time_row." + item).css('display', '');
$("#background_row_1").css('display', 'none'); $("#background_row_1").css('display', 'none');
$("#background_row_1." + item).css('display', ''); $("#background_row_1." + item).css('display', '');
@ -1858,6 +1884,55 @@ function setPercentileBar(id_data, values) {
}); });
} }
function setEventsBar(id_data, values) {
var url_hack_metaconsole = '';
if (is_metaconsole()) {
url_hack_metaconsole = '../../';
}
parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_module_events"});
parameter.push ({name: "id_agent", value: values['id_agent']});
parameter.push ({name: "id_agent_module", value: values['module']});
if (is_metaconsole()) {
parameter.push ({name: "id_metaconsole", value: id_metaconsole});
}
parameter.push ({name: "period", value: values['event_max_time_row']});
parameter.push ({name: "id_visual_console", value: id_visual_console});
jQuery.ajax({
url: get_url_ajax(),
data: parameter,
type: "POST",
dataType: 'json',
success: function (data) {
if (data['no_data'] == true) {
if (values['width'] == "0" || values['height'] == "0") {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/module-events.png');
}
else {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/module-events.png');
$("#" + id_data + " img").css('width', values['width'] + 'px');
$("#" + id_data + " img").css('height', values['height'] + 'px');
}
}
else {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/module-events.png');
if($('#text-width').val() == 0 || $('#text-height').val() == 0){
$("#" + id_data + " img").css('width', '300px');
$("#" + id_data + " img").css('height', '180px');
}
else{
$("#" + id_data + " img").css('width', $('#text-width').val()+'px');
$("#" + id_data + " img").css('height', $('#text-height').val()+'px');
}
}
}
});
}
function setPercentileBubble(id_data, values) { function setPercentileBubble(id_data, values) {
metaconsole = $("input[name='metaconsole']").val(); metaconsole = $("input[name='metaconsole']").val();
@ -2173,6 +2248,17 @@ function createItem(type, values, id_data) {
set_static_graph_status(id_data, values['image']); set_static_graph_status(id_data, values['image']);
break;
case 'auto_sla_graph':
var sizeStyle = '';
var imageSize = '';
item = $('<div id="' + id_data + '" class="item auto_sla_graph" style="text-align: left; position: absolute; display: inline-block; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<table><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' +
'<img class="image" id="image_' + id_data + '" src="images/spinner.gif" />' +
'</div>'
);
setEventsBar(id_data, values);
break; break;
case 'percentile_bar': case 'percentile_bar':
case 'percentile_item': case 'percentile_item':
@ -2498,13 +2584,13 @@ function updateDB_visual(type, idElement , values, event, top, left) {
set_static_graph_status(idElement, values['image']); set_static_graph_status(idElement, values['image']);
} }
break;
case 'percentile_item': case 'percentile_item':
case 'simple_value': case 'simple_value':
case 'label': case 'label':
case 'icon': case 'icon':
case 'module_graph': case 'module_graph':
case 'auto_sla_graph':
if (type == 'simple_value') { if (type == 'simple_value') {
setModuleValue(idElement, setModuleValue(idElement,
values.process_simple_value, values.process_simple_value,
@ -2667,7 +2753,6 @@ function updateDB(type, idElement , values, event) {
update_user_line(type, idElement, top, left); update_user_line(type, idElement, top, left);
break; break;
default: default:
if ((typeof(values['mov_left']) != 'undefined') && if ((typeof(values['mov_left']) != 'undefined') &&
(typeof(values['mov_top']) != 'undefined')) { (typeof(values['mov_top']) != 'undefined')) {
top = parseInt($("#" + idElement) top = parseInt($("#" + idElement)
@ -2728,8 +2813,6 @@ function updateDB(type, idElement , values, event) {
function copyDB(idItem) { function copyDB(idItem) {
metaconsole = $("input[name='metaconsole']").val(); metaconsole = $("input[name='metaconsole']").val();
parameter = Array(); parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "copy"}); parameter.push ({name: "action", value: "copy"});
@ -2900,6 +2983,15 @@ function eventsItems(drag) {
activeToolboxButton('delete_item', true); activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false); activeToolboxButton('show_grid', false);
} }
if ($(divParent).hasClass('auto_sla_graph')) {
creationItem = null;
selectedItem = 'auto_sla_graph';
idItem = $(divParent).attr('id');
activeToolboxButton('copy_item', true);
activeToolboxButton('edit_item', true);
activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false);
}
if ($(divParent).hasClass('group_item')) { if ($(divParent).hasClass('group_item')) {
creationItem = null; creationItem = null;
selectedItem = 'group_item'; selectedItem = 'group_item';
@ -2989,7 +3081,7 @@ function eventsItems(drag) {
} }
if(selectedItem == 'simple_value'){ if(selectedItem == 'simple_value'){
$('#data_image_width').val(event.currentTarget.clientWidth);
var found = $('#'+idItem).find("img"); var found = $('#'+idItem).find("img");
if(found.length > 0){ if(found.length > 0){
@ -3040,6 +3132,9 @@ function eventsItems(drag) {
if ($(event.target).hasClass('static_graph')) { if ($(event.target).hasClass('static_graph')) {
selectedItem = 'static_graph'; selectedItem = 'static_graph';
} }
if ($(event.target).hasClass('auto_sla_graph')) {
selectedItem = 'auto_sla_graph';
}
if ($(event.target).hasClass('group_item')) { if ($(event.target).hasClass('group_item')) {
selectedItem = 'group_item'; selectedItem = 'group_item';
} }
@ -3338,12 +3433,17 @@ function click_button_toolbox(id) {
toolbuttonActive = creationItem = 'module_graph'; toolbuttonActive = creationItem = 'module_graph';
toggle_item_palette(); toggle_item_palette();
break; break;
case 'auto_sla_graph':
toolbuttonActive = creationItem = 'auto_sla_graph';
toggle_item_palette();
break;
case 'simple_value': case 'simple_value':
toolbuttonActive = creationItem = 'simple_value'; toolbuttonActive = creationItem = 'simple_value';
toggle_item_palette(); toggle_item_palette();
$("#period_row." + id).css('display', 'none'); $("#period_row." + id).css('display', 'none');
break; break;
case 'label': case 'label':
$("#data_image_width").val(100);
toolbuttonActive = creationItem = 'label'; toolbuttonActive = creationItem = 'label';
toggle_item_palette(); toggle_item_palette();
break; break;
@ -3393,7 +3493,7 @@ function click_button_toolbox(id) {
activeToolboxButton('icon', false); activeToolboxButton('icon', false);
activeToolboxButton('service', false); activeToolboxButton('service', false);
activeToolboxButton('group_item', false); activeToolboxButton('group_item', false);
activeToolboxButton('auto_sla_graph', false);
activeToolboxButton('copy_item', false); activeToolboxButton('copy_item', false);
activeToolboxButton('edit_item', false); activeToolboxButton('edit_item', false);
activeToolboxButton('delete_item', false); activeToolboxButton('delete_item', false);
@ -3423,6 +3523,7 @@ function click_button_toolbox(id) {
activeToolboxButton('label', true); activeToolboxButton('label', true);
activeToolboxButton('icon', true); activeToolboxButton('icon', true);
activeToolboxButton('group_item', true); activeToolboxButton('group_item', true);
activeToolboxButton('auto_sla_graph', true);
} }
break; break;
case 'save_visualmap': case 'save_visualmap':
@ -3629,4 +3730,4 @@ function showGrid() {
eventsItems(); eventsItems();
} }
} }

View File

@ -152,6 +152,11 @@ foreach ($layoutDatas as $layoutData) {
html_print_image('images/chart_curve.png', true, html_print_image('images/chart_curve.png', true,
array('title' => __('Module Graph'))); array('title' => __('Module Graph')));
break; break;
case AUTO_SLA_GRAPH:
$table->data[$i + 1]['icon'] =
html_print_image('images/auto_sla_graph.png', true,
array('title' => __('Auto SLA Graph')));
break;
case SIMPLE_VALUE: case SIMPLE_VALUE:
$table->data[$i + 1]['icon'] = $table->data[$i + 1]['icon'] =
html_print_image('images/binary.png', true, html_print_image('images/binary.png', true,
@ -465,6 +470,7 @@ foreach ($layoutDatas as $layoutData) {
switch ($layoutData['type']) { switch ($layoutData['type']) {
case LINE_ITEM: case LINE_ITEM:
case BOX_ITEM: case BOX_ITEM:
case AUTO_SLA_GRAPH:
$table->data[$i + 2][4] = ""; $table->data[$i + 2][4] = "";
break; break;
default: default:

View File

@ -33,21 +33,40 @@ if (isset($_GET["server"])) {
$id_server= get_parameter_get ("server"); $id_server= get_parameter_get ("server");
// Headers // Headers
ui_print_page_header (__('Update Server'), "images/gm_servers.png", false, "servers", true); ui_print_page_header (__('Update Server'), "images/gm_servers.png", false, "servers", true);
$sql = sprintf("SELECT name, ip_address, description FROM tserver WHERE id_server = %d",$id_server); $sql = sprintf("SELECT name, ip_address, description, server_type, exec_proxy FROM tserver WHERE id_server = %d",$id_server);
$row = db_get_row_sql ($sql); $row = db_get_row_sql ($sql);
echo '<form name="servers" method="POST" action="index.php?sec=gservers&sec2=godmode/servers/modificar_server&update=1">'; echo '<form name="servers" method="POST" action="index.php?sec=gservers&sec2=godmode/servers/modificar_server&update=1">';
html_print_input_hidden ("server",$id_server); html_print_input_hidden ("server",$id_server);
$server_type = __('Standard');
if ($row["server_type"] == 13) {
$server_type = __('Satellite');
}
$exec_server_enable = __("No");
if ($row["exec_proxy"] == 1) {
$exec_server_enable = __('Yes');
}
$table->cellpadding=4; $table->cellpadding=4;
$table->cellspacing=4; $table->cellspacing=4;
$table->width='100%'; $table->width='100%';
$table->class="databox filters"; $table->class="databox filters";
$table->data[] = array (__('Name'),$row["name"]); $table->data[] = array (__('Name'), $row["name"]);
$table->data[] = array (__('IP Address'),html_print_input_text ('address',$row["ip_address"],'',50,0,true)); $table->data[] = array (__('IP Address'), html_print_input_text ('address',$row["ip_address"],'',50,0,true));
$table->data[] = array (__('Description'),html_print_input_text ('description',$row["description"],'',50,0,true)); $table->data[] = array (__('Description'), html_print_input_text ('description',$row["description"],'',50,0,true));
html_print_table ($table);
if (enterprise_installed()) {
$table->data[] = array (__('Type'), $server_type);
if ($row["server_type"] == 13) {
$table->data[] = array (__('Exec Server'), html_print_checkbox ("exec_proxy", 1, $row["exec_proxy"], true));
if ($row["exec_proxy"]) {
$table->data[] = array (__('Check Exec Server'), '<a id="check_exec_server">' . html_print_image ("images/dot_red.disabled.png", true) . '</a>' . '<div id="check_error_message"></div>');
}
}
}
html_print_table ($table);
echo '<div class="action-buttons" style="width: 100%">'; echo '<div class="action-buttons" style="width: 100%">';
echo '<input type="submit" class="sub upd" value="'.__('Update').'">'; echo '<input type="submit" class="sub upd" value="'.__('Update').'">';
@ -105,8 +124,9 @@ else {
$address = get_parameter_post ("address"); $address = get_parameter_post ("address");
$description = get_parameter_post ("description"); $description = get_parameter_post ("description");
$id_server = get_parameter_post ("server"); $id_server = get_parameter_post ("server");
$exec_proxy = get_parameter_post ("exec_proxy");
$values = array('ip_address' => $address, 'description' => $description); $values = array('ip_address' => $address, 'description' => $description, 'exec_proxy' => $exec_proxy);
$result = db_process_sql_update('tserver', $values, array('id_server' => $id_server)); $result = db_process_sql_update('tserver', $values, array('id_server' => $id_server));
if ($result !== false) { if ($result !== false) {
ui_print_success_message(__('Server updated successfully')); ui_print_success_message(__('Server updated successfully'));
@ -141,3 +161,38 @@ else {
require($config['homedir'] . '/godmode/servers/servers.build_table.php'); require($config['homedir'] . '/godmode/servers/servers.build_table.php');
} }
?> ?>
<script language="javascript" type="text/javascript">
$(document).ready (function () {
$("#check_exec_server img").on("click", function () {
$("#check_exec_server img").attr("src", "images/spinner.gif");
check_process("<?php echo $id_server;?>");
});
});
function check_process (id_server) {
var parameters = {};
parameters['page'] = 'enterprise/include/ajax/servers.ajax';
parameters['check_exec_server'] = 1;
parameters['id_server'] = id_server;
jQuery.post(
"ajax.php",
parameters,
function (data) {
if (data['correct']) {
$("#check_exec_server img").attr("src", "images/dot_green.png");
}
else {
$("#check_exec_server img").attr("src", "images/dot_red.png");
$("#check_error_message").empty();
$("#check_error_message").append("<span>" + data['message'] + "</span>");
}
},
"json"
);
}
</script>

View File

@ -127,7 +127,7 @@ else {
$disable_user = get_parameter ("disable_user", false); $disable_user = get_parameter ("disable_user", false);
if (isset ($_GET["user_del"])) { //delete user if (isset ($_GET["user_del"]) && isset ($_GET["delete_user"])) { //delete user
$id_user = get_parameter ("delete_user", 0); $id_user = get_parameter ("delete_user", 0);
// Only allow delete user if is not the actual user // Only allow delete user if is not the actual user
if ($id_user != $config['id_user']) { if ($id_user != $config['id_user']) {
@ -197,16 +197,17 @@ elseif ($disable_user !== false) { //disable_user
else { else {
$result = false; $result = false;
} }
if($result != null){
if ($disable_user == 1) { if ($disable_user == 1) {
ui_print_result_message ($result, ui_print_result_message ($result,
__('Successfully disabled'), __('Successfully disabled'),
__('There was a problem disabling user')); __('There was a problem disabling user'));
} }
else { else {
ui_print_result_message ($result, ui_print_result_message ($result,
__('Successfully enabled'), __('Successfully enabled'),
__('There was a problem enabling user')); __('There was a problem enabling user'));
}
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -122,19 +122,64 @@ if ($perform_event_response) {
global $config; global $config;
$command = get_parameter('target',''); $command = get_parameter('target','');
$response_id = get_parameter ('response_id');
switch (PHP_OS) {
case "FreeBSD": $event_response = db_get_row('tevent_response','id',$response_id);
$timeout_bin = '/usr/local/bin/gtimeout';
break; if (enterprise_installed()) {
case "NetBSD": if ($event_response['server_to_exec'] != 0 && $event_response['type'] == 'command') {
$timeout_bin = '/usr/pkg/bin/gtimeout'; $commandExclusions = array ('vi', 'vim', 'nano');
break;
default: $server_data = db_get_row('tserver','id_server', $event_response['server_to_exec']);
$timeout_bin = '/usr/bin/timeout';
break; if (in_array(strtolower($command),$commandExclusions)) {
echo "Only stdin/stdout commands are supported";
}
else {
switch (PHP_OS) {
case "FreeBSD":
$timeout_bin = '/usr/local/bin/gtimeout';
break;
case "NetBSD":
$timeout_bin = '/usr/pkg/bin/gtimeout';
break;
default:
$timeout_bin = '/usr/bin/timeout';
break;
}
echo system("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . $timeout_bin . " 90 " . io_safe_output($command) . " 2>&1\"", $ret_val);
}
}
else {
switch (PHP_OS) {
case "FreeBSD":
$timeout_bin = '/usr/local/bin/gtimeout';
break;
case "NetBSD":
$timeout_bin = '/usr/pkg/bin/gtimeout';
break;
default:
$timeout_bin = '/usr/bin/timeout';
break;
}
echo system($timeout_bin . ' 90 '.io_safe_output($command).' 2>&1');
}
}
else {
switch (PHP_OS) {
case "FreeBSD":
$timeout_bin = '/usr/local/bin/gtimeout';
break;
case "NetBSD":
$timeout_bin = '/usr/pkg/bin/gtimeout';
break;
default:
$timeout_bin = '/usr/bin/timeout';
break;
}
echo system($timeout_bin . ' 90 '.io_safe_output($command).' 2>&1');
} }
echo system($timeout_bin . ' 9 '.io_safe_output($command).' 2>&1');
return; return;
} }
@ -162,7 +207,7 @@ if ($dialogue_event_response) {
echo "<br><div id='response_out' style='text-align:left'></div>"; echo "<br><div id='response_out' style='text-align:left'></div>";
echo "<br><div id='re_exec_command' style='display:none;'>"; echo "<br><div id='re_exec_command' style='display:none;'>";
html_print_button(__('Execute again'),'btn_str',false,'perform_response(\''.$command.'\');', "class='sub next'"); html_print_button(__('Execute again'),'btn_str',false,'perform_response(\''.$command.'\', ' . $response_id . ');', "class='sub next'");
echo "</div>"; echo "</div>";
break; break;
case 'url': case 'url':

View File

@ -162,12 +162,12 @@ if ($get_graphs){
tagente_modulo WHERE id_agente_modulo = ". $value['id_agent_module']); tagente_modulo WHERE id_agente_modulo = ". $value['id_agent_module']);
$sql_alias = db_get_all_rows_sql("SELECT alias from tagente $sql_alias = db_get_all_rows_sql("SELECT alias from tagente
WHERE id_agente = ". $sql_modulo[0]['id_agente']); WHERE id_agente = ". $sql_modulo[0]['id_agente']);
$table .= "<div style='width: 800px'><h4>AGENT " .$sql_alias[0]['alias']." MODULE ".$sql_modulo[0]['nombre']."</h4><hr></div>"; $table .= "<div style='width: 90%'><h4>AGENT " .$sql_alias[0]['alias']." MODULE ".$sql_modulo[0]['nombre']."</h4><hr></div>";
$table .= grafico_modulo_sparse( $table .= grafico_modulo_sparse(
$value['id_agent_module'], $value['id_agent_module'],
$value['time_lapse'], $value['time_lapse'],
0, 0,
800, 1000,
300, 300,
'', '',
'', '',
@ -225,11 +225,11 @@ if ($get_graphs){
} else { } else {
$height = 300; $height = 300;
} }
$table .= "<div style='width: 800px'><h4>CUSTOM GRAPH ".$graph[0]['name']."</h4><hr></div>"; $table .= "<div style='width: 90%'><h4>".$graph[0]['name']."</h4><hr></div>";
$table .= graphic_combined_module($modules, $table .= graphic_combined_module($modules,
$weights, $weights,
$value['time_lapse'], $value['time_lapse'],
800, 1000,
$height, $height,
'', '',
'', '',
@ -259,8 +259,10 @@ if ($get_graphs){
} }
break; break;
case 'dynamic_graph': case 'dynamic_graph':
$alias = " AND alias like '%".io_safe_output($value['agent'])."%'"; if($value['agent'] != ''){
$alias = " AND alias REGEXP '".$value['agent']."'";
}
if($value['id_group'] === '0'){ if($value['id_group'] === '0'){
$id_group = ""; $id_group = "";
} else { } else {
@ -281,8 +283,10 @@ if ($get_graphs){
$id_tag = " AND ttag_module.id_tag = ".$value['id_tag']; $id_tag = " AND ttag_module.id_tag = ".$value['id_tag'];
} }
$module_name = " AND nombre like '%".io_safe_output($value['module'])."%'"; if($value['module'] != ''){
$module_name = " AND nombre REGEXP '".$value['module']."'";
}
$id_agent_module = db_get_all_rows_sql("SELECT tagente_modulo.id_agente_modulo FROM tagente_modulo $id_agent_module = db_get_all_rows_sql("SELECT tagente_modulo.id_agente_modulo FROM tagente_modulo
". $tag . "WHERE 1=1" . $id_module_group . $module_name . ". $tag . "WHERE 1=1" . $id_module_group . $module_name .
" AND id_agente IN (SELECT id_agente FROM tagente WHERE 1=1" .$alias.$id_group.")" " AND id_agente IN (SELECT id_agente FROM tagente WHERE 1=1" .$alias.$id_group.")"
@ -296,13 +300,13 @@ if ($get_graphs){
$sql_alias2 = db_get_all_rows_sql("SELECT alias from tagente $sql_alias2 = db_get_all_rows_sql("SELECT alias from tagente
WHERE id_agente = ". $sql_modulo2[0]['id_agente']); WHERE id_agente = ". $sql_modulo2[0]['id_agente']);
$table .= "<div style='width: 800px'><h4>AGENT " .$sql_alias2[0]['alias']." MODULE ".$sql_modulo2[0]['nombre']."</h4><hr></div>"; $table .= "<div style='width: 90%'><h4>AGENT " .$sql_alias2[0]['alias']." MODULE ".$sql_modulo2[0]['nombre']."</h4><hr></div>";
$table .= grafico_modulo_sparse( $table .= grafico_modulo_sparse(
$value2['id_agente_modulo'], $value2['id_agente_modulo'],
$value['time_lapse'], $value['time_lapse'],
0, 0,
800, 1000,
300, 300,
'', '',
'', '',

View File

@ -38,9 +38,7 @@ $get_agent_modules_json_by_name = (bool) get_parameter('get_agent_modules_json_b
if ($get_agent_modules_json_by_name) { if ($get_agent_modules_json_by_name) {
$agent_name = get_parameter('agent_name'); $agent_id = get_parameter('id_agent');
$agent_id = agents_get_agent_id($agent_name);
$agent_modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo $agent_modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
WHERE id_agente = " . $agent_id); WHERE id_agente = " . $agent_id);
@ -739,7 +737,7 @@ if ($list_modules) {
$table->head[5] = __('Status') . ' ' . $table->head[5] = __('Status') . ' ' .
'<a href="' . $url . '&sort_field=status&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectStatusUp, "alt" => "up")) . '</a>' . '<a href="' . $url . '&sort_field=status&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectStatusUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=status&amp;sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . '</a>'; '<a href="' . $url . '&sort_field=status&amp;sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . '</a>';
$table->head[6] = __('Warn'); $table->head[6] = __('Thresholds');
$table->head[7] = __('Data'); $table->head[7] = __('Data');
$table->head[8] = __('Graph'); $table->head[8] = __('Graph');
$table->head[9] = __('Last contact') . ' ' . $table->head[9] = __('Last contact') . ' ' .

View File

@ -95,6 +95,7 @@ $top = get_parameter('top', null);
$agent = get_parameter('agent', null); $agent = get_parameter('agent', null);
$id_module = get_parameter('module', null); $id_module = get_parameter('module', null);
$period = get_parameter('period', null); $period = get_parameter('period', null);
$event_max_time_row = get_parameter('event_max_time_row', null);
$width = get_parameter('width', null); $width = get_parameter('width', null);
$height = get_parameter('height', null); $height = get_parameter('height', null);
$parent = get_parameter('parent', null); $parent = get_parameter('parent', null);
@ -139,7 +140,39 @@ switch ($action) {
echo json_encode($return); echo json_encode($return);
break; break;
case 'get_module_events':
$data = array ();
$date = get_system_time ();
$datelimit = $date - $event_max_time_row;
$events = db_get_row_filter ('tevento',
array ('id_agente' => $id_agent,
'id_agentmodule' => $id_module,
'utimestamp > ' . $datelimit,
'utimestamp < ' . $date), 'criticity, utimestamp');
$return = array();
if (!$events) {
$return['no_data'] = true;
if (!empty($id_metaconsole)) {
$connection = db_get_row_filter ('tmetaconsole_setup',
$id_metaconsole);
if (metaconsole_load_external_db($connection) != NOERR) {
continue;
}
}
$return['url'] = true;
if (!empty($id_metaconsole)) {
metaconsole_restore_db();
}
}
else {
$return['no_data'] = false;
}
echo json_encode($return);
break;
case 'get_image_sparse': case 'get_image_sparse':
//Metaconsole db connection //Metaconsole db connection
@ -430,6 +463,7 @@ switch ($action) {
case 'module_graph': case 'module_graph':
case 'label': case 'label':
case 'icon': case 'icon':
case 'auto_sla_graph':
default: default:
if ($type == 'label') { if ($type == 'label') {
$values['type'] = LABEL; $values['type'] = LABEL;
@ -504,6 +538,18 @@ switch ($action) {
$values['border_color'] = $line_color; $values['border_color'] = $line_color;
break; break;
// ------------------------------------------------- // -------------------------------------------------
case 'auto_sla_graph':
$values['type'] = AUTO_SLA_GRAPH;
if ($event_max_time_row !== null) {
$values['period'] = $event_max_time_row;
}
if ($width !== null) {
$values['width'] = $width;
}
if ($height !== null) {
$values['height'] = $height;
}
break;
case 'box_item': case 'box_item':
$values['border_width'] = $border_width; $values['border_width'] = $border_width;
$values['border_color'] = $border_color; $values['border_color'] = $border_color;
@ -622,7 +668,7 @@ switch ($action) {
if (($item_in_db['parent_item'] == 0) && ($values['parent_item'] != 0)) { if (($item_in_db['parent_item'] == 0) && ($values['parent_item'] != 0)) {
$new_line = 1; $new_line = 1;
} }
$result = db_process_sql_update('tlayout_data', $values, $result = db_process_sql_update('tlayout_data', $values,
array('id' => $id_element)); array('id' => $id_element));
@ -659,6 +705,7 @@ switch ($action) {
case 'simple_value': case 'simple_value':
case 'label': case 'label':
case 'icon': case 'icon':
case 'auto_sla_graph':
$elementFields = db_get_row_filter('tlayout_data', $elementFields = db_get_row_filter('tlayout_data',
array('id' => $id_element)); array('id' => $id_element));
@ -710,6 +757,8 @@ switch ($action) {
} }
switch ($type) { switch ($type) {
case 'auto_sla_graph':
$elementFields['event_max_time_row'] = $elementFields['period'];
case 'percentile_item': case 'percentile_item':
case 'percentile_bar': case 'percentile_bar':
$elementFields['width_percentile'] = $elementFields['width']; $elementFields['width_percentile'] = $elementFields['width'];
@ -869,6 +918,12 @@ switch ($action) {
} }
$values['period'] = $period; $values['period'] = $period;
break; break;
case 'auto_sla_graph':
$values['type'] = AUTO_SLA_GRAPH;
$values['period'] = $event_max_time_row;
$values['width'] = $width;
$values['height'] = $height;
break;
case 'percentile_item': case 'percentile_item':
case 'percentile_bar': case 'percentile_bar':
if ($type_percentile == 'percentile') { if ($type_percentile == 'percentile') {
@ -985,8 +1040,6 @@ switch ($action) {
echo json_encode($return); echo json_encode($return);
break; break;
case 'delete': case 'delete':
if (db_process_sql_delete('tlayout_data', array('id' => $id_element, 'id_layout' => $id_visual_console)) === false) { if (db_process_sql_delete('tlayout_data', array('id' => $id_element, 'id_layout' => $id_visual_console)) === false) {
$return['correct'] = 0; $return['correct'] = 0;

View File

@ -645,15 +645,26 @@ function ldap_process_user_login ($login, $password) {
} }
} }
$ldap_login_attr = isset($config["ldap_login_attr"]) ? io_safe_output($config["ldap_login_attr"]) . "=" : ''; $ldap_login_attr = !empty($config["ldap_login_attr"]) ? io_safe_output($config["ldap_login_attr"]) . "=" : '';
$ldap_base_dn = isset($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : ''; $ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
if (strlen($password) == 0 || if(!empty($ldap_base_dn)){
if (strlen($password) == 0 ||
!@ldap_bind($ds, $ldap_login_attr.io_safe_output($login).$ldap_base_dn, $password) ) {
html_debug("entra1",true);
$config["auth_error"] = 'User not found in database or incorrect password';
@ldap_close ($ds);
return false;
}
} else {
if (strlen($password) == 0 ||
!@ldap_bind($ds, io_safe_output($login), $password) ) { !@ldap_bind($ds, io_safe_output($login), $password) ) {
$config["auth_error"] = 'User not found in database or incorrect password'; $config["auth_error"] = 'User not found in database or incorrect password';
@ldap_close ($ds); @ldap_close ($ds);
return false; return false;
}
} }
@ldap_close ($ds); @ldap_close ($ds);

View File

@ -22,8 +22,8 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC170719'; $build_version = 'PC170831';
$pandora_version = 'v7.0NG.707'; $pandora_version = 'v7.0NG.711';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get(); $script_tz = @date_default_timezone_get();

View File

@ -185,6 +185,7 @@ define('AGENT_STATUS_WARNING', 2);
define('STATIC_GRAPH', 0); define('STATIC_GRAPH', 0);
define('PERCENTILE_BAR', 3); define('PERCENTILE_BAR', 3);
define('MODULE_GRAPH', 1); define('MODULE_GRAPH', 1);
define('AUTO_SLA_GRAPH', 14);
define('SIMPLE_VALUE', 2); define('SIMPLE_VALUE', 2);
define('LABEL', 4); define('LABEL', 4);
define('ICON', 5); define('ICON', 5);

View File

@ -1506,7 +1506,7 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '',
$snmp3_auth_user = '', $snmp3_security_level = '', $snmp3_auth_user = '', $snmp3_security_level = '',
$snmp3_auth_method = '', $snmp3_auth_pass = '', $snmp3_auth_method = '', $snmp3_auth_pass = '',
$snmp3_privacy_method = '', $snmp3_privacy_pass = '', $snmp3_privacy_method = '', $snmp3_privacy_pass = '',
$quick_print = 0, $base_oid = "", $snmp_port = '') { $quick_print = 0, $base_oid = "", $snmp_port = '', $server_to_exec = 0) {
global $config; global $config;
@ -1598,7 +1598,18 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '',
break; break;
} }
exec($command_str, $output, $rc); if (enterprise_installed()) {
if ($server_to_exec != 0) {
$server_data = db_get_row('tserver','id_server', $server_to_exec);
exec("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . $command_str . "\"", $output, $rc);
}
else {
exec($command_str, $output, $rc);
}
}
else {
exec($command_str, $output, $rc);
}
// Parse the output of snmpwalk // Parse the output of snmpwalk
$snmpwalk = array(); $snmpwalk = array();
@ -1701,7 +1712,7 @@ function check_sql ($sql) {
//Check that it not delete_ as "delete_pending" (this is a common field in pandora tables). //Check that it not delete_ as "delete_pending" (this is a common field in pandora tables).
if (preg_match("/\*|delete[^_]|drop|alter|modify|union|password|pass|insert|update/i", $sql)) { if (preg_match("/\*|delete[^_]|drop|alter|modify|password|pass|insert|update/i", $sql)) {
return ""; return "";
} }
return $sql; return $sql;
@ -1796,26 +1807,6 @@ function check_acl($id_user, $id_group, $access, $onlyOneGroup = false) {
$id_group = (int) $id_group; $id_group = (int) $id_group;
} }
if($_SESSION['check_acl'] != null){
if (empty ($_SESSION['check_acl']))
return 0;
$result = 0;
$acl_column = get_acl_column($access);
foreach ($_SESSION['check_acl'] as $row) {
// For each profile for this pair of group and user do...
if (isset($row[$acl_column])) {
$result += $row[$acl_column];
}
}
if ($result >= 1) {
return 1;
}
return 0;
}
$parents_id = array($id_group); $parents_id = array($id_group);
if ($id_group != 0 && $onlyOneGroup !== true) { if ($id_group != 0 && $onlyOneGroup !== true) {
$group = db_get_row_filter('tgrupo', array('id_grupo' => $id_group)); $group = db_get_row_filter('tgrupo', array('id_grupo' => $id_group));
@ -1864,13 +1855,8 @@ function check_acl($id_user, $id_group, $access, $onlyOneGroup = false) {
OR tusuario_perfil.id_grupo = 0)", $id_user, implode(', ', $parents_id)); OR tusuario_perfil.id_grupo = 0)", $id_user, implode(', ', $parents_id));
} }
$rowdup = db_get_all_rows_sql ($query); $rowdup = db_get_all_rows_sql ($query);
$_SESSION['check_acl'] = $rowdup;
if (empty ($rowdup)) if (empty ($rowdup))
return 0; return 0;
@ -2779,4 +2765,14 @@ function remove_right_zeros ($value) {
} }
} }
function register_pass_change_try ($id_user, $success) {
$values = array();
$values['id_user'] = $id_user;
$reset_pass_moment = new DateTime('now');
$reset_pass_moment = $reset_pass_moment->format("Y-m-d H:i:s");
$values['reset_moment'] = $reset_pass_moment;
$values['success'] = $success;
db_process_sql_insert('treset_pass_history', $values);
}
?> ?>

View File

@ -9112,8 +9112,9 @@ function api_set_create_event($id, $trash1, $other, $returnType) {
* http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_event_comment&id=event_id&other=string|&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora * http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_event_comment&id=event_id&other=string|&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
*/ */
function api_set_add_event_comment($id, $thrash2, $other, $thrash3) { function api_set_add_event_comment($id, $thrash2, $other, $thrash3) {
$meta = false;
if (defined ('METACONSOLE')) { if (defined ('METACONSOLE')) {
return; $meta = true;
} }
if ($other['type'] == 'string') { if ($other['type'] == 'string') {
@ -9122,11 +9123,9 @@ function api_set_add_event_comment($id, $thrash2, $other, $thrash3) {
} }
else if ($other['type'] == 'array') { else if ($other['type'] == 'array') {
$comment = io_safe_input($other['data'][0]); $comment = io_safe_input($other['data'][0]);
$meta = $other['data'][1];
$history = $other['data'][2]; $history = $other['data'][2];
$status = events_comment($id, $comment, 'Added comment', $meta, $status = events_comment($id, $comment, 'Added comment', $meta, $history);
$history);
if (is_error($status)) { if (is_error($status)) {
returnError('error_add_event_comment', returnError('error_add_event_comment',
__('Error adding event comment.')); __('Error adding event comment.'));
@ -9556,6 +9555,257 @@ function api_set_create_special_day($thrash1, $thrash2, $other, $thrash3) {
} }
} }
/**
* Create a service and return service id.
*
* @param $thrash1 Don't use.
* @param $thrash2 Don't use.
* @param array $other it's array, $other as param is <description>;<id_group>;<critical>;
* <warning>;<id_agent>;<sla_interval>;<sla_limit>;<id_warning_module_template_alert>;
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;
* in this order and separator char (after text ; ) and separator
* (pass in param othermode as othermode=url_encode_separator_<separator>)
* @param $thrash3 Don't use
*
* example:
* http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_service&return_type=json
* &other=test1%7CDescripcion de prueba%7C12%7C1%7C0.5%7C1&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
*/
function api_set_create_service($thrash1, $thrash2, $other, $thrash3) {
$name = $other['data'][0];
$description = $other['data'][1];
$id_group = $other['data'][2];
$critical = $other['data'][3];
$warning = $other['data'][4];
$mode = 0;
$id_agent = $other['data'][5];
$sla_interval = $other['data'][6];
$sla_limit = $other['data'][7];
$id_warning_module_template = $other['data'][8];
$id_critical_module_template = $other['data'][9];
$id_unknown_module_template = 0;
$id_critical_module_sla = $other['data'][10];
if(empty($name)){
returnError('error_create_service', __('Error in creation service. No name'));
return;
}
if(empty($id_group)){
// By default applications
$id_group = 12;
}
if(empty($critical)){
$critical = 1;
}
if(empty($warning)){
$warning = 0.5;
}
if(empty($id_agent)){
returnError('error_create_service', __('Error in creation service. No agent id'));
return;
}
if(empty($sla_interval)){
// By default one month
$sla_interval = 2592000;
}
if(empty($sla_limit)){
$sla_limit = 95;
}
if(empty($id_warning_module_template)){
$id_warning_module_template = 0;
}
if(empty($id_critical_module_template)){
$id_critical_module_template = 0;
}
if(empty($id_critical_module_sla)){
$id_critical_module_sla = 0;
}
$result = services_create_service ($name, $description, $id_group,
$critical, $warning, SECONDS_5MINUTES, $mode, $id_agent, $sla_interval, $sla_limit,
$id_warning_module_template, $id_critical_module_template,
$id_unknown_module_template, $id_critical_module_sla);
if($result){
returnData('string', array('type' => 'string', 'data' => $result));
} else {
returnError('error_create_service', __('Error in creation service'));
}
}
/**
* Update a service.
*
* @param $thrash1 service id.
* @param $thrash2 Don't use.
* @param array $other it's array, $other as param is <name>;<description>;<id_group>;<critical>;
* <warning>;<id_agent>;<sla_interval>;<sla_limit>;<id_warning_module_template_alert>;
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;
* in this order and separator char (after text ; ) and separator
* (pass in param othermode as othermode=url_encode_separator_<separator>)
* @param $thrash3 Don't use
*
* example:
* http://172.17.0.1/pandora_console/include/api.php?op=set&op2=update_service&return_type=json
* &id=4&other=test2%7CDescripcion%7C%7C%7C0.6%7C&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
*
*/
function api_set_update_service($thrash1, $thrash2, $other, $thrash3) {
$id_service = $thrash1;
if(empty($id_service)){
returnError('error_update_service', __('Error in update service. No service id'));
return;
}
$service = db_get_row('tservice',
'id', $id_service);
$name = $other['data'][0];
if(empty($name)){
$name = $service['name'];
}
$description = $other['data'][1];
if(empty($description)){
$description = $service['description'];
}
$id_group = $other['data'][2];
if(empty($id_group)){
$id_group = $service['id_group'];
}
$critical = $other['data'][3];
if(empty($critical)){
$critical = $service['critical'];
}
$warning = $other['data'][4];
if(empty($warning)){
$warning = $service['warning'];
}
$mode = 0;
$id_agent = $other['data'][5];
if(empty($id_agent)){
$id_agent = $service['id_agent_module'];
}
$sla_interval = $other['data'][6];
if(empty($sla_interval)){
$sla_interval = $service['sla_interval'];
}
$sla_limit = $other['data'][7];
if(empty($sla_limit)){
$sla_limit = $service['sla_limit'];
}
$id_warning_module_template = $other['data'][8];
if(empty($id_warning_module_template)){
$id_warning_module_template = $service['id_template_alert_warning'];
}
$id_critical_module_template = $other['data'][9];
if(empty($id_critical_module_template)){
$id_critical_module_template = $service['id_template_alert_critical'];
}
$id_unknown_module_template = 0;
$id_critical_module_sla = $other['data'][10];
if(empty($id_critical_module_sla)){
$id_critical_module_sla = $service['id_template_alert_critical_sla'];
}
$result = services_update_service ($id_service, $name,$description, $id_group, $critical, $warning,
SECONDS_5MINUTES, $mode, $id_agent,$sla_interval, $sla_limit,$id_warning_module_template,
$id_critical_module_template,$id_unknown_module_template,$id_critical_module_sla);
if($result){
returnData('string', array('type' => 'string', 'data' => $result));
} else {
returnError('error_update_service', __('Error in update service'));
}
}
/**
* Add elements to service.
*
* @param $thrash1 service id.
* @param $thrash2 Don't use.
* @param array $other it's a json, $other as param is <description>;<id_group>;<critical>;
* <warning>;<id_agent>;<sla_interval>;<sla_limit>;<id_warning_module_template_alert>;
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;
* in this order and separator char (after text ; ) and separator
* (pass in param othermode as othermode=url_encode_separator_<separator>)
* @param $thrash3 Don't use
*
* example:
* http://172.17.0.1/pandora_console/include/api.php?op=set&op2=add_element_service&return_type=json&id=1
* &other=W3sidHlwZSI6ImFnZW50IiwiaWQiOjIsImRlc2NyaXB0aW9uIjoiamlqaWppIiwid2VpZ2h0X2NyaXRpY2FsIjowLCJ3ZWlnaHRfd2FybmluZyI6MCwid2VpZ2h0X3Vua25vd24iOjAsIndlaWdodF9vayI6MH0seyJ0eXBlIjoibW9kdWxlIiwiaWQiOjEsImRlc2NyaXB0aW9uIjoiSG9sYSBxdWUgdGFsIiwid2VpZ2h0X2NyaXRpY2FsIjowLCJ3ZWlnaHRfd2FybmluZyI6MCwid2VpZ2h0X3Vua25vd24iOjAsIndlaWdodF9vayI6MH0seyJ0eXBlIjoic2VydmljZSIsImlkIjozLCJkZXNjcmlwdGlvbiI6ImplamVqZWplIiwid2VpZ2h0X2NyaXRpY2FsIjowLCJ3ZWlnaHRfd2FybmluZyI6MCwid2VpZ2h0X3Vua25vd24iOjAsIndlaWdodF9vayI6MH1d
* &other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
*
*/
function api_set_add_element_service($thrash1, $thrash2, $other, $thrash3) {
$id = $thrash1;
if(empty($id)){
returnError('error_add_service_element', __('Error adding elements to service. No service id'));
return;
}
$array_json = json_decode(base64_decode(io_safe_output($other['data'][0])), true);
if(!empty($array_json)){
$results = false;
foreach ($array_json as $key => $element) {
if($element['id'] == 0){
continue;
}
switch ($element['type']) {
case 'agent':
$id_agente_modulo = 0;
$id_service_child = 0;
$agent_id = $element['id'];
break;
case 'module':
$agent_id = 0;
$id_service_child = 0;
$id_agente_modulo = $element['id'];
break;
case 'service':
$agent_id = 0;
$id_agente_modulo = 0;
$id_service_child = $element['id'];
break;
}
$values = array(
'id_agente_modulo' => $id_agente_modulo,
'description' => $element['description'],
'id_service' => $id,
'weight_critical' => $element['weight_critical'],
'weight_warning' => $element['weight_warning'],
'weight_unknown' => $element['weight_unknown'],
'weight_ok' => $element['weight_ok'],
'id_agent' => $agent_id,
'id_service_child' => $id_service_child,
'id_server_meta' => 0);
$result = db_process_sql_insert('tservice_element',$values);
if($result && !$results){
$results = $result;
}
}
}
if($results){
returnData('string', array('type' => 'string', 'data' => 1));
} else {
returnError('error_add_service_element', __('Error adding elements to service'));
}
}
/** /**
* Update a special day. And return a message with the result of the operation. * Update a special day. And return a message with the result of the operation.
* *
@ -9690,7 +9940,14 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) {
$other['data'][0] $other['data'][0]
: :
SECONDS_1HOUR; // 1 hour by default SECONDS_1HOUR; // 1 hour by default
$graph_threshold =
(!empty($other) && isset($other['data'][2]))
?
$other['data'][2]
:
0;
if (is_nan($graph_seconds) || $graph_seconds <= 0) { if (is_nan($graph_seconds) || $graph_seconds <= 0) {
// returnError('error_module_graph', __('')); // returnError('error_module_graph', __(''));
return; return;
@ -9701,41 +9958,44 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) {
$id_module, $graph_seconds, false, 600, 300, '', $id_module, $graph_seconds, false, 600, 300, '',
'', false, false, true, time(), '', 0, 0, true, true, '', false, false, true, time(), '', 0, 0, true, true,
ui_get_full_url(false) . '/', 1, false, '', false, true, ui_get_full_url(false) . '/', 1, false, '', false, true,
true, 'white', null, false, false, $config['type_module_charts']); true, 'white', null, false, false, $config['type_module_charts'],
false, false);
$graph_image_file_encoded = false; $graph_image_file_encoded = false;
if (preg_match("/<img src='(.+)'./", $graph_html, $matches)) { if (preg_match("/<img src='(.+)'./", $graph_html, $matches)) {
$file_url = $matches[1]; $file_url = $matches[1];
if (preg_match("/\?(.+)&(.+)&(.+)&(.+)/", $file_url,$parameters)) { if (preg_match("/\?(.+)&(.+)&(.+)&(.+)/", $file_url,$parameters)) {
array_shift ($parameters); array_shift ($parameters);
foreach ($parameters as $parameter){ foreach ($parameters as $parameter){
$value = explode ("=",$parameter); $value = explode ("=",$parameter);
if (strcmp($value[0], "static_graph") == 0){ if (strcmp($value[0], "static_graph") == 0){
$static_graph = $value[1]; $static_graph = $value[1];
} }
elseif (strcmp($value[0], "graph_type") == 0){ elseif (strcmp($value[0], "graph_type") == 0){
$graph_type = $value[1]; $graph_type = $value[1];
} }
elseif (strcmp($value[0], "ttl") == 0){ elseif (strcmp($value[0], "ttl") == 0){
$ttl = $value[1]; $ttl = $value[1];
} }
elseif (strcmp($value[0], "id_graph") == 0){ elseif (strcmp($value[0], "id_graph") == 0){
$id_graph = $value[1]; $id_graph = $value[1];
} }
}
} }
}
} }
// Check values are OK // Check values are OK
if ( (isset ($graph_type)) if ( (isset ($graph_type))
&& (isset ($ttl)) && (isset ($ttl))
&& (isset ($id_graph))) { && (isset ($id_graph))) {
$_GET["ttl"] = $ttl; $_GET["ttl"] = $ttl;
$_GET["id_graph"] = $id_graph; $_GET["id_graph"] = $id_graph;
$_GET["graph_type"] = $graph_type; $_GET["graph_type"] = $graph_type;
$_GET["static_graph"] = $static_graph; $_GET["static_graph"] = $static_graph;
$_GET["graph_threshold"] = $graph_threshold;
$_GET["id_module"] = $id_module;
} }
ob_start(); ob_start();

View File

@ -1653,6 +1653,10 @@ function config_process_config () {
config_update_value ('command_snapshot', 1); config_update_value ('command_snapshot', 1);
} }
if (!isset($config['custom_report_info'])) {
config_update_value ('custom_report_info', 1);
}
// Juanma (06/05/2014) New feature: Custom front page for reports // Juanma (06/05/2014) New feature: Custom front page for reports
if (!isset($config['custom_report_front'])) { if (!isset($config['custom_report_front'])) {
config_update_value ('custom_report_front', 0); config_update_value ('custom_report_front', 0);

View File

@ -2115,7 +2115,7 @@ function events_page_details ($event, $server = "") {
"type" => $graph_type, "type" => $graph_type,
"period" => SECONDS_1DAY, "period" => SECONDS_1DAY,
"id" => $module["id_agente_modulo"], "id" => $module["id_agente_modulo"],
"label" => rawurlencode(urlencode(base64_encode($module["nombre"]))), "label" => base64_encode($module["nombre"]),
"refresh" => SECONDS_10MINUTES "refresh" => SECONDS_10MINUTES
); );
@ -2350,6 +2350,8 @@ function events_page_general ($event) {
} }
$table_general->data[] = $data; $table_general->data[] = $data;
$event["owner_user"] = $event["id_usuario"];
$data = array(); $data = array();
$data[0] = __('Owner'); $data[0] = __('Owner');
if (empty($event["owner_user"])) { if (empty($event["owner_user"])) {

View File

@ -1092,25 +1092,25 @@ function graphic_combined_module ($module_list, $weight_list, $period,
// Set the title and time format // Set the title and time format
if ($temp_range <= SECONDS_1DAY) { if ($temp_range <= SECONDS_1DAY) {
$time_format = 'd.m.Y H:i:s'; $time_format = 'Y M d H:i:s';
} }
elseif ($temp_range < SECONDS_15DAYS) { elseif ($temp_range < SECONDS_15DAYS) {
$time_format = 'M d'; $time_format = 'Y M d';
$time_format_2 = 'H:i'; $time_format_2 = 'H:i';
if ($projection != false) { if ($projection != false) {
$time_format_2 = 'H\h'; $time_format_2 = 'H\h';
} }
} }
elseif ($temp_range <= SECONDS_1MONTH) { elseif ($temp_range <= SECONDS_1MONTH) {
$time_format = 'M d'; $time_format = 'Y M d';
$time_format_2 = 'H\h'; $time_format_2 = 'H\h';
} }
elseif ($temp_range <= SECONDS_1MONTH) { elseif ($temp_range <= SECONDS_1MONTH) {
$time_format = 'M d'; $time_format = 'Y M d';
$time_format_2 = 'H\h'; $time_format_2 = 'H\h';
} }
elseif ($period < SECONDS_6MONTHS) { elseif ($period < SECONDS_6MONTHS) {
$time_format = 'M d'; $time_format = 'Y M d';
$time_format_2 = 'H\h'; $time_format_2 = 'H\h';
} }
else { else {
@ -1382,7 +1382,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
// Calculate chart data // Calculate chart data
$last_known = $previous_data; $last_known = $previous_data;
for ($l = 0; $l < $resolution; $l++) {
for ($l = 0; $l <= $resolution; $l++) {
$countAvg ++; $countAvg ++;
$timestamp = $datelimit + ($interval * $l); $timestamp = $datelimit + ($interval * $l);
@ -1398,6 +1399,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
// Read data that falls in the current interval // Read data that falls in the current interval
$interval_min = $last_known; $interval_min = $last_known;
$interval_max = $last_known; $interval_max = $last_known;
while (isset ($data[$j]) && $data[$j]['utimestamp'] >= $timestamp && $data[$j]['utimestamp'] < ($timestamp + $interval)) { while (isset ($data[$j]) && $data[$j]['utimestamp'] >= $timestamp && $data[$j]['utimestamp'] < ($timestamp + $interval)) {
if ($data[$j]['datos'] > $interval_max) { if ($data[$j]['datos'] > $interval_max) {
$interval_max = $data[$j]['datos']; $interval_max = $data[$j]['datos'];
@ -3220,11 +3222,11 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
} }
else { else {
if ($meta) { if ($meta) {
$name = mb_substr (io_safe_output($row['agent_name']), 0, 14)." (".$row["count"].")"; $name = mb_substr (io_safe_output($row['agent_name']), 0, 25)." (".$row["count"].")";
} }
else { else {
$alias = agents_get_alias($row["id_agente"]); $alias = agents_get_alias($row["id_agente"]);
$name = mb_substr($alias, 0, 14)." #".$row["id_agente"]." (".$row["count"].")"; $name = mb_substr($alias, 0, 25)." #".$row["id_agente"]." (".$row["count"].")";
} }
$data[$name] = $row["count"]; $data[$name] = $row["count"];
} }
@ -3581,7 +3583,7 @@ function graph_custom_sql_graph ($id, $width, $height,
* @param string homeurl * @param string homeurl
* @param bool return or echo the result * @param bool return or echo the result
*/ */
function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false) { function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $from_agent_view = false) {
global $config; global $config;
global $graphic_type; global $graphic_type;
@ -3598,13 +3600,119 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
$data = array (); $data = array ();
$legend = array(); $legend = array();
$full_legend = array(); $full_legend = array();
$full_legend_date = array();
$cont = 0; $cont = 0;
for ($i = 0; $i < $interval; $i++) { for ($i = 0; $i < $interval; $i++) {
$bottom = $datelimit + ($periodtime * $i); $bottom = $datelimit + ($periodtime * $i);
if (! $graphic_type) { if (! $graphic_type) {
if ($config['flash_charts']) { if ($config['flash_charts']) {
$name = date('H:i', $bottom); $name = date('H:i:s', $bottom);
}
else {
$name = date('H\h', $bottom);
}
}
else {
$name = $bottom;
}
// Show less values in legend
if ($cont == 0 or $cont % 2)
$legend[$cont] = $name;
if ($from_agent_view) {
$full_date = date('Y/m/d', $bottom);
$full_legend_date[$cont] = $full_date;
}
$full_legend[$cont] = $name;
$top = $datelimit + ($periodtime * ($i + 1));
$event = db_get_row_filter ('tevento',
array ('id_agente' => $id_agent,
'utimestamp > '.$bottom,
'utimestamp < '.$top), 'criticity, utimestamp');
if (!empty($event['utimestamp'])) {
$data[$cont]['utimestamp'] = $periodtime;
switch ($event['criticity']) {
case EVENT_CRIT_WARNING:
$data[$cont]['data'] = 2;
break;
case EVENT_CRIT_CRITICAL:
$data[$cont]['data'] = 3;
break;
default:
$data[$cont]['data'] = 1;
break;
}
}
else {
$data[$cont]['utimestamp'] = $periodtime;
$data[$cont]['data'] = 1;
}
$cont++;
}
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
// Draw slicebar graph
if ($config['flash_charts']) {
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date);
}
else {
$out = slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
// Draw legend
$out .= "<br>";
$out .= "&nbsp;";
foreach ($legend as $hour) {
$out .= "<span style='font-size: 6pt'>" . $hour . "</span>";
$out .= "&nbsp;";
}
}
if ($return) {
return $out;
}
else {
echo $out;
}
}
/**
* Print a static graph with event data of agents
*
* @param integer id_agent Agent ID
* @param integer width pie graph width
* @param integer height pie graph height
* @param integer period time period
* @param string homeurl
* @param bool return or echo the result
*/
function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $period = 0, $homeurl, $return = false) {
global $config;
global $graphic_type;
$data = array ();
$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
$interval = (int) ($period / $resolution);
$date = get_system_time ();
$datelimit = $date - $period;
$periodtime = floor ($period / $interval);
$time = array ();
$data = array ();
$legend = array();
$full_legend = array();
$cont = 0;
for ($i = 0; $i < $interval; $i++) {
$bottom = $datelimit + ($periodtime * $i);
if (! $graphic_type) {
if ($config['flash_charts']) {
$name = date('H:i:s', $bottom);
} }
else { else {
$name = date('H\h', $bottom); $name = date('H\h', $bottom);
@ -3621,11 +3729,13 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
$full_legend[$cont] = $name; $full_legend[$cont] = $name;
$top = $datelimit + ($periodtime * ($i + 1)); $top = $datelimit + ($periodtime * ($i + 1));
$event = db_get_row_filter ('tevento', $event = db_get_row_filter ('tevento',
array ('id_agente' => $id_agent, array ('id_agente' => $id_agent,
'id_agentmodule' => $id_module,
'utimestamp > '.$bottom, 'utimestamp > '.$bottom,
'utimestamp < '.$top), 'criticity, utimestamp'); 'utimestamp < '.$top), 'criticity, utimestamp');
if (!empty($event['utimestamp'])) { if (!empty($event['utimestamp'])) {
$data[$cont]['utimestamp'] = $periodtime; $data[$cont]['utimestamp'] = $periodtime;
switch ($event['criticity']) { switch ($event['criticity']) {

View File

@ -1722,7 +1722,7 @@ function modules_get_agentmodule_data ($id_agent_module, $period,
break; break;
//log4x //log4x
case 24: case 24:
$sql = sprintf ("SELECT message AS data, utimestamp $sql = sprintf ("SELECT stacktrace AS data, utimestamp
FROM tagente_datos_log4x FROM tagente_datos_log4x
WHERE id_agente_modulo = %d WHERE id_agente_modulo = %d
AND utimestamp > %d AND utimestamp <= %d AND utimestamp > %d AND utimestamp <= %d
@ -2597,4 +2597,4 @@ function recursive_get_dt_from_modules_tree (&$f_modules, $modules, $deep) {
} }
} }
?> ?>

View File

@ -128,26 +128,6 @@ function reporting_make_reporting_data($report = null, $id_report,
$content['period'] = $period; $content['period'] = $period;
} }
if(defined('METACONSOLE')){
if (is_array($content['id_agent'])) {
$new_array = array();
foreach ($content['id_agent'] as $key => $value) {
$meta_id = explode("|",$value);
array_push($new_array,$meta_id[1]);
}
$content['id_agent'] = $new_array;
}
else {
$meta_id = explode("|",$content['id_agent']);
if ($meta_id[1] != null) {
$content['id_agent'] = array();
$content['id_agent'] = $meta_id[1];
}
}
}
$content['style'] = json_decode(io_safe_output($content['style']), true); $content['style'] = json_decode(io_safe_output($content['style']), true);
if(isset($content['style']['name_label'])){ if(isset($content['style']['name_label'])){
//Add macros name //Add macros name
@ -166,19 +146,17 @@ function reporting_make_reporting_data($report = null, $id_report,
continue; continue;
} }
} }
if(sizeof($content['id_agent']) != 1){
$content['style']['name_label'] = str_replace("_agent_",sizeof($content['id_agent']).__(' agents'),$content['style']['name_label']);
}
if(sizeof($content['id_agent_module']) != 1){
$content['style']['name_label'] = str_replace("_module_",sizeof($content['id_agent_module']).__(' modules'),$content['style']['name_label']);
}
$content['name'] = reporting_label_macro($items_label, $content['style']['name_label']);
if(sizeof($content['id_agent']) != 1){
$content['style']['name_label'] = str_replace("_agent_",sizeof($content['id_agent']).__(' agents'),$content['style']['name_label']);
}
if(sizeof($content['id_agent_module']) != 1){
$content['style']['name_label'] = str_replace("_module_",sizeof($content['id_agent_module']).__(' modules'),$content['style']['name_label']);
}
$content['name'] = reporting_label_macro($items_label, $content['style']['name_label']);
if ($metaconsole_on) { if ($metaconsole_on) {
//Restore db connection //Restore db connection
@ -2469,7 +2447,14 @@ function reporting_database_serialized($report, $content) {
$return['agent_name'] = $agent_name; $return['agent_name'] = $agent_name;
$return['module_name'] = $module_name; $return['module_name'] = $module_name;
if ($config['metaconsole']) {
$id_meta = metaconsole_get_id_server($content["server_name"]);
$server = metaconsole_get_connection_by_id ($id_meta);
metaconsole_connect($server);
}
$datelimit = $report["datetime"] - $content['period']; $datelimit = $report["datetime"] - $content['period'];
$search_in_history_db = db_search_in_history_db($datelimit); $search_in_history_db = db_search_in_history_db($datelimit);
@ -2545,6 +2530,10 @@ function reporting_database_serialized($report, $content) {
$data[] = $row; $data[] = $row;
} }
} }
if ($config['metaconsole']) {
metaconsole_restore_db();
}
$return["data"] = $data; $return["data"] = $data;
@ -4002,7 +3991,7 @@ function reporting_sql($report, $content) {
} }
else { else {
$return['correct'] = 0; $return['correct'] = 0;
$return['error'] = __('Illegal query: Due security restrictions, there are some tokens or words you cannot use: *, delete, drop, alter, modify, union, password, pass, insert or update.'); $return['error'] = __('Illegal query: Due security restrictions, there are some tokens or words you cannot use: *, delete, drop, alter, modify, password, pass, insert or update.');
} }
if ($config['metaconsole']) { if ($config['metaconsole']) {
@ -5811,10 +5800,8 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
require_once ($config["homedir"] . '/include/functions_graph.php'); require_once ($config["homedir"] . '/include/functions_graph.php');
if ($config['metaconsole']) { if ($config['metaconsole'] && $type_report != 'automatic_graph') {
$id_meta = metaconsole_get_id_server($content["server_name"]); $id_meta = metaconsole_get_id_server($content["server_name"]);
$server = metaconsole_get_connection_by_id ($id_meta); $server = metaconsole_get_connection_by_id ($id_meta);
metaconsole_connect($server); metaconsole_connect($server);
} }
@ -5870,7 +5857,25 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
'id_agent_module'=>$graph_item['id_agent_module']); 'id_agent_module'=>$graph_item['id_agent_module']);
} }
$label = reporting_label_macro($item, $content['style']['label']); if($type_report == 'automatic_graph'){
$label = (isset($content['style']['label'])) ? $content['style']['label'] : '';
if (!empty($label)) {
if ($config['metaconsole']) {
$id_meta = metaconsole_get_id_server($content["server_name"]);
$server = metaconsole_get_connection_by_id ($id_meta);
metaconsole_connect($server);
}
$label = reporting_label_macro($content, $label);
if ($config['metaconsole']) {
metaconsole_restore_db();
}
}
} else {
$label = (isset($content['style']['label'])) ? $content['style']['label'] : '';
$label = reporting_label_macro($content, $label);
}
$labels[$graph_item['id_agent_module']] = $label; $labels[$graph_item['id_agent_module']] = $label;
} }
} }
@ -5889,13 +5894,6 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
$height = 50; $height = 50;
} }
} }
if (defined('METACONSOLE')) {
$modules_new = array();
foreach ($modules as $mod) {
$modules_new[] = $mod['module'];
}
$modules = $modules_new;
}
switch ($type) { switch ($type) {
case 'dinamic': case 'dinamic':
@ -5934,13 +5932,8 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
break; break;
} }
if ($type_report == 'automatic_graph') { if ($config['metaconsole'] && $type_report != 'automatic_graph') {
// Do none metaconsole_restore_db();
}
else {
if ($config['metaconsole']) {
metaconsole_restore_db();
}
} }
return reporting_check_structure_content($return); return reporting_check_structure_content($return);
@ -10292,6 +10285,7 @@ function reporting_get_agentmodule_sla_working_timestamp ($period, $date_end, $w
} }
function reporting_label_macro ($item, $label) { function reporting_label_macro ($item, $label) {
switch ($item['type']) { switch ($item['type']) {
case 'event_report_agent': case 'event_report_agent':
case 'alert_report_agent': case 'alert_report_agent':
@ -10317,7 +10311,6 @@ function reporting_label_macro ($item, $label) {
$label = str_replace("_address_", $agent_name, $label); $label = str_replace("_address_", $agent_name, $label);
} }
break; break;
case 'automatic_graph':
case 'simple_graph': case 'simple_graph':
case 'module_histogram_graph': case 'module_histogram_graph':
case 'custom_graph': case 'custom_graph':
@ -10337,6 +10330,7 @@ function reporting_label_macro ($item, $label) {
case 'TTO': case 'TTO':
case 'MTBF': case 'MTBF':
case 'MTTR': case 'MTTR':
case 'automatic_graph':
if (preg_match("/_agent_/", $label)) { if (preg_match("/_agent_/", $label)) {
$agent_name = agents_get_alias($item['id_agent']); $agent_name = agents_get_alias($item['id_agent']);
$label = str_replace("_agent_", $agent_name, $label); $label = str_replace("_agent_", $agent_name, $label);

View File

@ -3780,6 +3780,7 @@ function reporting_get_event_histogram ($events, $text_header_event = false) {
); );
} }
} }
$table = new stdClass(); $table = new stdClass();
if (!$text_header_event) { if (!$text_header_event) {
$table->width = '100%'; $table->width = '100%';
@ -3839,6 +3840,157 @@ function reporting_get_event_histogram ($events, $text_header_event = false) {
return $event_graph; return $event_graph;
} }
function reporting_get_event_histogram_meta ($width) {
global $config;
if (!defined("METACONSOLE")) {
include_once ($config['homedir'] .'/include/graphs/functions_gd.php');
}
else {
include_once ('../../include/graphs/functions_gd.php');
}
$period = SECONDS_1HOUR;
if (!$text_header_event) {
$text_header_event = __('Events info (1hr.)');
}
$ttl = 1;
$urlImage = ui_get_full_url(false, true, false, false);
$data = array ();
$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
$interval = (int) ($period / $resolution);
$date = get_system_time ();
$datelimit = $date - $period;
$periodtime = floor ($period / $interval);
$time = array ();
$data = array ();
$legend = array();
$full_legend = array();
$full_legend_date = array();
$colors = array(
EVENT_CRIT_MAINTENANCE => COL_MAINTENANCE,
EVENT_CRIT_INFORMATIONAL => COL_INFORMATIONAL,
EVENT_CRIT_NORMAL => COL_NORMAL,
EVENT_CRIT_MINOR => COL_MINOR,
EVENT_CRIT_WARNING => COL_WARNING,
EVENT_CRIT_MAJOR => COL_MAJOR,
EVENT_CRIT_CRITICAL => COL_CRITICAL
);
$cont = 0;
for ($i = 0; $i < $interval; $i++) {
$bottom = $datelimit + ($periodtime * $i);
if (! $graphic_type) {
if ($config['flash_charts']) {
$name = date('H:i:s', $bottom);
}
else {
$name = date('H\h', $bottom);
}
}
else {
$name = $bottom;
}
// Show less values in legend
if ($cont == 0 or $cont % 2)
$legend[$cont] = $name;
if ($from_agent_view) {
$full_date = date('Y/m/d', $bottom);
$full_legend_date[$cont] = $full_date;
}
$full_legend[$cont] = $name;
$top = $datelimit + ($periodtime * ($i + 1));
$event = db_get_row_filter ('tmetaconsole_event',
array (
'utimestamp > '.$bottom,
'utimestamp < '.$top),
'criticity, utimestamp');
if (!empty($event['utimestamp'])) {
$data[$cont]['utimestamp'] = $periodtime;
switch ($event['criticity']) {
case 0:
$data[$cont]['data'] = EVENT_CRIT_MAINTENANCE;
break;
case 1:
$data[$cont]['data'] = EVENT_CRIT_INFORMATIONAL;
break;
case 2:
$data[$cont]['data'] = EVENT_CRIT_NORMAL;
break;
case 3:
$data[$cont]['data'] = EVENT_CRIT_WARNING;
break;
case 4:
$data[$cont]['data'] = EVENT_CRIT_CRITICAL;
break;
case 5:
$data[$cont]['data'] = EVENT_CRIT_MINOR;
break;
case 6:
$data[$cont]['data'] = EVENT_CRIT_MAJOR;
break;
case 20:
$data[$cont]['data'] = EVENT_CRIT_NOT_NORMAL;
break;
case 34:
$data[$cont]['data'] = EVENT_CRIT_WARNING_OR_CRITICAL;
break;
default:
$data[$cont]['data'] = 1;
break;
}
}
else {
$data[$cont]['utimestamp'] = $periodtime;
$data[$cont]['data'] = 1;
}
$cont++;
}
$table = new stdClass();
$table->width = '100%';
$table->data = array ();
$table->size = array ();
$table->head = array ();
$table->title = '<span>' . $text_header_event . '</span>';
$table->data[0][0] = "" ;
if (!empty($data)) {
$slicebar = flot_slicesbar_graph($data, $period, "100%", 30, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $url, '', '', false, 0, $full_legend_date);
$table->data[0][0] = $slicebar;
}
else {
$table->data[0][0] = __('No events');
}
if (!$text_header_event) {
$event_graph = '<fieldset class="databox tactical_set">
<legend>' .
$text_header_event .
'</legend>' .
html_print_table($table, true) . '</fieldset>';
}
else {
$table->class = 'noclass';
$event_graph = html_print_table($table, true);
}
return $event_graph;
}
function reporting_html_planned_downtimes_table ($planned_downtimes) { function reporting_html_planned_downtimes_table ($planned_downtimes) {
global $config; global $config;

View File

@ -138,7 +138,7 @@ function snmp_browser_print_tree ($tree, $id = 0, $depth = 0, $last = 0, $last_a
* *
* @return array The SNMP tree. * @return array The SNMP tree.
*/ */
function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $version = '2c', $snmp3_auth_user = '', $snmp3_security_level = '', $snmp3_auth_method = '', $snmp3_auth_pass = '', $snmp3_privacy_method = '', $snmp3_privacy_pass = '') { function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $version = '2c', $snmp3_auth_user = '', $snmp3_security_level = '', $snmp3_auth_method = '', $snmp3_auth_pass = '', $snmp3_privacy_method = '', $snmp3_privacy_pass = '', $server_to_exec = 0) {
global $config; global $config;
if ($target_ip == '') { if ($target_ip == '') {
@ -173,27 +173,73 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve
$error_redir_dir = '/dev/null'; $error_redir_dir = '/dev/null';
break; break;
} }
if ($server_to_exec != 0) {
$sql = sprintf("SELECT ip_address FROM tserver WHERE id_server = %d", $server_to_exec);
$server_data = db_get_row_sql($sql);
$oid_tree = array('__LEAVES__' => array()); if (enterprise_installed()) {
if ($version == "3") { enterprise_include_once ('include/functions_satellite.php');
switch ($snmp3_security_level) {
case "authPriv": $oid_tree = array('__LEAVES__' => array());
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' -x ' . escapeshellarg($snmp3_privacy_method) . ' -X ' . escapeshellarg($snmp3_privacy_pass) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); if ($version == "3") {
break; switch ($snmp3_security_level) {
case "authNoPriv": case "authPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); $command = $snmpwalk_bin . " -m ALL -v 3 -u " . escapeshellarg($snmp3_auth_user) . " -A " . escapeshellarg($snmp3_auth_pass) . " -l " . escapeshellarg($snmp3_security_level) . " -a " . escapeshellarg($snmp3_auth_method) . " -x " . escapeshellarg($snmp3_privacy_method) . " -X " . escapeshellarg($snmp3_privacy_pass) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir;
break; break;
case "noAuthNoPriv": case "authNoPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -l ' . escapeshellarg($snmp3_security_level) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); $command = $snmpwalk_bin . " -m ALL -v 3 -u " . escapeshellarg($snmp3_auth_user) . " -A " . escapeshellarg($snmp3_auth_pass) . " -l " . escapeshellarg($snmp3_security_level) . " -a " . escapeshellarg($snmp3_auth_method) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir;
break; break;
case "noAuthNoPriv":
$command = $snmpwalk_bin . " -m ALL -v 3 -u " . escapeshellarg($snmp3_auth_user) . " -l " . escapeshellarg($snmp3_security_level) . " " . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir;
break;
}
}
else {
$command = $snmpwalk_bin . " -m ALL -M +" . escapeshellarg($config['homedir'] . "/attachment/mibs") . " -Cc -c " . escapeshellarg($community) . " -v " . escapeshellarg($version) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir;
}
exec("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . $command . "\"", $output, $rc);
}
else {
$oid_tree = array('__LEAVES__' => array());
if ($version == "3") {
switch ($snmp3_security_level) {
case "authPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' -x ' . escapeshellarg($snmp3_privacy_method) . ' -X ' . escapeshellarg($snmp3_privacy_pass) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
break;
case "authNoPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
break;
case "noAuthNoPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -l ' . escapeshellarg($snmp3_security_level) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
break;
}
}
else {
exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
}
} }
} }
else { else {
exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); $oid_tree = array('__LEAVES__' => array());
if ($version == "3") {
switch ($snmp3_security_level) {
case "authPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' -x ' . escapeshellarg($snmp3_privacy_method) . ' -X ' . escapeshellarg($snmp3_privacy_pass) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
break;
case "authNoPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
break;
case "noAuthNoPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -l ' . escapeshellarg($snmp3_security_level) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
break;
}
}
else {
exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
}
} }
//if ($rc != 0) { html_debug($output, true);
// return __('No data');
//}
foreach ($output as $line) { foreach ($output as $line) {
// Separate the OID from the value // Separate the OID from the value
@ -518,7 +564,21 @@ function snmp_browser_print_container ($return = false, $width = '100%', $height
'3' => 'v. 3'), '3' => 'v. 3'),
'snmp_browser_version', '', 'checkSNMPVersion();', '', '', true, false, false, ''); 'snmp_browser_version', '', 'checkSNMPVersion();', '', '', true, false, false, '');
$table->data[0][4] = html_print_button(__('Browse'), 'browse', false, 'snmpBrowse()', 'class="sub search" style="margin-top:0px;"', true); $servers_to_exec = array();
$servers_to_exec[0] = __('Local console');
if (enterprise_installed()) {
enterprise_include_once ('include/functions_satellite.php');
$rows = get_proxy_servers();
foreach ($rows as $row) {
$servers_to_exec[$row['id_server']] = $row['name'];
}
}
$table->data[0][4] = '<strong>' . __('Server to execute') . '</strong> &nbsp;&nbsp;';
$table->data[0][4] .= html_print_select($servers_to_exec, 'server_to_exec', '', '', '', '', true);
$table->data[0][5] = html_print_button(__('Browse'), 'browse', false, 'snmpBrowse()', 'class="sub search" style="margin-top:0px;"', true);
// SNMP v3 options // SNMP v3 options
$table3 = new stdClass(); $table3 = new stdClass();

View File

@ -660,6 +660,28 @@ function ui_print_os_icon ($id_os, $name = true, $return = false,
return $output; return $output;
} }
function ui_print_type_agent_icon ( $id_os = false, $remote_contact = false, $contact = false,
$return = false, $remote = 0, $version = ""){
if($id_os == 19){
//Satellite
$options['title'] = __('Satellite');
$output = html_print_image("images/op_satellite.png", true, $options, false, false, false, true);
}
else if ($remote_contact == $contact && $remote == 0 && $version == ""){
//Network
$options['title'] = __('Network');
$output = html_print_image("images/network.png", true, $options, false, false, false, true);
}
else{
//Software
$options['title'] = __('Software');
$output = html_print_image("images/data.png", true, $options, false, false, false, true);
}
return $output;
}
/** /**
* Prints an agent name with the correct link * Prints an agent name with the correct link
* *

View File

@ -624,8 +624,8 @@ function update_manager_extract_package() {
$extracted = false; $extracted = false;
// Phar and exception working fine in 5.5.0 or higher // Phar and exception working fine in 5.6.0 or higher
if (PHP_VERSION_ID >= 50505) { if (PHP_VERSION_ID >= 50600) {
$phar = new PharData($path_package); $phar = new PharData($path_package);
try { try {
$result = $phar->extractTo($config['attachment_store'] . "/downloads/",null, true); $result = $phar->extractTo($config['attachment_store'] . "/downloads/",null, true);

View File

@ -110,13 +110,11 @@ function visual_map_print_item($mode = "read", $layoutData,
$border_color = $layoutData['border_color']; $border_color = $layoutData['border_color'];
$fill_color = $layoutData['fill_color']; $fill_color = $layoutData['fill_color'];
$label_position = $layoutData['label_position']; $label_position = $layoutData['label_position'];
$sizeStyle = ''; $sizeStyle = '';
$borderStyle = ''; $borderStyle = '';
$imageSize = ''; $imageSize = '';
if (!empty($proportion)) { if (!empty($proportion)) {
$top = $top * $proportion['proportion_height']; $top = $top * $proportion['proportion_height'];
$left = $left * $proportion['proportion_width']; $left = $left * $proportion['proportion_width'];
@ -156,6 +154,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$wimg ='70'; $wimg ='70';
break; break;
case 3: case 3:
case 14:
if (get_parameter('action') == 'edit') { if (get_parameter('action') == 'edit') {
$himg = '30'; $himg = '30';
$wimg = '150'; $wimg = '150';
@ -201,7 +200,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$text = '<table style="float:right;height:'.$himg.'px;"><tr><td></td></tr><tr><td><span style="" id="text_' . $id . '" class="text">' . $label .'</span></td></tr><tr><td></td></tr></table>'; $text = '<table style="float:right;height:'.$himg.'px;"><tr><td></td></tr><tr><td><span style="" id="text_' . $id . '" class="text">' . $label .'</span></td></tr><tr><td></td></tr></table>';
} }
else { else {
$text = '<table style="width:'.$wimg.'px;"><tr><td></td></tr><tr><td><span style="" id="text_' . $id . '" class="text">' . $label .'</span></td></tr><tr><td></td></tr></table>'; $text = '<table style="text-align:center ;width:'.$wimg.'px;"><tr><td></td></tr><tr><td><span style="" id="text_' . $id . '" class="text">' . $label .'</span></td></tr><tr><td></td></tr></table>';
} }
@ -376,6 +375,9 @@ function visual_map_print_item($mode = "read", $layoutData,
$link = true; $link = true;
} }
break;
case AUTO_SLA_GRAPH:
$link = true;
break; break;
default: default:
if (!empty($element_enterprise)) { if (!empty($element_enterprise)) {
@ -391,7 +393,6 @@ function visual_map_print_item($mode = "read", $layoutData,
$is_a_service = false; $is_a_service = false;
$is_a_link_to_other_visualconsole = false; $is_a_link_to_other_visualconsole = false;
if (enterprise_installed()) { if (enterprise_installed()) {
$id_service = services_service_from_module $id_service = services_service_from_module
($layoutData['id_agente_modulo']); ($layoutData['id_agente_modulo']);
@ -404,9 +405,6 @@ function visual_map_print_item($mode = "read", $layoutData,
$is_a_link_to_other_visualconsole = true; $is_a_link_to_other_visualconsole = true;
} }
if ($is_a_service) { if ($is_a_service) {
if (empty($layoutData['id_metaconsole'])) { if (empty($layoutData['id_metaconsole'])) {
$url = $config['homeurl'] . $url = $config['homeurl'] .
@ -458,6 +456,36 @@ function visual_map_print_item($mode = "read", $layoutData,
} }
break;
case AUTO_SLA_GRAPH:
$e_period = $layoutData['period'];
$date = get_system_time ();
$datelimit = $date - $e_period;
$time_format = "Y/m/d H:i:s";
$timestamp_init = date($time_format, $datelimit);
$timestamp_end = date($time_format, $date);
$timestamp_init_aux = explode(" ", $timestamp_init);
$timestamp_end_aux = explode(" ", $timestamp_end);
$date_from = $timestamp_init_aux[0];
$time_from = $timestamp_init_aux[1];
$date_to = $timestamp_end_aux[0];
$time_to = $timestamp_end_aux[1];
if (empty($layout_data['id_metaconsole'])) {
$url = $config['homeurl'] . "index.php?sec=eventos&sec2=operation/events/events&id_agent=" . $layoutData['id_agent'] .
"&module_search_hidden=" . $layoutData['id_agente_modulo'] . "&date_from=" . $date_from . "&time_from=" . $time_from .
"&date_to=" . $date_to . "&time_to=" . $time_to . "&status=-1";
}
else {
$url = "index.php?sec=eventos&sec2=operation/events/events&id_agent=" . $layoutData['id_agent'] .
"&module_search_hidden=" . $layoutData['id_agente_modulo'] . "&date_from=" . $date_from . "&time_from=" . $time_from .
"&date_to=" . $date_to . "&time_to=" . $time_to . "&status=-1";
}
break; break;
case GROUP_ITEM: case GROUP_ITEM:
$is_a_link_to_other_visualconsole = false; $is_a_link_to_other_visualconsole = false;
@ -1037,8 +1065,6 @@ function visual_map_print_item($mode = "read", $layoutData,
metaconsole_restore_db(); metaconsole_restore_db();
} }
//$img = str_replace('>', 'class="image" id="image_' . $id . '" />', $img);
break; break;
case LABEL: case LABEL:
$z_index = 4 + 1; $z_index = 4 + 1;
@ -1046,6 +1072,61 @@ function visual_map_print_item($mode = "read", $layoutData,
case BOX_ITEM: case BOX_ITEM:
$z_index = 1; $z_index = 1;
break; break;
case AUTO_SLA_GRAPH:
if ((get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap')) {
if($width == 0 || $height == 0){
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="../../images/console/signes/module-events.png">';
}
else{
$img = '<img src="images/console/signes/module-events.png">';
}
}
else{
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="../../images/console/signes/module-events.png" style="width:'.$width.'px;height:'. $height.'px;">';
}
else{
$img = '<img src="images/console/signes/module-events.png" style="width:'.$width.'px;height:'. $height.'px;">';
}
}
}
else {
if ($width == 0 || $height == 0) {
if ($layoutData['label_position']=='left') {
$img = '<div style="float:left;height:'.$himg.'px;">' .
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true);
}
elseif ($layoutData['label_position']=='right') {
$img = '<div style="float:right;height:'.$himg.'px;">' .
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true);
}
else {
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true);
}
}
else{
if ($layoutData['label_position']=='left') {
$img = '<div style="float:left;height:'.$himg.'px;">' .
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true);
}
elseif ($layoutData['label_position']=='right') {
$img = '<div style="float:right;height:'.$himg.'px;">' .
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true);
}
else {
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true);
}
}
}
//Restore db connection
if ($layoutData['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
$z_index = 2 + 1;
break;
} }
$class = "item "; $class = "item ";
@ -1053,6 +1134,9 @@ function visual_map_print_item($mode = "read", $layoutData,
case STATIC_GRAPH: case STATIC_GRAPH:
$class .= "static_graph"; $class .= "static_graph";
break; break;
case AUTO_SLA_GRAPH:
$class .= "auto_sla_graph";
break;
case GROUP_ITEM: case GROUP_ITEM:
$class .= "group_item"; $class .= "group_item";
break; break;
@ -1386,6 +1470,20 @@ function visual_map_print_item($mode = "read", $layoutData,
echo io_safe_output($text); echo io_safe_output($text);
} }
break; break;
case AUTO_SLA_GRAPH:
if ($layoutData['label_position']=='up') {
echo io_safe_output($text);
}
echo $img;
if ($layoutData['label_position']=='down') {
echo io_safe_output($text);
}
elseif($layoutData['label_position']=='left' || $layoutData['label_position']=='right') {
echo io_safe_output($text);
}
break;
case SIMPLE_VALUE: case SIMPLE_VALUE:
case SIMPLE_VALUE_MAX: case SIMPLE_VALUE_MAX:
case SIMPLE_VALUE_MIN: case SIMPLE_VALUE_MIN:
@ -1433,32 +1531,24 @@ function visual_map_print_item($mode = "read", $layoutData,
} }
} }
//$io_safe_output_text = str_replace(array('_VALUE_','_value_'), $value, $io_safe_output_text);
if(get_parameter('action') == 'edit'){ if(get_parameter('action') == 'edit'){
//html_debug($layoutData); if( (strip_tags($io_safe_output_text) != '_VALUE_') || (strip_tags($io_safe_output_text) != '(_VALUE_)') ) {
//echo 'Data value';
if(strip_tags($io_safe_output_text) != '_VALUE_'){
echo $io_safe_output_text; echo $io_safe_output_text;
} }
else{ else {
echo "<img style='width:".$layoutData['width']."px;' src='images/console/signes/data_image.png'>"; echo "<img style='width:".$layoutData['width']."px;' src='images/console/signes/data_image.png'>";
} }
} else {
if(strrpos(strip_tags($io_safe_output_text),'(_VALUE_)') !== false || (strip_tags($io_safe_output_text) == '(_VALUE_)')) {
echo str_replace(array("(_VALUE_)","(_value_)"), $value, $io_safe_output_text);
} }
else{ elseif(strrpos(strip_tags($io_safe_output_text),'_VALUE_') !== false || (strip_tags($io_safe_output_text) == '_VALUE_')) {
if(strip_tags($io_safe_output_text) != '_VALUE_'){
echo str_replace(array('_VALUE_','_value_'), $value, $io_safe_output_text); echo str_replace(array('_VALUE_','_value_'), $value, $io_safe_output_text);
} } else {
else{
echo str_replace('>', ' style="width:'.$layoutData['width'].'px">',$value); echo str_replace('>', ' style="width:'.$layoutData['width'].'px">',$value);
} }
} }
//Restore db connection //Restore db connection
if ($layoutData['id_metaconsole'] != 0) { if ($layoutData['id_metaconsole'] != 0) {
metaconsole_restore_db(); metaconsole_restore_db();
@ -1583,8 +1673,6 @@ function visual_map_get_simple_value_type($process_simple_value) {
function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY) { function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY) {
global $config; global $config;
$unit_text = db_get_sql ('SELECT unit $unit_text = db_get_sql ('SELECT unit
FROM tagente_modulo WHERE id_agente_modulo = ' . $id_module); FROM tagente_modulo WHERE id_agente_modulo = ' . $id_module);
$unit_text = trim(io_safe_output($unit_text)); $unit_text = trim(io_safe_output($unit_text));
@ -1593,8 +1681,6 @@ function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY)
case SIMPLE_VALUE: case SIMPLE_VALUE:
$value = db_get_value ('datos', 'tagente_estado', $value = db_get_value ('datos', 'tagente_estado',
'id_agente_modulo', $id_module); 'id_agente_modulo', $id_module);
if ($value === false) { if ($value === false) {
$value = __('Unknown'); $value = __('Unknown');
@ -2559,6 +2645,8 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
'proportion_width' => $proportion_width); 'proportion_width' => $proportion_width);
} }
$layout_data['label'] = visual_map_macro($layout_data['label']);
switch ($layout_data['type']) { switch ($layout_data['type']) {
case LINE_ITEM: case LINE_ITEM:
visual_map_print_user_lines($layout_data, $proportion); visual_map_print_user_lines($layout_data, $proportion);
@ -2768,6 +2856,10 @@ function visual_map_create_internal_name_item($label = null, $type, $image, $age
case MODULE_GRAPH: case MODULE_GRAPH:
$text = __('Module graph'); $text = __('Module graph');
break; break;
case 'auto_sla_graph':
case AUTO_SLA_GRAPH:
$text = __('Auto SLA Graph');
break;
case 'percentile_bar': case 'percentile_bar':
case PERCENTILE_BAR: case PERCENTILE_BAR:
$text = __('Percentile bar'); $text = __('Percentile bar');
@ -2879,6 +2971,9 @@ function visual_map_type_in_js($type) {
case MODULE_GRAPH: case MODULE_GRAPH:
return 'module_graph'; return 'module_graph';
break; break;
case AUTO_SLA_GRAPH:
return 'auto_sla_graph';
break;
case SIMPLE_VALUE: case SIMPLE_VALUE:
return 'simple_value'; return 'simple_value';
break; break;
@ -2915,4 +3010,10 @@ function visual_map_type_in_js($type) {
} }
} }
function visual_map_macro($label){
$label = str_replace('_date_',strftime("%x"),$label);
$label = str_replace('_time_',strftime("%T"),$label);
return $label;
}
?> ?>

View File

@ -54,6 +54,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
'static_graph' => __('Static Graph'), 'static_graph' => __('Static Graph'),
'percentile_item' => __('Percentile Item'), 'percentile_item' => __('Percentile Item'),
'module_graph' => __('Graph'), 'module_graph' => __('Graph'),
'auto_sla_graph' => __('Auto SLA Graph'),
'simple_value' => __('Simple value') . ui_print_help_tip(__("To use 'label'field, you should write 'simple_value' => __('Simple value') . ui_print_help_tip(__("To use 'label'field, you should write
a text to replace '(_VALUE_)' and the value of the module will be printed at the end."), true), a text to replace '(_VALUE_)' and the value of the module will be printed at the end."), true),
'label' => __('Label'), 'label' => __('Label'),
@ -153,7 +154,6 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
html_print_input_text('height_module_graph', 180, '', 3, 5, true) . html_print_input_text('height_module_graph', 180, '', 3, 5, true) .
'</td>'; '</td>';
$form_items['label_row'] = array(); $form_items['label_row'] = array();
$form_items['label_row']['items'] = array('label', $form_items['label_row']['items'] = array('label',
'static_graph', 'static_graph',
@ -162,7 +162,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
'module_graph', 'module_graph',
'simple_value', 'simple_value',
'datos', 'datos',
'group_item'); 'group_item',
'auto_sla_graph');
$form_items['label_row']['html'] = $form_items['label_row']['html'] =
'<td align="left" valign="top" style="">' . __('Label') . ' '<td align="left" valign="top" style="">' . __('Label') . '
@ -276,7 +277,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['agent_row'] = array(); $form_items['agent_row'] = array();
$form_items['agent_row']['items'] = array('static_graph', $form_items['agent_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph', 'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'datos'); 'simple_value', 'datos', 'auto_sla_graph');
$form_items['agent_row']['html'] = '<td align="left">' . $form_items['agent_row']['html'] = '<td align="left">' .
__('Agent') . '</td>'; __('Agent') . '</td>';
$params = array(); $params = array();
@ -306,28 +307,38 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
ui_print_agent_autocomplete_input($params) . ui_print_agent_autocomplete_input($params) .
'</td>'; '</td>';
$form_items['module_row'] = array(); $form_items['module_row'] = array();
$form_items['module_row']['items'] = array('static_graph', $form_items['module_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph', 'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'datos'); 'simple_value', 'datos', 'auto_sla_graph');
$form_items['module_row']['html'] = '<td align="left">' . $form_items['module_row']['html'] = '<td align="left">' .
__('Module') . '</td> __('Module') . '</td>
<td align="left">' . <td align="left">' .
html_print_select(array(), 'module', '', '', __('Any'), 0, true). '<div id="data_image_container" style="display:none;"><span id="data_image_check_label" style="margin-left:20px;">'.__("Data image").': </span><span id="data_image_check">Off</span><span id="data_image_width_label"> - Width: </span><input style="margin-left:5px;width:40px;" type="number" id="data_image_width" value="100"></input></div> html_print_select(array(), 'module', '', '', __('Any'), 0, true) . '<div id="data_image_container" style="display:none;"><span id="data_image_check_label" style="margin-left:20px;">'.__("Data image").': </span><span id="data_image_check">Off</span><span id="data_image_width_label"> - Width: </span><input style="margin-left:5px;width:40px;" type="number" min="0" id="data_image_width" value="100"></input></div>
</td>'; </td>';
$event_times = array(86400 => __('24h'),
28800 => __('8h'),
7200 => __('2h'),
3600 => __('1h'),);
$form_items['event_max_time_row'] = array();
$form_items['event_max_time_row']['items'] = array('auto_sla_graph');
$form_items['event_max_time_row']['html'] = '<td align="left">' .
__('Max. Time') . '</td>
<td align="left">' .
html_print_select($event_times, 'event_max_time_row', '', '', 0, 86400, true, false, false) .
'</td>';
$form_items['type_graph'] = array();
$form_items['type_graph'] = array(); $form_items['type_graph']['items'] = array(
$form_items['type_graph']['items'] = array( 'Line',
'Line', 'Area');
'Area'); $form_items['type_graph']['html'] = '<td align="left"><span>' .
$form_items['type_graph']['html'] = '<td align="left"><span>' . __('Type of graph') . '</span></td>
__('Type of graph') . '</span></td> <td align="left">'. html_print_select (
<td align="left">'. html_print_select ( array ('line' => __('Line'),
array ('line' => __('Line'), 'area' => __('Area')),
'area' => __('Area')), 'type_graph', '', '', 0, 'area', true, false, false) . '</td>';
'type_graph', '', '', 0, 'area', true, false, false) . '</td>';
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "PM")) if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "PM"))
@ -499,7 +510,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items_advance['position_row'] = array(); $form_items_advance['position_row'] = array();
$form_items_advance['position_row']['items'] = array('static_graph', $form_items_advance['position_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph', 'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'label', 'icon', 'datos', 'box_item'); 'simple_value', 'label', 'icon', 'datos', 'box_item',
'auto_sla_graph');
$form_items_advance['position_row']['html'] = ' $form_items_advance['position_row']['html'] = '
<td align="left">' . __('Position') . '</td> <td align="left">' . __('Position') . '</td>
<td align="left">(' . html_print_input_text('left', '0', '', 3, 5, true) . <td align="left">(' . html_print_input_text('left', '0', '', 3, 5, true) .
@ -510,7 +522,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items_advance['size_row'] = array(); $form_items_advance['size_row'] = array();
$form_items_advance['size_row']['items'] = array( $form_items_advance['size_row']['items'] = array(
'group_item', 'background', 'group_item', 'background',
'static_graph', 'icon datos'); 'static_graph', 'icon datos',
'auto_sla_graph');
$form_items_advance['size_row']['html'] = '<td align="left">' . $form_items_advance['size_row']['html'] = '<td align="left">' .
__('Size') . __('Size') .
ui_print_help_tip ( ui_print_help_tip (
@ -527,7 +540,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items_advance['parent_row']['items'] = array( $form_items_advance['parent_row']['items'] = array(
'group_item', 'static_graph', 'group_item', 'static_graph',
'percentile_bar', 'percentile_item', 'module_graph', 'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'label', 'icon', 'datos'); 'simple_value', 'label', 'icon', 'datos', 'auto_sla_graph');
$form_items_advance['parent_row']['html'] = '<td align="left">' . $form_items_advance['parent_row']['html'] = '<td align="left">' .
__('Parent') . '</td> __('Parent') . '</td>
<td align="left">' . <td align="left">' .
@ -654,6 +667,7 @@ function visual_map_editor_print_toolbox() {
visual_map_print_button_editor('static_graph', __('Static Graph'), 'left', false, 'camera_min', true); visual_map_print_button_editor('static_graph', __('Static Graph'), 'left', false, 'camera_min', true);
visual_map_print_button_editor('percentile_item', __('Percentile Item'), 'left', false, 'percentile_item_min', true); visual_map_print_button_editor('percentile_item', __('Percentile Item'), 'left', false, 'percentile_item_min', true);
visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true); visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true);
visual_map_print_button_editor('auto_sla_graph', __('Auto SLA Graph'), 'left', false, 'auto_sla_graph_min', true);
visual_map_print_button_editor('simple_value', __('Simple Value'), 'left', false, 'binary_min', true); visual_map_print_button_editor('simple_value', __('Simple Value'), 'left', false, 'binary_min', true);
visual_map_print_button_editor('label', __('Label'), 'left', false, 'label_min', true); visual_map_print_button_editor('label', __('Label'), 'left', false, 'label_min', true);
visual_map_print_button_editor('icon', __('Icon'), 'left', false, 'icon_min', true); visual_map_print_button_editor('icon', __('Icon'), 'left', false, 'icon_min', true);
@ -672,7 +686,6 @@ function visual_map_editor_print_toolbox() {
$text_autosave = html_print_input_hidden ('auto_save', true, true); $text_autosave = html_print_input_hidden ('auto_save', true, true);
visual_map_print_item_toolbox('auto_save', $text_autosave, 'right'); visual_map_print_item_toolbox('auto_save', $text_autosave, 'right');
//visual_map_print_button_editor('save_visualmap', __('Save'), 'right', true, 'save_min', true);
visual_map_print_button_editor('show_grid', __('Show grid'), 'right', true, 'grid_min', true); visual_map_print_button_editor('show_grid', __('Show grid'), 'right', true, 'grid_min', true);
visual_map_print_button_editor('edit_item', __('Update item'), 'right', true, 'config_min', true); visual_map_print_button_editor('edit_item', __('Update item'), 'right', true, 'config_min', true);
visual_map_print_button_editor('delete_item', __('Delete item'), 'right', true, 'delete_min', true); visual_map_print_button_editor('delete_item', __('Delete item'), 'right', true, 'delete_min', true);

View File

@ -34,10 +34,7 @@
} }
if (dataObjects.length > 1) { if (dataObjects.length > 1) {
dataObjects.forEach(function (element) { dataObjects.forEach(function (element) {
if (/^Avg.:/i.test(element.label)) result = element;
result = element;
if (/^Percentil/i.test(element.label))
result = element;
}); });
// If the avg set is missing, retrieve the first set // If the avg set is missing, retrieve the first set
@ -88,7 +85,10 @@
else if (typeof labels[index] !== 'undefined') else if (typeof labels[index] !== 'undefined')
date = labels[index]; date = labels[index];
result.data.push([date, value,dataObject.label]); var clean_label = dataObject.label;
clean_label = clean_label.replace( new RegExp("<.*?>", "g"), "");
clean_label = clean_label.replace( new RegExp(";", "g"), "");
result.data.push([date, value, clean_label]);
}); });
} }
/* [ /* [
@ -139,7 +139,7 @@
try { try {
var elements = []; var elements = [];
var custom_graph = $('input:hidden[name=custom_graph]').value; var custom_graph = $('#hidden-custom_graph').val();
if (custom_graph) { if (custom_graph) {
dataObject = retrieveDataOject(dataObjects); dataObject = retrieveDataOject(dataObjects);

View File

@ -608,13 +608,16 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
} }
} }
function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick, water_mark, maxvalue, separator, separator2, graph_javascript, id_agent) { function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick, water_mark, maxvalue, separator, separator2, graph_javascript, id_agent, full_legend) {
values = values.split(separator2); values = values.split(separator2);
labels = labels.split(separator); labels = labels.split(separator);
legend = legend.split(separator); legend = legend.split(separator);
acumulate_data = acumulate_data.split(separator); acumulate_data = acumulate_data.split(separator);
datacolor = datacolor.split(separator); datacolor = datacolor.split(separator);
if (full_legend != false) {
full_legend = full_legend.split(separator);
}
// Check possible adapt_keys on classes // Check possible adapt_keys on classes
check_adaptions(graph_id); check_adaptions(graph_id);
@ -635,7 +638,11 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
var stack = 0, bars = true, lines = false, steps = false; var stack = 0, bars = true, lines = false, steps = false;
var options = { var regex = /visual_console/;
var match = regex.exec(window.location.href);
if (match == null) {
var options = {
series: { series: {
stack: stack, stack: stack,
shadowSize: 0.1, shadowSize: 0.1,
@ -662,51 +669,99 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
show: false show: false
} }
}; };
}
else {
var options = {
series: {
stack: stack,
shadowSize: 0.1,
color: '#ddd'
},
grid: {
hoverable: false,
clickable: false,
borderWidth:1,
borderColor: '',
tickColor: '#fff'
},
xaxes: [ {
tickFormatter: xFormatter,
color: '',
tickSize: intervaltick,
tickLength: 0
} ],
yaxes: [ {
show: false,
tickLength: 0
}],
legend: {
show: false
}
};
}
var plot = $.plot($('#'+graph_id), datas, options ); var plot = $.plot($('#'+graph_id), datas, options );
// Events if (match == null) {
$('#'+graph_id).bind('plothover', function (event, pos, item) { // Events
if (item) { $('#'+graph_id).bind('plothover', function (event, pos, item) {
var from = legend[item.seriesIndex]; if (item) {
var to = legend[item.seriesIndex+1]; var from = legend[item.seriesIndex];
var to = legend[item.seriesIndex+1];
if (to == undefined) { if (to == undefined) {
to = '>'; to = '>';
}
$('#extra_'+graph_id).text(from+'-'+to);
var extra_height = parseInt($('#extra_'+graph_id).css('height').split('px')[0]);
var extra_width = parseInt($('#extra_'+graph_id).css('width').split('px')[0]);
$('#extra_'+graph_id).css('left',pos.pageX-(extra_width/4)+'px');
//$('#extra_'+graph_id).css('top',plot.offset().top-extra_height-5+'px');
$('#extra_'+graph_id).show();
} }
});
$('#extra_'+graph_id).text(from+'-'+to); $('#'+graph_id).bind('plotclick', function(event, pos, item) {
var extra_height = parseInt($('#extra_'+graph_id).css('height').split('px')[0]); if (item) {
var extra_width = parseInt($('#extra_'+graph_id).css('width').split('px')[0]); //from time
$('#extra_'+graph_id).css('left',pos.pageX-(extra_width/4)+'px'); var from = legend[item.seriesIndex];
//$('#extra_'+graph_id).css('top',plot.offset().top-extra_height-5+'px'); //to time
$('#extra_'+graph_id).show(); var to = legend[item.seriesIndex+1];
} //current date
}); var dateObj = new Date();
if (full_legend != "") {
newdate = full_legend[item.seriesIndex];
newdate2 = full_legend[item.seriesIndex+1];
}
else {
var month = dateObj.getUTCMonth() + 1; //months from 1-12
var day = dateObj.getUTCDate();
var year = dateObj.getUTCFullYear();
newdate = year + "/" + month + "/" + day;
}
if(!to){
to= '23:59';
}
if (full_legend != "") {
if (newdate2 == undefined) {
window.location='index.php?sec=eventos&sec2=operation/events/events&id_agent='+id_agent+'&date_from='+newdate+'&time_from='+from+'&status=-1';
}
else {
window.location='index.php?sec=eventos&sec2=operation/events/events&id_agent='+id_agent+'&date_from='+newdate+'&time_from='+from+'&date_to='+newdate2+'&time_to='+to+'&status=-1';
}
}
else {
window.location='index.php?sec=eventos&sec2=operation/events/events&id_agent='+id_agent+'&date_from='+newdate+'&time_from='+from+'&date_to='+newdate+'&time_to='+to+'&status=-1';
}
}
});
$('#'+graph_id).bind('plotclick', function(event, pos, item) { $('#'+graph_id).bind('mouseout',resetInteractivity);
if (item) { }
//from time
var from = legend[item.seriesIndex];
//to time
var to = legend[item.seriesIndex+1];
//current date
var dateObj = new Date();
var month = dateObj.getUTCMonth() + 1; //months from 1-12
var day = dateObj.getUTCDate();
var year = dateObj.getUTCFullYear();
newdate = year + "/" + month + "/" + day;
if(!to){
to= '23:59';
}
window.location='index.php?sec=eventos&sec2=operation/events/events&id_agent='+id_agent+'&date_from='+newdate+'&time_from='+from+'&date_to='+newdate+'&time_to='+to+'&status=-1';
}
});
$('#'+graph_id).bind('mouseout',resetInteractivity);
// Reset interactivity styles // Reset interactivity styles
function resetInteractivity() { function resetInteractivity() {
@ -784,11 +839,16 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
// Prepared to turn series with a checkbox // Prepared to turn series with a checkbox
// var showed = new Array(); // var showed = new Array();
var min_check = 0;
for (i = 0; i < values.length; i++) { for (i = 0; i < values.length; i++) {
var serie = values[i].split(separator); var serie = values[i].split(separator);
var aux = new Array(); var aux = new Array();
$.each(serie, function(i, v) { $.each(serie, function(i, v) {
if(v < 0){
if(min_check > parseFloat(v)){
min_check = v;
}
}
aux.push([i, v]); aux.push([i, v]);
}); });
@ -872,7 +932,9 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
// Prepared to turn series with a checkbox // Prepared to turn series with a checkbox
// showed[i] = true; // showed[i] = true;
} }
if(min_check != 0){
min_check = min_check -5;
}
// If threshold and up are the same, that critical or warning is disabled // If threshold and up are the same, that critical or warning is disabled
if (yellow_threshold == yellow_up) yellow_inverse = false; if (yellow_threshold == yellow_up) yellow_inverse = false;
if (red_threshold == red_up) red_inverse = false; if (red_threshold == red_up) red_inverse = false;
@ -1421,7 +1483,6 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
xaxes: [{ xaxes: [{
axisLabelFontSizePixels: font_size, axisLabelFontSizePixels: font_size,
axisLabelUseCanvas: false, axisLabelUseCanvas: false,
axisLabel: xaxisname,
tickFormatter: xFormatter, tickFormatter: xFormatter,
labelHeight: 50, labelHeight: 50,
color: '', color: '',
@ -1435,6 +1496,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
position: 'left', position: 'left',
font: font, font: font,
reserveSpace: true, reserveSpace: true,
min: min_check
}], }],
legend: { legend: {
position: 'se', position: 'se',
@ -1605,6 +1667,15 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
how_bigger = "K"; how_bigger = "K";
y = y / 1000; y = y / 1000;
} }
else if(y < -1000000) {
how_bigger = "M";
y = y / 1000000;
}
else if (y < -1000) {
console.log('entra por negativo');
how_bigger = "K";
y = y / 1000;
}
if (currentRanges == null || (currentRanges.xaxis.from < j && j < currentRanges.xaxis.to)) { if (currentRanges == null || (currentRanges.xaxis.from < j && j < currentRanges.xaxis.to)) {
$('#timestamp_'+graph_id).show(); $('#timestamp_'+graph_id).show();
@ -2028,6 +2099,10 @@ function number_format(number, force_integer, unit) {
pos++; //Position in array starting with 0 pos++; //Position in array starting with 0
number = number / 1000; number = number / 1000;
} }
else if (number <= -1000) {
pos++;
number = number / 1000;
}
else { else {
break; break;
} }

View File

@ -846,7 +846,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
return $return; return $return;
} }
function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '', $stat_win = false, $id_agent = 0) { function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '', $stat_win = false, $id_agent = 0, $full_legend_date = array()) {
global $config; global $config;
include_javascript_dependencies_flot_graph(); include_javascript_dependencies_flot_graph();
@ -932,7 +932,6 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
$acumulate += $value; $acumulate += $value;
$c++; $c++;
//$return .= "<div id='value_".$i."_$graph_id' class='values_$graph_id' style='color: #000; position:absolute;'>$value</div>";
if ($value > $max) { if ($value > $max) {
$max = $value; $max = $value;
} }
@ -943,6 +942,12 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
$labels = implode($separator,$labels); $labels = implode($separator,$labels);
$datacolor = implode($separator,$datacolor); $datacolor = implode($separator,$datacolor);
$legend = io_safe_output(implode($separator,$legend)); $legend = io_safe_output(implode($separator,$legend));
if (!empty($full_legend_date)) {
$full_legend_date = io_safe_output(implode($separator,$full_legend_date));
}
else {
$full_legend_date = false;
}
$acumulate_data = io_safe_output(implode($separator,$acumulate_data)); $acumulate_data = io_safe_output(implode($separator,$acumulate_data));
// Store data series in javascript format // Store data series in javascript format
@ -966,7 +971,7 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
// Javascript code // Javascript code
$return .= "<script type='text/javascript'>"; $return .= "<script type='text/javascript'>";
$return .= "//<![CDATA[\n"; $return .= "//<![CDATA[\n";
$return .= "pandoraFlotSlicebar('$graph_id', '$values', '$datacolor', '$labels', '$legend', '$acumulate_data', $intervaltick, false, $max, '$separator', '$separator2', '', $id_agent)"; $return .= "pandoraFlotSlicebar('$graph_id', '$values', '$datacolor', '$labels', '$legend', '$acumulate_data', $intervaltick, false, $max, '$separator', '$separator2', '', $id_agent, '$full_legend_date')";
$return .= "\n//]]>"; $return .= "\n//]]>";
$return .= "</script>"; $return .= "</script>";

View File

@ -54,6 +54,11 @@ $graph_type = get_parameter('graph_type', '');
$id_graph = get_parameter('id_graph', false); $id_graph = get_parameter('id_graph', false);
$graph_threshold = get_parameter('graph_threshold', false);
$id_module = get_parameter('id_module');
if (!$id_graph) { if (!$id_graph) {
exit; exit;
} }
@ -383,7 +388,7 @@ switch ($graph_type) {
pch_vertical_graph($graph_type, $data_keys, $data_values, $width, pch_vertical_graph($graph_type, $data_keys, $data_values, $width,
$height, $rgb_color, $xaxisname, $yaxisname, false, $legend, $height, $rgb_color, $xaxisname, $yaxisname, false, $legend,
$font, $antialiasing, $water_mark, $font_size, $font, $antialiasing, $water_mark, $font_size,
$backgroundColor, $unit, $series_type); $backgroundColor, $unit, $series_type, $graph_threshold, $id_module);
break; break;
case 'threshold': case 'threshold':
pch_threshold_graph($graph_type, $data_keys, $data_values, $width, pch_threshold_graph($graph_type, $data_keys, $data_values, $width,
@ -769,7 +774,8 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
function pch_vertical_graph ($graph_type, $index, $data, $width, $height, function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false, $rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false,
$legend = array(), $font, $antialiasing, $water_mark = '', $font_size, $legend = array(), $font, $antialiasing, $water_mark = '', $font_size,
$backgroundColor = 'white', $unit = '', $series_type = array()) { $backgroundColor = 'white', $unit = '', $series_type = array(),
$graph_threshold = false, $id_module) {
global $config; global $config;
@ -975,8 +981,8 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
($height - $margin_bottom)); ($height - $margin_bottom));
/*Get minimun value to draw axis properly*/ /*Get minimun value to draw axis properly*/
$min_data = min(min($data));
$min_data = min(min($data));
$ManualScale = array(); $ManualScale = array();
$mode = SCALE_MODE_START0; $mode = SCALE_MODE_START0;
if ($min_data < 0) { if ($min_data < 0) {
@ -987,33 +993,249 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$ManualScale = array(0 => array("Min" => $min_data, "Max" => 0)); $ManualScale = array(0 => array("Min" => $min_data, "Max" => 0));
$mode = SCALE_MODE_MANUAL; $mode = SCALE_MODE_MANUAL;
} }
else if ($max_data >= 0 && $min_data <= 0){
$ManualScale = array(0 => array("Min" => $min_data, "Max" => $max_data));
$mode = SCALE_MODE_MANUAL;
}
/* Draw the scale */ if($graph_threshold){
$scaleSettings = array( $sql_treshold = 'select min_critical, max_critical, min_warning, max_warning, critical_inverse, warning_inverse from tagente_modulo where id_agente_modulo =' . $id_module;
"GridR" => 200, $treshold_position = db_get_all_rows_sql($sql_treshold);
"GridG" => 200,
"GridB" => 200, //min, max and inverse critical and warning
"GridAlpha" => 30, $p_min_crit = $treshold_position[0]['min_critical'];
"DrawSubTicks" => true, $p_max_crit = $treshold_position[0]['max_critical'];
"CycleBackground" => true, $p_inv_crit = $treshold_position[0]['critical_inverse'];
"BackgroundAlpha1" => 35, $p_min_warn = $treshold_position[0]['min_warning'];
"BackgroundAlpha2" => 35, $p_max_warn = $treshold_position[0]['max_warning'];
"Mode" => $mode, $p_inv_warn = $treshold_position[0]['warning_inverse'];
"ManualScale" => $ManualScale,
"LabelRotation" => 40, //interval warning
"XMargin" => 0, $print_rectangle_warning = 1;
"MinDivHeight" => 15, if($p_min_warn == "0.00" && $p_max_warn == "0.00" && $p_inv_warn == 0){
"TicksFontSize" => $font_size - 1); $print_rectangle_warning = 0;
}
$scaleSettings['AxisR'] = '200'; if($print_rectangle_warning){
$scaleSettings['AxisG'] = '200'; if($p_inv_warn){
$scaleSettings['AxisB'] = '200'; if($p_max_warn == 0){
$scaleSettings['TickR'] = '200'; $p_max_warn = $p_min_warn;
$scaleSettings['TickG'] = '200'; $p_min_warn = "none";
$scaleSettings['TickB'] = '200'; }
else{
$myPicture->drawScale($scaleSettings); $p_max_warn_inv = $p_min_warn;
$p_min_warn_inv = $min_data + 2;
$p_min_warn = $p_max_warn;
if($p_max_warn > $max_data){
$p_max_warn = $p_max_warn + 21;
}
else{
$p_max_warn = $max_data + 21;
}
}
}
else{
if($p_max_warn == 0){
if($max_data > $p_min_warn){
$p_max_warn = $max_data + 21;
}
else{
$p_max_warn = $p_min_warn + 21;
}
}
}
}
//interval critical
$print_rectangle_critical = 1;
if($p_min_crit == "0.00" && $p_max_crit == "0.00" && $p_inv_crit == 0){
$print_rectangle_critical = 0;
}
if($print_rectangle_critical){
if($p_inv_crit){
if($p_max_crit == 0){
$p_max_crit = $p_min_crit;
$p_min_crit = "none";
}
else{
$p_max_crit_inv = $p_min_crit;
$p_min_crit_inv = $min_data + 2;
$p_min_crit = $p_max_crit;
if($p_inv_warn){
if($p_max_crit < $p_max_warn){
$p_max_crit = $p_max_warn;
}
}
else{
if($p_max_crit > $max_data){
$p_max_crit = $p_max_crit + 21;
}
else{
$p_max_crit = $max_data + 21;
}
}
}
}
else{
if($p_max_crit == 0){
if($p_max_warn > $p_min_crit){
$p_max_crit = $p_max_warn;
}
else{
if($max_data > $p_min_crit){
$p_max_crit = $max_data + 21;
}
else{
$p_max_crit = $p_min_crit + 21;
}
}
}
}
}
//Check size scale
//Which of the thresholds is higher?
if($p_max_crit > $p_max_warn){
$check_scale = $p_max_crit;
}
else{
$check_scale = $p_max_warn;
}
if($p_min_crit < $p_min_warn){
$check_scale_min = $p_min_crit;
}
else{
$check_scale_min = $p_min_warn;
}
//Is the threshold higher than our maximum?
if($max_data > $check_scale){
$check_scale = $max_data;
}
if($min_data < $check_scale_min){
$check_scale_min = $min_data;
}
$ManualScale = array( 0 => array("Min" => $check_scale_min, "Max" => $check_scale) );
$mode = SCALE_MODE_MANUAL;
/* Draw the scale */
$scaleSettings = array(
"GridR" => 200,
"GridG" => 200,
"GridB" => 200,
"GridAlpha" => 30,
"DrawSubTicks" => true,
"CycleBackground" => true,
"BackgroundAlpha1" => 35,
"BackgroundAlpha2" => 35,
"Mode" => $mode,
"ManualScale" => $ManualScale,
"LabelRotation" => 40,
"XMargin" => 0,
"MinDivHeight" => 15,
"TicksFontSize" => $font_size - 1);
$scaleSettings['AxisR'] = '200';
$scaleSettings['AxisG'] = '200';
$scaleSettings['AxisB'] = '200';
$scaleSettings['TickR'] = '200';
$scaleSettings['TickG'] = '200';
$scaleSettings['TickB'] = '200';
$myPicture->drawScale($scaleSettings);
//values
$scale_max = $myPicture->DataSet->Data["Axis"][0]["ScaleMax"];
$scale_min = $myPicture->DataSet->Data["Axis"][0]["ScaleMin"];
$position_y1 = $myPicture->GraphAreaY1;
$position_y2 = $myPicture->GraphAreaY2;
$position1 = $myPicture->GraphAreaX1;
$position3 = $myPicture->GraphAreaX2;
$cte = ($position_y2 - $position_y1) / ($scale_max - $scale_min);
//warning
if($print_rectangle_warning){
$RectangleSettings = array("R"=>255,"G"=>255,"B"=>000,"Dash"=>TRUE,"DashR"=>170,"DashG"=>220,"DashB"=>190);
if($p_min_warn == "none"){
$p_min_warn = $scale_min;
}
$position2 = ($scale_max - $p_min_warn)*$cte + $position_y1;
$position4 = ($scale_max - $p_max_warn)*$cte + $position_y1;
$myPicture->drawFilledRectangle($position1, floor($position2),
$position3, floor($position4),
$RectangleSettings);
if($p_inv_warn){
$position2 = ($scale_max - $p_min_warn_inv)*$cte + $position_y1;
$position4 = ($scale_max - $p_max_warn_inv)*$cte + $position_y1;
$myPicture->drawFilledRectangle($position1, floor($position2),
$position3, floor($position4),
$RectangleSettings);
}
}
//critical
if($print_rectangle_critical){
$RectangleSettings = array("R"=>248,"G"=>000,"B"=>000,"Dash"=>TRUE,"DashR"=>170,"DashG"=>220,"DashB"=>190);
if($p_min_crit == "none"){
$p_min_crit = $scale_min;
}
$position2 = ($scale_max - $p_min_crit)*$cte + $position_y1;
$position4 = ($scale_max - $p_max_crit)*$cte + $position_y1;
$myPicture->drawFilledRectangle($position1, $position2,
$position3, $position4,
$RectangleSettings);
if($p_inv_crit){
$position2 = ($scale_max - $p_min_crit_inv)*$cte + $position_y1;
$position4 = ($scale_max - $p_max_crit_inv)*$cte + $position_y1;
$myPicture->drawFilledRectangle($position1, $position2,
$position3, $position4,
$RectangleSettings);
}
}
}
else{
/* Draw the scale */
$scaleSettings = array(
"GridR" => 200,
"GridG" => 200,
"GridB" => 200,
"GridAlpha" => 30,
"DrawSubTicks" => true,
"CycleBackground" => true,
"BackgroundAlpha1" => 35,
"BackgroundAlpha2" => 35,
"Mode" => $mode,
"ManualScale" => $ManualScale,
"LabelRotation" => 40,
"XMargin" => 0,
"MinDivHeight" => 15,
"TicksFontSize" => $font_size - 1);
$scaleSettings['AxisR'] = '200';
$scaleSettings['AxisG'] = '200';
$scaleSettings['AxisB'] = '200';
$scaleSettings['TickR'] = '200';
$scaleSettings['TickG'] = '200';
$scaleSettings['TickB'] = '200';
$myPicture->drawScale($scaleSettings);
}
/* Turn on shadow computing */ /* Turn on shadow computing */
//$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); //$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
@ -1087,7 +1309,6 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
} }
} }
/* Render the picture */ /* Render the picture */
$myPicture->stroke(); $myPicture->stroke();
} }

View File

@ -63,7 +63,11 @@ Apart from the defined module macros, the following macros are also available:
<li>_groupcontact_ : Group contact information. Configured when the group is created.</li> <li>_groupcontact_ : Group contact information. Configured when the group is created.</li>
<li>_groupother_ : Other information about the group. Configured when the group is created.</li> <li>_groupother_ : Other information about the group. Configured when the group is created.</li>
<li>_email_tag_ : Emails associated to the module tags.</li> <li>_email_tag_ : Emails associated to the module tags.</li>
<li>_alert_critical_instructions_: Instructions for CRITICAL status contained in the module.</li>
<li>_alert_warning_instructions_: Instructions for WARNING status contained in the module.</li>
<li>_alert_unknown_instructions_: Instructions for UNKNOWN status contained in the module.</li>
<li>_modulegraph_nh_: (Only for alerts that use the command eMail) Returns an image of a module graph with a period of n hours (eg. _modulegraph_24h_). A correct setup of the connection between the server and the console's api is required. This setup is done into the server's configuration file.</li> <li>_modulegraph_nh_: (Only for alerts that use the command eMail) Returns an image of a module graph with a period of n hours (eg. _modulegraph_24h_). A correct setup of the connection between the server and the console's api is required. This setup is done into the server's configuration file.</li>
<li>_modulegraphth_<i>n</i>h_:Same operation as the previous macro only with the critical and warning thresholds of the module provided they are defined.</li>
<li>_homeurl_ : It is a link of the public URL this must be configured in the general options of the setup.</li> <li>_homeurl_ : It is a link of the public URL this must be configured in the general options of the setup.</li>
</ul> </ul>
<p> <p>

View File

@ -67,6 +67,7 @@ Besides the defined module macros, the following macros are available:
Returns an image encoded in base64 of a modules graph with a period of <i>n</i> hours (eg. _modulegraph_24h_). Returns an image encoded in base64 of a modules graph with a period of <i>n</i> hours (eg. _modulegraph_24h_).
A correct setup of the connection between the server and the console's API is required. A correct setup of the connection between the server and the console's API is required.
This setup is done on the server's configuration file.</li> This setup is done on the server's configuration file.</li>
<li>_modulegraphth_<i>n</i>h_:Same operation as the previous macro only with the critical and warning thresholds of the module provided they are defined.</li>
</ul> </ul>
<p> <p>

View File

@ -8,6 +8,7 @@
The following macros are also available: <br /> The following macros are also available: <br />
<ul> <ul>
Only if you select one graph for each agent.<br />
<li><b>_agent_ </b>: Name of the agent that you selected in report item.<li /> <li><b>_agent_ </b>: Name of the agent that you selected in report item.<li />
<li><b>_agentdescription_ </b>: Description of the agent that you selected in report item.<li /> <li><b>_agentdescription_ </b>: Description of the agent that you selected in report item.<li />
<li><b>_agentgroup_ </b>: Agent group name.<li /> <li><b>_agentgroup_ </b>: Agent group name.<li />

View File

@ -65,7 +65,11 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
<li>_groupcontact_ : Información de contacto del grupo. Se configura al crear el grupo.</li> <li>_groupcontact_ : Información de contacto del grupo. Se configura al crear el grupo.</li>
<li>_groupother_ : Otra información sobre el grupo. Se configura al crear el grupo.</li> <li>_groupother_ : Otra información sobre el grupo. Se configura al crear el grupo.</li>
<li>_email_tag_ : Emails asociados a los tags de módulos.</li> <li>_email_tag_ : Emails asociados a los tags de módulos.</li>
<li>_modulegraph_nh_: (Sólo para alertas que usen el comando eMail) Devuelve una imagen codificada en base64 de una gráfica del módulo con un período de n horas (eg. _modulegraph_24h_). Requiere de una configuración correcta de la conexión del servidor a la consola vía api, la cual se realiza en el fichero de configuración del servidor.</li> <li>_alert_critical_instructions_: Instrucciones contenidas en el módulo para un estado CRITICAL.</li>
<li>_alert_warning_instructions_: Instrucciones contenidas en el módulo para un estado WARNING.</li>
<li>_alert_unknown_instructions_: Instrucciones contenidas en el módulo para un estado UNKNOWN.</li>
<li>_modulegraph_<i>n</i>h_: (Sólo para alertas que usen el comando eMail) Devuelve una imagen codificada en base64 de una gráfica del módulo con un período de n horas (eg. _modulegraph_24h_). Requiere de una configuración correcta de la conexión del servidor a la consola vía api, la cual se realiza en el fichero de configuración del servidor.</li>
<li>_modulegraphth_<i>n</i>h_:mismo funcionamiento que la macro anterior solo que con los umbrales critical y warning del modulo siempre que estos esten definidos</li>
<li>_homeurl_ : Es un link de la URL pública esta debe de estar configurada en las opciones generales del setup.</li> <li>_homeurl_ : Es un link de la URL pública esta debe de estar configurada en las opciones generales del setup.</li>
</ul> </ul>
<p> <p>

View File

@ -67,6 +67,7 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
Devuelve una imagen codificada en base64 de una gráfica del módulo con un período de <i>n</i> horas (eg. _modulegraph_24h_). Devuelve una imagen codificada en base64 de una gráfica del módulo con un período de <i>n</i> horas (eg. _modulegraph_24h_).
Requiere de una configuración correcta de la conexión del servidor a la consola vía api, Requiere de una configuración correcta de la conexión del servidor a la consola vía api,
la cual se realiza en el fichero de configuración del servidor.</li> la cual se realiza en el fichero de configuración del servidor.</li>
<li>_modulegraphth_<i>n</i>h_:mismo funcionamiento que la macro anterior solo que con los umbrales critical y warning del modulo siempre que estos esten definidos</li>
</ul> </ul>
<p> <p>

View File

@ -8,6 +8,7 @@
Lista de las macros admitidas en este campo: <br /> Lista de las macros admitidas en este campo: <br />
<ul> <ul>
Solamente si seleccionas una gráfica por cada agente.<br />
<li><b>_agent_ </b>: Nombre del agente que ha seleccionado en el elemento del informe.<li /> <li><b>_agent_ </b>: Nombre del agente que ha seleccionado en el elemento del informe.<li />
<li><b>_agentdescription_ </b>: Descripción del agente que ha seleccionado en el elemento del informe.<li /> <li><b>_agentdescription_ </b>: Descripción del agente que ha seleccionado en el elemento del informe.<li />
<li><b>_agentgroup_ </b>: Grupo del agente que ha seleccionado en el elemento del informe<li /> <li><b>_agentgroup_ </b>: Grupo del agente que ha seleccionado en el elemento del informe<li />

View File

@ -307,7 +307,12 @@ function change_shape(id_db_node) {
}) })
.on("click", selected_node) .on("click", selected_node)
.on("dblclick", function(d) { .on("dblclick", function(d) {
edit_node(d, true); if (d.type == undefined) {
move_to_networkmap(d);
}
else {
edit_node(d, true);
}
}) })
.on("contextmenu", function(d) { show_menu("node", d);}); .on("contextmenu", function(d) { show_menu("node", d);});
@ -342,7 +347,12 @@ function change_shape(id_db_node) {
}) })
.on("click", selected_node) .on("click", selected_node)
.on("dblclick", function(d) { .on("dblclick", function(d) {
edit_node(d, true); if (d.type == undefined) {
move_to_networkmap(d);
}
else {
edit_node(d, true);
}
}) })
.on("contextmenu", function(d) { show_menu("node", d);}); .on("contextmenu", function(d) { show_menu("node", d);});
@ -365,7 +375,12 @@ function change_shape(id_db_node) {
}) })
.on("click", selected_node) .on("click", selected_node)
.on("dblclick", function(d) { .on("dblclick", function(d) {
edit_node(d, true); if (d.type == undefined) {
move_to_networkmap(d);
}
else {
edit_node(d, true);
}
}) })
.on("contextmenu", function(d) { show_menu("node", d);}); .on("contextmenu", function(d) { show_menu("node", d);});
@ -400,7 +415,12 @@ function change_shape(id_db_node) {
}) })
.on("click", selected_node) .on("click", selected_node)
.on("dblclick", function(d) { .on("dblclick", function(d) {
edit_node(d, true); if (d.type == undefined) {
move_to_networkmap(d);
}
else {
edit_node(d, true);
}
}) })
.on("contextmenu", function(d) { show_menu("node", d);}); .on("contextmenu", function(d) { show_menu("node", d);});
@ -425,7 +445,12 @@ function change_shape(id_db_node) {
}) })
.on("click", selected_node) .on("click", selected_node)
.on("dblclick", function(d) { .on("dblclick", function(d) {
edit_node(d, true); if (d.type == undefined) {
move_to_networkmap(d);
}
else {
edit_node(d, true);
}
}) })
.on("contextmenu", function(d) { show_menu("node", d);}); .on("contextmenu", function(d) { show_menu("node", d);});
@ -460,7 +485,12 @@ function change_shape(id_db_node) {
}) })
.on("click", selected_node) .on("click", selected_node)
.on("dblclick", function(d) { .on("dblclick", function(d) {
edit_node(d, true); if (d.type == undefined) {
move_to_networkmap(d);
}
else {
edit_node(d, true);
}
}) })
.on("contextmenu", function(d) { show_menu("node", d);}); .on("contextmenu", function(d) { show_menu("node", d);});
} }
@ -3154,7 +3184,12 @@ function draw_elements_graph() {
}) })
.on("click", selected_node) .on("click", selected_node)
.on("dblclick", function(d) { .on("dblclick", function(d) {
edit_node(d, true); if (d.type == undefined) {
move_to_networkmap(d);
}
else {
edit_node(d, true);
}
}) })
.on("contextmenu", function(d) { show_menu("node", d);}); .on("contextmenu", function(d) { show_menu("node", d);});
@ -3188,7 +3223,12 @@ function draw_elements_graph() {
}) })
.on("click", selected_node) .on("click", selected_node)
.on("dblclick", function(d) { .on("dblclick", function(d) {
edit_node(d, true); if (d.type == undefined) {
move_to_networkmap(d);
}
else {
edit_node(d, true);
}
}) })
.on("contextmenu", function(d) { show_menu("node", d);}); .on("contextmenu", function(d) { show_menu("node", d);});
@ -3216,7 +3256,12 @@ function draw_elements_graph() {
}) })
.on("click", selected_node) .on("click", selected_node)
.on("dblclick", function(d) { .on("dblclick", function(d) {
edit_node(d, true); if (d.type == undefined) {
move_to_networkmap(d);
}
else {
edit_node(d, true);
}
}) })
.on("contextmenu", function(d) { show_menu("node", d);}); .on("contextmenu", function(d) { show_menu("node", d);});
@ -3254,7 +3299,12 @@ function draw_elements_graph() {
}) })
.on("click", selected_node) .on("click", selected_node)
.on("dblclick", function(d) { .on("dblclick", function(d) {
edit_node(d, true); if (d.type == undefined) {
move_to_networkmap(d);
}
else {
edit_node(d, true);
}
}) })
.on("contextmenu", function(d) { show_menu("node", d);}); .on("contextmenu", function(d) { show_menu("node", d);});
@ -3284,7 +3334,12 @@ function draw_elements_graph() {
}) })
.on("click", selected_node) .on("click", selected_node)
.on("dblclick", function(d) { .on("dblclick", function(d) {
edit_node(d, true); if (d.type == undefined) {
move_to_networkmap(d);
}
else {
edit_node(d, true);
}
}) })
.on("contextmenu", function(d) { show_menu("node", d);}); .on("contextmenu", function(d) { show_menu("node", d);});
@ -3322,7 +3377,12 @@ function draw_elements_graph() {
}) })
.on("click", selected_node) .on("click", selected_node)
.on("dblclick", function(d) { .on("dblclick", function(d) {
edit_node(d, true); if (d.type == undefined) {
move_to_networkmap(d);
}
else {
edit_node(d, true);
}
}) })
.on("contextmenu", function(d) { show_menu("node", d);}); .on("contextmenu", function(d) { show_menu("node", d);});
@ -3353,6 +3413,29 @@ function draw_elements_graph() {
node.exit().remove(); node.exit().remove();
} }
function move_to_networkmap (node) {
var params = [];
params.push("get_networkmap_from_fictional=1");
params.push("id=" + node.id_db);
params.push("id_map=" + node.map_id);
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
jQuery.ajax ({
data: params.join ("&"),
dataType: 'json',
type: 'POST',
url: action="ajax.php",
success: function (data) {
if (data['correct']) {
window.location="index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap=" + data['id_networkmap'];
}
else {
edit_node(node, true);
}
}
});
}
function choose_group_for_show_agents() { function choose_group_for_show_agents() {
if (enterprise_installed) { if (enterprise_installed) {
group = $("#group_for_show_agents option:selected").val(); group = $("#group_for_show_agents option:selected").val();

View File

@ -177,7 +177,7 @@ function show_response_dialog(event_id, response_id, response) {
draggable: true, draggable: true,
modal: false, modal: false,
open: function(event, ui) { open: function(event, ui) {
perform_response(response['target']); perform_response(response['target'], response_id);
}, },
width: response['modal_width'], width: response['modal_width'],
height: response['modal_height'] height: response['modal_height']
@ -336,7 +336,7 @@ function get_response_target(event_id, response_id, server_id) {
} }
// Perform a response and put the output into a div // Perform a response and put the output into a div
function perform_response(target) { function perform_response(target, response_id) {
var ajax_file = $('#hidden-ajax_file').val(); var ajax_file = $('#hidden-ajax_file').val();
$('#re_exec_command').hide(); $('#re_exec_command').hide();
@ -351,6 +351,7 @@ function perform_response(target) {
params.push("page=include/ajax/events"); params.push("page=include/ajax/events");
params.push("perform_event_response=1"); params.push("perform_event_response=1");
params.push("target="+target); params.push("target="+target);
params.push("response_id="+response_id)
jQuery.ajax ({ jQuery.ajax ({
data: params.join ("&"), data: params.join ("&"),

View File

@ -19,6 +19,7 @@ function snmpBrowse () {
var community = $('#text-community').val(); var community = $('#text-community').val();
var starting_oid = $('#text-starting_oid').val(); var starting_oid = $('#text-starting_oid').val();
var snmp_version = $('#snmp_browser_version').val(); var snmp_version = $('#snmp_browser_version').val();
var server_to_exec = $('#server_to_exec').val();
var snmp3_auth_user = $('#text-snmp3_browser_auth_user').val(); var snmp3_auth_user = $('#text-snmp3_browser_auth_user').val();
var snmp3_security_level = $('#snmp3_browser_security_level').val(); var snmp3_security_level = $('#snmp3_browser_security_level').val();
var snmp3_auth_method = $('#snmp3_browser_auth_method').val(); var snmp3_auth_method = $('#snmp3_browser_auth_method').val();
@ -33,6 +34,7 @@ function snmpBrowse () {
"community=" + community, "community=" + community,
"starting_oid=" + starting_oid, "starting_oid=" + starting_oid,
"snmp_browser_version=" + snmp_version, "snmp_browser_version=" + snmp_version,
"server_to_exec=" + server_to_exec,
"snmp3_browser_auth_user=" + snmp3_auth_user, "snmp3_browser_auth_user=" + snmp3_auth_user,
"snmp3_browser_security_level=" + snmp3_security_level, "snmp3_browser_security_level=" + snmp3_security_level,
"snmp3_browser_auth_method=" + snmp3_auth_method, "snmp3_browser_auth_method=" + snmp3_auth_method,

View File

@ -781,6 +781,12 @@ input.percentile_item_min {
input.percentile_item_min[disabled] { input.percentile_item_min[disabled] {
background: #fefefe url(../../images/percentile_item.disabled.png) no-repeat center !important; background: #fefefe url(../../images/percentile_item.disabled.png) no-repeat center !important;
} }
input.auto_sla_graph_min {
background: #fefefe url(../../images/auto_sla_graph.png) no-repeat center !important;
}
input.auto_sla_graph_min[disabled] {
background: #fefefe url(../../images/auto_sla_graph.disabled.png) no-repeat center !important;
}
input.binary_min { input.binary_min {
background: #fefefe url(../../images/binary.png) no-repeat center !important; background: #fefefe url(../../images/binary.png) no-repeat center !important;
} }
@ -4167,4 +4173,26 @@ div#footer_help{
.service_text_odd { .service_text_odd {
transform: translateY(100px); transform: translateY(100px);
}
/*styles graph conteiner*/
.graph_conteiner_inside > .parent_graph{
width: 100% !important;
}
.graph_conteiner_inside > .parent_graph > .menu_graph{
left: 90% !important;
}
.graph_conteiner_inside > .parent_graph > .noresizevc{
width: 90% !important;
}
.graph_conteiner_inside > div > .nodata_container > .nodata_text {
display: none;
}
.graph_conteiner_inside > div > .nodata_container{
background-size: 120px 80px !important;
>>>>>>> pandora_console/include/styles/pandora.css
} }

View File

@ -2837,6 +2837,14 @@ div#agent_wizard_subtabs {
text-decoration: underline; text-decoration: underline;
} }
#code_license_dialog a:hover {
color:red;
}
#code_license_dialog *{
color: #222222;
}
/* GRAPHS CSS */ /* GRAPHS CSS */
.parent_graph { .parent_graph {

View File

@ -584,12 +584,18 @@ if (! isset ($config['id_user'])) {
$res = update_user_password ($id_user, $pass1); $res = update_user_password ($id_user, $pass1);
if ($res) { if ($res) {
$correct_reset_pass_process = __('Password changed successfully'); $correct_reset_pass_process = __('Password changed successfully');
register_pass_change_try($id_user, 1);
} }
else { else {
register_pass_change_try($id_user, 0);
$process_error_message = __('Failed to change password'); $process_error_message = __('Failed to change password');
} }
} }
else { else {
register_pass_change_try($id_user, 0);
$process_error_message = __('Passwords must be the same'); $process_error_message = __('Passwords must be the same');
} }
require_once ('general/login_page.php'); require_once ('general/login_page.php');
@ -605,6 +611,7 @@ if (! isset ($config['id_user'])) {
if ($db_reset_pass_entry) { if ($db_reset_pass_entry) {
if (($db_reset_pass_entry + SECONDS_2HOUR) < time()) { if (($db_reset_pass_entry + SECONDS_2HOUR) < time()) {
register_pass_change_try($id_user, 0);
$process_error_message = __('Too much time since password change request'); $process_error_message = __('Too much time since password change request');
delete_reset_pass_entry($id_user); delete_reset_pass_entry($id_user);
require_once ('general/login_page.php'); require_once ('general/login_page.php');
@ -615,6 +622,7 @@ if (! isset ($config['id_user'])) {
} }
} }
else { else {
register_pass_change_try($id_user, 0);
$process_error_message = __('This user has not requested a password change'); $process_error_message = __('This user has not requested a password change');
require_once ('general/login_page.php'); require_once ('general/login_page.php');
} }
@ -641,7 +649,8 @@ if (! isset ($config['id_user'])) {
if (!$check_user) { if (!$check_user) {
$reset = false; $reset = false;
$error = __('User doesn\'t exist in database'); register_pass_change_try($user_reset_pass, 0);
$error = __('Error in reset password request');
$show_error = true; $show_error = true;
} }
else { else {
@ -649,6 +658,7 @@ if (! isset ($config['id_user'])) {
if (!$check_mail) { if (!$check_mail) {
$reset = false; $reset = false;
register_pass_change_try($user_reset_pass, 0);
$error = __('This user doesn\'t have a valid email address'); $error = __('This user doesn\'t have a valid email address');
$show_error = true; $show_error = true;
} }

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