Merge branch 'develop' into '1077-sql-error-in-log4x-data-module-dialog-dev'

# Conflicts:
#   pandora_console/include/functions_modules.php
This commit is contained in:
vgilc 2017-08-14 15:26:54 +02:00
commit 9c32a72c9f
124 changed files with 2772 additions and 736 deletions

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.705, AIX version # Version 7.0NG.710, 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
@ -15,8 +15,7 @@ logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default # Interval in seconds, 300 by default
interval 300 interval 300
# Debug mode only generate XML, and stop after first execution, # Debug mode renames XML in the temp folder and continues running
# and does not copy XML to server.
debug 0 debug 0
# By default, agent takes machine name # By default, agent takes machine name

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.705, FreeBSD Version # Version 7.0NG.710, 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
@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default # Interval in seconds, 300 by default
interval 300 interval 300
# Debug mode only generate XML, and stop after first execution, # Debug mode renames XML in the temp folder and continues running
# and does not copy XML to server.
debug 0 debug 0
# By default, agent takes machine name # By default, agent takes machine name

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.705, HP-UX Version # Version 7.0NG.710, 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
@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default # Interval in seconds, 300 by default
interval 300 interval 300
# Debug mode only generate XML, and stop after first execution, # Debug mode renames XML in the temp folder and continues running
# and does not copy XML to server.
debug 0 debug 0
# By default, agent takes machine name # By default, agent takes machine name

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.705, GNU/Linux # Version 7.0NG.710, 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
@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default # Interval in seconds, 300 by default
interval 300 interval 300
# Debug mode only generate XML, and stop after first execution, # Debug mode renames XML in the temp folder and continues running
# and does not copy XML to server.
debug 0 debug 0
# Optional. UDP Server to receive orders from outside # Optional. UDP Server to receive orders from outside

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.705, GNU/Linux # Version 7.0NG.710, 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.705, Solaris Version # Version 7.0NG.710, 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
@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default # Interval in seconds, 300 by default
interval 300 interval 300
# Debug mode only generate XML, and stop after first execution, # Debug mode renames XML in the temp folder and continues running
# and does not copy XML to server.
debug 0 debug 0
# By default, agent takes machine name # By default, agent takes machine name

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.705 # Version 7.0NG.710
# 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
@ -60,7 +60,7 @@ server_port 41121
# In case of using FTP or tentacle with password. User is always "pandora" # In case of using FTP or tentacle with password. User is always "pandora"
#server_pwd pandora #server_pwd pandora
# Debug mode do not copy XML data files to server. # Debug mode renames XML in the temp folder and continues running
# debug 1 # debug 1
# ODBC connections. Check documentation for more information. # ODBC connections. Check documentation for more information.

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.705, AIX version # Version 7.0NG.710, AIX version
# General Parameters # General Parameters
# ================== # ==================
@ -11,7 +11,7 @@ pandora_path /usr/share/pandora_agent
temporal /var/spool/pandora/data_out temporal /var/spool/pandora/data_out
interval 300 interval 300
checksum 0 checksum 0
#agent_name adama # Debug mode renames XML in the temp folder and continues running
debug 0 debug 0
# By default is 22 (for ssh) # By default is 22 (for ssh)
#server_port 22 #server_port 22

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.705 # Version 7.0NG.710
# FreeBSD/IPSO version # FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena # Licenced under GPL licence, 2003-2007 Sancho Lerena
@ -13,6 +13,7 @@ pandora_path /opt/pandora_agent
temporal /var/spool/pandora/data_out temporal /var/spool/pandora/data_out
interval 600 interval 600
agent_name nokia agent_name nokia
# Debug mode renames XML in the temp folder and continues running
debug 0 debug 0
checksum 0 checksum 0
harmless_mode 1 harmless_mode 1

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.705, HPUX Version # Version 7.0NG.710, HPUX Version
# General Parameters # General Parameters
# ================== # ==================
@ -11,6 +11,7 @@ temporal /var/spool/pandora/data_out
interval 300 interval 300
#agent_name satellite_system #agent_name satellite_system
checksum 1 checksum 1
# Debug mode renames XML in the temp folder and continues running
debug 0 debug 0
# Module Definition # Module Definition

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.705 # Version 7.0NG.710
# 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
@ -15,8 +15,7 @@ logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default # Interval in seconds, 300 by default
interval 300 interval 300
# Debug mode only generate XML, and stop after first execution, # Debug mode renames XML in the temp folder and continues running
# and does not copy XML to server.
debug 0 debug 0
# By default, agent takes machine name # By default, agent takes machine name

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.705 # Version 7.0NG.710
# 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
@ -15,8 +15,7 @@ logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default # Interval in seconds, 300 by default
interval 300 interval 300
# Debug mode only generate XML, and stop after first execution, # Debug mode renames XML in the temp folder and continues running
# and does not copy XML to server.
debug 0 debug 0
# By default, agent takes machine name # By default, agent takes machine name

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.705 # Version 7.0NG.710
# Licensed under GPL license v2, # Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net
@ -14,8 +14,7 @@ logfile /opt/pandora/pandora_agent.log
# Interval in seconds, 300 by default # Interval in seconds, 300 by default
interval 30 interval 30
# Debug mode only generate XML, and stop after first execution, # Debug mode renames XML in the temp folder and continues running
# and does not copy XML to server.
debug 0 debug 0
# By default, agent takes machine name # By default, agent takes machine name

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.705, Solaris version # Version 7.0NG.710, Solaris version
# General Parameters # General Parameters
# ================== # ==================
@ -11,6 +11,7 @@ temporal /var/spool/pandora/data_out
interval 300 interval 300
#agent_name satellite_system #agent_name satellite_system
checksum 0 checksum 0
# Debug mode renames XML in the temp folder and continues running
debug 0 debug 0
# By default is 22 (for ssh) # By default is 22 (for ssh)
#server_port 22 #server_port 22

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.705, AIX version # Version 7.0NG.710, 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
@ -15,8 +15,7 @@ logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default # Interval in seconds, 300 by default
interval 300 interval 300
# Debug mode only generate XML, and stop after first execution, # Debug mode renames XML in the temp folder and continues running
# and does not copy XML to server.
debug 0 debug 0
# By default, agent takes machine name # By default, agent takes machine name

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.705-170710 Version: 7.0NG.710-170814
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.705-170710" pandora_version="7.0NG.710-170814"
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

