Merge branch '2619_Group_View' into 'develop'

Added warning and normal status agents in group view

See merge request artica/pandorafms!1799
This commit is contained in:
vgilc 2018-10-29 09:16:33 +01:00
commit 17286414c7
3 changed files with 64 additions and 12 deletions

View File

@ -95,16 +95,18 @@ function groupview_get_all_counters($tree_group) {
? 'tmetaconsole_agent_secondary_group'
: 'tagent_secondary_group';
$sql =
"SELECT SUM(ta.normal_count) AS _monitors_ok_,
SUM(ta.critical_count) AS _monitors_critical_,
"SELECT SUM(ta.critical_count) AS _monitors_critical_,
SUM(ta.warning_count) AS _monitors_warning_,
SUM(ta.unknown_count) AS _monitors_unknown_,
SUM(ta.notinit_count) AS _monitors_not_init_,
SUM(ta.fired_count) AS _monitors_alerts_fired_,
SUM(ta.normal_count) AS _monitors_ok_,
SUM(ta.total_count) AS _monitor_checks_,
SUM(ta.fired_count) AS _monitors_alerts_fired_,
SUM(IF(ta.critical_count > 0, 1, 0)) AS _agents_critical_,
SUM(IF(ta.critical_count = 0 AND ta.warning_count > 0, 1, 0)) AS _agents_warning_,
SUM(IF(ta.critical_count = 0 AND ta.warning_count = 0 AND ta.unknown_count > 0, 1, 0)) AS _agents_unknown_,
SUM(IF(ta.total_count = ta.notinit_count, 1, 0)) AS _agents_not_init_,
SUM(IF(ta.total_count = ta.normal_count AND ta.total_count <> ta.notinit_count, 1, 0)) AS _agents_ok_,
COUNT(ta.id_agente) AS _total_agents_,
'$all_name' AS _name_,
0 AS _id_,
@ -169,9 +171,11 @@ function groupview_get_groups_list($id_user = false, $access = 'AR', $is_not_pag
$list[$id_group]['_id_'] = $agent_counter['id'];
$list[$id_group]['_iconImg_'] = $agent_counter['icon'];
$list[$id_group]['_agents_not_init_'] = $agent_counter['counters']['not_init'];
$list[$id_group]['_agents_unknown_'] = $agent_counter['counters']['unknown'];
$list[$id_group]['_agents_critical_'] = $agent_counter['counters']['critical'];
$list[$id_group]['_agents_warning_'] = $agent_counter['counters']['warning'];
$list[$id_group]['_agents_unknown_'] = $agent_counter['counters']['unknown'];
$list[$id_group]['_agents_not_init_'] = $agent_counter['counters']['not_init'];
$list[$id_group]['_agents_ok_'] = $agent_counter['counters']['ok'];
$list[$id_group]['_total_agents_'] = $agent_counter['counters']['total'];
$list[$id_group]['_monitors_critical_'] = (int)$modules_counters[$id_group]['total_module_critical'];

View File

@ -3041,9 +3041,9 @@ table#policy_modules td * {
#sumary{
color: #FFF;
margin: 15px;
margin: 2px;
padding: 10px 30px;
font-size: 20px;
font-size: 15px;
font-weight: bold;
border-radius: 2px;
}

View File

@ -77,6 +77,8 @@ $monitor_not_init = 0;
$agents_unknown = 0;
$agents_critical = 0;
$agents_notinit = 0;
$agents_ok = 0;
$agents_warning = 0;
$all_alerts_fired = 0;
//Groups and tags
@ -98,6 +100,8 @@ if ($result_groups[0]["_id_"] == 0) {
$agents_unknown = $result_groups[0]["_agents_unknown_"];
$agents_notinit = $result_groups[0]["_agents_not_init_"];
$agents_critical = $result_groups[0]["_agents_critical_"];
$agents_warning = $result_groups[0]["_agents_warning_"];
$agents_ok = $result_groups[0]["_agents_ok_"];
$all_alerts_fired = $result_groups[0]["_monitors_alerts_fired_"];
}
@ -114,6 +118,8 @@ $total_monitor_not_init =0;
$total_agent_unknown = 0;
$total_agent_critical = 0;
$total_not_init = 0;
$total_agent_warning = 0;
$total_agent_ok = 0;
if ($total > 0) {
//Modules
@ -127,6 +133,8 @@ if ($total_agentes > 0) {
//Agents
$total_agent_unknown = format_numeric (($agents_unknown*100)/$total_agentes,2);
$total_agent_critical = format_numeric (($agents_critical*100)/$total_agentes,2);
$total_agent_warning = format_numeric (($agents_warning*100)/$total_agentes,2);
$total_agent_ok = format_numeric (($agents_ok*100)/$total_agentes,2);
$total_not_init = format_numeric (($agents_notinit*100)/$total_agentes,2);
}
@ -135,14 +143,16 @@ echo '<table cellpadding="0" cellspacing="0" border="0" width="100%" class="data
echo "<th colspan=2 style='text-align: center;'>" . __("Summary of the status groups") . "</th>";
echo "</tr>";
echo "<tr>";
echo "<th width=30% style='text-align:center'>" . __("Agents") . "</th>";
echo "<th width=70% style='text-align:center'>" . __("Modules") . "</th>";
echo "<th width=50% style='text-align:center'>" . __("Agents") . "</th>";
echo "<th width=50% style='text-align:center'>" . __("Modules") . "</th>";
echo "</tr>";
echo "<tr height=70px'>";
echo "<td align='center'>";
echo "<span id='sumary' style='background-color:#FC4444;'>". $total_agent_critical ."%</span>";
echo "<span id='sumary' style='background-color:#FAD403;'>". $total_agent_warning ."%</span>";
echo "<span id='sumary' style='background-color:#80BA27;'>". $total_agent_ok ."%</span>";
echo "<span id='sumary' style='background-color:#B2B2B2;'>". $total_agent_unknown ."%</span>";
echo "<span id='sumary' style='background-color:#5bb6e5;'>". $total_not_init ."%</span>";
echo "<span id='sumary' style='background-color:#FC4444;'>". $total_agent_critical ."%</span>";
echo "</td>";
echo "<td align='center'>";
echo "<span id='sumary' style='background-color:#FC4444;'>". $total_critical ."%</span>";
@ -167,7 +177,7 @@ if (!empty($result_groups)) {
echo '<table cellpadding="0" cellspacing="0" style="margin-top:10px;" class="databox data" border="0" width="100%">';
echo "<tr>";
echo "<th colspan=2 ></th>";
echo "<th colspan=4 class='difference' style='text-align:center'>" . __("Agents") . "</th>";
echo "<th colspan=6 class='difference' style='text-align:center'>" . __("Agents") . "</th>";
echo "<th colspan=6 style='text-align:center'>" . __("Modules") . "</th>";
echo "</tr>";
@ -177,9 +187,11 @@ if (!empty($result_groups)) {
echo "<th width='10%' style='min-width: 60px;text-align:center;'>" . __("Total") . "</th>";
echo "<th width='10%' style='min-width: 60px;text-align:center;'>" . __("Unknown") . "</th>";
echo "<th width='10%' style='min-width: 60px;text-align:center;'>" . __("Not init") . "</th>";
echo "<th width='10%' style='min-width: 60px;text-align:center;'>" . __("Normal") . "</th>";
echo "<th width='10%' style='min-width: 60px;text-align:center;'>" . __("Warning") . "</th>";
echo "<th width='10%' style='min-width: 60px;text-align:center;'>" . __("Critical") . "</th>";
echo "<th width='10%' style='min-width: 60px;text-align:center;'>" . __("Unknown") . "</th>";
echo "<th width='10%' style='min-width: 60px;text-align:center;'>" . __("Not Init") . "</th>";
echo "<th width='10%' style='min-width: 60px;text-align:center;'>" . __("Not init") . "</th>";
echo "<th width='10%' style='min-width: 60px;text-align:center;'>" . __("Normal") . "</th>";
echo "<th width='10%' style='min-width: 60px;text-align:center;'>" . __("Warning") . "</th>";
echo "<th width='10%' style='min-width: 60px;text-align:center;'>" . __("Critical") . "</th>";
@ -324,6 +336,42 @@ if (!empty($result_groups)) {
}
echo "</td>";
// Agents Normal
echo "<td class='group_view_data group_view_data_unk $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'>";
if (isset($data['_is_tag_'])) {
$link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_']. "&status=" . AGENT_STATUS_NORMAL ."'>";
} else {
$link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=".$data['_id_']."&status=" . AGENT_STATUS_NORMAL ."'>";
}
if (($data["_id_"] == 0) && ($agents_ok != 0)) {
echo $link . $agents_ok . "</a>";
}
if ($data["_agents_ok_"] > 0 && ($data["_id_"] != 0)) {
echo $link . $data["_agents_ok_"] . "</a>";
}
echo "</td>";
// Agents warning
echo "<td class='group_view_data group_view_data_unk $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'>";
if (isset($data['_is_tag_'])) {
$link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_']. "&status=" . AGENT_STATUS_WARNING ."'>";
} else {
$link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=".$data['_id_']."&status=" . AGENT_STATUS_WARNING ."'>";
}
if (($data["_id_"] == 0) && ($agents_warning != 0)) {
echo $link . $agents_warning . "</a>";
}
if ($data["_agents_warning_"] > 0 && ($data["_id_"] != 0)) {
echo $link . $data["_agents_warning_"] . "</a>";
}
echo "</td>";
// Agents critical
echo "<td class='group_view_data group_view_data_unk $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'>";
if (isset($data['_is_tag_'])) {