Fixed the group view for agents not init. Ticket: #1584

(cherry picked from commit 62c38c8a9f2ff160ab1dc312d43e55d4cdbb1369)
This commit is contained in:
mdtrooper 2014-12-01 13:55:47 +01:00
parent 005c8cac01
commit 37a6fa76ab
5 changed files with 42 additions and 3 deletions

View File

@ -897,6 +897,10 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups) {
$group_class = 'group_view_ok';
$status_image = ui_print_status_image ('agent_ok_ball.png', "", true);
}
elseif ($data["agent_not_init"] > 0) {
$group_class = 'group_view_not_init';
$status_image = ui_print_status_image ('agent_no_data_ball.png', "", true);
}
else {
$group_class = 'group_view_normal';
$status_image = ui_print_status_image ('agent_no_data_ball.png', "", true);
@ -958,6 +962,19 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups) {
echo "<td class='$group_class'></td>";
}
// Agents not init
if ($data["agent_not_init"] > 0) {
echo "<td class='group_view_data group_view_data_unk $group_class' style='font-weight: bold; font-size: 18px; text-align: center;'>";
echo "<a class='group_view_data group_view_data_unk $group_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=$id_group&status=" . AGENT_STATUS_NOT_INIT ."'>";
echo $data["agent_not_init"];
echo "</a>";
echo "</td>";
}
else {
echo "<td class='$group_class'></td>";
}
// Monitors Unknown
if ($data["monitor_unknown"] > 0) {
echo "<td class='group_view_data group_view_data_unk $group_class' style='font-weight: bold; font-size: 18px; text-align: center;'>";
@ -1123,7 +1140,14 @@ function groups_agent_not_init ($group_array) {
$group_clause = implode (",", $group_array);
$group_clause = "(" . $group_clause . ")";
$count = db_get_sql ("SELECT COUNT(*) FROM tagente WHERE disabled=0 AND critical_count=0 AND warning_count=0 AND unknown_count=0 AND notinit_count>0 AND id_grupo IN $group_clause");
$count = db_get_sql ("SELECT COUNT(*)
FROM tagente
WHERE disabled = 0
AND critical_count = 0
AND warning_count = 0
AND unknown_count = 0
AND (notinit_count > 0 OR total_count = 0)
AND id_grupo IN $group_clause");
return $count > 0 ? $count : 0;
}

View File

@ -1803,7 +1803,8 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
}
if ($id_group == 0) {
$id_group = array_keys (users_get_groups ($config['id_user'], $access, false));
$id_group = array_keys(
users_get_groups($config['id_user'], $access, false));
}
// -----------------------------------------------------------------
@ -1820,7 +1821,8 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') {
foreach ($id_group as $group) {
$group_stat = db_get_all_rows_sql ("SELECT *
FROM tgroup_stat, tgrupo
WHERE tgrupo.id_grupo = tgroup_stat.id_group AND tgroup_stat.id_group = $group
WHERE tgrupo.id_grupo = tgroup_stat.id_group
AND tgroup_stat.id_group = $group
ORDER BY nombre");
$data["monitor_checks"] += $group_stat[0]["modules"];

View File

@ -2133,6 +2133,11 @@ tr.group_view_ok, .group_view_ok {
color: #fff;
}
tr.group_view_not_init, .group_view_not_init, tr.group_view_not_init, .group_view_not_init {
background-color: #5AB7E5;
color: #fff !important;
}
tr.group_view_warn, .group_view_warn, tr.group_view_warn.a, a.group_view_warn, tr.a.group_view_warn {
background-color: #ffea59;
color: #3F3F3F !important;

7
pandora_console/mobile/include/style/main.css Normal file → Executable file
View File

@ -113,6 +113,13 @@ tr.group_view_crit, .group_view_crit {
.group_view_norm * {
color: #000000 !important;
}
.group_view_not_init, .group_view_not_init * {
background-color: #5AB7E5;
color: #fff !important;
}
.ui-btn-up-group_view_normal, .ui-btn-hover-group_view_normal,
.ui-btn-up-group_view_norm, .ui-btn-hover-group_view_norm {
background-color: #6EB432;

View File

@ -107,6 +107,7 @@ if (count($agents) > 0) {
echo "<th width='30%' style='min-width: 60px;'>" . __("Group") . "</th>";
echo "<th width='10%' style='min-width: 60px;'>" . __("Agents") . "</th>";
echo "<th width='10%' style='min-width: 60px;'>" . __("Agent unknown") . "</th>";
echo "<th width='10%' style='min-width: 60px;'>" . __("Agents not init") . "</th>";
echo "<th width='10%' style='min-width: 60px;'>" . __("Unknown") . "</th>";
echo "<th width='10%' style='min-width: 60px;'>" . __("Not Init") . "</th>";
echo "<th width='10%' style='min-width: 60px;'>" . __("Normal") . "</th>";