"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 = $updated_info; $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_groups = '
'; $comborefr = '"; if ($config["pure"] == 0) { $fullscreen['text'] = '' . html_print_image ("images/full_screen.png", true, array ("title" => __('Full screen mode'))) . ""; } else { $fullscreen['text'] = '' . html_print_image ("images/normal_screen.png", true, array ("title" => __('Back to normal mode'))) . ""; $config['refr'] = $refr; } $onheader = array('updated_time' => $updated_time, 'fullscreen' => $fullscreen, 'combo_groups' => $filter_groups); if ($config['pure'] == 1) { $onheader['combo_refr'] = $comborefr; } // Header ui_print_page_header (__("Agents/Alerts"), "images/op_alerts.png", false, "", false, $onheader); // Old style table, we need a lot of special formatting,don't use table function // Prepare old-style table $filter = array ('offset' => (int) $offset, 'limit' => (int) $config['block_size']); $filter_count = array(); if ($group_id > 0) { $filter['id_grupo'] = $group_id; $filter_count['id_grupo'] = $group_id; } // Get the id of all agents with alerts $sql = 'SELECT DISTINCT(id_agente) FROM tagente_modulo WHERE id_agente_modulo IN (SELECT id_agent_module FROM talert_template_modules)'; $agents_with_alerts_raw = db_get_all_rows_sql($sql); if ($agents_with_alerts_raw === false) { $agents_with_alerts_raw = array(); } $agents_with_alerts = array(); foreach ($agents_with_alerts_raw as $awar) { $agents_with_alerts[] = $awar['id_agente']; } $filter['id_agente'] = $agents_with_alerts; $filter_count['id_agente'] = $agents_with_alerts; $agents = agents_get_agents ($filter); $nagents = count(agents_get_agents ($filter_count)); if ($agents == false) { echo "".__("Agents")." / ".__("Alert templates")." | "; if ($hor_offset > 0) { $new_hor_offset = $hor_offset-$block; echo "".html_print_image("images/darrowleft.png",true, array('title' => __('Previous templates')))." | "; } if (!empty($templates)) { $sql = sprintf('SELECT id, name FROM talert_templates WHERE id IN (%s)',implode(',',array_keys($templates))); $templates_raw = db_get_all_rows_sql($sql); } $alerts = array(); $ntemplates = 0; foreach ($templates_raw as $temp) { if (isset($templates[$temp['id']]) && $templates[$temp['id']] == '') { $ntemplates++; if ($ntemplates <= $hor_offset || $ntemplates > ($hor_offset+$block)) { continue; } $templates[$temp['id']] = $temp['name']; } } foreach ($templates as $tid => $tname) { if ($tname == '') { continue; } echo ''. html_print_image('images/information.png', true, array('title' => io_safe_output($tname))) ." | "; } if (($hor_offset + $block) < $ntemplates) { $new_hor_offset = $hor_offset+$block; echo "".html_print_image("images/darrowright.png",true, array('title' => __('More templates')))." | "; } foreach ($agents as $agent) { echo '
---|---|---|
'.$agent['nombre'].' | '; // Alerts of the agent $anyfired = false; foreach ($templates as $tid => $tname) { if ($tname == '') { continue; } if (isset($agent_alerts[$agent['nombre']][$tid])) { foreach($agent_alerts[$agent['nombre']][$tid] as $alert) { if($alert["times_fired"] > 0) { $anyfired = true; } } $cellstyle = ''; if($anyfired) { $cellstyle = 'background:'.COL_ALERTFIRED.';'; } echo ' ';
$uniqid = uniqid();
echo " ";
echo count($agent_alerts[$agent['nombre']][$tid])." ".__('Alerts')." ";
echo "".html_print_image('images/zoom.png', true)."";
echo " ";
print_alerts_summary_modal_window($uniqid, $agent_alerts[$agent['nombre']][$tid]);
}
else {
echo ' | '; } echo ' | '; } echo '