排查 Linux 更新代理问题Troubleshoot Linux update agent issues

在进行更新管理时计算机未显示为已就绪(正常),这可能有多种原因。There can be many reasons why your machine isn't showing up as ready (healthy) in Update Management. 你可以检查 Linux 混合 Runbook 辅助角色代理的运行状况,以确定潜在问题。You can check the health of a Linux Hybrid Runbook Worker agent to determine the underlying problem. 以下是计算机的三种就绪状态:The following are the three readiness states for a machine:

  • 迁移就绪性:已部署混合 Runbook 辅助角色,并且上次访问它的时间距当前时间不到一小时。Ready: The Hybrid Runbook Worker is deployed and was last seen less than one hour ago.
  • 已断开连接:已部署混合 Runbook 辅助角色,并且上次访问它的时间距当前时间超过一小时。Disconnected: The Hybrid Runbook Worker is deployed and was last seen over one hour ago.
  • 未配置:混合 Runbook 辅助角色找不到或尚未完成部署。Not configured: The Hybrid Runbook Worker isn't found or hasn't finished deployment.

备注

Azure 门户显示的内容和计算机的当前状态之间可能会些微延迟。There can be a slight delay between what the Azure portal shows and the current state of a machine.

本文介绍如何从 Azure 门户为 Azure 计算机运行故障排除,以及如何为离线场景下的非 Azure 计算机运行故障排除。This article discusses how to run the troubleshooter for Azure machines from the Azure portal and non-Azure machines in the offline scenario.

备注

如果配置了代理服务器,则故障排除脚本当前不会通过它路由流量。The troubleshooter script currently doesn't route traffic through a proxy server if one is configured.

启动“故障排除”Start the troubleshooter

对于 Azure 计算机,请选择门户中“更新代理准备”列下的“故障排除”链接,以打开“排除更新代理故障”页 。For Azure machines, select the troubleshoot link under the Update Agent Readiness column in the portal to open the Troubleshoot Update Agent page. 对于非 Azure 计算机,该链接会转到本文。For non-Azure machines, the link brings you to this article. 若要对非 Azure 计算机进行故障排除,请参阅“脱机进行故障排除”部分中的说明。To troubleshoot a non-Azure machine, see the instructions in the "Troubleshoot offline" section.

VM 列表页

备注

检查要求 VM 处于运行状态。The checks require the VM to be running. 如果 VM 没有运行,则会显示“启动 VM”。If the VM isn't running, Start the VM appears.

在“排除更新代理故障”页上,选择“运行检查”,启动故障排除。On the Troubleshoot Update Agent page, select Run Checks to start the troubleshooter. 故障排除将使用运行命令在计算机上运行脚本,以验证依赖项。The troubleshooter uses Run command to run a script on the machine to verify the dependencies. 完成故障排除时,它会返回检查的结果。When the troubleshooter is finished, it returns the result of the checks.

故障排除页

检查完成后,在窗口中将返回结果。When the checks are finished, the results are returned in the window. 检查部分提供了每项检查所要查找的内容相关信息。The check sections provide information on what each check is looking for.

更新代理检查页

先决条件检查Prerequisite checks

操作系统Operating system

操作系统检查将验证混合 Runbook 辅助角色是否正在运行以下操作系统之一。The operating system check verifies if the Hybrid Runbook Worker is running one of the following operating systems.

操作系统Operating system 说明Notes
CentOS 6 (x86/x64) 和 7 (x64)CentOS 6 (x86/x64) and 7 (x64) Linux 代理必须具有访问更新存储库的权限。Linux agents must have access to an update repository. 基于分类的修补需要借助“yum”来返回 CentOS 当前没有的安全数据。Classification-based patching requires 'yum' to return security data, which CentOS doesn't have out of the box.
Red Hat Enterprise 6 (x86/x64) 和 7 (x64)Red Hat Enterprise 6 (x86/x64) and 7 (x64) Linux 代理必须具有访问更新存储库的权限。Linux agents must have access to an update repository.
SUSE Linux Enterprise Server 11 (x86/x64) 和 12 (x64)SUSE Linux Enterprise Server 11 (x86/x64) and 12 (x64) Linux 代理必须具有访问更新存储库的权限。Linux agents must have access to an update repository.
Ubuntu 14.04 LTS、16.04 LTS 和 18.04 LTS (x86/x64)Ubuntu 14.04 LTS, 16.04 LTS, and 18.04 LTS (x86/x64) Linux 代理必须具有访问更新存储库的权限。Linux agents must have access to an update repository.

