'in-process' events can now inhibit alerts.

Ref pandora_enterprise#3747
This commit is contained in:
Ramon Novoa 2019-07-31 09:06:51 +02:00
parent 8279fff11b
commit eaa7edd89f
4 changed files with 22 additions and 0 deletions

View File

@ -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 !

View File

@ -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 !

View File

@ -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);
}

View File

@ -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)) {