diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index dc902083f9..c8d97b93c0 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2010-05-25 Ramon Novoa + + * lib/PandoraFMS/DB.pm: Added a function to get the id of an action + (needed by pandora_manage.pl). + 2010-05-25 Ramon Novoa * lib/PandoraFMS/Tools.pm: Set a default verbosity level for logger(). diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index 8ac92b3221..0ab6cc16df 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -31,6 +31,7 @@ our @EXPORT = qw( db_disconnect db_do db_insert + get_action_id get_agent_id get_agent_name get_agent_module_id @@ -79,6 +80,16 @@ sub db_disconnect ($) { $dbh->disconnect(); } +########################################################################## +## Return action ID given the action name. +########################################################################## +sub get_action_id ($$) { + my ($dbh, $action_name) = @_; + + my $rc = get_db_value ($dbh, "SELECT id FROM talert_actions WHERE name = ?", $action_name); + return defined ($rc) ? $rc : -1; +} + ########################################################################## ## Return agent ID given the agent name. ##########################################################################