监视代理服务运行状况检查Monitoring agent service health checks

Log Analytics 代理Log Analytics agent

此检查可确保已安装适用于 Linux 的 Log Analytics 代理。This check ensures that the Log Analytics agent for Linux is installed. 有关如何安装的说明,请参阅安装适用于 Linux 的代理For instructions on how to install it, see Install the agent for Linux.

Log Analytics 代理状态Log Analytics agent status

此检查可确保适用于 Linux 的 Log Analytics 代理正在运行。This check ensures that the Log Analytics agent for Linux is running. 如果该代理未在运行,则可以运行以下命令尝试重启该代理。If the agent isn't running, you can run the following command to attempt to restart it. 有关对该代理进行故障排除的详细信息,请参阅 Linux - 排查混合 Runbook 辅助角色问题For more information on troubleshooting the agent, see Linux - Troubleshoot Hybrid Runbook Worker issues.

sudo /opt/microsoft/omsagent/bin/service_control restart

多宿主Multihoming

此检查可确定代理是否向多个工作区报告。This check determines if the agent is reporting to multiple workspaces. 更新管理不支持多宿主。Update Management doesn't support multihoming.

混合 Runbook 辅助角色Hybrid Runbook Worker

此检查可验证适用于 Linux 的 Log Analytics 代理是否拥有混合 Runbook 辅助角色包。This check verifies if the Log Analytics agent for Linux has the Hybrid Runbook Worker package. 更新管理需要此包才能工作。This package is required for Update Management to work. 若要了解详细信息,请参阅适用于 Linux 的 Log Analytics 代理未运行To learn more, see Log Analytics agent for Linux isn't running.

更新管理将从操作终结点下载混合 Runbook 辅助角色包。Update Management downloads Hybrid Runbook Worker packages from the operations endpoint. 因此,如果混合 Runbook 辅助角色未运行,并且操作终结点检查失败,则更新可能会失败。Therefore, if the Hybrid Runbook Worker is not running and the operations endpoint check fails, the update can fail.

混合 Runbook 辅助角色状态Hybrid Runbook Worker status

此检查可确保混合 Runbook 辅助角色在计算机上运行。This check makes sure the Hybrid Runbook Worker is running on the machine. 如果混合 Runbook 辅助角色正常运行,则应存在以下示例中的进程。The processes in the example below should be present if the Hybrid Runbook Worker is running correctly.

nxautom+   8567      1  0 14:45 ?        00:00:00 python /opt/microsoft/omsconfig/modules/nxOMSAutomationWorker/DSCResources/MSFT_nxOMSAutomationWorkerResource/automationworker/worker/main.py /var/opt/microsoft/omsagent/state/automationworker/oms.conf rworkspace:<workspaceId> <Linux hybrid worker version>
nxautom+   8593      1  0 14:45 ?        00:00:02 python /opt/microsoft/omsconfig/modules/nxOMSAutomationWorker/DSCResources/MSFT_nxOMSAutomationWorkerResource/automationworker/worker/hybridworker.py /var/opt/microsoft/omsagent/state/automationworker/worker.conf managed rworkspace:<workspaceId> rversion:<Linux hybrid worker version>
nxautom+   8595      1  0 14:45 ?        00:00:02 python /opt/microsoft/omsconfig/modules/nxOMSAutomationWorker/DSCResources/MSFT_nxOMSAutomationWorkerResource/automationworker/worker/hybridworker.py /var/opt/microsoft/omsagent/<workspaceId>/state/automationworker/diy/worker.conf managed rworkspace:<workspaceId> rversion:<Linux hybrid worker version>

连接性检查Connectivity checks

一般 Internet 连接General internet connectivity

此检查可确保计算机拥有 Internet 访问权限。This check makes sure that the machine has access to the internet.

注册终结点Registration endpoint

此检查可确定混合 Runbook 辅助角色是否可以与 Log Analytics 工作区中的 Azure 自动化正确通信。This check determines if the Hybrid Runbook Worker can properly communicate with Azure Automation in the Log Analytics workspace.