@ -14,3 +14,4 @@ if [ -x `command -v systemctl` ]; then
else else
update-rc.d -f pandora_agent_daemon remove update-rc.d -f pandora_agent_daemon remove
fi fi
exit 0

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.705, GNU/Linux # Version 7.0NG.710, 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
@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default # Interval in seconds, 300 by default
interval 300 interval 300
# Debug mode only generate XML, and stop after first execution, # Debug mode renames XML in the temp folder and continues running
# and does not copy XML to server.
debug 0 debug 0
# Optional. UDP Server to receive orders from outside # Optional. UDP Server to receive orders from outside

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.705, FreeBSD Version # Version 7.0NG.710, 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
@ -18,8 +18,7 @@ logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default # Interval in seconds, 300 by default
interval 300 interval 300
# Debug mode only generate XML, and stop after first execution, # Debug mode renames XML in the temp folder and continues running
# and does not copy XML to server.
debug 0 debug 0
# Optional. UDP Server to receive orders from outside # Optional. UDP Server to receive orders from outside

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.705, HP-UX Version # Version 7.0NG.710, 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
@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default # Interval in seconds, 300 by default
interval 300 interval 300
# Debug mode only generate XML, and stop after first execution, # Debug mode renames XML in the temp folder and continues running
# and does not copy XML to server.
debug 0 debug 0
# By default, agent takes machine name # By default, agent takes machine name

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.705, GNU/Linux # Version 7.0NG.710, 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
@ -18,8 +18,7 @@ logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default # Interval in seconds, 300 by default
interval 300 interval 300
# Debug mode only generate XML, and stop after first execution, # Debug mode renames XML in the temp folder and continues running
# and does not copy XML to server.
debug 0 debug 0
# Optional. UDP Server to receive orders from outside # Optional. UDP Server to receive orders from outside

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.705, GNU/Linux # Version 7.0NG.710, 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.705, NetBSD Version # Version 7.0NG.710, 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
@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default # Interval in seconds, 300 by default
interval 300 interval 300
# Debug mode only generate XML, and stop after first execution, # Debug mode renames XML in the temp folder and continues running
# and does not copy XML to server.
debug 0 debug 0
# By default, agent takes machine name # By default, agent takes machine name

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.705, Solaris Version # Version 7.0NG.710, 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
@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default # Interval in seconds, 300 by default
interval 300 interval 300
# Debug mode only generate XML, and stop after first execution, # Debug mode renames XML in the temp folder and continues running
# and does not copy XML to server.
debug 0 debug 0
# By default, agent takes machine name # By default, agent takes machine name

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.705'; use constant AGENT_VERSION => '7.0NG.710';
use constant AGENT_BUILD => '170710'; use constant AGENT_BUILD => '170814';
# 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,11 +906,10 @@ 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;
@ -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,6 +957,67 @@ sub send_file {
waitpid ($pid, 0); waitpid ($pid, 0);
my $rc = $? >> 8; my $rc = $? >> 8;
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 ();
return $rc;
}
else{
my $rc_secondary = 0;
if( ($rc != 0) && ($file =~ /\.data/)){
$rc_secondary = 1;
}
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)); return $rc unless (defined ($secondary));
# Send the file to the secondary server # Send the file to the secondary server
@ -968,29 +1028,33 @@ sub send_file {
swap_servers (); swap_servers ();
return $rc; 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;
if (defined($flag_always) && ($flag_always == 2)){
swap_servers ();
}
while (my $xml_file = readdir(TEMPORAL)) { 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.705 %define version 7.0NG.710
%define release 170710 %define release 170814
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.705 %define version 7.0NG.710
%define release 170710 %define release 170814
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.705" PI_VERSION="7.0NG.710"
PI_BUILD="170710" PI_BUILD="170814"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0
@ -150,6 +150,13 @@ uninstall () {
rm /Library/LaunchDaemons/com.pandorafms.pandorafms.plist 2> /dev/null rm /Library/LaunchDaemons/com.pandorafms.pandorafms.plist 2> /dev/null
fi fi
# Stops the agent on uninstall
if [ -f $PANDORA_BASE/etc/init.d/pandora_agent_daemon ]; then
$PANDORA_BASE/etc/init.d/pandora_agent_daemon stop 12> /dev/null
else
echo "$PANDORA_BASE/etc/init.d/pandora_agent_daemon not found to stop agent"
fi
echo "Removing Pandora FMS Agent..." echo "Removing Pandora FMS Agent..."
rm -Rf $PANDORA_BASE$PANDORA_BIN 2> /dev/null rm -Rf $PANDORA_BASE$PANDORA_BIN 2> /dev/null
rm -Rf $PANDORA_BASE$PANDORA_EXEC_BIN 2> /dev/null rm -Rf $PANDORA_BASE$PANDORA_EXEC_BIN 2> /dev/null

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.705 # Version 7.0NG.710
# 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
@ -77,7 +77,7 @@ server_port 41121
# If set to 1 disables log writing into pandora_agent.log # If set to 1 disables log writing into pandora_agent.log
#disable_logfile 1 #disable_logfile 1
# Debug mode do not copy XML data files to server. # Debug mode renames XML in the temp folder and continues running
# debug 1 # debug 1
# If set to 1 allows the agent to be configured via the web console # If set to 1 allows the agent to be configured via the web console

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes} {Yes}
AppName AppName
{Pandora FMS Windows Agent v7.0NG.705} {Pandora FMS Windows Agent v7.0NG.710}
ApplicationID ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F} {17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{170710} {170814}
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.705(Build 170710)") #define PANDORA_VERSION ("7.0NG.710(Build 170814)")
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.705(Build 170710))" VALUE "ProductVersion", "(7.0NG.710(Build 170814))"
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.705-170710 Version: 7.0NG.710-170814
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.705-170710" pandora_version="7.0NG.710-170814"
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

@ -127,7 +127,7 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d
ui_print_error_message( ui_print_error_message(
__('Unsuccessful installed tables into the testing DB')); __('Unsuccessful installed tables into the testing DB'));
} }
else { else {/*
if (enterprise_installed()) { if (enterprise_installed()) {
$install_tables_enterprise = $install_tables_enterprise =
extension_db_status_execute_sql_file( extension_db_status_execute_sql_file(
@ -139,7 +139,7 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d
__('Unsuccessful installed enterprise tables into the testing DB')); __('Unsuccessful installed enterprise tables into the testing DB'));
} }
} }
*/
extension_db_check_tables_differences( extension_db_check_tables_differences(
$connection_test, $connection_test,
$connection_system, $connection_system,
@ -159,6 +159,7 @@ function extension_db_check_tables_differences($connection_test,
global $config; global $config;
// --------- Check the tables -------------------------------------- // --------- Check the tables --------------------------------------
mysql_select_db($db_name_test, $connection_test); mysql_select_db($db_name_test, $connection_test);
$result = mysql_query("SHOW TABLES", $connection_test); $result = mysql_query("SHOW TABLES", $connection_test);
@ -170,9 +171,8 @@ function extension_db_check_tables_differences($connection_test,
//~ $tables_test = array_merge($tables_test, //~ $tables_test = array_merge($tables_test,
//~ extension_db_status_extension_tables()); //~ extension_db_status_extension_tables());
mysql_select_db($db_name_system, $connection_test);
mysql_select_db($db_name_system, $connection_system); $result = mysql_query("SHOW TABLES", $connection_test);
$result = mysql_query("SHOW TABLES", $connection_system);
$tables_system = array(); $tables_system = array();
while ($row = mysql_fetch_array ($result)) { while ($row = mysql_fetch_array ($result)) {
$tables_system[] = $row[0]; $tables_system[] = $row[0];
@ -227,8 +227,8 @@ function extension_db_check_tables_differences($connection_test,
mysql_select_db($db_name_system, $connection_system); mysql_select_db($db_name_system, $connection_test);
$result = mysql_query("EXPLAIN " . $table, $connection_system); $result = mysql_query("EXPLAIN " . $table, $connection_test);
$fields_system = array(); $fields_system = array();
if (!empty($result)) { if (!empty($result)) {
while ($row = mysql_fetch_array ($result)) { while ($row = mysql_fetch_array ($result)) {

View File

@ -0,0 +1,17 @@
START TRANSACTION;
alter table tusuario add autorefresh_white_list text not null default '';
ALTER TABLE tserver_export MODIFY name varchar(600) BINARY NOT NULL default '';
CREATE TABLE IF NOT EXISTS `tpolicy_groups` (
`id` int(10) unsigned NOT NULL auto_increment,
`id_policy` int(10) unsigned default '0',
`id_group` int(10) unsigned default '0',
`policy_applied` tinyint(1) unsigned default '0',
`pending_delete` tinyint(1) unsigned default '0',
`last_apply_utimestamp` int(10) unsigned NOT NULL default 0,
PRIMARY KEY (`id`),
UNIQUE (`id_policy`, `id_group`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
COMMIT;

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

@ -181,6 +181,20 @@ CREATE TABLE IF NOT EXISTS `tpolicy_agents` (
UNIQUE (`id_policy`, `id_agent`) UNIQUE (`id_policy`, `id_agent`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `tpolicy_groups`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tpolicy_groups` (
`id` int(10) unsigned NOT NULL auto_increment,
`id_policy` int(10) unsigned default '0',
`id_group` int(10) unsigned default '0',
`policy_applied` tinyint(1) unsigned default '0',
`pending_delete` tinyint(1) unsigned default '0',
`last_apply_utimestamp` int(10) unsigned NOT NULL default 0,
PRIMARY KEY (`id`),
UNIQUE (`id_policy`, `id_group`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tdashboard` -- Table `tdashboard`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1136,10 +1150,10 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 1); INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 4);
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '704'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '708');
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tplanned_downtime_agents` -- Table `tplanned_downtime_agents`
@ -1168,6 +1182,7 @@ ALTER TABLE tevent_filter ADD COLUMN `date_to` date DEFAULT NULL;
ALTER TABLE tusuario ADD COLUMN `id_filter` int(10) UNSIGNED NULL DEFAULT NULL; ALTER TABLE tusuario ADD COLUMN `id_filter` int(10) UNSIGNED NULL DEFAULT NULL;
ALTER TABLE tusuario ADD CONSTRAINT `fk_id_filter` FOREIGN KEY (`id_filter`) REFERENCES tevent_filter(`id_filter`) ON DELETE SET NULL; ALTER TABLE tusuario ADD CONSTRAINT `fk_id_filter` FOREIGN KEY (`id_filter`) REFERENCES tevent_filter(`id_filter`) ON DELETE SET NULL;
ALTER TABLE tusuario ADD COLUMN `session_time` int(10) signed NOT NULL default '0'; ALTER TABLE tusuario ADD COLUMN `session_time` int(10) signed NOT NULL default '0';
alter table tusuario add autorefresh_white_list text not null default '';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tagente_modulo` -- Table `tagente_modulo`
@ -1312,6 +1327,7 @@ IF @vv1>0 THEN
END IF; END IF;
END; END;
// //
delimiter;
CALL addcol(); CALL addcol();
DROP PROCEDURE addcol; DROP PROCEDURE addcol;
@ -1336,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`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1371,3 +1398,21 @@ CREATE TABLE IF NOT EXISTS `treset_pass` (
UPDATE tgis_map_connection SET conection_data = '{"type":"OSM","url":"http://tile.openstreetmap.org/${z}/${x}/${y}.png"}' where id_tmap_connection = 1; UPDATE tgis_map_connection SET conection_data = '{"type":"OSM","url":"http://tile.openstreetmap.org/${z}/${x}/${y}.png"}' where id_tmap_connection = 1;
ALTER TABLE tpolicy_modules MODIFY post_process double(24,15) default 0; ALTER TABLE tpolicy_modules MODIFY post_process double(24,15) default 0;
-- ---------------------------------------------------------------------
-- Table `tserver_export`
-- ---------------------------------------------------------------------
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 '';

View File

@ -0,0 +1,25 @@
<?php
include_once ('include/config.php');
include_once ('include/functions.php');
include_once ('include/functions_db.php');
include_once ('include/auth/mysql.php');
$id = get_parameter('get_image');
$sql = 'SELECT datos FROM tagente_estado WHERE id_agente_modulo = '.$id;
$result = db_get_sql($sql);
$image = strpos($result, 'data:image');
if($image === false){
echo 0;
}
else{
echo 1;
}
?>

View File

@ -32,6 +32,12 @@ if (!$config["MR"]) {
echo '<a class="white_bold footer" target="_blank" href="' . $config["homeurl"] . $license_file. '">'; echo '<a class="white_bold footer" target="_blank" href="' . $config["homeurl"] . $license_file. '">';
if(enterprise_installed()){
enterprise_include_once("../include/functions_update_manager.php");
}
$current_package = update_manager_get_current_package();
if($current_package == 0){ if($current_package == 0){
$build_package_version = $build_version; $build_package_version = $build_version;
} }
@ -39,7 +45,6 @@ else{
$build_package_version = $current_package; $build_package_version = $current_package;
} }
echo sprintf(__('Pandora FMS %s - Build %s - MR %s', $pandora_version, $build_package_version, $config["MR"])); echo sprintf(__('Pandora FMS %s - Build %s - MR %s', $pandora_version, $build_package_version, $config["MR"]));
echo '</a><br />'; echo '</a><br />';

View File

@ -191,7 +191,9 @@ config_check();
$_GET['refr'] = null; $_GET['refr'] = null;
} }
if ($config['autorefresh_white_list'] !== null && array_search($_GET['sec2'], $config['autorefresh_white_list']) !== false) { $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']);
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'))); $autorefresh_img = html_print_image("images/header_refresh.png", true, array("class" => 'bot', "alt" => 'lightning', 'title' => __('Configure autorefresh')));
if ($_GET['refr']) { if ($_GET['refr']) {
@ -354,7 +356,7 @@ config_check();
var new_chat = <?php echo (int)$_SESSION['new_chat'];?>; var new_chat = <?php echo (int)$_SESSION['new_chat'];?>;
$(document).ready (function () { $(document).ready (function () {
<?php <?php
if (($config['autorefresh_white_list'] !== null) && (array_search($_GET['sec2'], $config['autorefresh_white_list']) !== false) && (!isset($_GET["refr"]))) { if (($autorefresh_list !== null) && (array_search($_GET['sec2'], $autorefresh_list) !== false) && (!isset($_GET["refr"]))) {
?> ?>
$("a.autorefresh_txt").toggle (); $("a.autorefresh_txt").toggle ();
$("#combo_refr").toggle (); $("#combo_refr").toggle ();

View File

@ -119,7 +119,7 @@ $(document).ready (function () {
// Update config['skip_login_help_dialog'] to don't display more this message // Update config['skip_login_help_dialog'] to don't display more this message
if (skip_login_help) { if (skip_login_help) {
jQuery.get ("ajax.php", jQuery.post ("ajax.php",
{"page": "general/login_help_dialog", {"page": "general/login_help_dialog",
"skip_login_help": 1}, "skip_login_help": 1},
function (data) {} function (data) {}

View File

@ -239,6 +239,16 @@ if ($create_agent) {
$agent_created_ok = true; $agent_created_ok = true;
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
WHERE id_group = ".$grupo);
if($tpolicy_group_old){
foreach ($tpolicy_group_old as $key => $old_group) {
db_process_sql_insert ('tpolicy_agents',
array('id_policy' => $old_group['id_policy'], 'id_agent' => $id_agente));
}
}
$info = 'Name: ' . $nombre_agente . $info = 'Name: ' . $nombre_agente .
' IP: ' . $direccion_agente . ' IP: ' . $direccion_agente .
' Group: ' . $grupo . ' Group: ' . $grupo .
@ -774,6 +784,10 @@ if ($update_agent) { // if modified some agent paramenter
$values['update_module_count'] = 1; // Force an update of the agent cache. $values['update_module_count'] = 1; // Force an update of the agent cache.
} }
$group_old = db_get_sql("SELECT id_grupo FROM tagente WHERE id_agente =" .$id_agente);
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
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(
@ -788,6 +802,38 @@ if ($update_agent) { // if modified some agent paramenter
enterprise_hook('config_agents_update_config_interval', array($id_agente, $intervalo)); enterprise_hook('config_agents_update_config_interval', array($id_agente, $intervalo));
} }
if($tpolicy_group_old){
foreach ($tpolicy_group_old as $key => $value) {
$tpolicy_agents_old= db_get_sql("SELECT * FROM tpolicy_agents
WHERE id_policy = ".$value['id_policy'] . " AND id_agent = " .$id_agente);
if($tpolicy_agents_old){
$result2 = db_process_sql_update ('tpolicy_agents',
array('pending_delete' => 1),
array ('id_agent' => $id_agente, 'id_policy' => $value['id_policy']));
}
}
}
$tpolicy_group = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
WHERE id_group = ".$grupo);
if($tpolicy_group){
foreach ($tpolicy_group as $key => $value) {
$tpolicy_agents= db_get_sql("SELECT * FROM tpolicy_agents
WHERE id_policy = ".$value['id_policy'] . " AND id_agent =" .$id_agente);
if(!$tpolicy_agents){
db_process_sql_insert ('tpolicy_agents',
array('id_policy' => $value['id_policy'], 'id_agent' => $id_agente));
} else {
$result3 = db_process_sql_update ('tpolicy_agents',
array('pending_delete' => 0),
array ('id_agent' => $id_agente, 'id_policy' => $value['id_policy']));
}
}
}
$info = 'Group: ' . $grupo . ' Interval: ' . $intervalo . $info = 'Group: ' . $grupo . ' Interval: ' . $intervalo .
' Comments: ' . $comentarios . ' Mode: ' . $modo . ' Comments: ' . $comentarios . ' Mode: ' . $modo .
' ID OS: ' . $id_os . ' Disabled: ' . $disabled . ' ID OS: ' . $id_os . ' Disabled: ' . $disabled .
@ -954,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)) {
@ -965,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 = str_replace('\\', "&#92;",
io_safe_input($new_configuration_data));;
$configuration_data = $new_configuration_data; html_debug($configuration_data, true);
} }
// Services are an enterprise feature, // Services are an enterprise feature,
@ -1182,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,
@ -1342,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,
@ -1466,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

@ -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

@ -148,7 +148,7 @@ $table_simple->colspan[6][1] = 3;
$table_simple->data[0][0] = __('Name'); $table_simple->data[0][0] = __('Name');
$table_simple->data[0][1] = html_print_input_text_extended ('name', $table_simple->data[0][1] = html_print_input_text_extended ('name',
io_safe_output($name), 'text-name', '', 45, 100, $disabledBecauseInPolicy, '', $largeClassDisabledBecauseInPolicy, true); io_safe_input(html_entity_decode($name)), 'text-name', '', 45, 100, $disabledBecauseInPolicy, '', $largeClassDisabledBecauseInPolicy, true);
//$table_simple->data[0][1] = html_print_input_text ('name', //$table_simple->data[0][1] = html_print_input_text ('name',
// io_safe_output($name), '', 45, 100, true, $disabledBecauseInPolicy); // io_safe_output($name), '', 45, 100, true, $disabledBecauseInPolicy);

View File

@ -32,7 +32,7 @@ $id_alert = get_parameter ("id_alert", 0); // ID given as parameter
$alert = alerts_get_alert_agent_module($id_alert); $alert = alerts_get_alert_agent_module($id_alert);
$template = alerts_get_alert_template ($alert['id_alert_template']); $template = alerts_get_alert_template ($alert['id_alert_template']);
$actions = alerts_get_alert_agent_module_actions ($id_alert); $actions = alerts_get_alert_agent_module_actions ($id_alert);
$agent_name = modules_get_agentmodule_agent_name ($alert['id_agent_module']); $agent_alias = modules_get_agentmodule_agent_alias ($alert['id_agent_module']);
$agent = modules_get_agentmodule_agent ($alert['id_agent_module']); $agent = modules_get_agentmodule_agent ($alert['id_agent_module']);
$module_name = modules_get_agentmodule_name ($alert['id_agent_module']); $module_name = modules_get_agentmodule_name ($alert['id_agent_module']);
@ -65,7 +65,7 @@ $table_details->data[] = $data;
$data[0] = __('Agent'); $data[0] = __('Agent');
$data[1] ='<a style=" font-size: 7pt;" href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent. $data[1] ='<a style=" font-size: 7pt;" href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent.
'" title="'.$agent_name.'"><b><span style=" font-size: 7pt;">'.$agent_name.'</span></b></a>'; '" title="'.$agent_alias.'"><b><span style=" font-size: 7pt;">'.$agent_alias.'</span></b></a>';
$table_details->data[] = $data; $table_details->data[] = $data;
$data[0] = __('Module'); $data[0] = __('Module');

View File

@ -139,9 +139,51 @@ if ($update_agents) {
isset($values['id_grupo'])) { isset($values['id_grupo'])) {
$values['update_module_count'] = 1; // Force an update of the agent cache. $values['update_module_count'] = 1; // Force an update of the agent cache.
} }
$group_old = false;
if($values['id_grupo']){
$group_old = db_get_sql("SELECT id_grupo FROM tagente WHERE id_agente =" .$id_agent);
}
$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){
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
WHERE id_group = ".$group_old);
if($tpolicy_group_old){
foreach ($tpolicy_group_old as $key => $value) {
$tpolicy_agents_old= db_get_sql("SELECT * FROM tpolicy_agents
WHERE id_policy = ".$value['id_policy'] . " AND id_agent = " .$id_agent);
if($tpolicy_agents_old){
$result2 = db_process_sql_update ('tpolicy_agents',
array('pending_delete' => 1),
array ('id_agent' => $id_agent, 'id_policy' => $value['id_policy']));
}
}
}
$tpolicy_group_new = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
WHERE id_group = ".$values['id_grupo']);
if($tpolicy_group_new){
foreach ($tpolicy_group_new as $key => $value) {
$tpolicy_agents_new= db_get_sql("SELECT * FROM tpolicy_agents
WHERE id_policy = ".$value['id_policy'] . " AND id_agent =" .$id_agent);
if(!$tpolicy_agents_new){
db_process_sql_insert ('tpolicy_agents',
array('id_policy' => $value['id_policy'], 'id_agent' => $id_agent));
} else {
$result3 = db_process_sql_update ('tpolicy_agents',
array('pending_delete' => 0),
array ('id_agent' => $id_agent, 'id_policy' => $value['id_policy']));
}
}
}
}
} }
// Update Custom Fields // Update Custom Fields

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;
} }
@ -434,6 +445,12 @@ if($edit_container){
$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

@ -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

@ -85,6 +85,45 @@ function visual_map_main() {
$(window).load(function() { $(window).load(function() {
$('#module').change(function(){
var txt = $("#module").val();
if(selectedItem == 'simple_value' || creationItem == 'simple_value'){
$.ajax({
async:false,
type: "POST",
url: "ajax.php",
data: {"page" : "general/check_image_module",
"get_image" : txt,
},
success: function(data) {
if(data == 0){
$("#data_image_check").html('Off');
$('#data_image_container').css('display','none');
$('#data_image_check').css('display','none');
$('#data_image_check_label').css('display','none');
$('.block_tinymce').remove();
$('#process_value_row').css('display','table-row');
if($('#process_value').val() != '0'){
$('#period_row').css('display','table-row');
}
}
else{
$('#data_image_container').css('display','inline');
$('#data_image_check').css('display','inline');
$('#data_image_check_label').css('display','inline');
$("#data_image_check").html('On');
$('#process_value_row').css('display','none');
$('#period_row').css('display','none');
$('#text-label_ifr').contents().find('#tinymce').html('_VALUE_');
$('.block_tinymce').remove();
$('#label_row').append('<div class="block_tinymce" style="background-color:#fbfbfb;position:absolute;left:0px;height:230px;width:100%;opacity:0.7;z-index:5;"></div>');
}
}
});
}
});
// Begin - Background label color changer // Begin - Background label color changer
$( "#text-label_ifr" ).contents().find( "body" ).bind("contextmenu", function(e) { $( "#text-label_ifr" ).contents().find( "body" ).bind("contextmenu", function(e) {
@ -295,7 +334,6 @@ function update_button_palette_callback() {
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;
@ -305,7 +343,6 @@ function update_button_palette_callback() {
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");
if (values['type_percentile'] == 'bubble') { if (values['type_percentile'] == 'bubble') {
@ -315,12 +352,8 @@ 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($('#dir_items').html() == 'horizontal'){
if(parseInt($('#text-left').val()) + (parseInt($('input[name=height_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'))){ || parseInt($('#text-left').val()) + (parseInt($('input[name=width_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))){
@ -339,7 +372,6 @@ function update_button_palette_callback() {
} }
} }
if($('input[name=width_module_graph]').val() == ''){ if($('input[name=width_module_graph]').val() == ''){
alert('Undefined width'); alert('Undefined width');
return false; return false;
@ -353,23 +385,58 @@ function update_button_palette_callback() {
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 'simple_value': 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']); $("#text_" + idItem).html(values['label']);
$("#image_" + idItem).attr("src", "images/spinner.gif");
setEventsBar(idItem, values);
break;
case 'simple_value':
//checkpoint
// if(($('#text-label_ifr').contents().find('#tinymce p').html() == '_VALUE_' ||
// $('#text-label_ifr').contents().find('#tinymce').html() == '_VALUE_')
// && $('#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.');
// return;
// }
$("#" + idItem).html(values['label']);
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">');
$("#" + idItem).html('<img style="width:'+values['width_data_image']+'px;" src="images/console/signes/data_image.png">');
}
else{
$("#text_" + idItem).html(
'<table><tbody><tr><td></td></tr><tr><td><span style="" id="text_21" class="text">'+values["label"]+'</span></td></tr><tr><td></td></tr></tbody></table>'
)
$("#" + idItem).html(
'<table><tbody><tr><td></td></tr><tr><td><span style="" id="text_21" class="text">'+values["label"]+'</span></td></tr><tr><td></td></tr></tbody></table>'
)
}
//$("#simplevalue_" + idItem) //$("#simplevalue_" + idItem)
//.html($('<img></img>').attr('src', "images/spinner.gif")); //.html($('<img></img>').attr('src', "images/spinner.gif"));
setModuleValue(idItem,values['process_simple_value'], values['period']); setModuleValue(idItem,values['process_simple_value'], values['period'],values['width']);
break; break;
case 'label': case 'label':
$("#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;
@ -510,14 +577,24 @@ function readFields() {
values['process_simple_value'] = $("select[name=process_value]").val(); values['process_simple_value'] = $("select[name=process_value]").val();
values['background'] = $("#background_image").val(); values['background'] = $("#background_image").val();
values['period'] = undefined != $("#hidden-period").val() ? $("#hidden-period").val() : $("#period").val(); values['period'] = undefined != $("#hidden-period").val() ? $("#hidden-period").val() : $("#period").val();
if (values['period'] == null) {
values['period'] = undefined != $("#hidden-period").val() ? $("#hidden-period").val() : $("#period_select").val();
}
values['width'] = $("input[name=width]").val(); values['width'] = $("input[name=width]").val();
values['width_data_image'] = $("#data_image_width").val();
if(selectedItem == 'simple_value' || creationItem == 'simple_value'){
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;
@ -587,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());
@ -678,6 +765,7 @@ function create_button_palette_callback() {
create_line('step_1', values); create_line('step_1', values);
break; break;
default: default:
insertDB(creationItem, values); insertDB(creationItem, values);
break; break;
} }
@ -861,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);
@ -880,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);
@ -956,6 +1046,14 @@ function toggle_item_palette() {
$( "#text-label_ifr" ).contents().find( "body" ).css("background","lightgray"); $( "#text-label_ifr" ).contents().find( "body" ).css("background","lightgray");
} }
if(creationItem != 'simple_value'){
$("#data_image_check").html('Off');
$("#data_image_check").css('display','none');
$("#data_image_check_label").css('display','none');
$("#data_image_container").css('display','none');
$('.block_tinymce').remove();
}
} }
function fill_parent_select(id_item) { function fill_parent_select(id_item) {
@ -1012,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);
@ -1346,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', '');
@ -1518,7 +1621,6 @@ function set_static_graph_status(idElement, image, status) {
data: parameter, data: parameter,
success: function (data) { success: function (data) {
set_static_graph_status(idElement, image, data); set_static_graph_status(idElement, image, data);
if($('#'+idElement+' table').css('float') == 'right' || $('#'+idElement+ ' table').css('float') == 'left'){ if($('#'+idElement+' table').css('float') == 'right' || $('#'+idElement+ ' table').css('float') == 'left'){
$('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2); $('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2);
} }
@ -1554,7 +1656,6 @@ function set_static_graph_status(idElement, image, status) {
suffix = ".png"; suffix = ".png";
break; break;
} }
set_image("image", idElement, image + suffix); set_image("image", idElement, image + suffix);
} }
@ -1678,12 +1779,13 @@ function setModuleGraph(id_data) {
} }
function setModuleValue(id_data, process_simple_value, period) { function setModuleValue(id_data, process_simple_value, period,width_data_image) {
var parameter = Array(); var 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: "get_module_value"}); parameter.push ({name: "action", value: "get_module_value"});
parameter.push ({name: "id_element", value: id_data}); parameter.push ({name: "id_element", value: id_data});
parameter.push ({name: "period", value: period}); parameter.push ({name: "period", value: period});
parameter.push ({name: "width", value: width_data_image});
parameter.push ({name: "id_visual_console", value: id_visual_console}); parameter.push ({name: "id_visual_console", value: id_visual_console});
if (process_simple_value != undefined) { if (process_simple_value != undefined) {
parameter.push ({name: "process_simple_value", value: process_simple_value}); parameter.push ({name: "process_simple_value", value: process_simple_value});
@ -1695,7 +1797,9 @@ function setModuleValue(id_data, process_simple_value, period) {
type: "POST", type: "POST",
dataType: 'json', dataType: 'json',
success: function (data) { success: function (data) {
var currentValue = $("#text_" + id_data).html(); var currentValue = $("#text_" + id_data).html();
//currentValue = currentValue.replace(/_VALUE_/gi, data.value); //currentValue = currentValue.replace(/_VALUE_/gi, data.value);
$("#text_" + id_data).html(currentValue); $("#text_" + id_data).html(currentValue);
//$("#text_" + id_data).html('Data value'); //$("#text_" + id_data).html('Data value');
@ -1780,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();
@ -2026,6 +2179,10 @@ function createItem(type, values, id_data) {
$image.attr('width', '70') $image.attr('width', '70')
.attr('height', '70'); .attr('height', '70');
} }
else{
$image.attr('width', $('#preview > img')[0].naturalWidth)
.attr('height', $('#preview > img')[0].naturalHeight);
}
} }
else { else {
$image.attr('width', values['width']) $image.attr('width', values['width'])
@ -2091,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':
@ -2206,10 +2374,14 @@ function createItem(type, values, id_data) {
case 'simple_value': case 'simple_value':
sizeStyle = ''; sizeStyle = '';
imageSize = ''; imageSize = '';
if($('#data_image_check').html() == 'On'){
values['label'] = '<img style="width:'+$('#data_image_width').val()+'px;" src="images/console/signes/data_image.png">';
}
item = $('<div id="' + id_data + '" class="item simple_value" style="position: absolute; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' + item = $('<div id="' + id_data + '" class="item simple_value" style="position: absolute; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<span id="text_' + id_data + '" class="text"> ' + values['label'] + '</span> ' + '</div>' '<span id="text_' + id_data + '" class="text"> ' + values['label'] + '</span> ' + '</div>'
); );
setModuleValue(id_data,values.process_simple_value,values.period); setModuleValue(id_data,values.process_simple_value,values.period,values.width_data_image);
break; break;
case 'label': case 'label':
item = $('<div id="' + id_data + '" ' + item = $('<div id="' + id_data + '" ' +
@ -2289,6 +2461,7 @@ function addItemSelectParents(id_data, text) {
} }
function insertDB(type, values) { function insertDB(type, values) {
metaconsole = $("input[name='metaconsole']").val(); metaconsole = $("input[name='metaconsole']").val();
$("#saving_in_progress_dialog").dialog({ $("#saving_in_progress_dialog").dialog({
@ -2411,17 +2584,17 @@ 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,
values.period); values.period,values.width_data_image);
} }
@ -2580,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)
@ -2641,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"});
@ -2813,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';
@ -2900,6 +3079,39 @@ function eventsItems(drag) {
if ((!is_opened_palette) && (autosave)) { if ((!is_opened_palette) && (autosave)) {
toggle_item_palette(); toggle_item_palette();
} }
if(selectedItem == 'simple_value'){
$('#data_image_width').val(event.currentTarget.clientWidth);
var found = $('#'+idItem).find("img");
if(found.length > 0){
$("#data_image_check").css('display','inline');
$("#data_image_check_label").css('display','inline');
$('#data_image_container').css('display','inline');
$("#data_image_check").html('On');
$('.block_tinymce').remove();
$('#label_row').append('<div class="block_tinymce" style="background-color:#fbfbfb;position:absolute;left:0px;height:230px;width:100%;opacity:0.7;z-index:5;"></div>');
$('#process_value_row').css('display','none');
$('#period_row').css('display','none');
}
else{
$("#data_image_check").html('Off');
$("#data_image_check").css('display','none');
$("#data_image_check_label").css('display','none');
$('#data_image_container').css('display','none');
$('.block_tinymce').remove();
$('#process_value_row').css('display','table-row');
if($('#process_value').val() != 0){
$('#period_row').css('display','table-row');
}
}
}
else{
$("#data_image_check").css('display','none');
$("#data_image_check_label").css('display','none');
$('#data_image_container').css('display','none');
}
}); });
//Set the limit of draggable in the div with id "background" and set drag //Set the limit of draggable in the div with id "background" and set drag
@ -2920,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';
} }
@ -3218,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;
@ -3273,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);
@ -3303,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':

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

@ -52,6 +52,7 @@ if (is_ajax ()) {
$row['control'] .= __('No').'&nbsp;'.html_print_radio_button('fallback_local_auth', 0, '', $config['fallback_local_auth'], true); $row['control'] .= __('No').'&nbsp;'.html_print_radio_button('fallback_local_auth', 0, '', $config['fallback_local_auth'], true);
$table->data['fallback_local_auth'] = $row; $table->data['fallback_local_auth'] = $row;
if (enterprise_installed()) {
// Autocreate remote users // Autocreate remote users
$row = array(); $row = array();
$row['name'] = __('Autocreate remote users'); $row['name'] = __('Autocreate remote users');
@ -59,7 +60,6 @@ if (is_ajax ()) {
$row['control'] .= __('No').'&nbsp;'.html_print_radio_button_extended('autocreate_remote_users', 0, '', $config['autocreate_remote_users'], false, '', '', true); $row['control'] .= __('No').'&nbsp;'.html_print_radio_button_extended('autocreate_remote_users', 0, '', $config['autocreate_remote_users'], false, '', '', true);
$table->data['autocreate_remote_users'] = $row; $table->data['autocreate_remote_users'] = $row;
if (enterprise_installed()) {
add_enterprise_auth_autocreate_profiles($table, $type_auth); add_enterprise_auth_autocreate_profiles($table, $type_auth);
} }
} }

View File

@ -221,8 +221,6 @@ if (($filter_group == 0) && ($filter_search == '')) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = "databox filters"; $table->class = "databox filters";
if(defined('METACONSOLE'))
$table->class = "databox_filters";
$table->rowclass[0] = ''; $table->rowclass[0] = '';
$table->data[0][0] = '<b>' . __('Group') . '</b>'; $table->data[0][0] = '<b>' . __('Group') . '</b>';
$table->data[0][1] = html_print_select_groups(false, "AR", true, $table->data[0][1] = html_print_select_groups(false, "AR", true,
@ -496,3 +494,10 @@ echo '</div>';
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
?> ?>
<script type="text/javascript">
$(document).ready (function () {
console.log('sknknan');
// text-filter_search
});
</script>

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: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

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,7 +259,9 @@ 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 = "";
@ -281,7 +283,9 @@ 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 .
@ -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

@ -268,21 +268,16 @@ if ($get_module_detail) {
foreach ($columns as $col => $attr) { foreach ($columns as $col => $attr) {
if ($attr[1] != "modules_format_data") { if ($attr[1] != "modules_format_data") {
$data[] = date('d F Y h:i:s A', $row['utimestamp']); $data[] = date('d F Y h:i:s A', $row['utimestamp']);
} }
elseif (($config['command_snapshot']) && (preg_match ("/[\n]+/i", $row[$attr[0]]))) { elseif (($config['command_snapshot']) && (preg_match ("/[\n]+/i", $row[$attr[0]]))) {
// Its a single-data, multiline data (data snapshot) ? // Its a single-data, multiline data (data snapshot) ?
// Detect string data with \n and convert to <br>'s // Detect string data with \n and convert to <br>'s
$datos = $row[$attr[0]]; $datos = $row[$attr[0]];
//$datos = preg_replace ('/\n/i','<br>',$row[$attr[0]]);
//$datos = preg_replace ('/\s/i','&nbsp;',$datos);
// Because this *SHIT* of print_table monster, I cannot format properly this cells // Because this *SHIT* of print_table monster, I cannot format properly this cells
// so, eat this, motherfucker :)) // so, eat this, motherfucker :))
$datos = preg_replace("/\n/", "</br></br>", $datos);
$datos = io_safe_input($datos);
// I dont why, but using index (value) method, data is automatically converted to html entities ¿? // I dont why, but using index (value) method, data is automatically converted to html entities ¿?
$data[] = $datos; $data[] = $datos;
@ -290,7 +285,6 @@ if ($get_module_detail) {
elseif ($is_web_content_string) { elseif ($is_web_content_string) {
//Fixed the goliat sends the strings from web //Fixed the goliat sends the strings from web
//without HTML entities //without HTML entities
$data[] = io_safe_input($row[$attr[0]]); $data[] = io_safe_input($row[$attr[0]]);
} }
else { else {
@ -301,9 +295,6 @@ if ($get_module_detail) {
$data[] = io_safe_input($row[$attr[0]]); $data[] = io_safe_input($row[$attr[0]]);
} }
else if (is_numeric($row[$attr[0]]) && !modules_is_string_type($row['module_type']) ) { else if (is_numeric($row[$attr[0]]) && !modules_is_string_type($row['module_type']) ) {
//~ $data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision']));
//~ $data[] = (double) $row[$attr[0]];
switch($row['module_type']) { switch($row['module_type']) {
case 15: case 15:
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module_id); $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module_id);
@ -328,17 +319,12 @@ if ($get_module_detail) {
$data[] = 'No data'; $data[] = 'No data';
} }
else { else {
if(is_snapshot_data($row[$attr[0]])){ if(is_snapshot_data($row[$attr[0]])){
$data[] = "<a target='_blank' href='".io_safe_input($row[$attr[0]])."'><img style='width:300px' src='".io_safe_input($row[$attr[0]])."'></a>"; $data[] = "<a target='_blank' href='".io_safe_input($row[$attr[0]])."'><img style='width:300px' src='".io_safe_input($row[$attr[0]])."'></a>";
} }
else{ else{
$data[] = $row[$attr[0]]; $data[] = $row[$attr[0]];
} }
} }
} }
} }

View File

@ -0,0 +1,126 @@
<?php
//Pandora FMS- http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2017 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
include_once($config['homedir'] . "/include/functions_config.php");
include_once($config['homedir'] . "/include/functions_snmp_browser.php");
require_once ($config['homedir'] . '/include/functions_network_components.php');
global $config;
if(is_ajax()){
ob_clean();
$action = (string) get_parameter ("action", "");
$target_ip = (string) get_parameter ("target_ip", '');
$community = (string) get_parameter ("community", '');
$snmp_version = (string) get_parameter ("snmp_browser_version", '');
$snmp3_auth_user = get_parameter('snmp3_browser_auth_user');
$snmp3_security_level = get_parameter('snmp3_browser_security_level');
$snmp3_auth_method = get_parameter('snmp3_browser_auth_method');
$snmp3_auth_pass = get_parameter('snmp3_browser_auth_pass');
$snmp3_privacy_method = get_parameter('snmp3_browser_privacy_method');
$snmp3_privacy_pass = get_parameter('snmp3_browser_privacy_pass');
$targets_oids = get_parameter ("oids", "");
$targets_oids = explode(",", $targets_oids);
$custom_action = get_parameter ("custom_action", "");
if ($custom_action != "") {
$custom_action = urldecode (base64_decode ($custom_action));
}
if($action == 'create_modules_snmp'){
$fail_modules = array();
foreach ($targets_oids as $key => $target_oid) {
$oid = snmp_browser_get_oid ($target_ip, $community,
htmlspecialchars_decode($target_oid), $snmp_version, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass);
$name_check = db_get_value ('name', 'tnetwork_component',
'name', $oid['oid']);
if(empty($oid['description'])) {
$description = '';
} else {
$description = io_safe_input($oid['description']);
}
if(!$name_check){
$id = network_components_create_network_component ($oid['oid'],17,1,
array ('description' => $description,
'module_interval' => 300,
'max' => 0,
'min' => 0,
'tcp_send' => $snmp_version,
'tcp_rcv' => '',
'tcp_port' => 0,
'snmp_oid' => $oid['numeric_oid'],
'snmp_community' => $community,
'id_module_group' => 3,
'id_modulo' => 2,
'id_plugin' => 0,
'plugin_user' => '',
'plugin_pass' => '',
'plugin_parameter' => '',
'macros' => '',
'max_timeout' => 0,
'max_retries' => 0,
'history_data' => '',
'dynamic_interval' => 0,
'dynamic_max' => 0,
'dynamic_min' => 0,
'dynamic_two_tailed' => 0,
'min_warning' => 0,
'max_warning' => 0,
'str_warning' => '',
'min_critical' => 0,
'max_critical' => 0,
'str_critical' => '',
'min_ff_event' => 0,
'custom_string_1' => '',
'custom_string_2' => '',
'custom_string_3' => '',
'post_process' => 0,
'unit' => '',
'wizard_level' => 'nowizard',
'macros' => '',
'critical_instructions' => '',
'warning_instructions' => '',
'unknown_instructions' => '',
'critical_inverse' => 0,
'warning_inverse' => 0,
'id_category' => 0,
'tags' => '',
'disabled_types_event' => '{"going_unknown":1}',
'min_ff_event_normal' => 0,
'min_ff_event_warning' => 0,
'min_ff_event_critical' => 0,
'each_ff' => 0));
}
if(empty($id)) {
array_push($fail_modules,$name_check);
}
}
}
echo json_encode($fail_modules);
return;
}
?>

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
@ -422,6 +455,7 @@ switch ($action) {
$values['type'] = visual_map_get_simple_value_type( $values['type'] = visual_map_get_simple_value_type(
$process_simple_value); $process_simple_value);
$values['period'] = $period; $values['period'] = $period;
$values['width'] = $width;
} }
case 'percentile_bar': case 'percentile_bar':
case 'percentile_item': case 'percentile_item':
@ -429,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;
@ -503,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;
@ -658,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));
@ -709,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'];
@ -868,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') {
@ -897,6 +953,7 @@ switch ($action) {
//This allows min, max and avg process in a simple value //This allows min, max and avg process in a simple value
$values['type'] = visual_map_get_simple_value_type($process_simple_value); $values['type'] = visual_map_get_simple_value_type($process_simple_value);
$values['period'] = $period; $values['period'] = $period;
$values['width'] = $width;
break; break;
case 'label': case 'label':
$values['type'] = LABEL; $values['type'] = LABEL;
@ -983,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

@ -22,8 +22,8 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC170710'; $build_version = 'PC170814';
$pandora_version = 'v7.0NG.705'; $pandora_version = 'v7.0NG.710';
// 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();
@ -252,7 +252,7 @@ if (isset($_POST['vc_refr'])) {
//======= Autorefresh code ============================================= //======= Autorefresh code =============================================
$select = db_process_sql("SELECT value FROM tconfig WHERE token='autorefresh_white_list'"); $select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '" . $config['id_user'] . "'");
$autorefresh_list = json_decode($select[0]['value']); $autorefresh_list = json_decode($select[0]['value']);
$config['autorefresh_white_list'] = array(); $config['autorefresh_white_list'] = array();
$config['autorefresh_white_list'] = $autorefresh_list; $config['autorefresh_white_list'] = $autorefresh_list;

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);
@ -467,6 +468,7 @@ define("OPTION_SINGLE_SELECT_TIME", 7);
define("OPTION_CUSTOM_INPUT", 8); define("OPTION_CUSTOM_INPUT", 8);
define("OPTION_AGENT_AUTOCOMPLETE", 9); define("OPTION_AGENT_AUTOCOMPLETE", 9);
define("OPTION_SELECT_MULTISELECTION", 10); define("OPTION_SELECT_MULTISELECTION", 10);
define("OPTION_COLOR_PICKER", 11);
/* Transactional map constants */ /* Transactional map constants */
define("NODE_TYPE", 0); define("NODE_TYPE", 0);

View File

@ -2754,4 +2754,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

@ -1196,6 +1196,10 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3) {
$cascadeProtectionModule = 0; $cascadeProtectionModule = 0;
} }
$group_old = db_get_sql("SELECT id_grupo FROM tagente WHERE id_agente =" .$id_agent);
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
WHERE id_group = ".$group_old);
$return = db_process_sql_update('tagente', $return = db_process_sql_update('tagente',
array('alias' => $alias, array('alias' => $alias,
'direccion' => $ip, 'direccion' => $ip,
@ -1217,6 +1221,40 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3) {
agents_add_address ($id_agent, $ip); agents_add_address ($id_agent, $ip);
} }
if($return){
if($tpolicy_group_old){
foreach ($tpolicy_group_old as $key => $value) {
$tpolicy_agents_old= db_get_sql("SELECT * FROM tpolicy_agents
WHERE id_policy = ".$value['id_policy'] . " AND id_agent = " .$id_agent);
if($tpolicy_agents_old){
$result2 = db_process_sql_update ('tpolicy_agents',
array('pending_delete' => 1),
array ('id_agent' => $id_agent, 'id_policy' => $value['id_policy']));
}
}
}
$tpolicy_group = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
WHERE id_group = ".$idGroup);
if($tpolicy_group){
foreach ($tpolicy_group as $key => $value) {
$tpolicy_agents= db_get_sql("SELECT * FROM tpolicy_agents
WHERE id_policy = ".$value['id_policy'] . " AND id_agent =" .$id_agent);
if(!$tpolicy_agents){
db_process_sql_insert ('tpolicy_agents',
array('id_policy' => $value['id_policy'], 'id_agent' => $id_agent));
} else {
$result3 = db_process_sql_update ('tpolicy_agents',
array('pending_delete' => 0),
array ('id_agent' => $id_agent, 'id_policy' => $value['id_policy']));
}
}
}
}
returnData('string', returnData('string',
array('type' => 'string', 'data' => (int)((bool)$return))); array('type' => 'string', 'data' => (int)((bool)$return)));
} }
@ -1340,6 +1378,18 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3) {
agents_add_address ($idAgente, $ip); agents_add_address ($idAgente, $ip);
} }
if($idGroup && !empty($idAgente)){
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
WHERE id_group = ".$idGroup);
if($tpolicy_group_old){
foreach ($tpolicy_group_old as $key => $old_group) {
db_process_sql_insert ('tpolicy_agents',
array('id_policy' => $old_group['id_policy'], 'id_agent' => $idAgente));
}
}
}
returnData('string', returnData('string',
array('type' => 'string', 'data' => $idAgente)); array('type' => 'string', 'data' => $idAgente));
} }
@ -9506,6 +9556,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.
* *

View File

@ -855,9 +855,6 @@ function config_process_config () {
config_update_value ('status_images_set', 'default'); config_update_value ('status_images_set', 'default');
} }
if(!isset ($config['autorefresh_white_list'])){
config_update_value ('autorefresh_white_list', '');
}
// Load user session // Load user session
if (isset ($_SESSION['id_usuario'])) if (isset ($_SESSION['id_usuario']))
$config["id_user"] = $_SESSION["id_usuario"]; $config["id_user"] = $_SESSION["id_usuario"];
@ -1656,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

@ -164,7 +164,7 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$background_color = 'white', $modules_param = array(), $homeurl = '', $background_color = 'white', $modules_param = array(), $homeurl = '',
$name_list = array(), $unit_list = array(), $show_last = true, $name_list = array(), $unit_list = array(), $show_last = true,
$show_max = true, $show_min = true, $show_avg = true, $ttl = 1, $show_max = true, $show_min = true, $show_avg = true, $ttl = 1,
$dashboard = false, $vconsole = false, $percentil = null, $from_interface = false) { $dashboard = false, $vconsole = false, $percentil = null, $from_interface = false,$id_widget_dashboard=false) {
global $config; global $config;
@ -260,7 +260,8 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$dashboard, $dashboard,
$vconsole, $vconsole,
$percentil, $percentil,
$from_interface); $from_interface,
$id_widget_dashboard);
if ($return) if ($return)
return $output; return $output;

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
); );

View File

@ -368,6 +368,7 @@ function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null, $publ
} }
} }
} }
EventZoomEnd(null,map.zoom);
} }
}); });
} }
@ -405,11 +406,16 @@ function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null, $publ
idIntervalAjax = setInterval("clock_ajax_refresh()", refreshAjaxIntervalSeconds); idIntervalAjax = setInterval("clock_ajax_refresh()", refreshAjaxIntervalSeconds);
oldRefreshAjaxIntervalSeconds = refreshAjaxIntervalSeconds; oldRefreshAjaxIntervalSeconds = refreshAjaxIntervalSeconds;
} }
EventZoomEnd(null,map.zoom);
} }
$(document).ready ( $(document).ready (
function () { function () {
idIntervalAjax = setInterval("clock_ajax_refresh()", refreshAjaxIntervalSeconds); idIntervalAjax = setInterval("clock_ajax_refresh()", refreshAjaxIntervalSeconds);
EventZoomEnd(null,map.zoom);
} }
); );
</script> </script>

View File

@ -867,7 +867,8 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$only_image = false, $homeurl = '', $ttl = 1, $projection = false, $only_image = false, $homeurl = '', $ttl = 1, $projection = false,
$adapt_key = '', $compare = false, $show_unknown = false, $adapt_key = '', $compare = false, $show_unknown = false,
$menu = true, $backgroundColor = 'white', $percentil = null, $menu = true, $backgroundColor = 'white', $percentil = null,
$dashboard = false, $vconsole = false, $type_graph = 'area', $fullscale = false) { $dashboard = false, $vconsole = false, $type_graph = 'area', $fullscale = false,
$id_widget_dashboard = false) {
global $config; global $config;
global $graphic_type; global $graphic_type;
@ -933,7 +934,6 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$projection, $adapt_key, $compare, '', '', $show_unknown, $projection, $adapt_key, $compare, '', '', $show_unknown,
$percentil, $dashboard, $vconsole, $type_graph, $fullscale); $percentil, $dashboard, $vconsole, $type_graph, $fullscale);
if ($return_data) { if ($return_data) {
return $data_returned; return $data_returned;
} }
@ -984,6 +984,13 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
} }
else { else {
// Color commented not to restrict serie colors // Color commented not to restrict serie colors
if($id_widget_dashboard){
$opcion = unserialize(db_get_value_filter('options','twidget_dashboard',array('id' => $id_widget_dashboard)));
$color['min']['color'] = $opcion['min'];
$color['sum']['color'] = $opcion['avg'];
$color['max']['color'] = $opcion['max'];
}
return return
area_graph($flash_chart, $chart, $width, $height, $color, area_graph($flash_chart, $chart, $width, $height, $color,
$legend, $long_index, $legend, $long_index,
@ -1070,7 +1077,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$prediction_period = false, $background_color = 'white', $prediction_period = false, $background_color = 'white',
$name_list = array(), $unit_list = array(), $show_last = true, $show_max = true, $name_list = array(), $unit_list = array(), $show_last = true, $show_max = true,
$show_min = true, $show_avg = true, $labels = array(), $dashboard = false, $show_min = true, $show_avg = true, $labels = array(), $dashboard = false,
$vconsole = false, $percentil = null, $from_interface = false) { $vconsole = false, $percentil = null, $from_interface = false, $id_widget_dashboard=false) {
global $config; global $config;
global $graphic_type; global $graphic_type;
@ -1085,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 {
@ -1375,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);
@ -1391,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'];
@ -1906,6 +1915,15 @@ function graphic_combined_module ($module_list, $weight_list, $period,
'color' => COL_GRAPH13, 'color' => COL_GRAPH13,
'alpha' => CHART_DEFAULT_ALPHA); 'alpha' => CHART_DEFAULT_ALPHA);
if($id_widget_dashboard){
$opcion = unserialize(db_get_value_filter('options','twidget_dashboard',array('id' => $id_widget_dashboard)));
foreach ($module_list as $key => $value) {
if(!empty($opcion[$value])){
$color[$key]['color'] = $opcion[$value];
}
}
}
$threshold_data = array(); $threshold_data = array();
if ($from_interface) { if ($from_interface) {
@ -3565,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;
@ -3582,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);
@ -3605,8 +3729,10 @@ 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');

View File

@ -385,13 +385,28 @@ function html_print_select_groups($id_user = false, $privilege = "AR",
$nothing = '', $nothing_value = 0, $return = false, $nothing = '', $nothing_value = 0, $return = false,
$multiple = false, $sort = true, $class = '', $disabled = false, $multiple = false, $sort = true, $class = '', $disabled = false,
$style = false, $option_style = false, $id_group = false, $style = false, $option_style = false, $id_group = false,
$keys_field = 'id_grupo', $strict_user = false) { $keys_field = 'id_grupo', $strict_user = false, $delete_groups = false , $include_groups = false) {
global $config; global $config;
$fields = users_get_groups_for_select($id_user, $privilege, $fields = users_get_groups_for_select($id_user, $privilege,
$returnAllGroup, true, $id_group, $keys_field); $returnAllGroup, true, $id_group, $keys_field);
if ($delete_groups && is_array($delete_groups)){
foreach ($delete_groups as $value) {
unset($fields[$value]);
}
}
if (is_array($include_groups)){
$field = array();
foreach ($include_groups as $value) {
$field[$value] = $fields[$value];
}
$fields = array_intersect($fields, $field);
}
if ($strict_user) { if ($strict_user) {
$fields = users_get_strict_mode_groups($config['id_user'], $returnAllGroup); $fields = users_get_strict_mode_groups($config['id_user'], $returnAllGroup);
} }

View File

@ -147,6 +147,15 @@ function reporting_make_reporting_data($report = null, $id_report,
} }
} }
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']); $content['name'] = reporting_label_macro($items_label, $content['style']['name_label']);
if ($metaconsole_on) { if ($metaconsole_on) {
@ -2438,6 +2447,13 @@ 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);
@ -2515,6 +2531,10 @@ function reporting_database_serialized($report, $content) {
} }
} }
if ($config['metaconsole']) {
metaconsole_restore_db();
}
$return["data"] = $data; $return["data"] = $data;
return reporting_check_structure_content($return); return reporting_check_structure_content($return);
@ -5780,18 +5800,11 @@ 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 ($type_report == 'automatic_graph') { if ($config['metaconsole'] && $type_report != 'automatic_graph') {
// Do none
}
else {
if ($config['metaconsole']) {
$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);
} }
}
$graph = db_get_row ("tgraph", "id_graph", $content['id_gs']); $graph = db_get_row ("tgraph", "id_graph", $content['id_gs']);
$return = array(); $return = array();
@ -5833,10 +5846,36 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
array_push ($weights, $graph_item["weight"]); array_push ($weights, $graph_item["weight"]);
if (in_array('label',$content['style'])) { if (in_array('label',$content['style'])) {
if (defined('METACONSOLE')) {
$item = array('type' => 'custom_graph',
'id_agent' =>$content['id_agent'],
'id_agent_module'=>$graph_item['id_agent_module']);
}
else {
$item = array('type' => 'custom_graph', $item = array('type' => 'custom_graph',
'id_agent' =>modules_get_agentmodule_agent($graph_item['id_agent_module']), 'id_agent' =>modules_get_agentmodule_agent($graph_item['id_agent_module']),
'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;
} }
} }
@ -5893,14 +5932,9 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
break; break;
} }
if ($type_report == 'automatic_graph') { if ($config['metaconsole'] && $type_report != 'automatic_graph') {
// Do none
}
else {
if ($config['metaconsole']) {
metaconsole_restore_db(); metaconsole_restore_db();
} }
}
return reporting_check_structure_content($return); return reporting_check_structure_content($return);
} }
@ -10296,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

@ -279,4 +279,111 @@ function snmp_update_translation($oid, $new_oid, $description, $post_process) {
} }
} }
} }
/*
* Print the event filter tag cloud (enterprise feature)
* @param $filter_resume: Array with the active filters
* @param $filter_refs: Array of all arrays to humanize some tags
*/
function print_snmp_tags_active_filters ($filter_resume = array()) {
global $config;
$tags_set = array();
// Alert
if (isset($filter_resume['filter_fired'])) {
array_push ($tags_set, array(
'title' => __('Alert'),
'value' => $filter_resume['filter_fired']
));
}
// Severity
if (isset($filter_resume['filter_severity'])) {
array_push ($tags_set, array(
'title' => __('Severity'),
'value' => $filter_resume['filter_severity']
));
}
// Pagination
if ($filter_resume['pagination'] == "") {
$filter_resume['pagination'] = $config["block_size"];
}
array_push ($tags_set, array(
'title' => __('Pagination'),
'value' => $filter_resume['pagination']
));
// Free search
if (isset($filter_resume['free_search_string']) && $filter_resume['free_search_string'] != "") {
array_push ($tags_set, array(
'title' => __('Search'),
'value' => $filter_resume['free_search_string']
));
}
// Status
if (isset($filter_resume['filter_status']) && $filter_resume['filter_status'] != "") {
array_push ($tags_set, array(
'title' => __('Status'),
'value' => $filter_resume['filter_status']
));
}
// Group by
if (isset($filter_resume['group_by'])) {
if ($filter_resume['group_by'] == 0) {
array_push ($tags_set, array(
'title' => __('Group by Enterprise String / IP'),
'value' => __('No')
));
}
else {
array_push ($tags_set, array(
'title' => __('Group by Enterprise String / IP'),
'value' => __('Yes')
));
}
}
// Date from
if (isset($filter_resume['date_from_trap']) && $filter_resume['date_from_trap'] != "") {
if (isset($filter_resume['time_from_trap']) && $filter_resume['time_from_trap'] != "") {
array_push ($tags_set, array(
'title' => __('From'),
'value' => $filter_resume['date_from_trap'] . " " . $filter_resume['time_from_trap']
));
}
else {
array_push ($tags_set, array(
'title' => __('From'),
'value' => $filter_resume['date_from_trap']
));
}
}
// Date to
if (isset($filter_resume['date_to_trap']) && $filter_resume['date_to_trap'] != "") {
if (isset($filter_resume['time_to_trap']) && $filter_resume['time_to_trap'] != "") {
array_push ($tags_set, array(
'title' => __('To'),
'value' => $filter_resume['date_to_trap'] . " " . $filter_resume['time_to_trap']
));
}
else {
array_push ($tags_set, array(
'title' => __('To'),
'value' => $filter_resume['date_to_trap']
));
}
}
// Trap type
if (isset($filter_resume['trap_type'])) {
array_push ($tags_set, array(
'title' => __('Trap type'),
'value' => $filter_resume['trap_type']
));
}
$title = '';
if(!$config['pure']){
$title = isset($filter_resume['title'])
? __('Active filter') . " (" . $filter_resume['title'] . ")"
: __('Active filters');
}
if (sizeof($filter_resume) > 0) ui_print_tags_view($title, $tags_set);
}
?> ?>

View File

@ -116,7 +116,7 @@ function snmp_browser_print_tree ($tree, $id = 0, $depth = 0, $last = 0, $last_a
echo "</a>"; echo "</a>";
} }
echo '&nbsp;<span>' . $level . '</span>'; echo html_print_checkbox("create_$sub_id", 0, false, true, false, '') .'&nbsp;<span>' . $level . '</span>';
if (isset ($sub_level['__VALUE__'])) { if (isset ($sub_level['__VALUE__'])) {
echo '<span class="value" style="display: none;">&nbsp;=&nbsp;' . $sub_level['__VALUE__'] . '</span>'; echo '<span class="value" style="display: none;">&nbsp;=&nbsp;' . $sub_level['__VALUE__'] . '</span>';
} }
@ -618,3 +618,137 @@ function snmp_browser_print_container ($return = false, $width = '100%', $height
} }
?> ?>
<script type="text/javascript">
$(document).ready(function () {
$('input[name*=create_network_component]').click(function () {
var id_check = $('#ul_0').find('input').map(function(){
if(this.id.indexOf('checkbox-create_')!=-1){
if($(this).is(':checked')){
return this.id;
}
} }).get();
$('input[name*=create_network_component]').removeClass("sub add");
$('input[name*=create_network_component]').addClass("sub spinn");
var target_ip = $('#text-target_ip').val();
var community = $('#text-community').val();
var snmp_version = $('#snmp_browser_version').val();
var snmp3_auth_user = $('#text-snmp3_browser_auth_user').val();
var snmp3_security_level = $('#snmp3_browser_security_level').val();
var snmp3_auth_method = $('#snmp3_browser_auth_method').val();
var snmp3_auth_pass = $('#password-snmp3_browser_auth_pass').val();
var snmp3_privacy_method = $('#snmp3_browser_privacy_method').val();
var snmp3_privacy_pass = $('#password-snmp3_browser_privacy_pass').val();
var custom_action = $('#hidden-custom_action').val();
if (custom_action == undefined) {
custom_action = '';
}
var oids = [];
id_check.forEach(function(product, index) {
var oid = $("#"+product).siblings('a').attr('href');
if(oid.indexOf('javascript: snmpGet("')!=-1) {
oid = oid.replace('javascript: snmpGet("',"");
oid = oid.replace('");',"");
oids.push(oid);
}
});
// Prepare the AJAX call
var params = [
"target_ip=" + target_ip,
"community=" + community,
"oids=" + oids,
"snmp_browser_version=" + snmp_version,
"snmp3_browser_auth_user=" + snmp3_auth_user,
"snmp3_browser_security_level=" + snmp3_security_level,
"snmp3_browser_auth_method=" + snmp3_auth_method,
"snmp3_browser_auth_pass=" + snmp3_auth_pass,
"snmp3_browser_privacy_method=" + snmp3_privacy_method,
"snmp3_browser_privacy_pass=" + snmp3_privacy_pass,
"action=" + "create_modules_snmp",
"custom_action=" + custom_action,
"page=include/ajax/snmp_browser.ajax"
];
$.ajax({
type: "GET",
url: "ajax.php",
data: params.join ("&"),
dataType: "json",
success: function(data) {
$('input[name*=create_network_component]').removeClass("sub spinn");
$('input[name*=create_network_component]').addClass("sub add");
if(data.length !== 0){
$('#error_text').text("");
data.forEach( function(valor, indice, array) {
console.log(valor);
$('#error_text').append('<br/>'+ valor );
});
$("#dialog_error")
.dialog({
resizable: true,
draggable: true,
modal: true,
height: 300,
width: 500,
overlay: {
opacity: 0.5,
background: "black"
}
});
} else {
$("#dialog_success")
.dialog({
resizable: true,
draggable: true,
modal: true,
height: 250,
width: 500,
overlay: {
opacity: 0.5,
background: "black"
}
});
}
}
});
});
$('input[id^=checkbox-create]').change(function () {
if ($(this).is(':checked') ) {
$('input[name*=create_network_component]').show();
var id_input = $(this).attr("id");
id_input = id_input.split("checkbox-create_");
var checks = $('#ul_'+id_input[1]).find('input').map(function(){
if(this.id.indexOf('checkbox-create_')!=-1){
return this.id;
} }).get();
checks.forEach(function(product, index) {
$("#"+product).prop('checked', "true");
});
} else {
var id_input = $(this).attr("id");
id_input = id_input.split("checkbox-create_");
var checks = $('#ul_'+id_input[1]).find('input').map(function(){
if(this.id.indexOf('checkbox-create_')!=-1){
return this.id;
} }).get();
checks.forEach(function(product, index) {
$("#"+product).prop('checked', false);
});
}
});
});
</script>

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

@ -115,8 +115,6 @@ function visual_map_print_item($mode = "read", $layoutData,
$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;
@ -1379,6 +1463,20 @@ function visual_map_print_item($mode = "read", $layoutData,
echo $img; 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 AUTO_SLA_GRAPH:
if ($layoutData['label_position']=='up') {
echo io_safe_output($text);
}
echo $img;
if ($layoutData['label_position']=='down') { if ($layoutData['label_position']=='down') {
echo io_safe_output($text); echo io_safe_output($text);
} }
@ -1433,23 +1531,23 @@ 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'){
if( (strip_tags($io_safe_output_text) != '_VALUE_') || (strip_tags($io_safe_output_text) != '(_VALUE_)') ) {
//echo 'Data 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 str_replace(array('_VALUE_','_value_'), $value, $io_safe_output_text); }
} 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);
}
elseif(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 {
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) {
@ -1585,8 +1683,16 @@ function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY)
'id_agente_modulo', $id_module); 'id_agente_modulo', $id_module);
if ($value === false) { if ($value === false) {
$value = __('Unknown'); $value = __('Unknown');
$value = preg_replace ('/\n/i','<br>',$value);
$value = preg_replace ('/\s/i','&nbsp;',$value);
} }
else { else {
if(strpos($value, 'data:image') !== false){
$value = '<img class="b64img" src="'.$value.'">';
}
else{
if ( is_numeric($value) ) { if ( is_numeric($value) ) {
if ($config['simple_module_value']) { if ($config['simple_module_value']) {
$value = remove_right_zeros(number_format($value, $config['graph_precision'])); $value = remove_right_zeros(number_format($value, $config['graph_precision']));
@ -1595,11 +1701,13 @@ function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY)
if (!empty($unit_text)) { if (!empty($unit_text)) {
$value .= " " . $unit_text; $value .= " " . $unit_text;
} }
}
$value = preg_replace ('/\n/i','<br>',$value); $value = preg_replace ('/\n/i','<br>',$value);
$value = preg_replace ('/\s/i','&nbsp;',$value); $value = preg_replace ('/\s/i','&nbsp;',$value);
}
}
return $value; return $value;
break; break;
case SIMPLE_VALUE_MAX: case SIMPLE_VALUE_MAX:
@ -2746,6 +2854,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');
@ -2857,6 +2969,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;

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') . '
@ -188,7 +189,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
<td align="left" style="">' . <td align="left" style="">' .
html_print_input_text('label', '', '', 20, 200, true) . ' html_print_input_text('label', '', '', 20, 200, true) . '
<span id="advice_label" style="font-style:italic;z-index:3;display:inline;margin-top:0px;float:right;margin-right:100px;"> <span id="advice_label" style="font-style:italic;z-index:3;display:inline;margin-top:0px;float:right;margin-right:100px;">
'.__("Click right mouse button to change background label editor color").' '.__("Click right mouse button to change the background color of the label editor").'
</span> </span>
</td>'; </td>';
@ -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,17 +307,27 @@ 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) . 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(
@ -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

@ -88,7 +88,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 +142,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,12 +608,15 @@ 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,6 +638,10 @@ 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 regex = /visual_console/;
var match = regex.exec(window.location.href);
if (match == null) {
var options = { var options = {
series: { series: {
stack: stack, stack: stack,
@ -662,9 +669,40 @@ 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 );
if (match == null) {
// Events // Events
$('#'+graph_id).bind('plothover', function (event, pos, item) { $('#'+graph_id).bind('plothover', function (event, pos, item) {
if (item) { if (item) {
@ -692,21 +730,38 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
var to = legend[item.seriesIndex+1]; var to = legend[item.seriesIndex+1];
//current date //current date
var dateObj = new 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 month = dateObj.getUTCMonth() + 1; //months from 1-12
var day = dateObj.getUTCDate(); var day = dateObj.getUTCDate();
var year = dateObj.getUTCFullYear(); var year = dateObj.getUTCFullYear();
newdate = year + "/" + month + "/" + day; newdate = year + "/" + month + "/" + day;
}
if(!to){ if(!to){
to= '23:59'; 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'; 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); $('#'+graph_id).bind('mouseout',resetInteractivity);
}
// Reset interactivity styles // Reset interactivity styles
function resetInteractivity() { function resetInteractivity() {
@ -1421,7 +1476,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: '',

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

@ -138,6 +138,7 @@ function js_printMap(id_div, initial_zoom, center_latitude, center_longitude, ob
var baseLayer = null; var baseLayer = null;
map.events.on({"zoomend": EventZoomEnd}); map.events.on({"zoomend": EventZoomEnd});
map.events.on({"mouseup": EventZoomEnd});
//Define the maps layer //Define the maps layer
for (var baselayerIndex in objBaseLayers) { for (var baselayerIndex in objBaseLayers) {
@ -224,10 +225,18 @@ function js_printMap(id_div, initial_zoom, center_latitude, center_longitude, ob
.transform(map.displayProjection, map.getProjectionObject()); .transform(map.displayProjection, map.getProjectionObject());
map.setCenter (lonLat, initial_zoom); map.setCenter (lonLat, initial_zoom);
} }
function EventZoomEnd (evt) { function EventZoomEnd (evt,zoom = map.zoom) {
if(evt == null){
var actual_zoom = (zoom < 6) ? 6 : zoom;
}
else{
var actual_zoom = (evt.object.zoom < 6) ? 6 : evt.object.zoom; var actual_zoom = (evt.object.zoom < 6) ? 6 : evt.object.zoom;
}
var max_width_marker = 38; var max_width_marker = 38;
var max_zoom_map = map.numZoomLevels; var max_zoom_map = map.numZoomLevels;
var max_font_size = 15; var max_font_size = 15;
@ -258,7 +267,6 @@ function EventZoomEnd (evt) {
var new_width_marker = (actual_zoom * max_width_marker) / max_zoom_map; var new_width_marker = (actual_zoom * max_width_marker) / max_zoom_map;
var new_height_marker = (actual_zoom * max_width_marker) / max_zoom_map; var new_height_marker = (actual_zoom * max_width_marker) / max_zoom_map;
console.log(feature);
feature.style.fontSize = '' + actual_font_size + ' !important'; feature.style.fontSize = '' + actual_font_size + ' !important';
feature.style.graphicHeight = new_height_marker; feature.style.graphicHeight = new_height_marker;
feature.style.graphicWidth = new_width_marker; feature.style.graphicWidth = new_width_marker;
@ -280,6 +288,7 @@ function EventZoomEnd (evt) {
function changeShowStatus(newShowStatus) { function changeShowStatus(newShowStatus) {
statusShow = newShowStatus; statusShow = newShowStatus;
hideAgentsStatus(); hideAgentsStatus();
EventZoomEnd(null,map.zoom);
js_refreshParentLines(); js_refreshParentLines();
} }

View File

@ -656,7 +656,7 @@ input.sub[disabled] {
input.next, input.upd, input.ok, input.wand, input.delete, input.cog, input.next, input.upd, input.ok, input.wand, input.delete, input.cog,
input.target, input.search, input.copy, input.add, input.graph, input.target, input.search, input.copy, input.add, input.graph,
input.percentile, input.binary, input.camera, input.config, input.percentile, input.binary, input.camera, input.config,
input.cancel, input.default, input.filter, input.pdf { input.cancel, input.default, input.filter, input.pdf,input.spinn {
padding-right: 30px; padding-right: 30px;
height: 23px; height: 23px;
@ -741,6 +741,9 @@ input.pdf:disabled {
input.camera { input.camera {
background-image: url(../../images/input_camera.png) !important; background-image: url(../../images/input_camera.png) !important;
} }
input.spinn {
background-image: url(../../images/spinner_green.gif) !important;
}
#toolbox #auto_save { #toolbox #auto_save {
padding-top: 5px; padding-top: 5px;
@ -778,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;
} }
@ -4157,3 +4166,24 @@ div#footer_help{
#div_all_events_24h{ #div_all_events_24h{
padding: 4px; padding: 4px;
} }
/*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;
}

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;
} }

View File

@ -70,8 +70,8 @@
<body> <body>
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.705'; $version = '7.0NG.710';
$build = '170710'; $build = '170814';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -466,7 +466,10 @@ else {
'unknown_count', 'unknown_count',
'notinit_count', 'notinit_count',
'total_count', 'total_count',
'fired_count'), 'fired_count',
'ultimo_contacto_remoto',
'remote',
'agent_version'),
$access, $access,
$order); $order);
} }
@ -498,11 +501,11 @@ $table->head[1] = __('Description'). ' ' .
$table->size[1] = "16%"; $table->size[1] = "16%";
$table->head[9] = __('Remote'). ' ' . $table->head[10] = __('Remote'). ' ' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=remote&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectRemoteUp, "alt" => "up")) . '</a>' . '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=remote&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectRemoteUp, "alt" => "up")) . '</a>' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=remote&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectRemoteDown, "alt" => "down")) . '</a>'; '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=remote&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectRemoteDown, "alt" => "down")) . '</a>';
$table->size[9] = "9%"; $table->size[10] = "9%";
$table->head[2] = __('OS'). ' ' . $table->head[2] = __('OS'). ' ' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=os&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp, "alt" => "up")) . '</a>' . '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=os&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp, "alt" => "up")) . '</a>' .
@ -517,21 +520,24 @@ $table->size[3] = "10%";
$table->head[4] = __('Group'). ' ' . $table->head[4] = __('Group'). ' ' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=group&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp, "alt" => "up")) . '</a>' . '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=group&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp, "alt" => "up")) . '</a>' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=group&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown, "alt" => "down")) . '</a>'; '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=group&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown, "alt" => "down")) . '</a>';
$table->size[4] = "15%"; $table->size[4] = "8%";
$table->head[5] = __('Modules'); $table->head[5] = __('Type');
$table->size[5] = "10%"; $table->size[5] = "8%";
$table->head[6] = __('Status'); $table->head[6] = __('Modules');
$table->size[6] = "4%"; $table->size[6] = "10%";
$table->head[7] = __('Alerts'); $table->head[7] = __('Status');
$table->size[7] = "4%"; $table->size[7] = "4%";
$table->head[8] = __('Last contact'). ' ' . $table->head[8] = __('Alerts');
$table->size[8] = "4%";
$table->head[9] = __('Last contact'). ' ' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=last_contact&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '</a>' . '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=last_contact&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '</a>' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=last_contact&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . '</a>'; '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=last_contact&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . '</a>';
$table->size[8] = "15%"; $table->size[9] = "15%";
$table->align = array (); $table->align = array ();
@ -542,9 +548,9 @@ $table->align[5] = "left";
$table->align[6] = "left"; $table->align[6] = "left";
$table->align[7] = "left"; $table->align[7] = "left";
$table->align[8] = "left"; $table->align[8] = "left";
$table->align[9] = "left";
$table->style = array(); $table->style = array();
//$table->style[0] = 'width: 15%';
$table->data = array (); $table->data = array ();
@ -584,14 +590,14 @@ foreach ($agents as $agent) {
$data[1] = ui_print_truncate_text($agent["description"], 'description', false, true, true, '[&hellip;]', 'font-size: 6.5pt'); $data[1] = ui_print_truncate_text($agent["description"], 'description', false, true, true, '[&hellip;]', 'font-size: 6.5pt');
$data[9] = ""; $data[10] = "";
if (enterprise_installed()) { if (enterprise_installed()) {
enterprise_include_once('include/functions_config_agents.php'); enterprise_include_once('include/functions_config_agents.php');
if (enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"]))) { if (enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"]))) {
$data[9] = html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Remote config'))); $data[10] = html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Remote config')));
} }
} }
@ -602,14 +608,18 @@ foreach ($agents as $agent) {
$data[4] = ui_print_group_icon ($agent["id_grupo"], true); $data[4] = ui_print_group_icon ($agent["id_grupo"], true);
$agent['not_init_count'] = $agent['notinit_count']; $agent['not_init_count'] = $agent['notinit_count'];
$data[5] = reporting_tiny_stats($agent, true, 'modules', ':', $strict_user);
$data[5] = ui_print_type_agent_icon ($agent["id_os"], $agent['ultimo_contacto_remoto'],
$agent['ultimo_contacto'], $agent['remote'],
$agent['agent_version']);
$data[6] = $status_img; $data[6] = reporting_tiny_stats($agent, true, 'modules', ':', $strict_user);
$data[7] = $alert_img; $data[7] = $status_img;
$data[8] = agents_get_interval_status ($agent); $data[8] = $alert_img;
$data[9] = agents_get_interval_status ($agent);
// This old code was returning "never" on agents without modules, BAD !! // This old code was returning "never" on agents without modules, BAD !!
// And does not print outdated agents in red. WRONG !!!! // And does not print outdated agents in red. WRONG !!!!

View File

@ -602,7 +602,7 @@ $data[0][0] .=
__('Events (24h)') . __('Events (24h)') .
'</th></tr>' . '</th></tr>' .
'<tr><td style="text-align:center;"><br />' . '<tr><td style="text-align:center;"><br />' .
graph_graphic_agentevents ($id_agente, 450, 15, SECONDS_1DAY, '', true) . graph_graphic_agentevents ($id_agente, 450, 15, SECONDS_1DAY, '', true, true) .
'<br /></td></tr>' . '<br /></td></tr>' .
'</table>'; '</table>';

View File

@ -141,9 +141,29 @@ $result = db_get_all_rows_sql ($sql, true);
if ($result === false) { if ($result === false) {
$sql2 = sprintf ("
SELECT current_longitude AS longitude, current_latitude AS latitude, current_altitude AS altitude,
start_timestamp, description, number_of_packages, manual_placement
FROM tgis_data_status
WHERE tagente_id_agente = %d
ORDER BY start_timestamp DESC
LIMIT %d OFFSET %d", $agentId, $config['block_size'], (int)get_parameter ('offset'));
$result2 = db_get_all_rows_sql ($sql2, true);
if ($result2 === false) {
ui_print_empty_data( __('This agent doesn\'t have any GIS data.') ); ui_print_empty_data( __('This agent doesn\'t have any GIS data.') );
} else {
$result2[0]['end_timestamp'] = date('Y-m-d H:i:s');
$result = $result2;
}
}
if ($result !== false) {
if(!$countData){
$countData = 1;
} }
else {
ui_pagination ($countData, false) ; ui_pagination ($countData, false) ;
$table->data = array(); $table->data = array();
foreach ($result as $key => $row) { foreach ($result as $key => $row) {

View File

@ -139,7 +139,10 @@ $interface_traffic_modules = array(
} }
// Get input parameters // Get input parameters
$period = (int) get_parameter('period', SECONDS_1HOUR); $period = get_parameter ("period");
if ($period == "") {
$period = get_parameter ("period_select", SECONDS_1DAY);
}
$width = (int) get_parameter("width", 555); $width = (int) get_parameter("width", 555);
$height = (int) get_parameter("height", 245); $height = (int) get_parameter("height", 245);
$start_date = (string) get_parameter("start_date", date("Y-m-d")); $start_date = (string) get_parameter("start_date", date("Y-m-d"));

View File

@ -150,7 +150,10 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
$avg_only = $show_other; $avg_only = $show_other;
} }
$period = get_parameter ("period", SECONDS_1DAY); $period = get_parameter ("period");
if ($period == "") {
$period = get_parameter ("period_select", SECONDS_1DAY);
}
$id = get_parameter ("id", 0); $id = get_parameter ("id", 0);
$width = get_parameter ("width", STATWIN_DEFAULT_CHART_WIDTH); $width = get_parameter ("width", STATWIN_DEFAULT_CHART_WIDTH);
$height = get_parameter ("height", STATWIN_DEFAULT_CHART_HEIGHT); $height = get_parameter ("height", STATWIN_DEFAULT_CHART_HEIGHT);

View File

@ -543,8 +543,6 @@ $table_advanced->rowclass[] = '';
$data = array(); $data = array();
$data[0] = __('Date from') . $jump; $data[0] = __('Date from') . $jump;
//~ $user_users = users_get_user_users($config['id_user'], "ER", users_can_manage_group_all());
$data[0] .= html_print_input_text ('date_from', $date_from, '', 15, 10, true); $data[0] .= html_print_input_text ('date_from', $date_from, '', 15, 10, true);
$data[1] = __('Date to') . $jump; $data[1] = __('Date to') . $jump;

View File

@ -246,7 +246,7 @@ switch ($opt) {
$row = array(); $row = array();
$row[] = __('Agent'); $row[] = __('Agent');
$row[] = '<a style="font-weight: bolder;" href="?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' $row[] = '<a style="font-weight: bolder;" href="?sec=estado&sec2=operation/agentes/ver_agente&id_agente='
. $agent['id_agente'] . '">'.$agent['nombre'].'</a>'; . $agent['id_agente'] . '">'.$agent['alias'].'</a>';
$table->data[] = $row; $table->data[] = $row;
// Position // Position

View File

@ -58,7 +58,7 @@ $confMap = gis_get_map_conf($idMap);
// Default open map (used to overwrite unlicensed google map view) // Default open map (used to overwrite unlicensed google map view)
$confMapDefault = get_good_con(); $confMapDefault = get_good_con();
$confMapUrlDefault = json_decode($confMapDefault['conection_data'], true)['url']; $confMapUrlDefault = json_decode($confMapDefault['conection_data'], true);
$num_baselayer=0; $num_baselayer=0;
// Initialy there is no Gmap base layer. // Initialy there is no Gmap base layer.
@ -77,7 +77,7 @@ if ($confMap !== false) {
case 'Gmap': case 'Gmap':
if (!isset($decodeJSON['gmap_key']) || empty($decodeJSON['gmap_key'])) { if (!isset($decodeJSON['gmap_key']) || empty($decodeJSON['gmap_key'])) {
// If there is not gmap_key, show the default view // If there is not gmap_key, show the default view
$baselayers[$num_baselayer]['url'] = $confMapUrlDefault; $baselayers[$num_baselayer]['url'] = $confMapUrlDefault['url'];
$baselayers[$num_baselayer]['typeBaseLayer'] = 'OSM'; $baselayers[$num_baselayer]['typeBaseLayer'] = 'OSM';
} else { } else {
$baselayers[$num_baselayer]['gmap_type'] = $decodeJSON['gmap_type']; $baselayers[$num_baselayer]['gmap_type'] = $decodeJSON['gmap_type'];
@ -207,6 +207,7 @@ if ($layers != false) {
var new_height = $(document).height(); var new_height = $(document).height();
$("#map").css("height", new_height - 60); $("#map").css("height", new_height - 60);
$("svg[id*=OpenLayers]").css("height", new_height - 60);
}); });
</script> </script>

View File

@ -242,6 +242,7 @@ if ($config["pure"] != 0) {
var new_height = $(document).height(); var new_height = $(document).height();
$("#map").css("height", new_height - 60); $("#map").css("height", new_height - 60);
$("svg[id*=OpenLayers]").css("height", new_height - 60);
}); });
</script> </script>

View File

@ -47,6 +47,26 @@ if (is_ajax()) {
} }
else { else {
snmp_browser_print_tree ($snmp_tree); snmp_browser_print_tree ($snmp_tree);
echo html_print_submit_button(__('Create network components'),'create_network_component',
false, array('style' => 'display: none', 'class' => 'sub add'), true);
echo '<div id="dialog_error" style="display: none" title="Network components">';
echo "<div>";
echo "<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='images/icono_error_mr.png'></div>";
echo "<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>ERROR</strong></h3>";
echo "<p style='font-family:Verdana; font-size:12pt;margin-bottom: 0px'>".__('Error creating the following modules:')."</p>";
echo "<p id='error_text' style='font-family:Verdana; font-size:12pt;'></p>";
echo "</div>";
echo '</div>';
echo '<div id="dialog_success" style="display: none" title="Network components">';
echo "<div>";
echo "<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='images/icono_exito_mr.png'></div>";
echo "<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>SUCCESS</strong></h3>";
echo "<p style='font-family:Verdana; font-size:12pt;'>".__('Modules successfully created')."</p>";
echo "</div>";
echo '</div>';
} }
return; return;
} }

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