2013-08-29 Miguel de Dios <miguel.dedios@artica.es>

* lib/PandoraFMS/Core.pm: into the function "pandora_module_unknown"
	now checks if the module have disable unknown events.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8714 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-08-29 13:01:12 +00:00
parent a1b163e263
commit 1ebaeac2e5
2 changed files with 46 additions and 17 deletions

View File

@ -1,3 +1,8 @@
2013-08-29 Miguel de Dios <miguel.dedios@artica.es>
* lib/PandoraFMS/Core.pm: into the function "pandora_module_unknown"
now checks if the module have disable unknown events.
2013-08-29 Miguel de Dios <miguel.dedios@artica.es>
* util/pandora_manage.pl: added support to disable/enable unknown

View File

@ -109,6 +109,10 @@ use POSIX qw(strftime);
use threads;
use threads::shared;
use JSON qw(decode_json);
# Debugging
#use Data::Dumper;
# Force XML::Simple to use XML::Parser instead SAX to manage XML
# due a bug processing some XML with blank spaces.
# See http://www.perlmonks.org/?node_id=706838
@ -3866,7 +3870,10 @@ sub pandora_module_unknown ($$) {
db_do ($dbh, 'UPDATE tagente_estado SET last_known_status = estado, last_status = 0, estado = 0 WHERE id_agente_estado = ?', $module->{'id_agente_estado'});
# Get agent information
my $agent = get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE id_agente = ?', $module->{'id_agente'});
my $agent = get_db_single_row ($dbh, 'SELECT *
FROM tagente
WHERE id_agente = ?', $module->{'id_agente'});
if (! defined ($agent)) {
logger($pa_config, "Agent ID " . $module->{'id_agente'} . " not found while executing unknown alerts for module '" . $module->{'nombre'} . "'.", 3);
return;
@ -3913,13 +3920,30 @@ sub pandora_module_unknown ($$) {
logger($pa_config, "Alerts inhibited for agent '" . $agent->{'nombre'} . "'.", 10);
}
my $do_event = 0;
if ($module->{'disabled_types_event'} eq "") {
$do_event = 1;
}
else {
my $disabled_types_event = decode_json($module->{'disabled_types_event'});
if ($disabled_types_event->{'going_unknown'}) {
$do_event = 0;
}
else {
$do_event = 1;
}
}
# Generate event with severity minor
if ($do_event) {
my ($event_type, $severity) = ('going_unknown', 5);
my $description = "Module " . safe_output($module->{'nombre'}) . " is going to UNKNOWN";
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'});
}
}
}
}
##########################################################################