From 2e0e8027cc3dd2b0932a8fec93940ff7159b8936 Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Thu, 20 Mar 2014 12:02:07 +0000
Subject: [PATCH] 2014-03-20  Miguel de Dios <miguel.dedios@artica.es>

	* godmode/snmpconsole/snmp_alert.php,
	godmode/alerts/alert_list.list.php,
	godmode/agentes/agent_manager.php,
	godmode/agentes/configurar_agente.php,
	godmode/agentes/modificar_agente.php,
	include/functions_reporting.php,
	operation/agentes/estado_agente.php,
	images/remote_configuration.png: added a tab for enterprise remote
	configuration.

	Incident: #311




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9619 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                     |  14 ++
 .../godmode/agentes/agent_manager.php         |  25 ++-
 .../godmode/agentes/configurar_agente.php     | 187 +++++++++++-------
 .../godmode/agentes/modificar_agente.php      |   6 +-
 .../godmode/alerts/alert_list.list.php        |  68 +++----
 .../godmode/snmpconsole/snmp_alert.php        |   6 +-
 .../images/remote_configuration.png           | Bin 0 -> 1359 bytes
 .../include/functions_reporting.php           |  11 +-
 .../operation/agentes/estado_agente.php       |   7 +-
 9 files changed, 203 insertions(+), 121 deletions(-)
 create mode 100644 pandora_console/images/remote_configuration.png

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index 73036e6993..7587cf0aff 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,3 +1,17 @@
+2014-03-20  Miguel de Dios <miguel.dedios@artica.es>
+	
+	* godmode/snmpconsole/snmp_alert.php,
+	godmode/alerts/alert_list.list.php,
+	godmode/agentes/agent_manager.php,
+	godmode/agentes/configurar_agente.php,
+	godmode/agentes/modificar_agente.php,
+	include/functions_reporting.php,
+	operation/agentes/estado_agente.php,
+	images/remote_configuration.png: added a tab for enterprise remote
+	configuration.
+	
+	Incident: #311
+
 2014-03-19  Alejandro Gallardo <alejandro.gallardo@artica.es>
 	
 	* pandoradb_data.sql,
diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php
index 536c44aef4..a62170000c 100644
--- a/pandora_console/godmode/agentes/agent_manager.php
+++ b/pandora_console/godmode/agentes/agent_manager.php
@@ -128,13 +128,6 @@ if (!$new_agent) {
 	}
 }
 
