From a24f7ed11122d5cfc5b62159837e32de4a4f28b4 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Mon, 21 May 2012 08:40:53 +0000 Subject: [PATCH] 2012-05-21 Sergio Martin * lib/PandoraFMS/Core.pm: Added new Internal Command for actions to validate the events of one module given the agent name (field1) and the module name (field2) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6325 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 6 ++++++ pandora_server/lib/PandoraFMS/Core.pm | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index adcd84ce75..974a7a8436 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,9 @@ +2012-05-21 Sergio Martin + + * lib/PandoraFMS/Core.pm: Added new Internal Command for + actions to validate the events of one module given + the agent name (field1) and the module name (field2) + 2012-05-21 Koichiro Kikuchi * util/pandora_db.pl: Merged from 4.0.2: Set default DB port diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 85826ebde4..6130f5d90d 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -817,6 +817,19 @@ sub pandora_execute_action ($$$$$$$$$;$) { } elsif ($action->{'name'} eq "Pandora FMS Event") { $field1 = subst_alert_macros ($field1, \%macros); pandora_event ($pa_config, $field1, (defined ($agent) ? $agent->{'id_grupo'} : 0), (defined ($agent) ? $agent->{'id_agente'} : 0), $alert->{'priority'}, 0, 0, "alert_fired", 0, $dbh); + # Validate event (field1: agent name; field2: module name) + } elsif ($action->{'name'} eq "Validate Event") { + my $agent_id = -1; + my $module_id = -1; + if($field1 ne '') { + $agent_id = get_agent_id ($dbh, $field1); + if($field2 ne '' && $agent_id != -1) { + $module_id = get_agent_module_id ($dbh, $field2, $agent_id); + if($module_id != -1) { + pandora_validate_event ($pa_config, $module_id, $dbh); + } + } + } # Unknown } else {