From 5cd7b95996d4740aa70d56619d6338dd2ace3704 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 21 Aug 2012 19:06:47 +0000 Subject: [PATCH] 2012-08-21 Miguel de Dios * lib/PandoraFMS/Core.pm: added in the modules the same feature to set agent in "Quiet" mode. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6899 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 5 +++++ pandora_server/lib/PandoraFMS/Core.pm | 28 +++++++++++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 550fe45e39..a7a106134e 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2012-08-21 Miguel de Dios + + * lib/PandoraFMS/Core.pm: added in the modules the same feature to + set agent in "Quiet" mode. + 2012-08-21 Miguel de Dios * lib/PandoraFMS/Server.pm:: added the feature to set a agent in diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index c1d1836422..ae20ccd81b 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -227,6 +227,11 @@ sub pandora_generate_alerts ($$$$$$$$;$$$) { return; } + if ($module->{'quiet'} == 1) { + logger($pa_config, "Generate Alert. The module '" . $module->{'nombre'} . "' is in quiet mode.", 10); + + return; + } # Do not generate alerts for disabled groups if (is_group_disabled ($dbh, $agent->{'id_grupo'})) { @@ -1605,12 +1610,23 @@ sub pandora_event ($$$$$$$$$$;$$$$$) { my ($pa_config, $evento, $id_grupo, $id_agente, $severity, $id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh, $source, $user_name, $comment, $id_extra, $tags) = @_; - my $agent = get_db_single_row ($dbh, 'SELECT * - FROM tagente WHERE id_agente = ?', $id_agente); - if ($agent->{'quiet'} == 1) { - logger($pa_config, "Generate Event. The agent '" . $agent->{'nombre'} . "' is in quiet mode.", 10); - - return; + if ($id_agente != 0) { + my $agent = get_db_single_row ($dbh, 'SELECT * + FROM tagente WHERE id_agente = ?', $id_agente); + if ($agent->{'quiet'} == 1) { + logger($pa_config, "Generate Event. The agent '" . $agent->{'nombre'} . "' is in quiet mode.", 10); + + return; + } + } + if ($id_agentmodule != 0) { + my $module = get_db_single_row ($dbh, 'SELECT * + FROM tagente_modulo WHERE id_agente_modulo = ?', $id_agentmodule); + if ($module->{'quiet'} == 1) { + logger($pa_config, "Generate Event. The module '" . $module->{'nombre'} . "' is in quiet mode.", 10); + + return; + } } logger($pa_config, "Generating event '$evento' for agent ID $id_agente module ID $id_agentmodule.", 10);