Fixed secondary groups in alerts details
This commit is contained in:
parent
f7940908c2
commit
5c54afe673
|
@ -966,12 +966,12 @@ function agents_get_group_agents (
|
|||
$filter['order'] = 'alias';
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$table_name = 'tmetaconsole_agent LEFT JOIN tmetaconsole_agent_secondary_group ON ta.id_agente = tasg.id_agent';
|
||||
$table_name = 'tmetaconsole_agent ta LEFT JOIN tmetaconsole_agent_secondary_group tasg ON ta.id_agente = tasg.id_agent';
|
||||
|
||||
$fields = array(
|
||||
'id_tagente AS id_agente',
|
||||
'ta.id_tagente AS id_agente',
|
||||
'alias',
|
||||
'id_tmetaconsole_setup AS id_server'
|
||||
'ta.id_tmetaconsole_setup AS id_server'
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -50,7 +50,10 @@ function alerts_get_alerts($id_group = 0, $free_search = "", $status = "all", $s
|
|||
|
||||
$id_groups = array_keys($groups);
|
||||
|
||||
$group_query = " AND t3.id_grupo IN (" . implode(',', $id_groups) . ") ";
|
||||
$group_query = " AND (
|
||||
t3.id_grupo IN (" . implode(',', $id_groups) . ")
|
||||
OR tasg.id_group IN (" . implode(',', $id_groups) . ")
|
||||
)";
|
||||
}
|
||||
else {
|
||||
$group_query = "";
|
||||
|
@ -1792,9 +1795,12 @@ function get_group_alerts($id_group, $filter = '', $options = false,
|
|||
FROM tagente_modulo
|
||||
WHERE delete_pending = 0
|
||||
AND id_agente IN (SELECT id_agente
|
||||
FROM tagente
|
||||
FROM tagente ta
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE
|
||||
id_grupo IN (' . implode(',', $id_group) . '))';
|
||||
id_grupo IN (' . implode(',', $id_group) . ')
|
||||
OR id_group IN (' . implode(',', $id_group) . '))';
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1861,6 +1867,8 @@ function get_group_alerts($id_group, $filter = '', $options = false,
|
|||
ON talert_template_modules.id_agent_module = t2.id_agente_modulo
|
||||
INNER JOIN tagente t3
|
||||
ON t2.id_agente = t3.id_agente
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON tasg.id_agent = t2.id_agente
|
||||
INNER JOIN talert_templates t4
|
||||
ON talert_template_modules.id_alert_template = t4.id
|
||||
WHERE id_agent_module in (%s) %s %s %s",
|
||||
|
|
|
@ -187,77 +187,37 @@ if ($alert_validate) {
|
|||
enterprise_hook('open_meta_frame');
|
||||
|
||||
if ($free_search != '') {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$whereAlertSimple = 'AND (' .
|
||||
'id_alert_template IN (
|
||||
SELECT id
|
||||
FROM talert_templates
|
||||
WHERE name LIKE "%' . $free_search . '%") OR ' .
|
||||
'id_alert_template IN (
|
||||
SELECT id
|
||||
FROM talert_templates
|
||||
WHERE id_alert_action IN (
|
||||
SELECT id
|
||||
FROM talert_actions
|
||||
WHERE name LIKE "%' . $free_search . '%")) OR ' .
|
||||
'talert_template_modules.id IN (
|
||||
SELECT id_alert_template_module
|
||||
FROM talert_template_module_actions
|
||||
WHERE id_alert_action IN (
|
||||
SELECT id
|
||||
FROM talert_actions
|
||||
WHERE name LIKE "%' . $free_search . '%")) OR ' .
|
||||
'id_agent_module IN (
|
||||
SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE nombre LIKE "%' . $free_search . '%") OR ' .
|
||||
'id_agent_module IN (
|
||||
SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente IN (
|
||||
SELECT id_agente
|
||||
FROM tagente
|
||||
WHERE nombre LIKE "%' . $free_search . '%") OR alias LIKE "%' . $free_search . '%")' .
|
||||
')';
|
||||
|
||||
break;
|
||||
case "postgresql":
|
||||
case "oracle":
|
||||
$whereAlertSimple = 'AND (' .
|
||||
'id_alert_template IN (
|
||||
SELECT id
|
||||
FROM talert_templates
|
||||
WHERE name LIKE \'%' . $free_search . '%\') OR ' .
|
||||
'id_alert_template IN (
|
||||
SELECT id
|
||||
FROM talert_templates
|
||||
WHERE id_alert_action IN (
|
||||
SELECT id
|
||||
FROM talert_actions
|
||||
WHERE name LIKE \'%' . $free_search . '%\')) OR ' .
|
||||
'talert_template_modules.id IN (
|
||||
SELECT id_alert_template_module
|
||||
FROM talert_template_module_actions
|
||||
WHERE id_alert_action IN (
|
||||
SELECT id
|
||||
FROM talert_actions
|
||||
WHERE name LIKE \'%' . $free_search . '%\')) OR ' .
|
||||
'id_agent_module IN (
|
||||
SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE nombre LIKE \'%' . $free_search . '%\') OR ' .
|
||||
'id_agent_module IN (
|
||||
SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente IN (
|
||||
SELECT id_agente
|
||||
FROM tagente
|
||||
WHERE nombre LIKE \'%' . $free_search . '%\' OR alias LIKE \'%' . $free_search . '%\'))' .
|
||||
')';
|
||||
|
||||
break;
|
||||
}
|
||||
$whereAlertSimple = 'AND (' .
|
||||
'id_alert_template IN (
|
||||
SELECT id
|
||||
FROM talert_templates
|
||||
WHERE name LIKE "%' . $free_search . '%") OR ' .
|
||||
'id_alert_template IN (
|
||||
SELECT id
|
||||
FROM talert_templates
|
||||
WHERE id_alert_action IN (
|
||||
SELECT id
|
||||
FROM talert_actions
|
||||
WHERE name LIKE "%' . $free_search . '%")) OR ' .
|
||||
'talert_template_modules.id IN (
|
||||
SELECT id_alert_template_module
|
||||
FROM talert_template_module_actions
|
||||
WHERE id_alert_action IN (
|
||||
SELECT id
|
||||
FROM talert_actions
|
||||
WHERE name LIKE "%' . $free_search . '%")) OR ' .
|
||||
'id_agent_module IN (
|
||||
SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE nombre LIKE "%' . $free_search . '%") OR ' .
|
||||
'id_agent_module IN (
|
||||
SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente IN (
|
||||
SELECT id_agente
|
||||
FROM tagente
|
||||
WHERE nombre LIKE "%' . $free_search . '%") OR alias LIKE "%' . $free_search . '%")' .
|
||||
')';
|
||||
}
|
||||
else {
|
||||
$whereAlertSimple = '';
|
||||
|
|
Loading…
Reference in New Issue