Fixed problems with acl strict in group view. Ticket#3347
This commit is contained in:
parent
0f98652e0c
commit
7a862cacc4
|
@ -29,6 +29,14 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
|
||||||
if ($user_strict) { //Remove groups with tags
|
if ($user_strict) { //Remove groups with tags
|
||||||
$groups_without_tags[$group] = $group;
|
$groups_without_tags[$group] = $group;
|
||||||
}
|
}
|
||||||
|
$user_groups[$group] = groups_get_name($group);
|
||||||
|
if ($tags != '') {
|
||||||
|
$tags_group = explode(',', $tags);
|
||||||
|
|
||||||
|
foreach ($tags_group as $tag) {
|
||||||
|
$user_tags[$tag] = tags_get_name($tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_strict) {
|
if ($user_strict) {
|
||||||
|
@ -240,54 +248,61 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
|
||||||
$list["_server_sanity_"] = format_numeric (100 - $list["_module_sanity_"], 1);
|
$list["_server_sanity_"] = format_numeric (100 - $list["_module_sanity_"], 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
foreach ($list_groups as $group) {
|
if ($user_strict) {
|
||||||
$agent_not_init = agents_get_agents(array (
|
$i = 1;
|
||||||
'disabled' => 0,
|
foreach ($user_tags as $group_id => $tag_name) {
|
||||||
'id_grupo' => $group['id_grupo'],
|
$id = db_get_value('id_tag', 'ttag', 'name', $tag_name);
|
||||||
'status' => AGENT_STATUS_NOT_INIT),
|
|
||||||
array ('COUNT(*) as total'), 'AR', false);
|
$list[$i]['_id_'] = $id;
|
||||||
$list[$group['id_grupo']]['_agents_not_init_'] = isset ($agent_not_init[0]['total']) ? $agent_not_init[0]['total'] : 0;
|
$list[$i]['_name_'] = $tag_name;
|
||||||
$agent_unknown = agents_get_agents(array (
|
$list[$i]['_iconImg_'] = html_print_image ("images/tag_red.png", true, array ("style" => 'vertical-align: middle;'));
|
||||||
'disabled' => 0,
|
$list[$i]['_is_tag_'] = 1;
|
||||||
'id_grupo' => $group['id_grupo'],
|
|
||||||
'status' => AGENT_STATUS_UNKNOWN),
|
$list[$i]['_total_agents_'] = (int) tags_get_total_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
|
||||||
array ('COUNT(*) as total'), 'AR', false);
|
$list[$i]['_agents_unknown_'] = (int) tags_get_unknown_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
|
||||||
$list[$group['id_grupo']]['_agents_unknown_'] = isset ($agent_unknown[0]['total']) ? $agent_unknown[0]['total'] : 0;
|
$list[$i]['_agents_not_init_'] = (int) tags_get_not_init_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
|
||||||
$agent_total = agents_get_agents(array (
|
$list[$i]['_monitors_ok_'] = (int) tags_get_normal_monitors ($id, $acltags, $agent_filter, $module_filter);
|
||||||
'disabled' => 0,
|
$list[$i]['_monitors_critical_'] = (int) tags_get_critical_monitors ($id, $acltags, $agent_filter, $module_filter);
|
||||||
'id_grupo' => $group['id_grupo']),
|
$list[$i]['_monitors_warning_'] = (int) tags_get_warning_monitors ($id, $acltags, $agent_filter, $module_filter);
|
||||||
array ('COUNT(*) as total'), 'AR', false);
|
$list[$i]['_monitors_not_init_'] = (int) tags_get_not_init_monitors ($id, $acltags, $agent_filter, $module_filter);
|
||||||
$list[$group['id_grupo']]['_total_agents_'] = isset ($agent_total[0]['total']) ? $agent_total[0]['total'] : 0;
|
$list[$i]['_monitors_unknown_'] = (int) tags_get_unknown_monitors ($id, $acltags, $agent_filter, $module_filter);
|
||||||
$list[$group['id_grupo']]["_monitor_not_normal_"] = $list[$group['id_grupo']]["_monitor_checks_"] - $list[$group['id_grupo']]["_monitors_ok_"];
|
$list[$i]['_monitors_alerts_fired_'] = tags_monitors_fired_alerts($id, $acltags);
|
||||||
$list[$group['id_grupo']]['_monitors_alerts_fired_'] = groupview_monitor_fired_alerts ($group['id_grupo'], $user_strict,$group['id_grupo']);
|
|
||||||
$result_list = db_get_all_rows_sql("SELECT COUNT(*) as contado, estado
|
if (! defined ('METACONSOLE')) {
|
||||||
FROM tagente_estado tae INNER JOIN tagente ta
|
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) {
|
||||||
ON tae.id_agente = ta.id_agente
|
unset($list[$i]);
|
||||||
AND ta.disabled = 0
|
|
||||||
AND ta.id_grupo = " . $group['id_grupo'] . "
|
|
||||||
INNER JOIN tagente_modulo tam
|
|
||||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
|
||||||
AND tam.disabled = 0
|
|
||||||
WHERE tae.utimestamp > 0
|
|
||||||
GROUP BY estado");
|
|
||||||
if ($result_list) {
|
|
||||||
foreach ($result_list as $result) {
|
|
||||||
switch ($result['estado']) {
|
|
||||||
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
|
||||||
$list[$group['id_grupo']]['_monitors_critical_'] = (int)$result['contado'];
|
|
||||||
break;
|
|
||||||
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
|
||||||
break;
|
|
||||||
case AGENT_MODULE_STATUS_WARNING:
|
|
||||||
$list[$group['id_grupo']]['_monitors_warning_'] = (int)$result['contado'];
|
|
||||||
break;
|
|
||||||
case AGENT_MODULE_STATUS_UNKNOWN:
|
|
||||||
$list[$group['id_grupo']]['_monitors_unknown_'] = (int)$result['contado'];
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0)) {
|
||||||
|
unset($list[$i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
$result_normal = db_get_row_sql("SELECT COUNT(*) as contado
|
}
|
||||||
|
else {
|
||||||
|
foreach ($list_groups as $group) {
|
||||||
|
$agent_not_init = agents_get_agents(array (
|
||||||
|
'disabled' => 0,
|
||||||
|
'id_grupo' => $group['id_grupo'],
|
||||||
|
'status' => AGENT_STATUS_NOT_INIT),
|
||||||
|
array ('COUNT(*) as total'), 'AR', false);
|
||||||
|
$list[$group['id_grupo']]['_agents_not_init_'] = isset ($agent_not_init[0]['total']) ? $agent_not_init[0]['total'] : 0;
|
||||||
|
$agent_unknown = agents_get_agents(array (
|
||||||
|
'disabled' => 0,
|
||||||
|
'id_grupo' => $group['id_grupo'],
|
||||||
|
'status' => AGENT_STATUS_UNKNOWN),
|
||||||
|
array ('COUNT(*) as total'), 'AR', false);
|
||||||
|
$list[$group['id_grupo']]['_agents_unknown_'] = isset ($agent_unknown[0]['total']) ? $agent_unknown[0]['total'] : 0;
|
||||||
|
$agent_total = agents_get_agents(array (
|
||||||
|
'disabled' => 0,
|
||||||
|
'id_grupo' => $group['id_grupo']),
|
||||||
|
array ('COUNT(*) as total'), 'AR', false);
|
||||||
|
$list[$group['id_grupo']]['_total_agents_'] = isset ($agent_total[0]['total']) ? $agent_total[0]['total'] : 0;
|
||||||
|
$list[$group['id_grupo']]["_monitor_not_normal_"] = $list[$group['id_grupo']]["_monitor_checks_"] - $list[$group['id_grupo']]["_monitors_ok_"];
|
||||||
|
$list[$group['id_grupo']]['_monitors_alerts_fired_'] = groupview_monitor_fired_alerts ($group['id_grupo'], $user_strict,array($group['id_grupo']));
|
||||||
|
$result_list = db_get_all_rows_sql("SELECT COUNT(*) as contado, estado
|
||||||
FROM tagente_estado tae INNER JOIN tagente ta
|
FROM tagente_estado tae INNER JOIN tagente ta
|
||||||
ON tae.id_agente = ta.id_agente
|
ON tae.id_agente = ta.id_agente
|
||||||
AND ta.disabled = 0
|
AND ta.disabled = 0
|
||||||
|
@ -295,24 +310,52 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
|
||||||
INNER JOIN tagente_modulo tam
|
INNER JOIN tagente_modulo tam
|
||||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||||
AND tam.disabled = 0
|
AND tam.disabled = 0
|
||||||
WHERE tae.estado = 0
|
WHERE tae.utimestamp > 0
|
||||||
AND (tae.utimestamp > 0 OR tam.id_tipo_modulo IN(21,22,23,100))
|
|
||||||
GROUP BY estado");
|
GROUP BY estado");
|
||||||
$list[$group['id_grupo']]['_monitors_ok_'] = isset ($result_normal['contado']) ? $result_normal['contado'] : 0;
|
if ($result_list) {
|
||||||
|
foreach ($result_list as $result) {
|
||||||
|
switch ($result['estado']) {
|
||||||
|
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||||
|
$list[$group['id_grupo']]['_monitors_critical_'] = (int)$result['contado'];
|
||||||
|
break;
|
||||||
|
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
||||||
|
break;
|
||||||
|
case AGENT_MODULE_STATUS_WARNING:
|
||||||
|
$list[$group['id_grupo']]['_monitors_warning_'] = (int)$result['contado'];
|
||||||
|
break;
|
||||||
|
case AGENT_MODULE_STATUS_UNKNOWN:
|
||||||
|
$list[$group['id_grupo']]['_monitors_unknown_'] = (int)$result['contado'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$result_normal = db_get_row_sql("SELECT COUNT(*) as contado
|
||||||
|
FROM tagente_estado tae INNER JOIN tagente ta
|
||||||
|
ON tae.id_agente = ta.id_agente
|
||||||
|
AND ta.disabled = 0
|
||||||
|
AND ta.id_grupo = " . $group['id_grupo'] . "
|
||||||
|
INNER JOIN tagente_modulo tam
|
||||||
|
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||||
|
AND tam.disabled = 0
|
||||||
|
WHERE tae.estado = 0
|
||||||
|
AND (tae.utimestamp > 0 OR tam.id_tipo_modulo IN(21,22,23,100))
|
||||||
|
GROUP BY estado");
|
||||||
|
$list[$group['id_grupo']]['_monitors_ok_'] = isset ($result_normal['contado']) ? $result_normal['contado'] : 0;
|
||||||
|
|
||||||
$result_not_init = db_get_row_sql("SELECT COUNT(*) as contado
|
$result_not_init = db_get_row_sql("SELECT COUNT(*) as contado
|
||||||
FROM tagente_estado tae INNER JOIN tagente ta
|
FROM tagente_estado tae INNER JOIN tagente ta
|
||||||
ON tae.id_agente = ta.id_agente
|
ON tae.id_agente = ta.id_agente
|
||||||
AND ta.disabled = 0
|
AND ta.disabled = 0
|
||||||
AND ta.id_grupo = " . $group['id_grupo'] . "
|
AND ta.id_grupo = " . $group['id_grupo'] . "
|
||||||
INNER JOIN tagente_modulo tam
|
INNER JOIN tagente_modulo tam
|
||||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||||
AND tam.disabled = 0
|
AND tam.disabled = 0
|
||||||
WHERE tae.utimestamp = 0 AND
|
WHERE tae.utimestamp = 0
|
||||||
tae.estado IN (".AGENT_MODULE_STATUS_NO_DATA.",".AGENT_MODULE_STATUS_NOT_INIT." )
|
AND tae.estado IN (".AGENT_MODULE_STATUS_NO_DATA.",".AGENT_MODULE_STATUS_NOT_INIT." )
|
||||||
AND tam.id_tipo_modulo NOT IN (21,22,23,100)
|
AND tam.id_tipo_modulo NOT IN (21,22,23,100)
|
||||||
GROUP BY estado");
|
GROUP BY estado");
|
||||||
$list[$group['id_grupo']]['_monitors_not_init_'] = isset ($result_not_init['contado']) ? $result_not_init['contado'] : 0;
|
$list[$group['id_grupo']]['_monitors_not_init_'] = isset ($result_not_init['contado']) ? $result_not_init['contado'] : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue