diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 9fb203a895..464bd5aec6 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -515,6 +515,9 @@ console_pass pandora # Passphrase used to generate the key for password encryption (PANDORA FMS ENTERPRISE ONLY). #encryption_passphrase passphrase +# Enable (1) or disable (0) events related to the unknown module status. +unknown_events 1 + # Time interval (as a multiple of the module interval) before a module becomes unknown. Twice the module's interval by default. #unknown_interval 2 diff --git a/pandora_server/conf/pandora_server.conf.windows b/pandora_server/conf/pandora_server.conf.windows index d843fc1048..c6408ae903 100644 --- a/pandora_server/conf/pandora_server.conf.windows +++ b/pandora_server/conf/pandora_server.conf.windows @@ -489,6 +489,9 @@ console_pass pandora # Passphrase used to generate the key for password encryption (PANDORA FMS ENTERPRISE ONLY). #encryption_passphrase passphrase +# Enable (1) or disable (0) events related to the unknown module status. +unknown_events 1 + # Time interval (as a multiple of the module interval) before a module becomes unknown. Twice the module's interval by default. #unknown_interval 2 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index a88c33ab80..0fab7ff5df 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -430,6 +430,9 @@ sub pandora_load_config { # External .enc files for XML::Parser. $pa_config->{"enc_dir"} = ""; # > 6.0SP4 + # Enable (1) or disable (0) events related to the unknown status. + $pa_config->{"unknown_events"} = 1; # > 6.0SP4 + # Check for UID0 if ($pa_config->{"quiet"} != 0){ if ($> == 0){ @@ -962,6 +965,9 @@ sub pandora_load_config { elsif ($parametro =~ m/^enc_dir\s+(.*)/i) { $pa_config->{'enc_dir'} = clean_blank($1); } + elsif ($parametro =~ m/^unknown_events\s+([0-1])/i) { + $pa_config->{'unknown_events'} = clean_blank($1); + } } # end of loop for parameter # # Set to RDBMS' standard port diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 932f11c67f..1aee4f5baf 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -3847,6 +3847,11 @@ sub generate_status_event ($$$$$$$$) { pandora_event ($pa_config, "Warmup mode for events ended.", 0, 0, 0, 0, 0, 'system', 0, $dbh); } + # Disable events related to the unknown status. + if ($pa_config->{'unknown_events'} == 0 && ($last_status == 3 || $status == 3)) { + return; + } + # disable event just recovering from 'Unknown' without status change if($last_status == 3 && $status == $known_status && $module->{'disabled_types_event'} ) { my $disabled_types_event; @@ -4627,8 +4632,11 @@ sub pandora_module_unknown ($$) { load_module_macros ($module->{'module_macros'}, \%macros); $description = subst_alert_macros ($description, \%macros, $pa_config, $dbh, $agent, $module); - pandora_event ($pa_config, $description, $agent->{'id_grupo'}, $module->{'id_agente'}, - $severity, 0, $module->{'id_agente_modulo'}, $event_type, 0, $dbh, 'Pandora', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'}); + # Are unknown events enabled? + if ($pa_config->{'unknown_events'} == 1) { + pandora_event ($pa_config, $description, $agent->{'id_grupo'}, $module->{'id_agente'}, + $severity, 0, $module->{'id_agente_modulo'}, $event_type, 0, $dbh, 'Pandora', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'}); + } } # Regular module else { @@ -4654,8 +4662,12 @@ sub pandora_module_unknown ($$) { logger($pa_config, "Alerts inhibited for agent '" . $agent->{'nombre'} . "'.", 10); } - my $do_event = 0; - if (!defined($module->{'disabled_types_event'}) || $module->{'disabled_types_event'} eq "") { + my $do_event; + # Are unknown events enabled? + if ($pa_config->{'unknown_events'} == 0) { + $do_event = 0; + } + elsif (!defined($module->{'disabled_types_event'}) || $module->{'disabled_types_event'} eq "") { $do_event = 1; } else {