'; echo '
'; echo '

'.__('Refresh').'

'; echo html_print_select( [ '30' => __('30 seconds'), (string) SECONDS_1MINUTE => __('1 minute'), '180' => __('3 minutes'), (string) SECONDS_5MINUTES => __('5 minutes'), ], 'refresh', $refresh, '', '', 0, true, false, false, '', false, 'margin-top: 3px;' ); echo '
'; echo '
'; echo '

'.__('Search').'

'; echo html_print_input_text('search', $search, '', 30, 255, true); echo '
'; echo '
'; echo '

'.__('Type').'

'; echo html_print_select( [ 0 => __('Group agents'), 1 => __('Group modules by tag'), 2 => __('Group modules by module group'), ], 'type', $type, '', '', 0, true, false, false, '', false, 'margin-top: 3px;width:70%' ); echo '
'; echo '
'; echo '

'.__('Show groups').'

'; echo html_print_checkbox('group', 1, $group, true); echo '
'; echo ''; } if ($getFilterType === true) { $filter = get_parameter('filter', 0); echo '
'; switch ($type) { case 0: default: echo '

'.__('Group').'

'; echo html_print_input( [ 'type' => 'select_groups', 'returnAllGroup' => true, 'name' => 'filter[]', 'selected' => $filter, 'return' => true, 'required' => true, 'privilege' => 'AR', 'multiple' => true, ] ); break; case 1: echo '

'.__('Tag').'

'; if (tags_has_user_acl_tags($config['id_user']) === false) { echo html_print_select_from_sql( 'SELECT id_tag, name FROM ttag WHERE id_tag ORDER BY name', 'filter[]', $filter, '', '', '', true, true, false, false, 'width: 200px', '5' ); } else { $user_tags = tags_get_user_tags($config['id_user'], 'AR'); if (!empty($user_tags)) { $id_user_tags = array_keys($user_tags); echo html_print_select_from_sql( 'SELECT id_tag, name FROM ttag WHERE id_tag IN ('.implode(',', $id_user_tags).') ORDER BY name', 'filter[]', $filter, '', '', '', true, true, false, false, 'width: 200px', '5' ); } else { echo html_print_select_from_sql( 'SELECT id_tag, name FROM ttag WHERE id_tag ORDER BY name', 'filter[]', $filter, '', '', '', true, true, false, false, 'width: 200px', '5' ); } } break; case 2: echo '

'.__('Module group').'

'; echo html_print_select_from_sql( 'SELECT id_mg, name FROM tmodule_group ORDER BY name', 'filter[]', $filter, '', __('Not assigned'), '0', true, true, true, false, 'width: 200px', '5' ); break; } echo '
'; } if ($getInfo === true) { enterprise_include_once('include/functions_agents.php'); $id = get_parameter('id', 0); switch ($type) { case 2: $data = db_get_row('tagente_modulo', 'id_agente_modulo', $id); // Nombre. $link = sprintf( 'index.php?sec=view&sec2=operation/agentes/status_monitor%s&ag_modulename=%s', '&refr=0&ag_group=0&module_option=1&status=-1', $data['nombre'] ); echo '
'; echo '

'.__('Module name').'

'; echo ''.$data['nombre'].''; echo '
'; // Descripcion. $description = (empty($data['descripcion']) === true) ? '-' : $data['descripcion']; echo '
'; echo '

'.__('Description').'

'; echo '

'.$description.'

'; echo '
'; // Agent. echo '
'; echo '

'.__('Agent').'

'; echo ''.agents_get_alias($data['id_agente']).''; echo '
'; // Group. $group = (empty($data['id_module_group']) === true) ? '-' : modules_get_modulegroup_name($data['id_module_group']); echo '
'; echo '

'.__('Module group').'

'; echo '

'.$group.'

'; echo '
'; break; case 1: $data = db_get_row('tagente_modulo', 'id_agente_modulo', $id); // Nombre. $link = sprintf( 'index.php?sec=view&sec2=operation/agentes/status_monitor%s&ag_modulename=%s', '&refr=0&ag_group=0&module_option=1&status=-1', $data['nombre'] ); echo '
'; echo '

'.__('Module name').'

'; echo ''.$data['nombre'].''; echo '
'; // Descripcion. $description = (empty($data['descripcion']) === true) ? '-' : $data['descripcion']; echo '
'; echo '

'.__('Description').'

'; echo '

'.$description.'

'; echo '
'; // Agent. echo '
'; echo '

'.__('Agent').'

'; echo ''.agents_get_alias($data['id_agente']).''; echo '
'; // Group. $group = (empty($data['id_module_group']) === true) ? '-' : modules_get_modulegroup_name($data['id_module_group']); echo '
'; echo '

'.__('Module group').'

'; echo '

'.$group.'

'; echo '
'; // Tag. $tags = db_get_all_rows_sql('SELECT id_tag FROM ttag_module WHERE id_agente_modulo ='.$id); $tags_name = ''; echo '
'; echo '

'.__('Tag').'

'; foreach ($tags as $key => $tag) { $tags_name .= tags_get_name($tag['id_tag']).', '; } $tags_name = trim($tags_name, ', '); echo '

'.$tags_name.'

'; echo '
'; break; case 0: default: $data = agents_get_agent($id); // Alias. echo '
'; echo '

'.__('Agent').'

'; echo ''.$data['alias'].''; echo '
'; // Ip. echo '
'; echo '

'.__('IP').'

'; echo '

'.$data['direccion'].'

'; echo '
'; // OS. echo '
'; echo '

'.__('OS').'

'; echo '

'.ui_print_os_icon($data['id_os'], true, true).'

'; echo '
'; // Description. echo '
'; echo '

'.__('Description').'

'; echo '

'.$data['comentarios'].'

'; echo '
'; // Group. $secondary_groups = ''; $secondary = agents_get_secondary_groups($data['id_agente']); if (isset($secondary['for_select']) === true && empty($secondary['for_select']) === false) { $secondary_groups = implode(', ', $secondary['for_select']); $secondary_groups = ', '.$secondary_groups; } echo '
'; echo '

'.__('Group').'

'; echo '

'.groups_get_name($data['id_grupo']).$secondary_groups.'

'; echo '
'; // Events. echo '
'; echo graph_graphic_agentevents( $id, 100, 40, SECONDS_1DAY, '', true, false, false, 1 ); echo '
'; break; } } return; }