From 7edd4335666ed87eac1225f2909d6f226c933d25 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Fri, 17 Jun 2022 10:21:06 +0200 Subject: [PATCH] Add recovery support for correlation alerts. --- pandora_server/lib/PandoraFMS/Core.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index acc4d83546..b33d0f95da 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -506,7 +506,7 @@ B: ########################################################################## sub pandora_evaluate_alert ($$$$$$$;$$$$) { my ($pa_config, $agent, $data, $last_status, $alert, $utimestamp, $dbh, - $last_data_value, $correlatedItems, $event, $log) = @_; + $last_data_value, $correlated_items, $event, $log) = @_; if (defined ($agent)) { logger ($pa_config, "Evaluating alert '" . safe_output($alert->{'name'}) . "' for agent '" . safe_output ($agent->{'nombre'}) . "'.", 10); @@ -604,13 +604,16 @@ sub pandora_evaluate_alert ($$$$$$$;$$$$) { # Cease on valid data $status = 3; - + + # Unlike module alerts, correlated alerts recover when they cease! + $status = 4 if ($alert->{'recovery_notify'} == 1 && !defined($alert->{'id_template_module'})); + # Always reset ($alert->{'internal_counter'}, $alert->{'times_fired'}) = (0, 0); } # Recover takes precedence over cease - $status = 4 if ($alert->{'recovery_notify'} == 1); + $status = 4 if ($alert->{'recovery_notify'} == 1 && defined ($alert->{'id_template_module'})); } elsif ($utimestamp > $limit_utimestamp && $alert->{'internal_counter'} > 0) { @@ -691,7 +694,7 @@ sub pandora_evaluate_alert ($$$$$$$;$$$$) { $pa_config, $dbh, $alert, - $correlatedItems, + $correlated_items, $event, $log ]