Merge branch 'ent-12124-modo-autodisabled-de-los-agentes-no-se-comporta-como-se-espera' into 'develop'

Ent 12124 modo autodisabled de los agentes no se comporta como se espera

Closes pandora_enterprise#12124

See merge request artica/pandorafms!6782
This commit is contained in:
Diego Muñoz-Reja 2024-01-24 10:51:54 +00:00
commit 481e5bb670
2 changed files with 13 additions and 5 deletions

View File

@ -7191,10 +7191,18 @@ Puts all autodisable agents with all modules unknown on disabled mode
sub pandora_disable_autodisable_agents ($$) {
my ($pa_config, $dbh) = @_;
my $sql = 'SELECT id_agente FROM tagente
WHERE disabled=0 AND
tagente.unknown_count>0 AND
tagente.modo=2';
my $sql = 'SELECT id_agente
FROM (
SELECT tm.id_agente, count(*) as sync_modules, ta.unknown_count
FROM tagente_modulo tm
JOIN tagente ta ON ta.id_agente = tm.id_agente
WHERE ta.disabled = 0
AND NOT ((id_tipo_modulo >= 21 AND id_tipo_modulo <= 23) OR id_tipo_modulo = 100)
GROUP BY tm.id_agente
) AS subquery
WHERE subquery.unknown_count >= subquery.sync_modules;';
my @agents_autodisabled = get_db_rows ($dbh, $sql);
return if ($#agents_autodisabled < 0);

View File

@ -1533,7 +1533,7 @@ sub get_agent_addr_id ($$$) {
########################################################################
sub db_do ($$;@) {
my ($dbh, $query, @values) = @_;
#DBI->trace( 3, '/tmp/dbitrace.log' );
eval {
$dbh->do($query, undef, @values);