diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf
index 4fc8c757ba..d78044b76d 100644
--- a/pandora_agents/unix/AIX/pandora_agent.conf
+++ b/pandora_agents/unix/AIX/pandora_agent.conf
@@ -58,6 +58,9 @@ server_port	41121
 # Transfer mode: tentacle, ftp, ssh or local 
 transfer_mode tentacle
 
+# Transfer mode user: Owner of files copied on local transfer mode (default apache)
+#transfer_mode_user apache
+
 # Server password (Tentacle or FTP). Leave empty for no password (default).
 # server_pwd mypassword
 
diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index 5a75c5dca4..4a5d72dfd7 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-agent-unix
-Version: 7.0NG.712-170914
+Version: 7.0NG.712-170925
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh
index 9d4335697a..5eb6b7b67d 100644
--- a/pandora_agents/unix/DEBIAN/make_deb_package.sh
+++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="7.0NG.712-170914"
+pandora_version="7.0NG.712-170925"
 
 echo "Test if you has the tools for to make the packages."
 whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
diff --git a/pandora_agents/unix/Darwin/pandora_agent.conf b/pandora_agents/unix/Darwin/pandora_agent.conf
index 41c6747052..11a58e3225 100644
--- a/pandora_agents/unix/Darwin/pandora_agent.conf
+++ b/pandora_agents/unix/Darwin/pandora_agent.conf
@@ -88,6 +88,9 @@ server_port	41121
 # Transfer mode: tentacle, ftp, ssh or local 
 transfer_mode tentacle
 
+# Transfer mode user: Owner of files copied on local transfer mode (default apache)
+#transfer_mode_user apache
+
 # Server password (Tentacle or FTP). Leave empty for no password (default).
 #server_pwd mypassword
 
diff --git a/pandora_agents/unix/FreeBSD/pandora_agent.conf b/pandora_agents/unix/FreeBSD/pandora_agent.conf
index 29d6e893b7..6d988c94ac 100644
--- a/pandora_agents/unix/FreeBSD/pandora_agent.conf
+++ b/pandora_agents/unix/FreeBSD/pandora_agent.conf
@@ -98,6 +98,9 @@ server_port	41121
 # Transfer mode: tentacle, ftp, ssh or local 
 transfer_mode tentacle
 
+# Transfer mode user: Owner of files copied on local transfer mode (default apache)
+#transfer_mode_user apache
+
 # timeout in seconds for file transfer programs execution (30 by default)
 #transfer_timeout 30
 
diff --git a/pandora_agents/unix/HP-UX/pandora_agent.conf b/pandora_agents/unix/HP-UX/pandora_agent.conf
index 9db22b3b47..01bc718c43 100644
--- a/pandora_agents/unix/HP-UX/pandora_agent.conf
+++ b/pandora_agents/unix/HP-UX/pandora_agent.conf
@@ -60,6 +60,9 @@ server_port	41121
 # Transfer mode: tentacle, ftp, ssh or local 
 transfer_mode tentacle
 
+# Transfer mode user: Owner of files copied on local transfer mode (default apache)
+#transfer_mode_user apache
+
 # Server password (Tentacle or FTP). Leave empty for no password (default).
 # server_pwd mypassword
 
diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf
index fcfa94b429..00fa91f85f 100644
--- a/pandora_agents/unix/Linux/pandora_agent.conf
+++ b/pandora_agents/unix/Linux/pandora_agent.conf
@@ -104,6 +104,9 @@ server_port	41121
 # Transfer mode: tentacle, ftp, ssh or local 
 transfer_mode tentacle
 
+# Transfer mode user: Owner of files copied on local transfer mode (default apache)
+#transfer_mode_user apache
+
 # timeout in seconds for file transfer programs execution (30 by default) 
 #transfer_timeout 30
 
diff --git a/pandora_agents/unix/NetBSD/pandora_agent.conf b/pandora_agents/unix/NetBSD/pandora_agent.conf
index 4f89baee8b..088a6b5159 100644
--- a/pandora_agents/unix/NetBSD/pandora_agent.conf
+++ b/pandora_agents/unix/NetBSD/pandora_agent.conf
@@ -66,6 +66,9 @@ server_port	41121
 # Transfer mode: tentacle, ftp, ssh or local 
 transfer_mode tentacle
 
+# Transfer mode user: Owner of files copied on local transfer mode (default apache)
+#transfer_mode_user apache
+
 # timeout in seconds for file transfer programs execution (30 by default)
 #transfer_timeout 30
 
diff --git a/pandora_agents/unix/SunOS/pandora_agent.conf b/pandora_agents/unix/SunOS/pandora_agent.conf
index 94bc194a05..3c50a12bfa 100644
--- a/pandora_agents/unix/SunOS/pandora_agent.conf
+++ b/pandora_agents/unix/SunOS/pandora_agent.conf
@@ -60,6 +60,9 @@ server_port	41121
 # Transfer mode: tentacle, ftp, ssh or local 
 transfer_mode tentacle
 
+# Transfer mode user: Owner of files copied on local transfer mode (default apache)
+#transfer_mode_user apache
+
 # timeout in seconds for file transfer programs execution (30 by default)
 #transfer_timeout 30
 
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index 89945c274d..ed1036113a 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -41,7 +41,7 @@ my $Sem = undef;
 my $ThreadSem = undef;
 
 use constant AGENT_VERSION => '7.0NG.712';
-use constant AGENT_BUILD => '170914';
+use constant AGENT_BUILD => '170925';
 
 # Agent log default file size maximum and instances
 use constant DEFAULT_MAX_LOG_SIZE => 600000;
