diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 36540cfad9..53aeef3db0 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -424,6 +424,10 @@ eventserver 0 event_window 3600 +# If set to 1, an alert will not be fired if the last event it generated is in 'in-process' status. + +event_inhibit_alerts 0 + # Enable (1) or disable (0) Pandora FMS Enterprise ICMP Server (PANDORA FMS ENTERPRISE ONLY). # You need nmap 5.20 or higher in order to use this ! diff --git a/pandora_server/conf/pandora_server.conf.windows b/pandora_server/conf/pandora_server.conf.windows index c78fbc86c7..ad5b93c32e 100644 --- a/pandora_server/conf/pandora_server.conf.windows +++ b/pandora_server/conf/pandora_server.conf.windows @@ -374,6 +374,10 @@ eventserver 0 event_window 3600 +# If set to 1, an alert will not be fired if the last event it generated is in 'in-process' status. + +event_inhibit_alerts 0 + # Enable (1) or disable (0) Pandora FMS Enterprise ICMP Server (PANDORA FMS ENTERPRISE ONLY). # You need nmap 5.20 or higher in order to use this ! diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 8e12c5226d..e31dbc5a6c 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -494,6 +494,8 @@ sub pandora_load_config { $pa_config->{"fsnmp"} = "/usr/bin/pandorafsnmp"; # 7.0 732 + $pa_config->{"event_inhibit_alerts"} = 0; # 7.0 737 + # Check for UID0 if ($pa_config->{"quiet"} != 0){ if ($> == 0){ @@ -917,6 +919,9 @@ sub pandora_load_config { elsif ($parametro =~ m/^event_file\s+(.*)/i) { $pa_config->{'event_file'}= clean_blank($1); } + elsif ($parametro =~ m/^event_inhibit_alerts\s+([0-1])/i) { + $pa_config->{'event_inhibit_alerts'}= clean_blank($1); + } elsif ($parametro =~ m/^text_going_down_normal\s+(.*)/i) { $pa_config->{'text_going_down_normal'} = safe_input ($1); } diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 7f9e50acea..d17ef7e771 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -725,6 +725,15 @@ sub pandora_execute_alert ($$$$$$$$$;$) { my ($pa_config, $data, $agent, $module, $alert, $alert_mode, $dbh, $timestamp, $forced_alert, $extra_macros) = @_; + # 'in-process' events can inhibit alers too. + if ($pa_config->{'event_inhibit_alerts'} == 1 && $alert_mode != RECOVERED_ALERT) { + my $status = get_db_value($dbh, 'SELECT estado FROM tevento WHERE id_alert_am = ? ORDER BY utimestamp DESC LIMIT 1', $alert->{'id_template_module'}); + if (defined($status) && $status == 2) { + logger ($pa_config, "Alert '" . safe_output($alert->{'name'}) . "' inhibited by in-process events.", 10); + return; + } + } + # Alerts in stand-by are not executed if ($alert->{'standby'} == 1) { if (defined ($module)) {