-$disk_conf = (bool) get_parameter ('disk_conf');
-
-if ($disk_conf) {
-	require ("agent_disk_conf_editor.php");
-	return;
-}
-
 $disk_conf_delete = (bool) get_parameter ('disk_conf_delete');
 // Agent remote configuration DELETE
 if ($disk_conf_delete) {
@@ -174,11 +167,18 @@ if (!$new_agent) {
 			$agent_name = io_safe_output($agent_name);
 			$agent_md5 = md5 ($agent_name, false);
 			
-			$table->data[0][1] .= '&nbsp;&nbsp;<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;id_agente='.$id_agente.'&amp;disk_conf='.$agent_md5.'">';
+			$table->data[0][1] .= '&nbsp;&nbsp;' .
+				'<a href="index.php?' .
+					'sec=gagente&amp;' .
+					'sec2=godmode/agentes/configurar_agente&amp;' .
+					'tab=remote_configuration&amp;' .
+					'id_agente=' . $id_agente . '&amp;' .
+					'disk_conf=' . $agent_md5 . '">';
 			$table->data[0][1] .= html_print_image(
 				"images/application_edit.png",
 				true,
-				array ("border" => 0, "title" => __('This agent can be remotely configured')));
+				array("border" => 0,
+					"title" => __('This agent can be remotely configured')));
 			$table->data[0][1] .= '</a>' .
 				ui_print_help_tip (
 					__('You can remotely edit this agent configuration'), true);
@@ -286,7 +286,12 @@ if (!$new_agent) {
 		if (file_exists ($filename['md5'])) {
 			$table->data[3][1] = date ("F d Y H:i:s", fileatime ($filename['md5']));
 			// Delete remote configuration
-			$table->data[3][1] .= '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;disk_conf_delete=1&amp;id_agente='.$id_agente.'">';
+			$table->data[3][1] .= '<a href="index.php?' .
+				'sec=gagente&amp;' .
+				'sec2=godmode/agentes/configurar_agente&amp;' .
+				'tab=main&amp;' .
+				'disk_conf_delete=1&amp;' .
+				'id_agente=' . $id_agente . '">';
 			$table->data[3][1] .= html_print_image(
 				"images/cross.png", true,
 				array ('title' => __('Delete remote configuration file'), 'style' => 'vertical-align: middle;')).'</a>';
diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php
index dd92b26529..a997c9b62d 100644
--- a/pandora_console/godmode/agentes/configurar_agente.php
+++ b/pandora_console/godmode/agentes/configurar_agente.php
@@ -212,11 +212,16 @@ if ($create_agent) {
 			
 			$agent_created_ok = true;
 			
-			$info = 'Name: ' . $nombre_agente . ' IP: ' . $direccion_agente .
-				' Group: ' . $grupo . ' Interval: ' . $intervalo .
-				' Comments: ' . $comentarios . ' Mode: ' . $modo .
-				' ID_parent: ' . $id_parent . ' Server: ' . $server_name .
-				' ID os: ' . $id_os . ' Disabled: ' . $disabled .
+			$info = 'Name: ' . $nombre_agente .
+				' IP: ' . $direccion_agente .
+				' Group: ' . $grupo .
+				' Interval: ' . $intervalo .
+				' 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 .
@@ -237,7 +242,6 @@ if ($create_agent) {
 // Show tabs
 $img_style = array ("class" => "top", "width" => 16);
 
-// TODO: Change to use ui_print_page_header
 if ($id_agente) {
 	
 	/* View tab */
@@ -299,7 +303,8 @@ if ($id_agente) {
 		$inventorytab = "";
 	
 	
-	$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration',array($id_agente));
+	$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration',
+		array($id_agente));
 	
 	if ($has_remote_conf === true) {
 		/* Plugins */
@@ -365,18 +370,56 @@ if ($id_agente) {
 	}
 	
 	if (check_acl ($config["id_user"], $group, "AW", $id_agente)) {
-		$onheader = array('view' => $viewtab,
-			'main' => $maintab,
-			'module' => $moduletab,
-			'alert' => $alerttab,
-			'template' => $templatetab,
-			'inventory' => $inventorytab,
-			'pluginstab' => $pluginstab,
-			'collection'=> $collectiontab,
-			'group' => $grouptab,
-			'gis' => $gistab,
-			'agent_wizard' => $agent_wizard);
+		if ($has_remote_conf) {
+			$agent_name = agents_get_name($id_agente);
+			$agent_name = io_safe_output($agent_name);
+			$agent_md5 = md5 ($agent_name, false);
 			
+			$remote_configuration_tab['text'] =
+				'<a href="index.php?' .
+					'sec=gagente&amp;' .
+					'sec2=godmode/agentes/configurar_agente&amp;' .
+					'tab=remote_configuration&amp;' .
+					'id_agente=' . $id_agente . '&amp;' .
+					'disk_conf=' . $agent_md5 . '">' 
+				. html_print_image ("images/book_edit.png", true,
+					array("title" =>__('Remote configuration')))
+				. '</a>';
+			if ($tab == 'remote_configuration')
+				$remote_configuration_tab['active'] = true;
+			else
+				$remote_configuration_tab['active'] = false;
+			
+			
+			$onheader = array('view' => $viewtab,
+				'separator' => "",
+				'main' => $maintab,
+				'remote_configuration' => $remote_configuration_tab,
+				'module' => $moduletab,
+				'alert' => $alerttab,
+				'template' => $templatetab,
+				'inventory' => $inventorytab,
+				'pluginstab' => $pluginstab,
+				'collection'=> $collectiontab,
+				'group' => $grouptab,
+				'gis' => $gistab,
+				'agent_wizard' => $agent_wizard);
+		}
+		else {
+			$onheader = array('view' => $viewtab,
+				'separator' => "",
+				'main' => $maintab,
+				'module' => $moduletab,
+				'alert' => $alerttab,
+				'template' => $templatetab,
+				'inventory' => $inventorytab,
+				'pluginstab' => $pluginstab,
+				'collection'=> $collectiontab,
+				'group' => $grouptab,
+				'gis' => $gistab,
+				'agent_wizard' => $agent_wizard);
+		}
+		
 		// Only if the agent has incidents associated show incidents tab
 		if ($total_incidents) {
 			$onheader['incident'] = $incidenttab;
@@ -449,6 +492,9 @@ if ($id_agente) {
 		case "incident":
 			$tab_description = '- ' . __('Incidents');
 			break;
+		case "remote_configuration":
+			$tab_description = '- ' . __('Remote configuration');
+			break;
 		case "agent_wizard":
 			switch(get_parameter('wizard_section')) {
 				case 'snmp_explorer':
@@ -475,12 +521,14 @@ if ($id_agente) {
 			break;
 	}
 	
-	ui_print_page_header (agents_get_name ($id_agente) .
-		' ' . $tab_description, "images/setup.png", false, $help_header , true, $onheader);
+	ui_print_page_header (
+		agents_get_name ($id_agente) . ' ' . $tab_description,
+		"images/setup.png", false, $help_header , true, $onheader);
 }
 else {
 	// Create agent 
-	ui_print_page_header (__('Agent manager'), "images/bricks.png", false, "create_agent", true);
+	ui_print_page_header (__('Agent manager'), "images/bricks.png",
+		false, "create_agent", true);
 }
 
 $delete_conf_file = (bool) get_parameter('delete_conf_file');
@@ -594,7 +642,8 @@ if ($update_agent) { // if modified some agent paramenter
 	
 	
 	foreach ($field_values as $key => $value) {
-		$old_value = db_get_all_rows_filter('tagent_custom_data', array('id_agent' => $id_agente, 'id_field' => $key));
+		$old_value = db_get_all_rows_filter('tagent_custom_data',
+			array('id_agent' => $id_agente, 'id_field' => $key));
 		
 		if ($old_value === false) {
 			// Create custom field if not exist
@@ -741,7 +790,7 @@ if ($update_module || $create_module) {
 	// where are very big and PHP uses scientific notation, p.e:
 	// 1.23E-10 is 0.000000000123
 	
-	$post_process = get_parameter ('post_process', 0);
+	$post_process = (string) get_parameter ('post_process', 0.0);
 	$prediction_module = 0;
 	$max_timeout = (int) get_parameter ('max_timeout');
 	$max_retries = (int) get_parameter ('max_retries');
@@ -790,15 +839,15 @@ if ($update_module || $create_module) {
 	if (!empty($macros)) {
 		$macros = json_decode(base64_decode($macros), true);
 		
-		foreach ($macros as $k => $m) {
+		foreach($macros as $k => $m) {
 			$macros[$k]['value'] = get_parameter($m['macro'], '');
 		}
 		
 		$macros = json_encode($macros);
 		
-		$conf_array = explode("\n", $configuration_data);
-		foreach ($conf_array as $line) {
-			if (preg_match("/^module_name\s*(.*)/", $line, $match)) {
+		$conf_array = explode("\n",$configuration_data);
+		foreach($conf_array as $line) {
+			if(preg_match("/^module_name\s*(.*)/", $line, $match)) {
 				$new_configuration_data .= "module_name $name\n";
 			}
 			// We delete from conf all the module macros starting with _field
@@ -822,7 +871,8 @@ if ($update_module || $create_module) {
 	
 	enterprise_hook ('get_service_synthetic_parameters');
 	
-	$agent_name = (string) get_parameter('agent_name',agents_get_name ($id_agente));
+	$agent_name = (string) get_parameter('agent_name',
+		agents_get_name($id_agente));
 	
 	$snmp_community = (string) get_parameter ('snmp_community');
 	$snmp_oid = (string) get_parameter ('snmp_oid');
@@ -895,7 +945,7 @@ if ($update_module || $create_module) {
 	//Set the event type that can show.
 	$disabled_types_event = array(EVENTS_GOING_UNKNOWN => (int)!$throw_unknown_events);
 	$disabled_types_event = json_encode($disabled_types_event);
-
+	
 	$module_macro_names = (array) get_parameter('module_macro_names', array());
 	$module_macro_values = (array) get_parameter('module_macro_values', array());
 	$module_macros = modules_get_module_macros_json ($module_macro_names, $module_macro_values);
@@ -1413,6 +1463,9 @@ switch ($tab) {
 	case "incident":
 		require("agent_incidents.php");
 		break;
+	case "remote_configuration":
+		enterprise_include("godmode/agentes/agent_disk_conf_editor.php");
+		break;
 	case "extension":
 		$found = false;
 		foreach($config['extensions'] as $extension) {
@@ -1470,46 +1523,46 @@ echo '</ul>';
 echo '</div>';
 ?>
 <script type="text/javascript">
-var wizard_tab_showed = 0;
-
-/* <![CDATA[ */
-$(document).ready (function () {
-	// Control the tab and subtab hover. When mouse leave one, 
-	// check if is hover the other before hide the subtab
-	$('.agent_wizard_tab').hover(agent_wizard_tab_show, agent_wizard_tab_hide);
+	/* <![CDATA[ */
+	var wizard_tab_showed = 0;
 	
-	$('#agent_wizard_subtabs').hover(agent_wizard_tab_show, agent_wizard_tab_hide);
-});
-
-// Set the position and width of the subtab
-function agent_wizard_tab_setup() {		
-	$('#agent_wizard_subtabs').css('left', $('.agent_wizard_tab').offset().left)
-	$('#agent_wizard_subtabs').css('top', $('.agent_wizard_tab').offset().top + $('.agent_wizard_tab').height() + 4)
-	$('#agent_wizard_subtabs').css('width', $('.agent_wizard_tab').width() + 6)
-}
-
-function agent_wizard_tab_show() {
-	agent_wizard_tab_setup();
-	wizard_tab_showed = wizard_tab_showed + 1;
+	$(document).ready (function () {
+		// Control the tab and subtab hover. When mouse leave one, 
+		// check if is hover the other before hide the subtab
+		$('.agent_wizard_tab').hover(agent_wizard_tab_show, agent_wizard_tab_hide);
+		
+		$('#agent_wizard_subtabs').hover(agent_wizard_tab_show, agent_wizard_tab_hide);
+	});
 	
-	if(wizard_tab_showed == 1) {
-		$('#agent_wizard_subtabs').show("fast");
+	// Set the position and width of the subtab
+	function agent_wizard_tab_setup() {		
+		$('#agent_wizard_subtabs').css('left', $('.agent_wizard_tab').offset().left)
+		$('#agent_wizard_subtabs').css('top', $('.agent_wizard_tab').offset().top + $('.agent_wizard_tab').height() + 4)
+		$('#agent_wizard_subtabs').css('width', $('.agent_wizard_tab').width() + 6)
 	}
-}
-
-function agent_wizard_tab_hide() {
-	wizard_tab_showed = wizard_tab_showed - 1;
-
-	setTimeout(function() {
-		if(wizard_tab_showed <= 0) {
-			$('#agent_wizard_subtabs').hide("fast");
+	
+	function agent_wizard_tab_show() {
+		agent_wizard_tab_setup();
+		wizard_tab_showed = wizard_tab_showed + 1;
+		
+		if(wizard_tab_showed == 1) {
+			$('#agent_wizard_subtabs').show("fast");
 		}
-	},500);
-}
-
-$(window).resize(function() {
-	agent_wizard_tab_setup();
-});
-
-/* ]]> */
+	}
+	
+	function agent_wizard_tab_hide() {
+		wizard_tab_showed = wizard_tab_showed - 1;
+		
+		setTimeout(function() {
+			if(wizard_tab_showed <= 0) {
+				$('#agent_wizard_subtabs').hide("fast");
+			}
+		},500);
+	}
+	
+	$(window).resize(function() {
+		agent_wizard_tab_setup();
+	});
+	
+	/* ]]> */
 </script>
diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php
index 5f577ad503..b29abc7e66 100644
--- a/pandora_console/godmode/agentes/modificar_agente.php
+++ b/pandora_console/godmode/agentes/modificar_agente.php
@@ -483,7 +483,11 @@ if ($agents !== false) {
 		if (enterprise_installed()) {
 			enterprise_include_once('include/functions_config_agents.php');
 			if (config_agents_has_remote_configuration($agent["id_agente"])) {
-				echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente=".$agent["id_agente"]."&disk_conf=1'>";
+				echo "<a href='index.php?" .
+					"sec=gagente&" .
+					"sec2=godmode/agentes/configurar_agente&" .
+					"tab=remote_configuration&" .
+					"id_agente=" . $agent["id_agente"] . "&disk_conf=1'>";
 				echo html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Edit remote config')));		
 				echo "</a>";
 			}
diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php
index 36f64804bf..386b5bbab2 100644
--- a/pandora_console/godmode/alerts/alert_list.list.php
+++ b/pandora_console/godmode/alerts/alert_list.list.php
@@ -41,18 +41,18 @@ else {
 }
 
 // Table for filter controls
-$form_filter = '<form method="post" action="index.php?sec='.$sec.'&amp;sec2=godmode/alerts/alert_list&amp;refr=' . ((int)get_parameter('refr', 0)) . '&amp;pure='.$config["pure"].'">';
+$form_filter = '<form method="post" action="index.php?sec=' . $sec . '&amp;sec2=godmode/alerts/alert_list&amp;refr=' . ((int)get_parameter('refr', 0)) . '&amp;pure='.$config["pure"].'">';
 $form_filter .= "<input type='hidden' name='search' value='1' />\n";
 $form_filter .= '<table style="width: 98%;" cellpadding="4" cellspacing="4" class="databox">'."\n";
 $form_filter .= "<tr>\n";
-$form_filter .= "<td>".__('Template name')."</td><td>";
+$form_filter .= "<td>" . __('Template name') . "</td><td>";
 $form_filter .= html_print_input_text ('template_name', $templateName, '', 12, 255, true);
 $form_filter .= "</td>\n";
 $temp = agents_get_agents();
 $arrayAgents = array();
 
 # Avoid empty arrays, warning messages are UGLY !
-if ($temp){
+if ($temp) {
 	foreach ($temp as $agentElement) {
 		$arrayAgents[$agentElement['id_agente']] = $agentElement['nombre'];
 	}
@@ -137,7 +137,7 @@ $form_filter .= "</table>\n";
 $form_filter .= "</form>\n";
 
 echo "<br>";
-ui_toggle($form_filter,__('Alert control filter'), __('Toggle filter(s)'));
+ui_toggle($form_filter, __('Alert control filter'), __('Toggle filter(s)'));
 
 $simple_alerts = array();
 
@@ -313,7 +313,7 @@ if (!$id_agente) {
 else {
 	$url = 'index.php?sec='.$sec.'&sec2=godmode/agentes/configurar_agente&pure='.$pure.'&tab=alert&id_agente=' . $id_agente;
 }
-	
+
 $table->class = 'alert_list databox';
 $table->width = '98%';
 $table->size = array ();
@@ -375,8 +375,8 @@ $iterator = 0;
 
 foreach ($simple_alerts as $alert) {
 	if ($alert['disabled']) {
-		 $table->rowstyle[$iterator] = 'font-style: italic; color: #aaaaaa;';
-		 $table->style[$iterator][1] = 'font-style: italic; color: #aaaaaa;';
+		$table->rowstyle[$iterator] = 'font-style: italic; color: #aaaaaa;';
+		$table->style[$iterator][1] = 'font-style: italic; color: #aaaaaa;';
 	}
 	
 	if ($rowPair)
@@ -385,9 +385,9 @@ foreach ($simple_alerts as $alert) {
 		$table->rowclass[$iterator] = 'rowOdd';
 	$rowPair = !$rowPair;
 	$iterator++;
-
+	
 	$data = array ();
-
+	
 	if (! $id_agente) {
 		$id_agent = modules_get_agentmodule_agent ($alert['id_agent_module']);
 		
@@ -395,7 +395,7 @@ foreach ($simple_alerts as $alert) {
 		
 		$data[0] = '';
 		
-		if(check_acl ($config['id_user'], $agent_group, "AW")) {
+		if (check_acl ($config['id_user'], $agent_group, "AW")) {
 			$main_tab = 'main';
 		}
 		else {
@@ -410,7 +410,7 @@ foreach ($simple_alerts as $alert) {
 		$data[0] .= ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[&hellip;]', 'display:block;font-size: 7.2pt');
 		if ($alert['disabled'])
 			$data[0] .= '</span>';
-			
+		
 		$data[0] .= '</a>';
 	}
 	else {
@@ -421,7 +421,7 @@ foreach ($simple_alerts as $alert) {
 	$data[1] = ui_print_truncate_text($module_name, 'module_medium', false, true, true, '[&hellip;]', 'display:block;font-size: 7.2pt') . '<br>';
 	
 	$template_group = db_get_value('id_group', 'talert_templates', 'id', $alert['id_alert_template']);
-
+	
 	// The access to the template manage page is necessary have LW permissions on template group
 	if(check_acl ($config['id_user'], $template_group, "LW")) {
 		$data[1] .= "<a href='index.php?sec=".$sec."&sec2=godmode/alerts/configure_alert_template&id=".$alert['id_alert_template']."'>";
@@ -433,7 +433,7 @@ foreach ($simple_alerts as $alert) {
 		href="'.ui_get_full_url(false,false,false,false).'ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'">';
 		$data[1] .= html_print_image("images/zoom.png", true, array("id" => 'template-details-'.$alert['id_alert_template'], "class" => "img_help"));
 	$data[1] .= '</a> ';
-		
+	
 	if(check_acl ($config['id_user'], $template_group, "LW")) {
 		$data[1] .= "</a>";
 	}
@@ -453,7 +453,7 @@ foreach ($simple_alerts as $alert) {
 		$data[2] .= "<td></td>";
 		$data[2] .= "</tr>";
 	}
-
+	
 	foreach ($actions as $action_id => $action) {
 		$data[2] .= "<tr>";
 			$data[2] .= "<td>";
@@ -519,7 +519,7 @@ foreach ($simple_alerts as $alert) {
 				$data[2] .= '<table class="databox_color" style="width:100%">';
 					$data[2] .= html_print_input_hidden ('add_action', 1, true);
 					$data[2] .= html_print_input_hidden ('id_alert_module', $alert['id'], true);
-		
+					
 					if (! $id_agente) {
 						$data[2] .= '<tr class="datos2">';
 							$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
@@ -569,7 +569,7 @@ foreach ($simple_alerts as $alert) {
 			$data[2] .= '</form>';
 		$data[2] .= '</div>';
 	}
-
+	
 	$status = STATUS_ALERT_NOT_FIRED;
 	$title = "";
 	
@@ -614,7 +614,7 @@ foreach ($simple_alerts as $alert) {
 		$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
 		$data[4] .= '</form>';
 	}
-
+	
 	// To access to policy page is necessary have AW permissions in the agent
 	if(check_acl ($config['id_user'], $agent_group, "AW")) {
 		if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
@@ -623,7 +623,7 @@ foreach ($simple_alerts as $alert) {
 				$data[4] .= '';
 			else {
 				$img = 'images/policies.png';
-					
+				
 				$data[4] .= '&nbsp;&nbsp;<a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&pure='.$pure.'&id=' . $policyInfo['id'] . '">' . 
 					html_print_image($img, true, array('title' => $policyInfo['name'])) .
 					'</a>';
@@ -658,11 +658,11 @@ foreach ($simple_alerts as $alert) {
 	array_push ($table->data, $data);
 }
 
-if (isset($data)){
+if (isset($data)) {
 	html_print_table ($table);
 }
 else {
-	echo "<div class='nf'>".__('No alerts defined')."</div>";
+	echo "<div class='nf'>" . __('No alerts defined') . "</div>";
 }
 
 // Create alert button
@@ -673,7 +673,7 @@ if (isset($dont_display_alert_create_bttn))
 		$display_create = false;
 
 if ($display_create && check_acl ($config['id_user'], 0, "LW")){
-	echo '<div class="action-buttons" style="width: '.$table->width.'">';
+	echo '<div class="action-buttons" style="width: ' . $table->width . '">';
 	echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">';
 	html_print_submit_button (__('Create'), 'crtbtn', false, 'class="sub next"');
 	echo '</form>';
@@ -771,19 +771,19 @@ function show_advance_options_action(id_alert) {
 
 function show_add_action(id_alert) {
 	$("#add_action-div-" + id_alert).hide ()
-			.dialog ({
-				resizable: true,
-				draggable: true,
-				title: '<?php echo __('Add action'); ?>',
-				modal: true,
-				overlay: {
-					opacity: 0.5,
-					background: "black"
-				},
-				width: 500,
-				height: 300
-			})
-			.show ();
+		.dialog ({
+			resizable: true,
+			draggable: true,
+			title: '<?php echo __('Add action'); ?>',
+			modal: true,
+			overlay: {
+				opacity: 0.5,
+				background: "black"
+			},
+			width: 500,
+			height: 300
+		})
+		.show ();
 }
 
 /* ]]> */
diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php
index 93576bdb0e..a9d76c36cf 100644
--- a/pandora_console/godmode/snmpconsole/snmp_alert.php
+++ b/pandora_console/godmode/snmpconsole/snmp_alert.php
@@ -195,7 +195,7 @@ if ($save_alert || $modify_alert) {
 			$custom_oid_data_15, $custom_oid_data_16, $custom_oid_data_17,
 			$custom_oid_data_18, $custom_oid_data_19, $custom_oid_data_20,
 			$trap_type, $single_value, $position, $group, $id_as);
-	
+		
 		$result = db_process_sql ($sql);
 		
 		if (!$result) {
@@ -737,7 +737,7 @@ else {
 			"priority_filter=" . $priority_filter . "&" .
 			"offset=" . $offset;
 	}
-
+	
 	//$where_sql = ' 1 = 1';
 	if ($trap_type_filter != SNMP_TRAP_TYPE_NONE) {
 		$where_sql .= ' AND `trap_type` = ' . $trap_type_filter;
@@ -767,7 +767,7 @@ else {
 	
 	$count = db_get_value_sql("SELECT COUNT(*)
 		FROM talert_snmp WHERE id_group IN ($str_user_groups) " . $where_sql);
-		
+	
 	$result = array();
 	
 	//Overview
diff --git a/pandora_console/images/remote_configuration.png b/pandora_console/images/remote_configuration.png
new file mode 100644
index 0000000000000000000000000000000000000000..5e4bd77c77b83445cbe47e10a533b4dc2881327d
GIT binary patch
literal 1359
zcmbVMZA=?w9Dh1WLB?BTLyJ?+gDhy^?s-aSdlxFb_S(^91yUMm{IqNDC<nb4?+z$r
zbJYw31Os2(j3ZI9#27;s{o)r*HU}DsCeDy4)5MrLU-!WgopCx-?|`BvWFNfba?k&N
zzu*7;|IGCD9I2{kr~m*|MZ4L!`F+rO%N+pN&Z<?iDL9RA(&$$Pjd4yB0K+RO0gFmp
zMu-a>Kk@XM&<Q}vkeEms$=ESEtw;oCVThchnrr|%yK*X*9uW*IC1ga|kN^D6MH~}(
zKR(bAgE2KE42j*7n$SPllSogFq$wWndIIar(WU`OFgPqHWo4bt`SC5gw0XAFB#v!C
zj1fP+9aJ*bhlLbPz&Z%nmWCdLdE5kYL&{CHVlIdviCiS~wjoG&cxi~Rod-9)Y5X7^
zXCphlOv#TA8HP%e<oNhFG2TunT82avMUl`&x?F80qD`NW4KCLv>rF)qte~egQ8h$G
z#w?3mN*Oi$xEbko3X&R&?HZQ#okE!<BXgWeA_9_<WaYJm){VIEPZ)cm^~8iKka0m*
zMzyrrkHMxQ*{t2Y9a%s#8oE~#&8Bc!R!NUaf^0-tKW_dZc#)@JhYup;bwjTUdVC1^
z7!Ml>dtFpGh}d=ni#GP+hJqf-?eRj!=cW(}xBJ4BFNl~B6>+;z5PFN;sH_{DoED0H
zMbqy#*AuxXmkwzHXDC`iQL@De=o?ZDMITaBEY#mYAS}kEMcL9=4cg9^6*O^7;3JwM
zVOtfZ#XTZ`=)ajWi1Jaeo$<0>ggnrN?{NA5Q#H~IhP1}xU*l3#nKNh|cZc5;cGpLc
z&7INA<v91{i{G02c{0i}iQE^dyM;nmNhM@{1d&L@;ozNlkYWekZk%TD0yk-A>;drX
zZLs-_qZ!;NWSH;3V_~d5;Q76)qydy;2Oe@>`FQ2=4^C&xW}A-F`Cso8;C|)+aXz`Q
zID5S%4}xO{tG{0w&QFyeeH~n@NG|_1e|>-R%%6c_e|KHt)035D>9=f-efcD~=BQt;
zE<Hk3_kKNBaR^}f?$0g-;|sWW>85-GaF>??wzGqW-BbGli-7;CFu$U2WM8U@{q(?_
zV(@eIkrxWKftL3=FO=WLTB(*)?4yn4$Zx(6Ym@h<E<1mio2$7MKD2TQKfhQ?)z8>~
zEuuYzAAB`awjf~_iRSfpbJ&xC%}3*o_gl|(+plc=F`qqLci+o}P*rXI%+$@9tJCXc
zfw7fScR_PwV5X)%@QvNx;9LT$&(Gc|*|Z%!u>e*}?I%#<D>c)zd|z&5m2m{GI&16J
s+`ZwAH%j}a)&s9STw#2&cC6Cv0JoT53LbQN*t+7P;U4xv@c46o15Kd4g8%>k

literal 0
HcmV?d00001

diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index 0174cb9c04..367594e3f7 100644
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -1423,11 +1423,12 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
 			$id_group[0] = $my_group;
 		}
 		
-		foreach ($id_group as $group){
+		foreach ($id_group as $group) {
 			$group_stat = db_get_all_rows_sql ("SELECT *
 				FROM tgroup_stat, tgrupo
 				WHERE tgrupo.id_grupo = tgroup_stat.id_group AND tgroup_stat.id_group = $group
 				ORDER BY nombre");
+			
 			$data["monitor_checks"] += $group_stat[0]["modules"];
 			$data["monitor_not_init"] += $group_stat[0]["non-init"];
 			$data["monitor_unknown"] += $group_stat[0]["unknown"];
@@ -1453,7 +1454,7 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
 			// Get Agents Unknown
 			$data["agent_unknown"] += groups_agent_unknown($group);
 			// Get Agents Not init
-			$data["agent_not_init"] += groups_agent_not_init($group);			
+			$data["agent_not_init"] += groups_agent_not_init($group);
 			
 		}
 		
@@ -1484,7 +1485,7 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
 					array_push($covered_groups, $sub['id_grupo']);
 					array_push($group_array, $sub['id_grupo']);
 				}
-			
+				
 			}
 			
 			// Add id of this group to create the clause
@@ -1531,7 +1532,7 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
 				
 				// Get monitor WARNING, except disabled and non-init
 				$data["monitor_warning"] += groups_monitor_warning ($group_array);
-			
+				
 				// Get monitor UNKNOWN, except disabled and non-init
 				$data["monitor_unknown"] += groups_monitor_unknown ($group_array);
 				
@@ -1545,7 +1546,7 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
 				
 				// Get TOTAL agents in a group
 				$data["total_agents"] += groups_total_agents ($group_array);
-			
+				
 				// Get TOTAL non-init modules, except disabled ones and async modules
 				$data["total_not_init"] += $data["monitor_not_init"];
 			
diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php
index 6c06ac7b71..6a8d28cc4e 100644
--- a/pandora_console/operation/agentes/estado_agente.php
+++ b/pandora_console/operation/agentes/estado_agente.php
@@ -493,7 +493,12 @@ foreach ($agents as $agent) {
 		
 		if (enterprise_installed()) {
 			if (config_agents_has_remote_configuration($agent["id_agente"])) {
-				$data[9] = "<a href='index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=main&id_agente=".$agent["id_agente"]."&disk_conf=1'>".
+				$data[9] = "<a href='index.php?" .
+					"sec=estado&" .
+					"sec2=godmode/agentes/configurar_agente&" .
+					"tab=remote_configuration&" .
+					"id_agente=" . $agent["id_agente"] . "&" .
+					"disk_conf=1'>".
 				html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Edit remote config')))."</a>";
 			}
 		}