From 54febc81364b026ba6108877f468057a923bc4a9 Mon Sep 17 00:00:00 2001 From: ramonn Date: Thu, 15 Jan 2009 17:19:24 +0000 Subject: [PATCH] 2009-01-15 Ramon Novoa * lib/PandoraFMS/DB.pm: min_alerts now works as expected. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1348 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 4 ++++ pandora_server/lib/PandoraFMS/DB.pm | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 39eb4ff13c..3f26ee82c4 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,7 @@ +2009-01-15 Ramon Novoa + + * lib/PandoraFMS/DB.pm: min_alerts now works as expected. + 2009-01-15 Ramon Novoa * lib/PandoraFMS/DB.pm: Partially rewrote the alert core to support the diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index e029fa9144..f8675cd512 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -161,6 +161,7 @@ sub pandora_generate_alerts (%$$$$$$$$) { ## 2 Do not execute the alert, but increment its internal counter. ## 3 Cease the alert. ## 4 Recover the alert. +## 5 Reset internal counter (alert not fired, interval elapsed). ########################################################################## sub pandora_evaluate_alert (%$%$$$) { @@ -211,6 +212,8 @@ sub pandora_evaluate_alert (%$%$$$) { if ($alert_data->{'recovery_notify'} == 1) { $status = 4; } + } elsif (Date_Cmp ($date, $limit_date) >= 0) { + $status = 5; } # Check for valid data @@ -308,6 +311,13 @@ sub pandora_process_alert (%$$$$$%$$) { return; } + # Reset internal counter + if ($rc == 5) { + db_do("UPDATE talert_template_modules SET internal_counter = 0 WHERE id = " . + $alert_data->{'id_template_module'}, $dbh); + return; + } + # Get current date my $date_db = &UnixDate("today","%s");