'ANY(SELECT id_agente FROM tagente WHERE id_grupo = '.$group]; db_process_sql_update('tagente_modulo', ['flag' => 1], $where); } else { db_pandora_audit( AUDIT_LOG_ACL_VIOLATION, 'Trying to set flag for groups' ); include '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_info = ''; } $updated_time = $updated_info; $modulegroup = get_parameter('modulegroup', 0); $refr = (int) get_parameter('refresh', 0); // By default 30 seconds. $recursion = get_parameter('recursion', 0); $group_id = (int) get_parameter('group_id', 0); $offset = (int) get_parameter('offset', 0); $hor_offset = (int) get_parameter('hor_offset', 0); $block = $config['block_size']; if (intval($block) > 15) { $block = '15'; } if (get_parameter('modulegroup') != null) { $agents_id = (array) get_parameter('id_agents2', null); } $selection_a_m = (int) get_parameter('selection_agent_module'); $modules_selected = (array) get_parameter('module', 0); $update_item = (string) get_parameter('edit_item', ''); $save_serialize = (int) get_parameter('save_serialize', 0); $full_modules_selected = explode(';', get_parameter('full_modules_selected', 0)); $full_agents_id = explode(';', get_parameter('full_agents_id', 0)); $show_type = (int) get_parameter('show_type', 0); // In full screen there is no pagination neither filters. if (( ($config['pure'] == 0 && $save_serialize) && $update_item == '' ) || ( ($config['pure'] == 1 && $save_serialize == 0) && $update_item == '' )) { $unserialize_modules_selected = unserialize_in_temp($config['id_user'].'_agent_module', true, 1); $unserialize_agents_id = unserialize_in_temp($config['id_user'].'_agents', true, 1); if ($unserialize_modules_selected) { $modules_selected = $unserialize_modules_selected; } if ($unserialize_agents_id) { $agents_id = $unserialize_agents_id; } } else { unserialize_in_temp($config['id_user'].'_agent_module', true, 1); unserialize_in_temp($config['id_user'].'_agents', true, 1); } if (isset($modules_selected[0]) === true && $modules_selected[0]) { serialize_in_temp($modules_selected, $config['id_user'].'_agent_module', 1); } if (isset($agents_id[0]) === true && $agents_id[0] != -1) { serialize_in_temp($agents_id, $config['id_user'].'_agents', 1); } if ($config['pure'] == 0) { if ($modules_selected[0] && $agents_id[0]) { $full_modules = urlencode(implode(';', $modules_selected)); $full_agents = urlencode(implode(';', $agents_id)); $fullscreen['text'] = ''.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; } else if ($full_modules_selected[0] && $full_agents_id[0]) { $full_modules = urlencode(implode(';', $full_modules_selected)); $full_agents = urlencode(implode(';', $full_agents_id)); $fullscreen['text'] = ''.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; } else { $fullscreen['text'] = ''.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; } } // Type show. $show_select = [ 0 => __('Show module status'), 1 => __('Show module data'), ]; $filter_type = html_print_label_input_block( __('Information to be shown'), html_print_select( $show_select, 'show_type', $show_type, '', '', 0, true, false, false, '', false, 'width: 100%;' ) ); $filter_groups = html_print_label_input_block( __('Group'), html_print_select_groups( false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: 100%;' ) ); $filter_groups .= html_print_label_input_block( __('Recursion'), html_print_checkbox_switch('recursion', 1, 0, true), [ 'div_class' => 'add-input-reverse', 'label_class' => 'label-thin', ] ); $filter_module_groups = html_print_label_input_block( __('Module group'), html_print_select_from_sql( 'SELECT * FROM tmodule_group ORDER BY name', 'modulegroup', $modulegroup, '', __('All'), 0, true, false, true, false, 'width: 100%;' ) ); $agents = agents_get_group_agents($group_id); if ((empty($agents)) || $agents == -1) { $agents = []; } $filter_agents = html_print_label_input_block( __('Agents'), html_print_select( $agents, 'id_agents2[]', $agents_id, '', '', 0, true, true, true, '', false, 'width: 100%;' ) ); // Type show. $selection = [ 0 => __('Show common modules'), 1 => __('Show all modules'), ]; $filter_type_show = html_print_label_input_block( __('Show common modules'), html_print_select( $selection, 'selection_agent_module', $selection_a_m, '', '', 0, true, false, true, '', false, 'width: 100%;' ) ); // Modules. $all_modules = select_modules_for_agent_group($group_id, $agents_id, $selection_a_m, false); $filter_modules = html_print_label_input_block( __('Module'), html_print_select( $all_modules, 'module[]', $modules_selected, '', '', 0, true, true, false, '', false, 'width: 100%;' ) ); $onheader = [ 'updated_time' => $updated_time, 'fullscreen' => $fullscreen, ]; /* * Old style table, we need a lot of special formatting,don't use table function. * Prepare old-style table. */ if ($config['pure'] == 0) { // Header. ui_print_standard_header( __('Agents/Modules'), 'images/module.png', false, '', false, $onheader, [ [ 'link' => '', 'label' => __('Monitoring'), ], [ 'link' => '', 'label' => __('Views'), ], ] ); } else { if ($full_agents_id[0]) { $full_modules = urlencode(implode(';', $full_modules_selected)); $full_agents = urlencode(implode(';', $full_agents_id)); $url = sprintf( 'index.php?sec=view&sec2=extensions/agents_modules&pure=0&offset=%s &group_id=%s&modulegroup=%s&refresh=%s&full_modules_selected=%s &full_agents_id=%s&selection_agent_module=%s&show_type=%s', $offset, $group_id, $modulegroup, $refr, $full_modules, $full_agents, $selection_a_m, $show_type ); } else { $url = sprintf( 'index.php?sec=view&sec2=extensions/agents_modules&pure=0&offset=%s&group_id=%s &modulegroup=%s&refresh=%s&show_type=%s', $offset, $group_id, $modulegroup, $refr, $show_type ); } // Floating menu - Start. echo '
".__('Agents').' / '.__('Modules').' | '; if ($hor_offset > 0) { $new_hor_offset = ($hor_offset - $block); echo "".html_print_image( 'images/arrow_left_green.png', true, ['title' => __('Previous modules')] ).' | '; } $nmodules = 0; foreach ($modules_by_name as $module) { $nmodules++; if ($nmodules <= $hor_offset || $nmodules > ($hor_offset + $block)) { continue; } $text = ui_print_truncate_text(io_safe_output($module['name']), 'module_small'); echo '
'.$text.'
| ';
}
if (($hor_offset + $block) < $nmodules) {
$new_hor_offset = ($hor_offset + $block);
echo "".html_print_image( 'images/arrow_right_green.png', true, ['title' => __('More modules')] ).' | '; } echo '
---|---|---|---|
".$alias['alias'].' | '; // TODO TAGS agents_get_modules. $agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, true); $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)) { echo ""; $win_handle = dechex(crc32($module_id.$module['name'])); $graph_type = return_graphtype(modules_get_agentmodule_type($module_id)); $link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&'.'id='.$module_id.'&'.'refresh='.SECONDS_10MINUTES."', 'day_".$win_handle."', 800, 480)"; echo ''; $module_last_value = modules_get_last_value($module_id); if (!is_numeric($module_last_value)) { $module_last_value = htmlspecialchars($module_last_value); } if ($show_type === 0) { $status = modules_get_agentmodule_status($module_id); switch ($status) { case AGENT_MODULE_STATUS_NORMAL: ui_print_status_image('module_ok.png', $module_last_value, false); break; case AGENT_MODULE_STATUS_CRITICAL_BAD: ui_print_status_image('module_critical.png', $module_last_value, false); break; case AGENT_MODULE_STATUS_WARNING: ui_print_status_image('module_warning.png', $module_last_value, false); break; case AGENT_MODULE_STATUS_UNKNOWN: ui_print_status_image('module_unknown.png', $module_last_value, false); break; case AGENT_MODULE_STATUS_NORMAL_ALERT: case AGENT_MODULE_STATUS_WARNING_ALERT: case AGENT_MODULE_STATUS_CRITICAL_ALERT: ui_print_status_image('module_alertsfired.png', $module_last_value, false); break; case 4: ui_print_status_image('module_no_data.png', $module_last_value, false); break; } } else { $module = modules_get_agentmodule($module_id); $module['datos'] = $module_last_value; $module_last_value = modules_get_agentmodule_data_for_humans($module); echo $module_last_value; } echo ''; echo ' | '; $match = true; } } if (!$match) { echo ''; } } echo ' |