Merge branch 'ent-3747-deshabilitar-alertas-con-eventos-en-proceso' into 'develop'

'in-process' events can now inhibit alerts.

See merge request artica/pandorafms!2624
This commit is contained in:
Alejandro Fraguas 2019-07-31 11:58:48 +02:00
commit b47e66d35b
4 changed files with 22 additions and 0 deletions

View File

@ -429,6 +429,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

@ -379,6 +379,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

@ -495,6 +495,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){
@ -921,6 +923,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

@ -726,6 +726,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)) {