"ANY(SELECT id_agente FROM tagente WHERE id_grupo = " . $group); db_process_sql_update('tagente_modulo', array("flag" => 1), $where); } else { db_pandora_audit("ACL Violation", "Trying to set flag for groups"); require ("general/noaccess.php"); exit; } } if ($config["realtimestats"] == 0) { $updated_info = __('Last update'). " : ". ui_print_timestamp (db_get_sql ("SELECT min(utimestamp) FROM tgroup_stat"), true); } else { $updated_info = __("Updated at realtime"); } $updated_time = html_print_image ("images/information.png", true, array ("title" => __('Last update'), "style" => 'margin: 5px 3px 0px 10px')).$updated_info; $modulegroup = get_parameter('modulegroup', 0); $refr = get_parameter('refr', 30); // By default 30 seconds $group_id = get_parameter('group_id', 0); $offset = get_parameter('offset', 0); $hor_offset = get_parameter('hor_offset', 0); $block = 20; $groups = users_get_groups (); $filter_module_groups = '
'; $filter_module_groups .= ''.__('Module group').''; $filter_module_groups .= html_print_select_from_sql ("SELECT * FROM tmodule_group ORDER BY name", 'modulegroup', $modulegroup, 'this.form.submit()',__('All'), 0, true, false, true, false, 'width: 100px; margin-right: 10px; margin-top: 5px;'); $filter_module_groups .= '
'; $filter_groups = '
'; $filter_groups .= ''.__('Group').''; $filter_groups .= html_print_select_groups(false, "AR", true, 'group_id', $group_id, 'this.form.submit()', '', '', true, false, true, '', false , 'width: 100px; margin-right: 10px;; margin-top: 5px;'); $filter_groups .= '
'; $comborefr = '
'; $comborefr .= ''.__('Refresh').''; $comborefr .= html_print_select ( array('30' => '30 '.__('seconds'), (string)SECONDS_1MINUTE => __('1 minute'), (string)SECONDS_2MINUTES => __('2 minutes'), (string)SECONDS_5MINUTES => __('5 minutes'), (string)SECONDS_10MINUTES => __('10 minutes')), 'refr', $config['refr'], $script = 'this.form.submit()', '', 0, true, false, false, '', false, 'width: 100px; margin-right: 10px; margin-top: 5px;'); $comborefr .= "
"; if ($config["pure"] == 0) { $fullscreen = '' . html_print_image ("images/fullscreen.png", true, array ("title" => __('Full screen mode'))) . ""; } else { $fullscreen = '' . html_print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode'))) . ""; $config['refr'] = $refr; } $onheader = array('updated_time' => $updated_time, 'fullscreen' => $fullscreen, 'combo_module_groups' => $filter_module_groups, 'combo_groups' => $filter_groups); if ($config['pure'] == 1) { $onheader['combo_refr'] = $comborefr; } // Header ui_print_page_header (__("Agents/Modules"), "images/bricks.png", false, "", false, $onheader); // Old style table, we need a lot of special formatting,don't use table function // Prepare old-style table $agents = ''; if ($group_id > 0) { $agents = agents_get_group_agents($group_id); $agents = array_keys($agents); } $filter_module_groups = false; if ($modulegroup > 0) { $filter_module_groups['id_module_group'] = $modulegroup; } $all_modules = agents_get_modules($agents, false, $filter_module_groups, 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 ++; } } if($config["pure"] == 1) { $block = count($modules_by_name); } $filter_groups = array ('offset' => (int) $offset, 'limit' => (int) $config['block_size']); if($group_id > 0) { $filter_groups['id_grupo'] = $group_id; } $agents = 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; } 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 ui_pagination ((int)count(agents_get_agents ($filter_agents))); echo "
"; foreach ($agents as $agent) { // Get stats for this group $agent_status = agents_get_status($agent['id_agente']); switch($agent_status) { case 4: // Alert fired status $rowcolor = 'group_view_alrm'; break; case 1: // Critical status $rowcolor = 'group_view_crit'; break; case 2: // Warning status $rowcolor = 'group_view_warn'; break; case 0: // Normal status $rowcolor = "group_view_ok"; break; case 3: case -1: default: // Unknown status $rowcolor = 'group_view_unk'; break; } echo ""; echo ""; $agent_modules = agents_get_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 = modules_get_agentmodule_status($module_id); echo ""; $match = true; } } if(!$match) { echo ""; } } echo ""; } echo "
".__("Agents")." / ".__("Modules")."".html_print_image("images/darrowleft.png",true, array('title' => __('Previous modules')))." '. html_print_image('images/information.png', true, array('title' => io_safe_output($module['name']))) ."".html_print_image("images/darrowright.png",true, array('title' => __('More modules')))."
" . ui_print_truncate_text(io_safe_output($agent['nombre']), 'agent_size_text_small', true, true, true, '...', 'font-size:10px; font-weight: bold;') . ""; $win_handle = dechex(crc32($module_id.$module["name"])); $graph_type = return_graphtype (modules_get_agentmodule_type($module_id)); $link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$module_id."&label=".base64_encode($module["name"])."&refresh=600','day_".$win_handle."')"; echo ''; switch($status){ case 0: ui_print_status_image ('module_ok.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); break; case 1: ui_print_status_image ('module_critical.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); break; case 2: ui_print_status_image ('module_warning.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); break; case 3: ui_print_status_image ('module_unknown.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); break; case 4: ui_print_status_image ('module_alertsfired.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); break; } echo ''; echo "
"; echo "

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

" . "

"; } extensions_add_operation_menu_option(__("Agents/Modules view"), 'estado', 'agents_modules/icon_menu.png', "v1r1"); extensions_add_main_function('mainAgentsModules'); ?>