Add an option to control alert queuing.

The alertserver_queue configuration option enables or disables alert
queuing for the local server. Ref. pandora_enterprise#8762.
This commit is contained in:
Ramon Novoa 2022-07-19 11:28:34 +02:00
parent 93e9992b19
commit 6aca4be90c
3 changed files with 8 additions and 1 deletions

View File

@ -723,6 +723,9 @@ alertserver_threads 4
# Generate an hourly warning event if alert execution is being delayed more than alertserver_warn seconds.
alertserver_warn 180
# If set to 1, alerts are queued for the Pandora FMS Alert Server.If alertserver is set to 1, alerts are always queued.
alertserver_queue 0
# Pandora FMS HA MySQL cluster splitbrain auto-recovery (PANDORA FMS ENTERPRISE ONLY)
# IMPORTANT! Please understand and configure all settings from pandora_console/index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster&tab=setup
# before enable this feature.

View File

@ -550,6 +550,7 @@ sub pandora_load_config {
$pa_config->{"alertserver"} = 0; # 7.0 756
$pa_config->{"alertserver_threads"} = 1; # 7.0 756
$pa_config->{"alertserver_warn"} = 180; # 7.0 756
$pa_config->{"alertserver_queue"} = 0; # 7.0 764
$pa_config->{'ncmserver'} = 0; # 7.0 758
$pa_config->{'ncmserver_threads'} = 1; # 7.0 758
@ -1284,6 +1285,9 @@ sub pandora_load_config {
elsif ($parametro =~ m/^alertserver_warn\s+([0-9]*)/i) {
$pa_config->{'alertserver_warn'}= clean_blank($1);
}
elsif ($parametro =~ m/^alertserver_queue\s+([0-1]*)/i) {
$pa_config->{'alertserver_queue'}= clean_blank($1);
}
elsif ($parametro =~ m/^ncmserver\s+([0-9]*)/i){
$pa_config->{'ncmserver'}= clean_blank($1);
}

View File

@ -795,7 +795,7 @@ sub pandora_process_alert ($$$$$$$$;$$) {
db_do($dbh, 'UPDATE talert_template_module_actions SET last_execution = 0 WHERE id_alert_template_module = ?', $id);
}
if ($pa_config->{'alertserver'} == 1) {
if ($pa_config->{'alertserver'} == 1 || $pa_config->{'alertserver_queue'} == 1) {
pandora_queue_alert($pa_config, $dbh, [$data, $agent, $module,
$alert, 0, $timestamp, 0, $extra_macros, $is_correlated_alert]);
} else {