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'); include '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_info = __("Updated at realtime"); $updated_info = ''; } // Header. ui_print_page_header( __('Group view'), 'images/group.png', false, '', false, $updated_time ); $total_agentes = 0; $monitor_ok = 0; $monitor_warning = 0; $monitor_critical = 0; $monitor_unknown = 0; $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 $result_groups_info = groupview_get_groups_list( $config['id_user'], ($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR') ); $result_groups = $result_groups_info['groups']; $count = $result_groups_info['counter']; if ($result_groups[0]['_id_'] == 0) { $total_agentes = $result_groups[0]['_total_agents_']; $monitor_ok = $result_groups[0]['_monitors_ok_']; $monitor_warning = $result_groups[0]['_monitors_warning_']; $monitor_critical = $result_groups[0]['_monitors_critical_']; $monitor_unknown = $result_groups[0]['_monitors_unknown_']; $monitor_not_init = $result_groups[0]['_monitors_not_init_']; $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_']; } $total = ($monitor_ok + $monitor_warning + $monitor_critical + $monitor_unknown + $monitor_not_init); // Modules $total_ok = 0; $total_warning = 0; $total_critical = 0; $total_unknown = 0; $total_monitor_not_init = 0; // Agents $total_agent_unknown = 0; $total_agent_critical = 0; $total_not_init = 0; $total_agent_warning = 0; $total_agent_ok = 0; if ($total > 0) { // Modules $total_ok = format_numeric((($monitor_ok * 100) / $total), 2); $total_warning = format_numeric((($monitor_warning * 100) / $total), 2); $total_critical = format_numeric((($monitor_critical * 100) / $total), 2); $total_unknown = format_numeric((($monitor_unknown * 100) / $total), 2); $total_monitor_not_init = format_numeric((($monitor_not_init * 100) / $total), 2); } 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); } echo ''; echo ''; echo "'; echo ''; echo ''; echo "'; echo "'; echo ''; echo ""; echo "'; echo "'; echo ''; echo '
".__('Summary of the status groups').'
".__('Agents').'".__('Modules').'
"; echo "".$total_agent_critical.'%'; echo "".$total_agent_warning.'%'; echo "".$total_agent_ok.'%'; echo "".$total_agent_unknown.'%'; echo "".$total_not_init.'%'; echo '"; echo "".$total_critical.'%'; echo "".$total_warning.'%'; echo "".$total_ok.'%'; echo "".$total_unknown.'%'; echo "".$total_monitor_not_init.'%'; echo '
'; if ($count == 1) { if ($result_groups[0]['_id_'] == 0) { unset($result_groups[0]); } } ui_pagination($count); if (!empty($result_groups)) { echo ''; echo ''; echo ''; echo "'; echo "'; echo ''; echo ''; echo "'; echo "'; echo "'; echo "'; echo "'; echo "'; echo "'; echo "'; echo "'; echo "'; echo "'; echo "'; echo "'; echo "'; echo ''; foreach ($result_groups as $data) { $groups_id = $data['_id_']; // Calculate entire row color if ($groups_id != 0) { if ($data['_monitors_alerts_fired_'] > 0) { $color_class = 'group_view_alrm'; $status_image = ui_print_status_image('agent_alertsfired_ball.png', '', true); } else if ($data['_monitors_critical_'] > 0) { $color_class = 'group_view_crit'; $status_image = ui_print_status_image('agent_critical_ball.png', '', true); } else if ($data['_monitors_warning_'] > 0) { $color_class = 'group_view_warn'; $status_image = ui_print_status_image('agent_warning_ball.png', '', true); } else if (($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); } else if ($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); } } else { $color_class = ''; $status_image = ui_print_status_image('agent_no_data_ball.png', '', true); } echo ""; // Force echo "'; $prefix = ''; if (!isset($data['_is_tag_'])) { if ($data['_id_'] != 0) { $prefix = '    '; } } // Groupname and Tags echo ''; // Total agents echo "'; // Agents unknown echo "'; // Agents not init echo "'; // Agents Normal echo "'; // Agents warning echo "'; // Agents critical echo "'; // Monitors unknown echo "'; // Monitors not init echo "'; // Monitors OK echo "'; // Monitors Warning echo "'; // Monitors Critical echo "'; // Alerts fired echo "'; echo ''; } echo '
".__('Agents').'".__('Modules').'
".__('Force').'".__('Group').'/'.__('Tags').'".__('Total').'".__('Unknown').'".__('Not init').'".__('Normal').'".__('Warning').'".__('Critical').'".__('Unknown').'".__('Not init').'".__('Normal').'".__('Warning').'".__('Critical').'".__('Alert fired').'
"; if (!isset($data['_is_tag_']) && check_acl($config['id_user'], $data['_id_'], 'AW')) { echo ''.html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force')]).''; } 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 { $hint = ''; if (enterprise_hook('agents_is_using_secondary_groups')) { $hint = ui_print_help_tip(__('This %s installation are using the secondary groups feature. For this reason, an agent can be counted several times.', get_product_name())); } echo $link.$group_name.''.$hint; } if (isset($data['_is_tag_'])) { echo ''.html_print_image('images/tag.png', true, ['border' => '0', 'style' => 'width:18px;margin-left:5px', 'title' => __('Tag')]).''; } echo '"; if (isset($data['_is_tag_'])) { $link = ""; } else { $link = ""; } if ($data['_id_'] == 0) { echo $link.$total_agentes.''; } if ($data['_total_agents_'] > 0 && $data['_id_'] != 0) { echo $link.$data['_total_agents_'].''; } echo '"; if (isset($data['_is_tag_'])) { $link = ""; } else { $link = ""; } if (($data['_id_'] == 0) && ($agents_unknown != 0)) { echo $link.$agents_unknown.''; } if ($data['_agents_unknown_'] > 0 && ($data['_id_'] != 0)) { echo $link.$data['_agents_unknown_'].''; } echo '"; if (isset($data['_is_tag_'])) { $link = ""; } else { $link = ""; } if (($data['_id_'] == 0) && ($agents_notinit != 0)) { echo $link.$agents_notinit.''; } if ($data['_agents_not_init_'] > 0 && ($data['_id_'] != 0)) { echo $link.$data['_agents_not_init_'].''; } echo '"; if (isset($data['_is_tag_'])) { $link = ""; } else { $link = ""; } if (($data['_id_'] == 0) && ($agents_ok != 0)) { echo $link.$agents_ok.''; } if ($data['_agents_ok_'] > 0 && ($data['_id_'] != 0)) { echo $link.$data['_agents_ok_'].''; } echo '"; if (isset($data['_is_tag_'])) { $link = ""; } else { $link = ""; } if (($data['_id_'] == 0) && ($agents_warning != 0)) { echo $link.$agents_warning.''; } if ($data['_agents_warning_'] > 0 && ($data['_id_'] != 0)) { echo $link.$data['_agents_warning_'].''; } echo '"; if (isset($data['_is_tag_'])) { $link = ""; } else { $link = ""; } if (($data['_id_'] == 0) && ($agents_critical != 0)) { echo $link.$agents_critical.''; } if ($data['_agents_critical_'] > 0 && ($data['_id_'] != 0)) { echo $link.$data['_agents_critical_'].''; } echo '"; if (!isset($data['_is_tag_'])) { $link = ""; } else { $link = ""; } if (($data['_id_'] == 0) && ($monitor_unknown != 0)) { echo $link.$monitor_unknown.''; } if ($data['_monitors_unknown_'] > 0 && ($data['_id_'] != 0)) { echo $link.$data['_monitors_unknown_'].''; } echo '"; if (!isset($data['_is_tag_'])) { $link = ""; } else { $link = ""; } if (($data['_id_'] == 0) && ($monitor_not_init != 0)) { echo $link.$monitor_not_init.''; } if ($data['_monitors_not_init_'] > 0 && ($data['_id_'] != 0)) { echo $link.$data['_monitors_not_init_'].''; } echo '"; if (!isset($data['_is_tag_'])) { $link = ""; } else { $link = ""; } if (($data['_id_'] == 0) && ($monitor_ok != 0)) { echo $link.$monitor_ok.''; } if ($data['_monitors_ok_'] > 0 && ($data['_id_'] != 0)) { echo $link.$data['_monitors_ok_'].''; } echo '"; if (!isset($data['_is_tag_'])) { $link = ""; } else { $link = ""; } if (($data['_id_'] == 0) && ($monitor_warning != 0)) { echo $link.$monitor_warning.''; } if ($data['_monitors_warning_'] > 0 && ($data['_id_'] != 0)) { echo $link.$data['_monitors_warning_'].''; } echo '"; if (!isset($data['_is_tag_'])) { $link = ""; } else { $link = ""; } if (($data['_id_'] == 0) && ($monitor_critical != 0)) { echo $link.$monitor_critical.''; } if ($data['_monitors_critical_'] > 0 && ($data['_id_'] != 0)) { echo $link.$data['_monitors_critical_'].''; } echo '"; if (!isset($data['_is_tag_'])) { $link = ""; } else { $link = ""; } if (($data['_id_'] == 0) && ($all_alerts_fired != 0)) { echo $link.$all_alerts_fired.''; } if ($data['_monitors_alerts_fired_'] > 0 && ($data['_id_'] != 0)) { echo $link.$data['_monitors_alerts_fired_'].''; } echo '
'; } else { ui_print_info_message(__('There are no defined agents')); }