1));
}
else {
db_process_sql("UPDATE `tagente_modulo`
SET `flag` = 1
WHERE `id_agente` = ANY(SELECT id_agente
FROM tagente
WHERE id_grupo = " . $group . ")");
}
}
else {
db_pandora_audit("ACL Violation", "Trying to set flag for groups");
require ("general/noaccess.php");
exit;
}
}
if ($config["realtimestats"] == 0) {
$updated_time ="";
$updated_time .= __('Last update'). " : ". ui_print_timestamp (db_get_sql ("SELECT min(utimestamp) FROM tgroup_stat"), true);
$updated_time .= "";
}
else {
$updated_time = __("Updated at realtime");
}
// Header
ui_print_page_header (__("Group view"), "images/group.png", false, "", false, $updated_time);
$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
//Groups and tags
$result_groups = group_get_groups_list($config['id_user'], $strict_user,
'AR', true, true);
$count = count($result_groups);
if ($count == 1) {
if ($result_groups[0]['_id_'] == 0) {
unset($result_groups[0]);
}
}
$total_agentes = 0;
$monitor_ok = 0;
$monitor_warning = 0;
$monitor_critical = 0;
$agents_unknown = 0;
foreach ($result_groups as $data) {
$total_agentes += $data["_total_agents_"];
$monitor_ok += $data["_monitors_ok_"];
$monitor_warning += $data["_monitors_warning_"];
$monitor_critical += $data["_monitors_critical_"];
$monitor_unknown += $data["_monitors_unknown_"];
}
$total = $monitor_ok + $monitor_warning + $monitor_critical;
//$total_ok = format_numeric (($total_agentes / $monitor_ok / 100), 1);
$total_ok = format_numeric (($monitor_ok*100)/$total,0);
$total_warning = format_numeric (($monitor_warning*100)/$total,0);
$total_critical = format_numeric (($monitor_critical*100)/$total,0);
$total_unknown = format_numeric (($monitor_unknown*100)/$total,0);
echo '
';
echo "";
echo "" . __("Summary of the status groups") . " | ";
echo "
";
echo "";
echo "";
echo "". $total_critical ."%";
echo "". $total_warning ."%";
echo "". $total_ok ."%";
echo "". $total_unknown ."%";
echo " | ";
echo "
";
echo "
";
ui_pagination($count);
if (!empty($result_groups)) {
echo '';
echo "";
echo "" . __("Force") . " | ";
echo "" . __("Group") . " | ";
echo "" . __("Agents") . " | ";
echo "" . __("Agent unknown") . " | ";
echo "" . __("Agents not init") . " | ";
echo "" . __("Unknown") . " | ";
echo "" . __("Not Init") . " | ";
echo "" . __("Normal") . " | ";
echo "" . __("Warning") . " | ";
echo "" . __("Critical") . " | ";
echo "" . __("Alert fired") . " | ";
foreach ($result_groups as $data) {
// Calculate entire row color
if ($data["_monitors_alerts_fired_"] > 0){
$color_class = 'group_view_alrm';
$status_image = ui_print_status_image ('agent_alertsfired_ball.png', "", true);
}
elseif ($data["_monitors_critical_"] > 0) {
$color_class = 'group_view_crit';
$status_image = ui_print_status_image ('agent_critical_ball.png', "", true);
}
elseif ($data["_monitors_warning_"] > 0) {
$color_class = 'group_view_warn';
$status_image = ui_print_status_image ('agent_warning_ball.png', "", true);
}
elseif (($data["_monitors_unknown_"] > 0) || ($data["_agents_unknown_"] > 0)) {
$color_class = 'group_view_unk';
$status_image = ui_print_status_image ('agent_no_monitors_ball.png', "", true);
}
elseif ($data["_monitors_ok_"] > 0) {
$color_class = 'group_view_ok';
$status_image = ui_print_status_image ('agent_ok_ball.png', "", true);
}
else {
$color_class = '';
$status_image = ui_print_status_image ('agent_no_data_ball.png', "", true);
}
echo "
";
// Force
echo "";
if (!isset($data['_is_tag_']) && check_acl ($config['id_user'], $data['_id_'], "AW")) {
echo '' .
html_print_image("images/target.png", true, array("border" => '0', "title" => __('Force'))) . '';
}
echo " | ";
$prefix = "";
if (!isset($data['_is_tag_'])) {
if ($data['_id_'] != 0) {
$prefix = ' ';
}
}
// Groupname
echo "";
if (isset($data['_is_tag_'])) {
$deep = "";
$link = "";
} else {
$deep = groups_get_group_deep ($data['_id_']);
$link = "";
}
$group_name = "" . ui_print_truncate_text($data['_name_'], 50) . "";
$item_icon = '';
if (isset($data['_iconImg_']) && !empty($data['_iconImg_']))
$item_icon = $data['_iconImg_'];
if ($data['_name_'] != "All")
echo $deep . $link . $group_name . "";
else
echo $link . $group_name . "";
echo " | ";
// Total agents
echo "";
if (isset($data['_is_tag_'])) {
$link = "";
} else {
$link = "";
}
if ($data["_total_agents_"] > 0) {
echo $link . $data["_total_agents_"] . "";
}
echo " | ";
// Agents unknown
echo "";
if (isset($data['_is_tag_'])) {
$link = "";
} else {
$link = "";
}
if ($data["_agents_unknown_"] > 0) {
echo $link . $data["_agents_unknown_"] . "";
}
echo " | ";
// Agents not init
echo "";
if (isset($data['_is_tag_'])) {
$link = "";
} else {
$link = "";
}
if ($data["_agents_not_init_"] > 0) {
echo $link . $data["_agents_not_init_"] . "";
}
echo " | ";
// Monitors unknown
echo "";
if (!isset($data['_is_tag_'])) {
$link = "";
} else {
$link = "";
}
if ($data["_monitors_unknown_"] > 0) {
echo $link . $data["_monitors_unknown_"] . "";
}
echo " | ";
// Monitors not init
echo "";
if (!isset($data['_is_tag_'])) {
$link = "";
} else {
$link = "";
}
if ($data["_monitors_not_init_"] > 0) {
echo $link . $data["_monitors_not_init_"] . "";
}
echo " | ";
// Monitors OK
echo "";
if (!isset($data['_is_tag_'])) {
$link = "";
} else {
$link = "";
}
if ($data["_monitors_ok_"] > 0) {
echo $link . $data["_monitors_ok_"] . "";
}
echo " | ";
// Monitors Warning
echo "";
if (!isset($data['_is_tag_'])) {
$link = "";
} else {
$link = "";
}
if ($data["_monitors_warning_"] > 0) {
echo $link . $data["_monitors_warning_"] . "";
}
echo " | ";
// Monitors Critical
echo "";
if (!isset($data['_is_tag_'])) {
$link = "";
} else {
$link = "";
}
if ($data["_monitors_critical_"] > 0) {
echo $link . $data["_monitors_critical_"] . "";
}
echo " | ";
// Alerts fired
echo "";
if (!isset($data['_is_tag_'])) {
$link = "";
} else {
$link = "";
}
if ($data["_monitors_alerts_fired_"] > 0){
echo $link . $data["_monitors_alerts_fired_"] . "";
}
echo ' | ';
echo "
";
}
echo '
';
} else {
echo "" . __('There are no defined agents') .
"
";
}
?>