Added an option to disable events related to unknown modules.
This commit is contained in:
parent
26b50bd95e
commit
17bf92b695
|
@ -515,6 +515,9 @@ console_pass pandora
|
||||||
# Passphrase used to generate the key for password encryption (PANDORA FMS ENTERPRISE ONLY).
|
# Passphrase used to generate the key for password encryption (PANDORA FMS ENTERPRISE ONLY).
|
||||||
#encryption_passphrase passphrase
|
#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.
|
# Time interval (as a multiple of the module interval) before a module becomes unknown. Twice the module's interval by default.
|
||||||
#unknown_interval 2
|
#unknown_interval 2
|
||||||
|
|
||||||
|
|
|
@ -489,6 +489,9 @@ console_pass pandora
|
||||||
# Passphrase used to generate the key for password encryption (PANDORA FMS ENTERPRISE ONLY).
|
# Passphrase used to generate the key for password encryption (PANDORA FMS ENTERPRISE ONLY).
|
||||||
#encryption_passphrase passphrase
|
#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.
|
# Time interval (as a multiple of the module interval) before a module becomes unknown. Twice the module's interval by default.
|
||||||
#unknown_interval 2
|
#unknown_interval 2
|
||||||
|
|
||||||
|
|
|
@ -430,6 +430,9 @@ sub pandora_load_config {
|
||||||
# External .enc files for XML::Parser.
|
# External .enc files for XML::Parser.
|
||||||
$pa_config->{"enc_dir"} = ""; # > 6.0SP4
|
$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
|
# Check for UID0
|
||||||
if ($pa_config->{"quiet"} != 0){
|
if ($pa_config->{"quiet"} != 0){
|
||||||
if ($> == 0){
|
if ($> == 0){
|
||||||
|
@ -962,6 +965,9 @@ sub pandora_load_config {
|
||||||
elsif ($parametro =~ m/^enc_dir\s+(.*)/i) {
|
elsif ($parametro =~ m/^enc_dir\s+(.*)/i) {
|
||||||
$pa_config->{'enc_dir'} = clean_blank($1);
|
$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 #
|
} # end of loop for parameter #
|
||||||
|
|
||||||
# Set to RDBMS' standard port
|
# Set to RDBMS' standard port
|
||||||
|
|
|
@ -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);
|
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
|
# disable event just recovering from 'Unknown' without status change
|
||||||
if($last_status == 3 && $status == $known_status && $module->{'disabled_types_event'} ) {
|
if($last_status == 3 && $status == $known_status && $module->{'disabled_types_event'} ) {
|
||||||
my $disabled_types_event;
|
my $disabled_types_event;
|
||||||
|
@ -4627,8 +4632,11 @@ sub pandora_module_unknown ($$) {
|
||||||
load_module_macros ($module->{'module_macros'}, \%macros);
|
load_module_macros ($module->{'module_macros'}, \%macros);
|
||||||
$description = subst_alert_macros ($description, \%macros, $pa_config, $dbh, $agent, $module);
|
$description = subst_alert_macros ($description, \%macros, $pa_config, $dbh, $agent, $module);
|
||||||
|
|
||||||
pandora_event ($pa_config, $description, $agent->{'id_grupo'}, $module->{'id_agente'},
|
# Are unknown events enabled?
|
||||||
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 0, $dbh, 'Pandora', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'});
|
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
|
# Regular module
|
||||||
else {
|
else {
|
||||||
|
@ -4654,8 +4662,12 @@ sub pandora_module_unknown ($$) {
|
||||||
logger($pa_config, "Alerts inhibited for agent '" . $agent->{'nombre'} . "'.", 10);
|
logger($pa_config, "Alerts inhibited for agent '" . $agent->{'nombre'} . "'.", 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $do_event = 0;
|
my $do_event;
|
||||||
if (!defined($module->{'disabled_types_event'}) || $module->{'disabled_types_event'} eq "") {
|
# 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;
|
$do_event = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue