Fixed view data in group view. Tiquet: #3289, #3297

(cherry picked from commit d0cea38c8d)
This commit is contained in:
m-lopez-f 2016-02-01 11:52:03 +01:00
parent 64dd3e99ad
commit 9f2a149600
1 changed files with 22 additions and 10 deletions

View File

@ -69,6 +69,16 @@ $strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_use
$all_data = groupview_status_modules_agents ($config['id_user'], $strict_user, 'AR', $strict_user);
$total_agentes = 0;
$monitor_ok = 0;
$monitor_warning = 0;
$monitor_critical = 0;
$monitor_unknown = 0;
$monitor_not_init = 0;
$agents_unknown = 0;
$agents_notinit = 0;
$all_alerts_fired = 0;
foreach ($all_data as $group_all_data) {
$total_agentes += $group_all_data["_total_agents_"];
$monitor_ok += $group_all_data["_monitors_ok_"];
@ -76,7 +86,7 @@ foreach ($all_data as $group_all_data) {
$monitor_critical += $group_all_data["_monitors_critical_"];
$monitor_unknown += $group_all_data["_monitors_unknown_"];
$monitor_not_init += $group_all_data["_monitors_not_init_"];
$agents_unknown += $group_all_data["_agents_unknown_"];
$agents_notinit += $group_all_data["_agents_not_init_"];
@ -154,7 +164,9 @@ if (!empty($result_groups)) {
echo "<th width='10%' style='min-width: 60px;text-align:center;'>" . __("Critical") . "</th>";
echo "<th width='10%' style='min-width: 60px;text-align:center;'>" . __("Alert fired") . "</th>";
echo "</tr>";
$result_groups = array_slice($result_groups, $offset, $config['block_size']);
foreach ($result_groups as $data) {
$groups_id = $data["_id_"];
@ -243,7 +255,7 @@ if (!empty($result_groups)) {
$agent_counter = agents_get_group_agents($groups_id);
echo $link . count($agent_counter) . "</a>";
}
if ($data["_total_agents_"] > 0) {
if ($data["_total_agents_"] > 0 && $data["_id_"] != 0) {
echo $link . $data["_total_agents_"] . "</a>";
}
echo "</td>";
@ -260,7 +272,7 @@ if (!empty($result_groups)) {
if (($data["_id_"] == 0) && ($agents_unknown != 0)) {
echo $link . $agents_unknown . "</a>";
}
if ($data["_agents_unknown_"] > 0) {
if ($data["_agents_unknown_"] > 0 && ($data["_id_"] != 0)) {
echo $link . $data["_agents_unknown_"] . "</a>";
}
echo "</td>";
@ -277,7 +289,7 @@ if (!empty($result_groups)) {
if (($data["_id_"] == 0) && ($agents_notinit != 0)) {
echo $link . $agents_notinit . "</a>";
}
if ($data["_agents_not_init_"] > 0) {
if ($data["_agents_not_init_"] > 0 && ($data["_id_"] != 0)) {
echo $link . $data["_agents_not_init_"] . "</a>";
}
echo "</td>";
@ -294,7 +306,7 @@ if (!empty($result_groups)) {
if (($data["_id_"] == 0) && ($monitor_unknown != 0)) {
echo $link . $monitor_unknown . "</a>";
}
if ($data["_monitors_unknown_"] > 0) {
if ($data["_monitors_unknown_"] > 0 && ($data["_id_"] != 0)) {
echo $link . $data["_monitors_unknown_"] . "</a>";
}
echo "</td>";
@ -311,7 +323,7 @@ if (!empty($result_groups)) {
if (($data["_id_"] == 0) && ($monitor_not_init != 0)) {
echo $link . $monitor_not_init . "</a>";
}
if ($data["_monitors_not_init_"] > 0) {
if ($data["_monitors_not_init_"] > 0 && ($data["_id_"] != 0)) {
echo $link . $data["_monitors_not_init_"] . "</a>";
}
echo "</td>";
@ -328,7 +340,7 @@ if (!empty($result_groups)) {
if (($data["_id_"] == 0) && ($monitor_ok != 0)) {
echo $link . $monitor_ok . "</a>";
}
if ($data["_monitors_ok_"] > 0) {
if ($data["_monitors_ok_"] > 0 && ($data["_id_"] != 0)) {
echo $link . $data["_monitors_ok_"] . "</a>";
}
echo "</td>";
@ -345,7 +357,7 @@ if (!empty($result_groups)) {
if (($data["_id_"] == 0) && ($monitor_warning != 0)) {
echo $link . $monitor_warning . "</a>";
}
if ($data["_monitors_warning_"] > 0) {
if ($data["_monitors_warning_"] > 0 && ($data["_id_"] != 0)) {
echo $link . $data["_monitors_warning_"] . "</a>";
}
echo "</td>";
@ -362,7 +374,7 @@ if (!empty($result_groups)) {
if (($data["_id_"] == 0) && ($monitor_critical != 0)) {
echo $link . $monitor_critical . "</a>";
}
if ($data["_monitors_critical_"] > 0) {
if ($data["_monitors_critical_"] > 0 && ($data["_id_"] != 0)) {
echo $link . $data["_monitors_critical_"] . "</a>";
}
echo "</td>";
@ -379,7 +391,7 @@ if (!empty($result_groups)) {
if (($data["_id_"] == 0) && ($all_alerts_fired != 0)) {
echo $link . $all_alerts_fired . "</a>";
}
if ($data["_monitors_alerts_fired_"] > 0) {
if ($data["_monitors_alerts_fired_"] > 0 && ($data["_id_"] != 0)) {
echo $link . $data["_monitors_alerts_fired_"] . "</a>";
}
echo '</td>';