From 42dc2048b1729e18edea78b2c5ccaee942a0278e Mon Sep 17 00:00:00 2001 From: fermin831 Date: Wed, 4 Nov 2015 17:33:13 +0100 Subject: [PATCH] Fixed SNMP alerts. All matched alerts with same position will be trown --- pandora_server/lib/PandoraFMS/Core.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 05736f6531..60f8760f05 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -3092,11 +3092,18 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) { # Get all SNMP alerts my @snmp_alerts = get_db_rows ($dbh, 'SELECT * FROM talert_snmp ORDER BY position ASC'); + my $fired_position; # Find those that apply to the given SNMP trap foreach my $alert (@snmp_alerts) { my $alert_data = ''; + + # Check if one alert has been thrown. If there is another with same position, tries to throw it. + if (defined($fired_position)) { + last if ($fired_position != $alert->{'position'}); + } + my ($times_fired, $internal_counter, $alert_type) = ($alert->{'times_fired'}, $alert->{'internal_counter'}, $alert->{'alert_type'}); @@ -3373,8 +3380,8 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) { } } - # Do not execute more than one alert per trap - last; + $fired_position = $alert->{'position'}; + } }