Avoid async modules to disable autodisable agents Tickets #3497
This commit is contained in:
parent
c5e97eb396
commit
088b85cd3e
|
@ -4672,10 +4672,27 @@ Puts all autodisable agents with all modules unknown on disabled mode
|
|||
sub pandora_disable_autodisable_agents ($$) {
|
||||
my ($pa_config, $dbh) = @_;
|
||||
|
||||
db_do ($dbh, 'UPDATE tagente SET disabled=1
|
||||
my $sql = 'SELECT id_agente FROM tagente
|
||||
WHERE disabled=0 AND
|
||||
tagente.total_count=tagente.unknown_count AND
|
||||
tagente.modo=2');
|
||||
tagente.unknown_count>0 AND
|
||||
tagente.modo=2';
|
||||
my @agents_autodisabled = get_db_rows ($dbh, $sql);
|
||||
return if !defined (@agents_autodisabled);
|
||||
|
||||
my $disable_agents = '';
|
||||
foreach my $agent (@agents_autodisabled) {
|
||||
if (get_agent_status ($pa_config, $dbh, $agent->{'id_agente'}) == 3) {
|
||||
$disable_agents .= $agent->{'id_agente'} . ',';
|
||||
}
|
||||
}
|
||||
return if ($disable_agents eq '');
|
||||
|
||||
# Remove the last quote
|
||||
$disable_agents =~ s/,$//ig;
|
||||
logger($pa_config, "Autodisable agents ($disable_agents) will be disabled", 9);
|
||||
|
||||
db_do ($dbh, 'UPDATE tagente SET disabled=1
|
||||
WHERE id_agente IN ('.$disable_agents.')');
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
|
|
|
@ -373,8 +373,7 @@ sub pandora_purgedb ($$) {
|
|||
db_do ($dbh, "DELETE FROM tagente
|
||||
WHERE UNIX_TIMESTAMP(ultimo_contacto) + ? < UNIX_TIMESTAMP(NOW())
|
||||
AND disabled=1
|
||||
AND modo=2
|
||||
AND total_count=unknown_count", $conf->{'_days_autodisable_deletion'}*8600);
|
||||
AND modo=2", $conf->{'_days_autodisable_deletion'}*8600);
|
||||
|
||||
|
||||
# Delete old netflow data
|
||||
|
|
Loading…
Reference in New Issue