Remove a semaphore that is no longer needed. Thanks fbsanchez!
Ref pandora_enterprise#3060.
This commit is contained in:
parent
0dd6c54651
commit
be79ae83fb
|
@ -52,7 +52,6 @@ my %Agents :shared;
|
||||||
my $Sem :shared;
|
my $Sem :shared;
|
||||||
my $TaskSem :shared;
|
my $TaskSem :shared;
|
||||||
my $AgentSem :shared;
|
my $AgentSem :shared;
|
||||||
my $ModuleSem :shared;
|
|
||||||
|
|
||||||
########################################################################################
|
########################################################################################
|
||||||
# Data Server class constructor.
|
# Data Server class constructor.
|
||||||
|
@ -69,7 +68,6 @@ sub new ($$;$) {
|
||||||
$Sem = Thread::Semaphore->new;
|
$Sem = Thread::Semaphore->new;
|
||||||
$TaskSem = Thread::Semaphore->new (0);
|
$TaskSem = Thread::Semaphore->new (0);
|
||||||
$AgentSem = Thread::Semaphore->new (1);
|
$AgentSem = Thread::Semaphore->new (1);
|
||||||
$ModuleSem = Thread::Semaphore->new (1);
|
|
||||||
|
|
||||||
# Call the constructor of the parent class
|
# Call the constructor of the parent class
|
||||||
my $self = $class->SUPER::new($config, DATASERVER, \&PandoraFMS::DataServer::data_producer, \&PandoraFMS::DataServer::data_consumer, $dbh);
|
my $self = $class->SUPER::new($config, DATASERVER, \&PandoraFMS::DataServer::data_producer, \&PandoraFMS::DataServer::data_consumer, $dbh);
|
||||||
|
@ -677,7 +675,6 @@ sub process_module_data ($$$$$$$$$$) {
|
||||||
$module_conf->{'module_macros'} = '' unless defined ($module_conf->{'module_macros'});
|
$module_conf->{'module_macros'} = '' unless defined ($module_conf->{'module_macros'});
|
||||||
|
|
||||||
# Get module data or create it if it does not exist
|
# Get module data or create it if it does not exist
|
||||||
$ModuleSem->down ();
|
|
||||||
my $module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND ' . db_text ('nombre') . ' = ?', $agent->{'id_agente'}, safe_input($module_name));
|
my $module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND ' . db_text ('nombre') . ' = ?', $agent->{'id_agente'}, safe_input($module_name));
|
||||||
if (! defined ($module)) {
|
if (! defined ($module)) {
|
||||||
|
|
||||||
|
@ -685,14 +682,12 @@ sub process_module_data ($$$$$$$$$$) {
|
||||||
# Do not auto create modules
|
# Do not auto create modules
|
||||||
#if ($pa_config->{'autocreate'} ne '1') {
|
#if ($pa_config->{'autocreate'} ne '1') {
|
||||||
# logger($pa_config, "Module '$module_name' not found for agent '$agent_name' and module auto-creation disabled.", 10);
|
# logger($pa_config, "Module '$module_name' not found for agent '$agent_name' and module auto-creation disabled.", 10);
|
||||||
# $ModuleSem->up ();
|
|
||||||
# return;
|
# return;
|
||||||
#}
|
#}
|
||||||
|
|
||||||
# Is the agent not learning?
|
# Is the agent not learning?
|
||||||
if (($agent->{'modo'} == 0) && !($force_processing)) {
|
if (($agent->{'modo'} == 0) && !($force_processing)) {
|
||||||
logger($pa_config, "Learning mode disabled. Skipping module '$module_name' agent '$agent_name'.", 10);
|
logger($pa_config, "Learning mode disabled. Skipping module '$module_name' agent '$agent_name'.", 10);
|
||||||
$ModuleSem->up ();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,7 +695,6 @@ sub process_module_data ($$$$$$$$$$) {
|
||||||
$module_conf->{'id_tipo_modulo'} = get_module_id ($dbh, $module_type);
|
$module_conf->{'id_tipo_modulo'} = get_module_id ($dbh, $module_type);
|
||||||
if ($module_conf->{'id_tipo_modulo'} <= 0) {
|
if ($module_conf->{'id_tipo_modulo'} <= 0) {
|
||||||
logger($pa_config, "Invalid module type '$module_type' for module '$module_name' agent '$agent_name'.", 3);
|
logger($pa_config, "Invalid module type '$module_type' for module '$module_name' agent '$agent_name'.", 3);
|
||||||
$ModuleSem->up ();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -758,7 +752,6 @@ sub process_module_data ($$$$$$$$$$) {
|
||||||
$module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND ' . db_text('nombre') . ' = ?', $agent->{'id_agente'}, safe_input($module_name));
|
$module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND ' . db_text('nombre') . ' = ?', $agent->{'id_agente'}, safe_input($module_name));
|
||||||
if (! defined ($module)) {
|
if (! defined ($module)) {
|
||||||
logger($pa_config, "Could not create module '$module_name' for agent '$agent_name'.", 3);
|
logger($pa_config, "Could not create module '$module_name' for agent '$agent_name'.", 3);
|
||||||
$ModuleSem->up ();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -816,8 +809,6 @@ sub process_module_data ($$$$$$$$$$) {
|
||||||
update_module_configuration ($pa_config, $dbh, $module, $module_conf);
|
update_module_configuration ($pa_config, $dbh, $module, $module_conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ModuleSem->up ();
|
|
||||||
|
|
||||||
# Module disabled!
|
# Module disabled!
|
||||||
if ($module->{'disabled'} eq '1') {
|
if ($module->{'disabled'} eq '1') {
|
||||||
logger($pa_config, "Skipping disabled module '$module_name' agent '$agent_name'.", 10);
|
logger($pa_config, "Skipping disabled module '$module_name' agent '$agent_name'.", 10);
|
||||||
|
|
Loading…
Reference in New Issue