代理和防火墙配置必须允许混合 Runbook 辅助角色代理与注册终结点通信。Proxy and firewall configurations must allow the Hybrid Runbook Worker agent to communicate with the registration endpoint. 有关要打开的地址和端口的列表,请参阅网络规划For a list of addresses and ports to open, see Network planning.

操作终结点Operations endpoint

此检查可确定 Log Analytics 代理是否可以与作业运行时数据服务正确通信。This check determines if the Log Analytics agent can properly communicate with the Job Runtime Data Service.

代理和防火墙配置必须允许混合 Runbook 辅助角色代理与作业运行时数据服务通信。Proxy and firewall configurations must allow the Hybrid Runbook Worker agent to communicate with the Job Runtime Data Service. 有关要打开的地址和端口的列表,请参阅网络规划For a list of addresses and ports to open, see Network planning.

Log Analytics 终结点 1Log Analytics endpoint 1

此检查会验证计算机是否可以访问 Log Analytics 代理所需的终结点。This check verifies that your machine has access to the endpoints needed by the Log Analytics agent.

Log Analytics 终结点 2Log Analytics endpoint 2

此检查会验证计算机是否可以访问 Log Analytics 代理所需的终结点。This check verifies that your machine has access to the endpoints needed by the Log Analytics agent.

Log Analytics 终结点 3Log Analytics endpoint 3

此检查会验证计算机是否可以访问 Log Analytics 代理所需的终结点。This check verifies that your machine has access to the endpoints needed by the Log Analytics agent.

脱机进行故障排除Troubleshoot offline

可以通过在本地运行脚本,在混合 Runbook 辅助角色上脱机使用故障排除。You can use the troubleshooter offline on a Hybrid Runbook Worker by running the script locally. Python 脚本 update_mgmt_health_check.py 可在脚本中心内找到。The Python script, update_mgmt_health_check.py, can be found in Script Center. 以下示例显示了此脚本的输出示例:An example of the output of this script is shown in the following example:

Debug: Machine Information:   Static hostname: LinuxVM2
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 00000000000000000000000000000000
           Boot ID: 00000000000000000000000000000000
    Virtualization: microsoft
  Operating System: Ubuntu 16.04.5 LTS
            Kernel: Linux 4.15.0-1025-azure
      Architecture: x86-64


Passed: Operating system version is supported

Passed: Microsoft Monitoring agent is installed

Debug: omsadmin.conf file contents:
        WORKSPACE_ID=00000000-0000-0000-0000-000000000000
        AGENT_GUID=00000000-0000-0000-0000-000000000000
        LOG_FACILITY=local0
        CERTIFICATE_UPDATE_ENDPOINT=https://00000000-0000-0000-0000-000000000000.oms.opinsights.azure.cn/ConfigurationService.Svc/RenewCertificate
        URL_TLD=opinsights.azure.cn
        DSC_ENDPOINT=https://scus-agentservice-prod-1.azure-automation.cn/Accounts/00000000-0000-0000-0000-000000000000/Nodes\(AgentId='00000000-0000-0000-0000-000000000000'\)
        OMS_ENDPOINT=https://00000000-0000-0000-0000-000000000000.ods.opinsights.azure.cn/OperationalData.svc/PostJsonDataItems
        AZURE_RESOURCE_ID=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myresourcegroup/providers/microsoft.compute/virtualmachines/linuxvm2
        OMSCLOUD_ID=0000-0000-0000-0000-0000-0000-00
        UUID=00000000-0000-0000-0000-000000000000


Passed: Microsoft Monitoring agent is running

Passed: Machine registered with log analytics workspace:['00000000-0000-0000-0000-000000000000']

Passed: Hybrid worker package is present

Passed: Hybrid worker is running

Passed: Machine is connected to internet

Passed: TCP test for {scus-agentservice-prod-1.azure-automation.cn} (port 443) succeeded

Passed: TCP test for {eus2-jobruntimedata-prod-su1.azure-automation.cn} (port 443) succeeded

Passed: TCP test for {00000000-0000-0000-0000-000000000000.ods.opinsights.azure.cn} (port 443) succeeded

Passed: TCP test for {00000000-0000-0000-0000-000000000000.oms.opinsights.azure.cn} (port 443) succeeded

Passed: TCP test for {ods.systemcenteradvisor.com} (port 443) succeeded

后续步骤Next steps

排查混合 Runbook 辅助角色问题Troubleshoot Hybrid Runbook Worker issues.