$group_id, 'offset' => 0, 'hor_offset' => 0)).'">'; echo ''; echo '
'.__('Group').': '; $groups = get_user_groups (); print_select_groups(false, "AR", true, 'group_id', $group_id, 'this.form.submit()', '', ''); echo ' 
'; $agents = ''; if($group_id > 0) { $agents = get_group_agents($group_id); $agents = array_keys($agents); } $all_modules = get_agent_modules($agents, false, false, true, false); $modules_by_name = array(); $name = ''; $cont = 0; foreach($all_modules as $key => $module) { if($module == $name){ $modules_by_name[$cont-1]['id'][] = $key; } else{ $name = $module; $modules_by_name[$cont]['name'] = $name; $modules_by_name[$cont]['id'][] = $key; $cont ++; } } $filter_groups = array ('offset' => (int) $offset, 'limit' => (int) $config['block_size']); if($group_id > 0) { $filter_groups['id_grupo'] = $group_id; } $agents = get_agents ($filter_groups); $nagents = count($agents); if($all_modules === false || $agents === false) { echo "
".__('There are no agents with modules')."
"; return; } echo ''; echo ""; if($hor_offset > 0) { $new_hor_offset = $hor_offset-$block; echo ""; } $nmodules = 0; foreach($modules_by_name as $module) { $nmodules++; if($nmodules <= $hor_offset || $nmodules > ($hor_offset+$block)) { continue; } $file_name = string2image(printTruncateText($module['name'],15, false, true, false, '...'), 115, 13, 3, 270, '#9EAC8B', 'FFF', 4, 0); echo ""; } if(($hor_offset + $block) < $nmodules) { $new_hor_offset = $hor_offset+$block; echo ""; } $filter_agents = false; if($group_id > 0) { $filter_agents = array('id_grupo' => $group_id); } // Prepare pagination pagination ((int)count(get_agents ($filter_agents))); echo "
"; foreach ($agents as $agent) { // Get stats for this group $agent_status = get_agent_status($agent['id_agente']); switch($agent_status) { case 4: // Alert fired status $rowcolor = '#ffa300'; $textcolor = '#000'; break; case 1: // Critical status $rowcolor = '#bc0000'; $textcolor = '#FFF'; break; case 2: // Warning status $rowcolor = '#f2ef00'; $textcolor = '#000'; break; case 0: // Normal status $rowcolor = '#8ae234'; $textcolor = '#000'; break; case 3: case -1: default: // Unknown status $rowcolor = '#babdb6'; $textcolor = '#000'; break; } echo ""; $file_name = string2image(printTruncateText($agent['nombre'],17, false, true, false, '...'), 140, 15, 3, 0, $rowcolor, $textcolor, 4, 0); echo ""; $agent_modules = get_agent_modules($agent['id_agente']); $nmodules = 0; foreach($modules_by_name as $module) { $nmodules++; if($nmodules <= $hor_offset || $nmodules > ($hor_offset+$block)) { continue; } $match = false; foreach($module['id'] as $module_id){ if(!$match && array_key_exists($module_id,$agent_modules)) { $status = get_agentmodule_status($module_id); echo ""; $match = true; } } if(!$match) { echo ""; } } echo ""; } echo "
".__("Agents")." / ".__("Modules")."".print_image("images/darrowleft.png",true, array('title' => __('Previous modules')))." ".print_image($file_name, true, array('title' => $module['name']))."".print_image("images/darrowright.png",true, array('title' => __('More modules')))."
".print_image($file_name, true, array('title' => $agent['nombre'])).""; switch($status){ case 0: print_status_image ('module_ok.png', $module['name']." in ".$agent['nombre'].": ".__('NORMAL'), false, array('width' => '20px', 'height' => '20px')); break; case 1: print_status_image ('module_critical.png', $module['name']." in ".$agent['nombre'].": ".__('CRITICAL'), false, array('width' => '20px', 'height' => '20px')); break; case 2: print_status_image ('module_warning.png', $module['name']." in ".$agent['nombre'].": ".__('WARNING'), false, array('width' => '20px', 'height' => '20px')); break; case 3: print_status_image ('module_unknown.png', $module['name']." in ".$agent['nombre'].": ".__('UNKNOWN'), false, array('width' => '20px', 'height' => '20px')); break; case 4: print_status_image ('module_alertsfired.png', $module['name']." in ".$agent['nombre'].": ".__('ALERTS FIRED'), false, array('width' => '20px', 'height' => '20px')); break; } echo "
"; echo "

" . __("The colours meaning:") . "

" . "

"; } add_operation_menu_option(__("Agents/Modules view"), 'estado', ''); add_extension_main_function('mainAgentsModules'); ?>