From 6eeda98886ab15d1be82efcbf26c4d9957a51e4a Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Tue, 21 Aug 2012 17:12:02 +0000
Subject: [PATCH] 2012-08-21 Miguel de Dios <miguel.dedios@artica.es>

	* pandoradb.oracle.sql, operation/agentes/estado_generalagente.php,
	operation/agentes/estado_agente.php,
	operation/agentes/ver_agente.php,
	extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
	extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
	extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
	godmode/agentes/agent_manager.php,
	godmode/agentes/modificar_agente.php,
	godmode/agentes/configurar_agente.php, pandoradb.sql,
	pandoradb.postgreSQL.sql: added the feature to set a agent in
	"Quiet" mode.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6896 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                     |  14 ++
 .../pandoradb_migrate_4.0.x_to_5.0.mysql.sql  |  15 +-
 .../pandoradb_migrate_4.0.x_to_5.0.oracle.sql |   1 +
 ...doradb_migrate_4.0.x_to_5.0.postgreSQL.sql |   3 +-
 .../godmode/agentes/agent_manager.php         |  17 +-
 .../godmode/agentes/configurar_agente.php     |  52 +++---
 .../godmode/agentes/modificar_agente.php      |  32 ++--
 .../operation/agentes/estado_agente.php       |  13 +-
 .../agentes/estado_generalagente.php          |  11 +-
 .../operation/agentes/ver_agente.php          | 113 ++++++------
 pandora_console/pandoradb.oracle.sql          |   3 +-
 pandora_console/pandoradb.postgreSQL.sql      |   3 +-
 pandora_console/pandoradb.sql                 | 166 ++++++++++--------
 13 files changed, 255 insertions(+), 188 deletions(-)

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index ccec59c1a1..fa8a7cecb9 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,3 +1,17 @@
+2012-08-21 Miguel de Dios <miguel.dedios@artica.es>
+	
+	* pandoradb.oracle.sql, operation/agentes/estado_generalagente.php,
+	operation/agentes/estado_agente.php,
+	operation/agentes/ver_agente.php,
+	extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
+	extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
+	extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
+	godmode/agentes/agent_manager.php,
+	godmode/agentes/modificar_agente.php,
+	godmode/agentes/configurar_agente.php, pandoradb.sql,
+	pandoradb.postgreSQL.sql: added the feature to set a agent in
+	"Quiet" mode.
+
 2012-08-21 Dario Rodriguez <dario.rodriguez@artica.es>
 
         * operation/agentes/ver_agente.php: Added code to support new
diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
index dca2a9706d..c2d7e4e782 100644
--- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
+++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
@@ -55,6 +55,7 @@ ALTER TABLE `tincidencia` ADD COLUMN `id_agent` int(10) unsigned NULL default 0;
 -- Table `tagente`
 -- -----------------------------------------------------
 ALTER TABLE `tagente` ADD COLUMN `url_address` mediumtext NULL;
+ALTER TABLE `tagente` ADD COLUMN `quiet` tinyint(1) NOT NULL DEFAULT '0';
 
 -- -----------------------------------------------------
 -- Table `talert_special_days`
@@ -86,20 +87,22 @@ ALTER TABLE tplanned_downtime_agents
 -- Table `tevento`
 -- -----------------------------------------------------
 ALTER TABLE `tevento` ADD COLUMN (`source` tinytext NOT NULL,
-`id_extra` tinytext NOT NULL);
+	`id_extra` tinytext NOT NULL);
 
 -- -----------------------------------------------------
 -- Table `talert_snmp`
 -- -----------------------------------------------------
 ALTER TABLE `talert_snmp` ADD COLUMN (`_snmp_f1_` text, `_snmp_f2_` text, `_snmp_f3_` text,
-`_snmp_f4_` text, `_snmp_f5_` text, `_snmp_f6_` text, `trap_type` int(11) NOT NULL default '-1',
-`single_value` varchar(255) DEFAULT '');
+	`_snmp_f4_` text, `_snmp_f5_` text, `_snmp_f6_` text, `trap_type` int(11) NOT NULL default '-1',
+	`single_value` varchar(255) DEFAULT '');
 
 -- -----------------------------------------------------
 -- Table `tagente_modulo`
 -- -----------------------------------------------------
 ALTER TABLE `tagente_modulo` ADD COLUMN `module_ff_interval` int(4) unsigned default '0';
 ALTER TABLE `tagente_modulo` CHANGE COLUMN `post_process` `post_process` double(18,5) default NULL;
+ALTER TABLE `tagente_modulo` ADD COLUMN `wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard';
+ALTER TABLE `tagente_modulo` ADD COLUMN `macros` text;
 
 -- -----------------------------------------------------
 -- Table `tnetwork_component`
@@ -244,12 +247,6 @@ ALTER TABLE tnetwork_component ADD `wizard_level` enum('basic','advanced','custo
 ALTER TABLE tnetwork_component ADD `only_metaconsole` tinyint(1) unsigned default '0';
 ALTER TABLE tnetwork_component ADD `macros` text;
 
--- -----------------------------------------------------
--- Table `tagente_modulo`
--- -----------------------------------------------------
-ALTER TABLE tagente_modulo ADD `wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard';
-ALTER TABLE tagente_modulo ADD `macros` text;
-
 -- -----------------------------------------------------
 -- Table `tplugin`
 -- -----------------------------------------------------
diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
index 2ebab6b8b8..7d390f7a4d 100644
--- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
+++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
@@ -74,6 +74,7 @@ alter table tincidencia add (id_agent NUMBER(10,0) default 0 NULL);
 -- Table `tagente`
 -- -----------------------------------------------------
 alter table tagente add (url_address CLOB default '' NULL);
