Merge branch '1674-Sincronizacion-de-agentes-inmediata-con-metaconsola-en-operación-masiva' into 'develop'

Update metaconsole after agent bulk operations for update - #1674

See merge request artica/pandorafms!1174
This commit is contained in:
vgilc 2018-01-29 13:29:40 +01:00
commit bc6b660592
3 changed files with 3 additions and 4 deletions

View File

@ -135,8 +135,7 @@ if ($update_agents) {
$result = false;
foreach ($id_agents as $id_agent) {
if (!empty($values)) {
if ($config['metaconsole_agent_cache'] == 1 &&
isset($values['id_grupo'])) {
if ($config['metaconsole_agent_cache'] == 1) {
$values['update_module_count'] = 1; // Force an update of the agent cache.
}
$group_old = false;

View File

@ -293,7 +293,7 @@ sub pandora_server_tasks ($) {
if (($counter % 30) == 0) {
# Update module status and fired alert counts
my @agents = get_db_rows ($dbh, 'SELECT id_agente, nombre, update_module_count, update_alert_count FROM tagente WHERE disabled = 0 AND (update_module_count=1 OR update_alert_count=1)');
my @agents = get_db_rows ($dbh, 'SELECT id_agente, nombre, update_module_count, update_alert_count FROM tagente WHERE (update_module_count=1 OR update_alert_count=1)');
foreach my $agent (@agents) {
logger ($pa_config, "Updating module status and fired alert counts for agent " . $agent->{'nombre'}, 10);

View File

@ -5155,7 +5155,7 @@ sub pandora_update_agent_module_count ($$$) {
}; # Module counts by status.
# Retrieve and hash module status counts.
my @rows = get_db_rows ($dbh, 'SELECT estado, COUNT(*) AS total FROM tagente_modulo, tagente_estado WHERE tagente_modulo.disabled=0 AND tagente_modulo.id_agente_modulo=tagente_estado.id_agente_modulo AND tagente_modulo.id_agente=?GROUP BY estado', $agent_id);
my @rows = get_db_rows ($dbh, 'SELECT estado, COUNT(*) AS total FROM tagente_modulo, tagente_estado WHERE tagente_modulo.id_agente_modulo=tagente_estado.id_agente_modulo AND tagente_modulo.id_agente=?GROUP BY estado', $agent_id);
foreach my $row (@rows) {
$counts->{$row->{'estado'}} = $row->{'total'};
$total += $row->{'total'};