diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index fb5007b24d..1e340aa5db 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,9 @@ +2011-06-10 Ramon Novoa + + * lib/PandoraFMS/DB.pm: Added a function to get the group of an agent. + + * lib/PandoraFMS/Core.pm: Fixed a prototype. + 2011-06-08 Ramon Novoa * lib/PandoraFMS/Core.pm: Use commas to separate tags. diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index af51e89b19..8993461265 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -1420,7 +1420,7 @@ Generate an event. =cut ########################################################################## -sub pandora_event ($$$$$$$$$$;$) { +sub pandora_event ($$$$$$$$$$) { my ($pa_config, $evento, $id_grupo, $id_agente, $severity, $id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh) = @_; diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index 8cd664143a..feef76983f 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -41,6 +41,7 @@ our @EXPORT = qw( get_action_id get_agent_id get_agent_address + get_agent_group get_agent_name get_agent_module_id get_alert_template_module_id @@ -170,6 +171,19 @@ sub get_os_id ($$) { return defined ($rc) ? $rc : -1; } +########################################################################## +## SUB get_agent_name (agent_id) +## Return agent group id, given "agent_id" +########################################################################## +sub get_agent_group ($$) { + my ($dbh, $agent_id) = @_; + + my $group_id = get_db_value ($dbh, "SELECT id_grupo FROM tagente WHERE id_agente = ?", $agent_id); + return 0 unless defined ($group_id); + + return $group_id; +} + ########################################################################## ## SUB get_agent_name (agent_id) ## Return agent name, given "agent_id"