Merge branch 'ent-10729-15255-15647-Numero-de-Agentes-en-Tactical-View-de-Metaconsola-incorrecto-cuando-los-Agentes-tienen-Grupos-Secundarios' into 'develop'
fix count See merge request artica/pandorafms!6191
This commit is contained in:
commit
47b46456b3
|
@ -150,16 +150,19 @@ function tactical_get_data(
|
|||
$data_stats = db_get_all_rows_sql($sql_stats);
|
||||
|
||||
$sql_stats_unknown = sprintf(
|
||||
'SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_unknown
|
||||
FROM tmetaconsole_agent tma
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
|
||||
ON tma.id_agente = tmasg.id_agent
|
||||
WHERE tma.disabled = 0
|
||||
AND (tma.id_grupo IN (%s) OR tmasg.id_group IN (%s))
|
||||
AND tma.critical_count = 0
|
||||
AND tma.warning_count = 0
|
||||
AND tma.unknown_count > 0
|
||||
GROUP BY tma.id_grupo',
|
||||
'SELECT COUNT(*) AS agents_unknown
|
||||
FROM (
|
||||
SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_unknown
|
||||
FROM tmetaconsole_agent tma
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
|
||||
ON tma.id_agente = tmasg.id_agent
|
||||
WHERE tma.disabled = 0
|
||||
AND (tma.id_grupo IN (%s) OR tmasg.id_group IN (%s))
|
||||
AND tma.critical_count = 0
|
||||
AND tma.warning_count = 0
|
||||
AND tma.unknown_count > 0
|
||||
GROUP BY tma.id_agente
|
||||
) AS grouped_data',
|
||||
$user_groups_ids,
|
||||
$user_groups_ids
|
||||
);
|
||||
|
@ -167,14 +170,17 @@ function tactical_get_data(
|
|||
$data_stats_unknown = db_get_all_rows_sql($sql_stats_unknown);
|
||||
|
||||
$sql_stats_not_init = sprintf(
|
||||
'SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_not_init
|
||||
FROM tmetaconsole_agent tma
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
|
||||
ON tma.id_agente = tmasg.id_agent
|
||||
WHERE tma.disabled = 0
|
||||
AND (tma.id_grupo IN (%s) OR tmasg.id_group IN (%s))
|
||||
AND (tma.total_count = 0 OR tma.total_count = tma.notinit_count)
|
||||
GROUP BY tma.id_grupo',
|
||||
'SELECT COUNT(*) AS agents_not_init
|
||||
FROM (
|
||||
SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_not_init
|
||||
FROM tmetaconsole_agent tma
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
|
||||
ON tma.id_agente = tmasg.id_agent
|
||||
WHERE tma.disabled = 0
|
||||
AND (tma.id_grupo IN (%s) OR tmasg.id_group IN (%s))
|
||||
AND (tma.total_count = 0 OR tma.total_count = tma.notinit_count)
|
||||
GROUP BY tma.id_agente
|
||||
) AS grouped_data',
|
||||
$user_groups_ids,
|
||||
$user_groups_ids
|
||||
);
|
||||
|
@ -182,17 +188,20 @@ function tactical_get_data(
|
|||
$data_stats_not_init = db_get_all_rows_sql($sql_stats_not_init);
|
||||
|
||||
$sql_stats_ok = sprintf(
|
||||
'SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_ok
|
||||
FROM tmetaconsole_agent tma
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
|
||||
ON tma.id_agente = tmasg.id_agent
|
||||
WHERE tma.disabled = 0
|
||||
AND (tma.id_grupo IN (%s) OR tmasg.id_group IN (%s))
|
||||
AND tma.critical_count = 0
|
||||
AND tma.warning_count = 0
|
||||
AND tma.unknown_count = 0
|
||||
AND tma.normal_count > 0
|
||||
GROUP BY tma.id_grupo',
|
||||
'SELECT COUNT(*) AS agents_ok
|
||||
FROM (
|
||||
SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_ok
|
||||
FROM tmetaconsole_agent tma
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
|
||||
ON tma.id_agente = tmasg.id_agent
|
||||
WHERE tma.disabled = 0
|
||||
AND (tma.id_grupo IN (%s) OR tmasg.id_group IN (%s))
|
||||
AND tma.critical_count = 0
|
||||
AND tma.warning_count = 0
|
||||
AND tma.unknown_count = 0
|
||||
AND tma.normal_count > 0
|
||||
GROUP BY tma.id_agente
|
||||
) AS grouped_data',
|
||||
$user_groups_ids,
|
||||
$user_groups_ids
|
||||
);
|
||||
|
@ -200,15 +209,18 @@ function tactical_get_data(
|
|||
$data_stats_ok = db_get_all_rows_sql($sql_stats_ok);
|
||||
|
||||
$sql_stats_warning = sprintf(
|
||||
'SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_warning
|
||||
FROM tmetaconsole_agent tma
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
|
||||
ON tma.id_agente = tmasg.id_agent
|
||||
WHERE tma.disabled = 0
|
||||
AND (tma.id_grupo IN (%s) OR tmasg.id_group IN (%s))
|
||||
AND tma.critical_count = 0
|
||||
AND tma.warning_count > 0
|
||||
GROUP BY tma.id_grupo',
|
||||
'SELECT COUNT(*) AS agents_warning
|
||||
FROM (
|
||||
SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_warning
|
||||
FROM tmetaconsole_agent tma
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
|
||||
ON tma.id_agente = tmasg.id_agent
|
||||
WHERE tma.disabled = 0
|
||||
AND (tma.id_grupo IN (%s) OR tmasg.id_group IN (%s))
|
||||
AND tma.critical_count = 0
|
||||
AND tma.warning_count > 0
|
||||
GROUP BY tma.id_agente
|
||||
) AS grouped_data',
|
||||
$user_groups_ids,
|
||||
$user_groups_ids
|
||||
);
|
||||
|
@ -216,14 +228,17 @@ function tactical_get_data(
|
|||
$data_stats_warning = db_get_all_rows_sql($sql_stats_warning);
|
||||
|
||||
$sql_stats_critical = sprintf(
|
||||
'SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_critical
|
||||
FROM tmetaconsole_agent tma
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
|
||||
ON tma.id_agente = tmasg.id_agent
|
||||
WHERE tma.disabled = 0
|
||||
AND (tma.id_grupo IN (%s) OR tmasg.id_group IN (%s))
|
||||
AND tma.critical_count > 0
|
||||
GROUP BY tma.id_grupo',
|
||||
'SELECT COUNT(*) AS agents_critical
|
||||
FROM (
|
||||
SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_critical
|
||||
FROM tmetaconsole_agent tma
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
|
||||
ON tma.id_agente = tmasg.id_agent
|
||||
WHERE tma.disabled = 0
|
||||
AND (tma.id_grupo IN (%s) OR tmasg.id_group IN (%s))
|
||||
AND tma.critical_count > 0
|
||||
GROUP BY tma.id_agente
|
||||
) AS grouped_data',
|
||||
$user_groups_ids,
|
||||
$user_groups_ids
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue