Merge branch 'ent-12028-la-vista-group-detail-no-esta-mostrando-los-agentes-que-tienen-el-grupo-mostrado-como-gru' into 'develop'

Ent 12028 La vista "group detail" no está mostrando los agentes que tienen el grupo mostrado como grupo secundario

See merge request artica/pandorafms!6446
This commit is contained in:
Rafael Ameijeiras 2023-09-13 12:50:55 +00:00
commit 046657e78a
3 changed files with 24 additions and 14 deletions

View File

@ -5382,9 +5382,11 @@ function graph_so_by_group($id_group, $width=300, $height=200, $recursive=true,
'SELECT COUNT(id_agente) AS count,
os.name
FROM tagente a
LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente
LEFT JOIN tconfig_os os ON a.id_os = os.id_os
WHERE a.id_grupo IN (%s)
WHERE a.id_grupo IN (%s) OR g.id_group IN (%s)
GROUP BY os.id_os',
implode(',', $id_groups),
implode(',', $id_groups)
);
@ -5466,7 +5468,7 @@ function graph_events_agent_by_group($id_group, $width=300, $height=200, $noWate
}
}
$filter_groups = ' AND te.id_grupo IN ('.implode(',', $id_groups).') ';
$filter_groups = ' AND (te.id_grupo IN ('.implode(',', $id_groups).') OR g.id_group IN ('.implode(',', $id_groups).'))';
// This will give the distinct id_agente, give the id_grupo that goes
// with it and then the number of times it occured. GROUP BY statement
@ -5475,7 +5477,8 @@ function graph_events_agent_by_group($id_group, $width=300, $height=200, $noWate
'SELECT DISTINCT(id_agente) AS id_agente,
COUNT(id_agente) AS count
FROM tevento te
WHERE 1=1 AND estado = 0
LEFT JOIN tagent_secondary_group g ON g.id_agent = te.id_agente
WHERE 1=1 AND estado = 0
%s %s
GROUP BY id_agente
ORDER BY count DESC LIMIT 8',

View File

@ -2501,7 +2501,9 @@ function groups_get_heat_map_agents(array $id_group, float $width=0, float $heig
$id_group = [$id_group];
}
$sql = 'SELECT * FROM tagente WHERE id_grupo IN('.implode(',', $id_group).')';
$sql = 'SELECT * FROM tagente a
LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente
WHERE a.id_grupo IN ('.implode(',', $id_group).') OR g.id_group IN ('.implode(',', $id_group).')';
$all_agents = db_get_all_rows_sql($sql);
if (empty($all_agents)) {
@ -2654,8 +2656,8 @@ function tactical_groups_get_agents_and_monitoring($id_groups, $data='')
if ($data === '') {
$data = [
'total_agents' => groups_agents_total_counters($id_groups, false)['total'],
'monitor_total' => groups_get_total_monitors($id_groups, [], [], false, false, false, false),
'total_agents' => groups_agents_total_counters($id_groups, true)['total'],
'monitor_total' => groups_get_total_monitors($id_groups, [], [], false, false, false, true),
];
}
@ -2719,7 +2721,7 @@ function tactical_groups_get_stats_alerts($id_groups, $data='')
}
$urls = [];
$urls['monitor_alerts'] = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&ag_group='.$id_groups[0];
$urls['monitor_alerts'] = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&disabled=all&ag_group='.$id_groups[0];
$urls['monitor_alerts_fired'] = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&disabled=fired&ag_group='.$id_groups[0];
// Alerts table.
@ -2790,11 +2792,11 @@ function groups_get_stats_modules_status($id_groups, $graph_width=250, $graph_he
if ($data === '') {
$data = [
'monitor_critical' => groups_get_critical_monitors($id_groups, [], [], false, false, false, false),
'monitor_warning' => groups_get_warning_monitors($id_groups, [], [], false, false, false, false),
'monitor_ok' => groups_get_normal_monitors($id_groups, [], [], false, false, false, false),
'monitor_unknown' => groups_get_unknown_monitors($id_groups, [], [], false, false, false, false),
'monitor_not_init' => groups_get_not_init_monitors($id_groups, [], [], false, false, false, false),
'monitor_critical' => groups_get_critical_monitors($id_groups, [], [], false, false, false, true),
'monitor_warning' => groups_get_warning_monitors($id_groups, [], [], false, false, false, true),
'monitor_ok' => groups_get_normal_monitors($id_groups, [], [], false, false, false, true),
'monitor_unknown' => groups_get_unknown_monitors($id_groups, [], [], false, false, false, true),
'monitor_not_init' => groups_get_not_init_monitors($id_groups, [], [], false, false, false, true),
];
}

View File

@ -663,11 +663,14 @@ class Group extends Entity
ultimo_contacto_remoto,
fired_count
FROM tagente t
LEFT JOIN tagent_secondary_group g ON g.id_agent = t.id_agente
WHERE disabled = 0 AND
total_count <> notinit_count AND
id_grupo IN (%s)
(id_grupo IN (%s) OR id_group IN (%s))
%s %s',
implode(',', $id_groups),
implode(',', $id_groups),
$order,
$pagination
);
@ -686,11 +689,13 @@ class Group extends Entity
ultimo_contacto_remoto,
fired_count
FROM tagente t
LEFT JOIN tagent_secondary_group g ON g.id_agent = t.id_agente
WHERE disabled = 0 AND
total_count <> notinit_count AND
id_grupo IN (%s)
(id_grupo IN (%s) OR id_group IN (%s))
%s',
implode(',', $id_groups),
implode(',', $id_groups),
$order,
);