+alter table tagente add (quiet NUMBER(5, 0) default 0 NOT NULL);
 
 -- -----------------------------------------------------
 -- Table `talert_special_days`
diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql
index d430cf4700..7d18c2c590 100644
--- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql
+++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql
@@ -62,14 +62,13 @@ CREATE TABLE "tnetflow_report_content" (
 -- -----------------------------------------------------
 -- Table `tincidencia`
 -- -----------------------------------------------------
-
 ALTER TABLE "tincidencia" ADD COLUMN "id_agent" INTEGER NULL DEFAULT 0;
 
 -- -----------------------------------------------------
 -- Table `tagente`
 -- -----------------------------------------------------
-
 ALTER TABLE "tagente" ADD COLUMN "url_address" text NULL default '';
+ALTER TABLE "tagente" ADD COLUMN "quiet" SMALLINT NOT NULL default 0;
 
 -- -----------------------------------------------------
 -- Table `talert_special_days`
diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php
index 1d74198f47..8f064d5401 100644
--- a/pandora_console/godmode/agentes/agent_manager.php
+++ b/pandora_console/godmode/agentes/agent_manager.php
@@ -14,7 +14,6 @@
 // GNU General Public License for more details.
 
 if (is_ajax ()) {
-	
 	global $config;
 	
 	$search_parents = (bool) get_parameter ('search_parents');
@@ -28,7 +27,7 @@ if (is_ajax ()) {
 		
 		$filter = array ();
 		
-		switch ($config['dbtype']){
+		switch ($config['dbtype']) {
 			case "mysql":
 			case "postgresql":
 				$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
@@ -58,7 +57,7 @@ if (is_ajax ()) {
 		
 		$filter = array ();
 		
-		switch ($config['dbtype']){
+		switch ($config['dbtype']) {
 			case "mysql":
 			case "postgresql":
 				$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
@@ -96,8 +95,8 @@ if (is_ajax ()) {
 		
 		$oid_snmp = array();
 		$out = false;
-		foreach($idSNMP as $id) {
-			foreach($snmp[$id] as $key => $value){
+		foreach ($idSNMP as $id) {
+			foreach ($snmp[$id] as $key => $value){
 				
 				// Check if it has "ifXXXX" syntax and skip it 
 				if (! preg_match  ( "/if/", $key)) {
@@ -107,7 +106,7 @@ if (is_ajax ()) {
 				$oid_snmp[$value['oid']] = $key;
 			}
 			
-			if($out === false){
+			if ($out === false) {
 				$out = $oid_snmp;
 			}
 			else{
@@ -341,9 +340,13 @@ if ($config['activate_gis']) {
 			$update_gis_data, false, '', 'style="margin-right: 40px;"', true);
 }
 
-$table->data[6][0] = __('Url address:');
+$table->data[6][0] = __('Url address');
 $table->data[6][1] = html_print_input_text ('url_description', $url_description, '', 45, 255, true);
 
+$table->data[7][0] = __('Quiet');
+$table->data[7][0] .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true);
+$table->data[7][1] = html_print_checkbox('quiet', 1, $quiet, true);
+
 ui_toggle(html_print_table ($table, true), __('Advanced options'));
 unset($table);
 
diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php
index 0c7222a7c4..7791973d7c 100644
--- a/pandora_console/godmode/agentes/configurar_agente.php
+++ b/pandora_console/godmode/agentes/configurar_agente.php
@@ -124,6 +124,7 @@ $unit = "";
 $id_tag = array();
 $tab_description = '';
 $url_description = '';
+$quiet = 0;
 $macros = '';
 
 $create_agent = (bool) get_parameter ('create_agent');
@@ -146,6 +147,7 @@ if ($create_agent) {
 	$icon_path = (string) get_parameter_post ("icon_path",'');
 	$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
 	$url_description = (string) get_parameter("url_description");
+	$quiet = (int) get_parameter("quiet", 0);
 	
 	$fields = db_get_all_fields_in_table('tagent_custom_fields');
 	
@@ -179,7 +181,8 @@ if ($create_agent) {
 				'id_parent' => $id_parent, 'custom_id' => $custom_id,
 				'icon_path' => $icon_path,
 				'update_gis_data' => $update_gis_data,
-				'url_address' => $url_description));
+				'url_address' => $url_description,
+				'quiet' => $quiet));
 		enterprise_hook ('update_agent', array ($id_agente));
 		if ($id_agente !== false) {
 			// Create custom fields for this agent
@@ -197,9 +200,12 @@ if ($create_agent) {
 				' Comments: ' . $comentarios . ' Mode: ' . $modo .
 				' ID_parent: ' . $id_parent . ' Server: ' . $server_name .
 				' ID os: ' . $id_os . ' Disabled: ' . $disabled .
-				' Custom ID: ' . $custom_id . ' Cascade protection: '  . $cascade_protection . 
-				' Icon path: ' . $icon_path . ' Update GIS data: ' . $update_gis_data . 
-				' Url description: ' . $url_description;
+				' Custom ID: ' . $custom_id .
+				' Cascade protection: '  . $cascade_protection . 
+				' Icon path: ' . $icon_path .
+				' Update GIS data: ' . $update_gis_data . 
+				' Url description: ' . $url_description .
+				' Quiet: ' . (int)$quiet;
 			
 			db_pandora_audit("Agent management",
 				"Created agent $nombre_agente", false, false, $info);
@@ -275,8 +281,8 @@ if ($id_agente) {
 	
 	 
 	$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration',array($id_agente));
-
-	if($has_remote_conf === true) {
+	
+	if ($has_remote_conf === true) {
 		/* Plugins */
 		$pluginstab = enterprise_hook ('plugins_tab');
 		if ($pluginstab == -1)
@@ -497,13 +503,14 @@ if ($update_agent) { // if modified some agent paramenter
 	$id_os = (int) get_parameter_post ("id_os");
 	$disabled = (bool) get_parameter_post ("disabled");
 	$server_name = (string) get_parameter_post ("server_name", "");
-	$id_parent = (string) get_parameter_post ("id_parent");
-	$id_parent = (int) agents_get_agent_id ($id_parent);
+	$parent_name = (string) get_parameter_post ("id_parent");
+	$id_parent = (int) agents_get_agent_id ($parent_name);
 	$custom_id = (string) get_parameter_post ("custom_id", "");
 	$cascade_protection = (int) get_parameter_post ("cascade_protection", 0);
 	$icon_path = (string) get_parameter_post ("icon_path",'');
 	$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
 	$url_description = (string) get_parameter("url_description");
+	$quiet = (int) get_parameter("quiet", 0);
 	
 	$fields = db_get_all_fields_in_table('tagent_custom_fields');
 	
@@ -552,7 +559,7 @@ if ($update_agent) { // if modified some agent paramenter
 			$delete_ip = get_parameter_post ("address_list");
 			agents_delete_address ($id_agente, $delete_ip);
 		}
-	
+		
 		$result = db_process_sql_update ('tagente', 
 			array ('disabled' => $disabled,
 				'id_parent' => $id_parent,
@@ -568,7 +575,8 @@ if ($update_agent) { // if modified some agent paramenter
 				'custom_id' => $custom_id,
 				'icon_path' => $icon_path,
 				'update_gis_data' => $update_gis_data,
-				'url_address' => $url_description),
+				'url_address' => $url_description,
+				'quiet' => $quiet),
 			array ('id_agente' => $id_agente));
 			
 		if ($result === false) {
@@ -582,7 +590,8 @@ if ($update_agent) { // if modified some agent paramenter
 				' Server Name: ' . $server_name . ' ID parent: ' . $id_parent .
 				' Custom ID: ' . $custom_id . ' Cascade Protection: ' . $cascade_protection .
 				' Icon Path: ' . $icon_path . 'Update GIS data: ' .$update_gis_data .
-				' Url description: ' . $url_description;
+				' Url description: ' . $url_description .
+				' Quiet: ' . (int)$quiet;
 			
 			enterprise_hook ('update_agent', array ($id_agente));
 			ui_print_success_message (__('Successfully updated'));
@@ -631,6 +640,7 @@ if ($id_agente) {
 	$icon_path = $agent["icon_path"];
 	$update_gis_data = $agent["update_gis_data"];
 	$url_description = $agent["url_address"];
+	$quiet = $agent["quiet"];
 }
 
 $update_module = (bool) get_parameter ('update_module');
@@ -690,14 +700,14 @@ if ($update_module || $create_module) {
 	
 	// Get macros
 	$macros = (string) get_parameter ('macros');
-
-	if(!empty($macros)) {
+	
+	if (!empty($macros)) {
 		$macros = json_decode(base64_decode($macros), true);
-
+		
 		foreach($macros as $k => $m) {
 			$macros[$k]['value'] = get_parameter($m['macro'], '');
 		}
-
+		
 		$macros = json_encode($macros);
 	}
 	
@@ -873,7 +883,7 @@ if ($create_module) {
 	switch ($config["dbtype"]) {
 		case "oracle":
 			if (empty($description) || !isset($description)) {
-				$description=' ';
+				$description = ' ';
 			}
 			break;
 	}
@@ -918,15 +928,15 @@ if ($create_module) {
 		'unit' => $unit,
 		'macros' => $macros);
 	
-	if($prediction_module == 3 && $serialize_ops == '') {
+	if ($prediction_module == 3 && $serialize_ops == '') {
 		$id_agent_module = false;
 	}
 	else {
 		$id_agent_module = modules_create_agent_module ($id_agente, $name, $values, false, $id_tag);
 	}
-
+	
 	if (is_error($id_agent_module)) {
-		switch($id_agent_module) {
+		switch ($id_agent_module) {
 			case ERR_EXIST:
 				$msg = __('There was a problem adding module. Another module already exists with the same name.');
 				break;
@@ -947,7 +957,7 @@ if ($create_module) {
 			"Fail to try added module '$name' for agent ".$agent["nombre"]);
 	}
 	else {
-		if($prediction_module == 3) {
+		if ($prediction_module == 3) {
 			enterprise_hook('modules_create_synthetic_operations', array($id_agent_module, $serialize_ops));
 		}
 		
@@ -1217,4 +1227,4 @@ switch ($tab) {
 		}
 		break;
 }
-?>
+?>
\ No newline at end of file
diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php
index 660ccd26e5..deefae1945 100644
--- a/pandora_console/godmode/agentes/modificar_agente.php
+++ b/pandora_console/godmode/agentes/modificar_agente.php
@@ -252,12 +252,12 @@ if ($ag_group > 0) {
 else {
 	// CLEAN: sql_extra
 	$sql_extra = '';
-		
-    // Admin user get ANY group, even if they doesnt exist
-    if (check_acl ($config['id_user'], 0, "PM")) {		
-	    $sql = sprintf ('SELECT COUNT(*) FROM tagente WHERE (1=1 %s) %s', $search_sql, $sql_extra);
-	    $total_agents = db_get_sql ($sql);
-    	switch ($config["dbtype"]) {
+	
+	// Admin user get ANY group, even if they doesnt exist
+	if (check_acl ($config['id_user'], 0, "PM")) {		
+		$sql = sprintf ('SELECT COUNT(*) FROM tagente WHERE (1=1 %s) %s', $search_sql, $sql_extra);
+		$total_agents = db_get_sql ($sql);
+		switch ($config["dbtype"]) {
 			case "mysql":
 				$sql = sprintf ('SELECT *
 					FROM tagente WHERE (1=1 %s) %s
@@ -280,15 +280,15 @@ else {
 				$sql = oracle_recode_query ($sql, $set);
 				break;
 		}
-    }
-    else {
+	}
+	else {
 		$sql = sprintf ('SELECT COUNT(*)
 			FROM tagente
 			WHERE (id_grupo IN (%s)
 			%s) %s',
 			implode (',', array_keys (users_get_groups ())),
 			$search_sql, $sql_extra);    
-			
+		
 		$total_agents = db_get_sql ($sql);
 		
 		switch ($config["dbtype"]) {
@@ -324,7 +324,7 @@ else {
 				$sql = oracle_recode_query ($sql, $set);
 				break;
 		}
-   }
+	}
 }
 
 $agents = db_get_all_rows_sql ($sql);
@@ -365,7 +365,7 @@ if ($agents !== false) {
 	foreach ($agents as $agent) {
 		$id_grupo = $agent["id_grupo"];
 		$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($agent["id_agente"]));
-
+		
 		if($is_extra === ENTERPRISE_NOT_HOOK) {
 			$is_extra = false;
 		}
@@ -394,11 +394,17 @@ if ($agents !== false) {
 			echo "<em>";
 		}
 		echo '<span class="left">';
-		echo "<strong><a href='index.php?sec=gagente&
+		echo "<strong>";
+		if ($agent['quiet']) {
+			html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => ""));
+			echo "&nbsp;";
+		}
+		echo "<a href='index.php?sec=gagente&
 			sec2=godmode/agentes/configurar_agente&tab=main&
 			id_agente=" . $agent["id_agente"] . "'>" .
 			ui_print_truncate_text($agent["nombre"], 'agent_medium', true, true, true, '[&hellip;]', 'font-size: 7pt') .
-			"</a></strong>";
+			"</a>";
+		echo "</strong>";
 		if ($agent["disabled"]) {
 			ui_print_help_tip(__('Disabled'));
 			echo "</em>";
diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php
index 6ac9cdf080..405e3560a4 100644
--- a/pandora_console/operation/agentes/estado_agente.php
+++ b/pandora_console/operation/agentes/estado_agente.php
@@ -47,7 +47,7 @@ if (is_ajax ()) {
 		
 		$filter_groups = '';
 		$filter_groups = implode(',', array_keys($usr_groups));		
-
+		
 		switch ($config["dbtype"]) {
 			case "mysql":
 				$sql = sprintf ("SELECT t1.id, t1.name,
@@ -325,11 +325,11 @@ switch ($sortField) {
 }
 
 $search_sql = '';
-if ($search != ""){
+if ($search != "") {
 	$search_sql = " AND ( nombre COLLATE utf8_general_ci LIKE '%$search%' OR direccion LIKE '%$search%' OR comentarios LIKE '%$search%') ";
 }
 
-// Show only selected groups	
+// Show only selected groups
 if ($group_id > 0) {
 	$groups = array($group_id);
 	if ($recursion) {
@@ -361,13 +361,13 @@ $agents = agents_get_agents(array (
 	'search' => $search_sql,
 	'offset' => (int) get_parameter ('offset'),
 	'limit' => (int) $config['block_size']  ),
-
+	
 	array ('id_agente',
 		'id_grupo',
 		'id_os',
 		'ultimo_contacto',
 		'intervalo',
-		'comentarios description'),
+		'comentarios description', 'quiet'),
 	'AR',
 	$order);
 
@@ -457,6 +457,9 @@ foreach ($agents as $agent) {
 	
 	$data[0] = '';
 	$data[0] .= '<span class="left">';
+	if ($agent['quiet']) {
+		$data[0] .= html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . "&nbsp;";
+	}
 	$data[0] .= ui_print_agent_name($agent["id_agente"], true, 60, 'font-size:6.5pt !important;', true);
 	$data[0] .= '</span>';
 	$data[0] .= '<div class="left actions" style="visibility: hidden; clear: left">';
diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php
index e29bdb5ee0..9b557648f8 100644
--- a/pandora_console/operation/agentes/estado_generalagente.php
+++ b/pandora_console/operation/agentes/estado_generalagente.php
@@ -45,7 +45,7 @@ if($is_extra === ENTERPRISE_NOT_HOOK) {
 
 if (! check_acl ($config["id_user"], $agent["id_grupo"], "AR") && !$is_extra) {
 	db_pandora_audit("ACL Violation", 
-			  "Trying to access Agent General Information");
+		"Trying to access Agent General Information");
 	require_once ("general/noaccess.php");
 	return;
 }
@@ -59,7 +59,7 @@ echo '<div style="height: 10px">&nbsp;</div>';
 
 if ($config["agentaccess"]){
 	echo '<b>'.__('Agent access rate (24h)').'</b><br />';
-
+	
 	graphic_agentaccess($id_agente, 280, 110, 86400);
 }
 
@@ -70,7 +70,7 @@ echo '<br>';
 graph_graphic_agentevents ($id_agente, 290, 15, 86400, '');
 
 echo '</div>';
-	
+
 echo '<div width="450px">';
 echo '<table cellspacing="4" cellpadding="4" border="0" class="databox" style="width:53%">';
 //Agent name
@@ -78,9 +78,14 @@ echo '<tr><td class="datos"><b>'.__('Agent name').'</b></td>';
 if ($agent['disabled']) {
 	$cellName = "<em>" . ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true) . ui_print_help_tip(__('Disabled'), true) . "</em>";
 }
+else if ($agent['quiet']) {
+	$cellName = "<em>" . ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true) .
+	"&nbsp;" . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . "</em>";
+}
 else {
 	$cellName = ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true);
 }
+
 echo '<td class="datos"><b>'.$cellName.'</b></td>';
 echo '<td class="datos" width="40"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'&amp;refr=60">' . html_print_image("images/refresh.png", true, array("border" => '0', "title" => __('Refresh data'), "alt" => "")) . '</a>&nbsp;';
 echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;flag_agent=1&amp;id_agente='.$id_agente.'">' . html_print_image("images/target.png", true, array("border" => '0', "title" => __('Force'), "alt" => "")) . '</a></td></tr>';
diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php
index ec8117e36a..264c99633d 100644
--- a/pandora_console/operation/agentes/ver_agente.php
+++ b/pandora_console/operation/agentes/ver_agente.php
@@ -301,10 +301,10 @@ if (is_ajax ()) {
 		foreach($agent_modules as $key => $module) {
 			$agent_modules[$key]['nombre'] = io_safe_output($module['nombre']);
 		}
-			
+		
 		//Hack to translate text "any" in PHP to javascript
 		//$agent_modules['any_text'] = __('Any');
-
+		
 		echo json_encode ($agent_modules);
 		return;
 	}
@@ -317,7 +317,7 @@ if (is_ajax ()) {
 		echo '<strong>'.__('Group').':</strong> ';
 		echo html_print_image('images/groups_small/'.groups_get_icon ($agent['id_grupo']).'.png', true); 
 		echo groups_get_name ($agent['id_grupo']).'<br />';
-
+		
 		echo '<strong>'.__('Last contact').':</strong> '.human_time_comparation($agent['ultimo_contacto']).'<br />';
 		echo '<strong>'.__('Last remote contact').':</strong> '.human_time_comparation($agent['ultimo_contacto_remoto']).'<br />';
 		
@@ -518,33 +518,33 @@ else {
 }
 
 
+///-------------Code for the tabs in the header of agent page-----------
 $tab = get_parameter ("tab", "main");
 
 /* Manage tab */
-
 $managetab = "";
-
 if (check_acl ($config['id_user'],$id_grupo, "AW") || $is_extra) {
 	$managetab['text'] ='<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'">'
 		. html_print_image("images/setup.png", true, array ("title" => __('Manage')))
 		. '</a>';
-
+	
 	if ($tab == 'manage')
 		$managetab['active'] = true;
 	else
 		$managetab['active'] = false;
 }
 
+
 /* Main tab */
 $maintab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">'
-		. html_print_image("images/monitor.png", true, array("title" => __('Main')))
-		. '</a>';
-		
+	. html_print_image("images/monitor.png", true, array("title" => __('Main')))
+	. '</a>';
 if ($tab == 'main')
 	$maintab['active'] = true;
 else
 	$maintab['active'] = false;
-	
+
+
 /* Data */
 $datatab['text']= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&tab=data">'
 	. html_print_image("images/lightbulb.png", true, array("title" => __('Data')))
@@ -555,21 +555,21 @@ if (($tab == 'data') OR ($tab == 'data_view'))
 else
 	$datatab['active'] = false;
 
+
 /* Alert tab */
 $alerttab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&tab=alert">'
-		. html_print_image("images/bell.png", true, array("title" => __('Alerts')))
-		. '</a>';
-		
+	. html_print_image("images/bell.png", true, array("title" => __('Alerts')))
+	. '</a>';
 if ($tab == 'alert')
 	$alerttab['active'] = true;
 else
 	$alerttab['active'] = false;
-	
+
+
 /* SLA view */
 $slatab['text']= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=sla&id_agente='.$id_agente.'">'
-		. html_print_image("images/images.png", true, array("title" => __('S.L.A.')))
-		. '</a>';
-
+	. html_print_image("images/images.png", true, array("title" => __('S.L.A.')))
+	. '</a>';
 if ($tab == 'sla') {
 	$slatab['active'] = true;
 }
@@ -577,35 +577,35 @@ else {
 	$slatab['active'] = false;
 }
 
+
 /* Inventory */
 $inventorytab = enterprise_hook ('inventory_tab');
-
 if ($inventorytab == -1)
 	$inventorytab = "";
 
+
 /* Collection */
 $collectiontab = enterprise_hook('collection_tab');
-
 if ($collectiontab == -1)
 	$collectiontab = "";
-	
+
+
 /* Policy */
 $policyTab = enterprise_hook('policy_tab');
 if ($policyTab == -1)
 	$policyTab = "";
 
-/* Group tab */
 
+/* Group tab */
 $grouptab['text']= '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id='.$id_grupo.'">'
 	. html_print_image("images/agents_group.png", true, array( "title" =>  __('Group')))
 	. '</a>';
-	
 $grouptab['active']=false;
 
+
 /* GIS tab */
 $gistab="";
 if ($config['activate_gis']) {
-	
 	$gistab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente='.$id_agente.'">'
 		.html_print_image("images/world.png", true, array( "title" => __('GIS data')))
 		.'</a>';
@@ -616,41 +616,37 @@ if ($config['activate_gis']) {
 		$gistab['active'] = false;
 }
 
-$total_incidents = agents_get_count_incidents($id_agente);
 
 /* Incident tab */
-if ($config['integria_enabled'] == 0 and $total_incidents > 0){
+$total_incidents = agents_get_count_incidents($id_agente);
+if ($config['integria_enabled'] == 0 and $total_incidents > 0) {
 	$incidenttab['text'] = '<a href="index.php?sec=gagente&amp;sec2=operation/agentes/ver_agente&tab=incident&id_agente='.$id_agente.'">' 
-			. html_print_image ("images/book_edit.png", true, array ("title" =>__('Incidents')))
-			. '</a>';
+		. html_print_image ("images/book_edit.png", true, array ("title" =>__('Incidents')))
+		. '</a>';
 	
-	if($tab == 'incident')
+	if ($tab == 'incident')
 		$incidenttab['active'] = true;
 	else
 		$incidenttab['active'] = false;
-}	
-	
-$custom_fields['text']= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=custom_fields&id_agente='.$id_agente.'">'
-		. html_print_image("images/note.png", true, array("title" => __('Custom fields')))
-		. '</a>';
+}
+
 
 /* Url address tab */
-if ($agent['url_address'] != ''){
+if ($agent['url_address'] != '') {
 	$urladdresstab['text'] = '<a href="index.php?sec=gagente&amp;sec2=operation/agentes/ver_agente&tab=url_address&id_agente='.$id_agente.'">' 
 		. html_print_image ("images/link2.png", true, array ("title" =>__('Url address')))
 		. '</a>';
 }
-
-if($tab == 'url_address')
+if ($tab == 'url_address')
 	$urladdresstab['active'] = true;
 else
 	$urladdresstab['active'] = false;
-	
-$custom_fields['text']= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=custom_fields&id_agente='.$id_agente.'">'
-		. html_print_image("images/note.png", true, array("title" => __('Custom fields')))
-		. '</a>';
 
 
+/* Custom fields tab */
+$custom_fields['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=custom_fields&id_agente='.$id_agente.'">'
+	. html_print_image("images/note.png", true, array("title" => __('Custom fields')))
+	. '</a>';
 if ($tab == 'custom_fields') {
 	$custom_fields['active'] = true;
 }
@@ -658,9 +654,11 @@ else {
 	$custom_fields['active'] = false;
 }
 
+
+/* Graphs tab */
 $graphs['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=graphs&id_agente='.$id_agente.'">'
-		. html_print_image("images/chart_curve.png", true, array("title" => __('Graphs')))
-		. '</a>';
+	. html_print_image("images/chart_curve.png", true, array("title" => __('Graphs')))
+	. '</a>';
 if ($tab == 'graphs') {
 	$graphs['active'] = true;
 }
@@ -669,20 +667,30 @@ else {
 }
 
 
-$onheader = array('manage' => $managetab, 'separator' => "", 'main' => $maintab, 
-				'data' => $datatab, 'alert' => $alerttab, 'sla' => $slatab, 
-				'inventory' => $inventorytab, 'collection' => $collectiontab, 
-				'group' => $grouptab, 'gis' => $gistab, 'custom' => $custom_fields, 'graphs' => $graphs, 'policy' => $policyTab);
+$onheader = array('manage' => $managetab,
+	'separator' => "",
+	'main' => $maintab, 
+	'data' => $datatab,
+	'alert' => $alerttab,
+	'sla' => $slatab, 
+	'inventory' => $inventorytab,
+	'collection' => $collectiontab, 
+	'group' => $grouptab,
+	'gis' => $gistab,
+	'custom' => $custom_fields,
+	'graphs' => $graphs,
+	'policy' => $policyTab);
 
-// If the agent has incidents associated				
-if ($total_incidents){
+//Added after it exists
+// If the agent has incidents associated
+if ($total_incidents) {
 	$onheader['incident'] = $incidenttab;
 }
-
-if ($agent['url_address'] != ''){
-	$onheader['url_address'] = $urladdresstab;	
+if ($agent['url_address'] != '') {
+	$onheader['url_address'] = $urladdresstab;
 }
 
+//Tabs for extensions
 foreach($config['extensions'] as $extension) {
 	if (isset($extension['extension_ope_tab'])) {
 		
@@ -849,5 +857,4 @@ switch ($tab) {
 		}
 		break;
 }
-
-?>
+?>
\ No newline at end of file
diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql
index ff5d9b8e2f..02790474c2 100644
--- a/pandora_console/pandoradb.oracle.sql
+++ b/pandora_console/pandoradb.oracle.sql
@@ -78,7 +78,8 @@ CREATE TABLE tagente (
 	icon_path VARCHAR2(127) DEFAULT NULL NULL ,
 	 --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 don\'t update it
 	update_gis_data NUMBER(5, 0) DEFAULT 1 NOT NULL,
-	url_address CLOB DEFAULT '' NULL 
+	url_address CLOB DEFAULT '' NULL,
+	quiet NUMBER(5, 0) default 0 NOT NULL
 );
 CREATE INDEX tagente_nombre_idx ON tagente(nombre);
 CREATE INDEX tagente_direccion_idx ON tagente(direccion);
diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql
index b73dbda63e..73bf520f53 100644
--- a/pandora_console/pandoradb.postgreSQL.sql
+++ b/pandora_console/pandoradb.postgreSQL.sql
@@ -76,7 +76,8 @@ CREATE TABLE "tagente" (
 	"icon_path" VARCHAR(127) NULL DEFAULT NULL,
 	 --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 don\'t update it
 	"update_gis_data" SMALLINT NOT NULL DEFAULT 1,
-	"url_address" TEXT  NULL default ''
+	"url_address" TEXT  NULL default '',
+	"quiet" SMALLINT NOT NULL default 0
 );
 CREATE INDEX "tagente_nombre_idx" ON "tagente"("nombre");
 CREATE INDEX "tagente_direccion_idx" ON "tagente"("direccion");
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index c4a3a5c014..79c4ad3b2f 100644
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -18,6 +18,12 @@
 -- Because Pandora Installer don't understand them
 -- and fails creating database !!!
 
+-- Priority : 0 - Maintance (grey)
+-- Priority : 1 - Low (green)
+-- Priority : 2 - Normal (blue)
+-- Priority : 3 - Warning (yellow)
+-- Priority : 4 - Critical (red)
+
 -- -----------------------------------------------------
 -- Table `taddress`
 -- -----------------------------------------------------
@@ -64,6 +70,7 @@ CREATE TABLE IF NOT EXISTS `tagente` (
 	`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' ,
 	`url_address` mediumtext NULL,
+	`quiet` tinyint(1) NOT NULL default '0',
 	PRIMARY KEY  (`id_agente`),
 	KEY `nombre` (`nombre`),
 	KEY `direccion` (`direccion`),
@@ -146,13 +153,11 @@ CREATE TABLE `tagente_estado` (
 	KEY `running_by` (`running_by`),
 	KEY `last_execution_try` (`last_execution_try`)
 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
-
 -- Probably last_execution_try index is not useful and loads more than benefits
 
 -- -----------------------------------------------------
 -- Table `tagente_modulo`
 -- -----------------------------------------------------
-
 -- id_modulo now uses tmodule 
 -- ---------------------------
 -- 1 - Data server modules (agent related modules)
@@ -416,103 +421,118 @@ CREATE TABLE IF NOT EXISTS `talert_compound` (
 		ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+-- -----------------------------------------------------
+-- Table `talert_compound_elements`
+-- -----------------------------------------------------
 CREATE TABLE  IF NOT EXISTS `talert_compound_elements` (
-  `id_alert_compound` int(10) unsigned NOT NULL,
-  `id_alert_template_module` int(10) unsigned NOT NULL,
-  `operation` enum('NOP', 'AND','OR','XOR','NAND','NOR','NXOR'),
-  `order` tinyint(2) unsigned default 0,
-  UNIQUE  (`id_alert_compound`, `id_alert_template_module`, `operation`),
-  FOREIGN KEY (`id_alert_compound`) REFERENCES talert_compound(`id`)
-    ON DELETE CASCADE ON UPDATE CASCADE,
-  FOREIGN KEY (`id_alert_template_module`) REFERENCES talert_template_modules(`id`)
-    ON DELETE CASCADE ON UPDATE CASCADE
+	`id_alert_compound` int(10) unsigned NOT NULL,
+	`id_alert_template_module` int(10) unsigned NOT NULL,
+	`operation` enum('NOP', 'AND','OR','XOR','NAND','NOR','NXOR'),
+	`order` tinyint(2) unsigned default 0,
+	UNIQUE  (`id_alert_compound`, `id_alert_template_module`, `operation`),
+	FOREIGN KEY (`id_alert_compound`) REFERENCES talert_compound(`id`)
+		ON DELETE CASCADE ON UPDATE CASCADE,
+	FOREIGN KEY (`id_alert_template_module`) REFERENCES talert_template_modules(`id`)
+		ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+-- -----------------------------------------------------
+-- Table `talert_compound_actions`
+-- -----------------------------------------------------
 CREATE TABLE IF NOT EXISTS `talert_compound_actions` (
-  `id` int(10) unsigned NOT NULL auto_increment,
-  `id_alert_compound` int(10) unsigned NOT NULL,
-  `id_alert_action` int(10) unsigned NOT NULL,
-  `fires_min` int(3) unsigned default 0,
-  `fires_max` int(3) unsigned default 0,
-  PRIMARY KEY (`id`),
-  FOREIGN KEY (`id_alert_compound`) REFERENCES talert_compound(`id`)
-    ON DELETE CASCADE ON UPDATE CASCADE,
-  FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)
-    ON DELETE CASCADE ON UPDATE CASCADE
+	`id` int(10) unsigned NOT NULL auto_increment,
+	`id_alert_compound` int(10) unsigned NOT NULL,
+	`id_alert_action` int(10) unsigned NOT NULL,
+	`fires_min` int(3) unsigned default 0,
+	`fires_max` int(3) unsigned default 0,
+	PRIMARY KEY (`id`),
+	FOREIGN KEY (`id_alert_compound`) REFERENCES talert_compound(`id`)
+		ON DELETE CASCADE ON UPDATE CASCADE,
+	FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)
+		ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+-- -----------------------------------------------------
+-- Table `talert_special_days`
+-- -----------------------------------------------------
 CREATE TABLE IF NOT EXISTS `talert_special_days` (
-  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
-  `date` date NOT NULL DEFAULT '0000-00-00',
-  `same_day` enum('monday','tuesday','wednesday','thursday','friday','saturday','sunday') NOT NULL DEFAULT 'sunday',
-  `description` text,
-  PRIMARY KEY (`id`)
+	`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+	`date` date NOT NULL DEFAULT '0000-00-00',
+	`same_day` enum('monday','tuesday','wednesday','thursday','friday','saturday','sunday') NOT NULL DEFAULT 'sunday',
+	`description` text,
+	PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
--- Priority : 0 - Maintance (grey)
--- Priority : 1 - Low (green)
--- Priority : 2 - Normal (blue)
--- Priority : 3 - Warning (yellow)
--- Priority : 4 - Critical (red)
-
+-- -----------------------------------------------------
+-- Table `tattachment`
+-- -----------------------------------------------------
 CREATE TABLE IF NOT EXISTS `tattachment` (
-  `id_attachment` int(10) unsigned NOT NULL auto_increment,
-  `id_incidencia` int(10) unsigned NOT NULL default '0',
-  `id_usuario` varchar(60) NOT NULL default '',
-  `filename` varchar(255) NOT NULL default '',
-  `description` varchar(150) default '',
-  `size` bigint(20) unsigned NOT NULL default '0',
-  PRIMARY KEY  (`id_attachment`)
+	`id_attachment` int(10) unsigned NOT NULL auto_increment,
+	`id_incidencia` int(10) unsigned NOT NULL default '0',
+	`id_usuario` varchar(60) NOT NULL default '',
+	`filename` varchar(255) NOT NULL default '',
+	`description` varchar(150) default '',
+	`size` bigint(20) unsigned NOT NULL default '0',
+	PRIMARY KEY  (`id_attachment`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+-- -----------------------------------------------------
+-- Table `tconfig`
+-- -----------------------------------------------------
 CREATE TABLE IF NOT EXISTS `tconfig` (
-  `id_config` int(10) unsigned NOT NULL auto_increment,
-  `token` varchar(100) NOT NULL default '',
-  `value` text NOT NULL,
-  PRIMARY KEY  (`id_config`)
+	`id_config` int(10) unsigned NOT NULL auto_increment,
+	`token` varchar(100) NOT NULL default '',
+	`value` text NOT NULL,
+	PRIMARY KEY  (`id_config`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
-
+-- -----------------------------------------------------
+-- Table `tconfig_os`
+-- -----------------------------------------------------
 CREATE TABLE IF NOT EXISTS  `tconfig_os` (
-  `id_os` int(10) unsigned NOT NULL auto_increment,
-  `name` varchar(100) NOT NULL default '',
-  `description` varchar(250) default '',
-  `icon_name` varchar(100) default '',
-  PRIMARY KEY  (`id_os`)
+	`id_os` int(10) unsigned NOT NULL auto_increment,
+	`name` varchar(100) NOT NULL default '',
+	`description` varchar(250) default '',
+	`icon_name` varchar(100) default '',
+	PRIMARY KEY  (`id_os`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
-
+-- -----------------------------------------------------
+-- Table `tevento`
+-- -----------------------------------------------------
 CREATE TABLE IF NOT EXISTS `tevento` (
-  `id_evento` bigint(20) unsigned NOT NULL auto_increment,
-  `id_agente` int(10) NOT NULL default '0',
-  `id_usuario` varchar(100) NOT NULL default '0',
-  `id_grupo` mediumint(4) NOT NULL default '0',
-  `estado` tinyint(3) unsigned NOT NULL default '0',
-  `timestamp` datetime NOT NULL default '1970-01-01 00:00:00',
-  `evento` text NOT NULL,
-  `utimestamp` bigint(20) NOT NULL default '0',
-  `event_type` enum('unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal', 'configuration_change') default 'unknown',
-  `id_agentmodule` int(10) NOT NULL default '0',
-  `id_alert_am` int(10) NOT NULL default '0',
-  `criticity` int(4) unsigned NOT NULL default '0',
-  `user_comment` text NOT NULL,
-  `tags` text NOT NULL,
-  `source` tinytext NOT NULL,
-  `id_extra` tinytext NOT NULL,
-  PRIMARY KEY  (`id_evento`),
-  KEY `indice_1` (`id_agente`,`id_evento`),
-  KEY `indice_2` (`utimestamp`,`id_evento`),
-  KEY `idx_agentmodule` (`id_agentmodule`),
-  INDEX criticity (`criticity`),
-  INDEX estado (`estado`)
+	`id_evento` bigint(20) unsigned NOT NULL auto_increment,
+	`id_agente` int(10) NOT NULL default '0',
+	`id_usuario` varchar(100) NOT NULL default '0',
+	`id_grupo` mediumint(4) NOT NULL default '0',
+	`estado` tinyint(3) unsigned NOT NULL default '0',
+	`timestamp` datetime NOT NULL default '1970-01-01 00:00:00',
+	`evento` text NOT NULL,
+	`utimestamp` bigint(20) NOT NULL default '0',
+	`event_type` enum('unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal', 'configuration_change') default 'unknown',
+	`id_agentmodule` int(10) NOT NULL default '0',
+	`id_alert_am` int(10) NOT NULL default '0',
+	`criticity` int(4) unsigned NOT NULL default '0',
+	`user_comment` text NOT NULL,
+	`tags` text NOT NULL,
+	`source` tinytext NOT NULL,
+	`id_extra` tinytext NOT NULL,
+	PRIMARY KEY  (`id_evento`),
+	KEY `indice_1` (`id_agente`,`id_evento`),
+	KEY `indice_2` (`utimestamp`,`id_evento`),
+	KEY `idx_agentmodule` (`id_agentmodule`),
+	INDEX criticity (`criticity`),
+	INDEX estado (`estado`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
 -- Criticity: 0 - Maintance (grey)
 -- Criticity: 1 - Informational (blue)
 -- Criticity: 2 - Normal (green) (status 0)
 -- Criticity: 3 - Warning (yellow) (status 2)
 -- Criticity: 4 - Critical (red) (status 1)
 
+-- -----------------------------------------------------
+-- Table `tgrupo`
+-- -----------------------------------------------------
 CREATE TABLE IF NOT EXISTS `tgrupo` (
 	`id_grupo` mediumint(4) unsigned NOT NULL auto_increment,
 	`nombre` varchar(100) NOT NULL default '',