From 33da2b14062e5c0172cae4839c6bab6420ae94e9 Mon Sep 17 00:00:00 2001
From: zarzuelo <zarzuelo@gmail.com>
Date: Thu, 12 May 2011 11:11:37 +0000
Subject: [PATCH] 2011-05-12  Sergio Martin <sergio.martin@artica.es>

	* lib/PandoraFMS/DB.pm: Added a function to give the address of
	one agent



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4342 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_server/ChangeLog            |  5 +++++
 pandora_server/lib/PandoraFMS/DB.pm | 15 +++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog
index 8c5b8ed969..ea6b8951ea 100644
--- a/pandora_server/ChangeLog
+++ b/pandora_server/ChangeLog
@@ -1,3 +1,8 @@
+2011-05-12  Sergio Martin <sergio.martin@artica.es>
+
+	* lib/PandoraFMS/DB.pm: Added a function to give the address of
+	one agent
+
 2011-05-12  Sergio Martin <sergio.martin@artica.es>
 
 	* util/pandora_manage.pl: Change apply policy option in CLI to
diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm
index a2f8b6b4a0..941f322ad6 100644
--- a/pandora_server/lib/PandoraFMS/DB.pm
+++ b/pandora_server/lib/PandoraFMS/DB.pm
@@ -40,6 +40,7 @@ our @EXPORT = qw(
 		db_update
 		get_action_id
 		get_agent_id
+		get_agent_address
 		get_agent_name
 		get_agent_module_id
 		get_alert_template_module_id
@@ -168,8 +169,8 @@ sub get_os_id ($$) {
 }
 
 ##########################################################################
-## SUB dame_agente_nombre (id_agente)
-## Return agent name, given "id_agente"
+## SUB get_agent_name (agent_id)
+## Return agent name, given "agent_id"
 ##########################################################################
 sub get_agent_name ($$) {
 	my ($dbh, $agent_id) = @_;
@@ -177,6 +178,16 @@ sub get_agent_name ($$) {
 	return get_db_value ($dbh, "SELECT nombre FROM tagente WHERE id_agente = ?", $agent_id);
 }
 
+##########################################################################
+## SUB get_agent_address (id_agente)
+## Return agent address, given "agent_id"
+##########################################################################
+sub get_agent_address ($$) {
+	my ($dbh, $agent_id) = @_;
+	
+	return get_db_value ($dbh, "SELECT direccion FROM tagente WHERE id_agente = ?", $agent_id);
+}
+
 ##########################################################################
 ## SUB get_module_name(module_id)
 ## Return the module name, given "module_id"