diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php index 8b1e4fe35f..99837ca824 100755 --- a/pandora_console/godmode/massive/massive_edit_agents.php +++ b/pandora_console/godmode/massive/massive_edit_agents.php @@ -135,9 +135,6 @@ if ($update_agents) { $result = false; foreach ($id_agents as $id_agent) { if (!empty($values)) { - if ($config['metaconsole_agent_cache'] == 1) { - $values['update_module_count'] = 1; // Force an update of the agent cache. - } $group_old = false; if($values['id_grupo']){ $group_old = db_get_sql("SELECT id_grupo FROM tagente WHERE id_agente =" .$id_agent); @@ -146,6 +143,12 @@ if ($update_agents) { $result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agent)); + + if ($result && $config['metaconsole_agent_cache'] == 1) { + $server_name['server_name'] = db_get_sql("SELECT server_name FROM tagente WHERE id_agente =" .$id_agent); + // Force an update of the agent cache. + $result_metaconsole = agent_update_from_cache($id_agent,$values,$server_name); + } if($group_old || $result){ if ($group_old && $group_old != null) { diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server index 03ff4ac0fe..1f13627cb3 100755 --- a/pandora_server/bin/pandora_server +++ b/pandora_server/bin/pandora_server @@ -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 (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 disabled = 0 AND (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); diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index d0188ced6c..1d3784348c 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -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.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.disabled=0 AND 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'};