mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
fixed bug in monitoring event creation
This commit is contained in:
parent
4899d68ec2
commit
f9bb085dad
@ -982,14 +982,17 @@ sub pandora_execute_alert ($$$$$$$$$;$$) {
|
|||||||
$threshold = $action->{'action_threshold'} if (defined ($action->{'action_threshold'}) && $action->{'action_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);
|
$threshold = $action->{'module_action_threshold'} if (defined ($action->{'module_action_threshold'}) && $action->{'module_action_threshold'} > 0);
|
||||||
if (time () >= ($action->{'last_execution'} + $threshold)) {
|
if (time () >= ($action->{'last_execution'} + $threshold)) {
|
||||||
|
my $monitoring_event_custom_data = '';
|
||||||
|
|
||||||
|
push(@{$custom_data->{'actions'}}, safe_output($action->{'action_name'}));
|
||||||
|
|
||||||
# Does the action generate an event?
|
# Does the action generate an event?
|
||||||
if (safe_output($action->{'name'}) eq "Monitoring Event") {
|
if (safe_output($action->{'name'}) eq "Monitoring Event") {
|
||||||
$event_generated = 1;
|
$event_generated = 1;
|
||||||
|
$monitoring_event_custom_data = $custom_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
pandora_execute_action ($pa_config, $data, $agent, $alert, $alert_mode, $action, $module, $dbh, $timestamp, $extra_macros);
|
pandora_execute_action ($pa_config, $data, $agent, $alert, $alert_mode, $action, $module, $dbh, $timestamp, $extra_macros, $monitoring_event_custom_data);
|
||||||
push(@{$custom_data->{'actions'}}, safe_output($action->{'action_name'}));
|
|
||||||
} else {
|
} else {
|
||||||
if (defined ($module)) {
|
if (defined ($module)) {
|
||||||
logger ($pa_config, "Skipping action " . safe_output($action->{'name'}) . " for alert '" . safe_output($alert->{'name'}) . "' module '" . safe_output($module->{'nombre'}) . "'.", 10);
|
logger ($pa_config, "Skipping action " . safe_output($action->{'name'}) . " for alert '" . safe_output($alert->{'name'}) . "' module '" . safe_output($module->{'nombre'}) . "'.", 10);
|
||||||
@ -1082,9 +1085,9 @@ Execute the given action.
|
|||||||
|
|
||||||
=cut
|
=cut
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub pandora_execute_action ($$$$$$$$$;$) {
|
sub pandora_execute_action ($$$$$$$$$;$$) {
|
||||||
my ($pa_config, $data, $agent, $alert,
|
my ($pa_config, $data, $agent, $alert,
|
||||||
$alert_mode, $action, $module, $dbh, $timestamp, $extra_macros) = @_;
|
$alert_mode, $action, $module, $dbh, $timestamp, $extra_macros, $custom_data) = @_;
|
||||||
|
|
||||||
logger($pa_config, "Executing action '" . safe_output($action->{'name'}) . "' for alert '". safe_output($alert->{'name'}) . "' agent '" . (defined ($agent) ? safe_output($agent->{'nombre'}) : 'N/A') . "'.", 10);
|
logger($pa_config, "Executing action '" . safe_output($action->{'name'}) . "' for alert '". safe_output($alert->{'name'}) . "' agent '" . (defined ($agent) ? safe_output($agent->{'nombre'}) : 'N/A') . "'.", 10);
|
||||||
|
|
||||||
@ -1660,7 +1663,12 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||||||
'',
|
'',
|
||||||
$comment,
|
$comment,
|
||||||
$id_extra,
|
$id_extra,
|
||||||
$tags);
|
$tags,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
p_encode_json($pa_config, $custom_data)
|
||||||
|
);
|
||||||
# Validate event (field1: agent name; field2: module name)
|
# Validate event (field1: agent name; field2: module name)
|
||||||
}
|
}
|
||||||
} elsif ($clean_name eq "Validate Event") {
|
} elsif ($clean_name eq "Validate Event") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user