@@ -128,6 +128,9 @@ my @BrokerPid;
 my %DefaultConf = (
 	'server_ip' => 'localhost',
 	'server_path' => '/var/spool/pandora/data_in',
+	'server_path_md5' => 'md5', #undocumented
+	'server_path_conf' => 'conf', #undocumented
+	'server_path_zip' => 'collections', #undocumented
 	'logfile' =>'/var/log/pandora/pandora_agent.log',
 	'logsize' => DEFAULT_MAX_LOG_SIZE,
 	'logrotate' => DEFAULT_LOG_ROTATE,
@@ -146,6 +149,7 @@ my %DefaultConf = (
 	'encoding' => 'UTF-8',
 	'server_port' => 41121,
 	'transfer_mode' => 'tentacle',
+	'transfer_mode_user' => 'apache',
 	'transfer_timeout' => 30,
 	'server_user' => 'pandora',
 	'server_pwd' => '',
@@ -906,13 +910,17 @@ sub fix_directory ($) {
 ################################################################################
 # Sends a file to the server.
 ################################################################################
-#sub send_file ($;$$$) {
 sub send_file {
-	my ($file, $secondary, $rc_primary, $flag_always) = @_;
+	my ($file, $secondary, $rc_primary, $flag_always, $relative) = @_;
+
 	my $output;
 	my $pid = fork();
 	return 1 unless defined $pid;
 
+	# Fix remote dir to some transfer mode
+	my $remote_dir = $Conf{'server_path'} . "/";
+	$remote_dir .= fix_directory($relative) . '/' if defined($relative);
+
 	if ($pid == 0) {
 		# execute the transfer program by child process.
 		eval {
@@ -935,7 +943,7 @@ sub send_file {
 				quit
 				FEOF1`
 			} elsif ($Conf{'transfer_mode'} eq 'local') {
-				$output = `cp "$file" "$Conf{'server_path'}/" 2>&1 >$DevNull`;
+				$output = `cp -p "$file" "$remote_dir" 2>&1 >$DevNull`;
 		 	}
 			alarm (0);
 		};
@@ -966,7 +974,7 @@ sub send_file {
 				$rc_primary = 1;
 			}
 			swap_servers ();
-			$rc = send_file ($file, undef, $rc_primary);
+			$rc = send_file ($file, undef, $rc_primary, undef, $relative);
 			swap_servers ();
 
 			return $rc;
@@ -1024,7 +1032,7 @@ sub send_file {
 		return $rc unless ($Conf{'secondary_mode'} eq 'always' || ($Conf{'secondary_mode'} eq 'on_error' && $rc != 0));
 		
 		swap_servers ();
-		$rc = send_file ($file);
+		$rc = send_file ($file, undef, undef, undef, $relative);
 		swap_servers ();
 		return $rc;
 	}
@@ -1075,12 +1083,16 @@ sub swap_servers () {
 ################################################################################
 # Receive a file from the server.
 ################################################################################
-sub recv_file ($) {
-	my $file = shift;
+sub recv_file {
+	my ($file, $relative) = @_;
 	my $output;
-
+	
 	my $pid = fork();
-        return 1 unless defined $pid;
+    return 1 unless defined $pid;
+
+	# Fix remote dir to some transfer mode
+	my $remote_dir = $Conf{'server_path'};
+	$remote_dir .= "/" . fix_directory($relative) if defined($relative);
 
 	if ($pid == 0) {
 		# execute the transfer program by child process.
@@ -1104,7 +1116,7 @@ sub recv_file ($) {
 				quit
 				FEOF1`
 			} elsif ($Conf{'transfer_mode'} eq 'local') {
-				$output = `cp $Conf{'server_path'}/$file $Conf{'temporal'} 2>&1 >$DevNull`;
+				$output = `cp "$remote_dir/$file" $Conf{'temporal'} 2>&1 >$DevNull`;
 			}
 			alarm (0);
 		};
@@ -1148,14 +1160,19 @@ sub check_remote_config () {
 	}
 
 	# Get the remote MD5 file
-	if (recv_file ($RemoteMD5File) != 0) {
+	if (recv_file ($RemoteMD5File, $Conf{'server_path_md5'}) != 0) {
+		log_message ('remote config', 'Uploading configuration for the first time.');
 		open (MD5_FILE, "> $Conf{'temporal'}/$RemoteMD5File") || error ("Could not open file '$ConfDir/$RemoteMD5File' for writing: $!.");
 		print MD5_FILE $conf_md5;
 		close (MD5_FILE);
 		copy ("$ConfDir/$ConfFile", "$Conf{'temporal'}/$RemoteConfFile");
-		send_file ("$Conf{'temporal'}/$RemoteConfFile");
-		send_file ("$Conf{'temporal'}/$RemoteMD5File");
-		log_message ('remote config', 'Uploading configuration for the first time.');
+		if ($Conf{'transfer_mode'} eq 'local') {
+			my (undef, undef, $uid, $gid) = getpwnam($Conf{'transfer_mode_user'});
+			chown ($uid, $gid, "$Conf{'temporal'}/$RemoteMD5File");
+			chown ($uid, $gid, "$Conf{'temporal'}/$RemoteConfFile");
+		}
+		send_file ("$Conf{'temporal'}/$RemoteConfFile", undef, undef, undef, $Conf{'server_path_conf'});
+		send_file ("$Conf{'temporal'}/$RemoteMD5File", undef, undef, undef, $Conf{'server_path_md5'});
 		unlink ("$Conf{'temporal'}/$RemoteConfFile");
 		unlink ("$Conf{'temporal'}/$RemoteMD5File");
 		return;
@@ -1169,7 +1186,7 @@ sub check_remote_config () {
 	return if ($remote_conf_md5 eq $conf_md5);
 	
 	# Get the new configuration file
-	return if (recv_file ($RemoteConfFile) != 0);
+	return if (recv_file ($RemoteConfFile, $Conf{'server_path_conf'}) != 0);
 	log_message ('remote config', 'Configuration has changed!');
 
 	# Save the new configuration
@@ -1255,7 +1272,7 @@ sub check_collections () {
 
 		# Get remote md5
  		error ("File '$Conf{'temporal'}/$collection_md5_file' already exists as a symlink and could not be removed: $!.") if (-l "$Conf{'temporal'}/$collection_md5_file" && !unlink("$Conf{'temporal'}/$collection_md5_file"));
-		next unless (recv_file ($collection_md5_file) == 0);
+		next unless (recv_file ($collection_md5_file, $Conf{'server_path_md5'}) == 0);
 		open (MD5_FILE, "< $Conf{'temporal'}/$collection_md5_file") || error ("Could not open file '$Conf{'temporal'}/$collection_md5_file' for reading: $!.");
 		my $remote_collection_md5 = <MD5_FILE>;
 		close (MD5_FILE);
@@ -1273,7 +1290,7 @@ sub check_collections () {
 		next if ($local_collection_md5 eq $remote_collection_md5);
 		
 		# Download and unzip
-		next unless (recv_file ($collection_file) == 0);
+		next unless (recv_file ($collection_file, $Conf{'server_path_zip'}) == 0);
 		rmrf ("$ConfDir/collections/$collection");
 		`unzip -d "$ConfDir/collections/$collection" "$Conf{'temporal'}/$collection_file" 2>$DevNull`;
 		unlink ("$Conf{'temporal'}/$collection_file");		
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index adaa8404c3..f39c25764f 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     7.0NG.712
-%define release     170914
+%define release     170925
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index e77bed63f0..d8d0ada673 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     7.0NG.712
-%define release     170914
+%define release     170925
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer
index aa7c62cb6c..9fe601b49a 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -10,7 +10,7 @@
 # **********************************************************************
 
 PI_VERSION="7.0NG.712"
-PI_BUILD="170914"
+PI_BUILD="170925"
 OS_NAME=`uname -s`
 
 FORCE=0
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index 3979f27147..1bdeb79524 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
 {}
 
 Version
-{170914}
+{170925}
 
 ViewReadme
 {Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index e0770c3c57..bf263f13d4 100644
--- a/pandora_agents/win32/pandora.cc
+++ b/pandora_agents/win32/pandora.cc
@@ -30,7 +30,7 @@ using namespace Pandora;
 using namespace Pandora_Strutils;
 
 #define PATH_SIZE    _MAX_PATH+1
-#define PANDORA_VERSION ("7.0NG.712(Build 170914)")
+#define PANDORA_VERSION ("7.0NG.712(Build 170925)")
 
 string pandora_path;
 string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index e25d77599a..197e963689 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
       VALUE "LegalCopyright", "Artica ST"
       VALUE "OriginalFilename", "PandoraAgent.exe"
       VALUE "ProductName", "Pandora FMS Windows Agent"
-      VALUE "ProductVersion", "(7.0NG.712(Build 170914))"
+      VALUE "ProductVersion", "(7.0NG.712(Build 170925))"
       VALUE "FileVersion", "1.0.0.0"
     END
   END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index f03a7cbd15..f7910714e4 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-console
-Version: 7.0NG.712-170914
+Version: 7.0NG.712-170925
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh
index 057d259316..02cc7e78a1 100644
--- a/pandora_console/DEBIAN/make_deb_package.sh
+++ b/pandora_console/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="7.0NG.712-170914"
+pandora_version="7.0NG.712-170925"
 
 package_pear=0
 package_pandora=1
diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php
index 6d888079e6..e2a264e6e0 100644
--- a/pandora_console/godmode/agentes/configurar_agente.php
+++ b/pandora_console/godmode/agentes/configurar_agente.php
@@ -793,7 +793,7 @@ if ($update_agent) { // if modified some agent paramenter
 				WHERE id_group = ".$group_old);
 		
 		$result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agente));
-		if ($result === false) {
+		if ($result == false) {
 			ui_print_error_message(
 				__('There was a problem updating the agent'));
 		}
diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php
index 023ed6e84c..6be8d61b40 100644
--- a/pandora_console/godmode/groups/group_list.php
+++ b/pandora_console/godmode/groups/group_list.php
@@ -35,6 +35,7 @@ if (is_ajax ()) {
 	
 	$get_group_json = (bool) get_parameter ('get_group_json');
 	$get_group_agents = (bool) get_parameter ('get_group_agents');
+	$get_is_disabled = (bool) get_parameter ('get_is_disabled');
 	
 	if ($get_group_json) {
 		$id_group = (int) get_parameter ('id_group');
@@ -70,6 +71,7 @@ if (is_ajax ()) {
 		$search = (string) get_parameter ('search', '');
 		$recursion = (int) get_parameter ('recursion', 0);
 		$privilege = (string) get_parameter ('privilege', '');
+		$all_agents = (int) get_parameter ('all_agents', 0);
 		// Is is possible add keys prefix to avoid auto sorting in js object conversion
 		$keys_prefix = (string) get_parameter ('keys_prefix', '');
 		// This attr is for the operation "bulk alert accions add", it controls the query that take the agents
@@ -96,7 +98,12 @@ if (is_ajax ()) {
 			$filter['id_agente'] = json_decode(io_safe_output($filter_agents_json), true);
 		}
 		
-		$filter['disabled'] = $disabled;
+		if ($all_agents) {
+			$filter['all_agents'] = true;
+		}
+		else {
+			$filter['disabled'] = $disabled;
+		}
 		
 		if ($search != '') {
 			$filter['string'] = $search;
@@ -126,17 +133,42 @@ if (is_ajax ()) {
 				false, $recursion, false, '|', $add_alert_bulk_op);
 		}
 		
+		$agents_disabled = array();
 		// Add keys prefix
 		if ($keys_prefix !== "") {
 			foreach($agents as $k => $v) {
 				$agents[$keys_prefix . $k] = $v;
 				unset($agents[$k]);
+				if ($all_agents) {
+					$agent_disabled = db_get_value_filter('disabled', 'tagente', array('id_agente' => $k));
+					$agents_disabled[$keys_prefix . $k] = $agent_disabled;
+				}
 			}
 		}
+
+		if ($all_agents) {
+			$all_agents_array = array();
+			$all_agents_array['agents'] = $agents;
+			$all_agents_array['agents_disabled'] = $agents_disabled;
+
+			$agents = $all_agents_array;
+		}
 		
 		echo json_encode ($agents);
 		return;
 	}
+
+	if ($get_is_disabled) {
+		$index = get_parameter('id_agent');
+
+		$agent_disabled = db_get_value_filter('disabled', 'tagente', array('id_agente' => $index));
+
+		$return['disabled'] = $agent_disabled;
+		$return['id_agent'] = $index;
+
+		echo json_encode($return);
+		return;
+	}
 	
 	return;
 }
diff --git a/pandora_console/godmode/massive/massive_operations.php b/pandora_console/godmode/massive/massive_operations.php
index 494e95e3f5..276ab4c478 100755
--- a/pandora_console/godmode/massive/massive_operations.php
+++ b/pandora_console/godmode/massive/massive_operations.php
@@ -212,7 +212,7 @@ You can of course remove the warnings, that's why we include the source and do n
 */
 
 ui_print_page_header(
-	__('Massive operations') . ' &raquo; '. $options[$option],
+	__('Bulk operations') . ' &raquo; '. $options[$option],
 	"images/gm_massive_operations.png", false, "", true, $onheader,true, "massivemodal");
 
 // Checks if the PHP configuration is correctly
diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php
index 38c0f2dfc6..b929a1ec84 100644
--- a/pandora_console/godmode/menu.php
+++ b/pandora_console/godmode/menu.php
@@ -196,7 +196,7 @@ if (!empty($sub)) {
 }
 
 
-if (check_acl ($config['id_user'], 0, "AW") || check_acl ($config['id_user'], 0, "PM")) {
+if (check_acl ($config['id_user'], 0, "AW") || check_acl ($config['id_user'], 0, "PM") || check_acl ($config['id_user'], 0, "RR")) {
 	// Servers
 	$menu_godmode["gservers"]["text"] = __('Servers');
 	$menu_godmode["gservers"]["sec2"] = "godmode/servers/modificar_server";
diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
index 00df36a2c7..534bf07a0b 100755
--- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php
+++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
@@ -94,6 +94,7 @@ $inventory_modules = array();
 $date = null;
 // Only avg is selected by default for the simple graphs
 $only_avg = true;
+$fullscale = false;
 $percentil = false;
 $time_compare_overlapped = false;
 
@@ -212,6 +213,7 @@ switch ($action) {
 					break;
 				case 'simple_graph':
 					$only_avg = isset($style['only_avg']) ? (bool) $style['only_avg'] : true;
+					$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
 					$percentil = isset($style['percentil']) ? $config['percentil'] : 0;
 					// The break hasn't be forgotten.
 				case 'simple_baseline_graph':
@@ -480,6 +482,7 @@ switch ($action) {
 					$description = $item['description'];
 					$group = $item['id_group'];
 					$period = $item['period'];
+					$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
 					break;
 				case 'top_n':
 					$description = $item['description'];
@@ -1353,6 +1356,11 @@ You can of course remove the warnings, that's why we include the source and do n
 			<td style="font-weight:bold;"><?php echo __('Only average');?></td>
 			<td><?php html_print_checkbox('only_avg', 1, $only_avg);?></td>
 		</tr>
+		<tr id="row_fullscale" style="" class="datos">
+			<td style="font-weight:bold;"><?php echo __('Full resolution graph (TIP)').
+					ui_print_help_tip(__('This option may cause performance issues.'), true);?></td>
+			<td><?php html_print_checkbox('fullscale', 1, $fullscale);?></td>
+		</tr>
 		<tr id="row_percentil" style="" class="datos">
 			<td style="font-weight:bold;"><?php echo __('Percentil');?></td>
 			<td><?php html_print_checkbox('percentil', 1, $percentil);?></td>
@@ -2643,6 +2651,7 @@ function chooseType() {
 	$("#row_show_graph").hide();
 	$("#row_max_min_avg").hide();
 	$("#row_only_avg").hide();
+	$("#row_fullscale").hide();
 	$("#row_time_compare_overlapped").hide();
 	$("#row_quantity").hide();
 	$("#row_exception_condition_value").hide();
@@ -2725,6 +2734,7 @@ function chooseType() {
 		case 'simple_graph':
 			$("#row_time_compare_overlapped").show();
 			$("#row_only_avg").show();
+			$("#row_fullscale").show();
 			if ($("#checkbox-percentil").prop("checked"))
 				$("#row_percentil").show();
 			// The break hasn't be forgotten, this element
@@ -3122,6 +3132,7 @@ function chooseType() {
 			$("#row_description").show();
 			$("#row_period").show();
 			$("#row_historical_db_check").hide();
+			$("#row_fullscale").show();
 			break;
 		
 		case 'top_n':
diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php
index 705f49c2d0..4dd13e9af0 100755
--- a/pandora_console/godmode/reporting/reporting_builder.php
+++ b/pandora_console/godmode/reporting/reporting_builder.php
@@ -1172,13 +1172,17 @@ switch ($action) {
 							case 'simple_graph':
 								// Warning. We are using this column to hold this value to avoid
 								// the modification of the database for compatibility reasons.
-								$style['only_avg'] = (int) get_parameter('only_avg');
+								$style['only_avg']  = (int) get_parameter('only_avg');
 								$style['percentil'] = (int) get_parameter('percentil');
+								$style['fullscale'] = (int) get_parameter('fullscale');
 								if ($label != '')
 									$style['label'] = $label;
 								else
 									$style['label'] = '';
 								break;
+							case 'network_interfaces_report':
+								$style['fullscale'] = (int) get_parameter('fullscale');
+								break;
 							case 'module_histogram_graph':
 							case 'agent_configuration':
 							case 'alert_report_agent':
@@ -1516,13 +1520,17 @@ switch ($action) {
 							case 'simple_graph':
 								// Warning. We are using this column to hold this value to avoid
 								// the modification of the database for compatibility reasons.
-								$style['only_avg'] = (int) get_parameter('only_avg');
+								$style['only_avg']  = (int) get_parameter('only_avg');
 								$style['percentil'] = (int) get_parameter('percentil');
+								$style['fullscale'] = (int) get_parameter('fullscale');
 								if ($label != '')
 									$style['label'] = $label;
 								else
 									$style['label'] = '';
 								break;
+							case 'network_interfaces_report':
+								$style['fullscale'] = (int) get_parameter('fullscale');
+								break;
 							case 'module_histogram_graph':
 							case 'agent_configuration':
 							case 'alert_report_agent':
diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js
index 7e0ff10cec..2c98fb5493 100755
--- a/pandora_console/godmode/reporting/visual_console_builder.editor.js
+++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js
@@ -313,9 +313,9 @@ function update_button_palette_callback() {
 				if ((values['width'] == 0) || (values['height'] == 0)) {
 						$("#image_" + idItem).removeAttr('width');
 						$("#image_" + idItem).removeAttr('height');
-						$("#image_" + idItem).attr('width', 450);
+						$("#image_" + idItem).attr('width', 520);
 						$("#image_" + idItem).attr('height', 80);
-						$("#image_" + idItem).css('width', '450px');
+						$("#image_" + idItem).css('width', '520px');
 						$("#image_" + idItem).css('height', '80px');
 						$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
 							
@@ -1742,7 +1742,7 @@ function set_image(type, idElement, image) {
 			$(item).attr('src', data);
 			
 			if(image == 'show_statistics_bad.png' || image == 'show_statistics_ok.png' || image == 'show_statistics_warning.png' || image == 'show_statistics.png'){
-				$(item).attr('width', 450);
+				$(item).attr('width', 520);
 				$(item).attr('height', 80);
 			}
 			
diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php
index 23a8805570..dc83d2d7f6 100644
--- a/pandora_console/godmode/setup/setup_general.php
+++ b/pandora_console/godmode/setup/setup_general.php
@@ -209,7 +209,7 @@ $table->data[34][0] = __('Allow create planned downtimes in the past') .
 $table->data[34][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('past_planned_downtimes', 1, '', $config["past_planned_downtimes"], true).'&nbsp;&nbsp;';
 $table->data[34][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('past_planned_downtimes', 0, '', $config["past_planned_downtimes"], true);
 
-$table->data[35][0] = __('Limit parameters massive') .
+$table->data[35][0] = __('Limit parameters bulk') .
 	ui_print_help_tip(__('Your PHP environment is setted with %d max_input_vars. Maybe you must not set this value with upper values.', ini_get("max_input_vars")), true);
 $table->data[35][1] = html_print_input_text('limit_parameters_massive',
 	$config['limit_parameters_massive'], '', 10, 10, true);
diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php
index a7e710dcb2..97fb142a8d 100644
--- a/pandora_console/include/auth/mysql.php
+++ b/pandora_console/include/auth/mysql.php
@@ -645,15 +645,27 @@ function ldap_process_user_login ($login, $password) {
 		}
 	}
 	
-	$ldap_login_attr  = isset($config["ldap_login_attr"]) ? io_safe_output($config["ldap_login_attr"]) . "=" : '';
-	$ldap_base_dn  = isset($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
-	
-	if (strlen($password) == 0 || 
-		!@ldap_bind($ds, io_safe_output($login), $password) ) {
-		$config["auth_error"] = 'User not found in database or incorrect password';
-		@ldap_close ($ds);
-		
-		return false;
+	$ldap_login_attr  = !empty($config["ldap_login_attr"]) ? io_safe_output($config["ldap_login_attr"]) . "=" : '';
+
+	$ldap_base_dn  = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
+
+	if(!empty($ldap_base_dn)){
+		if (strlen($password) == 0 || 
+			!@ldap_bind($ds, $ldap_login_attr.io_safe_output($login).$ldap_base_dn, $password) ) {
+				$config["auth_error"] = 'User not found in database or incorrect password';
+				@ldap_close ($ds);
+
+				return false;
+
+		}
+	} else {
+		if (strlen($password) == 0 || 
+			!@ldap_bind($ds, io_safe_output($login), $password) ) {
+			$config["auth_error"] = 'User not found in database or incorrect password';
+			@ldap_close ($ds);
+			
+			return false;
+		}
 	}
 	
 	@ldap_close ($ds);
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 0a07b5ca99..6b20518de4 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -22,7 +22,7 @@
 /**
  * Pandora build version and version 
  */
-$build_version = 'PC170914';
+$build_version = 'PC170925';
 $pandora_version = 'v7.0NG.712';
 
 // Do not overwrite default timezone set if defined.
diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php
index f59032071f..f8edfd1d27 100644
--- a/pandora_console/include/functions.php
+++ b/pandora_console/include/functions.php
@@ -1806,7 +1806,20 @@ function check_acl($id_user, $id_group, $access, $onlyOneGroup = false) {
 	else {
 		$id_group = (int) $id_group;
 	}
-	
+
+	$three_eyes_crow_groups = db_get_all_rows_sql("SELECT tperfil.*, tusuario_perfil.id_perfil FROM tperfil, tusuario_perfil WHERE tusuario_perfil.id_usuario = '" . 
+													$id_user . "' AND tusuario_perfil.id_grupo = 0 AND tusuario_perfil.id_perfil = tperfil.id_perfil");
+
+	if ($three_eyes_crow_groups && !empty($three_eyes_crow_groups)) {
+		$acl_column = get_acl_column($access);
+		
+		foreach ($three_eyes_crow_groups as $three_eyes_crow_group) {
+			if (isset($three_eyes_crow_group[$acl_column]) && $three_eyes_crow_group[$acl_column] == 1) {
+				return 1;
+			}
+		}
+	}
+
 	$parents_id = array($id_group);
 	if ($id_group != 0 && $onlyOneGroup !== true) {
 		$group = db_get_row_filter('tgrupo', array('id_grupo' => $id_group));
diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php
index 16ed02af3f..1a70f8d41d 100644
--- a/pandora_console/include/functions_config.php
+++ b/pandora_console/include/functions_config.php
@@ -201,7 +201,7 @@ function config_update_config () {
 					if (!config_update_value ('past_planned_downtimes', get_parameter('past_planned_downtimes')))
 						$error_update[] = __('Allow create planned downtimes in the past');
 					if (!config_update_value ('limit_parameters_massive', get_parameter('limit_parameters_massive')))
-						$error_update[] = __('Limit parameters massive');
+						$error_update[] = __('Limit parameters bulk');
 					if (!config_update_value ('identification_reminder', get_parameter('identification_reminder')))
 						$error_update[] = __('Identification_reminder');
 					if (!config_update_value ('include_agents', (bool)get_parameter('include_agents')))
diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php
index 499a8a817f..adf077ec6a 100644
--- a/pandora_console/include/functions_custom_graphs.php
+++ b/pandora_console/include/functions_custom_graphs.php
@@ -164,7 +164,7 @@ function custom_graphs_print($id_graph, $height, $width, $period,
 	$background_color = 'white', $modules_param = array(), $homeurl = '',
 	$name_list = array(), $unit_list = array(), $show_last = true,
 	$show_max = true, $show_min = true, $show_avg = true, $ttl = 1,
-	$dashboard = false, $vconsole = false, $percentil = null, $from_interface = false,$id_widget_dashboard=false) {
+	$dashboard = false, $vconsole = false, $percentil = null, $from_interface = false,$id_widget_dashboard=false, $fullscale = false) {
 	
 	global $config;
 	
@@ -261,7 +261,8 @@ function custom_graphs_print($id_graph, $height, $width, $period,
 		$vconsole,
 		$percentil,
 		$from_interface,
-		$id_widget_dashboard);
+		$id_widget_dashboard,
+		$fullscale);
 	
 	if ($return)
 		return $output;
diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php
index 6fcca53864..d79489e932 100644
--- a/pandora_console/include/functions_graph.php
+++ b/pandora_console/include/functions_graph.php
@@ -502,7 +502,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
 	$baseline = 0, $return_data = 0, $show_title = true, $projection = false, 
 	$adapt_key = '', $compare = false, $series_suffix = '', $series_suffix_str = '', 
 	$show_unknown = false, $percentil = null, $dashboard = false, $vconsole = false,
-	$type_graph='area', $fullscale = false) {
+	$type_graph='area', $fullscale = false, $flash_chart = false) {
 	
 	global $config;
 	global $chart;
@@ -570,12 +570,14 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
 	
 	// Get module data
 	if ($fullscale) {
-		$data = db_get_all_rows_filter ('tagente_datos',
-			array ('id_agente_modulo' => (int)$agent_module_id,
-				"utimestamp > $datelimit",
-				"utimestamp < $date",
-				'order' => 'utimestamp ASC'),
-			array ('datos', 'utimestamp'), 'AND', true);
+		fullscale_data( $chart, $chart_data_extra, $long_index, $series_type,
+						$agent_module_id, $datelimit, $date, $events, 
+						$show_events, $show_unknown, $show_alerts, 
+						$series_suffix, $percentil, $flash_chart);
+		if (count($chart) > $resolution) {
+			$resolution = count($chart); //Number of points of the graph
+			$interval = (int) ($period / $resolution);
+		}
 	}
 	else {
 		$data = db_get_all_rows_filter ('tagente_datos',
@@ -619,73 +621,68 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
 			}
 			$data = $new_data;
 		}
-	}
 	
-	// Get module warning_min and critical_min
-	$warning_min = db_get_value('min_warning','tagente_modulo','id_agente_modulo',$agent_module_id);
-	$critical_min = db_get_value('min_critical','tagente_modulo','id_agente_modulo',$agent_module_id);
-	
-	if ($data === false) {
-		$data = array ();
-	}
-	
-	
-	if ($uncompressed_module) {
-		// Uncompressed module data
 		
-		$min_necessary = 1;
-	}
-	else {
-		// Compressed module data
 		
-		// Get previous data
-		$previous_data = modules_get_previous_data ($agent_module_id, $datelimit);
-		if ($previous_data !== false) {
-			$previous_data['utimestamp'] = $datelimit;
-			array_unshift ($data, $previous_data);
+		if ($data === false) {
+			$data = array ();
 		}
 		
-		// Get next data
-		$nextData = modules_get_next_data ($agent_module_id, $date);
-		if ($nextData !== false) {
-			array_push ($data, $nextData);
+		if ($uncompressed_module) {
+			// Uncompressed module data	
+			$min_necessary = 1;
 		}
-		else if (count ($data) > 0) {
-			// Propagate the last known data to the end of the interval
-			$nextData = array_pop ($data);
-			array_push ($data, $nextData);
-			$nextData['utimestamp'] = $date;
-			array_push ($data, $nextData);
+		else {
+			// Compressed module data
+			
+			// Get previous data
+			$previous_data = modules_get_previous_data ($agent_module_id, $datelimit);
+			if ($previous_data !== false) {
+				$previous_data['utimestamp'] = $datelimit;
+				array_unshift ($data, $previous_data);
+			}
+			
+			// Get next data
+			$nextData = modules_get_next_data ($agent_module_id, $date);
+			if ($nextData !== false) {
+				array_push ($data, $nextData);
+			}
+			else if (count ($data) > 0) {
+				// Propagate the last known data to the end of the interval
+				$nextData = array_pop ($data);
+				array_push ($data, $nextData);
+				$nextData['utimestamp'] = $date;
+				array_push ($data, $nextData);
+			}
+			$min_necessary = 2;
 		}
-		
-		$min_necessary = 2;
-	}
 
-	// Check available data
-	if (count ($data) < $min_necessary) {
-		if (!$graphic_type) {
-			if (!$projection) {
-				return fs_error_image ();
-			}
-			else {
-				return fs_error_image ();
+		// Check available data
+		if (count ($data) < $min_necessary) {
+			if (!$graphic_type) {
+				if (!$projection) {
+					return fs_error_image ();
+				}
+				else {
+					return fs_error_image ();
+				}
 			}
+			graphic_error ();
+		}
+		
+
+		// Data iterator
+		$data_i = 0;
+		
+		// Set initial conditions
+		if ($data[0]['utimestamp'] == $datelimit) {
+			$previous_data = $data[0]['datos'];
+			$data_i++;
+		}
+		else {
+			$previous_data = 0;
 		}
-		graphic_error ();
 	}
-	
-	// Data iterator
-	$data_i = 0;
-	
-	// Set initial conditions
-	if ($data[0]['utimestamp'] == $datelimit) {
-		$previous_data = $data[0]['datos'];
-		$data_i++;
-	}
-	else {
-		$previous_data = 0;
-	}
-	
 	// Get baseline data
 	$baseline_data = array();
 	if ($baseline) {
@@ -707,49 +704,29 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
 		}
 	}
 
-	if ($fullscale) {
-		if (count($data) > $resolution) {
-			$resolution = count($data); //Number of points of the graph
-			$interval = (int) ($period / $resolution);
-		}
+	// Get module warning_min and critical_min
+	$warning_min  = db_get_value('min_warning','tagente_modulo','id_agente_modulo',$agent_module_id);
+	$critical_min = db_get_value('min_critical','tagente_modulo','id_agente_modulo',$agent_module_id);
+
+	// Calculate chart data
+	if($fullscale){
+		$avg_only = 1;
+	}
+	else{
+		grafico_modulo_sparse_data_chart ($chart, $chart_data_extra, $long_index, 
+			$data, $data_i, $previous_data, $resolution, $interval, $period, $datelimit, 
+			$projection, $avg_only, $uncompressed_module, 
+			$show_events, $show_alerts, $show_unknown, $baseline, 
+			$baseline_data, $events, $series_suffix, $start_unknown,
+			$percentil, $fullscale);
 	}
 	
-	// Calculate chart data
-	grafico_modulo_sparse_data_chart ($chart, $chart_data_extra, $long_index, 
-		$data, $data_i, $previous_data, $resolution, $interval, $period, $datelimit, 
-		$projection, $avg_only, $uncompressed_module, 
-		$show_events, $show_alerts, $show_unknown, $baseline, 
-		$baseline_data, $events, $series_suffix, $start_unknown,
-		$percentil, $fullscale);
-
-	if ($fullscale) {
-		if (!$flash_chart) {
-			$time_format = "Y M \nd H:i:s";
-		}
-		else {
-			$time_format = "Y M d H:i:s";
-		}
-
-		$new_chart = array();
-		$new_long_index = array();
-		foreach ($chart as $c_timestamp => $c_data) {
-			$timestamp_short = date($time_format, $c_timestamp);
-			$new_long_index[$timestamp_short] = date(
-				html_entity_decode($time_format, ENT_QUOTES, "UTF-8"), $c_timestamp);
-			$new_chart[$timestamp_short] = $c_data;
-		}
-
-		$long_index = $new_long_index;
-		$chart = $new_chart;
-	}
-
 	// Return chart data and don't draw
 	if ($return_data == 1) {
 		return $chart;
 	}
 	
 	$graph_stats = get_statwin_graph_statistics($chart, $series_suffix);
-	
 	// Fix event and alert scale
 	if ($max_value > 0) {
 		$event_max = 2 + (float)$max_value * 1.05;
@@ -820,7 +797,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
 	}
 	if ($show_events) {
 		$legend['event'.$series_suffix_str] = __('Events').$series_suffix_str;
-		$chart_extra_data['legend_events'] = $legend['event'].$series_suffix_str;
+		$chart_extra_data['legend_events'] = $legend['event'.$series_suffix_str];
 	}
 	if ($show_alerts) {
 		$legend['alert'.$series_suffix] = __('Alerts').$series_suffix_str;
@@ -842,11 +819,14 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
 			__('Last') . ': ' . remove_right_zeros(number_format($graph_stats['sum']['last'], $config['graph_precision'])) . ($unit ? ' ' . $unit : '') . ' ; '
 			. __('Avg') . ': ' . remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])) . ($unit ? ' ' . $unit : '');
 	}
-	else if (!$avg_only) {
+	else if (!$avg_only && !$fullscale) {
 		$legend['max'.$series_suffix] = __('Max').$series_suffix_str.': '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['max']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['max']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['max']['min'], $config['graph_precision'])).' '.$unit;
 		$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit;
 		$legend['min'.$series_suffix] = __('Min').$series_suffix_str.': '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['min']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['min']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['min']['min'], $config['graph_precision'])).' '.$unit;
 	}
+	else if ($fullscale){
+		$legend['sum'.$series_suffix] = __('Data').$series_suffix_str.': ';
+	}
 	else {
 		$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit;
 	}
@@ -855,7 +835,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
 		$legend['unknown'.$series_suffix] = __('Unknown').$series_suffix_str;
 		$chart_extra_data['legend_unknown'] = $legend['unknown'.$series_suffix_str];
 	}
-	
+
 	if (!is_null($percentil) && $percentil) {
 		$first_data = reset($chart);
 		$percentil_value = format_for_graph($first_data['percentil'], 2);
@@ -904,7 +884,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
 			$return_data, $show_title, $projection, $adapt_key,
 			$compare, $series_suffix, $series_suffix_str,
 			$show_unknown, $percentil, $dashboard, $vconsole,$type_graph, 
-			$fullscale);
+			$fullscale, $flash_chart);
 		
 		switch ($compare) {
 			case 'separated':
@@ -937,12 +917,10 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
 		$show_alerts, $avg_only,
 		$date, $unit, $baseline, $return_data, $show_title,
 		$projection, $adapt_key, $compare, '', '', $show_unknown,
-		$percentil, $dashboard, $vconsole, $type_graph, $fullscale);
-
+		$percentil, $dashboard, $vconsole, $type_graph, $fullscale, $flash_chart);
 	if ($return_data) {
 		return $data_returned;
 	}
-	
 	if ($compare === 'overlapped') {
 		$i = 0;
 		foreach ($chart as $k=>$v) {
@@ -1082,488 +1060,521 @@ function graphic_combined_module ($module_list, $weight_list, $period,
 	$prediction_period = false, $background_color = 'white',
 	$name_list = array(), $unit_list = array(), $show_last = true, $show_max = true,
 	$show_min = true, $show_avg = true, $labels = array(), $dashboard = false,
-	$vconsole = false, $percentil = null, $from_interface = false, $id_widget_dashboard=false) {
+	$vconsole = false, $percentil = null, $from_interface = false, 
+	$id_widget_dashboard=false, $fullscale = false) {
 	
 	global $config;
 	global $graphic_type;
+
+	if(!$fullscale){
+		$time_format_2 = '';
+		$temp_range = $period;
 	
-	$time_format_2 = '';
-	$temp_range = $period;
-	
-	if ($projection != false) {
-		if ($period < $prediction_period)
-			$temp_range = $prediction_period;
-	}
-	
-	// Set the title and time format
-	if ($temp_range <= SECONDS_1DAY) {
-		$time_format = 'Y M d H:i:s';
-	}
-	elseif ($temp_range < SECONDS_15DAYS) {
-		$time_format = 'Y M d';
-		$time_format_2 = 'H:i';
 		if ($projection != false) {
+			if ($period < $prediction_period)
+				$temp_range = $prediction_period;
+		}
+		
+		// Set the title and time format
+		if ($temp_range <= SECONDS_1DAY) {
+			$time_format = 'Y M d H:i:s';
+		}
+		elseif ($temp_range < SECONDS_15DAYS) {
+			$time_format = 'Y M d';
+			$time_format_2 = 'H:i';
+			if ($projection != false) {
+				$time_format_2 = 'H\h';
+			}
+		}
+		elseif ($temp_range <= SECONDS_1MONTH) {
+			$time_format = 'Y M d';
 			$time_format_2 = 'H\h';
 		}
-	}
-	elseif ($temp_range <= SECONDS_1MONTH) {
-		$time_format = 'Y M d';
-		$time_format_2 = 'H\h';
-	}
-	elseif ($temp_range <= SECONDS_1MONTH) {
-		$time_format = 'Y M d';
-		$time_format_2 = 'H\h';
-	}
-	elseif ($period < SECONDS_6MONTHS) {
-		$time_format = 'Y M d';
-		$time_format_2 = 'H\h';
-	}
-	else {
-		$time_format = "Y M d";
-		$time_format_2 = 'H\h';
-	}
-	
-	// Set variables
-	if ($date == 0)
-		$date = get_system_time();
-	$datelimit = $date - $period;
-	
-	$resolution = $config['graph_res'] * 50; //Number of points of the graph
-	$interval = (int) ($period / $resolution);
-	
-	// If projection graph, fill with zero previous data to projection interval	
-	if ($projection != false) {
-		$j = $datelimit;
-		$in_range = true;
-		while ($in_range) {
-			$timestamp_f = graph_get_formatted_date($j, $time_format, $time_format_2);
-			
-			$before_projection[$timestamp_f] = 0;
-			
-			if ($j > $date) {
-				$in_range = false;
-			}
-			$j = $j + $interval;
+		elseif ($temp_range <= SECONDS_1MONTH) {
+			$time_format = 'Y M d';
+			$time_format_2 = 'H\h';
 		}
-	}
-	
-	// Added support for projection graphs (normal_module + 1(prediction data))
-	if ($projection !== false) { 
-		$module_number = count ($module_list) + 1;
-	}
-	else {
-		$module_number = count ($module_list);
-	}
-	
-	$names_number = count($name_list);
-	$units_number = count($unit_list);
-	
-	// interval - This is the number of "rows" we are divided the time to fill data.
-	//    more interval, more resolution, and slower.
-	// periodo - Gap of time, in seconds. This is now to (now-periodo) secs
-	
-	// Init weights
-	for ($i = 0; $i < $module_number; $i++) {
-		if (! isset ($weight_list[$i])) {
-			$weight_list[$i] = 1;
-		}
-		else if ($weight_list[$i] == 0) {
-			$weight_list[$i] = 1;
-		}
-	}
-	
-	// Set data containers
-	for ($i = 0; $i < $resolution; $i++) {
-		$timestamp = $datelimit + ($interval * $i);/*
-		$timestamp_short = date($time_format, $timestamp);
-		$long_index[$timestamp_short] = date(
-		html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp);
-		$timestamp = $timestamp_short;*/
-		
-		$graph[$timestamp]['count'] = 0;
-		$graph[$timestamp]['timestamp_bottom'] = $timestamp;
-		$graph[$timestamp]['timestamp_top'] = $timestamp + $interval;
-		$graph[$timestamp]['min'] = 0;
-		$graph[$timestamp]['max'] = 0;
-		$graph[$timestamp]['event'] = 0;
-		$graph[$timestamp]['alert'] = 0;
-	}
-	
-	$long_index = array();
-	
-	$graph_values = array();
-	$module_name_list = array();
-	$collector = 0;
-	$user = users_get_user_by_id($config['id_user']);
-	$user_flash_charts = $user['flash_chart'];
-	
-	if ($user_flash_charts == 1)
-		$flash_charts = true;
-	elseif($user_flash_charts == -1)
-		$flash_charts = $config['flash_charts'];
-	elseif($user_flash_charts == 0)
-		$flash_charts = false;
-	
-	if ($only_image) {
-		$flash_charts = false;
-	}
-	
-	// Calculate data for each module
-	for ($i = 0; $i < $module_number; $i++) {
-		$automatic_custom_graph_meta = false;
-		if ($config['metaconsole']) {
-			// Automatic custom graph from the report template in metaconsole
-			if (is_array($module_list[$i])) {
-				$server = metaconsole_get_connection_by_id ($module_list[$i]['server']);
-				metaconsole_connect($server);
-				$automatic_custom_graph_meta = true;
-			}
-		}
-		
-		$search_in_history_db = db_search_in_history_db($datelimit);
-		
-		// If its a projection graph,
-		// first module will be data and second will be the projection
-		if ($projection != false && $i != 0) {
-			if ($automatic_custom_graph_meta)
-				$agent_module_id = $module_list[0]['module'];
-			else
-				$agent_module_id = $module_list[0];
-			
-			$id_module_type = modules_get_agentmodule_type ($agent_module_id);
-			$module_type = modules_get_moduletype_name ($id_module_type);
-			$uncompressed_module = is_module_uncompressed ($module_type);
+		elseif ($period < SECONDS_6MONTHS) {
+			$time_format = 'Y M d';
+			$time_format_2 = 'H\h';
 		}
 		else {
-			if ($automatic_custom_graph_meta)
-				$agent_module_id = $module_list[$i]['module'];
-			else
-				$agent_module_id = $module_list[$i];
-			
-			
-			$id_module_type = modules_get_agentmodule_type ($agent_module_id);
-			$module_type = modules_get_moduletype_name ($id_module_type);
-			$uncompressed_module = is_module_uncompressed ($module_type);
+			$time_format = "Y M d";
+			$time_format_2 = 'H\h';
 		}
 		
-		if ($uncompressed_module) {
-			$avg_only = 1;
+		// Set variables
+		if ($date == 0)
+			$date = get_system_time();
+		$datelimit = $date - $period;
+		
+		$resolution = $config['graph_res'] * 50; //Number of points of the graph
+		$interval = (int) ($period / $resolution);
+		
+		// If projection graph, fill with zero previous data to projection interval	
+		if ($projection != false) {
+			$j = $datelimit;
+			$in_range = true;
+			while ($in_range) {
+				$timestamp_f = graph_get_formatted_date($j, $time_format, $time_format_2);
+				
+				$before_projection[$timestamp_f] = 0;
+				
+				if ($j > $date) {
+					$in_range = false;
+				}
+				$j = $j + $interval;
+			}
 		}
 		
-		// Get event data (contains alert data too)
-		if ($show_events == 1 || $show_alerts == 1) {
-			$events = db_get_all_rows_filter ('tevento',
-				array ('id_agentmodule' => $agent_module_id,
+		// Added support for projection graphs (normal_module + 1(prediction data))
+		if ($projection !== false) { 
+			$module_number = count ($module_list) + 1;
+		}
+		else {
+			$module_number = count ($module_list);
+		}
+		
+		$names_number = count($name_list);
+		$units_number = count($unit_list);
+		
+		// interval - This is the number of "rows" we are divided the time to fill data.
+		//    more interval, more resolution, and slower.
+		// periodo - Gap of time, in seconds. This is now to (now-periodo) secs
+		
+		// Init weights
+		for ($i = 0; $i < $module_number; $i++) {
+			if (! isset ($weight_list[$i])) {
+				$weight_list[$i] = 1;
+			}
+			else if ($weight_list[$i] == 0) {
+				$weight_list[$i] = 1;
+			}
+		}
+		
+		// Set data containers
+		for ($i = 0; $i < $resolution; $i++) {
+			$timestamp = $datelimit + ($interval * $i);/*
+			$timestamp_short = date($time_format, $timestamp);
+			$long_index[$timestamp_short] = date(
+			html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp);
+			$timestamp = $timestamp_short;*/
+			
+			$graph[$timestamp]['count'] = 0;
+			$graph[$timestamp]['timestamp_bottom'] = $timestamp;
+			$graph[$timestamp]['timestamp_top'] = $timestamp + $interval;
+			$graph[$timestamp]['min'] = 0;
+			$graph[$timestamp]['max'] = 0;
+			$graph[$timestamp]['event'] = 0;
+			$graph[$timestamp]['alert'] = 0;
+		}
+		$long_index = array();
+		
+		$graph_values = array();
+		$module_name_list = array();
+		$collector = 0;
+		$user = users_get_user_by_id($config['id_user']);
+		$user_flash_charts = $user['flash_chart'];
+		
+		if ($user_flash_charts == 1)
+			$flash_charts = true;
+		elseif($user_flash_charts == -1)
+			$flash_charts = $config['flash_charts'];
+		elseif($user_flash_charts == 0)
+			$flash_charts = false;
+		
+		if ($only_image) {
+			$flash_charts = false;
+		}
+		
+		// Calculate data for each module
+		for ($i = 0; $i < $module_number; $i++) {
+			$automatic_custom_graph_meta = false;
+			if ($config['metaconsole']) {
+				// Automatic custom graph from the report template in metaconsole
+				if (is_array($module_list[$i])) {
+					$server = metaconsole_get_connection_by_id ($module_list[$i]['server']);
+					metaconsole_connect($server);
+					$automatic_custom_graph_meta = true;
+				}
+			}
+			
+			$search_in_history_db = db_search_in_history_db($datelimit);
+			
+			// If its a projection graph,
+			// first module will be data and second will be the projection
+			if ($projection != false && $i != 0) {
+				if ($automatic_custom_graph_meta)
+					$agent_module_id = $module_list[0]['module'];
+				else
+					$agent_module_id = $module_list[0];
+				
+				$id_module_type = modules_get_agentmodule_type ($agent_module_id);
+				$module_type = modules_get_moduletype_name ($id_module_type);
+				$uncompressed_module = is_module_uncompressed ($module_type);
+			}
+			else {
+				if ($automatic_custom_graph_meta)
+					$agent_module_id = $module_list[$i]['module'];
+				else
+					$agent_module_id = $module_list[$i];
+				
+				
+				$id_module_type = modules_get_agentmodule_type ($agent_module_id);
+				$module_type = modules_get_moduletype_name ($id_module_type);
+				$uncompressed_module = is_module_uncompressed ($module_type);
+			}
+			
+			if ($uncompressed_module) {
+				$avg_only = 1;
+			}
+			
+			// Get event data (contains alert data too)
+			if ($show_events == 1 || $show_alerts == 1) {
+				$events = db_get_all_rows_filter ('tevento',
+					array ('id_agentmodule' => $agent_module_id,
+						"utimestamp > $datelimit",
+						"utimestamp < $date",
+						'order' => 'utimestamp ASC'),
+					array ('evento', 'utimestamp', 'event_type'));
+				if ($events === false) {
+					$events = array ();
+				}
+			}
+			
+			// Get module data
+			$data = db_get_all_rows_filter ('tagente_datos',
+				array ('id_agente_modulo' => $agent_module_id,
 					"utimestamp > $datelimit",
 					"utimestamp < $date",
 					'order' => 'utimestamp ASC'),
-				array ('evento', 'utimestamp', 'event_type'));
-			if ($events === false) {
-				$events = array ();
-			}
-		}
-		
-		// Get module data
-		$data = db_get_all_rows_filter ('tagente_datos',
-			array ('id_agente_modulo' => $agent_module_id,
-				"utimestamp > $datelimit",
-				"utimestamp < $date",
-				'order' => 'utimestamp ASC'),
-			array ('datos', 'utimestamp'), 'AND', $search_in_history_db);
-		if ($data === false) {
-			$data = array ();
-		}
-		
-		// Uncompressed module data
-		if ($uncompressed_module) {
-			$min_necessary = 1;
-		
-		// Compressed module data
-		}
-		else {
-			// Get previous data
-			$previous_data = modules_get_previous_data ($agent_module_id, $datelimit);
-			if ($previous_data !== false) {
-				$previous_data['utimestamp'] = $datelimit;
-				array_unshift ($data, $previous_data);
-			}
+				array ('datos', 'utimestamp'), 'AND', $search_in_history_db);
 			
-			// Get next data
-			$nextData = modules_get_next_data ($agent_module_id, $date);
-			if ($nextData !== false) {
-				array_push ($data, $nextData);
-			}
-			else if (count ($data) > 0) {
-				// Propagate the last known data to the end of the interval
-				$nextData = array_pop ($data);
-				array_push ($data, $nextData);
-				$nextData['utimestamp'] = $date;
-				array_push ($data, $nextData);
+			if ($data === false) {
+				$data = array ();
 			}
+
+			// Uncompressed module data
+			if ($uncompressed_module) {
+				$min_necessary = 1;
 			
-			$min_necessary = 2;
-		}
-		
-		// Set initial conditions
-		$graph_values[$i] = array();
-		
-		// Check available data
-		if (count ($data) < $min_necessary) {
-			continue;
-		}
-		
-		if (!empty($name_list) && $names_number == $module_number && isset($name_list[$i])) {
-			if ($labels[$agent_module_id] != '')
-				$module_name_list[$i] = $labels[$agent_module_id];
+			// Compressed module data
+			}
 			else {
+				// Get previous data
+				$previous_data = modules_get_previous_data ($agent_module_id, $datelimit);
+				if ($previous_data !== false) {
+					$previous_data['utimestamp'] = $datelimit;
+					array_unshift ($data, $previous_data);
+				}
+				
+				// Get next data
+				$nextData = modules_get_next_data ($agent_module_id, $date);
+				if ($nextData !== false) {
+					array_push ($data, $nextData);
+				}
+				else if (count ($data) > 0) {
+					// Propagate the last known data to the end of the interval
+					$nextData = array_pop ($data);
+					array_push ($data, $nextData);
+					$nextData['utimestamp'] = $date;
+					array_push ($data, $nextData);
+				}
+				
+				$min_necessary = 2;
+			}
+			
+			// Set initial conditions
+			$graph_values[$i] = array();
+			
+			// Check available data
+			if (count ($data) < $min_necessary) {
+				continue;
+			}
+			
+			if (!empty($name_list) && $names_number == $module_number && isset($name_list[$i])) {
+				if ($labels[$agent_module_id] != '')
+					$module_name_list[$i] = $labels[$agent_module_id];
+				else {
+					$agent_name = io_safe_output(
+						modules_get_agentmodule_agent_name ($agent_module_id));
+					$alias = db_get_value ("alias","tagente","nombre",$agent_name);
+					$module_name = io_safe_output(
+						modules_get_agentmodule_name ($agent_module_id));
+					
+					if ($flash_charts)
+						$module_name_list[$i] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $alias . " / " . $module_name. '</span>';
+					else
+						$module_name_list[$i] = $alias . " / " . $module_name;
+				}
+			}
+			else {
+				//Get and process agent name
 				$agent_name = io_safe_output(
 					modules_get_agentmodule_agent_name ($agent_module_id));
 				$alias = db_get_value ("alias","tagente","nombre",$agent_name);
+				$agent_name = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '...', false);
+				
+				$agent_id = agents_get_agent_id ($agent_name);
+				
+				//Get and process module name
 				$module_name = io_safe_output(
 					modules_get_agentmodule_name ($agent_module_id));
+				$module_name = sprintf(__("%s"), $module_name);
+				$module_name = ui_print_truncate_text($module_name, 'module_small', false, true, false, '...', false);
 				
-				if ($flash_charts)
-					$module_name_list[$i] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $alias . " / " . $module_name. '</span>';
-				else
-					$module_name_list[$i] = $alias . " / " . $module_name;
-			}
-		}
-		else {
-			//Get and process agent name
-			$agent_name = io_safe_output(
-				modules_get_agentmodule_agent_name ($agent_module_id));
-			$alias = db_get_value ("alias","tagente","nombre",$agent_name);
-			$agent_name = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '...', false);
-			
-			$agent_id = agents_get_agent_id ($agent_name);
-			
-			//Get and process module name
-			$module_name = io_safe_output(
-				modules_get_agentmodule_name ($agent_module_id));
-			$module_name = sprintf(__("%s"), $module_name);
-			$module_name = ui_print_truncate_text($module_name, 'module_small', false, true, false, '...', false);
-			
-			if ($flash_charts) {
-				if ($labels[$agent_module_id] != '')
-					$module_name_list[$i] = '<span style=\"font-size:' . 
-						($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . 
-						$labels[$agent_module_id] . '</span>';
-				else
-					$module_name_list[$i] = '<span style=\"font-size:' . 
-						($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . 
-						$alias . ' / ' . $module_name . '</span>';
-			}
-			else {
-				if ($labels[$agent_module_id] != '')
-					$module_name_list[$i] = $labels[$agent_module_id];
-				else
-					$module_name_list[$i] = $alias . ' / ' . $module_name;
-			}
-		}
-		
-		// Data iterator
-		$j = 0;
-		
-		// Event iterator
-		$k = 0;
-		
-		// Set initial conditions
-		
-		//$graph_values[$i] = array();
-		$temp_graph_values = array();
-		
-		if ($data[0]['utimestamp'] == $datelimit) {
-			$previous_data = $data[0]['datos'];
-			$j++;
-		}
-		else {
-			$previous_data = 0;
-		}
-		
-		$max = 0;
-		$min = null;
-		$avg = 0;
-		$countAvg = 0;
-		
-		// Calculate chart data
-		$last_known = $previous_data;
-
-		for ($l = 0; $l <= $resolution; $l++) {
-			$countAvg ++;
-			
-			$timestamp = $datelimit + ($interval * $l);
-			$timestamp_short = graph_get_formatted_date($timestamp, $time_format, $time_format_2);
-			
-			$long_index[$timestamp_short] = date(
-			html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp);
-			//$timestamp = $timestamp_short;
-			
-			$total = 0;
-			$count = 0;
-			
-			// Read data that falls in the current interval
-			$interval_min = $last_known;
-			$interval_max = $last_known;
-			
-			while (isset ($data[$j]) && $data[$j]['utimestamp'] >= $timestamp && $data[$j]['utimestamp'] < ($timestamp + $interval)) {
-				if ($data[$j]['datos'] > $interval_max) {
-					$interval_max = $data[$j]['datos'];
-				}
-				else if ($data[$j]['datos'] < $interval_max) {
-					$interval_min = $data[$j]['datos'];
-				}
-				$total += $data[$j]['datos'];
-				$last_known = $data[$j]['datos'];
-				$count++;
-				$j++;
-			}
-			
-			// Average
-			if ($count > 0) {
-				$total /= $count;
-			}
-			
-			// Read events and alerts that fall in the current interval
-			$event_value = 0;
-			$alert_value = 0;
-			while (isset ($events[$k]) && $events[$k]['utimestamp'] >= $timestamp && $events[$k]['utimestamp'] <= ($timestamp + $interval)) {
-				if ($show_events == 1) {
-					$event_value++;
-				}
-				if ($show_alerts == 1 && substr ($events[$k]['event_type'], 0, 5) == 'alert') {
-					$alert_value++;
-				}
-				$k++;
-			}
-			
-			// Data
-			if ($count > 0) {
-				//$graph_values[$i][$timestamp] = $total * $weight_list[$i];
-				$temp_graph_values[$timestamp_short] = $total * $weight_list[$i];
-			}
-			else {
-				// Compressed data
-				if ($uncompressed_module || ($timestamp > time ())) {
-					$temp_graph_values[$timestamp_short] = 0;
+				if ($flash_charts) {
+					if ($labels[$agent_module_id] != '')
+						$module_name_list[$i] = '<span style=\"font-size:' . 
+							($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . 
+							$labels[$agent_module_id] . '</span>';
+					else
+						$module_name_list[$i] = '<span style=\"font-size:' . 
+							($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . 
+							$alias . ' / ' . $module_name . '</span>';
 				}
 				else {
-					$temp_graph_values[$timestamp_short] = $last_known * $weight_list[$i];
+					if ($labels[$agent_module_id] != '')
+						$module_name_list[$i] = $labels[$agent_module_id];
+					else
+						$module_name_list[$i] = $alias . ' / ' . $module_name;
 				}
 			}
 			
-			//Extract max, min, avg
-			if ($max < $temp_graph_values[$timestamp_short]) {
-				$max = $temp_graph_values[$timestamp_short];
+			// Data iterator
+			$j = 0;
+			
+			// Event iterator
+			$k = 0;
+			
+			// Set initial conditions
+			
+			//$graph_values[$i] = array();
+			$temp_graph_values = array();
+			
+			if ($data[0]['utimestamp'] == $datelimit) {
+				$previous_data = $data[0]['datos'];
+				$j++;
+			}
+			else {
+				$previous_data = 0;
 			}
 			
-			if (isset($min)) {
-				if ($min > $temp_graph_values[$timestamp_short]) {
+			$max = 0;
+			$min = null;
+			$avg = 0;
+			$countAvg = 0;
+			
+			// Calculate chart data
+			$last_known = $previous_data;
+			for ($l = 0; $l <= $resolution; $l++) {
+				$countAvg ++;
+				
+				$timestamp = $datelimit + ($interval * $l);
+				$timestamp_short = graph_get_formatted_date($timestamp, $time_format, $time_format_2);
+				
+				$long_index[$timestamp_short] = date(
+				html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp);
+				//$timestamp = $timestamp_short;
+				
+				$total = 0;
+				$count = 0;
+				
+				// Read data that falls in the current interval
+				$interval_min = $last_known;
+				$interval_max = $last_known;
+				
+				while (isset ($data[$j]) && $data[$j]['utimestamp'] >= $timestamp && $data[$j]['utimestamp'] < ($timestamp + $interval)) {
+					if ($data[$j]['datos'] > $interval_max) {
+						$interval_max = $data[$j]['datos'];
+					}
+					else if ($data[$j]['datos'] < $interval_max) {
+						$interval_min = $data[$j]['datos'];
+					}
+					$total += $data[$j]['datos'];
+					$last_known = $data[$j]['datos'];
+					$count++;
+					$j++;
+				}
+				
+				// Average
+				if ($count > 0) {
+					$total /= $count;
+				}
+				
+				// Read events and alerts that fall in the current interval
+				$event_value = 0;
+				$alert_value = 0;
+				while (isset ($events[$k]) && $events[$k]['utimestamp'] >= $timestamp && $events[$k]['utimestamp'] <= ($timestamp + $interval)) {
+					if ($show_events == 1) {
+						$event_value++;
+					}
+					if ($show_alerts == 1 && substr ($events[$k]['event_type'], 0, 5) == 'alert') {
+						$alert_value++;
+					}
+					$k++;
+				}
+				
+				// Data
+				if ($count > 0) {
+					//$graph_values[$i][$timestamp] = $total * $weight_list[$i];
+					$temp_graph_values[$timestamp_short] = $total * $weight_list[$i];
+				}
+				else {
+					// Compressed data
+					if ($uncompressed_module || ($timestamp > time ())) {
+						$temp_graph_values[$timestamp_short] = 0;
+					}
+					else {
+						$temp_graph_values[$timestamp_short] = $last_known * $weight_list[$i];
+					}
+				}
+				
+				//Extract max, min, avg
+				if ($max < $temp_graph_values[$timestamp_short]) {
+					$max = $temp_graph_values[$timestamp_short];
+				}
+				
+				if (isset($min)) {
+					if ($min > $temp_graph_values[$timestamp_short]) {
+						$min = $temp_graph_values[$timestamp_short];
+					}
+				}
+				else {
 					$min = $temp_graph_values[$timestamp_short];
 				}
+				$avg += $temp_graph_values[$timestamp_short];
+				
+				// Added to support projection graphs
+				if ($projection != false and $i != 0) {
+					$projection_data = array();
+					$projection_data = array_merge($before_projection, $projection); 
+					$graph_values[$i] = $projection_data;
+				}
+				else {
+					$graph_values[$i] = $temp_graph_values; 
+				}
+			}
+			
+			//Add the max, min and avg in the legend
+			$avg = round($avg / $countAvg, 1);
+			
+			$graph_stats = get_graph_statistics($graph_values[$i]);
+			
+			if (!isset($config["short_module_graph_data"]))
+				$config["short_module_graph_data"] = true;
+			
+			if ($config["short_module_graph_data"]) {
+				$min = $graph_stats['min'];
+				$max = $graph_stats['max'];
+				$avg = $graph_stats['avg'];
+				$last = $graph_stats['last'];
+				
+				if ($min > 1000000)
+					$min = sprintf("%sM", remove_right_zeros(number_format($min / 1000000, remove_right_zeros)));
+				else if ($min > 1000)
+					$min = sprintf("%sK", remove_right_zeros(number_format($min / 1000, $config['graph_precision'])));
+				
+				if ($max > 1000000)
+					$max = sprintf("%sM", remove_right_zeros(number_format($max / 1000000, $config['graph_precision'])));
+				else if ($max > 1000)
+					$max = sprintf("%sK", remove_right_zeros(number_format($max / 1000, $config['graph_precision'])));
+				
+				if ($avg > 1000000)
+					$avg = sprintf("%sM", remove_right_zeros(number_format($avg / 1000000, $config['graph_precision'])));
+				else if ($avg > 1000)
+					$avg = sprintf("%sK", remove_right_zeros(number_format($avg / 1000, $config['graph_precision'])));
+				
+				if ($last > 1000000)
+					$last = sprintf("%sM", remove_right_zeros(number_format($last / 1000000, $config['graph_precision'])));
+				else if ($last > 1000)
+					$last = sprintf("%sK", remove_right_zeros(number_format($last / 1000, $config['graph_precision'])));
 			}
 			else {
-				$min = $temp_graph_values[$timestamp_short];
+				$min = remove_right_zeros(number_format($graph_stats['min'], $config['graph_precision']));
+				$max = remove_right_zeros(number_format($graph_stats['max'], $config['graph_precision']));
+				$avg = remove_right_zeros(number_format($graph_stats['avg'], $config['graph_precision']));
+				$last = remove_right_zeros(number_format($graph_stats['last'], $config['graph_precision']));
 			}
-			$avg += $temp_graph_values[$timestamp_short];
 			
-			// Added to support projection graphs
-			if ($projection != false and $i != 0) {
-				$projection_data = array();
-				$projection_data = array_merge($before_projection, $projection); 
-				$graph_values[$i] = $projection_data;
+			
+			if (!empty($unit_list) && $units_number == $module_number && isset($unit_list[$i])) {
+				$unit = $unit_list[$i];
 			}
-			else {
-				$graph_values[$i] = $temp_graph_values; 
+			
+			if ($projection == false or ($projection != false and $i == 0)) {
+				$module_name_list[$i] .= ": ";
+				if ($show_max)
+					$module_name_list[$i] .= __("Max") . ": $max $unit; ";
+				if ($show_min)
+					$module_name_list[$i] .= __("Min") . ": $min $unit; ";
+				if ($show_avg)
+					$module_name_list[$i] .= __("Avg") . ": $avg $unit";
+			}
+			
+			if ($weight_list[$i] != 1) {
+				//$module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")";
+				$module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")";
+			}
+			
+			//$graph_values[$module_name_list[$i]] = $graph_values[$i];
+			//unset($graph_values[$i]);
+			
+			//$graph_values[$i] = $graph_values[$i];
+			
+			if ($config['metaconsole']) {
+				// Automatic custom graph from the report template in metaconsole
+				if (is_array($module_list[0])) {
+					metaconsole_restore_db();
+				}
 			}
 		}
 		
-		//Add the max, min and avg in the legend
-		$avg = round($avg / $countAvg, 1);
+		$temp = array();
 		
-		$graph_stats = get_graph_statistics($graph_values[$i]);
+		if ($flash_charts === false && $stacked == CUSTOM_GRAPH_GAUGE) 
+			$stacked = CUSTOM_GRAPH_BULLET_CHART;
 		
-		if (!isset($config["short_module_graph_data"]))
-			$config["short_module_graph_data"] = true;
-		
-		if ($config["short_module_graph_data"]) {
-			$min = $graph_stats['min'];
-			$max = $graph_stats['max'];
-			$avg = $graph_stats['avg'];
-			$last = $graph_stats['last'];
-			
-			if ($min > 1000000)
-				$min = sprintf("%sM", remove_right_zeros(number_format($min / 1000000, remove_right_zeros)));
-			else if ($min > 1000)
-				$min = sprintf("%sK", remove_right_zeros(number_format($min / 1000, $config['graph_precision'])));
-			
-			if ($max > 1000000)
-				$max = sprintf("%sM", remove_right_zeros(number_format($max / 1000000, $config['graph_precision'])));
-			else if ($max > 1000)
-				$max = sprintf("%sK", remove_right_zeros(number_format($max / 1000, $config['graph_precision'])));
-			
-			if ($avg > 1000000)
-				$avg = sprintf("%sM", remove_right_zeros(number_format($avg / 1000000, $config['graph_precision'])));
-			else if ($avg > 1000)
-				$avg = sprintf("%sK", remove_right_zeros(number_format($avg / 1000, $config['graph_precision'])));
-			
-			if ($last > 1000000)
-				$last = sprintf("%sM", remove_right_zeros(number_format($last / 1000000, $config['graph_precision'])));
-			else if ($last > 1000)
-				$last = sprintf("%sK", remove_right_zeros(number_format($last / 1000, $config['graph_precision'])));
-		}
-		else {
-			$min = remove_right_zeros(number_format($graph_stats['min'], $config['graph_precision']));
-			$max = remove_right_zeros(number_format($graph_stats['max'], $config['graph_precision']));
-			$avg = remove_right_zeros(number_format($graph_stats['avg'], $config['graph_precision']));
-			$last = remove_right_zeros(number_format($graph_stats['last'], $config['graph_precision']));
-		}
-		
-		
-		if (!empty($unit_list) && $units_number == $module_number && isset($unit_list[$i])) {
-			$unit = $unit_list[$i];
-		}
-		
-		if ($projection == false or ($projection != false and $i == 0)) {
-			$module_name_list[$i] .= ": ";
-			if ($show_max)
-				$module_name_list[$i] .= __("Max") . ": $max $unit; ";
-			if ($show_min)
-				$module_name_list[$i] .= __("Min") . ": $min $unit; ";
-			if ($show_avg)
-				$module_name_list[$i] .= __("Avg") . ": $avg $unit";
-		}
-		
-		if ($weight_list[$i] != 1) {
-			//$module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")";
-			$module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")";
-		}
-		
-		//$graph_values[$module_name_list[$i]] = $graph_values[$i];
-		//unset($graph_values[$i]);
-		
-		//$graph_values[$i] = $graph_values[$i];
-		
-		if ($config['metaconsole']) {
-			// Automatic custom graph from the report template in metaconsole
-			if (is_array($module_list[0])) {
-				metaconsole_restore_db();
-			}
-		}
-	}
-	
-	$temp = array();
-	
-	if ($flash_charts === false && $stacked == CUSTOM_GRAPH_GAUGE) 
-		$stacked = CUSTOM_GRAPH_BULLET_CHART;
-	
-	switch ($stacked) {
-		case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
-		case CUSTOM_GRAPH_BULLET_CHART:
-			$datelimit = $date - $period;
-			if($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
-				$acumulador = 0;
+		switch ($stacked) {
+			case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
+			case CUSTOM_GRAPH_BULLET_CHART:
+				$datelimit = $date - $period;
+				if($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
+					$acumulador = 0;
+					foreach ($module_list as $module_item) {
+						$module = $module_item;
+						$query_last_value = sprintf('
+							SELECT datos
+							FROM tagente_datos
+							WHERE id_agente_modulo = %d
+								AND utimestamp < %d
+								ORDER BY utimestamp DESC',
+							$module, $date);
+						$temp_data = db_get_value_sql($query_last_value);
+						if ($acumulador < $temp_data){
+							$acumulador = $temp_data;
+						}
+					}
+				}
 				foreach ($module_list as $module_item) {
-					$module = $module_item;
+					$automatic_custom_graph_meta = false;
+					if ($config['metaconsole']) {
+						// Automatic custom graph from the report template in metaconsole
+						if (is_array($module_list[$i])) {
+							$server = metaconsole_get_connection_by_id ($module_item['server']);
+							metaconsole_connect($server);
+							$automatic_custom_graph_meta = true;
+						}
+					}
+					
+					if ($automatic_custom_graph_meta)
+						$module = $module_item['module'];
+					else
+						$module = $module_item;
+					
+					$search_in_history_db = db_search_in_history_db($datelimit);
+					
+					$temp[$module] = modules_get_agentmodule($module);
 					$query_last_value = sprintf('
 						SELECT datos
 						FROM tagente_datos
@@ -1572,295 +1583,300 @@ function graphic_combined_module ($module_list, $weight_list, $period,
 							ORDER BY utimestamp DESC',
 						$module, $date);
 					$temp_data = db_get_value_sql($query_last_value);
-					if ($acumulador < $temp_data){
-						$acumulador = $temp_data;
+									
+					if ($temp_data) {
+						if (is_numeric($temp_data))
+							$value = $temp_data;
+						else
+							$value = count($value);
 					}
-				}
-			}
-			foreach ($module_list as $module_item) {
-				$automatic_custom_graph_meta = false;
-				if ($config['metaconsole']) {
-					// Automatic custom graph from the report template in metaconsole
-					if (is_array($module_list[$i])) {
-						$server = metaconsole_get_connection_by_id ($module_item['server']);
-						metaconsole_connect($server);
-						$automatic_custom_graph_meta = true;
+					else {
+						if ($flash_charts === false)
+							$value = 0;
+						else
+							$value = false;
 					}
-				}
-				
-				if ($automatic_custom_graph_meta)
-					$module = $module_item['module'];
-				else
-					$module = $module_item;
-				
-				$search_in_history_db = db_search_in_history_db($datelimit);
-				
-				$temp[$module] = modules_get_agentmodule($module);
-				$query_last_value = sprintf('
-					SELECT datos
-					FROM tagente_datos
-					WHERE id_agente_modulo = %d
-						AND utimestamp < %d
-						ORDER BY utimestamp DESC',
-					$module, $date);
-				$temp_data = db_get_value_sql($query_last_value);
-								
-				if ($temp_data) {
-					if (is_numeric($temp_data))
-						$value = $temp_data;
-					else
-						$value = count($value);
-				}
-				else {
-					if ($flash_charts === false)
-						$value = 0;
-					else
-						$value = false;
-				}
-				
-				if ( !empty($labels) && isset($labels[$module]) ){
-                    $label = io_safe_input($labels[$module]);
-                }else{
-					$alias = db_get_value ("alias","tagente","id_agente",$temp[$module]['id_agente']);
-                    $label = $alias . ': ' . $temp[$module]['nombre'];
-                }
 					
-				
-				$temp[$module]['label'] = $label;
-				$temp[$module]['value'] = $value;
-				$temp_max = reporting_get_agentmodule_data_max($module,$period,$date);
-				if ($temp_max < 0)
-					$temp_max = 0;
-				if (isset($acumulador)){
-					$temp[$module]['max'] = $acumulador;
-				}else{
-					$temp[$module]['max'] = ($temp_max === false) ? 0 : $temp_max;
-				}
+					if ( !empty($labels) && isset($labels[$module]) ){
+	                    $label = io_safe_input($labels[$module]);
+	                }else{
+						$alias = db_get_value ("alias","tagente","id_agente",$temp[$module]['id_agente']);
+	                    $label = $alias . ': ' . $temp[$module]['nombre'];
+	                }
+						
+					
+					$temp[$module]['label'] = $label;
+					$temp[$module]['value'] = $value;
+					$temp_max = reporting_get_agentmodule_data_max($module,$period,$date);
+					if ($temp_max < 0)
+						$temp_max = 0;
+					if (isset($acumulador)){
+						$temp[$module]['max'] = $acumulador;
+					}else{
+						$temp[$module]['max'] = ($temp_max === false) ? 0 : $temp_max;
+					}
 
-				$temp_min = reporting_get_agentmodule_data_min($module,$period,$date);
-				if ($temp_min < 0)
-					$temp_min = 0;
-				$temp[$module]['min'] = ($temp_min === false) ? 0 : $temp_min;
-				
-				if ($config['metaconsole']) {
-					// Automatic custom graph from the report template in metaconsole
-					if (is_array($module_list[0])) {
-						metaconsole_restore_db();
-					}
-				}
-				
-			}
-			
-			break;
-		case CUSTOM_GRAPH_HBARS:
-		case CUSTOM_GRAPH_VBARS:
-			$datelimit = $date - $period;
-			
-			$label = '';
-			foreach ($module_list as $module_item) {
-				$automatic_custom_graph_meta = false;
-				if ($config['metaconsole']) {
-					// Automatic custom graph from the report template in metaconsole
-					if (is_array($module_list[$i])) {
-						$server = metaconsole_get_connection_by_id ($module_item['server']);
-						metaconsole_connect($server);
-						$automatic_custom_graph_meta = true;
-					}
-				}
-				
-				if ($automatic_custom_graph_meta)
-					$module = $module_item['module'];
-				else
-					$module = $module_item;
-				
-				
-				$module_data = modules_get_agentmodule($module);
-				$query_last_value = sprintf('
-					SELECT datos
-					FROM tagente_datos
-					WHERE id_agente_modulo = %d
-						AND utimestamp < %d
-						ORDER BY utimestamp DESC',
-					$module, $date);
-				$temp_data = db_get_value_sql($query_last_value);
-				
-				$agent_name = io_safe_output(
-					modules_get_agentmodule_agent_name ($module));
-				
-				if (!empty($labels) && isset($labels[$module]) ){
-                    $label = $labels[$module];
-                }else {
-					$alias = db_get_value ("alias","tagente","id_agente",$module_data['id_agente']);
-                    $label = $alias . " - " .$module_data['nombre'];
-                }
+					$temp_min = reporting_get_agentmodule_data_min($module,$period,$date);
+					if ($temp_min < 0)
+						$temp_min = 0;
+					$temp[$module]['min'] = ($temp_min === false) ? 0 : $temp_min;
 					
-				$temp[$label]['g'] = round($temp_data,4);
-				
-				
-				if ($config['metaconsole']) {
-					// Automatic custom graph from the report template in metaconsole
-					if (is_array($module_list[0])) {
-						metaconsole_restore_db();
-					}
-				}
-				
-			}
-			break;
-		case CUSTOM_GRAPH_PIE:
-			$datelimit = $date - $period;
-			$total_modules = 0;
-			foreach ($module_list as $module_item) {
-				$automatic_custom_graph_meta = false;
-				if ($config['metaconsole']) {
-					// Automatic custom graph from the report template in metaconsole
-					if (is_array($module_list[$i])) {
-						$server = metaconsole_get_connection_by_id ($module_item['server']);
-						metaconsole_connect($server);
-						$automatic_custom_graph_meta = true;
-					}
-				}
-				
-				if ($automatic_custom_graph_meta)
-					$module = $module_item['module'];
-				else
-					$module = $module_item;
-				
-				$data_module = modules_get_agentmodule($module);
-				$query_last_value = sprintf('
-					SELECT datos
-					FROM tagente_datos
-					WHERE id_agente_modulo = %d
-						AND utimestamp > %d
-						AND utimestamp < %d
-						ORDER BY utimestamp DESC',
-					$module, $datelimit, $date);
-				$temp_data = db_get_value_sql($query_last_value);
-				
-				if ( $temp_data ){
-					if (is_numeric($temp_data))
-						$value = $temp_data;
-					else
-						$value = count($value);
-				}
-				else {
-					$value = false;
-				}
-				$total_modules += $value;
-
-				if ( !empty($labels) && isset($labels[$module]) ){
-					$label = io_safe_output($labels[$module]);
-				}else {
-					$alias = db_get_value ("alias","tagente","id_agente",$data_module['id_agente']);
-					$label = io_safe_output($alias . ": " . $data_module['nombre']);
-				}
-				
-				$temp[$label] = array('value'=>$value,
-										'unit'=>$data_module['unit']);
-				if ($config['metaconsole']) {
-					// Automatic custom graph from the report template in metaconsole
-					if (is_array($module_list[0])) {
-						metaconsole_restore_db();
-					}
-				}
-			}
-			$temp['total_modules'] = $total_modules;
-			
-			break;
-		case CUSTOM_GRAPH_GAUGE:
-			$datelimit = $date - $period;
-			$i = 0;
-			foreach ($module_list as $module_item) {
-				$automatic_custom_graph_meta = false;
-				if ($config['metaconsole']) {
-					// Automatic custom graph from the report template in metaconsole
-					if (is_array($module_list[$i])) {
-						$server = metaconsole_get_connection_by_id ($module_item['server']);
-						metaconsole_connect($server);
-						$automatic_custom_graph_meta = true;
-					}
-				}
-				
-				if ($automatic_custom_graph_meta)
-					$module = $module_item['module'];
-				else
-					$module = $module_item;
-				
-				$temp[$module] = modules_get_agentmodule($module);
-				$query_last_value = sprintf('
-					SELECT datos
-					FROM tagente_datos
-					WHERE id_agente_modulo = %d
-						AND utimestamp < %d
-						ORDER BY utimestamp DESC',
-					$module, $date);
-				$temp_data = db_get_value_sql($query_last_value);
-				if ( $temp_data ) {
-					if (is_numeric($temp_data))
-						$value = $temp_data;
-					else
-						$value = count($value);
-				}
-				else {
-					$value = false;
-				}
-				$temp[$module]['label'] = ($labels[$module] != '') ? $labels[$module] : $temp[$module]['nombre'];
-				
-				$temp[$module]['value'] = $value;
-				$temp[$module]['label'] = ui_print_truncate_text($temp[$module]['label'],"module_small",false,true,false,"..");
-				
-				if ($temp[$module]['unit'] == '%') {
-					$temp[$module]['min'] =	0;
-					$temp[$module]['max'] = 100;
-				}
-				else {
-					$min = $temp[$module]['min'];
-					if ($temp[$module]['max'] == 0)
-						$max = reporting_get_agentmodule_data_max($module,$period,$date);
-					else
-						$max = $temp[$module]['max'];
-					$temp[$module]['min'] = ($min == 0 ) ? 0 : $min;
-					$temp[$module]['max'] = ($max == 0 ) ? 100 : $max;
-				}
-				$temp[$module]['gauge'] = uniqid('gauge_');
-				
-				if ($config['metaconsole']) {
-					// Automatic custom graph from the report template in metaconsole
-					if (is_array($module_list[0])) {
-						metaconsole_restore_db();
-					}
-				}
-				$i++;
-			}
-			break;
-		default:
-			if (!is_null($percentil) && $percentil) {
-				foreach ($graph_values as $graph_group => $point) {
-					foreach ($point as $timestamp_point => $point_value) {
-						$temp[$timestamp_point][$graph_group] = $point_value;
+					if ($config['metaconsole']) {
+						// Automatic custom graph from the report template in metaconsole
+						if (is_array($module_list[0])) {
+							metaconsole_restore_db();
+						}
 					}
 					
-					$percentile_value = get_percentile($config['percentil'], $point);
-					$percentil_result[$graph_group] = array_fill ( 0, count($point), $percentile_value);
-					$series_type[$graph_group] = 'line';
+				}
+				
+				break;
+			case CUSTOM_GRAPH_HBARS:
+			case CUSTOM_GRAPH_VBARS:
+				$datelimit = $date - $period;
+				
+				$label = '';
+				foreach ($module_list as $module_item) {
+					$automatic_custom_graph_meta = false;
+					if ($config['metaconsole']) {
+						// Automatic custom graph from the report template in metaconsole
+						if (is_array($module_list[$i])) {
+							$server = metaconsole_get_connection_by_id ($module_item['server']);
+							metaconsole_connect($server);
+							$automatic_custom_graph_meta = true;
+						}
+					}
+					
+					if ($automatic_custom_graph_meta)
+						$module = $module_item['module'];
+					else
+						$module = $module_item;
+					
+					
+					$module_data = modules_get_agentmodule($module);
+					$query_last_value = sprintf('
+						SELECT datos
+						FROM tagente_datos
+						WHERE id_agente_modulo = %d
+							AND utimestamp < %d
+							ORDER BY utimestamp DESC',
+						$module, $date);
+					$temp_data = db_get_value_sql($query_last_value);
+					
 					$agent_name = io_safe_output(
-						modules_get_agentmodule_agent_alias ($module_list[$graph_group]));
-					$module_name = io_safe_output(
-						modules_get_agentmodule_name ($module_list[$graph_group]));
-					$module_name_list['percentil'.$graph_group] = __('Percentile %dº', $config['percentil']) . __(' of module ') . $agent_name .' / ' . $module_name . ' (' . $percentile_value . ' ' . $unit . ') ';
+						modules_get_agentmodule_agent_name ($module));
+					
+					if (!empty($labels) && isset($labels[$module]) ){
+	                    $label = $labels[$module];
+	                }else {
+						$alias = db_get_value ("alias","tagente","id_agente",$module_data['id_agente']);
+	                    $label = $alias . " - " .$module_data['nombre'];
+	                }
+						
+					$temp[$label]['g'] = round($temp_data,4);
+					
+					
+					if ($config['metaconsole']) {
+						// Automatic custom graph from the report template in metaconsole
+						if (is_array($module_list[0])) {
+							metaconsole_restore_db();
+						}
+					}
+					
 				}
-			}
-			else {
-				foreach ($graph_values as $graph_group => $point) {
-					foreach ($point as $timestamp_point => $point_value) {
-						$temp[$timestamp_point][$graph_group] = $point_value;
+				break;
+			case CUSTOM_GRAPH_PIE:
+				$datelimit = $date - $period;
+				$total_modules = 0;
+				foreach ($module_list as $module_item) {
+					$automatic_custom_graph_meta = false;
+					if ($config['metaconsole']) {
+						// Automatic custom graph from the report template in metaconsole
+						if (is_array($module_list[$i])) {
+							$server = metaconsole_get_connection_by_id ($module_item['server']);
+							metaconsole_connect($server);
+							$automatic_custom_graph_meta = true;
+						}
+					}
+					
+					if ($automatic_custom_graph_meta)
+						$module = $module_item['module'];
+					else
+						$module = $module_item;
+					
+					$data_module = modules_get_agentmodule($module);
+					$query_last_value = sprintf('
+						SELECT datos
+						FROM tagente_datos
+						WHERE id_agente_modulo = %d
+							AND utimestamp > %d
+							AND utimestamp < %d
+							ORDER BY utimestamp DESC',
+						$module, $datelimit, $date);
+					$temp_data = db_get_value_sql($query_last_value);
+					
+					if ( $temp_data ){
+						if (is_numeric($temp_data))
+							$value = $temp_data;
+						else
+							$value = count($value);
+					}
+					else {
+						$value = false;
+					}
+					$total_modules += $value;
+
+					if ( !empty($labels) && isset($labels[$module]) ){
+						$label = io_safe_output($labels[$module]);
+					}else {
+						$alias = db_get_value ("alias","tagente","id_agente",$data_module['id_agente']);
+						$label = io_safe_output($alias . ": " . $data_module['nombre']);
+					}
+					
+					$temp[$label] = array('value'=>$value,
+											'unit'=>$data_module['unit']);
+					if ($config['metaconsole']) {
+						// Automatic custom graph from the report template in metaconsole
+						if (is_array($module_list[0])) {
+							metaconsole_restore_db();
+						}
 					}
 				}
+				$temp['total_modules'] = $total_modules;
+				
+				break;
+			case CUSTOM_GRAPH_GAUGE:
+				$datelimit = $date - $period;
+				$i = 0;
+				foreach ($module_list as $module_item) {
+					$automatic_custom_graph_meta = false;
+					if ($config['metaconsole']) {
+						// Automatic custom graph from the report template in metaconsole
+						if (is_array($module_list[$i])) {
+							$server = metaconsole_get_connection_by_id ($module_item['server']);
+							metaconsole_connect($server);
+							$automatic_custom_graph_meta = true;
+						}
+					}
+					
+					if ($automatic_custom_graph_meta)
+						$module = $module_item['module'];
+					else
+						$module = $module_item;
+					
+					$temp[$module] = modules_get_agentmodule($module);
+					$query_last_value = sprintf('
+						SELECT datos
+						FROM tagente_datos
+						WHERE id_agente_modulo = %d
+							AND utimestamp < %d
+							ORDER BY utimestamp DESC',
+						$module, $date);
+					$temp_data = db_get_value_sql($query_last_value);
+					if ( $temp_data ) {
+						if (is_numeric($temp_data))
+							$value = $temp_data;
+						else
+							$value = count($value);
+					}
+					else {
+						$value = false;
+					}
+					$temp[$module]['label'] = ($labels[$module] != '') ? $labels[$module] : $temp[$module]['nombre'];
+					
+					$temp[$module]['value'] = $value;
+					$temp[$module]['label'] = ui_print_truncate_text($temp[$module]['label'],"module_small",false,true,false,"..");
+					
+					if ($temp[$module]['unit'] == '%') {
+						$temp[$module]['min'] =	0;
+						$temp[$module]['max'] = 100;
+					}
+					else {
+						$min = $temp[$module]['min'];
+						if ($temp[$module]['max'] == 0)
+							$max = reporting_get_agentmodule_data_max($module,$period,$date);
+						else
+							$max = $temp[$module]['max'];
+						$temp[$module]['min'] = ($min == 0 ) ? 0 : $min;
+						$temp[$module]['max'] = ($max == 0 ) ? 100 : $max;
+					}
+					$temp[$module]['gauge'] = uniqid('gauge_');
+					
+					if ($config['metaconsole']) {
+						// Automatic custom graph from the report template in metaconsole
+						if (is_array($module_list[0])) {
+							metaconsole_restore_db();
+						}
+					}
+					$i++;
+				}
+				break;
+			default:
+				if (!is_null($percentil) && $percentil) {
+					foreach ($graph_values as $graph_group => $point) {
+						foreach ($point as $timestamp_point => $point_value) {
+							$temp[$timestamp_point][$graph_group] = $point_value;
+						}
+						
+						$percentile_value = get_percentile($config['percentil'], $point);
+						$percentil_result[$graph_group] = array_fill ( 0, count($point), $percentile_value);
+						$series_type[$graph_group] = 'line';
+						$agent_name = io_safe_output(
+							modules_get_agentmodule_agent_alias ($module_list[$graph_group]));
+						$module_name = io_safe_output(
+							modules_get_agentmodule_name ($module_list[$graph_group]));
+						$module_name_list['percentil'.$graph_group] = __('Percentile %dº', $config['percentil']) . __(' of module ') . $agent_name .' / ' . $module_name . ' (' . $percentile_value . ' ' . $unit . ') ';
+					}
+				}
+				else {
+					foreach ($graph_values as $graph_group => $point) {
+						foreach ($point as $timestamp_point => $point_value) {
+							$temp[$timestamp_point][$graph_group] = $point_value;
+						}
+					}
+				}
+				break;
+		}
+	}
+	else{
+		$flash_charts = true;
+		if($ttl>1 || !$config['flash_charts']){
+			$flash_charts = false;
+		}
+
+		$temp = fullscale_data_combined($module_list, $period, $date, $flash_charts);
+
+		$resolution = count($temp); //Number of points of the graph
+		$interval = (int) ($period / $resolution);
+		$module_name_list = array();
+		
+		if($ttl>1 || !$config['flash_charts']){
+			$temp2 = array();
+			foreach ($temp as $key => $value) {
+				$real_date = date("Y/M/d", $key);
+				$real_date .= "\n";
+				$real_date .= date("   H:i:s", $key);
+				$temp2[$real_date] = $value;
 			}
-			break;
+			$temp = $temp2;
+		}
+
+		foreach ($module_list as $key => $value) {
+			$agent_name  = io_safe_output( modules_get_agentmodule_agent_name ($value) );
+			$alias       = db_get_value ("alias","tagente","nombre",$agent_name);
+			$module_name = io_safe_output( modules_get_agentmodule_name ($value) );
+			
+			if ($flash_charts){
+				$module_name_list[$key] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $alias . " / " . $module_name. '</span>';
+			}
+			else{
+				$module_name_list[$key] = $alias . " / " . $module_name;
+			}
+		}
 	}
 	
 	$graph_values = $temp;
-	
+
 	if($config["fixed_graph"] == false){
 		$water_mark = array(
 			'file' => $config['homedir'] .  "/images/logo_vertical_water.png",
@@ -2108,6 +2124,47 @@ function graphic_combined_module ($module_list, $weight_list, $period,
 	}
 }
 
+function fullscale_data_combined($module_list, $period, $date, $flash_charts){
+
+	// Set variables
+	if ($date == 0){
+		$date = get_system_time();
+	}
+
+	$datelimit = $date - $period;
+
+	foreach ($module_list as $key_module => $value_module) {
+		$data_uncompress = db_uncompress_module_data($value_module, $datelimit, $date);
+		foreach ($data_uncompress as $key_data => $value_data) {
+			foreach ($value_data['data'] as $k => $v) {
+				if($flash_charts) {
+					$real_date = date("Y M d H:i:s", $v['utimestamp']);
+				}
+				else{
+					$real_date = $v['utimestamp'];
+				}
+				$data_all[$real_date][$key_module] = $v['datos'];
+			}
+		}
+	}
+
+	$data_prev = array(); 
+
+	ksort($data_all);
+	foreach ($data_all as $key => $value) {
+		foreach ($module_list as $key_module => $value_module) {
+			if(!isset($value[$key_module])){
+				$data_all[$key][$key_module] = $data_prev[$key_module];
+			}
+			else{
+				$data_prev[$key_module] = $value[$key_module];	
+			}
+		}
+	}
+
+	return $data_all;
+}
+
 /**
  * Print a graph with access data of agents
  * 
@@ -3798,8 +3855,8 @@ function fs_error_image ($width = 300, $height = 110) {
 function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
 	$unit_name, $show_alerts, $avg_only = 0,
 	$date = 0, $series_suffix = '', $series_suffix_str = '', $show_unknown = false,
-	$fullscale = false) {
-	
+	$fullscale = false, $flash_chart = true) {
+
 	global $config;
 	global $chart;
 	global $color;
@@ -3855,18 +3912,15 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
 	}
 	
 	if ($fullscale) {
-		// Get module data
-		$data = db_get_all_rows_filter ('tagente_datos',
-			array ('id_agente_modulo' => $agent_module_id,
-				"utimestamp > $datelimit",
-				"utimestamp < $date",
-				'order' => 'utimestamp ASC'),
-			array ('datos', 'utimestamp'), 'AND', true);
-
-		if (count($data) > $resolution) {
-			$resolution = count($data); //Number of points of the graph
+		fullscale_data( $chart, $chart_data_extra, $long_index, $series_type,
+						$agent_module_id, $datelimit, $date, $events, 
+						$show_events, $show_unknown, $show_alerts, 
+						$series_suffix, $percentil, $flash_chart);
+		if (count($chart) > $resolution) {
+			$resolution = count($chart); //Number of points of the graph
 			$interval = (int) ($period / $resolution);
 		}
+		$max_value=1;
 	}
 	else {
 		// Get module data
@@ -3876,257 +3930,241 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
 				"utimestamp < $date",
 				'order' => 'utimestamp ASC'),
 			array ('datos', 'utimestamp'), 'AND', $search_in_history_db);
-	}
 	
-	if ($data === false) {
-		$data = array ();
-	}
 	
-	// Uncompressed module data
-	if ($uncompressed_module) {
-		$min_necessary = 1;
-	
-	// Compressed module data
-	}
-	else {
-		// Get previous data
-		$previous_data = modules_get_previous_data ($agent_module_id, $datelimit);
-		if ($previous_data !== false) {
-			$previous_data['utimestamp'] = $datelimit;
-			array_unshift ($data, $previous_data);
+		if ($data === false) {
+			$data = array ();
 		}
 		
-		// Get next data
-		$nextData = modules_get_next_data ($agent_module_id, $date);
-		if ($nextData !== false) {
-			array_push ($data, $nextData);
+		// Uncompressed module data
+		if ($uncompressed_module) {
+			$min_necessary = 1;
+		
+		// Compressed module data
 		}
-		else if (count ($data) > 0) {
-			// Propagate the last known data to the end of the interval
-			$nextData = array_pop ($data);
-			array_push ($data, $nextData);
-			$nextData['utimestamp'] = $date;
-			array_push ($data, $nextData);
+		else {
+			// Get previous data
+			$previous_data = modules_get_previous_data ($agent_module_id, $datelimit);
+			if ($previous_data !== false) {
+				$previous_data['utimestamp'] = $datelimit;
+				array_unshift ($data, $previous_data);
+			}
+			
+			// Get next data
+			$nextData = modules_get_next_data ($agent_module_id, $date);
+			if ($nextData !== false) {
+				array_push ($data, $nextData);
+			}
+			else if (count ($data) > 0) {
+				// Propagate the last known data to the end of the interval
+				$nextData = array_pop ($data);
+				array_push ($data, $nextData);
+				$nextData['utimestamp'] = $date;
+				array_push ($data, $nextData);
+			}
+			
+			$min_necessary = 2;
 		}
 		
-		$min_necessary = 2;
-	}
-	
-	// Check available data
-	if (count ($data) < $min_necessary) {
-		if (!$graphic_type) {
-			return fs_error_image ();
+		// Check available data
+		if (count ($data) < $min_necessary) {
+			if (!$graphic_type) {
+				return fs_error_image ();
+			}
+			graphic_error ();
+		}
+		
+		
+		
+		// Data iterator
+		$j = 0;
+		
+		// Event iterator
+		$k = 0;
+		
+		// Set initial conditions
+		if ($data[0]['utimestamp'] == $datelimit) {
+			$previous_data = $data[0]['datos'];
+			$j++;
+		}
+		else {
+			$previous_data = 0;
+		}
+		
+		$max_value = 0;
+		
+		// Calculate chart data
+		$last_known = $previous_data;
+		for ($i = 0; $i <= $resolution; $i++) {
+			$timestamp = $datelimit + ($interval * $i);
+
+			/*
+			if ($fullscale && ($resolution > ($config['graph_res'] * 50))) {
+				$timestamp = $data[$i]['utimestamp'];
+			}
+			*/
+			$zero = 0;
+			$total = 0;
+			$count = 0;
+			$is_unknown = false;
+			// Read data that falls in the current interval
+			while (isset ($data[$j]) &&
+				$data[$j]['utimestamp'] >= $timestamp &&
+				$data[$j]['utimestamp'] <= ($timestamp + $interval)) {
+				if ($data[$j]['datos'] == 0) {
+					$zero = 1;
+				}
+				else {
+					$total += $data[$j]['datos'];
+					$count++;
+				}
+				
+				$last_known = $data[$j]['datos'];
+
+				if ($show_unknown && $data[$j]['unknown']){
+					$is_unknown = true;
+				}
+				$j++;
+			}
+			
+			// Average
+			if ($count > 0) {
+				$total /= $count;
+			}
+			
+			// Read events and alerts that fall in the current interval
+			$event_value = 0;
+			$alert_value = 0;
+			$unknown_value = 0;
+			
+			// Is the first point of a unknown interval
+			$first_unknown = false;
+			
+			$event_ids = array();
+			$alert_ids = array();
+			while (isset ($events[$k]) &&
+				$events[$k]['utimestamp'] >= $timestamp &&
+				$events[$k]['utimestamp'] < ($timestamp + $interval)) {
+				if ($show_events == 1) {
+					$event_value++;
+					$event_ids[] = $events[$k]['id_evento'];
+				}
+				if ($show_alerts == 1 && substr ($events[$k]['event_type'], 0, 5) == 'alert') {
+					$alert_value++;
+					$alert_ids[] = $events[$k]['id_evento'];
+				}
+				if ($show_unknown) {
+					if ($events[$k]['event_type'] == 'going_unknown') {
+						if ($is_unknown == false) {
+							$first_unknown = true;
+						}
+						$is_unknown = true;
+					}
+					else if (substr ($events[$k]['event_type'], 0, 5) == 'going') {
+						$is_unknown = false;
+					}
+				}
+				$k++;
+			}
+
+			// In some cases, can be marked as known because a recovery event
+			// was found in same interval. For this cases first_unknown is 
+			// checked too
+			if ($is_unknown || $first_unknown) {
+				$unknown_value++;
+			}
+			
+			// Set the title and time format
+			if ($period <= SECONDS_6HOURS) {
+				$time_format = 'H:i:s';
+			}
+			elseif ($period < SECONDS_1DAY) {
+				$time_format = 'H:i';
+			}
+			elseif ($period < SECONDS_15DAYS) {
+				$time_format = 'M d H:i';
+			}
+			elseif ($period < SECONDS_1MONTH) {
+				$time_format = 'M d H\h';
+			}
+			else {
+				$time_format = 'M d H\h';
+			}
+			
+			$timestamp_short = date($time_format, $timestamp);
+			$long_index[$timestamp_short] = date(
+				html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp);
+			if (!$fullscale) {
+				$timestamp = $timestamp_short;
+			}
+			/////////////////////////////////////////////////////////////////
+			
+			if ($total > $max_value) {
+				$max_value = $total;
+			}
+			
+			if ($show_events) {
+				if (!isset($chart[$timestamp]['event'.$series_suffix])) {
+					$chart[$timestamp]['event'.$series_suffix] = 0;
+				}
+				
+				$chart[$timestamp]['event'.$series_suffix] += $event_value;
+				$series_type['event'.$series_suffix] = 'points';
+			}
+			if ($show_alerts) {
+				if (!isset($chart[$timestamp]['alert'.$series_suffix])) {
+					$chart[$timestamp]['alert'.$series_suffix] = 0;
+				}
+				
+				$chart[$timestamp]['alert'.$series_suffix] += $alert_value;
+				$series_type['alert'.$series_suffix] = 'points';
+			}
+			
+			// Data and zeroes (draw a step)
+			if ($zero == 1 && $count > 0) {
+				$chart[$timestamp]['sum'.$series_suffix] = 0;
+			}
+			else if ($zero == 1) { // Just zeros
+				$chart[$timestamp]['sum'.$series_suffix] = 0;
+			}
+			else if ($count > 0) { // No zeros
+				$chart[$timestamp]['sum'.$series_suffix] = $total;
+			}
+			else { // Compressed data
+				if ($uncompressed_module || ($timestamp > time ()) || $is_unknown) {
+					$chart[$timestamp]['sum'.$series_suffix] = 0;
+				}
+				else {
+					$chart[$timestamp]['sum'.$series_suffix] = $last_known;
+				}
+			}
+			
+			if ($show_unknown) {
+				if (!isset($chart[$timestamp]['unknown'.$series_suffix])) {
+					$chart[$timestamp]['unknown'.$series_suffix] = 0;
+				}
+				$chart[$timestamp]['unknown'.$series_suffix] = $unknown_value;
+				$series_type['unknown'.$series_suffix] = 'area';
+			}
+			
+			$series_type['sum' . $series_suffix] = 'boolean';
+			
+			if (!empty($event_ids)) {
+				$chart_extra_data[count($chart)-1]['events'] = implode(',',$event_ids);
+			}
+			if (!empty($alert_ids)) {
+				$chart_extra_data[count($chart)-1]['alerts'] = implode(',',$alert_ids);
+			}
+			
 		}
-		graphic_error ();
 	}
-	
+
 	if (empty($unit_name)) {
 		$unit = modules_get_unit($agent_module_id);
 	}
 	else
 		$unit = $unit_name;
-	
-	// Data iterator
-	$j = 0;
-	
-	// Event iterator
-	$k = 0;
-	
-	// Set initial conditions
-	if ($data[0]['utimestamp'] == $datelimit) {
-		$previous_data = $data[0]['datos'];
-		$j++;
-	}
-	else {
-		$previous_data = 0;
-	}
-	
-	$max_value = 0;
 
-	if ($fullscale) {
-		$data2 = array();
-		$previus_datas_cont = -1;
-		$k = 0;
-		for ($i = 0; $i <= $resolution; $i++) {
-			$timestamp = $datelimit + ($interval * $i);
-
-			if ($timestamp < $data[0]['utimestamp']) {
-				$previus_datas_cont++;
-				$data2[$k]['utimestamp'] = $timestamp;
-				$data2[$k]['datos'] = 0;
-				$k++;
-			}
-		}
-
-		$data = array_merge($data2, $data);
-		$resolution += $previus_datas_cont;
-	}
-	
-	// Calculate chart data
-	$last_known = $previous_data;
-	for ($i = 0; $i <= $resolution; $i++) {
-		$timestamp = $datelimit + ($interval * $i);
-
-		if ($fullscale && ($resolution > ($config['graph_res'] * 50))) {
-			$timestamp = $data[$i]['utimestamp'];
-		}
-		
-		$zero = 0;
-		$total = 0;
-		$count = 0;
-		
-		// Read data that falls in the current interval
-		while (isset ($data[$j]) &&
-			$data[$j]['utimestamp'] >= $timestamp &&
-			$data[$j]['utimestamp'] <= ($timestamp + $interval)) {
-			if ($data[$j]['datos'] == 0) {
-				$zero = 1;
-			}
-			else {
-				$total += $data[$j]['datos'];
-				$count++;
-			}
-			
-			$last_known = $data[$j]['datos'];
-			$j++;
-		}
-		
-		// Average
-		if ($count > 0) {
-			$total /= $count;
-		}
-		
-		// Read events and alerts that fall in the current interval
-		$event_value = 0;
-		$alert_value = 0;
-		$unknown_value = 0;
-		$is_unknown = false;
-		// Is the first point of a unknown interval
-		$first_unknown = false;
-		
-		$event_ids = array();
-		$alert_ids = array();
-		while (isset ($events[$k]) &&
-			$events[$k]['utimestamp'] >= $timestamp &&
-			$events[$k]['utimestamp'] < ($timestamp + $interval)) {
-			if ($show_events == 1) {
-				$event_value++;
-				$event_ids[] = $events[$k]['id_evento'];
-			}
-			if ($show_alerts == 1 && substr ($events[$k]['event_type'], 0, 5) == 'alert') {
-				$alert_value++;
-				$alert_ids[] = $events[$k]['id_evento'];
-			}
-			if ($show_unknown) {
-				if ($events[$k]['event_type'] == 'going_unknown') {
-					if ($is_unknown == false) {
-						$first_unknown = true;
-					}
-					$is_unknown = true;
-				}
-				else if (substr ($events[$k]['event_type'], 0, 5) == 'going') {
-					$is_unknown = false;
-				}
-			}
-			$k++;
-		}
-		
-		// In some cases, can be marked as known because a recovery event
-		// was found in same interval. For this cases first_unknown is 
-		// checked too
-		if ($is_unknown || $first_unknown) {
-			$unknown_value++;
-		}
-		
-		// Set the title and time format
-		if ($period <= SECONDS_6HOURS) {
-			$time_format = 'H:i:s';
-		}
-		elseif ($period < SECONDS_1DAY) {
-			$time_format = 'H:i';
-		}
-		elseif ($period < SECONDS_15DAYS) {
-			$time_format = 'M d H:i';
-		}
-		elseif ($period < SECONDS_1MONTH) {
-			$time_format = 'M d H\h';
-		}
-		else {
-			$time_format = 'M d H\h';
-		}
-		
-		$timestamp_short = date($time_format, $timestamp);
-		$long_index[$timestamp_short] = date(
-			html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp);
-		if (!$fullscale) {
-			$timestamp = $timestamp_short;
-		}
-		/////////////////////////////////////////////////////////////////
-		
-		if ($total > $max_value) {
-			$max_value = $total;
-		}
-		
-		if ($show_events) {
-			if (!isset($chart[$timestamp]['event'.$series_suffix])) {
-				$chart[$timestamp]['event'.$series_suffix] = 0;
-			}
-			
-			$chart[$timestamp]['event'.$series_suffix] += $event_value;
-			$series_type['event'.$series_suffix] = 'points';
-		}
-		if ($show_alerts) {
-			if (!isset($chart[$timestamp]['alert'.$series_suffix])) {
-				$chart[$timestamp]['alert'.$series_suffix] = 0;
-			}
-			
-			$chart[$timestamp]['alert'.$series_suffix] += $alert_value;
-			$series_type['alert'.$series_suffix] = 'points';
-		}
-		
-		// Data and zeroes (draw a step)
-		if ($zero == 1 && $count > 0) {
-			
-			//New code set 0 if there is a 0
-			//Please check the incident #665
-			//http://192.168.50.2/integria/index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id=665
-			$chart[$timestamp]['sum'.$series_suffix] = 0;
-		}
-		else if ($zero == 1) { // Just zeros
-			$chart[$timestamp]['sum'.$series_suffix] = 0;
-		}
-		else if ($count > 0) { // No zeros
-			$chart[$timestamp]['sum'.$series_suffix] = $total;
-		}
-		else { // Compressed data
-			if ($uncompressed_module || ($timestamp > time ()) || $is_unknown) {
-				$chart[$timestamp]['sum'.$series_suffix] = 0;
-			}
-			else {
-				$chart[$timestamp]['sum'.$series_suffix] = $last_known;
-			}
-		}
-		
-		if ($show_unknown) {
-			if (!isset($chart[$timestamp]['unknown'.$series_suffix])) {
-				$chart[$timestamp]['unknown'.$series_suffix] = 0;
-			}
-			
-			$chart[$timestamp]['unknown'.$series_suffix] = $unknown_value;
-			$series_type['unknown'.$series_suffix] = 'area';
-		}
-		
-		$series_type['sum' . $series_suffix] = 'boolean';
-		
-		if (!empty($event_ids)) {
-			$chart_extra_data[count($chart)-1]['events'] = implode(',',$event_ids);
-		}
-		if (!empty($alert_ids)) {
-			$chart_extra_data[count($chart)-1]['alerts'] = implode(',',$alert_ids);
-		}
-		
-	}
-	
 	// Get min, max and avg (less efficient but centralized for all modules and reports)
 	$graph_stats = get_statwin_graph_statistics($chart, $series_suffix);
 	
@@ -4150,26 +4188,27 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
 	}
 	
 	///////////////////////////////////////////////////
-	// Set the title and time format
-	if ($period <= SECONDS_6HOURS) {
-		$time_format = 'H:i:s';
+	if(!$fullscale){
+		// Set the title and time format
+		if ($period <= SECONDS_6HOURS) {
+			$time_format = 'H:i:s';
+		}
+		elseif ($period < SECONDS_1DAY) {
+			$time_format = 'H:i';
+		}
+		elseif ($period < SECONDS_15DAYS) {
+			$time_format = 'M d H:i';
+		}
+		elseif ($period < SECONDS_1MONTH) {
+			$time_format = 'M d H\h';
+		} 
+		elseif ($period < SECONDS_6MONTHS) {
+			$time_format = "M d H\h";
+		}
+		else {
+			$time_format = 'M d H\h';
+		}
 	}
-	elseif ($period < SECONDS_1DAY) {
-		$time_format = 'H:i';
-	}
-	elseif ($period < SECONDS_15DAYS) {
-		$time_format = 'M d H:i';
-	}
-	elseif ($period < SECONDS_1MONTH) {
-		$time_format = 'M d H\h';
-	} 
-	elseif ($period < SECONDS_6MONTHS) {
-		$time_format = "M d H\h";
-	}
-	else {
-		$time_format = 'M d H\h';
-	}
-	
 	// Flash chart
 	$caption = __('Max. Value').$series_suffix_str . ': ' . $graph_stats['sum']['max'] . '    ' . __('Avg. Value').$series_suffix_str . 
 	': ' . $graph_stats['sum']['avg'] . '    ' . __('Min. Value').$series_suffix_str . ': ' . $graph_stats['sum']['min'] . '   ' . __('Units').$series_suffix_str . ': ' . $unit;
@@ -4218,6 +4257,179 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
 	}
 }
 
+function fullscale_data ( &$chart_data, &$chart_extra_data, &$long_index, 
+						  $series_type, $agent_module_id, $datelimit, $date, 
+						  $events = false, $show_events = false, 
+						  $show_unknown = false, $show_alerts = false, 
+						  $series_suffix = '', $percentil = false, 
+						  $flash_chart = true ){
+
+	global $config;
+	global $max_value;
+	global $min_value;
+	global $series_type;
+	global $chart_extra_data;
+	
+	$ranges_unknown = db_get_module_ranges_unknown($agent_module_id, $datelimit, $date);
+
+	$table = "tagente_datos";
+	$module_type_str = modules_get_type_name ($agent_module_id);
+	if (strstr ($module_type_str, 'string') !== false) {
+		$table = "tagente_datos_string";
+	}
+
+	$query  = " SELECT utimestamp, datos FROM $table ";
+	$query .= " WHERE id_agente_modulo=$agent_module_id ";
+	$query .= " ORDER BY utimestamp ASC LIMIT 1";
+
+	$ret = db_get_all_rows_sql( $query , true);
+	
+	$first_data = $ret[0]['utimestamp'];
+	$data_uncompress = db_uncompress_module_data($agent_module_id, $datelimit, $date);
+	$i         = 0;
+	$max_value = 0;
+	$min_value = 0;
+	$timestamp_second = 0;
+	if(is_array($data_uncompress)){
+		foreach ($data_uncompress as $v) {
+			foreach ($v['data'] as $key => $value) {
+				$real_date = date("Y M d H:i:s", $value['utimestamp']);
+				if(!$flash_chart){
+					$real_date = date("Y/M/d", $value['utimestamp']);
+					$real_date .= "\n";
+					$real_date .= date("   H:i:s", $value['utimestamp']);
+				}
+				// Read events and alerts that fall in the current interval
+				$event_value   = 0;
+				$alert_value   = 0;
+				$unknown_value = 0;
+				$event_i       = 0;
+				// Is the first point of a unknown interval
+				$first_unknown = false;
+				
+				$event_ids = array();
+				$alert_ids = array();
+				
+				//
+				if($timestamp_second == 0){
+					$timestamp_second = $value['utimestamp']; 
+				}
+				$timestamp_first  = $timestamp_second;
+				$timestamp_second = $value['utimestamp'];
+				
+				foreach ($events as $key => $val) {
+					if( $val['utimestamp'] > $timestamp_first && 
+						$val['utimestamp'] <= $timestamp_second ){
+						if ($show_events == 1) {
+							$event_ids[] = $val['id_evento'];
+							$event_value++;
+						}
+						if ($show_alerts == 1 && substr ($val['event_type'], 0, 5) == 'alert') {
+							$alert_ids[] = $val['id_evento'];
+							$alert_value++;
+						}
+						if ($show_unknown) {
+							if ($val['event_type'] == 'going_unknown') {
+								if ($is_unknown == false) {
+									$first_unknown = true;
+								}
+								$is_unknown = true;
+							}
+							else if (substr ($val['event_type'], 0, 5) == 'going') {
+								$is_unknown = false;
+							}
+						}
+					}
+				}
+
+				if(empty($value['datos'])){
+					if($value['utimestamp'] < $first_data){
+						//$chart_data[$real_date]['unknown'.$series_suffix] = 0;
+						$is_unknown = false;
+					}
+					else{
+						//$chart_data[$real_date]['unknown'.$series_suffix] = 1;
+						$first_unknown = true;
+					}
+				}
+
+				$timestamp_short = date("Y M d H:i:s", $value['utimestamp']);
+
+				if(!$flash_chart){
+					$timestamp_short = date("Y/M/d", $value['utimestamp']);
+					$timestamp_short .= "\n";
+					$timestamp_short .= date("   H:i:s", $value['utimestamp']);
+				}
+
+
+				$long_index[$timestamp_short] = date(
+					html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $value['utimestamp']);
+				// In some cases, can be marked as known because a recovery event
+				// was found in same interval. For this cases first_unknown is 
+				// checked too
+				if ($is_unknown || $first_unknown) {
+					$unknown_value++;
+				}
+
+				// Data
+				if ($show_events) {
+					if (!isset($chart_data[$real_date]['event'.$series_suffix])) {
+						$chart_data[$real_date]['event'.$series_suffix] = 0;
+					}
+					
+					$chart_data[$real_date]['event'.$series_suffix] += $event_value;
+					
+					$series_type['event'.$series_suffix] = 'points';
+				}
+
+				if ($show_alerts) {
+					if (!isset($chart_data[$real_date]['alert'.$series_suffix])) {
+						$chart_data[$real_date]['alert'.$series_suffix] = 0;
+					}
+					
+					$chart_data[$real_date]['alert'.$series_suffix] += $alert_value;
+					
+					$series_type['alert'.$series_suffix] = 'points';
+				}
+
+				$chart_data[$real_date]['sum'.$series_suffix] = $value['datos'];
+				
+				if($value['datos'] > $max_value){
+					$max_value = $value['datos'];
+				}
+
+				if($value['datos'] < $min_value){
+					$min_value = $value['datos'];
+				}
+				
+				if ($show_unknown) {
+					if (!isset($chart_data[$real_date]['unknown'.$series_suffix])) {
+						$chart_data[$real_date]['unknown'.$series_suffix] = 0;
+					}	
+					$chart_data[$real_date]['unknown'.$series_suffix] = $unknown_value;
+					$series_type['unknown'.$series_suffix] = 'area';	
+				}
+				
+				if (!empty($event_ids)) {
+					$chart_extra_data[count($chart_data)-1]['events'] = implode(',',$event_ids);
+				}
+				if (!empty($alert_ids)) {
+					$chart_extra_data[count($chart_data)-1]['alerts'] = implode(',',$alert_ids);
+				}
+			}
+		}
+	
+		if (!is_null($percentil) && $percentil) {
+			$avg = array_map(function($item) { return $item['sum']; }, $chart_data);
+			$percentil_result = get_percentile($percentil, $avg);
+			//Fill the data of chart
+			array_walk($chart_data, function(&$item) use ($percentil_result, $series_suffix) {
+				$item['percentil' . $series_suffix] = $percentil_result; });
+			$series_type['percentil' . $series_suffix] = 'line';
+		}
+	}
+}
+
 function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
 	$width, $height , $title='', $unit_name, $show_alerts, $avg_only = 0, $pure=0,
 	$date = 0, $only_image = false, $homeurl = '', $adapt_key = '', $compare = false, 
@@ -4249,7 +4461,7 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
 		// Build the data of the previous period
 		grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
 			$unit_name, $show_alerts, $avg_only, $date-$period, $series_suffix, 
-			$series_suffix_str, $show_unknown, $fullscale);
+			$series_suffix_str, $show_unknown, $fullscale, $flash_chart);
 		switch ($compare) {
 			case 'separated':
 				// Store the chart calculated
@@ -4275,28 +4487,8 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
 	}
 	
 	grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
-		$unit_name, $show_alerts, $avg_only, $date, '', '', $show_unknown, $fullscale);
+		$unit_name, $show_alerts, $avg_only, $date, '', '', $show_unknown, $fullscale, $flash_chart);
 
-	if ($fullscale) {
-		if (!$flash_chart) {
-			$time_format = "Y M \nd H:i:s";
-		}
-		else {
-			$time_format = "Y M d H:i:s";
-		}
-
-		$new_chart = array();
-		$new_long_index = array();
-		foreach ($chart as $c_timestamp => $c_data) {
-			$timestamp_short = date($time_format, $c_timestamp);
-			$new_long_index[$timestamp_short] = date(
-				html_entity_decode($time_format, ENT_QUOTES, "UTF-8"), $c_timestamp);
-			$new_chart[$timestamp_short] = $c_data;
-		}
-
-		$long_index = $new_long_index;
-		$chart = $new_chart;
-	}
 	
 	if ($compare === 'overlapped') {
 		$i = 0;
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index d46ea0759a..8a47d2c7d2 100644
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -98,10 +98,13 @@ function reporting_get_name($id_report) {
 
 function reporting_make_reporting_data($report = null, $id_report,
 	$date, $time, $period = null, $type = 'dinamic',
-	$force_width_chart = null, $force_height_chart = null, $pdf= false) {
+	$force_width_chart = null, $force_height_chart = null, $pdf= false,
+	$from_template = false) {
 	
 	global $config;
 	
+	enterprise_include_once('include/functions_metaconsole.php');
+
 	$return = array();
 	
 	if (!empty($report)) {
@@ -122,21 +125,69 @@ function reporting_make_reporting_data($report = null, $id_report,
 	if (empty($contents)) {
 		return reporting_check_structure_report($report);
 	}
+
+	$metaconsole_on = is_metaconsole();
 	
 	foreach ($contents as $content) {
+		$server_name = $content['server_name'];
+		
 		if (!empty($period)) {
 			$content['period'] = $period;
 		}
 		
 		$content['style'] = json_decode(io_safe_output($content['style']), true);
+
+		$graphs_to_macro = db_get_all_rows_field_filter ("tgraph_source",
+			"id_graph", $content['id_gs']);
+		
+		if ($graphs_to_macro === false)
+			$graphs_to_macro = array();
+
+		$modules_to_macro = 0;
+		$agents_to_macro = array();
+		foreach ($graphs_to_macro as $graph_item) {
+			$modules_to_macro++;
+
+			if (in_array('label', $content['style'])) {
+				if ($content['id_agent'] == 0) {
+					//Metaconsole connection
+					if ($metaconsole_on && $server_name != '') {
+						$connection = metaconsole_get_connection($server_name);
+						if (!metaconsole_load_external_db($connection)) {
+							//ui_print_error_message ("Error connecting to ".$server_name);
+							continue;
+						}
+					}
+					
+					array_push ($agents_to_macro, modules_get_agentmodule_agent($graph_item['id_agent_module']));
+					if ($metaconsole_on) {
+						//Restore db connection
+						metaconsole_restore_db();
+					}
+				}
+			}
+		}
+		
+		$agents_to_macro_aux = array();
+		foreach ($agents_to_macro as $ag) {
+			if (!in_array($ag, $agents_to_macro_aux)) {
+				$agents_to_macro_aux[$ag] = $ag;
+			}
+		}
+		$agents_to_macro = $agents_to_macro_aux;
+
+		if (!empty($report) && $from_template) { 
+			$agents_to_macro = $content['id_agent'];
+		}
+
 		if(isset($content['style']['name_label'])){
 			//Add macros name
 			$items_label = array();
 			$items_label['type'] = $content['type'];
 			$items_label['id_agent'] = $content['id_agent'];
 			$items_label['id_agent_module'] = $content['id_agent_module'];
-			$metaconsole_on = is_metaconsole();
-			$server_name = $content['server_name'];
+			$items_label['modules'] = $modules_to_macro;
+			$items_label['agents'] = $agents_to_macro;
 			
 			//Metaconsole connection
 			if ($metaconsole_on && $server_name != '') {
@@ -147,7 +198,6 @@ 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']);
 			}
@@ -2624,6 +2674,10 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic
 	if (empty($content['name'])) {
 		$content['name'] = __('Network interfaces report');
 	}
+
+	if (isset($content['style']['fullscale'])) {
+		$fullscale = (bool) $content['style']['fullscale'];
+	}
 	
 	$group_name = groups_get_name($content['id_group']);
 	
@@ -2695,7 +2749,13 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic
 								true,
 								true,
 								true,
-								1);
+								1,
+								false,
+								false,
+								null,
+								false,
+								false,
+								$fullscale);
 							}
 						break;
 					case 'data':
@@ -2718,7 +2778,13 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic
 								true,
 								true,
 								true,
-								2);
+								2,
+								false,
+								false,
+								null,
+								false,
+								false,
+								$fullscale);
 							}
 						break;
 				}
@@ -5800,12 +5866,6 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
 	
 	require_once ($config["homedir"] . '/include/functions_graph.php');
 	
-	if ($config['metaconsole'] && $type_report != 'automatic_graph') {
-		$id_meta = metaconsole_get_id_server($content["server_name"]);	
-		$server = metaconsole_get_connection_by_id ($id_meta);
-		metaconsole_connect($server);
-	}
-	
 	$graph = db_get_row ("tgraph", "id_graph", $content['id_gs']);
 	$return = array();
 	$return['type'] = 'custom_graph';
@@ -5844,23 +5904,42 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
 			array_push ($modules, $graph_item['id_agent_module']);
 		}
 		
-		array_push ($weights, $graph_item["weight"]);
 		if (in_array('label',$content['style'])) {
 			if (defined('METACONSOLE')) {
+				$server_name = $content['server_name'];
+				$connection = metaconsole_get_connection($server_name);
+				if (!metaconsole_load_external_db($connection)) {
+					//ui_print_error_message ("Error connecting to ".$server_name);
+					continue;
+				}
 				$item = array('type' => 'custom_graph',
-							'id_agent' =>$content['id_agent'],
-							'id_agent_module'=>$graph_item['id_agent_module']);
+						'id_agent' =>modules_get_agentmodule_agent($graph_item['id_agent_module']),
+						'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_module'=>$graph_item['id_agent_module']);
 			}
 			
+			$label = reporting_label_macro($item, $content['style']['label']);
+
 			$labels[$graph_item['id_agent_module']] = $label;
+			if (defined('METACONSOLE')) {
+				//Restore db connection
+				metaconsole_restore_db();
+			}
 		}
+
+		array_push ($weights, $graph_item["weight"]);
 	}
 	
+	if ($config['metaconsole'] && $type_report != 'automatic_graph') {
+		$id_meta = metaconsole_get_id_server($content["server_name"]);	
+		$server = metaconsole_get_connection_by_id ($id_meta);
+		metaconsole_connect($server);
+	}
+
 	$return['chart'] = '';
 	// Get chart
 	reporting_set_conf_charts($width, $height, $only_image, $type,
@@ -5971,13 +6050,15 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
 	if (isset($content['style']['only_avg'])) {
 		$only_avg = (bool) $content['style']['only_avg'];
 	}
+
+	if (isset($content['style']['fullscale'])) {
+		$fullscale = (bool) $content['style']['fullscale'];
+	}
 	
 	$moduletype_name = modules_get_moduletype_name(
 		modules_get_agentmodule_type(
 			$content['id_agent_module']));
 	
-	
-	
 	$return['chart'] = '';
 	// Get chart
 	reporting_set_conf_charts($width, $height, $only_image, $type,
@@ -6051,7 +6132,8 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
 					($content['style']['percentil'] == 1) ? $config['percentil'] : null,
 					false,
 					false,
-					$config['type_module_charts']);
+					$config['type_module_charts'],
+					$fullscale);
 			}
 			break;
 		case 'data':
@@ -10266,7 +10348,6 @@ function reporting_get_agentmodule_sla_working_timestamp ($period, $date_end, $w
 }
 
 function reporting_label_macro ($item, $label) {
-	
 	switch ($item['type']) {
 		case 'event_report_agent':
 		case 'alert_report_agent':
@@ -10313,32 +10394,65 @@ function reporting_label_macro ($item, $label) {
 		case 'MTTR':
 		case 'automatic_graph':
 			if (preg_match("/_agent_/", $label)) {
-				$agent_name = agents_get_alias($item['id_agent']);
+				if (count($item['agents']) > 1) {
+					$agent_name = count($item['agents']) . __(' agents');
+				}
+				else {
+					$agent_name = agents_get_alias($item['id_agent']);
+				}
+				
 				$label = str_replace("_agent_", $agent_name, $label);
 			}
 			
 			if (preg_match("/_agentdescription_/", $label)) {
-				$agent_name = agents_get_description($item['id_agent']);
+				if (count($item['agents']) > 1) {
+					$agent_name = "";
+				}
+				else {
+					$agent_name = agents_get_description($item['id_agent']);
+				}
 				$label = str_replace("_agentdescription_", $agent_name, $label);
 			}
 			
 			if (preg_match("/_agentgroup_/", $label)) {
-				$agent_name = groups_get_name(agents_get_agent_group($item['id_agent']),true);
+				if (count($item['agents']) > 1) {
+					$agent_name = "";
+				}
+				else {
+					$agent_name = groups_get_name(agents_get_agent_group($item['id_agent']),true);
+				}
 				$label = str_replace("_agentgroup_", $agent_name, $label);
 			}
 			
 			if (preg_match("/_address_/", $label)) {
-				$agent_name = agents_get_address($item['id_agent']);
+				if (count($item['agents']) > 1) {
+					$agent_name = "";
+				}
+				else {
+					$agent_name = agents_get_address($item['id_agent']);
+				}
 				$label = str_replace("_address_", $agent_name, $label);
 			}
 			
 			if (preg_match("/_module_/", $label)) {
-				$module_name = modules_get_agentmodule_name($item['id_agent_module']);
+				if ($item['modules'] > 1) {
+					$module_name = $item['modules'] . __(' modules');
+				}
+				else {
+					$module_name = modules_get_agentmodule_name($item['id_agent_module']);
+				}
+				
 				$label = str_replace("_module_", $module_name, $label);
 			}
 			
 			if (preg_match("/_moduledescription_/", $label)) {
-				$module_description = modules_get_agentmodule_descripcion($item['id_agent_module']);
+				if ($item['modules'] > 1) {
+					$module_description = "";
+				}
+				else {
+					$module_description = modules_get_agentmodule_descripcion($item['id_agent_module']);
+				}
+
 				$label = str_replace("_moduledescription_", $module_description, $label);
 			}
 			break;
diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php
index 22fb6dafac..8d56a42918 100644
--- a/pandora_console/include/functions_reporting_html.php
+++ b/pandora_console/include/functions_reporting_html.php
@@ -3886,15 +3886,16 @@ function reporting_get_event_histogram_meta ($width) {
 	$user_groups_ids = array_keys($user_groups);
 	
 	if (empty($user_groups)) {
-		$groups_condition = ' 1 = 0 ';
+		$groups_condition = ' AND 1 = 0 ';
 	}
 	else {
-		$groups_condition = ' id_grupo IN (' . implode(',', $user_groups_ids) . ') ';
+		$groups_condition = ' AND id_grupo IN (' . implode(',', $user_groups_ids) . ') ';
 	}
 
 	if (!check_acl ($config['id_user'], 0, "PM")) {
 		$groups_condition .= " AND id_grupo != 0";
 	}
+	$status_condition = " AND estado = 0 ";
 	
 	$cont = 0;
 	for ($i = 0; $i < $interval; $i++) {
@@ -3923,49 +3924,45 @@ function reporting_get_event_histogram_meta ($width) {
 		$full_legend[$cont] = $name;
 		
 		$top = $datelimit + ($periodtime * ($i + 1));
-		$event = db_get_row_filter ('tmetaconsole_event',
-			array (
-				'utimestamp > '.$bottom,
-				'utimestamp < '.$top,
-				$groups_condition), 
-				'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;
-			}
+		$time_condition = 'utimestamp > '.$bottom . ' AND utimestamp < '.$top; 
+		$sql = sprintf('SELECT criticity,utimestamp
+			FROM tmetaconsole_event
+			WHERE %s %s %s
+			ORDER BY criticity DESC',
+			$time_condition, $groups_condition, $status_condition);
+		
+		$events = db_get_all_rows_sql($sql);
+		
+		$events_criticity = array();
+		foreach ($events as $key => $value) {
+			array_push($events_criticity,$value['criticity']);
 		}
-		else {
+		
+		if (!empty($events)) {
+			if(array_search('4',$events_criticity) !== false){
+				$data[$cont]['data'] = EVENT_CRIT_CRITICAL;
+			}else if (array_search('3',$events_criticity) !== false){
+				$data[$cont]['data'] = EVENT_CRIT_WARNING;
+			}else if(array_search('6',$events_criticity) !== false){
+				$data[$cont]['data'] = EVENT_CRIT_MAJOR;
+			}else if(array_search('5',$events_criticity) !== false){
+				$data[$cont]['data'] = EVENT_CRIT_MINOR;
+			}else if(array_search('20',$events_criticity) !== false){
+				$data[$cont]['data'] = EVENT_CRIT_NOT_NORMAL;
+			}else if(array_search('34',$events_criticity) !== false){
+				$data[$cont]['data'] = EVENT_CRIT_WARNING_OR_CRITICAL;
+			}else if(array_search('2',$events_criticity) !== false){
+				$data[$cont]['data'] = EVENT_CRIT_NORMAL;
+			}else if(array_search('0',$events_criticity) !== false){
+				$data[$cont]['data'] = EVENT_CRIT_MAINTENANCE;
+			}else {
+				$data[$cont]['data'] = EVENT_CRIT_INFORMATIONAL;
+			}
+			
+			$data[$cont]['utimestamp'] = $periodtime;
+			
+		} else {
 			$data[$cont]['utimestamp'] = $periodtime;
 			$data[$cont]['data'] = 1;
 		}
diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php
index b83abdfa2c..b06a0c6d5c 100755
--- a/pandora_console/include/functions_visual_map.php
+++ b/pandora_console/include/functions_visual_map.php
@@ -1277,7 +1277,7 @@ function visual_map_print_item($mode = "read", $layoutData,
 								
 						if ($width == 0 || $height == 0) {
 							
-						 echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:450px;height:80px;'.$imgpos.'">';
+						 echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:520px;height:80px;'.$imgpos.'">';
 						}
 						else{
 						 echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
@@ -1318,7 +1318,7 @@ function visual_map_print_item($mode = "read", $layoutData,
 						 $stat_agent_un = $agents_unknown[0]['total']/$total_agents*100;
 							
 							if($width == 0 || $height == 0){
-								$dyn_width = 450;			
+								$dyn_width = 520;			
 								$dyn_height = 80;
 							}
 							else{
@@ -1344,14 +1344,14 @@ function visual_map_print_item($mode = "read", $layoutData,
 								echo "</tr>";
 								echo "<tr style='background-color:whitesmoke;height:90%;'>";
 									echo "<td>";
-										echo "<div style='margin-left:2%;color: #FFF;font-size: 15px;display:inline;background-color:#FC4444;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_cr, 2)) ."%</div>";
-										echo "<div style='background-color:white;color: black ;font-size: 15px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Critical</div>";
-										echo "<div style='margin-left:2%;color: #FFF;font-size: 15px;display:inline;background-color:#f8db3f;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_wa, 2)) ."%</div>";
-										echo "<div style='background-color:white;color: black ;font-size: 15px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Warning</div>";
-										echo "<div style='margin-left:2%;color: #FFF;font-size: 15px;display:inline;background-color:#84b83c;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_ok, 2)) ."%</div>";
-										echo "<div style='background-color:white;color: black ;font-size: 15px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Normal</div>";
-										echo "<div style='margin-left:2%;color: #FFF;font-size: 15px;display:inline;background-color:#9d9ea0;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_un, 2)) ."%</div>";
-										echo "<div style='background-color:white;color: black ;font-size: 15px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Unknown</div>";
+									echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#FC4444;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_cr, 2)) ."%</div>";
+									echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Critical</div>";
+									echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#f8db3f;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_wa, 2)) ."%</div>";
+									echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Warning</div>";
+									echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#84b83c;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_ok, 2)) ."%</div>";
+									echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Normal</div>";
+									echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#9d9ea0;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_un, 2)) ."%</div>";
+									echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Unknown</div>";
 									
 									echo "</td>";
 								echo "</tr>";
diff --git a/pandora_console/include/help/en/help_profile.php b/pandora_console/include/help/en/help_profile.php
index 58327eb36a..1222af8668 100644
--- a/pandora_console/include/help/en/help_profile.php
+++ b/pandora_console/include/help/en/help_profile.php
@@ -51,7 +51,7 @@
 <tr><td>Group Management<td>PM
 <tr><td>Creating inventory modules<td>PM
 <tr><td>Module Management (includes all suboptions)<td>PM
-<tr><td>Massive Management Operations	<td>AW
+<tr><td>Bulk Management Operations	<td>AW
 <tr><td>Creating agents<td>AW
 <tr><td>Duplicating remote configurations<td>AW
 <tr><td>Downtime Management<td>AW
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 004fc2f7d8..70a9ce80f7 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -71,7 +71,7 @@
 		<div style='height: 10px'>
 			<?php
 $version = '7.0NG.712';
-$build = '170914';
+$build = '170925';
 			$banner = "v$version Build $build";
 			
 			error_reporting(0);
diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php
index 111abffeee..80a891b38e 100755
--- a/pandora_console/operation/agentes/estado_generalagente.php
+++ b/pandora_console/operation/agentes/estado_generalagente.php
@@ -74,17 +74,35 @@ $table_agent->data = array();
 $data = array();
 
 $agent_name = ui_print_agent_name($agent["id_agente"], true, 500, "font-size: medium;font-weight:bold", true);
+$in_planned_downtime = db_get_value_filter('id', 'tplanned_downtime_agents', array('id_agent' => $agent["id_agente"]));
 
 if ($agent['disabled']) {
-	$agent_name = "<em>" . $agent_name . "</em>" . ui_print_help_tip(__('Disabled'), true);
+	if ($in_planned_downtime) {
+		$agent_name = "<em>" . $agent_name . ui_print_help_tip(__('Disabled'), true);
+	}
+	else {
+		$agent_name = "<em>" . $agent_name . "</em>" . ui_print_help_tip(__('Disabled'), true);
+	}
 }
 else if ($agent['quiet']) {
-	$agent_name = "<em'>" . $agent_name . "&nbsp;" . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . "</em>";
+	if ($in_planned_downtime) {
+		$agent_name = "<em'>" . $agent_name . "&nbsp;" . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => ""));
+	}
+	else {
+		$agent_name = "<em'>" . $agent_name . "&nbsp;" . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . "</em>";
+	}
 }
 else {
 	$agent_name = $agent_name;
 }
 
+if ($in_planned_downtime && !$agent['disabled'] && !$agent['quiet']) {
+	$agent_name .= "<em>" . "&nbsp;" . ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png') . "</em>";
+}
+else if (($in_planned_downtime  && !$agent['disabled']) || ($in_planned_downtime  && !$agent['quiet'])) {
+	$agent_name .= "&nbsp;" . ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png') . "</em>";
+}
+
 if (!$config["show_group_name"])
 	$data[0] = ui_print_group_icon ($agent["id_grupo"], true);
 else
diff --git a/pandora_console/operation/agentes/interface_traffic_graph_win.php b/pandora_console/operation/agentes/interface_traffic_graph_win.php
index 8d676b4340..0e1c6ae241 100644
--- a/pandora_console/operation/agentes/interface_traffic_graph_win.php
+++ b/pandora_console/operation/agentes/interface_traffic_graph_win.php
@@ -150,6 +150,7 @@ $interface_traffic_modules = array(
 		$zoom = (int) get_parameter ("zoom", 1);
 		$baseline = get_parameter ("baseline", 0);
 		$show_percentil = get_parameter ("show_percentil", 0);
+		$fullscale = get_parameter("fullscale", 0);
 		
 		if ($zoom > 1) {
 			$height = $height * ($zoom / 2.1);
@@ -200,7 +201,9 @@ $interface_traffic_modules = array(
 			false,
 			false,
 			(($show_percentil)? $config['percentil'] : null),
-			true);
+			true,
+			false,
+			$fullscale);
 		
 		echo '</div>';
 		
@@ -258,6 +261,12 @@ $interface_traffic_modules = array(
 		$data[1] = html_print_checkbox ("show_percentil", 1, (bool) $show_percentil, true);
 		$table->data[] = $data;
 		$table->rowclass[] ='';
+
+		$data = array();
+		$data[0] = __('Show full scale graph (TIP)');
+		$data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale, true);
+		$table->data[] = $data;
+		$table->rowclass[] ='';
 		
 		$data = array();
 		$data[0] = __('Zoom factor');
diff --git a/pandora_console/operation/visual_console/render_view.php b/pandora_console/operation/visual_console/render_view.php
index 4364bfda9f..261205818b 100755
--- a/pandora_console/operation/visual_console/render_view.php
+++ b/pandora_console/operation/visual_console/render_view.php
@@ -282,7 +282,12 @@ $ignored_params['refr'] = '';
 		
 		$('.item:not(.icon) img:not(.b64img)').each( function() {
 			if ($(this).css('float')=='left' || $(this).css('float')=='right') {
-				$(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px');
+				if(	$(this).parent()[0].tagName == 'DIV'){
+					$(this).css('margin-top',(parseInt($(this).parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px');
+				}
+				else if (	$(this).parent()[0].tagName == 'A') {
+					$(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px');
+				}
 				$(this).css('margin-left','');
 			}
 			else {
@@ -290,7 +295,12 @@ $ignored_params['refr'] = '';
 					$(this).css('margin-left','');
 					$(this).css('margin-top','');
 				} else {
-					$(this).css('margin-left',(parseInt($(this).parent().parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
+					if(	$(this).parent()[0].tagName == 'DIV'){
+						$(this).css('margin-left',(parseInt($(this).parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
+					}
+					else if (	$(this).parent()[0].tagName == 'A') {
+						$(this).css('margin-left',(parseInt($(this).parent().parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
+					}
 					$(this).css('margin-top','');
 				}
 			}
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index fb64779b67..e00ba7e89c 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.712
-%define release     170914
+%define release     170925
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index c31d871307..cf0413db1d 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     7.0NG.712
-%define release     170914
+%define release     170925
 %define httpd_name      httpd
 # User and Group under which Apache is running
 %define httpd_name  apache2
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index 3640357a8f..0d749db694 100644
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -67,7 +67,7 @@ CREATE TABLE IF NOT EXISTS `tagente` (
 	`custom_id` varchar(255) default '',
 	`server_name` varchar(100) default '',
 	`cascade_protection` tinyint(2) NOT NULL default '0',
-	`cascade_protection_module` tinyint(2) NOT NULL default '0',
+	`cascade_protection_module` int(10) unsigned NOT NULL default '0',
 	`timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'nuber of hours of diference with the server timezone' ,
 	`icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' ,
 	`update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' ,
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index 00106fa71a..249dddb68b 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-server
-Version: 7.0NG.712-170914
+Version: 7.0NG.712-170925
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index 1211bd9650..254cfd494b 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="7.0NG.712-170914"
+pandora_version="7.0NG.712-170925"
 
 package_cpan=0
 package_pandora=1
diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server
index 709b6c7b04..ef617343aa 100755
--- a/pandora_server/bin/pandora_server
+++ b/pandora_server/bin/pandora_server
@@ -607,7 +607,10 @@ sub main() {
 				$server->update();
 			}
 	
-			db_do ($DBH, "UPDATE tserver SET status = 0 WHERE now()-keepalive > 2*server_keepalive");
+			db_do ($DBH,
+				"UPDATE tserver SET status = 0
+				WHERE UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(keepalive) > 2*server_keepalive"
+			);
 
 			# Set the master server
 			pandora_set_master(\%Config, $DBH);
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index a09614a35a..3eefabe178 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -43,7 +43,7 @@ our @EXPORT = qw(
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "7.0NG.712";
-my $pandora_build = "170914";
+my $pandora_build = "170925";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 # Setup hash
diff --git a/pandora_server/lib/PandoraFMS/SNMPServer.pm b/pandora_server/lib/PandoraFMS/SNMPServer.pm
index af15614465..bc7b3a708a 100644
--- a/pandora_server/lib/PandoraFMS/SNMPServer.pm
+++ b/pandora_server/lib/PandoraFMS/SNMPServer.pm
@@ -211,6 +211,11 @@ sub pandora_snmptrapd {
 		# Try to save as much information as possible if the trap could not be parsed
 		$oid = $type_desc if ($oid eq '' || $oid eq '.');
 
+		if (!defined($oid)) {
+			logger($pa_config, "[W] snmpTrapOID not found (Illegal SNMPv1 trap?)", 5);
+			return;
+		}
+
 	} elsif ($trap_ver eq "SNMPv2") {
 		($date, $time, $source, $data) = split(/\[\*\*\]/, $line, 4);
 		my @data = split(/\t/, $data);
@@ -219,7 +224,7 @@ sub pandora_snmptrapd {
 		$oid = shift @data;
 
 		if (!defined($oid)) {
-			logger($pa_config, "[W] snmpTrapOID not found (Illegal SNMPv2 trap?)", 1);
+			logger($pa_config, "[W] snmpTrapOID not found (Illegal SNMPv2 trap?)", 5);
 			return;
 		}
 		$oid =~ s/.* = OID: //;
@@ -441,21 +446,32 @@ sub read_snmplogfile()
 
 	return undef if (! defined($line));
 
+	my $retry_count = 0;
+
 	# More lines ?
-	while($read_ahead_line = <SNMPLOGFILE>) {
+	while(1) {
+		while($read_ahead_line = <SNMPLOGFILE>) {
 
-		# Get current file position
-		$read_ahead_pos = tell(SNMPLOGFILE);
+			# Get current file position
+			$read_ahead_pos = tell(SNMPLOGFILE);
 
-		# Get out of the loop if you find another Trap
-		last if($read_ahead_line =~ /^SNMP/ );
+			# Get out of the loop if you find another Trap
+			last if($read_ahead_line =~ /^SNMP/ );
 
-		# $read_ahead_line looks continued line...
+			# $read_ahead_line looks continued line...
 
-		# Append to the line and correct the position
-		chomp($line);
-		$line .= "$read_ahead_line";
-		$pos = $read_ahead_pos;
+			# Append to the line and correct the position
+			chomp($line);
+			$line .= "$read_ahead_line";
+			$pos = $read_ahead_pos;
+		}
+
+		# if $line looks incomplete, try to get continued line
+		# just within 10sec.  After that, giving up to complete it
+		# and flush $line as it is.
+		last if(chomp($line) > 0  || $retry_count++ >= 10);
+
+		sleep(1);
 	}
 
 	# return fetched line with file position to be saved.
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index d112f654ec..5a500f2dea 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     7.0NG.712
-%define release     170914
+%define release     170925
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index dc178baa49..5d110d82c1 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     7.0NG.712
-%define release     170914
+%define release     170925
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer
index 9054bd91f7..e0fd6f1c83 100755
--- a/pandora_server/pandora_server_installer
+++ b/pandora_server/pandora_server_installer
@@ -9,7 +9,7 @@
 # **********************************************************************
 
 PI_VERSION="7.0NG.712"
-PI_BUILD="170914"
+PI_BUILD="170925"
 
 MODE=$1
 if [ $# -gt 1 ]; then
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index f944e22d7c..5e44d0a6ec 100644
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -33,7 +33,7 @@ use PandoraFMS::Tools;
 use PandoraFMS::DB;
 
 # version: define current version
-my $version = "7.0NG.712 PS170914";
+my $version = "7.0NG.712 PS170925";
 
 # Pandora server configuration
 my %conf;
@@ -93,7 +93,7 @@ sub pandora_purgedb ($$) {
 	}
 
 	# Delete old inventory data
-	if (defined($conf->{'_inventory_purge'}) && $conf->{'_inventory_purge'} > 0) {
+	if (defined ($conf->{'_inventory_purge'}) && $conf->{'_inventory_purge'} > 0) {
 		if (enterprise_load (\%conf) != 0) {
 			my $ulimit_timestamp_inventory = time() - (86400 * $conf->{'_inventory_purge'});
 
@@ -612,6 +612,7 @@ sub pandora_load_config ($) {
 	$conf->{'dbengine'} = 'mysql' unless defined ($conf->{'dbengine'});
 	$conf->{'dbport'} = '3306' unless defined ($conf->{'dbport'});
 	$conf->{'claim_back_snmp_modules'} = '1' unless defined ($conf->{'claim_back_snmp_modules'});
+    $conf->{'verbosity'} = '3' unless defined ($conf->{'verbosity'});
 
     # Dynamic interval configuration.                                                                                                                             
 	$conf->{"dynamic_constant"} = 0.10 unless defined($conf->{"dynamic_constant"});
@@ -787,10 +788,10 @@ sub pandora_checkdb_consistency {
 		log_message ('CHECKDB', "Ignoring not-init data.");
 	}
 	
-	log_message ('CHECKDB',
-		"Deleting unknown data (More than " . $conf{'_days_delete_unknown'} . " days).");
-	
 	if (defined($conf{'_days_delete_unknown'}) && $conf{'_days_delete_unknown'} > 0) {
+	    log_message ('CHECKDB',
+		    "Deleting unknown data (More than " . $conf{'_days_delete_unknown'} . " days).");
+	
 		my @modules = get_db_rows($dbh,
 			'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.id_agente
 			FROM tagente_modulo, tagente_estado
@@ -1060,4 +1061,4 @@ if ($lock == 1) {
 	db_release_lock ($dbh, 'pandora_db');
 }
 
-exit 0;
+exit 0;
\ No newline at end of file
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index e49098c95d..43ce599ea1 100644
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -21,6 +21,7 @@ use JSON qw(decode_json encode_json);
 use MIME::Base64;
 use Encode qw(decode encode_utf8);
 use LWP::Simple;
+use Data::Dumper;
 
 # Default lib dir for RPM and DEB packages
 use lib '/usr/lib/perl5';
@@ -35,7 +36,7 @@ use Encode::Locale;
 Encode::Locale::decode_argv;
 
 # version: define current version
-my $version = "7.0NG.712 PS170914";
+my $version = "7.0NG.712 PS170925";
 
 # save program name for logging
 my $progname = basename($0);
@@ -213,6 +214,15 @@ sub help_screen{
     help_screen_line('--create_tag', '<tag_name> <tag_description> [<tag_url>] [<tag_email>]', 'Create a new tag');
     help_screen_line('--add_tag_to_user_profile', '<user_id> <tag_name> <group_name> <profile_name>', 'Add a tag to the given user profile');
     help_screen_line('--add_tag_to_module', '<agent_name> <module_name> <tag_name>', 'Add a tag to the given module');
+
+	print "\nVISUAL CONSOLES\n\n" unless $param ne '';
+	help_screen_line('--create_visual_console', '<name> <background> <width> <height> <group> <mode> [<position_to_locate_elements>] [<background_color>] [<elements>]', 'Create a new visual console');
+	help_screen_line('--edit_visual_console', '<id> [<name>] [<background>] [<width>] [<height>] [<group>] [<mode>] [<position_to_locate_elements>] [<background_color>] [<elements>]', 'Edit a visual console');
+	help_screen_line('--delete_visual_console', '<id>', 'Delete a visual console');
+	help_screen_line('--delete_visual_console_objects', '<id> <mode> <id_mode>', 'Delete a visual console elements');
+	help_screen_line('--duplicate_visual_console', '<id> <times> [<prefix>]', 'Duplicate a visual console');
+	help_screen_line('--export_json_visual_console', '<id> [<path>]', 'Creates a json with the visual console elements information');
+
 	
 	print "\n";
 	exit;
@@ -4753,6 +4763,802 @@ sub cli_delete_special_day() {
 	exist_check($result,'special day',$special_day);
 }
 
+##############################################################################
+# Creates a new visual console.
+# Related option: --create_visual_console
+##############################################################################
+
+sub cli_create_visual_console() {
+	my ($name,$background,$width,$height,$group,$mode,$element_square_positions,$background_color,$elements) = @ARGV[2..10];
+
+	if($name eq '') {
+		print_log "[ERROR] Name field cannot be empty.\n\n";
+		exit 1;
+	}
+	elsif ($background eq '') {
+		print_log "[ERROR] Background field cannot be empty.\n\n";
+		exit 1;
+	}
+	elsif (($width eq '') || ($height eq '')) {
+		print_log "[ERROR] Please specify size.\n\n";
+		exit 1;
+	}
+	elsif ($group eq '') {
+		print_log "[ERROR] Group field cannot be empty.\n\n";
+		exit 1;
+	}
+	elsif ($mode eq '') {
+		print_log "[ERROR] Mode parameter must be 'static_objects' or 'auto_creation'.\n\n";
+		exit 1;
+	}
+
+	if ($background_color eq '') {
+		$background_color = '#FFF';
+	}
+
+	print_log "[INFO] Creating visual console '$name' \n\n";
+
+	my $vc_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout (name, id_group, background, width, height, background_color)
+                         VALUES (?, ?, ?, ?, ?, ?)', safe_input($name), $group, $background, $width, $height, $background_color);
+
+	print_log "[INFO] The visual console id is '$vc_id' \n\n";
+
+	if ($elements ne '') {
+		my $elements_in_array = decode_json($elements);
+
+		if ($mode eq 'static_objects') {
+			my $elem_count = 1;
+
+			foreach my $elem (@$elements_in_array) {
+				my $pos_x = $elem->{'pos_x'};
+				my $pos_y = $elem->{'pos_y'};
+				my $width = $elem->{'width'};
+				my $height = $elem->{'height'};
+				my $label = $elem->{'label'};
+				my $image = $elem->{'image'};
+				my $type = $elem->{'type'};
+				my $period = $elem->{'period'};
+				my $id_agente_modulo = $elem->{'id_agente_modulo'};
+				my $id_agent = $elem->{'id_agent'};
+				my $id_layout_linked = $elem->{'id_layout_linked'};
+				my $parent_item = $elem->{'parent_item'};
+				my $enable_link = $elem->{'enable_link'};
+				my $id_metaconsole = $elem->{'id_metaconsole'};
+				my $id_group = $elem->{'id_group'};
+				my $id_custom_graph = $elem->{'id_custom_graph'};
+				my $border_width = $elem->{'border_width'};
+				my $type_graph = $elem->{'type_graph'};
+				my $label_position = $elem->{'label_position'};
+				my $border_color = $elem->{'border_color'};
+				my $fill_color = $elem->{'fill_color'};
+
+				my $elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
+							VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $vc_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
+
+				print_log "[INFO] The element id in position $elem_count is '$elem_id' \n\n";
+
+				$elem_count++;
+			}
+		}
+		elsif ($mode eq 'auto_creation') {
+			if ($element_square_positions eq '') {
+				print_log "[ERROR] With this mode, square positions is obligatory'.\n\n";
+				exit 1;
+			}
+			else {
+				my $positions = decode_json($element_square_positions);
+
+				my $pos1X = $positions->{'pos1x'};
+				my $pos1Y = $positions->{'pos1y'};
+				my $pos2X = $positions->{'pos2x'};
+				my $pos2Y = $positions->{'pos2y'};
+
+				my $number_of_elements = scalar(@$elements_in_array);
+				
+				my $x_divider = 4;
+				my $y_divider = 1;
+
+				for (my $i = 1; $i <= 1000; $i++) {
+					if (($i * 4) < $number_of_elements) {
+						$y_divider++;
+					}
+					else {
+						last;
+					}
+				}
+
+				my $elem_width = ($pos2X - $pos1X) / $x_divider;
+				my $elem_height = ($pos2Y - $pos1Y) / $y_divider;
+
+				if ($number_of_elements < 4) {
+					$elem_height = ($pos2Y - $pos1Y) / 3;
+				}
+
+				my $elem_count = 1;
+				my $pos_helper_x = 0;
+				my $pos_helper_y = 0;
+				foreach my $elem (@$elements_in_array) {
+					my $pos_x = $pos_helper_x * $elem_width;
+					my $pos_y = $pos_helper_y * $elem_height;
+					my $width = $elem_width;
+					my $height = $elem_height;
+					my $label = $elem->{'label'};
+					my $image = $elem->{'image'};
+					my $type = $elem->{'type'};
+					my $period = $elem->{'period'};
+					my $id_agente_modulo = $elem->{'id_agente_modulo'};
+					my $id_agent = $elem->{'id_agent'};
+					my $id_layout_linked = $elem->{'id_layout_linked'};
+					my $parent_item = $elem->{'parent_item'};
+					my $enable_link = $elem->{'enable_link'};
+					my $id_metaconsole = $elem->{'id_metaconsole'};
+					my $id_group = $elem->{'id_group'};
+					my $id_custom_graph = $elem->{'id_custom_graph'};
+					my $border_width = $elem->{'border_width'};
+					my $type_graph = $elem->{'type_graph'};
+					my $label_position = $elem->{'label_position'};
+					my $border_color = $elem->{'border_color'};
+					my $fill_color = $elem->{'fill_color'};
+
+					my $elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
+								VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $vc_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
+
+					print_log "[INFO] The element id in position $elem_count is '$elem_id' \n\n";
+
+					$elem_count++;
+
+					if ($pos_helper_x == 3) {
+						$pos_helper_x = 0;
+						$pos_helper_y++;
+					}
+					else {
+						$pos_helper_x++;
+					}
+				}
+			}
+		}
+		else {
+			print_log "[ERROR] Mode parameter must be 'static_objects' or 'auto_creation'.\n\n";
+			exit 1;
+		}
+	}
+}
+
+##############################################################################
+# Edit a visual console.
+# Related option: --edit_visual_console
+##############################################################################
+
+sub cli_edit_visual_console() {
+	my ($id,$name,$background,$width,$height,$group,$mode,$element_square_positions,$background_color,$elements) = @ARGV[2..11];
+
+	if($id eq '') {
+		print_log "[ERROR] ID field cannot be empty.\n\n";
+		exit 1;
+	}
+
+	my $console = get_db_single_row ($dbh, "SELECT * 
+			FROM tlayout 
+			WHERE id = $id");
+
+	my $new_name = $console->{'name'};
+	my $new_background = $console->{'background'};
+	my $new_console_width = $console->{'width'};
+	my $new_console_height = $console->{'height'};
+	my $new_console_id_group = $console->{'id_group'};
+	my $new_background_color = $console->{'background_color'};
+
+	if($name ne '') {
+		$new_name = $name;
+	}
+	if ($background ne '') {
+		$new_background = $background;
+	}
+	if ($width ne '') {
+		$new_console_width = $width;
+	}
+	if ($height ne '') {
+		$new_console_height = $height;
+	}
+	if ($group ne '') {
+		$new_console_id_group = $group;
+	}
+	if ($background_color ne '') {
+		$new_background_color = $background_color;
+	}
+
+	print_log "[INFO] The visual console with id $id is updated \n\n";
+
+	db_update ($dbh, "UPDATE tlayout SET name = '" . $new_name . "', background = '" . $new_background . "', width = " . $new_console_width . ", height = " . $new_console_height . ", id_group = " . $new_console_id_group . ", background_color = '" . $new_background_color . "' WHERE id = " . $id);
+
+	if ($elements ne '') {
+		my $elements_in_array = decode_json($elements);
+
+		if ($mode eq 'static_objects') {
+			foreach my $elem (@$elements_in_array) {
+				if (defined($elem->{'id'})) {
+
+					print_log "[INFO] Edit element with id " . $elem->{'id'} . " \n\n";
+
+					my $element_in_db = get_db_single_row ($dbh, "SELECT * 
+						FROM tlayout_data 
+						WHERE id = " . $elem->{'id'});
+
+					my $new_pos_x = $element_in_db->{'pos_x'};
+					my $new_pos_y = $element_in_db->{'pos_y'};
+					my $new_width = $element_in_db->{'width'};
+					my $new_height = $element_in_db->{'height'};
+					my $new_label = $element_in_db->{'label'};
+					my $new_image = $element_in_db->{'image'};
+					my $new_type = $element_in_db->{'type'};
+					my $new_period = $element_in_db->{'period'};
+					my $new_id_agente_modulo = $element_in_db->{'id_agente_modulo'};
+					my $new_id_agent = $element_in_db->{'id_agent'};
+					my $new_id_layout_linked = $element_in_db->{'id_layout_linked'};
+					my $new_parent_item = $element_in_db->{'parent_item'};
+					my $new_enable_link = $element_in_db->{'enable_link'};
+					my $new_id_metaconsole = $element_in_db->{'id_metaconsole'};
+					my $new_id_group = $element_in_db->{'id_group'};
+					my $new_id_custom_graph = $element_in_db->{'id_custom_graph'};
+					my $new_border_width = $element_in_db->{'border_width'};
+					my $new_type_graph = $element_in_db->{'type_graph'};
+					my $new_label_position = $element_in_db->{'label_position'};
+					my $new_border_color = $element_in_db->{'border_color'};
+					my $new_fill_color = $element_in_db->{'fill_color'};
+
+					if(defined($elem->{'pos_x'})) {
+						$new_pos_x = $elem->{'pos_x'};
+					}
+					if(defined($elem->{'pos_y'})) {
+						$new_pos_y = $elem->{'pos_y'};
+					}
+					if(defined($elem->{'width'})) {
+						$new_width = $elem->{'width'};
+					}
+					if(defined($elem->{'height'})) {
+						$new_height = $elem->{'height'};
+					}
+					if(defined($elem->{'label'})) {
+						$new_label = $elem->{'label'};
+					}
+					if(defined($elem->{'image'})) {
+						$new_image = $elem->{'image'};
+					}
+					if(defined($elem->{'type'})) {
+						$new_type = $elem->{'type'};
+					}
+					if(defined($elem->{'period'})) {
+						$new_period = $elem->{'period'};
+					}
+					if(defined($elem->{'id_agente_modulo'})) {
+						$new_id_agente_modulo = $elem->{'id_agente_modulo'};
+					}
+					if(defined($elem->{'id_agent'})) {
+						$new_id_agent = $elem->{'id_agent'};
+					}
+					if(defined($elem->{'id_layout_linked'})) {
+						$new_id_layout_linked = $elem->{'id_layout_linked'};
+					}
+					if(defined($elem->{'parent_item'})) {
+						$new_parent_item = $elem->{'parent_item'};
+					}
+					if(defined($elem->{'enable_link'})) {
+						$new_enable_link = $elem->{'enable_link'};
+					}
+					if(defined($elem->{'id_metaconsole'})) {
+						$new_id_metaconsole = $elem->{'id_metaconsole'};
+					}
+					if(defined($elem->{'id_group'})) {
+						$new_id_group = $elem->{'id_group'};
+					}
+					if(defined($elem->{'id_custom_graph'})) {
+						$new_id_custom_graph = $elem->{'id_custom_graph'};
+					}
+					if(defined($elem->{'border_width'})) {
+						$new_border_width = $elem->{'border_width'};
+					}
+					if(defined($elem->{'type_graph'})) {
+						$new_type_graph = $elem->{'type_graph'};
+					}
+					if(defined($elem->{'label_position'})) {
+						$new_label_position = $elem->{'label_position'};
+					}
+					if(defined($elem->{'border_color'})) {
+						$new_border_color = $elem->{'border_color'};
+					}
+					if(defined($elem->{'fill_color'})) {
+						$new_fill_color = $elem->{'fill_color'};
+					}
+
+					db_update ($dbh, "UPDATE tlayout_data SET pos_x = " . $new_pos_x . ", pos_y = " . $new_pos_y . ", width = " . $new_width . 
+						", height = " . $new_height . ", label = '" . $new_label . "', image = '" . $new_image . 
+						"', type = " . $new_type . ", period = " . $new_period . ", id_agente_modulo = " . $new_id_agente_modulo . 
+						", id_agent = " . $new_id_agent . ", id_layout_linked = " . $new_id_layout_linked . ", parent_item = " . $new_parent_item . 
+						", enable_link = " . $new_enable_link . ", id_metaconsole = " . $new_id_metaconsole . ", id_group = " . $new_id_group . 
+						", id_custom_graph = " . $new_id_custom_graph . ", border_width = " . $new_border_width . ", type_graph = '" . $new_type_graph . 
+						"', label_position = '" . $new_label_position . "', border_color = '" . $new_border_color . "', fill_color = '" . $new_fill_color . 
+						"' WHERE id = " . $elem->{'id'});
+					
+					print_log "[INFO] Element with id " . $elem->{'id'} . " has been updated \n\n";
+				}
+				else {
+					my $pos_x = $elem->{'pos_x'};
+					my $pos_y = $elem->{'pos_y'};
+					my $width = $elem->{'width'};
+					my $height = $elem->{'height'};
+					my $label = $elem->{'label'};
+					my $image = $elem->{'image'};
+					my $type = $elem->{'type'};
+					my $period = $elem->{'period'};
+					my $id_agente_modulo = $elem->{'id_agente_modulo'};
+					my $id_agent = $elem->{'id_agent'};
+					my $id_layout_linked = $elem->{'id_layout_linked'};
+					my $parent_item = $elem->{'parent_item'};
+					my $enable_link = $elem->{'enable_link'};
+					my $id_metaconsole = $elem->{'id_metaconsole'};
+					my $id_group = $elem->{'id_group'};
+					my $id_custom_graph = $elem->{'id_custom_graph'};
+					my $border_width = $elem->{'border_width'};
+					my $type_graph = $elem->{'type_graph'};
+					my $label_position = $elem->{'label_position'};
+					my $border_color = $elem->{'border_color'};
+					my $fill_color = $elem->{'fill_color'};
+
+					my $new_elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
+						VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
+				
+					print_log "[INFO] New element with id $new_elem_id has been created \n\n";
+				}
+			}
+		}
+		elsif ($mode eq 'auto_creation') {
+			if ($element_square_positions eq '') {
+				print_log "[ERROR] With this mode, square positions is obligatory'.\n\n";
+				exit 1;
+			}
+			else {
+				foreach my $elem (@$elements_in_array) {
+					if (defined($elem->{'id'})) {
+						print_log "[INFO] Edit element with id " . $elem->{'id'} . " \n\n";
+
+						my $element_in_db = get_db_single_row ($dbh, "SELECT * 
+							FROM tlayout_data 
+							WHERE id = " . $elem->{'id'});
+
+						my $new_pos_x = $element_in_db->{'pos_x'};
+						my $new_pos_y = $element_in_db->{'pos_y'};
+						my $new_width = $element_in_db->{'width'};
+						my $new_height = $element_in_db->{'height'};
+						my $new_label = $element_in_db->{'label'};
+						my $new_image = $element_in_db->{'image'};
+						my $new_type = $element_in_db->{'type'};
+						my $new_period = $element_in_db->{'period'};
+						my $new_id_agente_modulo = $element_in_db->{'id_agente_modulo'};
+						my $new_id_agent = $element_in_db->{'id_agent'};
+						my $new_id_layout_linked = $element_in_db->{'id_layout_linked'};
+						my $new_parent_item = $element_in_db->{'parent_item'};
+						my $new_enable_link = $element_in_db->{'enable_link'};
+						my $new_id_metaconsole = $element_in_db->{'id_metaconsole'};
+						my $new_id_group = $element_in_db->{'id_group'};
+						my $new_id_custom_graph = $element_in_db->{'id_custom_graph'};
+						my $new_border_width = $element_in_db->{'border_width'};
+						my $new_type_graph = $element_in_db->{'type_graph'};
+						my $new_label_position = $element_in_db->{'label_position'};
+						my $new_border_color = $element_in_db->{'border_color'};
+						my $new_fill_color = $element_in_db->{'fill_color'};
+
+						if(defined($elem->{'width'})) {
+							$new_width = $elem->{'width'};
+						}
+						if(defined($elem->{'height'})) {
+							$new_height = $elem->{'height'};
+						}
+						if(defined($elem->{'label'})) {
+							$new_label = $elem->{'label'};
+						}
+						if(defined($elem->{'image'})) {
+							$new_image = $elem->{'image'};
+						}
+						if(defined($elem->{'type'})) {
+							$new_type = $elem->{'type'};
+						}
+						if(defined($elem->{'period'})) {
+							$new_period = $elem->{'period'};
+						}
+						if(defined($elem->{'id_agente_modulo'})) {
+							$new_id_agente_modulo = $elem->{'id_agente_modulo'};
+						}
+						if(defined($elem->{'id_agent'})) {
+							$new_id_agent = $elem->{'id_agent'};
+						}
+						if(defined($elem->{'id_layout_linked'})) {
+							$new_id_layout_linked = $elem->{'id_layout_linked'};
+						}
+						if(defined($elem->{'parent_item'})) {
+							$new_parent_item = $elem->{'parent_item'};
+						}
+						if(defined($elem->{'enable_link'})) {
+							$new_enable_link = $elem->{'enable_link'};
+						}
+						if(defined($elem->{'id_metaconsole'})) {
+							$new_id_metaconsole = $elem->{'id_metaconsole'};
+						}
+						if(defined($elem->{'id_group'})) {
+							$new_id_group = $elem->{'id_group'};
+						}
+						if(defined($elem->{'id_custom_graph'})) {
+							$new_id_custom_graph = $elem->{'id_custom_graph'};
+						}
+						if(defined($elem->{'border_width'})) {
+							$new_border_width = $elem->{'border_width'};
+						}
+						if(defined($elem->{'type_graph'})) {
+							$new_type_graph = $elem->{'type_graph'};
+						}
+						if(defined($elem->{'label_position'})) {
+							$new_label_position = $elem->{'label_position'};
+						}
+						if(defined($elem->{'border_color'})) {
+							$new_border_color = $elem->{'border_color'};
+						}
+						if(defined($elem->{'fill_color'})) {
+							$new_fill_color = $elem->{'fill_color'};
+						}
+
+						db_update ($dbh, "UPDATE tlayout_data SET pos_x = " . $new_pos_x . ", pos_y = " . $new_pos_y . ", width = " . $new_width . 
+							", height = " . $new_height . ", label = '" . $new_label . "', image = '" . $new_image . 
+							"', type = " . $new_type . ", period = " . $new_period . ", id_agente_modulo = " . $new_id_agente_modulo . 
+							", id_agent = " . $new_id_agent . ", id_layout_linked = " . $new_id_layout_linked . ", parent_item = " . $new_parent_item . 
+							", enable_link = " . $new_enable_link . ", id_metaconsole = " . $new_id_metaconsole . ", id_group = " . $new_id_group . 
+							", id_custom_graph = " . $new_id_custom_graph . ", border_width = " . $new_border_width . ", type_graph = '" . $new_type_graph . 
+							"', label_position = '" . $new_label_position . "', border_color = '" . $new_border_color . "', fill_color = '" . $new_fill_color . 
+							"' WHERE id = " . $elem->{'id'});
+						
+						print_log "[INFO] Element with id " . $elem->{'id'} . " has been updated \n\n";
+					}
+					else {
+						my $pos_x = 0;
+						my $pos_y = 0;
+						my $width = $elem->{'width'};
+						my $height = $elem->{'height'};
+						my $label = $elem->{'label'};
+						my $image = $elem->{'image'};
+						my $type = $elem->{'type'};
+						my $period = $elem->{'period'};
+						my $id_agente_modulo = $elem->{'id_agente_modulo'};
+						my $id_agent = $elem->{'id_agent'};
+						my $id_layout_linked = $elem->{'id_layout_linked'};
+						my $parent_item = $elem->{'parent_item'};
+						my $enable_link = $elem->{'enable_link'};
+						my $id_metaconsole = $elem->{'id_metaconsole'};
+						my $id_group = $elem->{'id_group'};
+						my $id_custom_graph = $elem->{'id_custom_graph'};
+						my $border_width = $elem->{'border_width'};
+						my $type_graph = $elem->{'type_graph'};
+						my $label_position = $elem->{'label_position'};
+						my $border_color = $elem->{'border_color'};
+						my $fill_color = $elem->{'fill_color'};
+
+						my $new_elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
+							VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
+					
+						print_log "[INFO] New element with id $new_elem_id has been created \n\n";
+					}
+				}
+
+				my $positions = decode_json($element_square_positions);
+
+				my $pos1X = $positions->{'pos1x'};
+				my $pos1Y = $positions->{'pos1y'};
+				my $pos2X = $positions->{'pos2x'};
+				my $pos2Y = $positions->{'pos2y'};
+
+				my @console_elements = get_db_rows ($dbh, "SELECT * 
+						FROM tlayout_data 
+						WHERE id_layout = $id");
+
+				my $number_of_elements = scalar(@console_elements);
+
+				my $x_divider = 4;
+				my $y_divider = 1;
+
+				for (my $i = 1; $i <= 1000; $i++) {
+					if (($i * 4) < $number_of_elements) {
+						$y_divider++;
+					}
+					else {
+						last;
+					}
+				}
+
+				my $elem_width = ($pos2X - $pos1X) / $x_divider;
+				my $elem_height = ($pos2Y - $pos1Y) / $y_divider;
+
+				if ($number_of_elements < 4) {
+					$elem_height = ($pos2Y - $pos1Y) / 3;
+				}
+
+				my $elem_count = 1;
+				my $pos_helper_x = 0;
+				my $pos_helper_y = 0;
+				foreach my $elem (@console_elements) {
+					my $new_pos_x = $pos_helper_x * $elem_width;
+					my $new_pos_y = $pos_helper_y * $elem_height;
+					my $new_elem_width = $elem_width;
+					my $new_elem_height = $elem_height;
+
+					db_update ($dbh, "UPDATE tlayout_data SET pos_x = " . $new_pos_x . ", pos_y = " . $new_pos_y . 
+							", width = " . $new_elem_width . ", height = " . $new_elem_height . 
+							" WHERE id = " . $elem->{'id'});
+
+					print_log "[INFO] Recolocate element with id " . $elem->{'id'} . " \n\n";
+
+					$elem_count++;
+
+					if ($pos_helper_x == 3) {
+						$pos_helper_x = 0;
+						$pos_helper_y++;
+					}
+					else {
+						$pos_helper_x++;
+					}
+				}
+			}
+		}
+		else {
+			print_log "[ERROR] Mode parameter must be 'static_objects' or 'auto_creation'.\n\n";
+			exit 1;
+		}
+	}
+}
+
+##############################################################################
+# Delete a visual console.
+# Related option: --delete_visual_console
+##############################################################################
+
+sub cli_delete_visual_console() {
+	my ($id) = @ARGV[2];
+
+	if($id eq '') {
+		print_log "[ERROR] ID field cannot be empty.\n\n";
+		exit 1;
+	}
+
+	print_log "[INFO] Delete visual console with ID '$id' \n\n";
+
+	my $delete_layout = db_do($dbh, 'DELETE FROM tlayout WHERE id = ?', $id);
+
+	if ($delete_layout eq 1) {
+		db_do($dbh, 'DELETE FROM tlayout_data WHERE id_layout = ?', $id);
+
+		print_log "[INFO] Delete visual console elements with console ID '$id' \n\n";
+	}
+	else {
+		print_log "[ERROR] Error at remove the visual console.\n\n";
+		exit 1;
+	}
+}
+
+##############################################################################
+# Delete a visual console objects.
+# Related option: --delete_visual_console_objects
+##############################################################################
+
+sub cli_delete_visual_console_objects() {
+	my ($id_console,$mode,$id_mode) = @ARGV[2..4];
+
+	if($id_console eq '') {
+		print_log "[ERROR] Console ID field cannot be empty.\n\n";
+		exit 1;
+	}
+	elsif ($mode eq '') {
+		print_log "[ERROR] Mode field cannot be empty.\n\n";
+		exit 1;
+	}
+	elsif ($id_mode eq '') {
+		print_log "[ERROR] Mode index field cannot be empty.\n\n";
+		exit 1;
+	}
+
+	if (($mode eq 'type') || ($mode eq 'image') || ($mode eq 'id_agent') || 
+		($mode eq 'id_agente_modulo') || ($mode eq 'id_group') || ($mode eq 'type_graph')) {
+		print_log "[INFO] Removind objects with mode '$mode' and id '$id_mode' \n\n";
+		
+		db_do($dbh, 'DELETE FROM tlayout_data WHERE id_layout = ' . $id_console . ' AND ' . $mode . ' = "' . $id_mode . '"');
+	}
+	else {
+		print_log "[ERROR] Mode is not correct.\n\n";
+		exit 1;
+	}
+}
+
+##############################################################################
+# Duplicate a visual console.
+# Related option: --duplicate_visual_console
+##############################################################################
+
+sub cli_duplicate_visual_console () {
+	my ($id_console,$times,$prefix) = @ARGV[2..4];
+
+	if($id_console eq '') {
+		print_log "[ERROR] Console ID field cannot be empty.\n\n";
+		exit 1;
+	}
+
+	my $console = get_db_single_row ($dbh, "SELECT * 
+			FROM tlayout 
+			WHERE id = $id_console");
+
+	my $name_to_compare = $console->{'name'};
+	my $new_name = $console->{'name'} . "_1";
+	my $name_count = 2;
+
+	if ($prefix ne '') {
+		$new_name = $prefix;
+		$name_to_compare = $prefix;
+		$name_count = 1;
+	}
+
+	for (my $iteration = 0; $iteration < $times; $iteration++) {
+		my $exist = 1;
+		while ($exist == 1) {
+			my $name_in_db = get_db_single_row ($dbh, "SELECT name FROM tlayout WHERE name = '$new_name'");
+			
+			if (defined($name_in_db->{'name'}) && ($name_in_db->{'name'} eq $new_name)) {
+				$new_name = $name_to_compare . "_" . $name_count;
+				$name_count++;
+			}
+			else {
+				$exist = 0;
+			}
+		}
+
+		my $new_console_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout (name, id_group, background, width, height, background_color)
+							VALUES (?, ?, ?, ?, ?, ?)', $new_name, $console->{'id_group'}, $console->{'background'}, $console->{'width'}, $console->{'height'}, $console->{'background_color'});
+		
+		print_log "[INFO] The new visual console '$new_name' has been created. The new ID is '$new_console_id' \n\n";
+
+		my @console_elements = get_db_rows ($dbh, "SELECT * 
+				FROM tlayout_data 
+				WHERE id_layout = $id_console");
+
+		foreach my $element (@console_elements) {
+			my $pos_x = $element->{'pos_x'};
+			my $pos_y = $element->{'pos_y'};
+			my $width = $element->{'width'};
+			my $height = $element->{'height'};
+			my $label = $element->{'label'};
+			my $image = $element->{'image'};
+			my $type = $element->{'type'};
+			my $period = $element->{'period'};
+			my $id_agente_modulo = $element->{'id_agente_modulo'};
+			my $id_agent = $element->{'id_agent'};
+			my $id_layout_linked = $element->{'id_layout_linked'};
+			my $parent_item = $element->{'parent_item'};
+			my $enable_link = $element->{'enable_link'};
+			my $id_metaconsole = $element->{'id_metaconsole'};
+			my $id_group = $element->{'id_group'};
+			my $id_custom_graph = $element->{'id_custom_graph'};
+			my $border_width = $element->{'border_width'};
+			my $type_graph = $element->{'type_graph'};
+			my $label_position = $element->{'label_position'};
+			my $border_color = $element->{'border_color'};
+			my $fill_color = $element->{'fill_color'};
+
+			my $element_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
+						VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $new_console_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
+		
+			print_log "[INFO] Element with ID " . $element->{"id"} . " has been duplicated to the new console \n\n";
+		}
+	}
+}
+
+##############################################################################
+# Export a visual console elements to json.
+# Related option: --export_json_visual_console
+##############################################################################
+
+sub cli_export_visual_console() {
+	my ($id,$path) = @ARGV[2..3];
+
+	if($id eq '') {
+		print_log "[ERROR] ID field cannot be empty.\n\n";
+		exit 1;
+	}
+
+	my $data_to_json = '';
+	my $first = 1;
+
+	print_log "[INFO] Exporting visual console elements with ID '$id' \n\n";
+
+	my $console = get_db_single_row ($dbh, "SELECT * 
+			FROM tlayout 
+			WHERE id = $id");
+
+	$data_to_json .= '"' . safe_output($console->{'name'}) . '"';
+	$data_to_json .= ' "' . $console->{'background'} . '"';
+	$data_to_json .= ' ' . $console->{'width'};
+	$data_to_json .= ' ' . $console->{'height'};
+	$data_to_json .= ' ' . $console->{'id_group'};
+	$data_to_json .= ' "static_objects"';
+	$data_to_json .= ' ""';
+	$data_to_json .= ' "' . $console->{'background_color'} . '" ';
+
+	my @console_elements = get_db_rows ($dbh, "SELECT * 
+			FROM tlayout_data 
+			WHERE id_layout = $id");
+
+	$data_to_json .= '[';
+	foreach my $element (@console_elements) {
+		my $pos_x = $element->{'pos_x'};
+		my $pos_y = $element->{'pos_y'};
+		my $width = $element->{'width'};
+		my $height = $element->{'height'};
+		my $label = $element->{'label'};
+		my $image = $element->{'image'};
+		my $type = $element->{'type'};
+		my $period = $element->{'period'};
+		my $id_agente_modulo = $element->{'id_agente_modulo'};
+		my $id_agent = $element->{'id_agent'};
+		my $id_layout_linked = $element->{'id_layout_linked'};
+		my $parent_item = $element->{'parent_item'};
+		my $enable_link = $element->{'enable_link'};
+		my $id_metaconsole = $element->{'id_metaconsole'};
+		my $id_group = $element->{'id_group'};
+		my $id_custom_graph = $element->{'id_custom_graph'};
+		my $border_width = $element->{'border_width'};
+		my $type_graph = $element->{'type_graph'};
+		my $label_position = $element->{'label_position'};
+		my $border_color = $element->{'border_color'};
+		my $fill_color = $element->{'fill_color'};
+
+		if ($first == 0) {
+			$data_to_json .= ','
+		}
+		else {
+			$first = 0;
+		}
+
+		$label =~ s/"/\\"/g;
+
+		$data_to_json .= '{"image":"' . $image . '"';
+		$data_to_json .= ',"pos_y":' . $pos_y;
+		$data_to_json .= ',"pos_x":' . $pos_x;
+		$data_to_json .= ',"width":' . $width;
+		$data_to_json .= ',"height":' . $height;
+		$data_to_json .= ',"label":"' . $label . '"';
+		$data_to_json .= ',"type":' . $type;
+		$data_to_json .= ',"period":' . $period;
+		$data_to_json .= ',"id_agente_modulo":' . $id_agente_modulo;
+		$data_to_json .= ',"id_agent":' . $id_agent;
+		$data_to_json .= ',"id_layout_linked":' . $id_layout_linked;
+		$data_to_json .= ',"parent_item":' . $parent_item;
+		$data_to_json .= ',"enable_link":' . $enable_link;
+		$data_to_json .= ',"id_metaconsole":' . $id_metaconsole;
+		$data_to_json .= ',"id_group":' . $id_group;
+		$data_to_json .= ',"id_custom_graph":' . $id_custom_graph;
+		$data_to_json .= ',"border_width":' . $border_width;
+		$data_to_json .= ',"type_graph":"' . $type_graph . '"';
+		$data_to_json .= ',"label_position":"' . $label_position . '"';
+		$data_to_json .= ',"border_color":"' . $border_color . '"';
+		$data_to_json .= ',"fill_color":"' . $fill_color . '"';
+		$data_to_json .= '}';
+	}
+
+	$data_to_json .= ']';
+
+	if ($path eq '') {
+		open(FicheroJSON, ">console_" . $id . "_elements");
+	}
+	else {
+		open(FicheroJSON, ">" . $path . "/console_" . $id . "_elements");
+	}
+
+	print FicheroJSON $data_to_json;
+
+	print_log "[INFO] JSON file now contents: \n" . $data_to_json . "\n\n";
+}
 
 ###############################################################################
 ###############################################################################
@@ -5183,7 +5989,31 @@ sub pandora_manage_main ($$$) {
 		elsif ($param eq '--locate_agent') {
 			param_check($ltotal, 1);
 			cli_locate_agent();
-		} 
+		}
+		elsif ($param eq '--create_visual_console') {
+			param_check($ltotal, 9, 3);
+			cli_create_visual_console();
+		}
+		elsif ($param eq '--edit_visual_console') {
+			param_check($ltotal, 10, 9);
+			cli_edit_visual_console();
+		}
+		elsif ($param eq '--delete_visual_console') {
+			param_check($ltotal, 1);
+			cli_delete_visual_console();
+		}
+		elsif ($param eq '--delete_visual_console_objects') {
+			param_check($ltotal, 3);
+			cli_delete_visual_console_objects();
+		}
+		elsif ($param eq '--duplicate_visual_console') {
+			param_check($ltotal, 3, 2);
+			cli_duplicate_visual_console();
+		}
+		elsif ($param eq '--export_json_visual_console') {
+			param_check($ltotal, 2, 1);
+			cli_export_visual_console();
+		}
 		else {
 			print_log "[ERROR] Invalid option '$param'.\n\n";
 			$param = '';