'.html_print_image( 'images/eye_show.png', true, [ 'title' => __('View'), 'class' => 'invert_filter', ] ).''; $viewtab['operation'] = true; $viewtab['active'] = false; $onheader = ['view' => $viewtab]; // Header. ui_print_standard_header( __('Agents defined in %s', get_product_name()), 'images/agent.png', false, '', true, $onheader, [ [ 'link' => '', 'label' => __('Resources'), ], [ 'link' => '', 'label' => __('Manage agents'), ], ] ); if (is_management_allowed() === false) { if (is_metaconsole() === false) { $url = ''.__('metaconsole').''; } else { $url = __('any node'); } ui_print_warning_message( __( 'This node is configured with centralized mode. Go to %s to delete an agent', $url ) ); } // Perform actions. $agent_to_delete = (int) get_parameter('borrar_agente'); $enable_agent = (int) get_parameter('enable_agent'); $disable_agent = (int) get_parameter('disable_agent'); if ($disable_agent != 0) { $server_name = db_get_row_sql( 'select server_name from tagente where id_agente = '.$disable_agent ); } else if ($enable_agent != 0) { $server_name = db_get_row_sql( 'select server_name from tagente where id_agente = '.$enable_agent ); } $result = null; if ($agent_to_delete) { $id_agente = $agent_to_delete; if (check_acl_one_of_groups( $config['id_user'], agents_get_all_groups_agent($id_agente), 'AW' ) ) { $id_agentes[0] = $id_agente; $result = agents_delete_agent($id_agentes); } else { // NO permissions. db_pandora_audit( AUDIT_LOG_ACL_VIOLATION, "Trying to delete agent \'".agents_get_name($id_agente)."\'" ); include 'general/noaccess.php'; exit; } ui_print_result_message( $result, __('Success deleted agent.'), __('Could not be deleted.') ); if (enterprise_installed()) { // Check if the remote config file still exist. if (isset($config['remote_config'])) { enterprise_include_once( 'include/functions_config_agents.php' ); if (enterprise_hook( 'config_agents_has_remote_configuration', [$id_agente] ) ) { ui_print_error_message( __('Maybe the files conf or md5 could not be deleted') ); } } } } if ($enable_agent) { $result = db_process_sql_update( 'tagente', ['disabled' => 0], ['id_agente' => $enable_agent] ); $alias = io_safe_output(agents_get_alias($enable_agent)); if ($result) { // Update the agent from the metaconsole cache. enterprise_include_once('include/functions_agents.php'); $values = ['disabled' => 0]; enterprise_hook( 'agent_update_from_cache', [ $enable_agent, $values, $server_name, ] ); enterprise_hook( 'config_agents_update_config_token', [ $enable_agent, 'standby', 0, ] ); db_pandora_audit( AUDIT_LOG_AGENT_MANAGEMENT, 'Enable '.$alias ); } else { db_pandora_audit( AUDIT_LOG_AGENT_MANAGEMENT, 'Fail to enable '.$alias ); } ui_print_result_message( $result, __('Successfully enabled'), __('Could not be enabled') ); } if ($disable_agent) { $result = db_process_sql_update('tagente', ['disabled' => 1], ['id_agente' => $disable_agent]); $alias = io_safe_output(agents_get_alias($disable_agent)); if ($result) { // Update the agent from the metaconsole cache. enterprise_include_once('include/functions_agents.php'); $values = ['disabled' => 1]; enterprise_hook( 'agent_update_from_cache', [ $disable_agent, $values, $server_name, ] ); enterprise_hook( 'config_agents_update_config_token', [ $disable_agent, 'standby', 1, ] ); db_pandora_audit( AUDIT_LOG_AGENT_MANAGEMENT, 'Disable '.$alias ); } else { db_pandora_audit( AUDIT_LOG_AGENT_MANAGEMENT, 'Fail to disable '.$alias ); } ui_print_result_message( $result, __('Successfully disabled'), __('Could not be disabled') ); } echo "
'.__('Agent name').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectNameUp, $selectNameDown).' | '; echo "".__('R').ui_get_sorting_arrows($url_up_remote, $url_down_remote, $selectRemoteUp, $selectRemoteDown).' | '; echo ''.__('OS').ui_get_sorting_arrows($url_up_os, $url_down_os, $selectOsUp, $selectOsDown).' | '; echo ''.__('Type').' | '; echo ''.__('Group').ui_get_sorting_arrows($url_up_group, $url_down_group, $selectGroupUp, $selectGroupDown).' | '; echo ''.__('Description').' | '; echo "".__('Actions').' | '; echo '
---|---|---|---|---|---|---|
"; if ($agent['disabled']) { echo ''; } echo ''; echo ''; if ($check_aw) { $main_tab = 'main'; } else { $main_tab = 'module'; } if ($agent['alias'] == '') { $agent['alias'] = $agent['nombre']; } if ($agent['id_os'] == CLUSTER_OS_ID) { if (enterprise_installed()) { $cluster = PandoraFMS\Enterprise\Cluster::loadFromAgentId( $agent['id_agente'] ); $url = 'index.php?sec=reporting&sec2='.ENTERPRISE_DIR; $url .= '/operation/cluster/cluster'; $url = ui_get_full_url( $url.'&op=update&id='.$cluster->id() ); echo ''.ui_print_truncate_text($agent['alias'], 'agent_medium').''; } } else { echo '".''.ui_print_truncate_text($agent['alias'], 'agent_medium').''.''; } echo ''; $in_planned_downtime = db_get_sql( 'SELECT executed FROM tplanned_downtime INNER JOIN tplanned_downtime_agents ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime WHERE tplanned_downtime_agents.id_agent = '.$agent['id_agente'].' AND tplanned_downtime.executed = 1' ); if ($agent['disabled']) { ui_print_help_tip(__('Disabled')); if (!$in_planned_downtime) { echo ''; } } if ($agent['quiet']) { echo ' '; html_print_image( 'images/dot_blue.png', false, [ 'border' => '0', 'title' => __('Quiet'), 'alt' => '', ] ); } if ($in_planned_downtime) { ui_print_help_tip( __('Agent in scheduled downtime'), false, 'images/minireloj-16.png' ); echo ''; } echo ' '; echo ' | '; echo ""; // Has remote configuration ? if (enterprise_installed()) { enterprise_include_once('include/functions_config_agents.php'); if (enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']])) { echo ""; echo html_print_image( 'images/application_edit.png', true, [ 'align' => 'middle', 'title' => __('Edit remote config'), 'class' => 'invert_filter', ] ); echo ''; } } echo ' | '; // Operating System icon. echo ""; ui_print_os_icon($agent['id_os'], false); echo ' | '; // Type agent (Networt, Software or Satellite). echo ""; echo ui_print_type_agent_icon( $agent['id_os'], $agent['ultimo_contacto_remoto'], $agent['ultimo_contacto'], $agent['remote'], $agent['agent_version'] ); echo ' | '; // Group icon and name. echo "".ui_print_group_icon($agent['id_grupo'], true).' | '; // Description. echo "".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[…]').' | '; // Action // When there is only one element in page it's necesary go back page. if ((count($agents) == 1) && ($offset >= $config['block_size'])) { $offsetArg = ($offset - $config['block_size']); } else { $offsetArg = $offset; } echo ""; if ($agent['disabled']) { echo "'; } else { echo ' onClick="if (!confirm(\' '.__('You are going to enable a cluster agent. Are you sure?').'\')) return false;">'; } echo html_print_image('images/lightbulb_off.png', true, ['alt' => __('Enable agent'), 'title' => __('Enable agent'), 'class' => 'filter_none']).''; } else { echo "'; } else { echo ' onClick="if (!confirm(\' '.__('You are going to disable a cluster agent. Are you sure?').'\')) return false;">'; } echo html_print_image('images/lightbulb.png', true, ['alt' => __('Disable agent'), 'title' => __('Disable agent'), 'class' => 'invert_filter']).''; } if ($check_aw && is_management_allowed() === true) { echo "'; } else { echo ' onClick="if (!confirm(\' '.__('WARNING! - You are going to delete a cluster agent. Are you sure?').'\')) return false;">'; } echo html_print_image('images/cross.png', true, ['border' => '0', 'class' => 'invert_filter']).''; } echo ' | '; } echo '
"; } else { ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]); } if (check_acl($config['id_user'], 0, 'AW')) { // Create agent button. echo ' | '; } echo '