Merge branch '1853-Modulos-DISABLED-en-critical-dev' into 'develop'
Fixed disabled agent in bulk operations See merge request artica/pandorafms!1292
This commit is contained in:
commit
4eafda8b15
|
@ -135,9 +135,6 @@ if ($update_agents) {
|
||||||
$result = false;
|
$result = false;
|
||||||
foreach ($id_agents as $id_agent) {
|
foreach ($id_agents as $id_agent) {
|
||||||
if (!empty($values)) {
|
if (!empty($values)) {
|
||||||
if ($config['metaconsole_agent_cache'] == 1) {
|
|
||||||
$values['update_module_count'] = 1; // Force an update of the agent cache.
|
|
||||||
}
|
|
||||||
$group_old = false;
|
$group_old = false;
|
||||||
if($values['id_grupo']){
|
if($values['id_grupo']){
|
||||||
$group_old = db_get_sql("SELECT id_grupo FROM tagente WHERE id_agente =" .$id_agent);
|
$group_old = db_get_sql("SELECT id_grupo FROM tagente WHERE id_agente =" .$id_agent);
|
||||||
|
@ -147,6 +144,12 @@ if ($update_agents) {
|
||||||
$values,
|
$values,
|
||||||
array ('id_agente' => $id_agent));
|
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 || $result){
|
||||||
if ($group_old && $group_old != null) {
|
if ($group_old && $group_old != null) {
|
||||||
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
|
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
|
||||||
|
|
|
@ -293,7 +293,7 @@ sub pandora_server_tasks ($) {
|
||||||
if (($counter % 30) == 0) {
|
if (($counter % 30) == 0) {
|
||||||
|
|
||||||
# Update module status and fired alert counts
|
# 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) {
|
foreach my $agent (@agents) {
|
||||||
logger ($pa_config, "Updating module status and fired alert counts for agent " . $agent->{'nombre'}, 10);
|
logger ($pa_config, "Updating module status and fired alert counts for agent " . $agent->{'nombre'}, 10);
|
||||||
|
|
||||||
|
|
|
@ -5155,7 +5155,7 @@ sub pandora_update_agent_module_count ($$$) {
|
||||||
}; # Module counts by status.
|
}; # Module counts by status.
|
||||||
|
|
||||||
# Retrieve and hash module status counts.
|
# 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) {
|
foreach my $row (@rows) {
|
||||||
$counts->{$row->{'estado'}} = $row->{'total'};
|
$counts->{$row->{'estado'}} = $row->{'total'};
|
||||||
$total += $row->{'total'};
|
$total += $row->{'total'};
|
||||||
|
|
Loading…
Reference in New Issue