From 4f22c5b6d9d55130296fd015ee5b105847d3d343 Mon Sep 17 00:00:00 2001 From: ramonn Date: Fri, 30 Apr 2010 08:56:33 +0000 Subject: [PATCH] 2010-04-30 Ramon Novoa * lib/PandoraFMS/Core.pm: Changed the behaviour of SNMP alerts. Alert conditions are ANDed, not ORed. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2642 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 5 +++++ pandora_server/lib/PandoraFMS/Core.pm | 18 +++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 3d40c410b2..afeda16246 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2010-04-30 Ramon Novoa + + * lib/PandoraFMS/Core.pm: Changed the behaviour of SNMP alerts. + Alert conditions are ANDed, not ORed. + 2010-04-28 Sancho Lerena * util/gpx2pandora_agent_data.pl: Added support to process diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index a7e29798b6..07b5e365ac 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -1228,30 +1228,30 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$) { logger($pa_config, "Evaluating SNMP alert ID " . $alert->{'id_as'} . ".", 10); - my ($fire_alert, $alert_data) = (0, ''); + my $alert_data = ''; my ($times_fired, $internal_counter, $alert_type) = ($alert->{'times_fired'}, $alert->{'internal_counter'}, $alert->{'alert_type'}); # OID my $oid = $alert->{'oid'}; - if ($oid ne '' && $trap_oid =~ m/$oid/i || $trap_oid_text =~ m/$oid/i) { - $fire_alert = 1; + if ($oid ne '') { + next if ($trap_oid !~ m/$oid/i && $trap_oid_text !~ m/$oid/i); $alert_data .= "OID: $oid "; } + # Custom OID/value my $custom_oid = $alert->{'custom_oid'}; - if ($custom_oid ne '' && $trap_custom_value =~ m/$custom_oid/i || $trap_custom_oid =~ m/$custom_oid/i) { - $fire_alert = 1; + if ($custom_oid ne '') { + next if ($trap_custom_value !~ m/$custom_oid/i && $trap_custom_oid !~ m/$custom_oid/i); $alert_data .= "CUSTOM OID: $custom_oid "; } + # Agent IP my $agent = $alert->{'agent'}; - if ($agent ne '' && $trap_agent =~ m/$agent/i ) { - $fire_alert = 1; + if ($agent ne '') { + next if ($trap_agent !~ m/$agent/i ); $alert_data .= "AGENT: $agent"; } - - next unless ($fire_alert == 1); # Check time threshold $alert->{'last_fired'} = '0000-00-00 00:00:00' unless defined ($alert->{'last_fired'});