From 4984e1c20218006c06553546ef116ebf619fef47 Mon Sep 17 00:00:00 2001 From: ramonn Date: Tue, 25 May 2010 16:23:07 +0000 Subject: [PATCH] 2010-05-25 Ramon Novoa * lib/PandoraFMS/DB.pm: Added a function to get the id of an action (needed by pandora_manage.pl). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2798 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 5 +++++ pandora_server/lib/PandoraFMS/DB.pm | 11 +++++++++++ 2 files changed, 16 insertions(+) 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. ##########################################################################