diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 17fc31a8a9..922bba9345 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2010-05-25 Ramon Novoa + + * lib/PandoraFMS/DB.pm: Added functions to get alert data (needed by + pandora_manage.pl). + 2010-05-25 Ramon Novoa * lib/PandoraFMS/DB.pm: Added functions to get the id of an OS, a diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index 3a292e8d14..c602cd4567 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -43,6 +43,8 @@ our @EXPORT = qw( get_server_id get_group_id get_os_id + get_template_id + get_template_module_id is_group_disabled ); @@ -148,6 +150,26 @@ sub get_agent_module_id ($$$) { return defined ($rc) ? $rc : -1; } +########################################################################## +## Return template id given the template name. +########################################################################## +sub get_template_id ($$) { + my ($dbh, $template_name) = @_; + + my $rc = get_db_value ($dbh, "SELECT id FROM talert_templates WHERE name = ?", $template_name); + return defined ($rc) ? $rc : -1; +} + +########################################################################## +## Return the module template id given the module id and the template id. +########################################################################## +sub get_template_module_id ($$$) { + my ($dbh, $module_id, $template_id) = @_; + + my $rc = get_db_value ($dbh, "SELECT id FROM talert_template_modules WHERE id_agent_module = ? AND id_alert_template = ?", $module_id, $template_id); + return defined ($rc) ? $rc : -1; +} + ########################################################################## ## Returns true if the given group is disabled, false otherwise. ##########################################################################