2011-02-15 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Added support for action thresholds. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3856 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
716c90b318
commit
5dac65d9ee
|
@ -1,3 +1,7 @@
|
||||||
|
2011-02-15 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* lib/PandoraFMS/Core.pm: Added support for action thresholds.
|
||||||
|
|
||||||
2011-02-14 Dario Rodriguez <dario.rodriguez@artica.es>
|
2011-02-14 Dario Rodriguez <dario.rodriguez@artica.es>
|
||||||
|
|
||||||
* util/pandora_xml_stress.pl: Fixed an error using config files with
|
* util/pandora_xml_stress.pl: Fixed an error using config files with
|
||||||
|
|
|
@ -571,7 +571,16 @@ sub pandora_execute_alert ($$$$$$$$;$) {
|
||||||
|
|
||||||
# Execute actions
|
# Execute actions
|
||||||
foreach my $action (@actions) {
|
foreach my $action (@actions) {
|
||||||
pandora_execute_action ($pa_config, $data, $agent, $alert, $alert_mode, $action, $module, $dbh, $timestamp, $extra_macros);
|
|
||||||
|
# Check the action threshold (template_action_threshold takes precedence over action_threshold)
|
||||||
|
my $threshold = 0;
|
||||||
|
$threshold = $action->{'action_threshold'} if (defined ($action->{'action_threshold'}) && $action->{'action_threshold'} > 0);
|
||||||
|
$threshold = $action->{'module_action_threshold'} if (defined ($action->{'module_action_threshold'}) && $action->{'module_action_threshold'} > 0);
|
||||||
|
if (time () >= ($action->{'last_execution'} + $threshold)) {
|
||||||
|
pandora_execute_action ($pa_config, $data, $agent, $alert, $alert_mode, $action, $module, $dbh, $timestamp, $extra_macros);
|
||||||
|
} else {
|
||||||
|
logger ($pa_config, "Skipping action " . $action->{'name'} . " for alert '" . $alert->{'name'} . "' module '" . $module->{'nombre'} . "'.", 10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Generate an event
|
# Generate an event
|
||||||
|
@ -676,6 +685,11 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
||||||
} else {
|
} else {
|
||||||
logger($pa_config, "Unknown action '" . $action->{'name'} . "' for alert '". $alert->{'name'} . "' agent '" . (defined ($agent) ? $agent->{'nombre'} : 'N/A') . "'.", 3);
|
logger($pa_config, "Unknown action '" . $action->{'name'} . "' for alert '". $alert->{'name'} . "' agent '" . (defined ($agent) ? $agent->{'nombre'} : 'N/A') . "'.", 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Update action last execution date
|
||||||
|
if (defined ($action->{'last_execution'}) && defined ($action->{'id'})) {
|
||||||
|
db_do ($dbh, 'UPDATE talert_template_module_actions SET last_execution = ? WHERE id = ?', time (), $alert->{'id'});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
Loading…
Reference in New Issue